cancel
Showing results for 
Search instead for 
Did you mean: 

LSM303AGR gives weird values output of the accelerometer

Selim Sagir
Associate III

Hi,
I am using examples from the github repo to test accelerometer. I can read device id from both accel and magnetometer. Also I can read back the registers I set.  However, when it comes to read accelerometer, I read same values from all axis of the accelerometer such as A0A0A0 or 808080 and so on. Another behavior I observed is sometimes, boot register stuck as 1 after I use to BOOT bit from CTRL_REG5_A.
Also I read very low values from magnetometer and 0 from temperature sensor.
Is there any idea what is going wrong?

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Federica Bossi ,
I think problem is the auto address incrementation for the multiple reads. Because when I've read the axis out registers one by one, I can see correct values. Also when I changed to LSM303AGR_OUT_X_L_A (0x28) to 0xA8, library function (lsm303agr_temperature_raw_get) also gives correct outcomes
Thanks,
Selim.

View solution in original post

4 REPLIES 4
Federica Bossi
ST Employee

Hi @Selim Sagir ,

Have you made any changes to the examples on github or are you using them as they are loaded?

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi @Federica Bossi ,
I think problem is the auto address incrementation for the multiple reads. Because when I've read the axis out registers one by one, I can see correct values. Also when I changed to LSM303AGR_OUT_X_L_A (0x28) to 0xA8, library function (lsm303agr_temperature_raw_get) also gives correct outcomes
Thanks,
Selim.

Hi @Selim Sagir ,

Ok, so have you found how to solve this issue?

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Yes.