Calling app_timer_set() from wake up interrupt

⚠️
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.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
6 posts / 0 new
Last post
wangyi190228
Offline
Last seen:1 year 5 months ago
加入:2016-08-05 03:34
Calling app_timer_set() from wake up interrupt

Why call the app_timer_set (APP_ACC_TIMER, TASK_APP, 50) in the static void app_button_press_cb (void), when the chip wakes up, sometimes the timer can not be executed in time and will be delayed for a few minutes?

Device:
MT_dialog
Offline
Last seen:2 months 4 weeks ago
年代taff
加入:2015-06-08 11:34
Hi wangyi190228,

Hi wangyi190228,

年代ince you are using the app_timer_set() function i suppose that you are using a old SDK prior to the SDK 5 where the app_easy_timer() is introduced, i would suggest to move on to the latest SDK in order to build your fw and use the app_easy_timer() API which solves the issue that you are experiencing. The reason that the app_timer_set() sometimes executes and other times it doesn't is because the BLE core isn't active when you set the timer, so you get abnormal timer functionallity. The work around that the app_easy_timer implements is to check if the ble core is active and if not send a message from the wake up interrupt and when the message is scheduled it will set the timer, otherwise if the BLE core is active just set the timer normally. I ve also changed the title of the post, please dont post in Chinese on the English forum.

Thanks MT_dialog

wangyi190228
Offline
Last seen:1 year 5 months ago
加入:2016-08-05 03:34
你好,我试着改变

你好,我试着改变app_timer_set () to app_easy_timer () in the interrupt callback function static void app_button_press_cb (void), but the result of running the program has not changed and is the same as before the change, what is it Why?

MT_dialog
Offline
Last seen:2 months 4 weeks ago
年代taff
加入:2015-06-08 11:34
Hi wangyi190228,

Hi wangyi190228,

I am not able to replicate what you are mentioning, used the ble_app_sleepmode project and inserted a timer set (app_easy_timer()) in the app_button_press_cb() function, the callback is executed properly every timer a button was pressesed, and tested from more than 100 button presses and always the callback was executed after 500ms, perhaps you could share some code in order to replicate what you are mentioning ? What example you ve used to performed the tests ? What are the changed on the code ? How do you verify that the callback never occurs ?

Thanks MT_dialog

wangyi190228
Offline
Last seen:1 year 5 months ago
加入:2016-08-05 03:34
I uploaded the code, the

I uploaded the code, the problem code sub appcodoon.c file, now the code is app_timer_set (), but before using the app_easy_timer () as recommended, the same effect. I use the prox_reporter project in sdk5.0.4

Attachment:
MT_dialog
Offline
Last seen:2 months 4 weeks ago
年代taff
加入:2015-06-08 11:34
Hi wangyi190228,

Hi wangyi190228,

I dont see anything suspicious in the code, apart from the app_easy_timer() that you dont use, once again tried to replicate what you get, i suppose that you get the probelm in the app_button_press_cb() and none of the timers goes off or perhaps one or timers are not going off ? Used a modified version of the ble_app_sleepmode (advertise for a few seconds at the beggining and then go to sleep waiting for an external interrupt) and inserted 3 timers (using app_easy_timer() each of those timers has a distance of about 500ms each) in the app_button press_cb(). In each timer callback i ve inserted a arch_printf() printing the sequence that each timer will go off. So in each button press i could see the terminal printing 1,2,3. In all the tests all timers had elapsed on time and everytime the same printing occured. So bottom line is that i am not able to replicate what you mention and i trust that the timer goes off when using the app_easy_timer(), you can also try to perform the same test in order to verify. Perhaps the reason you dont see it going off is because of a condition in the callback.

Thanks MT_dialog