I am using the custom profile - sample128_After section 7.3.6 - project. i want to implement ext sleep,so custom profile will advertise for 1s and go to ext sleep for 5s again advertise for 1s then again ext sleep for 10s , how to do it ?
- i have just defined the ext sleep mode in da14580_config.h , what changes i have to make for ext sleep mode ?
Keywords:
Device:
Hi prasanth.velliyangiri,
The profile doens't have to do anything with your device sleeping or not, just by defining the CFG_EXT_SLEEP your device should go into sleep mode between advertising or the connection intervals (in case you dont see the device sleeping check if you invoke app_disable_sleep() anywhere in your program). Regarding the functionality you want to achieve, since you want to sleep for long periods you can use the kernel timers, you can try to use a flow like below:
1) start advertising and set a kernel timer, app_timer_set(MSG, TASK_APP, 100); //100 *10 -> 1s
2) When the handler of the timer hits, stop advertising and start an other timer that will count for 5s / 10s etc.
3) When that timer elapses the BLE will wake up and the timer handler will execute
4) Go to 1
Thanks MT_dialog
i am bit confused about where to put this ke_timer to put ble into sleep and wake up , from the UM-B-006 i understand that inside arch_main.c all the sleep related task's are happening , it would be great if u suggest where i have to put this sleep and wakeup ? is there any example code that can help me alot ...thank you..
Hi prasanth.velliyangiri,
All the tasks in a 580 are comunnicating through messages and those messages are triggering callback functions. In your case since you like to advertise upon power up and count for 1 sec you can start your 1s timer as soon as the advertise begins, in the app_adv_start() function. And in the timer handler, that is triggered when the time elapses, place the app_adv_stop() function. After the app_adv_stop() is invoked there should be an undirected advertise completetion message handled by the gapm_cmp_evt_handler() with GAPM_ADV_UNDIRECT operation, in there you can set the timer for the next time the 580 should wake up and advertise. You can have a look at the Smart Tag reference design in order to have an idea. Also we strongly reccommend to use SDK5 in new projects since its more compact and easier to use than SDK3, with the new timers api, the handling of the timers and the callbacks for the completetion messages, its quite more straight forward how to implement this kind of functionallity.
Thanks MT_dialog
Hi Prasanth, just to comment in addition to MT_Dialog : SDk5 is much easier and simpler to use. We have a list of "how to" tutorials that describe the questions you have... you can find them under software & tools... BR JE_Dialog
thank you ! dialog...