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

app_timer trigger immediatly on SDK13

Hi,

I have an issue with app_timer (nRF52, SDK13.0). I use a single shot timer.
I try to debug, and I'm in the case of app_timer.c line 650:

ticks latest: 534879, ticks at start: 12012818
ticks first interval: 163840

So this case put the ticks_to_expire to 0... I don't understand why ?

It think that it should be: MAX_RTC_COUNTER_VAL - delta_current_start + p_timer->ticks_first_interval;

Parents
  • No, the timer should expire in 5seconds. But it expire immediatly sometime.

    This happen when I wait some time before executing the timer (less than 5min. That correspond to MAX_RTC_COUNTER_VAL / 2, no ?)

    I have several timers. One timer is always on (a repeated timer to keep track of time). This may have an impact ?

    The timer code is encapsulated in a c++ class.

      err_code = app_timer_create(&timer_id,
                                    APP_TIMER_MODE_SINGLE_SHOT,
                                    timeout_handler);
      APP_ERROR_CHECK(err_code);
    

    And to start (timeout is 5000):

    err_code = app_timer_start(timer_id,
                 APP_TIMER_TICKS(timeout),
                             this);
    APP_ERROR_CHECK(err_code);
    
Reply
  • No, the timer should expire in 5seconds. But it expire immediatly sometime.

    This happen when I wait some time before executing the timer (less than 5min. That correspond to MAX_RTC_COUNTER_VAL / 2, no ?)

    I have several timers. One timer is always on (a repeated timer to keep track of time). This may have an impact ?

    The timer code is encapsulated in a c++ class.

      err_code = app_timer_create(&timer_id,
                                    APP_TIMER_MODE_SINGLE_SHOT,
                                    timeout_handler);
      APP_ERROR_CHECK(err_code);
    

    And to start (timeout is 5000):

    err_code = app_timer_start(timer_id,
                 APP_TIMER_TICKS(timeout),
                             this);
    APP_ERROR_CHECK(err_code);
    
Children
No Data
Related