Line 144 of timers.h:
#define _RTC_PRESCALE_VALUE (0x05)
Should be:
#define _RTC_PRESCALE_VALUE (0x28)
This affects line 367 of wiring.c
RTC.CTRLA = (RTC_RUNSTDBY_bm|RTC_RTCEN_bm|_RTC_PRESCALE_VALUE);//fire it up, prescale by 32.
Per pg 274 of the data sheet:
So, the divide by 32 prescaler is 0x05, but it is shifted 3 bits.
To test this, under the tools menu in the Arduino IDE, set millis()/micros() Timer to RTC:
Using the stock blink example, the led will flicker very fast. Adding the following to setup corrects the prescaler value and blink rate:
while(RTC.STATUS);
RTC.CTRLA |= (0x28);
See pull request #1289
Line 144 of timers.h:
#define _RTC_PRESCALE_VALUE (0x05)Should be:
#define _RTC_PRESCALE_VALUE (0x28)This affects line 367 of wiring.c
RTC.CTRLA = (RTC_RUNSTDBY_bm|RTC_RTCEN_bm|_RTC_PRESCALE_VALUE);//fire it up, prescale by 32.Per pg 274 of the data sheet:
So, the divide by 32 prescaler is 0x05, but it is shifted 3 bits.
To test this, under the tools menu in the Arduino IDE, set millis()/micros() Timer to RTC:
Using the stock blink example, the led will flicker very fast. Adding the following to setup corrects the prescaler value and blink rate:
while(RTC.STATUS);RTC.CTRLA |= (0x28);See pull request #1289