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.

RTC_C not working in MSP430

Other Parts Discussed in Thread: MSP430F6779

Hi,

I had tried source code from MSPWARE for RTC_C module in MSP430F6779 device. I have provided the external supply at AUXVCC3 pin. It gets initialized into all RTC registers. But, it doesn't enter into ISR.

Can anyone tell me what could be the problem or cause of it?

Thank you.

Regards,

Abhi

  • Too little information.
    1. Which example file are you using?
    2. Are you using a launchpad kit or custom board?
    3. What condition are you expecting to happen to cause the ISR to execute?
  • Hi Abhishek,

    In addition to what Brian said, can you please check the 32 KHz sourcing into ACLK

    Thanks and Regards
    Nishant
  • #include <msp430.h>
    volatile int sec,hr,min,day,mon,yr;

    void main(void)
    {
    WDTCTL = WDTPW | WDTHOLD; // Stop WTD

    // Initialize LFXT1
    UCSCTL6 &= ~(XT1OFF); // Enable XT1
    UCSCTL6 |= XCAP_3; // Internal load cap

    // Loop until XT1, XT2 & DCO fault flag is cleared
    do
    {
    UCSCTL7 &= ~(XT2OFFG | XT1LFOFFG | DCOFFG);
    // Clear XT2,XT1,DCO fault flags
    SFRIFG1 &= ~OFIFG; // Clear fault flags
    } while (SFRIFG1 & OFIFG); // Test oscillator fault flag
    //

    P1OUT &= ~BIT0; // Clear P1.0 output
    P1DIR |= BIT0; // Set P1.0 as output

    //Enable the charger for AUXVCC3 with Pass_key, Charger Current
    AUX3CHCTL = AUXCHKEY + AUXCHEN + AUXCHC_1 + AUXCHV_1;

    // Configure RTC_C
    RTCCTL0_H = RTCKEY_H; // Unlock RTC_C module
    RTCCTL0_L |= RTCRDYIE | RTCTEVIE; // Enable RTC time event,
    //int a= RTCCTL0_L; // read ready interrupt
    RTCCTL1 |= RTCBCD | RTCHOLD | RTCMODE; // RTC enable BCD mode, RTC hold
    // RTCTCCTL0 &= ~(TCEN); // Tamper Disable

    RTCYEAR = 0x2011; // Year
    RTCMON = 0x12; // Month
    RTCDAY = 0x05; // Day
    RTCDOW = 0x03; // Day of week
    RTCHOUR = 0x14; // Hour
    RTCMIN = 0x45; // Minute
    RTCSEC = 0x50; // Seconds

    RTCADOWDAY = 0x03; // RTC Day of week alarm
    RTCADAY = 0x22; // RTC Day Alarm
    RTCAHOUR = 0x23; // RTC Hour Alarm
    RTCAMIN = 0x45; // RTC Minute Alarm

    RTCCTL1 &= ~(RTCHOLD); // Start RTC calendar mode
    RTCCTL0_H = 0; // Lock RTC_C module


    *while( RTCRDY & RTCCTL1)
    {
    hr=RTCHOUR;
    }

    __bis_SR_register(GIE); // Enable Interrupts

    while(1);
    /{
    unsigned int b;
    b=RTCIV;

    }

    // __no_operation();
    }

    // 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, 16))
    {
    case RTCIV_NONE: // No interrupts
    break;
    case RTCIV_RTCOFIFG: // RTCOFIFG
    break;
    case RTCIV_RTCRDYIFG: // RTCRDYIFG
    {
    P1OUT ^= 0x01; // Toggles P1.0 every second
    sec=RTCSEC;
    min=RTCMIN;
    hr=RTCHOUR;
    day=RTCDAY;
    mon=RTCMON;
    yr=RTCYEAR;

    }
    break;
    case RTCIV_RTCTEVIFG: // RTCEVIFG
    //__no_operation(); // Interrupts every minute
    break;
    case RTCIV_RTCAIFG: // RTCAIFG
    //__no_operation(); // Interrupts every alarm event
    break;
    case RTCIV_RT0PSIFG: // RT0PSIFG
    break;
    case RTCIV_RT1PSIFG: // RT1PSIFG
    break;
    // case 14: break; // Reserved
    case 16: break; // Reserved
    default: break;
    }
    }
  • Hello,
    Brian Boorman and Nishant_Bhaskar
    I am using custom board and yes clock is working as expected because all of my other codes are working properly i have checked clock also and it is exactly 32Khz.
    But it is not going into ISR.
    please help...
  • RTCCTL0_L register is giving me value of 8 and 88 continuously even if i modify it or writing zero to it it makes it self 88 or 8 value..

    which represents my RTCOFIE and RTCOFIFG....
    which is 32-kHz crystal oscillator fault interrupt enable. This interrupt can be used as LPM3.5 wake-up event. But we are working on Vcc=3.3V why this interrupt is occuring?
    I am not enabling this Oscillator fault interrupt why it is enabling itself?

    Thank you
  • Linking duplicate thread: e2e.ti.com/.../453023
    Let's try to keep the responses in this thread I linked to avoid duplication of effort - then everyone trying to answer you will be aware of all the information you have posted already.
  • Hi

    I think you need one more external crystal 32kHz connected to xt1 

**Attention** This is a public forum