2018-03-12 03:50 PM
Hi,
I am working on a project where we are using the H3LIS331DL accelerometer.
I am trying to understand what is happening with the interrupts, because I see some inconsistant behaviour.
I got the following samples sampled at 400Hz with a max range of 200g. The threshold is set to 2, which should correspond to a value of 512 in the data registers ((2/128)*32768). I have the latched option enabled and configured INT1 for the threshold interrupt and enabled the high pass filter for data and interrupt generation.
X:288 Y:416 Z:-1648 (INT1 NOT active)
X:
-272Y:
-144Z:
400(
INT1 active
)
X:
32Y:
-64Z:
576(
INT1 active
)
The 1st sample has no interrupt, but the 2nd and 3th do have the interrupt active, why is that? I expected the 1st and the 3th sample to generate an interrupt, not the 2nd.
Secondly I noticed some other data i could not wrap my head around. Here a 4 sample, sampled in succession:
X:464
Y:
256Z:
-2144(
INT1 NOT active
)
X:
-224Y:
-80Z:
192(
INT1 NOT active
)
X:
-96Y:
-80Z:
496(
INT1 NOT active
)
X:
-16Y:
32
Z:
528(
INT1 NOT active
)
None of these sample values generated an interrupt!! I expected -2144 and 528 to give me an interrupt.
In the same set of samples I also have the following samples:
X:
32Y:
16
Z:
0(
INT1 NOT active
)
X:
96Y:
160Z:
-400(
INT1 active
)
X:
-96Y:
-32Z:
176(
INT1 active
)
X:
-80Y:
-32Z:
256(
INT1 NOT active
)
Interrupt was activated, but the data did never reach the threshold!
Can anyone explain this?
Edit:
After investigating the INT1_SRC value in more detail I sometimes saw the ZH, XH or YH bit set, but the IA was not.
can anyone please explain what is happening?
I have interrupts enabled for a high events on all axis.
Thank you.
2018-03-16 02:19 AM
Please provide your exact sensor configuration (register + value).
2018-03-16 07:51 AM
WHO_AM_I : Read only
CTRL_REG1 : 0x37
- normal mode.
- 400Hz.
- X, Y and Z axis enabled.
CTRL_REG2 : 0x14
- High-pass filter normal mode.
- data from internal filter sent to output register.
- High-pass filter enabled for interrupt 1 source.
CTRL_REG3 : 0x04
- Interrupt request latched on INT1_SRC register
CTRL_REG4 : 0x90
- 200g full scale selection
- output registers not updated between MSB and LSB reading
CTRL_REG5 : 0x00
- Sleep-to-wake function is disabled
HP_FILTER_RESET : Read only
REFERENCE : 0x00
STATUS_REG : Read only
OUT_X_L
: Read only
OUT_X_H
: Read only
OUT_Y_L
: Read only
OUT_Y_H
: Read only
OUT_Z_L
: Read only
OUT_Z_H
: Read only
INT1_CFG : 0x2A
- OR combination of interrupts
- Enable interrupt generation on X, Y and Z high events
INT1_SRC : Read only
INT1_THS : 0x02
INT1_DURATION : 0x00
INT2_CFG : 0x00
INT2_SRC : Read only
INT2_THS : 0x00
INT2_DURATION : 0x00
edit 19-3-18:
fixed CTRL_REG2 configuration typo.
2018-03-19 08:59 AM
OK, I see the problem.
In the configuration CTRL_REG2 : 0x18 you enabled the high pass filter for interrupt 2 source, but then you configured interrupt one (INT1_CFG : 0x2A, INT1_THS : 0x02). So the data without high pass filter are compered with the threshold in the interrupt 1.
You should set the CTRL_REG2 to 0x14.
2018-03-19 09:06 AM
Thank you for your response, but unfortunately I misread my own configuration.
I am actually configuring CTRL_REG2 with 0x14 instead of 0x18.