2025-02-08 2:47 PM
I am writing my own library in C++ to operate the LSM6DSO and when the sensor is at rest it reads 0.5 G on the z-axis, I've tried the code with 2 ICs, one in an Adafruit breakout board, and another one in an old PCB that had the sensor soldered one and both got the same error, so I believe that the issue might be in the code, but I can't identify where is the problem. Btw, I am using the dev kit NUH7AZIQ$ATZ3A140012 (STM32H7A3ZIT6Q). Also, when i turn the sensor 90 deg the 0.5g moves to the other axis, and regardless of the range scale I choose, the readings adjust themselves so that it still gives the 0.5 G after applying the conversion factor .
The first line shows the reading from the CTRL1_XL register and breaks it down into the configurations in that register (which in this picture is set up to +-2G range and sampling of Hz)
the second lines show the reading from the OUTZ_L_A (2Ch) and OUTZ_H_A (2Dh) registers, then it combines that into the raw data and multiply by the sensitivity factor suggested in the data sheet for each range ( in this case 0.0061)
Small programs that plots the lsm6dso outputs, as I turned the imu, the 0.5 g readings moved to the other axis
Here is the part of the code, in this section I its not exactly the library i am writing but it has follows the same procedures and gets the same numbers.
2025-03-01 9:58 AM
I fixed the thing you mentioned, and the behaviour of the Gyroscope changed a lot; now it seems to be more sensitive, but I guess it's still within a reasonable range. And it didn't change anything for the accelerometer
Now the ADDR : 0x11 (CTRL2_G) = 0x42
2025-03-03 8:54 AM
No more ideas on what could be wrong. LSM6DSO has been in production for years now and there are no known issues with the HW or with the official standard C drivers.
Last question: did you write to some wrong register address? (there are few undocumented register addresses which hold the factory calibration including the sensitivity and if you happen to write them then the sensor will not behave correctly and calibration will be compromised)
2025-03-04 11:36 AM
Can you double check that you are using LSM6DSO?
If you are using LSM6DSO32 then the '01' full scale bits would correspond to 32g and then the conversion factor would be 0.976 which would give you the right values
2025-03-05 5:25 PM
The ic is on a old breakout board used by our team, so I can't ensure that no one wrote to any unlisted address.
Also, this breakout board was bought from adafruit and its listed as lsm6dsox, which according to their datasheet is the lsm6dso not the lsm6dso32.
2025-03-06 8:47 AM
Understood. The WHO_AM_I register is the same in both cases. However, because we are now sure that configuration is correct because we have read it back, and we are sure that int16 values are read correctly, we can conclude that you are using LSM6DSO32 or LSM6DSO32X.