2024-02-01 10:01 AM - edited 2024-02-01 12:19 PM
Hello, ST community,
Recently, our team has been working with the LIS3DH accelerometer with a STM32WLE5 MCU. Some of the requisites we have for the project are: it works with a 400 Hz, 16 g Full Scale, High Resolution mode, High Pass filter activated, I2C communication, and the interrupt threshold must be small - due to the nature of the 16 g function, we went with the lowest possible value, 186 mg according to the datasheet. The problem is that the interrupt simply doesn't work with those configurations: when we set the interruption duration to 0 or 2.5 ms, the interrupt pin is always high, but if the duration is any higher than that, the interrupt never triggers. This issue doesn't happen when we set the INTx_THS register to any value above 0x01 - 0x02 has a normal behavior regardless of the INTx_DURATION written. This issue also happens when we set the Full Scale to 8 g. Is this a known issue or am I doing something wrong? The basic code idea is written as it follows:
1 - Factory reset (function we created to return every register to its default value)
2 - Write 77h on CTRL_REG1 (400 Hz ODR)
3 - Write 39h on CTRL_REG2 (High Pass filter Normal Mode, activate for FDS and IA1)
4 - Write 40h on CTRL_REG3 (IA1 on INT1)
5 - Write 78h on CTRL_REG4 (MSB @ lower address, 16 g FS, HR active)
6 - Write 08h on CTRL_REG5 (Latch on Interrupt 1)
7 - Write 01h on INT1_THS (186 mg Threshold)
8 - Write 00h on INT1_DURATION
9 - Read REFERENCE (Dummy read for the HP Filter)
10 - Write 2Ah on INT1_CFG (Interruption for all axis on high)
After polling the INT1 and going into the main code, the reading for INT1_SRC doesn't help much, although the interrupt most often active is on the Z axis. We also keep reading the accelerometer output, and as it's kept standing on its place, the reading never reach anywhere close to the interrupt threshold, and even works pretty well by itself.
2024-02-05 03:04 AM
Hi @Rodrigo2IoT ,
Welcome to ST Community!
Just to exclude problems related to your code, have you already tried to follow our examples on github?
2024-02-05 05:29 AM
Hello, Federica,
Thanks for the reply! Yes, we have tried the example codes - to make sure we weren't doing anything wrong with our actual code or equipment as well, we also tried using the module on an Arduino (we bought the original one with Future Electronics, while the Arduino one we bought in a different place to be sure it wasn't a problematic batch), and the same thing happened: the interrupt and most other functions tend to work great, but specifically when set to 01h on the INTx_THS, the interrupt stops working as it should. The other functions are not affected by this.