AnsweredAssumed Answered

Clock Setting Problem in Processor Expert Code for MK22FN512xxx12

Question asked by Bruno Paillard on Jan 1, 2015
Latest reply on Jan 8, 2015 by Bruno Paillard



The code that processor Expert generates to manage the clocks (set a new clock) on the MK22FN512 does not seem to allow HSRUN mode, except when it is initially set in CPU_CLOCK_CONFIG_0


More specifically, I believe the function CPU_SetClockConfiguration () in CPU_Init.c has the following error:

-     At line 767, the line "  if ((CPU_ClockConfigDescriptors[ClockConfigurationID].PowerMode & CPU_CLOCK_HSRUN_ENABLE_MASK) != 0U) {"   uses ClockConfigurationID, instead of [the argument of the function] ModeID

At that point, ClockConfigurationID has not been initialized to ModeID yet. So it really represents the last clock configuration, NOT the one we want.


-     Moving line 827"  ClockConfigurationID = ModeID;  /* Store clock configuration identifier */"   up, to before line 767 above resolves the problem.


This does not create an immediate problem because it seems that the CPU runs remarkably well at 120 MHz in RUN mode...! At least at room temperatures