Other Parts Discussed in Thread: MSP430FR5994
I'm trying to configure an MSP430FR5969 to use an external 16MHz clock oscillator which drives the HFXIN pin. However, I am not able to successfully configure the clock system to use this clock. The clock source seems to default to internal MODCLK (MODOSC), because my timer code sppears to be driven by a 4.8MHz source instead of a 16MHz source. This failsafe default occurs when a HFXT clock fault occurs that cannot be cleared, as described in the data sheet. I've probed the PCB and the clock looks stable with no overshoot, 50% duty cycle, etc. I am looking for suggestions as to what might be wrong.
Here is my code to configure MSP430FR5969 for use of the 16MHz ext. clock:
/* * Init for MSP430FR5969 with 16MHz external oscillator driving the HFXIN pin */ void hfxtClockInit_5MHzClock(void){ /* set external pins for use as HFXT */ PJOUT = 0x00; // DS table 6-61, xtal operation is PJSEL1.n=0 PJSEL0.n=1, n=6,7 PJSEL1 = 0x00; PJSEL0 |= BIT6 | BIT7; __delay_cycles(16000UL); CSCTL0_H = CSKEY >> 8; // Unlock CS registers CSCTL1_L = 0b00000000; // DCO 1Mhz (but DCO not used) CSCTL2 = SELS__HFXTCLK | SELM__HFXTCLK; // Set SMCLK and MCLK source = HFXT CSCTL3 = DIVS__1 | DIVM__1; // Set all dividers to 1 // 16MHz is borderline case for HFFREQ_n bits?, see table 3-1 in SLAU367 CSCTL4 |= HFFREQ_3 | HFXTBYPASS; // set clock input freq range // check and clear fault regs do { CSCTL5 &= ~(LFXTOFFG | HFXTOFFG); // Clear XT1 and XT2 fault flag SFRIFG1 &= ~OFIFG; }while (SFRIFG1&OFIFG); // Test oscillator fault flag CSCTL0_H = 0; // Lock CS registers }