RTC precision problem

In order to perform some application every 1 hour at nRF52832, I set the app_timer(RTC) pre-scaler to be 31.

I also use RTC for 3s and 5ms time keeping, but the actual intervals are sometimes lower than 3s and 5ms(for example 2.7s and 4.6ms)

Is the pre-scaler 31 is suitable for 3s and 5ms time keeping?

Can I use different pre-scaler for different time keeping process?

  • Hi,

    The prescaler setting will affect the resolution, but not the accuracy. The accuracy only depends on the LF clock source. If you are using the LFRC, that will be 500 ppm, if calibrated (which happens automatically if you are using the SoftDevice). If you need a better accuracy then that, you will need an 32.768 kHz crystal, and configure that as a clock source. In that case, the accuracy of the RTC and app_timer, will be equal to the accuracy of the crystal.

    Note that the above assumes that you do not introduce any delays in  your firmware. For instance, make sure to use "repeated" app timer, and not to re-start a timer in the timeout handler. If you do, you will introduce delays that are not compensated for, that will accumulate over time. If you use a repeated timer, that will not happen as it is handled internally in the library.

Related