This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

app_timer / softdevice S132 / sd_app_evt_wait

Hi there,

hope you are doing fine.

I am using SDK 14.1 with SoftDevice 132 as well as a state machine framework which needs a have a function called periodically to manage events, timers, etc. I am NOT using any RTOS.

I used SysTick_Handler for this which works fine until I have the SD stop advertising which I assume makes sd_app_evt_wait() block and potentially stop the HFCLK (?) which stops SysTick_Handler to be called. Correct ?

Now I started playing with app_timer which works as well ... some sort of. Before enabling the Softdevice I create a timer which calls the needed functions for the state machine framework. After the SD is enabled I assume that the configured timer in app_timer stops working because SD takes over RTC1. Correct ?

With this I have the SysTick_Handler AND the handler method configured for the app_timer call the state machine framework functions.

When I put the SD to sleep through sd_app_evt_wait by stopping advertising the app_timer kicks in again calling the state machine functions which is exactly what I want to achieve but I would like to understand if that is a save way or if it should be done otherwise for example

  • initiate app_timer just before stopping advertising or
  • before calling sd_app_evt_wait() after checking whether SD has disabled advertising and disabling the timer after sd_app_evt_wait() returns if timer was active

Any thoughts ?

Thanks, Mark

Parents Reply Children
No Data
Related