Hi Dialog,
1.I use 'app_easy_gap_undirected_advertise_with_timeout_start(uint16_t delay, void (*timeout_callback)(void))' to do Advertising, then close it after 10 seconds (delay is 10s), and I add a 'arch_set_sleep_mode(ARCH_DEEP_SLEEP_ON)' in 'static void app_easy_gap_advertise_stop_handler(void)' to make DA14580 go to deep sleep, but it does not enter deep sleep. Are there other processes or functions that I need to close before DA14580 can go to deep sleep?
Here is code excerpt from my firmware:
void app_easy_gap_undirected_advertise_with_timeout_start(uint16_t delay, void (*timeout_callback)(void))
{
//stop the current running timer
if(adv_timer_id != EASY_TIMER_INVALID_TIMER)
app_easy_timer_cancel(adv_timer_id);
if(timeout_callback != NULL)
adv_timeout_callback = timeout_callback;
adv_timer_id = app_easy_timer(delay, app_easy_gap_advertise_stop_handler);
app_easy_gap_undirected_advertise_start();
}
static void app_easy_gap_advertise_stop_handler(void)
{
app_easy_gap_advertise_with_timeout_stop();
app_easy_gap_advertise_stop();
adv_timer_id = app_easy_timer(SLEEP_TIMEOUT, app_timeout_callback);
arch_set_sleep_mode(ARCH_DEEP_SLEEP_ON);
}
2. If I change the 'app_easy_gap_undirected_advertise_start()' to 'app_easy_gap_non_connectable_advertise_start()', then DA14580 can sucessfully enter deep sleep mode. Do different advertising types define the sleep or idle modes that can follow?
3. I find this section of code keeps DA14580 in idle mode. How can I know which KERNEL EVENTS are still on going (preventing deep sleep mode)?
rwip.c (Line323)
/************************************************************************
************** CHECK KERNEL EVENTS **************
************************************************************************/
// Check if some kernel processing is ongoing
if (!ke_sleep_check())
break;
// Processor sleep can be enabled
proc_sleep = mode_idle;
DBG_SWDIAG(SLEEP, ALGO, 1);
4. Can I terminate the KERNEL EVENTS directly to enter deep sleep mode if I know which event is still on-going?
5. Can I force deep sleep mode even if I cannot identify or terminate the Kernel Events?
SDK5.0.3
Thanks