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.

MSP430F5529 LF XT1 runs fine at 32768, but can't clear XT1LFOFFG



I have two different 5529 boards, and I'm using the "XT1 sources ACLK" sample code. It initializes XT1, waits for the oscillator flags to clear:

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

My old board gets through this fine, but the new board hangs in this loop because XT1LFOFFG  won't clear. I put a scope on P1.0 and there is a nice 32kHz square wave.

Any ideas what could be happening?

-Lee Gordon 

  • What board? LaunchPads? Which version? Is all the code exactly the same?
  • This is a board of our own design, based on the 5529 LaunchPad. It is a slight variation of an older board which works fine. I wonder what could cause the XT1LFOFFG  to continually go high even though the MCU P1.0 sends out a nice 32KHz square wave. 

    The code is just the example code from the CCS resource explorer. It stays in the do loop that is supposed to allow XT1 to settle.

    #include <msp430.h>

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

    P1DIR |= BIT0; // ACLK set out to pin
    P1SEL |= BIT0;
    P5SEL |= BIT4+BIT5; // Select XT1

    UCSCTL6 &= ~(XT1OFF); // XT1 On
    UCSCTL6 |= XCAP_3; // Internal load cap
    UCSCTL3 = 0; // FLL Reference Clock = XT1
    PJDIR =0xF;
    PJOUT = BIT0;

    // OFIE

    // Loop until XT1,XT2 & DCO stabilizes - In this case loop until XT1 and DCo settle
    do
    {
    UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG);
    // Clear XT2,XT1,DCO fault flags
    SFRIFG1 &= ~OFIFG; // Clear fault flags
    }while (SFRIFG1&OFIFG); // Test oscillator fault flag
    PJOUT = BIT2;



    UCSCTL6 &= ~(XT1DRIVE_3); // Xtal is now stable, reduce drive strength

    UCSCTL4 |= SELA_0; // ACLK = LFTX1 (by default)

    __bis_SR_register(LPM3_bits); // Enter LPM3
    __no_operation(); // For debugger
    }

  • Section 5.2.12 of the User's Guide says:

    If ACLK is sourced from XT1 in LF mode, an oscillator fault causes ACLK to be automatically switched to the REFO for its clock source (REFOCLK).

    And REFO also runs at 32.768 Hz, only with less precision.

    What is that "slight variation"? Or the crystal/soldering could be bad.

  • Interesting. Can I change REFO so that I can tell it apart from the crystal? Later this morning I will test a series of boards. If they all do the same thing, then I have to conclude we did something dumb in our redesign.
  • Section 5.2.3: No I can't change REFO.
  • If you don't notice the difference, why have the crystal in the first place? ;-)

    Anyway, you can detect REFO being used only with the XT1LFOFFG bit (or the NMI, if enabled).

  • > If you don't notice the difference, why have the crystal in the first place? ;-)
    LOL. The crystal is for time keeping. The REFO kicking in is a nice backup, but if you don't realize what is going on, it would be disappointing to discover the clock has lost a few days. I was about ready to make that mistake.
  • Solved! We have two crystals: 32 kHz and 24 MHz, The assembly house reversed them. Not understanding how REFO worked had me looking in the wring places. Thanks Clemens for the explanation. 

**Attention** This is a public forum