We have a board using a Kinetis K64 part, and software built on MQX with a BSP cloned from that for the K64 tower, which uses Processor Expert to initialise the CPU.
A difference between our board and the tower is that we have a 12MHz crystal connected to the system oscillator pins, whereas the tower and other Freescale demo boards such as Freedom board generally feed an external clock signal in.
We have made the necessary changes to the Processor Expert component to enable and use the oscillator, but are seeing a problem with the way in which the Processor Expert-generated code initialises this, resulting in a problem starting up.
We have the "Oscillator Operating Mode" setting configured for "High Gain". What we are seeing is that the CPU starts in FEI mode and then the Processor Expert-generated CPU_SetClockConfigGenMode() in CPI_Init.c carefully moves to FBE (running from the oscillator directly, FLL enabled but unused), then to PBE (ditto, PLL enabled but unused), then to PEE (running from the oscillator multiplied by the PLL).
This all looks good, except that the High Gain bit in the MCG_C2 register is not set until the final PBE->PEE transition. At this point the oscillator is already started and the CPU is using it directly. Turning on high gain at this point causes a big disruption in the oscillator that resets the CPU (I guess one of the loss-of-clock bits trips).
It seems to me that if I request high gain, this should be configured from the start, when the oscillator is first enabled on the FEI->FBE transition, not later after we are already running from it.
Specifically, my complaint is that CPU_DEFAULT_FBE_MCG_C2 and CPU_DEFAULT_PBE_MCG_C2 in the Processor Expert-generated CPU_Config.h are not consistent with the chosen "Oscillator Operating Mode". If I choose high gain then this bit should be set in those constants, and hence used in FBE and PBE modes on the way to the final PEE mode.
Changing those constants fixes our startup problems but is clearly not ideal since the fix has to be re-applied every time the file is re-generated.