AnsweredAssumed Answered

K60 MCGOUTCLK gets divided by 4

Question asked by age on Oct 4, 2013
Latest reply on Oct 4, 2013 by Chris Brown

Hello!

 

I have a PK60FN1M0VLQ12 CPU on the TWR-K60F120M board and I'd like to configure it to run at 120 MHz from the onboard 50 MHz oscillator. I have studied documentation on the MCG and come up with the following code:

 

MCG_C7 &= ~MCG_C7_OSCSEL_MASK;
MCG_C2 = MCG_C2_RANGE(0x02) | MCG_C2_IRCS_MASK;
MCG_C1 = MCG_C1_CLKS(0x02) | MCG_C1_FRDIV(0x04) | MCG_C1_IRCLKEN_MASK;
MCG_C4 &= ~(MCG_C4_DRST_DRS_MASK | MCG_C4_DMX32_MASK);
MCG_C5 = MCG_C5_PRDIV(0x4);
MCG_C6 = MCG_C6_VDIV(28);
while (!(MCG_S & MCG_S_IREFST_MASK));
while ((MCG_S & MCG_S_CLKST_MASK) != MCG_S_CLKST(2));
MCG_C6 |= MCG_C6_PLLS_MASK;
while (!(MCG_S & MCG_S_LOCK_MASK));
MCG_C1 = MCG_C1_CLKS(0x00) | MCG_C1_FRDIV(0x04) | MCG_C1_IRCLKEN_MASK;
while ((MCG_S & 0x0CU) != 0x0CU);
SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(0x00) | SIM_CLKDIV1_OUTDIV2(0x01);

 

Please note lines 5 and 6: with these division/multiplication values, I end up with a 110 MHz clock, as I have verified by enabling MCGCLKOUT output on TRACE_CLKOUT pin hooking it up with a scope. So, the end equation for frequency calculation is: ((50 / 5) * (16 + 28)) / 4 = ((50 / 5) * 44) / 4 = 110 MHz;

I can not understand where the /4 division comes from; the most I could find is a division by 2 in PLL0. Could someone please show me what I missed? I'm using this reference manual: http://cache.freescale.com/files/microcontrollers/doc/ref_manual/K60P144M150SF3RM.pdf

Outcomes