Hello everyone, I got an issues on waking up the da4580 from extended sleep during the main loop. This is what I have done.
0.- The system in running normally (init, adv, connect, disconnect, the normal schedule)
1.——系统将extended sleep after an internal condition.
2.- Every 10 seconds the main loop starts because I set CFG_MAX_SLEEP_DURATION_EXTERNAL_WAKEUP_MS to 10 seconds.
3.- During the main loop, in the cb app_on_ble_powered I checked if an ADC value is higher than a threshold. If yes, then it returns KEEP_POWERED. On the contrary it return GOTO_SLEEP.
4.- I do the same as 3,. but considering the cb app_on_system_powered. If yes, then it return KEEP_POWERED and also I disable the sleep mode with arch_disable_sleep. On the contrary it return GOTO_SLEEP.
Assuming that the ADC value is higher than the threshold, the rutine results on waking up the module, because I measure a higher current consumption (500 uA), but the ble schedule is not running. For example the da14580 did not starts advertizing. How can I ensure that the da14580 starts the original ble schedule? Maybe I am missing something?
Thank you!
Matías
Hi mjara,
I dont quite get the problem, If you return KEEP_POWERED from the app_on_system_powered callback the device will not through the sleeping procedure (sleep checks etc) but it will re-run the scheduler rwip_schedule() (as the comment indicates). The rwip_schedule() will schedule any commands that you have inserted in the kernel's FIFO, after you have exceeded the threshold and you decide that you should return KEEP_POWERED and go out and advertise do you send an advertising command in order for scheduler to schedule ?
Thanks MT_dialog
Hello MT_dialog,
I tried to use user_app_adv_start() in the app_on_system_powered callback and it starts advertizing. But it did it just one time, so I imagine that the scheduler is not working.
Which have to be the correct command in order to make the scheduler to schedule?
Thank you for your help!
Matías
Hello MT_Dialog,
I was checking and the problem was that both of the callback functions where continuing measuring the ADC. I add some control to return GOTO_SLEEP after the da14580 wakes up. Then, the scheduler start to schedule nomally if I use user_app_adv_start().
Thank you.
Matías
Hi mjara,
Glad you found the problem. Just for your information there no correct command for the scheduler to schedule, in the main while loop in the main_func() function most of the callbacks are being called and executed, the schedule_while_ble_on() function invokes the rwip_schedule() function, that serves all the pending messages. In the app_asynch_proc() the app_on_system_powered() is called and the corresponding callback, if that callback returns KEEP_POWERED the while(app_asynch_proc() != GOTO_SLEEP) will be true and the schedule_while_ble_on() is going to be executed again therefore the rwip_schedule() will be executed again in order to schedule any messages.
Thanks MT_dialog