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.

MSP430FR5972: HIGH-FREQUENCY CRYSTAL OSCILLATOR

Part Number: MSP430FR5972

Hi Experts,

I am using an MSP430FR5972 controller for my project and I need to use HIGH-FREQUENCY CRYSTAL OSCILLATOR i.e 16MHZ  to drive all clock.I have disabled DCO  & turned on HFXT and following clock register settings I am using :
       PJSEL0 |= BIT6;
        FRCTL0 = FRCTLPW | NWAITS_1;
                                                                
        CSCTL0_H = CSKEY >> 8;                                                                         // Unlock CS registers
        CSCTL2 =SELA__VLOCLK | SELS__HFXTCLK | SELM__HFXTCLK;      // Set SMCLK = MCLK = XT2,
                                                                                                                            // ACLK = VLOCLK
        CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1;                     // Set all dividers
        CSCTL4 |= HFXTDRIVE_3 | HFFREQ_3;
        CSCTL4 &= ~HFXTOFF;
        PM5CTL0 &= ~LOCKLPM5;           // Disable the GPIO power-on default high-impedance mode to activate.
The issue I am facing is that SMCLK is not getting 16mhz, inside its getting 4.7mhz but I have checked using an oscilloscope, HFXT is producing 16mhz.only. If  I turn ON the DCO then I get 16mhz on SMCLK. 
Please help !!
Thanks in advance.
  • Please show the entire clock initialization code, including the crystal startup wait loop.
  • Following is entire clock initialization code:

    PJSEL0 |= BIT6;

    FRCTL0 = FRCTLPW | NWAITS_1;

    CSCTL0_H = CSKEY >> 8; // Unlock CS registers
    CSCTL2 =SELA__VLOCLK | SELS__HFXTCLK | SELM__HFXTCLK; // Set SMCLK = MCLK = XT2,
    // ACLK = VLOCLK
    CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1; // Set all dividers
    CSCTL4 |= HFXTDRIVE_3 | HFFREQ_3;
    CSCTL4 &= ~HFXTOFF;

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


    do
    {
    CSCTL5 &= ~ HFXTOFFG; // Clear XT2 fault flag
    SFRIFG1 &= ~OFIFG;
    }while (SFRIFG1 & OFIFG); // Test oscillator fault flag

    CSCTL0_H = 0;

    If I use this do-while loop then my code get stuck inside this loop only.
  • The loop is required.

    If the loop does never end, then the crystal is not oscillating correctly. How exactly did you connect it? What are the load capacitors?
  • I am using two 18pF load capacitors for HFXIN and HFXOUT.
  • I was debugging this issue with H/W team and now I am able to get 16MHZ SMCLK  even with 18pF capacitors but the issue is OFIFG flag is getting set even after clearing it due to which control is not coming out of this loop.

    do
            {
                CSCTL5 &= ~ HFXTOFFG;       // ClearXT2 fault flag
                SFRIFG1 &= ~OFIFG;
            }while (SFRIFG1 & OFIFG);                   // Test oscillator fault flag
    I have even tried with different load capacitors i.e 12pF and 8pF but the issue is still the same but I am able to produce 16mHZ.
    Kindly reply.
    Thanks In Advance.
  • Is OFIFG the only flag that is stuck? Or is HFXTOFFG set, too?
  • Hi Clemens,

    I got the solution of my problem.The problem was that I have to clear the LFXTOFFG bit of CSCTL5 which is true on POR or else the (SFRIFG1 & OFIFG) will always return an error and even I changed load capacitor to 8pF.

    Thank You for your advice.

**Attention** This is a public forum