AnsweredAssumed Answered

Cannot get MCF51AC256 into FEE mode

Question asked by Kaare Mai on Jan 17, 2011
Latest reply on Jan 18, 2011 by Kaare Mai

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:

 

32.768KHz external clock

 

 

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

Outcomes