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.
Hello,
i have a problem with a 4MHz resonator (Type CSTCR4M00G53U-R0) at XT2. It remains always in the loop, because the XT2OFFG flag is set.
Alternatively i tested it with a 4MHz crystal with 12pF load capacitance and it works, but the resonator always failed.
Has anybody an idea what could be the reason?
My code:
void SwitchXT2(U8 OnOff) {
if(OnOff == ON) {
_DINT();
P5SEL |= 0x0C; // Port select XT2
UCSCTL6 &= ~(XT2OFF+XT2BYPASS); // Switch ON XT2 oscillator
UCSCTL6 |= XT2DRIVE_3; // Highest drive setting for XT2startup
do { // wait till oscillator is stable
UCSCTL7 &= ~XT2OFFG; // Clear XT2 fault flags
}while(UCSCTL7 & XT2OFFG); // Test XT2 fault flag
UCSCTL6 = (UCSCTL6 & ~XT2DRIVE_3) | XT2DRIVE_0; //set requested Drive mode
UCSCTL4 = (UCSCTL4 & ~SELS_7) | SELS__XT2CLK; // switch XT2 as SMCLK source
_EINT();
}
else {
UCSCTL6 |= XT2OFF; // Switch XT2 off
}
}
**Attention** This is a public forum