I need to clock the RTC counter from a slow and reasonably accurate clock. The best option I find is the REFO. From the users manual on RTC config:
..and when looking in the FR2100 datasheet, it's ambigous:
..guessing this is a typo, setting the RTCSS to 01b would enable the AUX clock, which by default appears to fall back to REFO clock, in the absence of an external crystal, right?
However, when using this setting the RTC counter appears to count by a clock somewhere around 750 kHz, which is odd, where would that frequency come from? Also the prescalers don't appear to work reliably when using this clock (divider settings do not always change the counter speed).
I have verified that using the VLOCLK works fine with the RTC, but I can't use that due to the poor accuracy.
Please help me here, what did I misunderstand here, in the configuration of the RTC with REFO clock, on MSP430FR2100? Or is this not possible?
My code:
WATCHDOG_TIME EQU 3024 ;32 Hz tick * 90 seconds + 5% margin mov.w #WATCHDOG_TIME,&RTCMOD ;Set count limit bis.w #RTCSS0|RTCPS2|RTCPS1|RTCPS0,&RTCCTL; ;Clock = 01 (AUX/REFO?), prescaler 1024 = 32 Hz tick bis.w #RTCSR,&RTCCTL ;reset counter loop: bit.w #02h,&RTCIV ;Check if RTC counter overflowed jz skip {action on timeout goes here} skip: jmp loop
This code triggers the timeout with around 4 seconds interval, where it should be ~95. Changing the pre-scaler to pass through (1) changes the trigger time to 2 seconds, which does not make any sense at all to me.
Please help, thanks!
/Johannes