Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
PMC Clock Failure Detection Example
Purpose

This example shows how to use the Clock Failure Detection feature of the SAM MCUs when the external oscillator fails.

Usage
  1. After startup, the example enables Main Crystal Clock Failure Detector.
  2. The Clock Failure Detector Event interrupt is enabled as well. Then if a failure of crystal oscillator clock is detected, the MCU will generate an interrupt.
  3. Users could trigger the Clock Failure Detector Event by means of shorting XIN or XOUT pin to ground.
  4. In the interrupt handler, the example will turn a LED on to indicate that a clock failure has been detected.
Note

The example requires the chip configured to run on external oscillator, which is normally the case when using the sysclk_init(). When the external oscillator is activated, the XIN pin is automatically set in XIN mode, and no more in PIO mode.