This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR2100: How to clock RTC counter from REFO (32768 Hz)

Part Number: MSP430FR2100

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

  • Hi Johannes,

    That's actually not a typo. The RTC can use the SMCLK or ACLK when operating in Active and LPM0, and ACLK in LPM3.
    It's not clear from the documentation how to select between the SMCLK and ACLK independent of the operating mode so let me dig into this for you.
  • Ok,  turns out there is a revision in the datasheet that is a "work in progress" that will include a footnote pointing you to the following register.

    So until then I captured the register from the user's guide to show you will need to set the RTCCKSEL bit in the SYSCFG2 register to select the clock source for the RTC.

  • Works like a charm!

    1) The prescalers probably worked all the time, but when the clock ran at 1 MHz, my code looped too slow to catch that. Should have understood that. 

    2) I didn't spot until now that SYSCFG2 is detailed on six different places in the SLAU445G (Users guide), covering six different MSP430 series. The device I use (FR2100) is not covered by any of those. So perhaps this should also be updated, while you are at it.. 

    Thanks a lot! 

**Attention** This is a public forum