Basic Clock Module Operation
4-10
Basic Clock Module
4.2.6 Basic Clock Module Fail-Safe Operation
The basic clock module incorporates an oscillator-fault detection fail-safe
feature. The oscillator fault detector is an analog circuit that monitors the
LFXT1CLK (in HF mode) and the XT2CLK. An oscillator fault is detected when
either clock signal is not present for approximately 50 µs. When an oscillator
fault is detected, and when MCLK is sourced from either LFXT1 in HF mode
or XT2, MCLK is automatically switched to the DCO for its clock source. This
allows code execution to continue, even though the crystal oscillator has
stopped.
When OFIFG is set and OFIE is set, an NMI interrupt is requested. The NMI
interrupt service routine can test the OFIFG flag to determine if an oscillator
fault occurred. The OFIFG flag must be cleared by software.
Note: No Oscillator Fault Detection for LFXT1 in LF Mode
Oscillator fault detection is only applicable for LFXT1 in HF mode and XT2.
There is no oscillator fault detection for LFXT1 in LF mode.
OFIFG is set by the oscillator fault signal, XT_OscFault. XT_OscFault is set
at POR, when LFXT1 has an oscillator fault in HF mode, or when XT2 has an
oscillator fault. When XT2 or LFXT1 in HF mode is stopped with software the
XT_OscFault signal becomes active immediately, remains active until the
oscillator is re-started, and becomes inactive approximately 50 µs after the
oscillator re-starts as shown in Figure 4−8.
Figure 4−9. Oscillator-Fault Signal
V
CC
XT1OFF/
XT2OFF
LFXT1CLK/
XT2CLK
XT_OscFault
OSC faults
50 us
50 us
50 us
software enables OSC software disables OSC