Clock Configuration Locking

As a safety precaution, it is possible to lock the current Clock System configuration until the next reset. If your application is going to run from one clock configuration, it could be wise to protect that configuration from accidental changes.

The procedure for locking the configuration is as follows:

  1. 1.Set up the XMEGA Clock System to desired configuration
  2. 2.Load the Protect I/O Register signature (byte value 0xD8) into the Configuration Change Protection register (CCP). This will automatically disable all interrupts for the next four CPU instruction cycles.
  3. 3.Set the Clock System Lock bit (LOCK) in the Clock System Lock register (CLK.LOCK) to logic one.
  4. 4.The clock configuration is now locked until the next system reset.

If the External Oscillator Failure Detector is enabled, a failure will unlock the Clock System configuration. See the External Oscillator Failure Detector section for details.