I don't know why I can't clear XT1OFFG.
I wrote the following code based on the link below, but I can't get out of the while and clear the flag. What is the possible problem?
#include <msp430.h>
int main(void){
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P2SEL0 |= BIT0 | BIT1;
do {
CSCTL7 &= ~( XT1OFFG | DCOFFG ); // Clear XT1,DCO fault flags
SFRIFG1 &= ~OFIFG; // Clear fault flags
} while (SFRIFG1 & OFIFG); // Test oscillator fault flag
while(1){
/* code*/
}
}