- Purpose
This example shows how to use the Clock Failure Detection feature of the SAM MCUs when the external oscillator fails.
- Usage
- After startup, the example enables Main Crystal Clock Failure Detector.
- 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.
- Users could trigger the Clock Failure Detector Event by means of shorting XIN or XOUT pin to ground.
- 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.