ke_timer_set in ext_sleep case

6 posts / 0 new
Last post
hardy.chen
Offline
Last seen:1 year 10 months ago
Joined:2015-03-13 04:20
ke_timer_set in ext_sleep case

Hi Dialog team,

I've readhttp://support.dialog-semiconductor.com/faq/how-use-ketimer-during-wakeu....
And follow the instruction to my project
1) add BLE activity check in app_timer_set
2) add BLE force wakeup procedure in app_timer_set
3) add new message handler in TASK_APP for handling the creation of new timer

But it's still failed to create timer correctly (sometimes works but failed at most case), is there any missing change required in DA14580_BEACON_3.40.6?
Just wondering if any additional change is required in beacon reference sample?

Device:
MT_dialog
Offline
Last seen:2 months 1 week ago
Staff
Joined:2015-06-08 11:34
Hi hardy.chen,

Hi hardy.chen,

I am not aware of anything that would require the beacon to have something extra in implementing an external wake up. Have you tried to do something similar with a clean template project ?

Thanks MT_dialog

hardy.chen
Offline
Last seen:1 year 10 months ago
Joined:2015-03-13 04:20
Hi MT_dialog,

Hi MT_dialog,

Simply just to have different advertising frequency with external event, i.e. pressing button or detection of movement.

I don't try other template project (suppose you're mentioning SDK 5.0.x.x), I believe it should be fine without kernel timer issue, since it's more complete after restructuring API and stack architecture. And it's meaningless for me, since I need my project to be developed based on BEACON reference design.

I've check other reference design 'HID', which did has some other changes in *hooks#2* 'app_asynch_proc', could you explain more about waking BLE core via external interrupt based on BEACON reference design?

hardy.chen
Offline
Last seen:1 year 10 months ago
Joined:2015-03-13 04:20
Hi Dialog team,

Hi Dialog team,

Check my modification of 'app_timer_set' according to your FAQ as below.
I do wondering if the kernel message (ke_msg_send) be effectively sent to task for scheduling right after waking up BLE via 'app_ble_force_wakeup' and 'app_ble_ext_wakeup_off'?
Shall I wait for any signal of BLE truly ON before sending kernel message?

--
空白app_timer_set (ke_msg_id_t const timer_id ke_task_id_t const task_id, uint16_t delay)
{
// Delay shall not be more than maximum allowed
if(delay > KE_TIMER_DELAY_MAX)
{
delay = KE_TIMER_DELAY_MAX;

}
// Delay should not be zero
else if(delay == 0)
{
delay = 1;
}

// refer tohttp://support.dialog-semiconductor.com/faq/how-use-ketimer-during-wakeu...
if (app_check_BLE_active())
{
ke_timer_set(timer_id, task_id, delay);
}
else
{
app_ble_force_wakeup(); //wake_up BLE
app_ble_ext_wakeup_off ();

//send a message to wait for BLE to be woken up before executing the
struct create_new_timer_struct *req = KE_MSG_ALLOC(APP_CREATE_NEW_TIMER, TASK_APP, TASK_APP,
create_new_timer_struct);

req->delay=delay;
req->task_id=task_id;
req->timer_id=timer_id;
ke_msg_send(req);
}
}
--

MT_dialog
Offline
Last seen:2 months 1 week ago
Staff
Joined:2015-06-08 11:34
Hi Hardy.chen,

Hi Hardy.chen,

When the message is sent, it ends up to a queue, when the OS is active it will get the message from the queue and serve it as soon as it is operational. Thats the reason for avoiding putting the setting of a kernel timer in the waking up interrupt, since in order to set a kernel timer you need the BLE to be active in order for clocks to be synchronized and the elapse of the timer to occur at a valid moment in time.

Thanks MT_dialog

hardy.chen
Offline
Last seen:1 year 10 months ago
Joined:2015-03-13 04:20
Thanks and well noted!

Thanks and well noted!

Topic locked