Program still run main loop after set extended sleep mode

⚠️
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.
6 posts / 0 new
Last post
Aaron Li
Offline
Last seen:2 months 3 days ago
加入:2016-09-12 14:20
Program still run main loop after set extended sleep mode

Hello Dialog PM,
I am developping a project based on SDK5.0.3 and ble_app_profile project. After program excuted following function, chip should halt and only an external interrupt can wake up system.

int user_app_adv_timer_handler(ke_msg_id_t const msgid,
void const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{

app_easy_gap_advertise_stop();

ke_timer_clear(APP_ADV_TIMER, TASK_APP);

arch_set_extended_sleep();

// disable wakeup for BLe and timer events. Only external (GPIO) wakeup events can wakeup processor.
arch_ble_ext_wakeup_on();

user_app_button_enable();

return (KE_MSG_CONSUMED);
}

But I found program still run the main loop. As I understand, chip should halt and wait for an external interrupt to excute following function.

//wait for an interrupt to resume operation
WFI();
//resume operation
arch_resume_from_sleep();
Can you give me some suggestion or support? Thanks a lot for your help!

Best Regards,
Aaron

Device:
PM_Dialog
Offline
Last seen:2 days 1 hour ago
工作人员
加入:2018-02-08 11:03
Hi Aaron Li,

Hi Aaron Li,

Could you please explain what do you mean that the “chip should halt”? Do you mean that the device should enter the extended sleep mode and only an external interrupt can wake it up? Did I understand correctly? Please try to describe what you are trying to accomplish in order to provide you the correct guidelines.

Thanks, PM_Dialog

Aaron Li
Offline
Last seen:2 months 3 days ago
加入:2016-09-12 14:20
Hi Dialog PM,

Hi Dialog PM,
I mean the device should enter extended sleep mode and stop to execute the program until an external interrupt to wakeup. But I found the device still run the main loop.

PM_Dialog
Offline
Last seen:2 days 1 hour ago
工作人员
加入:2018-02-08 11:03
Hi Aaron Li,

Hi Aaron Li,

请检查ble_app_sleepmode example of the SDK. This example demonstrates how to use the sleep mode API and change in runtime the sleep mode. For getting further information for this SDK example, please read the 8.50 Pillar 5 (Sleep Mode) section of the DA1458x Software Developer’s Guide 9 (UM-B-050) user manual. This example demonstrates exactly the application you want to develop, so please try to implement the extended sleep functionality in the ble_app_profile project. Also, be aware that the ble_app_sleepmode example includes the implementation of the ble_app_profile.

Thanks, PM_Dialog

Aaron Li
Offline
Last seen:2 months 3 days ago
加入:2016-09-12 14:20
Hello Dialog PM,

Hello Dialog PM,
Let me simply my question.

1. If program executed arch_set_extended_sleep() function, device will enter extended sleep mode. Program will not run the main loop and stop at WFI() until an external interrupt invoke, right?

2. For arch_set_extended_sleep() function, there are following comments. It means even program executed arch_set_extended_sleep() function, system can also work at idle / active / extended sleep modes, right? If yes, how to decide system work at which mode?

/**
****************************************************************************************
* @brief Activates extended sleep mode. The system operates in idle / active / extended sleep modes.
* @param void
* @return void
****************************************************************************************
*/
void arch_set_extended_sleep(void)

PM_Dialog
Offline
Last seen:2 days 1 hour ago
工作人员
加入:2018-02-08 11:03
Hi Aaron Li,

Hi Aaron Li,

Yes, that’s right, the system is waiting for an interrupt and goes to sleep if this is allowed. Please, open the user_config.h header file which is under the user_config folder. Then you should set the app_default_sleep_mode variable with the mode you what your device to operate.

Thanks, PM_Dialog