I'm trying to enable clock output on the CLKOUT pin while running the microcontroller in "High-Frequency, High-Gain" mode.
To enable this output, I configured the microcontroller as follows:
1) I enabled the CLKOUT pin
// enables CLKOUT alternate function on pin PTC3
CLOCK_EnableClock(kCLOCK_PortC);
PORT_SetPinMux(PORTC, 3U, kPORT_MuxAlt5);
2) I enabled the external reference clock on the CLKOUT pin
OSC->CR |= OSC_CR_ERCLKEN(1); // enables OSCERCLK)
SIM->SOPT2 |= SIM_SOPT2_CLKOUTSEL(6); // CLKOUTSEL = OSCERCLK
I'm not able to measure anything on the CLKOUT pin, am I missing something? The same configuration shown above works if I configure the microcontroller in "High-Frequency, Low-Power Mode": in this case I'm able to measure the clock waveform on CLKOUT pin.
(my application works without problems in both "low power" and "high gain" modes)
Thanks for your help.
I managed to solve my problem by dividing the frequency of OSCERCLK by 2
// Divide OSCERCLK clock frequency by 2
OSC->DIV &= ~(OSC_DIV_ERPS_MASK);
OSC->DIV |= OSC_DIV_ERPS(1);
Apparently the clock frequency was too high (10Mhz); if I lower it to 5Mhz it works even in high gain mode.