I'm using s132.
I'm using the app timer with the app scheduler.
I'm running a simple loop and constantly scheduling the timer in the timer callback.
The callback works as expected, and is triggered at the correct time.
But the main loop wakes up twice as often as the timer callback is called.
My understanding is that `nrf_pwr_mgmt_run` will wait on events. So it's woken up twice. Once for the timer, and once for an unknown reason.
If I use `__WFI` instead of `nrf_pwr_mgmt_run` I get the proper wake up rate.
I'm ok blocking on interrupts (using `__WFI`), but I'm wondering if that's the proper way, and what is that unknown event.
// With
#define APP_SCHEDULER_ENABLED 1
#define APP_TIMER_ENABLED 1
#define APP_TIMER_CONFIG_USE_SCHEDULER 1
// Loop
app_timer_create(&m_timer_id, APP_TIMER_MODE_SINGLE_SHOT, timer_cb);
app_timer_start(m_timer_id, APP_TIMER_TICKS(100), NULL);
while (1) {
// This runs 20 times a second
app_sched_execute();
nrf_pwr_mgmt_run();
}
// Callback
void timer_cb(void *p_context) {
// This runs 10 times a second
app_timer_start(m_timer_id, APP_TIMER_TICKS(100), NULL);
}