A controller previously used a 16 MHz passive crystal. A prototype moves to 20 MHz for more processing headroom. It works at room temperature but sometimes stalls during cold startup. The crystal frequency and package do not tell you how the MCU’s oscillator amplifier was configured. The PIC18F46K22 high-speed crystal mode has medium-power and high-power selections. Check the oscillator configuration and supply conditions together, then separate crystal buildup from MCU startup delays.
Which high-speed mode is active?
The Microchip PIC18(L)F2X/4XK22 data sheet describes LP, XT, and HS external-crystal oscillator modes, and subdivides HS into medium- and high-power options. The medium-power mode suits approximately 4 to 16 MHz. The high-power mode is used at higher frequencies within the electrical limits. For a supply of at least 2.7 V, the timing table lists up to 16 MHz for medium power and up to 20 MHz for high power. If the original board used an HS medium-power setting with a 16 MHz crystal, read back the actual configuration after changing to 20 MHz and verify the supply and temperature range.
Distinguish the programmer interface setting, the configuration bits in the production image, and the device readback. Keep the image version and configuration with the board record. A waveform observed once at room temperature does not establish startup margin at lower supply or temperature. Repeat with the same confirmed image and power ramp before assigning an intermittent issue to the crystal.
Calculate the delay scale before diagnosing it
Microchip describes an Oscillator Start-up Timer, OST, of 1,024 input oscillator cycles when invoked in the relevant crystal modes. If the oscillator is already delivering usable input edges, at 16 MHz one cycle is 62.5 ns and 1,024 cycles span about 64 µs. At 20 MHz one cycle is 50 ns and the interval is 51.2 µs. These calculations describe the cycle-counting part of startup. They do not give the time for a stationary crystal to build oscillation or the total power-up delay.
If a first software action appears several tens of milliseconds late, inspect the other events too. The part has an optional power-up timer with a nominal delay around 66 ms and variation under different conditions. Capture VDD, external reset, the active clock path, and the first observable program action together. If using the PLL, track its relevant startup conditions separately. Use a suitable buffered observation point where possible instead of loading a sensitive oscillator pin with ordinary probe capacitance.
Qualify the changed circuit under real conditions
Use a known original board and image as a control. Repeat cold starts at the prescribed temperatures and supplies. Then test the 20 MHz candidate with a verified high-power mode, at the same test stations and conditions. If the failure occurs in a particular supply interval, inspect the voltage at the MCU, reset, and the data sheet’s operating conditions. A nominal 3.3 V rail does not describe the whole startup ramp. Compare crystal load capacitance, ESR, and allowable drive against the actual circuit.
A higher oscillator drive is not a general cure. Some crystals have a low rated drive. Microchip’s crystal circuit discussion notes that an appropriate series resistor may be needed with such parts. A resistor also affects startup margin, so verify its value in the actual circuit. Record why the oscillator mode was chosen and what happens in cold, low-voltage, and sustained operation tests. Do not approve a broad component change based on one bench start.
For a series of ten cold starts, discharge to the board’s defined power-off condition each time and trigger from the same threshold. Preserve the entire power and reset capture for any outlier. Change one variable at a time, such as comparing the qualified crystals after controlling the supply ramp. If the delay recurs only in the cold condition, report that group separately. Whether oscillation develops, when countable edges first arrive, and when firmware begins are more informative as separate observations. Record the crystal lot in the retest report.
Keep a separate evidence record for each board revision
Purchasing should keep complete 16 MHz and 20 MHz crystal order codes and requirements tied to approved board and firmware versions. For an active-oscillator variant, review the external digital clock mode, frequency and levels, and its connection. A crystal amplifier mode and an external-clock input mode require separate design and assembly verification.
Confirm crystal specification, actual configuration, and repeatable startup separately before approving substitution. If configuration and crystal pass but startup still fails, reproduce the supply ramp, load, and cold conditions in a trace. If only the program start appears late, calculate the oscillator cycles and reset timing separately before opening a supplier issue.
