cancel
Showing results for 
Search instead for 
Did you mean: 

LSM303AGR: reading acceleration values

Theresa Lichtenberger
Associate II
Posted on February 27, 2018 at 19:50

Hey there, I am currently trying to read some acceleration data with the LSM303AGR via SPI.

In order to do so, I have already set up the SPI and accelerometer and I have accomplished to read

the who_am_i register successfully. But there is something off with the values I am reading from the sensor.

It seems like I am always getting the same, lets say 5, random values, no matter how fast I twist and turn the sensor.

For example, the OUT_X_H_A (29h) always seems to be either 228 or 229. The OUT_X_L_A (28h) register on the other

hand is either 96,160, 0 or 224. It does not matter if I move the sensor. The same szenario applies to the other axes (Y and Z) too, and I cannot explain why. 

I have enabled all axes.

Power-mode-selection is: HR / Normal / Low-power mode (200Hz)

LPen Bit is 0.

I have enabled 3-wire SPI 

BDU Bit is 0 (I have also tested with BDU = 1 --> same result)

Fullscale = +/- 2g

I am also setting the REBOOT Bit ( to reboot the accelerometer memory content) after I have read all axes.

How can I fix this? Thank you for any help in advance!

#lsm303agr #stm32-sensor
1 REPLY 1
Miroslav BATEK
ST Employee
Posted on February 28, 2018 at 18:27

Can you please convert the raw data from registers into g unit value and provide these X, Y, Z values for two board position, when the device is faced by 1g gravity along an axis ?