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.

MSP430FR4133: MSP430FR4133 : Onboard RTC

Part Number: MSP430FR4133

I am working with the onboard RTC of MSP430FR4133 Launchpad. I have to make a clock and alarm system . I referred the code below which makes the RTC in a counter mode. It also says that RTC is triggered by a SMCLK. 

#include <msp430.h>

int main(void)
{
    WDTCTL = WDTPW | WDTHOLD;               // Stop watchdog timer

    P4SEL0 |= BIT1 | BIT2;                  // set XT1 pin as second function

    do
    {
        CSCTL7 &= ~(XT1OFFG | DCOFFG);      // Clear XT1 and DCO fault flag
        SFRIFG1 &= ~OFIFG;
    }while (SFRIFG1 & OFIFG);               // Test oscillator fault flag

    P1OUT &= ~BIT0;                         // Clear P1.0 output latch for a defined power-on state
    P1DIR |= BIT0;                          // Set P1.0 to output direction

    PM5CTL0 &= ~LOCKLPM5;                   // Disable the GPIO power-on default high-impedance mode
                                            // to activate previously configured port settings

    // Initialize RTC
    // RTC count re-load compare value at 32.
    // 1024/32768 * 32 = 1 sec.
    RTCMOD = 32-1;
    // Source = 32kHz crystal, divided by 1024
    RTCCTL = RTCSS__XT1CLK | RTCSR | RTCPS__1024 | RTCIE;

    __bis_SR_register(LPM3_bits | GIE);     // Enter LPM3, enable interrupt
}

// RTC interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=RTC_VECTOR
__interrupt void RTC_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(RTC_VECTOR))) RTC_ISR (void)
#else
#error Compiler not supported!
#endif
{
    switch(__even_in_range(RTCIV,RTCIV_RTCIF))
    {
        case  RTCIV_NONE:   break;          // No interrupt
        case  RTCIV_RTCIF:                  // RTC Overflow
            P1OUT ^= BIT0;
            break;
        default: break;
    }
}

My question is 

1. Is there any AUXVCC3 pin , where I can connect 3.0 battery like CR2032 , and be able to count the time elapsed when the Launchpads power is taken off. ?

2. Another thing is , if there is such AUCVCC3 pin, I can only monitor RTCCNT count for knowing the time elapsed ? I wish to know the framework of such approach. Would like to try it out 

  • Hi Madhusudan,

    Unfortunately on the FR4133 there is no separate AUXVCC pin that can be used to power the RTC using an external battery.
    However, the FR4133 can be placed into LPM3.5 (power to RTC and LCD only) and will wakeup from this mode through a pin toggle on ports P1 OR P2. You can also connect a battery to the device VCC through a protection diode (prevents the power supply from pushing current into the battery when power supply is on). You will also need a second protection diode to protect the power supply (when turned off) from the battery trying to power the VCC in the system.

    The RTC can be configured to wakeup the CPU from LPM3.5 on a periodic basis. This is how you will know when time has elapsed.

    In LPM3.5, you can't use SMCLK. You will need to use an external 32KHz crystal connected to XT1 or the internal VLO as a clock source for the RTC.
  • Thanks Dennis .. Working on it with existing examples on TI Resource Explorer

**Attention** This is a public forum