I am unable to generate an interrupt on INT2 pin. But I can generate an interrupt with the same configuration on INT1 pin. Seems like I am missing something obvious or the datasheet is missing something crucial!!
I am trying to detect a 180-degree flip from Z-axis. On a flat surface, Z-axis pointing upwards gives me approx +1g (decimal 65 with FS = 2). 180 flip will give me a negative value. Here is the configuration that worked on INT1 pin.
- CTRL_REG1 = 0x5F // ODR = 100Hz, LPen = 1, All axis enabled
- CTRL_REG2 = 0x42 // Reference filtering, Filter data for AOI function on interrupt 2
- REFERENCE = 50 // Taking the z-axis value close to 15
- CTRL_REG3 = 0x20 // IA2 interrupt on INT1
- CTRL_REG5 = 0x08 // Latch for INT1
- CTRL_REG6 = 0
- INT2_THS = 100 // A 180-degree flip gives me around -112 with REFERENCE 50
- INT2_DURATION = 50 // 500ms with ODR=100Hz
- INT2_CFG = 0x20 // Interrupt enable for High on Z-axis
With above configuration, I can detect the interrupt on INT1 pin. For INT2 pin I changed,
- CTRL_REG3 = 0
- CTRL_REG5 = 0x02 // Latch for INT2
- CTRL_REG6 = 0x20 // IA2 interrupt on INT2 pin
...and I don't receive any interrupt. I just redirected the pin. This should work. Unless I am missing something obvious. Any help will be much appreciated.