Cannot configure INT_XL pin to "active low" with lsm303c

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

Hello, Gil.

Unfortunately, we do not have much experience using the interrupt registers on the LSM303C (we also do not carry any products based on the LSM303C). You might try posting on ST’s forum.

-Jon

Hi Jon,

Since LSM303DLH is the “oldest” brother of LSM303C and their specification are very similar, it would really help me if you have the knowledge how to config an “active low” acceleration interrupt in LSM303DLH.

Best Regards,
Gil

Hi, Gil.

I took a look at your register settings and one thing stood out to me. It looks like you have the AOI and 6D bits in LSM303C_IG_CFG1_A set, and they probably should not be. I didn’t see any explanation of those two bits in the LSM303C datasheet, but this part of the LSM303D datasheet should help explain them:

Also, is your accelerometer oriented with the Y axis vertical in the rest state? If not, gravity could be triggering the interrupt most or all of the time. You have a pretty low threshold set, so even tilting the accelerometer a small amount could be enough to exceed that threshold on one axis.

Kevin

Hi Kevin,

Setting AOIbit =1 and 6D bit =0 did the job. Great!!! Thanks for that.

Regarding the accelerometer threshold - yes i know, its very sensitive, but i will set it more accurately according to the application needs later on.

Regarding Y axis, you are right, it is perpendicular to the floor and might trigger an interrupt, but i have disabled the Y axis in CTRL_REG1_A and disabled YHIE and YLIE in IG_CFG1_A

So i dont get interrupt there.

Best Regards,

Gil