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

How to disable the timer before sleep?

nRF52832, SDK15.0.0, S132

Hello.

I want to go into system on sleep and not wake up until I press the button.

But I'm using timer 1, so it seems to continue wakeup.

So I tried to disable the timer before sleeping.

timer_configure();                  // Timer Enable

while(1){
  
  //nrf_drv_timer_disable(&hTIMER);
  //nrf_drv_timer_uninit(&hTIMER);
  NRF_TIMER1->TASKS_STOP = 1;

  nrf_pwr_mgmt_run();

  //nrf_drv_timer_enable(&hTIMER);
  
  NRF_TIMER1->TASKS_START = 1;
  
  nrf_gpio_pin_write(24,false);
  nrf_delay_ms(100);
  nrf_gpio_pin_write(24,true);
  nrf_delay_ms(100);
}

(P0.24 : LED)

But it does not sleep.

If "//NRF_TIMER1-> TASKS_START = 1;"

It seems to wakeup only when the button is pressed.

I do not know why.
Is there any reason other than a timer?

(The code is based on the ble_uart example.)

Related