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

A PIC16F877A with a 4 MHz crystal pauses after power-up. How do you separate the two startup delays?

An older instrument with a crystal waits a while before sending its first serial character. A new crystal lot slightly changes the recorded startup time. For a PIC16F877A, first check the Power-up Timer and Oscillator Start-up Timer settings. The former allows the supply to rise. The latter counts oscillator periods in certain crystal modes and startup conditions. Attributing the whole interval from the supply rise to the first log entry to the crystal can send a substitution review after the wrong parameter.

Mark power, reset, and the first observable instruction

The manufacturer specifies a wait of 1024 oscillator cycles for the Oscillator Start-up Timer in the relevant LP, XT, and HS modes. At nominally 4 MHz, 1024 cycles take about 256 µs. This is the length of the count window. Time from power-on to the first instruction can also depend on the supply ramp, external reset hold, oscillator buildup, and whether the Power-up Timer is enabled.

Toggle one marker at the start of initialization and another after setting up the UART. Capture the supply, reset pin, and both markers together. The trace distinguishes a CPU that has yet to run from firmware that is running with the UART still unready. Before setting up reset tests, consult the datasheet’s reset timing table. Power-on reset, external reset, and wake-up from sleep can follow different delay sequences.

Compare crystal candidates with the same configuration bits, supply ramp, MCU revision, and environment. Record the delay distribution at each stage. If only the final interval grows, investigate firmware and peripherals. If the difference appears before the first marker, focus on power, the crystal, and oscillator mode. Specify the product’s worst-case startup limit and the board conditions in the purchase requirements. One typical unit’s first-byte timestamp cannot establish it.Microchip PIC16F87XA datasheet

Send us a part number or your requirements

Brand, frequency, quantity and delivery target — a useful place to start.

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.