2021-08-03 05:51 AM
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.
I’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.
Solved! Go to Solution.
2021-08-04 08:08 AM
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.
Tom
2021-08-04 08:08 AM
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.
Tom
2021-08-04 08:48 AM
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!
2023-07-27 03:23 AM
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 :
ODR | ACT_DUR value | Measured Duration |
10 | 1 | 0.99 sec |
10 | 2 | 1.8 sec |
10 | 5 | 4.2 sec |
10 | 10 | 8.2 sec |
10 | 20 | 16.1 sec |
10 | 30 | 24.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.