Learn MoreFAQsTutorials

4 posts / 0 new
Last post
Lyadnov
Offline
Last seen:9 months 19 hours ago
加入:2019-07-31 13:57
BLE timer

Dear support team! Could you, please, explain me, how set time interval for ext. sleep mode.

Device:
PM_Dialog
Offline
Last seen:12 hours 57 min ago
Staff
加入:2018-02-08 11:03
Hi Lyadnov,

Hi Lyadnov,

If I can understand correctly from you question, that you want to accomplish is to use a software timer in order to wake up periodically when the device is in extended sleep mode? Please check the app_easy_timer(). Otherwise, please clarify your question.

Thanks, PM_Dialog

Lyadnov
Offline
Last seen:9 months 19 hours ago
加入:2019-07-31 13:57
Hi, you right understand my

Hi, you right understand my question, but for clear understand app_easy_timer() working, i need check any sample, but in SDK i don't see sample with app_easy_timer() wake up from ext. sleep mode. Do you have it?

PM_Dialog
Offline
Last seen:12 hours 57 min ago
Staff
加入:2018-02-08 11:03
Hi Lyadnov,

Hi Lyadnov,

Use the ble_app_sleepmode example of the SDK6.0.10 (6.0.10.511\projects\target_apps\ble_examples\ble_app_sleepmode). This example demonstrates how to put the DA14585 into permanent sleep. A timer is set up in the user_app_adv_start() function and upon its expiration, the device will stop advertising and goes into extended sleep mode. You can wake it up via the wake up controller by pressing a button. Please see below the modifications should be done in order to wake it up via the app_easy_timer():

1.定义一个新的定时器处理函数:

timer_hnd wakeup_timer_used__attribute__((section("retention_mem_area0"),zero_init)); // @RETENTION MEMORY

2. Comment out app_button_enable() from the user_app_adv_undirect_complete() and set up a timer:

wakeup_timer_used = app_easy_timer(WAKEUP_TO, app_button_press_cb);

3. Define the WAKEUP_TO into ble_app_sleepmode.h header file

4. When it is expires the wakeup_timer_cb() will be trigger. The device will wake up and start advertising again

静态的空白wakeup_timer_cb(void) { if (GetBits16(SYS_STAT_REG, PER_IS_DOWN)) { periph_init(); } if (arch_ble_ext_wakeup_get()) { arch_set_sleep_mode(app_default_sleep_mode); arch_ble_force_wakeup(); arch_ble_ext_wakeup_off(); app_easy_wakeup(); } // If state is not idle, ignore the message if (ke_state_get(TASK_APP) == APP_CONNECTABLE) { user_app_adv_start(); } }

5. Stop the timer up connection.

app_easy_timer_cancel(wakeup_timer_used);

If you follow the step above, the system will advertise for APP_ADV_DATA_UPDATE_TO seconds. Then it will go into sleep mode and it will wake up after WAKEUP_TO seconds. If you found the steps useful, please mark the ticket as “accepted”.

Thanks, PM_Dialog