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

Stopping app_timer (using app_timer_stop) results in too much current during ON,IDLE mode

I'm having some trouble successfully entering ON,IDLE mode. I have pared-down my application to do the following:

  1. Initializes the app_timer using the scheduler:

APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, true);

  1. Initializes the BLE stack and softdevice:

BLE_STACK_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION, BLE_L2CAP_MTU_DEF, bleApp_evtDispatch, true);

  1. Creates an application timer using app_timer_create(). The timer is created, but never started.

  2. Initializes the scheduler:

APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE);

  1. Enters an infinite loop alternatively calling app_sched_execute() and sd_app_event_wait().

If during the infinite loop of step #5, I call app_timer_stop() before sd_app_event_wait(), the nRF51844 never appears to enter ON,IDLE mode. Instead, sd_app_event_wait() appears to return immediately, and total current consumption remains around 4mA.

Likewise, if I remove the call to app_timer_stop(), the nRF enters ON,IDLE mode without any issue.

Is there potentially a bug in the app_timer system, or am I doing something wrong?

I'm using

  • SDK v4.4.0.31803
  • s110_nrf51822_5.2.1_softdevice.hex
  • nRF51822 C0
Related