LIS3DH: INT2_CFG - LIR affects INT2 pin signal when configured for position recognition
I'm trying to figure out if a latched interrupt affects the INT pin signal. I'm working with Arduino. The datasheet says the following on page 44:
AOI-6D = ‘11’ is direction recognition. An interrupt is generated when the orientation is
inside a known zone. The interrupt signal remains while the orientation is inside the zone.
I understand that latched interrupt makes the IA bit on INTx_SRC stay HIGH until i read the register.
But when I enable LIR, this doesn't seem to be true.
Before configuring everything, I reset all the registers to default value.
I configured INT1 without LIR and INT2 with it to check the difference.
I put a LED on each INT pin.
Here's the configuration code:
write_reg(LIS_ADD, CTRL_REG1, 0x97); // 0x97: 1344 Hz, enable XYZ
write_reg(LIS_ADD, CTRL_REG2, 0x00); // 0x00: HP off
write_reg(LIS_ADD, CTRL_REG3, 0x40); // 0x40: IA1 on INT1
write_reg(LIS_ADD, CTRL_REG4, 0x30); // 0x30: 16g
write_reg(LIS_ADD, CTRL_REG5, 0x02); // 0x08: LIR_INT1, 0x02: LIR_INT2
write_reg(LIS_ADD, CTRL_REG6, 0x20); // 0x20: IA2 on INT2
write_reg(LIS_ADD, INT1_CFG, 0xFF); // 0xFF: postion detection XYZ(H+L)
write_reg(LIS_ADD, INT2_CFG, 0xFF); // 0xFF: postion detection XYZ(H+L)
write_reg(LIS_ADD, INT1_THS, 0x02);
write_reg(LIS_ADD, INT1_DURATION, 0x20); // 24 ms (1344 Hz)
write_reg(LIS_ADD, INT2_THS, 0x02);
write_reg(LIS_ADD, INT2_DURATION, 0x20); // 24 ms (1344 Hz)
What I get is:
- LED on INT1 pin is turned on every time i get an interrupt. It seems to be working correctly;
- LED on INT2 pin, on the other hand, is working weirdly. Sometimes it just doesn't turned on at all, sometimes it's always turned on.
- I printed INTx_SRC on the serial monitor: IA on INT1_SRC is correct. IA on INT2_SRC is almost never HIGH.
Is that the expected behavior? Does LIR really conflict with the position recognition configuration?
