AnsweredAssumed Answered

How to use tilt remedy with LIS3DH sensor

Question asked by dehai wo on Dec 22, 2017

Now I want achieve tilt remedy function. I did as the following:

1,tilt the sensor with a constant angle.
2, In initialization function:

set ODR,set mode nomal ,set full scale(+/-2g),enable x,y,z axis,
set LIS3DH_CTRL_REG2=0x48 ( HPM[1:0]=[01],Reference signal for filtering),set REFERENCE =0;
set THR = 2。enable X and Y interrupt . enable IA1 to INT1 .
3, In tilt remedy function:
check IA interrupt flag;
if IA interrupt occured , set THR with THR+1.
loop up line until interrupt not occured.
set the REFERENCE regesiter with the value of current THR , 
resume the THR register with value 2.
by now , IA interrupt should not occured. because the the difference between the input acceleration and the content of 
REFERENCE is 0. but actually the IA interrupt always occured. How to resolve it?