I have a custom board with K65 and 24MHz crystal instead of 8MHz crystal in the original evaluation kit design.
I made changes in bsp_cm.h as MCG_C5 = (MCG_C5 & ~MCG_C5_PRDIV_MASK) | MCG_C5_PRDIV(3) along with setting external crystal as 24MHz to account for the clock changes.
There is something unusual happening and I doubt it has something to do with BSP configuration. Code works properly at times, but at certain instances, it loops in Cpu_SetMCGModeFBE(). Then if i reset the device twice, it works properly. If anyone has faced similar issue, it would be great if they can share the work around for the same or at least help me with configuration (if it is because of this) needed to account for the clock change.
Thanks in advance