Resolution versus overflow and the prescaler

nRF5340 Product Specification

The relationship between the prescaler, counter resolution, and overflow is summarized in the following table.

Table 1. RTC resolution versus overflow
Prescaler Counter resolution Overflow
0 30.517 μs 512 seconds
28-1 7812.5 μs 131072 seconds
212-1 125 ms 582.542 hours

The counter increment frequency is given by the following equation:


    fRTC [kHz] = 32.768 / (PRESCALER + 1 )
    

The PRESCALER register can only be written when the RTC is stopped.

The prescaler is restarted on tasks START, CLEAR and TRIGOVRFLW. That is, the prescaler value is latched to an internal register (<<PRESC>>) on these tasks.

Examples:

  1. Desired COUNTER frequency 100 Hz (10 ms counter period)

    PRESCALER = round(32.768 kHz / 100 Hz) - 1 = 327

    fRTC = 99.9 Hz

    10009.576 μs counter period

  2. Desired COUNTER frequency 8 Hz (125 ms counter period)

    PRESCALER = round(32.768 kHz / 8 Hz) – 1 = 4095

    fRTC = 8 Hz

    125 ms counter period