cancel
Showing results for 
Search instead for 
Did you mean: 

H3LIS331DL Threshold interrupt

Philemon Jaermann
Associate
Posted on January 12, 2017 at 17:10

Hello,

I have troubles setting the H3LIS331DL accelerometer to trigger an interrupt when a programmed threshold is crossed. I can configure the device to trigger an interrupt when new data is ready on both INT1 and INT2 pad (confirmed with an oscilloscope). However, the threshold interrupt never fires.

I used the following configuration :

- Low power mode @ 10Hz, X/Y/Z axis enable : 0b1100 0111 written in CTRL_REG1

- No high pass filter

- No sleep to wake function

- Threshold interrupt on INT2 pad, interrupt not latched -->CTRL_REG3 = 0

- Full scale range +-100g, block data update : 0b1000 0000 written in CTRL_REG4

- OR combination of interrupt on the 3 axis : 0b0010 1010 written in INT2_CFG

- Threshold value set to ~2g (49mg/LSB @ +-100g) --> 0b0010 1000 written in INT2_THS

- No minimum duration

The different parameters are well written to the sensor (reading them back and oscilloscope measurement).

With this configuration, I read 0b0001 0101 in INT2_SRC (X/Y/Z under threshold) at rest, but shaking it doesn t change.

Since the threshold is defined on 7bits, I assume, that lower than threshold is lower than -2g in this case and not lower than 2g, is this correct (so why do I have 'lower than threshold' flags set in INT2_SRC)?

Decreasing the threshold to 1g and shaking the sensor give the same result, no interrupt are triggered.

Can someone tell me where I messed the configuration of this sensor please?

Cheers
2 REPLIES 2
Miroslav BATEK
ST Employee
Posted on January 13, 2017 at 11:30

Hello,

I think, the problem is in threshold setting. I think, your assumption is not correct.

The threshold is defined on 7bits, for full scale = 100g, the 1LSB will be 100g/128 = 0.781g. So to set the threshold to 2g the INT2_THS value should be 0x03.

Please be aware of the typical zero-g level which is 1g. For a low threshold the interrupt can be triggered without any movement (1g of gravity + ~1g of zero-g level).

I have checked your configuration and it works fine except the

INT2_THS setting

. If I set the 

INT2_THS = 0x05, the interrupt is triggered when I strongly shake with the sensor.

Philemon Jaermann
Associate
Posted on January 16, 2017 at 08:58

Hello,

Thank you for your reply, indeed, with this definition of the threshold, it works as expected.

Cheers