2018-12-15 04:18 PM
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();
}
2018-12-17 01:36 AM
Are you able to read back the sensor configuration and WHO_AM_I register?
2018-12-20 11:49 AM
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.
2019-01-06 04:28 AM
Is the WHO_AM_I value(s) correct? In line with datasheet?