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.

Recovering from an XT1 fault

Other Parts Discussed in Thread: MSP430F5310

Processor: MSP430F5310 IPT rev. C

I am trying to make sure I understand the proper way to recover from an XT1 oscillator fault when ACLK's source is XT1.  The User's Guide (SLAU208J) page 128 says:

"The crystal oscillator fault bits XT1LFOFFG, XT1HFOFFG, and XT2OFFG are set if the corresponding crystal oscillator is turned on and not operating properly. Once set, the fault bits remain set until reset in software, regardless if the fault condition no longer exists. If the user clears the fault bits and the fault condition still exists, the fault bits are automatically set, otherwise they remain cleared.

When using XT1 operation in LF mode as the reference source into the FLL (SELREF = {0}), a crystal fault automatically causes the FLL reference source, FLLREFCLK, to be sourced by the REFO.  XT1LFOFFG is set."

"If a fault is detected for the oscillator sourcing ACLK, ACLK is automatically switched to the DCO for its clock source (DCOCLKDIV) for all clock sources except XT1 LF mode. 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). This does not change the SELA bit settings. This condition must be handled by user software."

Page 130 says:

"NOTE: Fault logic

Please note that as long as a fault condition still exists, the OFIFG remains set. The application must take special care when clearing the OFIFG signal. If no fault condition remains when the OFIFG signal is cleared, the clock logic switches back to the original user settings prior to the fault condition."

I'm using a 32.768 kHz crystal as XT1.  If a fault condition occurs but is then removed, my understanding based on the above quotes is that I will have:

SFRIFG1: OFIFG is set; UCSCTL6: SELA is 000 (XT1CLK); UCSCTL7: XT1LFOFFG is set; ACLK is actually using REFO.

Then (again, assuming fault condition no longer exists) if I clear XT1LFOFFG, then clear OFIFG, ACLK will return to using XT1 instead of REFO.

Am I correct?  Or do I need to manually set SELA to REFOCLK then back to XT1CLK?

  • Yes, for those MSP430 that have REFO any clock sourced by LFXT1 will fall back to REFO in case of oscillator fault, except the FLL which I believe is disabled.

    [Edit: Oops, actually the FLL is only disabled if it was sourcing XT2 and an XT2 fault occurs. Sorry about that.]

  • Also, if you look at MSP430F530x_OF_LFXT1_nmi.c the oscillator fault NMI handler does not change the SELA bits.

    If you think about it, SELA defaults to LFXT1 if available, which wouldn't work if you have to manually set and reset the control register.

**Attention** This is a public forum