Specialist Supplier of Crystals & Frequency Control Componentssales@mecxtal.com.cn0755-26500570
MERLIN home / Rednote / System Validation and Replacement

Why can a PIC18F47Q10 keep running more slowly after losing its 8 MHz oscillator?

A low-voltage controller normally uses an 8 MHz active oscillator. During a bench test the reference is temporarily disabled. The program keeps running, but timed outputs slow down, and restoring the reference does not immediately restore their speed. A running CPU does not establish which time base it uses. The device can fall back to an internal source. Whether the application remains within its timing limits depends on the backup settings and the recovery sequence. Read the effective clock source as well as examining the external signal.

The fallback rate depends on previous settings

Microchip describes external digital clock input at OSC1 in EC mode. With the appropriate configuration, OSC2 can be an I/O pin or a divided clock output. At an 8 MHz system clock, an enabled FOSC divided-by-four output is nominally 2 MHz. Check the reference itself at the actual clock input. The divided monitoring signal can change independently of the external oscillator.

The fail-safe clock monitor switches COSC to HFINTOSC and sets the oscillator failure flag. The actual fallback depends on the previous HFFRQ and divider configuration. Suppose the system normally uses the external 8 MHz directly and its fallback is configured for 4 MHz without division. CLKOUT changes from 2 MHz to 1 MHz in that example. A task counting 4000 ticks at FOSC divided by four therefore changes from 2 ms to 4 ms. Confirm that its timer really uses the stated path. Another peripheral may have an independently selected source.

Detecting a failure and acquiring the original source are separate

The FSCM uses the internal low-frequency oscillator divided by 64. At a nominal 31 kHz, the sample period is about 2.06 ms, with a half-period around 1.03 ms. That illustrates its sampling scale. It does not guarantee total system reaction time, which also depends on event phase and device conditions. Capture the last valid reference edge, the visible failure indication, and the changed output cadence. A status read in a later interrupt handler is an observation of the event rather than its hardware origin.

Restoring the 8 MHz active oscillator does not by itself select it. Microchip describes continued operation on the internal source until firmware completes the switch back. Track the request, effective source, and actual recovery of output timing. Clearing an alarm without verifying the switch can leave the system silently operating at the fallback rate. Keep the clock, firmware events, and application output on a common time base.

Exercise the intended degraded state and recovery

Begin with normal external clocking and record a known timing output. Use the test board's controlled clock enable to introduce a loss. Capture the oscillator enable, reference input, CLKOUT, and a critical task output. If the backup cannot meet normal application timing, verify the implemented pause or reduced operating mode using a suitable test load. A responding button or blinking LED does not qualify cycle timing, protocol baud rate, or sampling.

Restore the external source and repeat supported cold-start and reset paths. For any replacement 8 MHz active oscillator, check output loading and valid input levels, then verify failover and recovery. Document the effective source in every state and the shortest or longest observed task period. If backup is also configured to 8 MHz, the two rates can look almost identical. Read the source and capture a software marker for detection to distinguish successful failover from a case that never switched.

The board can also contain devices using independent references. If the controller slows while the other device does not, their existing timeout and sample assumptions may diverge. In a test setup without the normal actuator load, capture an identifiable exchange. Record which frames were cancelled or sent at which timing. If firmware adjusts a timer after failover, verify that an in-flight operation ends in the intended way and that recovery does not repeat it. An independent peripheral clock can provide a useful comparison.

References

WeChat

MERLIN · TIMING COMPONENTS

Scan with WeChat to contact Sales

Add our WeCom contacts from your usual WeChat app.

On desktop, scan with your phone. On mobile, save the QR image and select it from your album in WeChat Scan.