Dear Dialog team,
I referenced ble_app_sleepmode project to implement button wake up in ble_app_barebone project. Also I use app_timer_set() to be able to wake up periodically for beacon.
The mode I used to do sleeping is extended sleep mode. The function to start sleeping is as below.
void user_app_adv_undirect_complete(uint8_t status)
{
...
app_timer_set(APP_BEACON_TIMER, TASK_APP, delay);
arch_set_extended_sleep();
arch_ble_ext_wakeup_on();
app_button_enable();
...
}
Now, I can wake up periodically by BLE timer correctly. But when I press the button, the system will be reset.
Is it related to OTP usage as well as Deep Sleep mode? Because I am burning the codes on Flash.
Best regards,
Simon
P.S. app_button_press_cb( ) and app_wakeup_cb( ) are changed slightly so that I don't think they will affect the result.
Hi Simon WANG,
In what kind of mode the device is operating (extended or deep sleep)? Please try to have the debugger attached when the issue occurs in order to see where exactly the device stalls. Also let me know if you have the watchdog enabled.
Thanks MT_dialog
Hi Dialog team,
我用“arch_set_extended_sleep()来设置睡眠模式e, so that it must be in extended, right?
Here is what I do in my codes,
static void app_wakeup_cb(void)
{
user_app_adv_start();
}
And I don't change anything in app_button_press_cb(void).
In above case, I found the system will reset, and this might due to watchdog.
But if I move "user_app_adv_start();" to app_button_press_cb(void) function, I will get advertisment and the system turns to be well as I thought.
Could you help to explain the sequence of wake up procedures and why app_wakeup_cb( ) is not executed ?
Best regards,
Simon
Hi Simon WANG,
Yes, since you are using the arch_set_extended_sleep() the sleep should be extended, regarding your issue, you will have to check what the system does exactly and resets in order for me to be able to understand what the possible cause might be. You mentioned that the reset is perhaps due to the watchdog, can you please make sure of that, just run the code in debug mode with the development flag (DEVELOPMENT_DEBUG set) and check if the system stucks in the NMI_Handler, also if you could attach the power profiler and check what the system does when the issue occurs will also help to debug this. Also please make sure that there is no conflict between the advertising start issued by the timer and the button press (as far as i understand both of them -timer and external interrupt- are triggering advertising so check if nothing weird is happening at that point).
Thanks MT_dialog