2018-07-31 06:28 AM
Hi,
I am trying to get lsm303c output an "active low" interrupt on pin INT_XL.
here is my init code:
void LSM303C_AccInit(void)
{
uint8_t result = 0;
ACCELERO_IO_Write(LSM303C_CTRL_REG1_A, 0b00100101); // disable y axis to avoid mg
ACCELERO_IO_Write(LSM303C_CTRL_REG2_A, 0b00000000);
ACCELERO_IO_Write(LSM303C_CTRL_REG3_A, 0b00001000);
ACCELERO_IO_Write(LSM303C_CTRL_REG4_A, 0b00000000);
ACCELERO_IO_Write(LSM303C_CTRL_REG5_A, 0b00000011); //interrupt active low, open-drain
ACCELERO_IO_Write(LSM303C_FIFO_CTRL, 0b01000000); //stream mode,
ACCELERO_IO_Write(LSM303C_IG_CFG1_A, 0b11100010); //y interrupt disabled
ACCELERO_IO_Write(LSM303C_IG_THS_X1_A, 5);
ACCELERO_IO_Write(LSM303C_IG_THS_Y1_A, 5);
ACCELERO_IO_Write(LSM303C_IG_THS_Z1_A, 5);
ACCELERO_IO_Write(LSM303C_IG_DUR1_A, 0b10000001); //interrupt delay
}
The embedded controller's pin is configured as input with weak pull up.
The oscilloscope shows a good interrupt reaction to acceleration, but not as i configured it: the INT_XL is low when no interrupt, but as soon as there is acceleration detected, the signal goes high for about 40ms and then goes back to low again forever.
What am i doing wrong?
Thanks,
Gil
2018-08-13 04:47 AM
Following configuration is not correct:
ACCELERO_IO_Write(LSM303C_IG_CFG1_A, 0b11100010); //y interrupt disabled
Please set the AOI bit to 1 if you want AND combination or to 0 if you want OR and set the
6D bit to 0.