2025-09-18 2:43 PM
Hi
We are testing out the lsm6dsv320x, which will be used on our new board.
The low G accelerometer is working fine, however the high G looks to be reporting wrong values.
If I use a simple calculation to computer the angles, the high G is off by about 3-4 degrees
This is the formula i use to calculate the angles
AccXangle = (math.atan2(ACCy,ACCz)*RAD_TO_DEG)
AccYangle = (math.atan2(ACCz,ACCx)+M_PI)*RAD_TO_DEG
Below is an example of the results of both formulas when the sensor is horizontal. The last two columns are for the high G sensor. you can see that it is different from the low G sensor. My expectation is that they should be reporting the same result.
ACCX_angle | ACCY_angle | ACCX_HG_angle | ACCY_HG_angle | |
-0.06 | -0.20 | -4.44 | -4.620 | |
0.03 | -0.17 | -3.67 | -4.120 | |
0.03 | -0.23 | -3.84 | -3.610 | |
-0.03 | -0.17 | -3.61 | -4.240 | |
-0.03 | -0.17 | -2.91 | -5.130 | |
0.03 | -0.20 | -3.50 | -4.240 | |
0.00 | -0.20 | -4.47 | -3.080 | |
0.00 | -0.20 | -3.05 | -5.680 | |
0.03 | -0.20 | -4.15 | -4.380 | |
-0.03 | -0.20 | -3.71 | -3.250 | |
-0.03 | -0.20 | -3.96 | -4.070 | |
0.00 | -0.20 | -2.97 | -4.880 | |
0.00 | -0.23 | -2.94 | -3.790 | |
-0.03 | -0.17 | -2.74 | -3.480 | |
0.00 | -0.20 | -3.70 | -3.760 | |
0.00 | -0.20 | -3.99 | -3.690 | |
-0.03 | -0.23 | -4.56 | -5.360 | |
0.03 | -0.20 | -2.46 | -3.690 | |
0.03 | -0.23 | -3.52 | -4.790 | |
0.00 | -0.20 | -3.15 | -4.010 | |
0.00 | -0.17 | -2.87 | -2.350 | |
-0.03 | -0.20 | -3.75 | -3.750 |
This is how we initialise the sensor
writeByte(LSM6DSV320X_ADDRESS,LSM6DSV320X_CTRL3, 0b01000000) # Block data update
writeByte(LSM6DSV320X_ADDRESS,LSM6DSV320X_CTRL1, 0b00000101) # High performance mode, 60Hz
writeByte(LSM6DSV320X_ADDRESS,LSM6DSV320X_CTRL1_XL_HG, 0b10011000) #Enable high G. 480Hz ODR 32G
writeByte(LSM6DSV320X_ADDRESS,LSM6DSV320X_CTRL8, 0b00000011) # 16G
writeByte(LSM6DSV320X_ADDRESS,LSM6DSV320X_CTRL2,0b00011010) #1.92KHz, high-accuracy ODR mode
writeByte(LSM6DSV320X_ADDRESS,LSM6DSV320X_CTRL6, 0b00000100) # 2000dps