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

RTC test issue

Hi,

I am running an RTC unit test on the boards (nRF52840), where I take RTC_Val1 then perform a delay for one second then take another RTC_val2.

My condition for passing the test is:   32768 < RTC_val2 - RTC_val1 < 32768 * 1.015 ( I assume there is some delay when performing the delay and the get RTC value command in between the two values).

The issue is that sometimes I got : RTC_val2 - RTC_val1 < 32768, How is that possible ??

BR

JK

Parents
  • Hi JK,

    It does not look like you handle that the RTC wraps around? If not, then it is expected that your test fails sometimes, when the RTC wraps around between you sampling RTC_val1 and RTC_val2.

    Einar

  • This is not about the wrap around.

    Lets say that the RTC didn't wrap around.

    I am getting the first RTC value, then delay for 1 second and then get second RTC value.

    the second value have to be equal to the first value + 32768. but that is nor accurate, what is the tolerance ? +-tolerance ?

    BR

    JK

  • Hi JK,

    jawadk said:
    the second value have to be equal to the first value + 32768. but that is nor accurate, what is the tolerance ? +-tolerance ?

    There are several factors here. First of all, the accuracy of your 32.768 kHz clock source. If you are using a 32.768 kHz crystal, then the accuracy is whatever is specified for the crystal. If using the internal RC, the accuracy is ±500 ppm if calibrated. Uncalibrated the accuracy is ±5 %. See electrical specification for the LFRC for details. If not calibrated, Secondly, there may be a delay when you sample the clock (getting RTC_val1 and RTC_val2). The latter should not matter on average though, if you do it the same way, but depending on how you do it you could see some jitter. (There could theoretically also be an issue with the reference clock you are using to measure 1 second).

    Einar

Reply
  • Hi JK,

    jawadk said:
    the second value have to be equal to the first value + 32768. but that is nor accurate, what is the tolerance ? +-tolerance ?

    There are several factors here. First of all, the accuracy of your 32.768 kHz clock source. If you are using a 32.768 kHz crystal, then the accuracy is whatever is specified for the crystal. If using the internal RC, the accuracy is ±500 ppm if calibrated. Uncalibrated the accuracy is ±5 %. See electrical specification for the LFRC for details. If not calibrated, Secondly, there may be a delay when you sample the clock (getting RTC_val1 and RTC_val2). The latter should not matter on average though, if you do it the same way, but depending on how you do it you could see some jitter. (There could theoretically also be an issue with the reference clock you are using to measure 1 second).

    Einar

Children
No Data
Related