I'm having trouble with Grace and setting up the basic clock source for a MSP430F249. With the following settings I receive no MCLK or SMCLK output on their respective pins. I've probed the XT2IN pin and there is definitely a 16 MHz clock going into the device. Any ideas?
Grace code output for BCSplus init (I removed commenting):
void BCSplus_graceInit(void) { BCSCTL2 = SELM_2 | DIVM_0 | SELS | DIVS_0; if (CALBC1_16MHZ != 0xFF) { __delay_cycles(100000); DCOCTL = 0x00; BCSCTL1 = CALBC1_16MHZ; DCOCTL = CALDCO_16MHZ; } BCSCTL1 |= DIVA_0; BCSCTL1 &= ~XT2OFF; BCSCTL3 = XT2S_2 | LFXT1S_0 | XCAP_0; }
Oscillator Fault ISR:
__interrupt void NMI_ISR_HOOK(void) { do { IFG1 &= ~OFIFG; // Clear OSC Fault flag __delay_cycles(50000); // Time for flag to set again } while (IFG1 & OFIFG); // Loop while OSC Fault flag is set IE1 |= OFIE; // re-enable osc fault interrupt P1OUT |= BIT7; }
Oscillator circuit: