You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//Function used to correct the RTC clock//<_Sign> : If the correction must be positive (false) or negative (true)//<_Value> : Value to put in the register from 1 to 127.voidSetClockCorrection(bool _Sign, byte _Value)
{
RTC->MODE2.FREQCORR.reg = (byte)_Sign << 8 || _Value;
}
Your code shifts _Sign one bit too far.
Furthermore, as far as I read the datasheet, there's need for write synchronization, thus you'll have to place something like while(RTC->MODE2.STATUS.bit.SYNCBUSY); before writing the register.
per1234
changed the title
Feature request: Adding a function using the register "FREQCORR" for clock correction
Add function that uses the register "FREQCORR" for clock correction
Oct 31, 2023
The RTC in my chip isn't really accurate. I think I'm not the only one
I looked in the library source code, but didn't find any existing function that allows correcting the clock.
I think it would be very important to add a function to correct the clock. This can be done using the
FREQCORR
" register.Datasheet:
https://cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/Atmel-42181-SAM-D21_Datasheet.pdf
Register in the page 262.
The text was updated successfully, but these errors were encountered: