I have found my build from the Clock generator is crashing after generating the clock.c code with the off-line Expert Configuration tool. A value is being set in MCG->C7, in fsl_clock.c, however there is NO C7 in the MCG for the K20dx256ZVLL10.
This is on the MK20DX256ZVLL10, and the MK60DN512VLL10 the clock generation tool with SDK2.2 is generating/using code in the fsl_clock.c module with the call below
status_t CLOCK_SetExternalRefClkConfig(mcg_oscsel_t oscsel)
that accesses MCG->C7, however there is no MCG->C7
which then results in a hard fault. If I comment out the line
//**rwl MCG->C7 = (MCG->C7 & ~MCG_C7_OSCSEL_MASK) | MCG_C7_OSCSEL(oscsel);
there is no trap, but the system hangs at
while ((MCG->S & (MCG_S_IREFST_MASK | MCG_S_CLKST_MASK)) !=
(MCG_S_IREFST(kMCG_FllSrcExternal) | MCG_S_CLKST(kMCG_ClkOutStatExt)))
{
}
I can comment this out and manually configure the clocks but the next time the generator is run it will overwrite the code. Is this a problem with the generator, or the SDK 2.2 (freertos, usb, fat)?
Does anyone know a workaround, or perhaps I am not doing something correct. There are no errors in the Diagram or the output HTML configuration.
Any advice would be greatly appreciated.
Thanks
Robert