Changing active clock configuration

CPU (processor) component SetClockConfiguration(ConfigurationID) method is used to change active clock configuration. This method will switch to clock configuration defined by ConfigurationID passed as input parameter. The required configuration has to be predefined in the processor component, otherwise the method returns an error.

Clock configuration change is done during CPU SetClockConfiguration() method call in the following order:

  1. It is checked whether required clock configuration number was defined in the CPU (processor) component. If not, method returns with an error.
  2. System timing is configured according to new clock configuration, including reference clock source selection, clock generator modules and system dividers.
  3. All LDD components which support clock configuration feature are called to configure their underlying peripherals - global internal LDD_SetClockConfiguation() method is invoked which in return invokes internal SetClockConfiguration() method of the LDD components.

Note that during the transition period glitches at the peripheral outputs may occur. Therefore, it is recommended to temporarily disable the peripherals before the clock configuration is switched to prevent any unpredictable behavior.