Unexpected wakeup every ~13 seconds

18 posts / 0 new
Last post
oren.
Offline
Last seen:1 year 8 months ago
Expert
Joined:2014-06-28 22:03
Unexpected wakeup every ~13 seconds

Hi,
We have an unexpected wakeup every ~13.4 seconds in long sleeps (deep-sleep).
我们不确定这是否是我们代码或SDK中的错误。

http://i.imgur.com/EJzs4sp.png

We use#undef CFG_WDOGin our da1458x_config_basic.h so I don't believe it's the watchdog.

Any suggestions?

谢谢,
Oren

Keywords:
Device:
MT_dialog
Offline
Last seen:3 months 5 days ago
Staff
Joined:2015-06-08 11:34
Hi oren,

Hi oren,

如果在永久睡眠中设置设备(无BLE活动),则设备上没有BLE活动,设备上有一个自动唤醒10秒钟,并且您尚未调用ARCH_BLE_EXT_WAKEUP_ON()。关于您观察到的13秒,您已经更改了从10秒内更改了CFG_MAX_SLEEP_DOURATION_EXTERNAL_WAKEUP_MS,这是默认为13秒。除了设备可以通过内核计时器或触发唤醒引脚的内容唤醒(在您设置的情况下)。

Thanks MT_dialog

oren.
Offline
Last seen:1 year 8 months ago
Expert
Joined:2014-06-28 22:03
We have changed CFG_MAX_SLEEP

We have changed CFG_MAX_SLEEP_DURATION_EXTERNAL_WAKEUP_MS to a much larger value: 23 hours.
We also tried with 1 hour, 1 minute.... wakeup still happens every ~13.4 seconds.

MT_dialog
Offline
Last seen:3 months 5 days ago
Staff
Joined:2015-06-08 11:34
Hi oren,

Hi oren,

If that is the case then something is wrong with the fw (as mentioned above either a timer or if the wakeup controller is enabled something is waking up the device externaly), the SDK doesn't wake on the timer period that you mention, you can test that by using one of the examples that are available on the SDK, for example the ble_app_sleepmode (the example advertises and then falls in sleep until a button is pressed). Regarding the watchdog, even if it is defined it is stopped when the device goes to sleep.

Thanks MT_dialog

oren.
Offline
Last seen:1 year 8 months ago
Expert
Joined:2014-06-28 22:03
Hi,

Hi,
Can you please check if increasing the value of CFG_MAX_SLEEP_DURATION_EXTERNAL_WAKEUP_MS to 1800000 (i.e. 30 minutes) actually works?
I noticed before that there was an error with the MS_TO_SLOTS_CONVERT macro - should be((int)((1000 *(很久)x) / 625))instead of((int)((1000 * x) / 625)), because a value of 23 hours multiplied by 1000 would give 82800000000 > max integer (0x7FFFFFFF).
Please see:https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-da...

What are the side effects of using a large value for the calibration wakeup? Why is the default so small?

谢谢,
Oren

MT_dialog
Offline
Last seen:3 months 5 days ago
Staff
Joined:2015-06-08 11:34
Hi oren,

Hi oren,

In order to prevent that periodical wake up you can use the arch_ext_wakeup_on() that will prevent the device to wakeup regardless the value that you have placed in the CFG_MAX_SLEEP_DURATION_EXTERNAL_WAKEUP. The periodical wakeup its not exaclty for calibration purposes, what you observe is a leftover from the RW kernel when operating in GTL mode. Regarding the maximum value, you are right, but as i ve mentioned if you would like to device not to wakeup you will have to invoke the previously mentioned function and not extend the the CFG_MAX_SLEEP_DURATION_EXTERNAL_WAKEUP (i suppose that the SDK didn't forsee that someone would like to do this and place such a large value). I tested the 30 minutes value and also placed the value directly in the MAX_SLEEP_DURATION_EXTERNAL_WAKEUP (without using the macro) i couldn't see the device waking up every 13 seconds.

Thanks MT_dialog

oren.
Offline
Last seen:1 year 8 months ago
Expert
Joined:2014-06-28 22:03
Hi,

Hi,
If I useARCH_EXT_WAKEUP_ON()then other timers will not work, right?

We will test the sleepmode program.

谢谢,
Oren

MT_dialog
Offline
Last seen:3 months 5 days ago
Staff
Joined:2015-06-08 11:34
Hi oren,

Hi oren,

No, you will be able to wake up via a BLE timer if you invoke the arch_ext_wakeup_on() function, the arch_ext_wakeup_on() just supresses the periodic wakeup.

Thanks MT_dialog

oren.
Offline
Last seen:1 year 8 months ago
Expert
Joined:2014-06-28 22:03
Hi,

Hi,

Great to hear arch_ext_wakeup_on() should eliminate this annoying power consumption.

What exactly did you mean by "GTL mode"? We do not need to communicate with an external processor.

Does it have to do with using deep-sleep? Is arch_ext_wakeup_on() related to deep-sleep vs extended-sleep?

How often do we need to call arch_ext_wakeup_on()? Is calling it once at the initialization enough? Or do we need to call it every time we go to sleep?

谢谢,
Oren

oren.
Offline
Last seen:1 year 8 months ago
Expert
Joined:2014-06-28 22:03
Hi,

Hi,
We have added a call toarc_ble_ext_wakeup_on()at the initialization, but the wakeup still happens.
We will try the sleep program.

问候,
Oren

MT_dialog
Offline
Last seen:3 months 5 days ago
Staff
Joined:2015-06-08 11:34
Hi oren,

Hi oren,

Regardless if you use GTL mode or not, this periodic wake up is leftover from the RW kernel, and you will be able to get rid of it by using the above mentioned suggestions.

The periodic wake up isn't related to any specific kind of sleep, if you dont invoke the arch_ble_ext_wakeup_on() the device is going to wake up everyCFG_MAX_SLEEP_DURATION_EXTERNAL_WAKEUP. Regarding the how often you should invoke the function, usualy this function is invoked when the device is going to stay in sleep mode for a large period of time, so i suppose every time that you would like to sleep for quite some time that exceeds the CFG_MAX_SLEEP_DURATION_EXTERNAL_WAKEUP you should invoke that function, but after waking up you should invoke the arch_ble_ext_sleep_off() function.

Thanks MT_dialog

oren.
Offline
Last seen:1 year 8 months ago
Expert
Joined:2014-06-28 22:03
I could not fix the problem.

I could not fix the problem.
My module still wakes up after 13.4 seconds when the value of CFG_MAX_SLEEP_DURATION_EXTERNAL_WAKEUP is high - tested with 0x7FFFFFF and 0x7FFF (which should give at least 20 seconds of continuous sleep).
I'm using deep sleep. Please see my comment in:
https://support.dialog-semiconductor.com/fixed-da14580-must-automaticall...

I would very appreciate if you test it with your equipment - increase the value of CFG_MAX_SLEEP_DURATION_EXTERNAL_WAKEUP and use Deep Sleep in a program that uses a timer (for example, in a simple peripheral program that would advertise for 1 minute, sleep for 1 minute, advertise for 1 minute, sleep for 1 minute, etc.). Then look with a scope on the power consumption - do you get a continuous sleep or a peak every ~13.4 seconds?

问候,
Oren

MT_dialog
Offline
Last seen:3 months 5 days ago
Staff
Joined:2015-06-08 11:34
嗨oren,

嗨oren,

Please check the comment on your other post, regarding the deep sleep configuration, i will try to check with deep sleep (as you understand this is quite difficult since to operate properly with deep sleep you should have the OTP burned although i dont think that this will change the behaviour of what i ve posted as a matter a fact i dont think when in deep sleep you will be able to wake up at all, not sure about that, i will have to check it as i ve mentioned). At least on extended sleep as allready mentioned on the pro kit the value of the periodic sleep / wake up depends on the value that the CFG_MAX_SLEEP_DURATION_EXTERNAL_WAKEUP has, so please check if with the extended sleep mode if the device still wakes up every 13.4 seconds regardless of the value that the CFG_MAX_SLEEP_DURATION_EXTERNAL_WAKEUP has.

Thanks MT_dialog

oren.
Offline
Last seen:1 year 8 months ago
Expert
Joined:2014-06-28 22:03
Hi,

Hi,
We are using deep sleep (CFG_MEM_MAP_DEEP_SLEEP defined and CFG_MEM_MAP_EXT_SLEEP undefined) and CFG_LP_CLK defined to LP_CLK_RCX20, with SDK 5.0.4.
We have the basic kit and we use it for debugging the code, but in order to measure power usage we burn the code on real modules.
We use LP_CLK_RCX20 and not LP_CLK_XTAL32 because some of our real modules do not have a crystal.
但是,我的团队告诉我,他们用CFG_LP_CLK = LP_CLK_RCX20刻录了该版本,也可以在包含水晶的模块上。

Could it be a crystal problem? Or CFG_LP_CLK being configured to the wrong value?

问候,
Oren

P.S.
切换到延长睡眠不是我们的选择,因为我们很长一段时间睡眠,我们的模块具有微小的不可移动的电池。我们真的需要深睡眠,更喜欢使用没有晶体的模块来降低成本。

oren.
Offline
Last seen:1 year 8 months ago
Expert
Joined:2014-06-28 22:03
Hi,

Hi,
We found that the problem happens only when CFG_LP_CLK=LP_CLK_RCX20 and not when CFG_LP_CLK=LP_CLK_XTAL32.
当CFG_LP_CLK = LP_CLK_RCX20时,唤醒也会发生每〜13.4秒,即使cfg_max_sleep_duration_external_wakeup要高得多。
Changing CFG_LP_CLK changes a lot of places in the code, so I could not trace the problem exactly. I still don't know where the 13.4 value is taken from - or maybe this value is created from some calibration calculations...
We have tried only deep-sleep because extended-sleep is not relevant for our product.

I would appreciate if you could re-check my results. Is it possible to avoid the 13.4 sec wakeups when CFG_LP_CLK=LP_CLK_RCX20? We do want in the future to use modules without a crystal.

Best Regards,
Oren Zomer

MT_dialog
Offline
Last seen:3 months 5 days ago
Staff
Joined:2015-06-08 11:34
Hi oren,

Hi oren,

I can verify that the calculation of the lp clock when the RCX is used is not properly calculated, i ve run some tests in extended sleep and i can verify what you are reporting, the device indeed wakes up every 13.5 seconds. Seems that there is a cast error in the rwip_slot_2_lpcycles_rcx(uint32_t slot_cnt) and the sleep value that returns is wrong. I ve open an internal ticket for this at the SDK team for checking that. Meanwhile, you can replace the function that i ve mentioned with the below function and check.

static uint32_t rwip_slot_2_lpcycles_rcx(uint32_t slot_cnt)
{
volatile uint32_t lpcycles;
uint64_t temp;

// Sanity check: The number of slots should not be too high to avoid overflow
//ASSERT_ERR(slot_cnt < 1000000);

temp = (uint64_t)((uint64_t)slot_cnt * (uint64_t)rcx_slot_duration_num);
temp =(uint64_t)(temp / rcx_slot_duration_den);
lpcycles = (uint32_t)(temp) ;
返回(LPCYCLES);
}

Thanks MT_dialog

oren.
Offline
Last seen:1 year 8 months ago
Expert
Joined:2014-06-28 22:03
That's a relief to hear,

That's a relief to hear,
I started thinking that my code has some memory overflow that might make my program go berserk.

I think a one-line can also do the trick:

lpcycles = (uint32_t)(((uint64_t)slot_cnt * (uint64_t)rcx_slot_duration_num) / (uint64_t)rcx_slot_duration_den);

Instead of:

lpcycles = (uint32_t)((uint64_t)slot_cnt * rcx_slot_duration_num) / rcx_slot_duration_den;

Notice that in the original code, the casting to uint32_t happened before the division.

问候,
Oren

MT_dialog
Offline
Last seen:3 months 5 days ago
Staff
Joined:2015-06-08 11:34
Hi oren,

Hi oren,

One line will be fine, the additional variables and calculations are in place in order for me to check the values returned from the operations to find the issue.

Thanks MT_dialog