Tools

Crystal load capacitor calculator

Choose the two load capacitors for a crystal from its datasheet load capacitance and your board’s stray capacitance. Add the crystal’s details to see the frequency error from standard values, the oscillator’s start-up margin, and a starting value for a series resistor.

How the capacitors are configured

Pierce crystal oscillator with two load capacitorsThe crystal connects between the oscillator's XIN and XOUT pins. Capacitor C1 runs from the XIN side of the crystal to ground, and C2 from the XOUT side to ground. An optional series resistor, Rext, sits between the XOUT pin and the crystal. The pins and traces add stray capacitance to ground on each side. Inside the chip, an inverting amplifier drives XOUT from XIN, with a feedback resistor Rf across it.Microcontroller or oscillator chipRfXINXOUTRext(optional)CrystalC1C2StrayStrayGround

Each capacitor runs from one crystal pin to ground. Seen from the crystal, they are in series with each other through ground, and the stray capacitance of the pins and traces, as the crystal sees it, adds in parallel:

CL = (C1 × C2) / (C1 + C2) + Cstray

With equal capacitors this becomes C1 = C2 = 2 × (CL − Cstray). That is why the capacitors are roughly twice the load capacitance, not equal to it.

Crystal

MHz
pF

For a 32.768 kHz watch crystal, enter 0.032768 MHz.

Board

pF

What the crystal sees from the oscillator pins, pads, and traces, beyond C1 and C2. A few picofarads is typical; 2 to 5 pF is a common starting estimate. Capacitance from each pin to ground counts about half. If the chip has built-in load capacitors, follow its datasheet: count a per-pin value at half, and a value given as the load the crystal sees in full.

Crystal and oscillator details (optional)

Ω
pF
fF
mA/V

ESR, C0, and Cm come from the crystal datasheet (Cm is sometimes called C1, in femtofarads). The frequency offset needs both C0 and Cm. The oscillator’s transconductance gm comes from the microcontroller datasheet; for 32.768 kHz oscillators it is often given in µA/V, so divide by 1000. Some datasheets give a maximum critical gm instead, with the margin already built in: the crystal’s value, shown in the results, must be below it.

Result

C1 and C2, each

–

Exact value for an equal pair

Nearest standard

–

Standard capacitor choices
ChoiceC1, C2CLOffset

Start-up and drive

Getting the stray capacitance right

The stray term is the least certain number here, and it matters: with small load capacitances, a picofarad of error moves the frequency by several ppm. Start from the oscillator pin capacitance in the chip datasheet plus an allowance for pads and traces. Because the crystal sees the two sides in series, capacitance from each pin to ground counts about half: 5 pF on each pin adds about 2.5 pF. Capacitance directly between the two crystal pins counts in full. Keep the crystal and its capacitors close to the pins, with short traces over a solid ground, and nothing noisy routed underneath.

Then measure. Read the frequency through a clock output pin or a timer, not with a probe on the crystal, because the probe’s own capacitance pulls the frequency. If it runs fast, the load is too low: increase the capacitors. If it runs slow, decrease them. Adjust the stray estimate to match and keep it for the next design on that chip.

Start-up margin

An oscillator starts only if its amplifier has enough gain to overcome the crystal’s losses. The crystal needs a critical transconductance of about 4 × ESR × (2πf)² × (C0 + CL)². The chip’s oscillator transconductance should exceed it with a comfortable margin; a gain margin of at least 5 is a common target. Larger load capacitors and higher ESR both raise the requirement, which is one reason not to oversize the capacitors.

On the board, a quick check is to add resistance between the XOUT pin and the crystal and find where oscillation stops. It should keep running with at least four times the crystal’s maximum ESR added, so that it overcomes five times the crystal’s losses in total. Check start-up at the lowest supply voltage and the temperature extremes, where margins are smallest.

The series resistor (Rext)

An optional resistor between the XOUT pin and the crystal limits the drive level, the power dissipated in the crystal. Small crystals and 32.768 kHz tuning forks are easily overdriven, which can age or damage them and shift the frequency. Many microcontroller oscillators, and most 32.768 kHz ones, drive gently enough that no resistor is needed: check the drive level against the crystal’s rating, and leave a 0 Ω footprint so you can fit one later.

If you need one, a common starting value is the reactance of C2 at the crystal frequency, 1 / (2πf × C2). The resistor adds to the crystal’s losses, so recheck the start-up margin with it fitted. The calculator adds it to the ESR, a cautious check that tends to understate the real margin; confirm on the board. Some chips put this resistor inside, or warn against one; follow the chip’s guidance where it gives one.

The feedback resistor (Rf)

The feedback resistor biases the amplifier into its linear region so the oscillator can start. Most microcontrollers include it. A discrete inverter or a chip that leaves it out needs one fitted across the amplifier, typically about 1 MΩ for megahertz crystals and 10 MΩ or more for 32.768 kHz crystals.

Want a second look at your design?

If you have a design heading toward a board order and want a second set of eyes, get in touch.

Based in southern Indiana. Working with clients anywhere.