cancel
Showing results for 
Search instead for 
Did you mean: 

Allowed values for interrupt threshold of LIS2DH12

ilg
Associate

Hi, 

I am using a LIS2DH12 chip to detect the orientation(in 3D space) of a device.

For this purpose I'm using the INT pins in 6D position mode to generate interrupt signal/s, that will alert me if the device has exited/entered a known positional area.

My problem is the following: when setting the threshold for each used axis, I'm unable to utilize any value below 45 degrees. The application behaves in the 

exact way I'm expecting it while the threshold value is set for a reference angle above or equal to 45 degrees but as soon as i enter a value below 45 degrees,

the interrupt flag starts to occur at output values much higher than expected.

This is my register configuration: 

(using INT2 and only Y axis HIGH interrupt enabled, Normal mode, 10 bit resolution, +/- 2g full-scale):

CTRL_REG1 - 0x37 

CTRL_REG2 - 0x0

CTRL_REG3 - 0x0

CTRL_REG4 - 0x0

CTRL_REG5 - 0x0

CTRL_REG6 - 0x20

INT2_CFG - 0xC8

INT2_SRC - 0x48

INT2_THS - 0x2D

When using this configuration I'm observing the interrupt signal going LOW when the Y axis acceleration value drops below ~0xB5.

0xB5 = 181, which is equal to 181*4mg = 724 mg

1g * sin(45) ~= 724 mg, which means everything is working as expected

Next I only modify the INT2_THS register to 0x20 and I am expecting the interrupt for the Y axis to go LOW when the acceleration reaches values below ~ 0x80.

0x80 = 128, 128*4mg = 512 

1g * sin(30) = 500 mg

However, when testing, the output interrupt threshold appears to be around ~0xE0, which is higher than when I was using 45 degrees as a reference angle (but the angle is lower, so it doesn't make any sense?).

My question is - is this the intended behavior? Can you set an interrupt reference angle below 45 degrees in 6D position detection mode? If yes, then what am I doing wrong?

For reference this is how I calculate the threshold value:

for 45 degrees threshold angle -> 724 mg, 1LSB in THS is 16 mg so 724 / 16 = 45 (0x2D), expected output threshold @ 724/ 4 mg (1 LSB = 4mg in output registers) = 181 (0xB5)

for 30 degrees threshold angle -> ~512 mg, 1LSB in THS is 16 mg so 512 / 16 = 32 (0x20), expected output threshold @ 500/ 4 mg (1 LSB = 4mg in output registers) ~= 128 (0x80)

Any help would be appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Eleon BORLINI
ST Employee

Hi @ilg​ ,

Calculations looks good from my side.

In a 6D orientation detection, 45° is the discriminant between an orientation and another one, since 44° along x are 46° along -x.

So I believe you should get an interrupt in any case, but with different flags risen in the INT1_SRC register.

For the 6D orientation, the INT1_THS is set to 0x21 (see app note AN5005, p.28).

0693W00000FC5F0QAL.pngCheck also this design tip note: Setting up 6D orientation detection with ST’s MEMS accelerometers.

0693W00000FC6efQAD.png0693W00000FC6emQAD.pngThe tilt detection is limited to 45° for symmetry.

-Eleon

View solution in original post

2 REPLIES 2
Eleon BORLINI
ST Employee

Hi @ilg​ ,

Calculations looks good from my side.

In a 6D orientation detection, 45° is the discriminant between an orientation and another one, since 44° along x are 46° along -x.

So I believe you should get an interrupt in any case, but with different flags risen in the INT1_SRC register.

For the 6D orientation, the INT1_THS is set to 0x21 (see app note AN5005, p.28).

0693W00000FC5F0QAL.pngCheck also this design tip note: Setting up 6D orientation detection with ST’s MEMS accelerometers.

0693W00000FC6efQAD.png0693W00000FC6emQAD.pngThe tilt detection is limited to 45° for symmetry.

-Eleon

ilg
Associate

Yeah I figured as much since the breaking point was 45°, which overlaps with the other adjacent axis. However, since I didn't find it described in the documentation I thought I'd try and ask. Thank you for the fast and complete answer 🙂