STMicroelectronics / STMems_Linux_IIO_drivers

DISCONTINUED (October 2022): the maintenance for this repository has been discontinued. Please refer to https://github.com/STMicroelectronics/st-mems-android-linux-drivers-iio for the up-to-date drivers repository. This repository contains Linux Kernel (v3.10, v3.14, v3.18, v4.9, v4.14, v4.19) including STMicroelectronics MEMS IIO sensor support
Other
75 stars 42 forks source link

LSM6DS3 linux driver for ODR of higher than 416 Hz #7

Closed wesedens closed 3 years ago

wesedens commented 3 years ago

Hello STM,

looking the the mainline kernel for the IMU line and the kernels contained here, i see some comments in the code that say the only supported ODRs are that of up to 416 Hz. is it possible to run the sensor in high performance mode with a linux driver? Is there a patchset that provides support for this or is this something that is unsupported with linux? would it be as easy as extending the ODR table definitions or would it be more complex? i'm specifically interested in both gyro and accel at 1.6 KHz or accel only at 6.66 KHz.

mainline kernel https://elixir.bootlin.com/linux/v5.12-rc8/source/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c#L18

custom STM kernel https://github.com/STMicroelectronics/STMems_Linux_IIO_drivers/blob/linux-4.4.y-gh/drivers/iio/imu/st_lsm6ds3/st_lsm6ds3_core.c#L61

thanks, wes

Screen Shot 2021-04-29 at 10 08 56 AM
mariotesi commented 3 years ago

Hi,

To extends the support to upper ODR you just need to increase the ST_LSM6DS3_ODR_LIST_NUM values

define ST_LSM6DS3_ODR_LIST_NUM

define ST_LSM6DS3_ODR_833HZ_VAL 0x07

define ST_LSM6DS3_ODR_1660HZ_VAL 0x08

.......

and add new entries to st_lsm6ds3_odr_table:

.odr_avl[6] = { .hz = 833, .value = ST_LSM6DS3_ODR_833HZ_VAL }, .odr_avl[7] = { .hz = 1660, .value = ST_LSM6DS3_ODR_1660HZ_VAL }, .......

Anyway we do not suggest to increase too much the ODR due to the excessive CPU consumption that would result