cancel
Showing results for 
Search instead for 
Did you mean: 

LSM303C gives zero output values

NVell
Associate II

Hi,

I am trying to read acceleration values from ;SM303C using a MCU. The output values are always zero, even for acceleration in z-axis when the module is at rest. I made sure that LSM303C is not in power down mode by setting CTRL_REG1_A (20h) to 0x6F. Please help. Here is my code:

void IMU_State (void)

{

U8 array[1] = {0x2C};

U8 array2[1] = {0x2D};

U8 array_write[2];

int SMB_DATA_WRITE_INDEX;

SMB_DATA_WRITE_INDEX = 0;

array_write[SMB_DATA_WRITE_INDEX++] = 0x20;

array_write[SMB_DATA_WRITE_INDEX++] = 0x6F;

SMB_DATA_OUT = array_write;

TARGET = 0x3A;  /

SMB_Write();

SMB_DATA_OUT = array;

TARGET = 0x3A;  

SMB_Write();

SMB_Read();

SMB_DATA_OUT = array2;

TARGET = 0x3A;  

SMB_Write();

SMB_Read();

}

3 REPLIES 3
Miroslav BATEK
ST Employee

Are you able to read back the sensor configuration and WHO_AM_I register?

NVell
Associate II

I am able to read back WHO_AM_I register correctly. However, the sensor configuration register returns a value of 0xFF even though I write a value of 0x6F. Whatever value I write, it reads back 0xFF. Here is the code for sensor configuration register:

void IMU (void)

{

U8 status[1] = {0x20};

SMB_DATA_OUT = status;

TARGET = 0x3A;  

SMB_Write();

SMB_Read();

}

Please help.

Miroslav BATEK
ST Employee

Is the WHO_AM_I value(s) correct? In line with datasheet?