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.

CCS/MSP430F6435: Oscillator fault flag OFIFG always high

Part Number: MSP430F6435

Tool/software: Code Composer Studio

I am currently having problem with my code and am unable to detect whether there is some problem in configuration of the clock or configuration of RTC_B. It would be grateful if anybody provides help for resolving the issue and highlight the part I am missing out. I am providing my init functions for further referral

void vMspclock_init(void)
{
	//-----------
    //General Settings
    UCSCTL6 &= ~(XT1OFF);                      // Enable XT1 for RTC_B
    UCSCTL6 &= ~XT2OFF;                        // Enable XT2 for MCLK, SMCLK, ACLK
    UCSCTL3 |= SELREF_2;                       // Reference to FLL is given from XT2
    UCSCTL6 |= XT2DRIVE_3;                      //Selecting high current drive capacity and current consumption for 32 MHz crystal
    //UCSCTL7                                   //This register is used to check oscillator fault flag, ie if there  is some error in the osc due to supply conditions

    //Init MCLK
    UCSCTL4 |= SELM_5;                         //Uses XT2(32MHz) crystal oscillator source
    UCSCTL5 |= DIVM_5;                          //Divides the clock source by 32, ie. 32/32 = 1Khz

    //Init SMCLK
    UCSCTL4 |= SELS_5;                         ////Uses XT2(32MHz) crystal oscillator source
    UCSCTL5 |= DIVS_0;                          //Divides the clock source by 1, ie. 32/1 = 32Khz

    //Init ACLK
    UCSCTL4 |= SELA_5;                         ////Uses XT2(32MHz) crystal oscillator source
    UCSCTL5 |= DIVA_3;                          //Divides the clock source by 8, ie. 32/8 = 4Khz
}

And function for init of RTC_B is

void init_RTC_B()       //NO PRESCALER USED
{

    // Setup Clock
    UCSCTL6 &= ~(XT1OFF);                     // 32Mhz capacitor used for MCLK, SMCLK, ACLK
    UCSCTL6 |= XCAP_3;                        // Cap 12pF configuration each
    while(BAKCTL & LOCKBAK)                   // Unlock XT1 pins for operation
       BAKCTL &= ~(LOCKBAK);
    do
    {
      UCSCTL7 &= ~(XT1LFOFFG + DCOFFG);
                                              // Clear XT1,DCO fault flags in case of possible faults that could set these registers high
      SFRIFG1 &= ~OFIFG;                      // Clear oscillator fault flags
    }while (SFRIFG1&OFIFG);                   // --------------------------------------------------------CODE IS STUCK HERE

    RTCCTL0 |= RTCAIE;           //Alarm interrupt for wake up from low power mode
    //RTCAIFG  is the interrupt register

    RTCCTL1 |= RTCHOLD;                        //Disables the calender mode
    RTCAMIN = 0x81;
    RTCAHOUR = 0x00;

    RTCHOUR = 0x5;//RTCHOUR = 0x5;
    RTCMIN = 0x00;//RTCMIN = 0x00;
    RTCSEC = 0x00;//RTCSEC = 0x00;
}

further information

1. XT1 is 32.768KHz and XT2 is 32MHz

2. I am using LPM3 and alarm interrupt in further code. Thanx

**Attention** This is a public forum