Hi.
Currently I'm facing a problem of RTC clock accuracy.
After running around 5 hours, the RTC clock is 5 minutes ahead of actual time, which is too low accuracy to make a clock application.
Then I've checked the RTC peripheral initialization code and I've found that the RTC peripheral uses internal 32[kHz] oscillator instead of external 32[kHz] crystal oscillator, which is less precise and accurate than crystal oscillator.
So this PR modifies RTC initialization code to use 32[kHz] crystal oscillator if available.
According to the ArduinoCore-samd source code (startup.c), the 32k crystal is enabled by the Arduino core if CRYSTALLESS is not defined.
Hi. Currently I'm facing a problem of RTC clock accuracy.
After running around 5 hours, the RTC clock is 5 minutes ahead of actual time, which is too low accuracy to make a clock application.
Then I've checked the RTC peripheral initialization code and I've found that the RTC peripheral uses internal 32[kHz] oscillator instead of external 32[kHz] crystal oscillator, which is less precise and accurate than crystal oscillator.
So this PR modifies RTC initialization code to use 32[kHz] crystal oscillator if available.
According to the ArduinoCore-samd source code (startup.c), the 32k crystal is enabled by the Arduino core if
CRYSTALLESS
is not defined.https://github.com/Seeed-Studio/ArduinoCore-samd/blob/master/cores/arduino/startup.c#L66
Thus, we can use safely without initializing XOSC32K if
CRYSTALLES
is not defined.If
CRYSTALLES
is defined, we can just use the original RTC clock initilalization code.