Hi All
In the meantime I have an explanation why the configuration doesn't "always" work.
See the following code in CPU_init.c (used by PE, or generated by PE (?))
/* System clock initialization */
#if STARTUP_RTCOSC
/* SIM_SCGC6: RTC=1 */
SIM_SCGC6 |= SIM_SCGC6_RTC_MASK;
if ((RTC_CR & RTC_CR_OSCE_MASK) == 0u) { /* Only if the OSCILLATOR is not already enabled */
RTC_CR = (uint32_t)((RTC_CR & (uint32_t)~(uint32_t)(RTC_CR_SC2P_MASK | RTC_CR_SC4P_MASK | RTC_CR_SC8P_MASK | RTC_CR_SC16P_MASK)) | (uint32_t)STARTUP_RTC_CR_SC_VALUE);
RTC_CR |= (uint32_t)RTC_CR_OSCE_MASK;
RTC_CR &= (uint32_t)~(uint32_t)RTC_CR_CLKO_MASK;
}
#endif
Notice that the final instruction executed when the oscillator is not enabled is to clear the CLKO mask. If this mask is set the 32.768kHz generated by the RTC is not actually availabe as physical output for use by the MCG, in which case the attempted switch to the external clock input to the FLL 'will' hang.
The probem is that if the RTC on the board is already operating and has the mask set (which was the case when I initially tested) the oscillator initialisation will be skipped and the mask left on, with the result that the clock initialisation fails (hangs).
This means that the CLKO mask reset should be performed unconditionally so that new code loaded to a board that has the RTC already configured can't fail. It should therefore actualy be outside of the if ()
Below I have added the CLKO mask switch to the MCG diagram since it is otherwise not seen and can result in unnecessary study being required in such cases.

Regards
Mark