2021-02-05 09:27 AM
Hello ST Community,
I am using LIS2DH12 sensor for the following purpose:
For this purpose, I have set the registers as follows:
CTRL_REG1 - 0x37
CTRL_REG3 - 0x40
CTRL_REG4 - 0x88
CTRL_REG5 - 0x0A
CTRL_REG6 - 0x28
INT1_THS - 0x0B
INT1_DUR - 0x0B
INT1_CFG - 0x95
INT2_THS - 0x38
INT2_DUR - 0x01
INT2_CFG - 0x2A
ACT_THS - 0x05
ACT_DUR - 0x20
When an interrupt occurs (INT1 or INT2), in the interrupt handler, I read OUT_X, OUT_Y, OUT_Z registers to get the acceleration value. If INT1 occurs, I was expecting the acceleration value to be less than 350 mg but there are cases when the acceleration read is higher than this. Same is the case with INT2. If INT2 interrupt occurs, the read acceleration value is less than 1.7 g in some cases.
Regards,
Anusha
2021-02-10 10:41 PM
Hi Anusha @AB.4 ,
Your configuration looks ok at first glance.
You may try not to latch the interrupts in CTRL_REG5 (24h) configuration and see what happens...
I'm wondering if you are effectively reading the acceleration value that triggered the interrupt when you run your procedure, or you are actually receiving a subsequent value . Especially for the INT2, the interrupt duration is low (1/ODR). I would suggest you to use the device in FIFO mode, so that you can compare some "historical" acceleration values around the interrupt.
You can find and example of FIFO configuration in the application note AN5005, or for demo code you can see the Github example: lis2dh12_read_fifo.c.
-Eleon