1) I have tried numberous experiments and I can get past the while loops:
/* MCG_C1: CLKS=0,FRDIV=0,IREFS=0,IRCLKEN=1,IREFSTEN=0 */
MCG_C1 = (MCG_C1_CLKS(0x00) | MCG_C1_FRDIV(0x00) | MCG_C1_IRCLKEN_MASK);
/* MCG_C4: DMX32=1,DRST_DRS=3 */
MCG_C4 |= (MCG_C4_DMX32_MASK | MCG_C4_DRST_DRS(0x03));
/* MCG_C5: ??=0,PLLCLKEN0=0,PLLSTEN0=0,PRDIV0=0 */
MCG_C5 = MCG_C5_PRDIV0(0x00);
/* MCG_C6: LOLIE0=0,PLLS=0,CME0=0,VDIV0=0 */
MCG_C6 = MCG_C6_VDIV0(0x00);
while((MCG_S & MCG_S_IREFST_MASK) != 0x00U) { /* Check that the source of the FLL reference clock is the external reference clock. */
}
while((MCG_S & 0x0CU) != 0x00U) { /* Wait until output of the FLL is selected */
}
2) The code snippet above is from Processor Expert.
3) I have tried numberous experiments and I always have the same problem. Any know issues with Processor Expert?
4) I have studied the TWR-K60D100M and TWR-K20D72m and both don't have any code for Internal Clocks (FBI, FLL, bsp_cm.c,_xxx_initialize_hardware).
5) bsp_cm.c: _pe_initialize_hardware and _bsp_set_clock_configuration are doing the same thing. Why are both methods (or functions) called? Should I set the MCG twice?
6) I tried the AutoTrim, but got stuck in the while loop (why am I not surprised?).
7) any ideas?