2019-05-28 11:39 PM
I'm using the H3LIS331DL high-g accelerometer. Below is my setup code including register configuration:
void init(void)
{
// Write to CTRL_REG3: interrupt active high, push-pull, no latching, data ready signal on INT1
write_data = 0x02;
i2c_write(0x18, 0x22, &write_data, 1);
// Write to CTRL_REG2: boot normal mode, high-pass filter normal mode,
// filter off, filter coefficient 00
write_data = 0x00;
i2c_write(0x18, 0x21, &write_data, 1);
// Write to INT1_CFG: enable interrupt for all 3 axis high or low readings (using OR logic)
write_data = 0x3f;
i2c_write(0x18, 0x30, &write_data, 1);
// Write to CTRL_REG4: set BDU true (update L and H at same time), and set scale 400G
write_data = 0x80 | (0x03 << 4);
i2c_write(0x18, 0x23, &write_data, 1);
// Write to CTRL_REG1: power into normal mode, enable all three axes, and set data rate 1000Hz
write_data = 0x27 | (0x03 << 3);
i2c_write(0x18, 0x20, &write_data, 1);
}
Upon the interrupt getting triggered, I'm performing the following:
void interrupt_handler(void)
{
// Read all 6 OUT registers to get data all axes data; use register address 0xA8 for auto
// increment starting at register HIGHG_REG_OUT_X_L (0x28)
i2c_read(0x18, 0xA8, 6);
}
From looking at a logic analyzer, I've seen that the interrupt signal from INT1 does not get pulled low until I have completed reading all 6 bytes of the accelerometer OUT registers.
The problem that I'm facing is this: my application has quite a bit of processing and is also performing other I2C writes/reads on the same bus. Sometime I'm not able to complete the read of the 6 bytes before 1ms has elapsed (at which time the next sample would be ready, since I'm using a 1000Hz data rate). When this read occurs too late, the interrupt signal just stays high and therefore my software interrupt does not trigger again, causing me to miss further reads of data.
Is it possible to have the interrupt signal simply pulse high for a short period of time every time new data is available, such that it always drops back low regardless of whether I read the data or when I read the data? I know this is possible with some other ST sensors (e.g. LSM6DS3H), but I can't figure out how to do it with the H3LIS331DL.
I tried using the latching feature as well, and it didn't seem to have any impact or work as described in the datasheet. The datasheet says that the interrupt resets after reading the INT1_SRC register, but when I tried this out the behavior seemed exactly the same as before: reading INT1_SRC didn't cause the interrupt signal to reset; however when I complete a read of the 6 data bytes it does reset.
Any help here would be appreciated.
2019-05-31 05:39 AM
Hi, the interrupt should not be latched by default, and this should be the condition you need (but if you want to clear the interrupt by sw you need to be in latched mode). However, you can try to tune the value INT1_DURATION (33h) different from default (that depends on the ODR pulse), setting 6*ODR if you want to go low after 6 readings (consider it especially if the interrupt is generated by all the axis). Regards
2021-04-07 04:42 AM
Hello,
I'm digging upt his subject as I may miss some samples due to varying MCU load of my application.
So, quite the same question as the previous one.
I'm not in "latched mode" however if I do not read the acceleration I never see my DATAREADY edge again.
How can I ensure the H3LIS331DL to continue lowering and raising the INT1 on DataReady even if data not read.
My test case is to use the H3LIS331DL (push/pull, Active LOW, INT1 on DataReady) with the application stopped in debug mode, then I can see that my level stay LOW until I read "manually" the aceleration again ?
Any idea ?
2021-04-09 07:34 AM
Hi @PGoud ,
I see you posted a similar question here, and I will refer to this one.
But good to post it also under this thread, in case @SKama.5 is coming back.
-Eleon
2021-04-09 11:23 AM
Hello! Sorry, it has been quite some time since I was working on this project and I don't remember whether I was able to get this working as I wanted it to, or if I ended doing some workaround solution. Sorry I can't be of more help!