Hi,
I have a hardware design where we use an external 32.768KHz crystal oscillator. The output looks like this, measured on the XTAL pin:

The problem is that i cannot get the MCU to switch over to FEE mode! It keeps waiting for MCGSC_OSCINIT, which will never set. Here's the code for clock init:
void initClock()
{
// BDIV = 0, HGO = 1, EREFS = Oscillator selected
MCGC2 = 0x14;
// CLKS = FLL mode, IREFS = External ref. clock
MCGC1 = 0x00;
// Wait until external oscillator has initialized
while(!MCGSC_OSCINIT) { };
// DMX32 = 1, DRS = 1 => 39.85MHz CPU clock
MCGC4 = 0x21;
// Wait for FLL to acquire new lock
while(!MCGSC_LOCK) { };
}
If i don't call the initClock, then my program will run jsut fine on the internal clock. Adding this routine makes the program stop at MCGSC_OSCINIT, waiting for it to be set, but this never happens!
What am i doing wrong here?
Regards, Kaare Mai