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.

MSP430F449: LFXT1 configuration procedure

Part Number: MSP430F449

MSP430 Team,

When configuring the LFXT1 to start on MSP430F4xx devices (e.g., F449), code examples typically show a delay after clearing the OFIFG bit and then looping around, like this:

  // 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

I believe the delay is there to allow the OFIFG bit to set again, but I don't see this documented anyplace.  Also, some code examples do not show the delay.

Is the delay needed?  If so, how long a delay is required?  Is this documented anyplace?

Thank you,

David

  • The oscillator fault interrupt flag indicates that the external crystal is not oscillating properly and traps the CPU in this do while loop until the crystal is running as expected. The delay allows some time for the OFIFG to be set by the hardware if necessary after being cleared by the software loop, and to see whether some more time is required for the crystal to start up. Please review SLAA322, specifically Section 5.4: www.ti.com/.../slaa322d.pdf

    Regards,
    Ryan
  • Thank you for the reply Ryan. Not sure what SLAA322 section 5.4 has to do with this, as that section talks about speeding about oscillator starting by toggling the XTS bit. It has nothing to do with a delay after clearing the OFIFG flag. ??

    - David
  • Hi David,

    To Ryan's point, the flag might not set immediately. So, to be safe, it would be a good practice to clear it and wait for a bit just in case it would set during this time. If within, say, 50000 cycles the flag does not set, then you are sure the crystal is oscillating properly.

    To answer your questions:

    Is it needed? It depends. If your project is to make an LED blink, then maybe not.

    How long should you wait? It depends on how sure you want to be before running the rest of your code.

  • Hi David,

    Based on your original question I figured that the crystal is starting up slowly and iterating through the fault flag loop multiple times, therefore I gave you a solution to help ramp the crystal start-up time.

    Regards,
    Ryan

**Attention** This is a public forum