Skip to content
This repository was archived by the owner on Jun 11, 2019. It is now read-only.
This repository was archived by the owner on Jun 11, 2019. It is now read-only.

Read x, y, and z values simultaneously #2

@nvandoorn

Description

@nvandoorn

The current implementation of reading the accelerometer is implemented using the Linux sysfs interface (e.g reading from/sys/bus/i2c/devices/3-0068/iio:device0/in_accel_x_raw). This means that reading x, y, and z requires 3 calls to (f)read which will occur one after the other with some delay in between. This delay will depend on many factors (determined mostly by the Linux scheduler), but it will always be greater than 0. For this reason, there is no guarantee that all three values retrieved from the accelerometer will be from the same moment. This is the same problem David Frey has been working on.

To solve this, we need to retrieve x, y, and z in a single read operation. On top of the sysfs interface, the driver for the BMI160 accelerometer exposes a dev interface at /dev/iio:device0. This interface is a little more complex than simply reading a file, so require some additional software to read from it. This is where libiio comes into play. libiio allows you to read all three values from the accelerometer in one operation. An example of this can be found here using our same accelerometer. Note that libiio is not currently installed on the mangOH so it will need to built and installed at some point (see here).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions