cancel
Showing results for 
Search instead for 
Did you mean: 

LSM303DLHC reading 0x00 when enable both acc & mag

Bogdan
Senior
Posted on August 11, 2014 at 19:30

Hello, recently i started working on a project using LSM303DLHC, i noticed if i enable both

accelerometer and magnetometer, i get 0x00 data.

If i enable only the accelerometer, the data is normal on all three axis registers (6 bytes)

But if i enable both acc and mag Why is this behaviour?

I am using stm32f407vg, i2c1 module, and 400khz baud

Bellow is my initialization routine

void LSM303_init(){

i2c_send_cmd(awAddr, CTRL_REG1_A, 0x27);  //accelerometer into normal operation mode with ODR 50Hz

i2c_send_cmd(awAddr, CTRL_REG4_A, 0x40);  //full scale range ±2 gauss in continuous data update big-endian structure

i2c_send_cmd(awAddr, CRA_REG_M, 0x14); // set magnetometer data rate to 30hz

i2c_send_cmd(awAddr, MR_REG_M, 0x00); // magnetic sensor into continuous mode

}

With a logic analyzer on the i2c bus, i can see that the bus itself works fine, except when i try to read any accelerometer register, the value returned after reading is 0x00 on all axes

Why?
0 REPLIES 0