Hello! To summarize my issue, I have a 6 DOF accelerometer/gyroscope [LSM6DS3TR-C]. I am accessing the sensor using SPI and the Zephyr Sensor API, and my readings are somewhat unstable and slightly incorrect - e.g, when not moving, the sensor's gyroscope measures +/- 0.1 - 0.9 rad/s.
My environment:
- NRF Connect SDK in VSCode - Version 2.1.1
- Zephyr v3.1.99
I'll attach the relevant code, apologies for the length.
Below is my function for creating the SPI device.
I access the sensor data using the Sensor API enums.
Here is my prj.conf:
And finally, my overlay file.
My primary concern is the gyroscope values being non-zero and very jittery when I print out the values. I am aware I'm using the library for the LSM6DSL, but I've compared datasheets with the LSM6DS3TR-C and all the registers and conversions are the exact same. Note that my readings are 'almost' correct, in the sense that I can still read G as ~9.81-10 [m/s^2].
I tested this exact same sensor (Adafruit LSM6DS3TR-C Breakout) in an Arduino environment and using the Adafruit library for both LSM6DSL and LSM6DS3TR-C. Both outputted stable zero values for the stationary gyroscope raw register reads. So the culprit has to be somewhere in my Zephyr implementation.
Is there any advice on what could be going wrong here? Any help is greatly appreciated!