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

Restartig app_timer does not work with nRF52832 and SDK12.0.0

I am having an app_timer (nRF52832 / SDK12.0.0) that's interval must be changed during its lifetime. I am using following code to change the interval:

app_timer_stop(m_timer_id);
uint32_t interval = APP_TIMER_TICKS(interval_ms, APP_TIMER_PRESCALER);
app_timer_start(m_timer_id, interval, NULL);

So far so good, but what really happens is that I end up having a delay of a minute or so, before timer starts to fire interrupts again. This happens only when I change the interval. My target interval is from 10 to 100 ms.

Could there be a bug somewhere in the app_timer library code? With SDK8.0.0 and nRF51822 I did not have similar problem. My code is exactly the same.

Parents Reply
  • I also tried to solve the problem by using nrf_drv_timer instead of app_timer. However, my code fails on this:

    nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
    err = nrf_drv_timer_init(&timer, &timer_cfg, timeoutHandler);
    APP_ERROR_CHECK(err_code); // err_code returns 0x00000008 !!
    time_ticks = nrf_drv_timer_ms_to_ticks(&timer, interval_ms);
    nrf_drv_timer_extended_compare(
         &timer, NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);
    nrf_drv_timer_enable(&timer);
    

    So, nrf_drv_timer_init() fails with error code 8. What coul be the reason?

Children
No Data
Related