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 **************
************************************************************************/
/ /检查是否一些内核处理正在进行中
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
Hi RexDevelopment,
Besides the changing the app_default_sleep_mode to ARCH_DEEP_SLEEP_ON and off course change also the memory configuration there is no other process or change that its needed in order to set up your fw in order to go in deep sleep. How do you know that the device doesn't go in deep sleep, you checked it via the power consumption ? You see that the device keeps on advertising ? Also be aware that in order to get proper power consumption and test the deep sleep mode you will have to #undefine the CFG_DEVELOPMENT_DEBUG and burn the image in the OTP along with bunring the applications flags. Regarding the code, the app_easy_gap_undirected_advertise_with_timeout_start() will start the advertising and set up a timer in order to finish the advertising procedure, when timer elapses the app_easy_gap_advertise_stop_handler() will occur in order to stop the advertising and trigger the callback that the user has perhaps attached. I dont get what you would like to do in the modified app_easy_gap_advertise_stop_handler() but you invoke again the advertising function before even stop the previous one and you set up a timer in order to wake up in the designated time. What you can try is to instead of a NULL function as a callback in the app_easy_gap_undirected_advertise_with_timeout_start() pass a function that will set up a timer which will count the next wake up and will initiate the advertising, like so:
void set_the_timer(void)
{
app_easy_timer(1000, default_advertise_operation);
}
app_easy_gap_undirected_advertise_with_timeout_start(user_default_hnd_conf.advertise_period, set_the_timer);
没有祝福,不会允许你go to sleep, the device will wake up and sleep depending on BLE events that it has available, for example sleep wakeup and advertise go back to sleep, there is no event that will keep the device awake for long unless there are multiple events that the device needs to serve and sleeping is out of the question. The cancelling of the sleep mode can be done only from the application side. The device will have to serve the events available and then go to sleep. I ve tried to replicate your code and in the app_easy_timer() that you set in the app_easy_gap_advertise_stop_handler() the device stalls by a timer assertion.
Also regarding your implementation you can also have a look at the ble_app_sleepmode and change wake up button with a kernel timer in order to implement this.
Thanks MT_dialog
Hi MT_dialog,
Thanks for your reply. I use VAM (current meter) to measure the current consumption. When DA14580 enters deep sleep mode, we read ~10uA from VAM. If DA14580 does not enter sleep, we read ~550uA from VAM. we also use mobile phone to check whether DA14580 is advertising.
In our firmware our cycle needs to go from -Advertise -> Deep Sleep -> Beacon -> Deep Sleep.
For our application, we have to make DA14580 do a cycle 'app_easy_gap_undirected_advertise_start()', sleep mode and 'app_easy_gap_non_connectable_advertise_start()', so I can not base my firmware on reference design architecture.
1.) What other way can I make DA14580 enter deep sleep mode?
2.) Just to confirm, DA14580 can only enter 'Deep Sleep Mode' if image is burned to 'OTP'? I currently use Flash memory on our hardward and also saw the current reaches 10uA during parts of the the sleep/wake cycle. I have also observed the 10uA on the EVB with the same firmware. What am I missing?
Thank you,
Alex
Hi RexDevelopment,
1) There is no additional way to put the device into deep sleep other that i ve allready mentioned. The device depending on the default sleep mode will take care of the sleep and waking up. 10uA is quite a few for deep sleep mode, perhaps the extra current comes from an additional module that you have on your custom PCB or connected on your dev kit. Since i can see that you have a flash on your board, perhaps the extra current comes from the flash.
2) Yes, the only way to test the deep sleep mode is to burn the OTP and dont forget to undefine the CFG_DEVELOPMENT_DEBUG since if you dont the device will not power of the sysram and it will be like you would be in extended sleep.
Thanks MT_dialog