static void mcf5223x_pll_init(void) {
//MCF_CLOCK_CCHR = 0x05; // The PLL pre divider -> 25MHz / 5 = 5MHz
(This is wrong) /* The PLL pre-divider affects this!!!
* Multiply 25Mhz reference crystal /CCHR by 12 to acheive system clock of 60Mhz
*/
MCF_CLOCK_SYNCR = 0
//|MCF_CLOCK_SYNCR_LOLRE // No reset on Loss Of Lock
| MCF_CLOCK_SYNCR_MFD(4) // CLK * 12
| MCF_CLOCK_SYNCR_RFD(0) // CLK / 1
//| MCF_CLOCK_SYNCR_LOCRE // No reset on Loss Of Clock
//| MCF_CLOCK_SYNCR_LOCEN // Loss Of Clock Disabled
//| MCF_CLOCK_SYNCR_DISCLK // CLKOUT Enabled
//| MCF_CLOCK_SYNCR_FWKUP // Wait PLL is locked
| MCF_CLOCK_SYNCR_CLKSRC // PLL Drive System Clock
| MCF_CLOCK_SYNCR_PLLMODE // PLL Mode
| MCF_CLOCK_SYNCR_PLLEN; // PLL Enabled
(this is absolutely necesary to do enable before) MCF_CLOCK_CCHR = MCF_CLOCK_CCHR_CCHR(4); // The PLL pre divider -> 25MHz / 5 = 5MHz
(This is Good) // Reset PLL to use CCHR
(and Disable and RE-Enable)
MCF_CLOCK_SYNCR &= ~MCF_CLOCK_SYNCR_PLLEN;
MCF_CLOCK_SYNCR |= MCF_CLOCK_SYNCR_PLLEN;
while (!(MCF_CLOCK_SYNSR & MCF_CLOCK_SYNSR_LOCK)) {
// PLL not locked
}
}
Bye and good luck all.