As you all know, Arduino UNO R4 does not have an external crystal oscillator, so when using RTC, the time lags by about 10 minutes a day.
There were many discussions by various people, which were very helpful.
I first switched the main clock (MOCO) to an externally attached crystal and looked at the RTC, but the deviation was the same.
Next, I tried to correct the RTC using the clock error correction register (RADJ), but the data sheet says that RADJ cannot be used with the internal clock (LOCO 32.768 kHz).
And I installed an external crystal (32.768 kHz), but I couldn't figure out how to switch the clock source in the sketch.
Finally, I rewrote "define RTC_CLOCK_SOURCE RTC_CLOCK_SOURCE_LOCO" on line 455 of RTC.cpp to "define RTC_CLOCK_SOURCE RTC_CLOCK_SOURCE_SUBCLK".
As a result, the time difference became less than 1 second per day.
So, my question is,
1 is it possible to switch the clock source by manipulating registers in the sketch without rewriting RTC.cpp?
2 Is there a way to check the settings of registers such as clock source in Arduino IDE?
I'm using Google Translate.