Hi CSMG Sarma
The clock setting scheme is quite confusing.
Initialize and setting clock module is complex task. Since we wanted focus on MQX as operating system, we delegate this task to Processor Expert tool.
The _bsp_initialize_hardware function is responsible for basic MCU setting and setting of the Multipurpose Clock Generator (MCG) module. It switches the MCG module from the reset state through the MCG state machine to the default configuration. See more information about the MCG Mode State Diagram in the reference manual for the selected Kinetis platform.
So, _bsp_initialize_hardware function is responsible for initialize clock module from reset state.
Function Cpu_SetClockConfiguration() is used for change clock settings.
Different situation happened when we want change this settings. We can reconfigure clock settings by Processor Expert, generate new code and this new code will overload the default setting in bsp_cm.c. See how the PE_LDD_VERSION is used for conditional compilation of either the default code or the newly generated code.
I agree with you that clock setting scheme could be confusing and there missing some transparent documentation for clock module software architecture. Most useful could be in this document
c:\Freescale\Freescale_MQX_4_1\doc\tools\cw\MQX_Howto_Setup_Kinetis_Clock_UsingPE.pdf
I hope it helps.
Have a great day,
Daniel
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct or Helpful button. Thank you!
-----------------------------------------------------------------------------------------------------------------------