No matter what I try, the oscillator fault reoccurs. I have verified the 24 MHz xtal is ringing
(yes - using correct test methods). The 5738 has two pins PJ.4 and PJ.5 for the xtal, so
I had top guess that meant the PJSEL had to be set for those bits - not mentioned anywhere.
Is that true? Then, here's the startup code...
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
SFRIE1_L = 0; // no interrupts please
init_Ports(); // start out fresh - sets up XT1 pins
PJSEL1 = 0; // PJ.4 and PJ.5 are the crystal XIN XOUT
PJSEL0 = BIT4 | BIT5; // select "tertiary function"
CSCTL0 = 0xA500; // password to access clock system
CSCTL1 = DCORSEL + DCOFSEL_3; // Set DCO to 24 MHz
CSCTL2 = 0; // set ACLK = XT1; SMCLK = XT1 MCLK = XT1
CSCTL3 = 0; // set all dividers to one
CSCTL4 = XT2OFF | XT1DRIVE_3 | XTS; // max XT1 drive / high freq mode
CSCTL6 = 0;
CSCTL0_H = 0; // close out password
for(x=0; x++>0; CSCTL5 &= ~XT1OFFG);
while (SFRIFG1 & OFIFG); // Test XT1 oscillator fault flag - Wait for XT1 to stabilize
{ CSCTL5 &= ~XT1OFFG; // Clear XT1 fault flag
SFRIFG1 &= ~OFIFG; // Clear XT1 oscillator fault interrupt flag
}
It never gets out. OFIFG stays set. I can run on the DCO just fine - but I need the crystal for stability.
Has anybody got a clue as to what is wrong? DK