cancel
Showing results for 
Search instead for 
Did you mean: 

LIS2DH12: Calculating return-to-sleep time using register ACT_DUR (3Fh)?

JohnM
Associate

Hello,

I’m probably missing something obvious but I don't understand how the return-to-sleep duration can be calculated using the equation in Section 8.34 of the datasheet.

0693W00000D1OrmQAF.jpgI’m also confused regarding how the ACT_DUR time is used for sleep-to-wake. AN5005 Section 10 shows no delay, except waiting for the next ODR period, for wake up to occur.

What effect does the ACT_DUR register setting have on sleep-to-wake? Does Section 10 show a duration of zero and if a duration is set in ACT_DUR then the activity must exceed the threshold for the entire duration that is set?

Thank you!

Regards,

John M.

1 ACCEPTED SOLUTION

Accepted Solutions
TBomb.1
Senior II

Hi John, my interpretation is that the LSb in the right hand side is the standard time LSB, i.e. 1/ODR, while the LSb in the left hand side of the equation is the actual ACT_DUR LSB. For example, if the ODR is 10Hz, the LSB would be = (8*1/10+1)/10 = 180 ms (instead of 100ms if it was 1/ODR). Can you check this in your setup?

The effect is described in the application note: The Activity/Inactivity recognition function is enabled by writing a wake-up threshold value different from zero in register ACT_THS. The return-to-sleep time is also customizable, acting on register ACT_DUR.

https://www.st.com/resource/en/application_note/dm00365457-lis2dh12-mems-digital-output-motion-sensor-ultralowpower-highperformance-3axis-nano-accelerometer-stmicroelectronics.pdf

0693W00000D1XSgQAN.png 

Tom

View solution in original post

3 REPLIES 3
TBomb.1
Senior II

Hi John, my interpretation is that the LSb in the right hand side is the standard time LSB, i.e. 1/ODR, while the LSb in the left hand side of the equation is the actual ACT_DUR LSB. For example, if the ODR is 10Hz, the LSB would be = (8*1/10+1)/10 = 180 ms (instead of 100ms if it was 1/ODR). Can you check this in your setup?

The effect is described in the application note: The Activity/Inactivity recognition function is enabled by writing a wake-up threshold value different from zero in register ACT_THS. The return-to-sleep time is also customizable, acting on register ACT_DUR.

https://www.st.com/resource/en/application_note/dm00365457-lis2dh12-mems-digital-output-motion-sensor-ultralowpower-highperformance-3axis-nano-accelerometer-stmicroelectronics.pdf

0693W00000D1XSgQAN.png 

Tom

Thank you Tom! We’re in the process of coding for the prototypes so it will be a week or so before testing that can begin. But we’ll go with your interpretation as it makes sense.

Thanks for the link. My question regarding ACT_DUR came about after reading AN5005. :)

It was clear to me how the timing worked when returning to sleep but I wasn’t sure if the same duration of activity (above the threshold) was needed for sleep-to-wake. Figure 33 in AN5005 shows instant wake-up (waiting only for next ODR). If ACT_DUR was used for both return-to-sleep and sleep-to-wake, then we’ll have to do a bit of extra coding as we would like instant sleep-to-wake but delayed return-to-sleep. We’ll have to adjust ACT_DUR as needed.

Thank you again!

I have very different findings here.

So I varied the value of ACT_DUR and measured the actual delay on a scope and then tried to reverse engineer which interpretation of the formula mentioned in datasheet fits the bill.


So, first the measurement :

ODRACT_DUR valueMeasured Duration
1010.99 sec
1021.8 sec
1054.2 sec
10108.2 sec
102016.1 sec
103024.2 sec

Now the reverse engineering :
If I consider your interpretation, then for ACT_DUR = 1, i should get a duration of  (8*1/10+1)/10 = 180 ms.
But this is not the case. 
So, here is i interpret the formula :

If ACT_DUR is set to 'N'  then total duration is (((8*N) +1)/ODR) sec

Now when I put
ODR=10 , and N =1 , this becomes  ((8*1)+1)/10 = 0.9sec
ODR=10 , and N =2 , this becomes  ((8*2)+1)/10 = 1.7sec
ODR=10 , and N =5 , this becomes  ((8*5)+1)/10 = 4.1sec
ODR=10 , and N =10 , this becomes  ((8*10)+1)/10 = 8.1sec
ODR=10 , and N =20 , this becomes  ((8*20)+1)/10 = 16.1sec
ODR=10 , and N =30 , this becomes  ((8*30)+1)/10 = 24.1sec

Matches perfectly.

So, unless, somebody can point to me something that I might have messed up completely, I am sticking with this.