2020-07-11 03:23 PM
Hello Team ST, Sensor: LIS2DH12
our application needs to detect motion activity. Since it is not time critical, we want to check this by reading the (latched) activity of INT2.
I can see the motion activirty on the INT2-pin, but I can NEVER see it on INT2_RRC (35h).
(CTRL_REG5 (24h)LIR_INT2 is set and CTRL_REG6(25h). I2_ACT and I2_IA2 too)
I have checked the datasheet and aAN5005 very carfully, but I have no idea what is wrong.
Thanks in advance for your help!
Juergen
Solved! Go to Solution.
2020-07-16 04:03 AM
Hi Juergen, but are you maybe enabling the motion activity interrupt as a "software interrupt 1", but you want to drive this interrupt on INT2 physical pad? If so, you should check a pseudocode similar to the below one:
Write 20h into CTRL_REG3 // Interrupt activity 1 driven to INT2 pad
Write 00h into CTRL_REG4 // FS = ±2 g
Write 02h into CTRL_REG5 // Interrupt 2 pin latched
Write 10h into INT2_THS // Threshold = 250 mg
Write 00h into INT2_DURATION // Duration = 0
Write 0Ah into INT1_CFG // Enable XH and YH interrupt generation
Poll INT2 pad; if INT2=0 then go to 8 // Poll DRDY/INT2 pin waiting for the // wake-up event
Read INT2_SRC // Return the event that has triggered the interrupt
(Wake-up event has occurred; insert your code here) // Event handling
Regards
2020-07-16 04:03 AM
Hi Juergen, but are you maybe enabling the motion activity interrupt as a "software interrupt 1", but you want to drive this interrupt on INT2 physical pad? If so, you should check a pseudocode similar to the below one:
Write 20h into CTRL_REG3 // Interrupt activity 1 driven to INT2 pad
Write 00h into CTRL_REG4 // FS = ±2 g
Write 02h into CTRL_REG5 // Interrupt 2 pin latched
Write 10h into INT2_THS // Threshold = 250 mg
Write 00h into INT2_DURATION // Duration = 0
Write 0Ah into INT1_CFG // Enable XH and YH interrupt generation
Poll INT2 pad; if INT2=0 then go to 8 // Poll DRDY/INT2 pin waiting for the // wake-up event
Read INT2_SRC // Return the event that has triggered the interrupt
(Wake-up event has occurred; insert your code here) // Event handling
Regards
2020-07-16 07:44 AM
Hello Elon,
thank you very much for your reply! Yes, that seems to work. I can see the IRQs in the _SRC-register now.
I think the Accelerometer is used in many applications this way, maybe a few hints in the datasheet would be helpful for many users.
Best regards,
Juergen