Timer error is large. How to determine the clock source of the timer

I use ncs3.0.2 to develop the 54l10 chip. I created a timer using k_timer, with a period of 1 second, to record the device time. Although I have adjusted the load capacitors for the high-speed crystal and low-speed crystal, and measured the crystal's period with an oscilloscope, I can see it is 32.0003MHz and 32.768kHz, which is already very accurate, but through this timer, there is still an error of about 2.5 seconds per day.

Previously, on the board of the 52833 chip developed using NRF5, a timer was created with APP_TIMER_DEF macros, and the period was also 1 second, and the daily error was less than 1 second
I checked the information and found that it may be k_timer that the internal oscillator was used as a clock source instead of an external crystal oscillator, which caused the timing error problem?

CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=1000000
CONFIG_SYS_CLOCK_TICKS_PER_SEC=31250
The above two values are also integer multiples
How should I troubleshoot this issue?
Parents Reply Children
  • For a 32.768kHz crystal oscillator, 30ppm is approximately 1Hz. The oscilloscope we use can display frequency with 4 decimal places, so this should be able to show the difference, right? If not, how should we know if the load capacitance is appropriate?

    This is part of the parameters of a 32.768kHz crystal oscillator. According to this CL value, the load capacitance should be in the range of several pF, but when we measure the crystal oscillator frequency with an oscilloscope, the actual frequency is most accurate with a load capacitance of 20 or 22pF.

Related