Datasheet
PIC18F47J53 FAMILY
DS39964B-page 456 Preliminary 2010 Microchip Technology Inc.
FIGURE 28-4: FSCM BLOCK DIAGRAM
Clock failure is tested for on the falling edge of the
sample clock. If a sample clock falling edge occurs
while the clock monitor is still set, and a clock failure
has been detected (Figure 28-5), the following results:
• The FSCM generates an oscillator fail interrupt by
setting bit, OSCFIF (PIR2<7>);
• The device clock source is switched to the internal
oscillator block (OSCCON is not updated to show
the current clock source – this is the Fail-safe
condition); and
•The WDT is reset.
During switchover, the postscaler frequency from the
internal oscillator block may not be sufficiently stable
for timing-sensitive applications. In these cases, it may
be desirable to select another clock configuration and
enter an alternate power-managed mode. This can be
done to attempt a partial recovery or execute a
controlled shutdown. See Section 4.1.4 “Multiple
Sleep Commands” and Section 28.4.1 “Special
Considerations For Using Two-speed Start-up” for
more details.
The FSCM will detect failures of the primary or secondary
clock sources only. If the internal oscillator block fails, no
failure would be detected, nor would any action be
possible.
28.5.1 FSCM AND THE WATCHDOG TIMER
Both the FSCM and the WDT are clocked by the
INTRC oscillator. Since the WDT operates with a
separate divider and counter, disabling the WDT has
no effect on the operation of the INTRC oscillator when
the FSCM is enabled.
As already noted, the clock source is switched to the
INTRC clock when a clock failure is detected; this may
mean a substantial change in the speed of code execu-
tion. If the WDT is enabled with a small prescale value,
a decrease in clock speed allows a WDT time-out to
occur and a subsequent device Reset. For this reason,
Fail-Safe Clock Monitor events also reset the WDT and
postscaler, allowing it to start timing from when execu-
tion speed was changed and decreasing the likelihood
of an erroneous time-out.
FIGURE 28-5: FSCM TIMING DIAGRAM
Peripheral
INTRC
÷ 64
S
C
Q
(32 s)
488 Hz
(2.048 ms)
Clock Monitor
Latch
(edge-triggered)
Clock
Failure
Detected
Source
Clock
Q
OSCFIF
Clock Monitor
Device
Clock
Output
Sample Clock
Failure
Detected
Oscillator
Failure
Note: The device clock is normally at a much higher frequency than the sample clock. The relative frequencies in
this example have been chosen for clarity.
Output (Q)
Clock Monitor Test
Clock Monitor Test
Clock Monitor Test