APP_TIMER_TICKS value

I want to know the max value that we can put in APP_TIMER_TICKS in x.

#define APP_TIMER_PRESCALER 0

APP_TIMER_TICKS(x, APP_TIMER_PRESCALER)

  • Well the max value would be the value which fills the 24bit RTC timer at the given prescalar with the clock running at 32.768kHz. Since it's in milliseconds it would be

    0xffffff / 32768 * ( APP_TIMER_PRESCALAR + 1 ) * 1000
    

    or, in decimal

    511,999 * ( APP_TIMER_PRESCALAR + 1 )
    

    so 511.999 seconds (511,999ms) at prescalar of 0 and 2,097,151 seconds (582.5 or so hours) at prescalar of 4,095.

    Those are also the resolutions shown in Table 149 of the nrf51 reference manual.