I have problem to re-enable the external crystal after resuming back from VLPR mode on my k20d50m custom board. The k20 is clocked by 8MHz crystal with two ends connected to ground via a capacitor valued 10pF (both boards with and w/o them populated are tested, same results).
The crystal has no problem to start after powering on but stops to oscillate on the way back to normal mode (via APIs of MQX4.1).
My IAR debugger hangs at
/* MCG_C1: CLKS=2,FRDIV=3,IREFS=0,IRCLKEN=0,IREFSTEN=0 */
MCG_C1 = (uint8_t)0x98U;
When the mode is changed from FBI to FBE and external clock is expected.
I traced the clock output of 8MHz crystal and found no oscillating there after
/* OSC0_CR: ERCLKEN=1,??=0,EREFSTEN=0,??=0,SC2P=0,SC4P=0,SC8P=0,SC16P=0 */
OSC0_CR = (uint8_t)0x80U;
in FBI mode. The only I can see is the voltage on XTAL0 jumps back to 3V from 0V.
The external clock is stopped on the way to VLPR which seems to be OK to me.
What is the reason to cause the crystal NOT to start again? it is the HW or SW problem?