Hi,Support Team,
Please let me ask the question about EXT_SLEEP mode every certain time. I need wake up it internally. I already read UM-B-006,but I'm a bit confused on how and where to write code .
In SDK5 code, which example is about it.
Please help me!
Keywords:
Device:
Hi wuxin_1019,
All the examples in SDK which implement BLE are able to go to sleep mode, all you have to do is to set the app_default_sleep_mode to ARCH_EXT_SLEEP_ON for extended sleep in file user_config.h file, in the user_config folder of your keil.
Thanks MT_dialog
I aready set the app_default_sleep_mode to ARCH_EXT_SLEEP_ON for extended sleep in file user_config.h file. But where I should put the code for waking up. Thanks!
Hi wuxin_1019,
There are different ways for the da to wake up, the da wakes up when its time to advertise or to keep a connection alive, you can wake it up internally by using a timer (software kernel timer) you can find an example in the app_ble_barebone project of the SDK in the user_barebone.c at the user_app_adv_function() (the app_easy_timer() function sets a timer and when it goes off, the adv_data_update_timer_cb function is executed and stops the advertising procedure). Finally you can wake it up by an external event, you can check how this is done by following the following post or by making a quick search on the forum, there are a lot of threads describing how to do this kind of thing.
http://support.dialog-semiconductor.com/dsps-use-gpio-control-its-extend...
Thanks MT_dialog
Thanks, I just want to wake up da internally, like "sleep 3s, ble send data, sleep 3s, ble send data,...." . I can not find the user_app_adv_function() in the user_barebone.c.
void user_app_adv_start(void)
{
// Schedule the next advertising data update
app_adv_data_update_timer_used = app_easy_timer(APP_ADV_DATA_UPDATE_TO, adv_data_update_timer_cb);
struct gapm_start_advertise_cmd* cmd;
cmd = app_easy_gap_undirected_advertise_get_active();
if(GPIO_GetPinStatus(GPIO_PORT_2, GPIO_PIN_2))
GPIO_SetInactive(GPIO_PORT_2, GPIO_PIN_2);
else
GPIO_SetActive(GPIO_PORT_2, GPIO_PIN_2);
// add manufacturer specific data dynamically
mnf_data_update();
app_add_ad_struct(cmd, &mnf_data, sizeof(struct mnf_specific_data_ad_structure));
app_easy_gap_undirected_advertise_start();
}
When I define ARCH_EXT_SLEEP_ON in user_config.h, the above code stop.
I want to know where I should put the code for waking up internally.(sorry,the "http://support.dialog-semiconductor.com/dsps-use-gpio-control-its-extend..." is not suit me.) Thank you !
Hi wuxin_1019,
You can use a kernel timer if you want you device to wake up internally. Just start advertise and start a timer as well, when the timer elapses you can invoke the app_easy_gap_advertise_stop() and when the cancel of advertising completes (in the user_app_adv_undirect_complete()) you can set an other timer that will count the time that you are off. When that timer elapses you can invoke the starting of advertising in the specific handler.
Thansk MT_dialog
I have other question. When I set the "const static sleep_state_t app_default_sleep_mode=ARCH_EXT_SLEEP_ON;" in file user_config.h file. Systerm stop and sleep. What can I do? Thanks.
Hi wuxin_1019,
Most probably you are using keil to donwload software to your 580. When using keil, you are in debug mode, and you have enabled sleep the da stops until the debbuger is detached. Just stop the debugging mode and you should see the da to start advertise.
Thanks MT_dialog