cancel
Showing results for 
Search instead for 
Did you mean: 

LSM9DS1 reading values Linux

Angel1
Associate II
Posted on December 05, 2017 at 16:41

Hello,

We have added LSM9DS1 to our design. We used linux 4.4.19 and we have added drivers got from

https://github.com/STMicroelectronics/STMems_Linux_IIO_drivers

We use SPI, modules are loaded fine and LSM9DS1 is detected (both accel/gyro and magnetometer chip selects).

My questions is, is there any public API or example program for linux user space, for reading data or changing LSM9DS1 configuration?

Thanks a lot for your help.

Best regards

Angel

1 REPLY 1
Miroslav BATEK
ST Employee
Posted on December 11, 2017 at 13:19

On public repository there are libraries (most popular is

https://github.com/torvalds/linux/tree/master/tools/iio

) that allow

access to iio sensor device through sysfs. A very simple example on how to use that library is iio_generic_buffer tool.

Another interesting library developed by Intel under Apache License is

https://github.com/01org/android-iio-sensors-hal

, it uses

Android sensor HAL.

In any case from linux user space is possible to access to iio sensors data and configuration through sysfs in a very simple fashion

by using file exported by linux device driver (see more in

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/ABI/testing/sysfs-bus-iio

).