-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Working with kernel version 5.15.y, I am using the LSM6DSM I2C IIO driver implementation. When the sampling frequency is set to 13Hz (default on startup is 13Hz), the accelerometer values do not update (stay at 0 for X/Y/Z). If I change the frequency to 26 or 52Hz, then the accelerometer data begins to update, and seems to change when acceleration is applied. Changing the sampling frequency back to 13Hz at this point makes the data freeze at the last received value.
Similarly, the gyroscope data seems to change drastically when the setting is at 13Hz. It does not freeze or stay at a value of 0, but the data does not match what is received when the frequency is 26 or 52 Hz.
My current work-around is that on initialization, I have a script that runs to set the proper sampling frequency, but it would be nice for this issue to be tackled at some point.
The issue with the driver source code is not obvious, as a setting of 13Hz should set the ODR bits to 0001b, which is 12.5Hz. I understand the naming convention is limited to the integer value.
What I find strange is that the sampling frequency available lists out:
~# cat /sys/bus/iio/devices/iio\:device1/sampling_frequency_available
12 26 52 104 208 416 833
But the sampling frequency default is:
~# cat /sys/bus/iio/devices/iio\:device1/sampling_frequency
13
Values at 52Hz:
ACCEL: GYRO:
X= -447 X= 117
Y= -467 Y= -217
Z= 16343 Z= -13
Values at 13Hz (on startup):
ACCEL: GYRO:
X= 0 X= 1648
Y= 0 Y= 931
Z= 0 Z= 1625
Lastly, a value that is not acceptable (not in the list of available frequencies) is rejected. This tells me that the failure is not because 13Hz is deemed a "invalid" value.
root@imx6ul-var-dart:~# cat /sys/bus/iio/devices/iio\:device1/sampling_frequency
13
root@imx6ul-var-dart:~# echo 52 > /sys/bus/iio/devices/iio\:device1/sampling_frequency
root@imx6ul-var-dart:~# cat /sys/bus/iio/devices/iio\:device1/sampling_frequency
52
root@imx6ul-var-dart:~# echo 12 > /sys/bus/iio/devices/iio\:device1/sampling_frequency
root@imx6ul-var-dart:~# cat /sys/bus/iio/devices/iio\:device1/sampling_frequency
13
root@imx6ul-var-dart:~# echo 52 > /sys/bus/iio/devices/iio\:device1/sampling_frequency
root@imx6ul-var-dart:~# cat /sys/bus/iio/devices/iio\:device1/sampling_frequency
52
root@imx6ul-var-dart:~# echo 50 > /sys/bus/iio/devices/iio\:device1/sampling_frequency
-sh: echo: write error: Invalid argument
Do you know what could be the cause of this issue?
Thanks,