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.

I had project code want to clear the oscillator fault flag ,but it didn't help

Hello

I had a project initialization PIN PJ.4 and PJ.5 as IO to driving leds ,and my project code must to test
HFXT oscillator fault flag,therefore,the oscillator fault can not be to clear.
Following is my project code:

cstartup.s43 file

1. BIC.W #LOCKLPM5,&PM5CTL0                              // Disable the GPIO power-on default high-impedance mode
2. BIS.B #BIT0,&P1DIR                              // Set P1.0 to output direction
3. BIS.B #BIT0,&P1OUT                                  // P1.0 output high
4. BIS.B #BIT4,&P7DIR                                    // Output SMCLK
5. BIS.B #BIT4,&P7SEL1                                   // Output SMCLK
6. BIS.B #BIT4,&P7SEL0

main.c file

1. void main(void)
2. {
3. WDTCTL = WDTPW | WDTHOLD;                                       // Stop WDT
4. FRCTL0 = FRCTLPW | NWAITS_1;
5. PJDIR |= BIT4 + BIT5;                                        //Set P7.4 P7.5 to output direction
6. PJOUT |= BIT4 + BIT5;                             //output high
7. // Clock System Setup
8. CSCTL0_H = CSKEY >> 8;                             // Unlock CS registers
9. CSCTL1 = DCOFSEL_4 | DCORSEL;                                // Set DCO to 16MHz
10.
11. CSCTL3 = DIVS__1 | DIVM__1;
12. CSCTL4 |= LFXTOFF;
13. do
14. {
15. CSCTL5 &= ~HFXTOFFG;                          // Clear HFXT fault flag
16. SFRIFG1 &= ~OFIFG;
17. }while (SFRIFG1&OFIFG);                        // Test oscillator fault flag,and there can't clear
18. CSCTL0_H = 0;                               // lock CS registers
19. P1OUT ^= BIT0;                                //toggle P1.0
20. while (1);
21.}

**Attention** This is a public forum