Trying to bring up a Kinetis K20 (MK20FN1M0VMD12) and having issues with the clock.
I ported over code from a 120MHz K70 project which should be virtually identical, other than it has DDR and a display controller module. The code to set the MCG is ported from a K20 120MHz project and comes from Freescale. It is not using the external oscillator and all the dividers are correct. Furthermore, changing them has no effect on the apparent execution speed or the TRACE_CLKOUT wave.
I'm not getting close to 120MHz. The processor seems to run fine using the BMD, but only appears to be running at 20Mhz. When I bring TRACE_CLKOUT to PORTA6, I see a 5.25MHz square wave, always. It's as if the processor is in some kind of limp mode. I've also checked that:
SMC_PMCTRL RUNM mode is 0 (normal run mode)
SIM_CLKDIV1 is set to hex 01240000
I've also checked PMC_LVDSC1 and that looks normal. Returns 0x10
Also: Clock source is external 24MHZ crystal oscillator (vs. 50MHz clock on K70 Tower Dev project), NOT using MQX.
Using "bare metal" startup with defines as:
#define CLK0_FREQ_HZ 24000000
#define CLK0_TYPE CRYSTAL
#define PLL0_PRDIV 2
#define PLL0_VDIV 20
I never see my external crystal oscillator activate. Is there something else I need to do to turn it on? PTA18 and PTA19 are not being re-assigned and should be defaulting to the proper outputs.
Does this point to anything obvious?