Periodic wake up can't be set to more than ~10 minutes

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
5 posts / 0 new
Last post
ViSt
Offline
Last seen:1 year 3 months ago
加入:2016-10-20 06:53
Periodic wake up can't be set to more than ~10 minutes

I tried to set the periodic wake up to 23 hours since this post explained that the maximum is about 23.3 hourshttps://support.dialog-semiconductor.com/cfgmaxsleepdurationexternalwake.... What is the exact maximum and how do I calculate it?

However when I set the wake-up to 23 hours by setting CFG_MAX_SLEEP_DURATION_EXTERNAL_WAKEUP_MS to (1000*60*60*23), it started waking up every 4 minutes. I tried setting it to (1000*60*10) and it woke up every 10 minutes as expected. Lower values also worked as expected. When I set it to (1000*60*30) it started waking up every 8 minutes.

I read in this posthttps://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bl...and herehttps://support.dialog-semiconductor.com/forums/post/dialog-smartbond-da...that there is a bug in the MS_TO_SLOTS_CONVERT function. I tried the suggested fix with converting to 'long long' but it still doesn't work. Perhaps there is some other integer overflow error somewhere?

Device:
MT_dialog
Offline
Last seen:2 months 1 day ago
Staff
加入:2015-06-08 11:34
Hi ViSt,

Hi ViSt,

The register is 27 bit counter counting in 625us base.

Try to set the register directly, without using the CFG_MAX_SLEEP_DURATION_EXTERNAL_WAKEUP_MS definition but with defining the actual value in the MAX_SLEEP_DURATION_EXTERNAL_WAKEUP definition, but use a value slightly less than the actual full value of the register, since the SDK will also add up to that value.

Also you can in use arch_ble_ext_wakeup_on() and dont change that value in order for the device to stay in sleep mode without waking up periodically.

Thanks MT_dialog

ViSt
Offline
Last seen:1 year 3 months ago
加入:2016-10-20 06:53
Thank you for the quick reply

Thank you for the quick reply.

Are 64-bit variables undefined in the DA14580? Because if they are, it would explain this behaviour. The maximum value that can be passed to MS_TO_SLOTS_CONVERT would be (2^32-1)/1000 ~= 4294967 ms ~= 1.193 h. I might have made a mistake when checking if 30m values were possible before.

The maximum value if setting MAX_SLEEP_DURATION_EXTERNAL_WAKEUP directly would be 2^27-1 slots= 134217727 slots = 83886079ms ~= 23.3016887 h.

I want to keep the wake-up timer but about once per day is enough, in order to do SUOTA or configurations over BLE without needing button push.

ViSt
Offline
Last seen:1 year 3 months ago
加入:2016-10-20 06:53
Apparently I was too quick on

Apparently I was too quick on accepting the answer, the problem remains after setting the value of MAX_SLEEP_DURATION_EXTERNAL_WAKEUP to 132480000 (23h)...

我测试了几均nt settings and they all give various incorrect wake up times
23h -> 4 min
12 h-> 20min
6h->700s
1h->1000s
500年代30 m - >
-- And some which do work
20m -> 20m
15m -> 15m
10m -> 10m

MT_dialog
Offline
Last seen:2 months 1 day ago
Staff
加入:2015-06-08 11:34
Hi ViSt,

Hi ViSt,

Yes, apparently there is an issue at the calculation of the low power clock and how much time the device will be in sleep, there is an overflow in the period calculation (if you apply large values, the SDK hasn't forseen such large values), please try the below code in order for the device to be able to calculate longer sleep periods:

In the rwip_slot_2_lpcycles() function replace the assignment of the lpcycles from: lpcycles = (slot_cnt << 11)/100; to lpcycles = ((uint64_t)slot_cnt << 11)/100;

That shoud allow you to sleep up to 23 hours.

Thanks MT_dialog