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.

HELP ME! Oscillator fault flag never clears on msp430f47197



Why
XT1OF = 0 và XT2OF = 0
but LFOF = 1, OFIFG =1,POR = 1, RSTIFG =0!
Here are my code: http://hastebin.com/ixisikekak.avrasm

FLL_CTL0 |= XCAP11PF; // ACLK = 32 KHz, SMCLK= MCLK = TACLK = BRCLK = 1 MHz
for(int i = 0x47FF; i<0; i++);

FLL_CTL0 |= DCOPLUS;
SCFI0 = FLLD_4+FN_8; // x4 DCO freq, 16MHz nominal DCO
SCFQCTL = 121;

FLL_CTL1 &= ~XT2OFF; // disalble XT2
FLL_CTL2 |= XT2S_2;
{
IFG1 &= ~(OFIFG); // Clear OSCFault flag
for (int i = 0x47FF; i > 0; i--); // Time for flag to set
}
while ((IFG1 & OFIFG)); // OSCFault flag still set?*/

FLL_CTL1 |= SELS | SELM_XT2; // SMCLK source select XT2

Can you help me! how to clear it ( OFIFG )?

  • Hello,

    The code host site you posted is blocked on my server so I cannot view your code in its entirety. Does the following code still cause the OFIFG?

    #include <msp430.h>
    
    int main(void)
    {
      volatile unsigned int i;
    
      WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
      FLL_CTL0 |= DCOPLUS + XCAP11PF;           // DCO+ set, freq = xtal x D x N+1
      SCFI0 = FLLD_4+FN_4;                      // x4 DCO freq, 16MHz nominal DCO
      SCFQCTL = 121;                            // (121+1) x 32768 x 4 = 16 MHz
      FLL_CTL1 &= ~XT2OFF;                      // Turn on XT2
    
      // Loop until 32kHz crystal stabilizes
      do
      {
        IFG1 &= ~OFIFG;                         // Clear oscillator fault flag
        for (i = 50000; i; i--);                // Delay
      }
      while (IFG1 & OFIFG);                     // Test osc fault flag
    
      FLL_CTL1 = SELS | SELM_XT2;                 // Select SMCLK source as XT2CLK
      FLL_CTL2 |= XT2S_2;
    
      while(1);                                 // Loop in place
    }
    
    

    If so then your hardware might be at fault. Are you using a custom board or a TI EVM? Have you tried switching out external crystals?

    Regards,
    Ryan

  • Have you made any advancements in solving your crystal issues?

    Regards,
    Ryan

**Attention** This is a public forum