Can I manually set the sleep mode to deep sleep when app_default_sleep_mode = ARCH_EXT_SLEEP_ON ?

⚠️
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.
13 posts / 0 new
Last post
cgha
Offline
Last seen:5 months 3 weeks ago
加入:2016-03-23 13:05
Can I manually set the sleep mode to deep sleep when app_default_sleep_mode = ARCH_EXT_SLEEP_ON ?

I just want my system works at app_default_sleep_mode = ARCH_EXT_SLEEP_ON, but after some condition match, I should close ble and put the system in deep sleep mode. The process is like:

1. Another mcu named MCU_A put a cmd on spi like "you should put into deep sleep mode"

2. DA14580 checkes if bluetooth is advertising or connected: if connected, disconnect it and do not restart advertising in disconnected callback; if advertising, just call app_easy_gap_advertise_stop to stop advertising

3. DA14580 ack the MCU_A with "OK, I'm ready" , then call arch_ble_ext_wakeup_on() and arch_set_deep_sleep(). (I think this should put the DA14580 in deep_sleep mode)

4. MCU_A put itself to deep_sleep.

NOTE: the code is run on otp.

But sometimes, DA14580 seems been waked up after sleeped a few seconds, there is no advertising, but the whole system current grows to 0.59mA.

What may happen after DA14580 put itself into deep sleep? The watchdog fired? or some timer is still running waked up the DA14580?

Device:
PS_Dialog
Offline
Last seen:5 months 5 days ago
加入:2018-01-15 10:36
Hi Cgha,

Hi Cgha,

I'm checking internally and let you know asap.

BR,保罗

cgha
Offline
Last seen:5 months 3 weeks ago
加入:2016-03-23 13:05
Where Can I get the reason

Where Can I get the reason for wakeup? I now set an breakpoint after the WFI(), and yes the DA14580 waked up after I let it go into deep sleep.

So now I want to get the wakeup reason to locate my source code bug.

PS_Dialog
Offline
Last seen:5 months 5 days ago
加入:2018-01-15 10:36
Hi Cgha,

Hi Cgha,

Please kindly let me know if you are following the proper procedure to send the system in deep sleep.
Information can be found in SDK5.0.4 proximity reporter - code to follow button_enable API.
I assume the 0.59mA is seen from a periodic wakeup CFG_MAX_SLEEP_DURATION_EXTERNAL_WAKEUP_MS, please increase this value to 10 sec for example to see the impact as well.

Watchdog if enabled that can be observed in a later stage.

Please also check this tutorial:

//www.wsdof.com/sites/default/files/training_04_sle...

BR,保罗

cgha
Offline
Last seen:5 months 3 weeks ago
加入:2016-03-23 13:05
The CFG_MAX_SLEEP_DURATION

The CFG_MAX_SLEEP_DURATION_EXTERNAL_WAKEUP_MS is 10S by default and I've not changed this value. The system should be ready to go to deep sleep after ble adv and connection have been stopped.

Note: No app timer is running when fall into deep sleep.

cgha
Offline
Last seen:5 months 3 weeks ago
加入:2016-03-23 13:05
If I just comment out the

If I just comment out the arch_set_deep_sleep(use the default extend sleep), it is OK(there is no gliches on the IRQ pin after sleep and so will not be awaked), if I set it to deep sleep, the irq pin will have some gliches after sleeped for seconds and I guess the application be awaked by these glitches, and so on system crash( since my system is wait for MCU_A to reset DA14580 after it totally fall into sleep). I do not know whether the glitches is caused by wakeup or just been reseted. I've used the oscilloscope to see if the reset is asserted by MCU_A, there is no reset signal after it fall into deep sleep.

LC_Dialog
Offline
Last seen:1 month 21 hours ago
Staff
加入:2016-09-19 23:20
Hi cgha,

Hi cgha,

Can you check the active Uart TX line using a scope and see if there is anything going on with that. If the device wakes up then there might be some bootloader activity sending out chirps

Also, can you confirm if you have followed our instructions in the tutorial to setup the Deep sleep memory configuration.
This ensures the right memory is selected and you've to make sure you are not allocating any heap memory before setting to deep sleep mode. Otherwise, the system will not go into deep sleep. If that is the case, the code will fail at ke_mem_is_empty(KE_MEM_NON_RETENTION),
而且,我也将recommend that you monitor any active BLE operations before setting the deep sleep mode. Looking at one of your comments, the device waking up with WFI means either the device hasn't gone to Deep sleep mode at all or something is waking it up. I beleive the from this information, the device is not going to Deep sleep.

Best regards,
LC_Dialog

cgha
Offline
Last seen:5 months 3 weeks ago
加入:2016-03-23 13:05
My system use extend sleep at

My system use extend sleep at normal time, at last step, if MCU_A ask DA14580 to enter into deep sleep, then it fall into deep sleep. After it enter into deep sleep , it should not be waked up, it is waiting MCU_A to reset it.

LC_Dialog
Offline
Last seen:1 month 21 hours ago
Staff
加入:2016-09-19 23:20
Hi cgha,

Hi cgha,

I understood what you want to do in the system design. Can you please try the above steps I have mentioned in my previous comment. That information will help us narrow down the root cause of the issue you are facing and it might be solved by one of the steps..

Best regards,
LC_Dialog

cgha
Offline
Last seen:5 months 3 weeks ago
加入:2016-03-23 13:05
1. I can confirm all my app

1. I can confirm all my app timer has been canceled before enter sleep.

2. I can confirm I have disabled the gpio wakeup using wkupct_disable_irq() before enter sleep;

3. I can confirm I have called arch_ble_ext_wakeup_on before enter sleep.

4. Now I test use extend sleep instead of deep sleep, set a flag before enter sleep, then check this flag after wakeup, if this flag is set, call watchdog reset, the test result is the DA145480 get reset.

Do you have an email ? I can send you my project to help me to check.

CYibin
Offline
Last seen:7 months 4 days ago
Staff
加入:2017-12-14 02:48
Hi cgha,

Hi cgha,

We have the China forum on which user can use Chinese to discuss with us.

Do you think it is necessary that let's going on discussing on China forum?

如果是的,请打开一个新线程来描述your question:

https://support.dialog-semiconductor.com/forums/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software-dialog-%E2%80%9Csmartbond%E2%80%9D%E7%B3%BB%E5%88%97%E4%BD%8E%E5%8A%9F%E8%80%97%E8%93%9D%E7%89%99%E2%80%94%E8%BD%AF%E4%BB%B6

Br

Yibin

cgha
Offline
Last seen:5 months 3 weeks ago
加入:2016-03-23 13:05
OK, I will open a new thread

OK, I will open a new thread on Chinese forum. Thanks, YiBin and LC_Dialog.

CYibin
Offline
Last seen:7 months 4 days ago
Staff
加入:2017-12-14 02:48
u r welcom~

u r welcom~