A 32.768 kHz watch crystal labeled “12.5 pF” seems to ask for 12.5 pF capacitors. Fit two of them, one on each pin as most designs do, and the clock built around it runs about 52 parts per million fast, roughly 4.5 seconds a day or 27 minutes a year. The right capacitors, for typical board stray capacitance, are about 19 pF each. The difference comes from one formula for capacitors in series and one figure buried in the crystal’s datasheet, its motional capacitance, and the numbers below work it through using a real part.
What load capacitance means
A crystal tuned by its surroundings
A quartz crystal resonates at a precise frequency, but in the parallel-resonant circuits used by almost every microcontroller, the exact frequency depends slightly on the capacitance the circuit presents to it. The manufacturer cuts and adjusts each crystal to hit its marked frequency when loaded with one specific capacitance, the load capacitance, CL. Give it more capacitance and it runs slow; less and it runs fast.
The two capacitors in series
In the standard Pierce oscillator, one capacitor goes from each crystal pin to ground. Seen from the crystal, those two capacitors are in series, plus whatever stray capacitance the board traces and chip pins add. ST’s application note AN2867, its oscillator design guide for STM8 and STM32 microcontrollers, gives the relationship as CL = (CL1 × CL2)/(CL1 + CL2) + Cs.
Turned around
With two equal capacitors, the series combination is half of one capacitor. So each capacitor should be about twice the crystal’s load capacitance minus the stray. ST’s own example uses a stray of 5 pF and a 15 pF crystal and arrives at 20 pF capacitors. Putting the crystal’s CL value on each pin directly gives only about half the intended load.

The crystal used for the numbers
Abracon ABS07AIG
The calculations use the Abracon ABS07AIG datasheet (revised June 7, 2022), a common 32.768 kHz tuning-fork crystal in a 3.2 by 1.5 mm package. Its figures:
| Parameter | Value |
|---|---|
| Load capacitance, CL | 12.5 pF (standard option) |
| Shunt capacitance, C0 | under 1.4 pF |
| Motional capacitance, C1 | 4.7 fF |
| Frequency tolerance at 25 °C | ±20 ppm |
| Temperature coefficient | −0.040 to −0.036 ppm/T² |
| Turnover temperature | 25 °C typical |
Motional capacitance
C1, measured in femtofarads, is the tiny capacitance in the crystal’s electrical model that stands for its mechanical stiffness. It’s small, and it controls how much the frequency moves when the load capacitance changes. ST’s note calls this sensitivity “pullability” and gives it as C1 divided by two times (C0 + CL) squared. For this crystal at 12.5 pF, that’s about 12.2 ppm per picofarad.
Running the numbers
Frequency error for different capacitor choices
Assuming 3 pF of stray capacitance from the board and microcontroller pins, and using the standard expression for frequency shift, half of C1 times the difference between 1/(C0 + CL actual) and 1/(C0 + CL nominal):
| Capacitor on each pin | Actual CL | Error | Seconds per day | Minutes per year |
|---|---|---|---|---|
| none | 3.0 pF | +365 ppm | +31.5 | +192 |
| 6.8 pF | 6.4 pF | +132 ppm | +11.4 | +69.5 |
| 12.5 pF | 9.25 pF | +51.6 ppm | +4.46 | +27.1 |
| 18 pF | 12.0 pF | +6.3 ppm | +0.55 | +3.3 |
| 19 pF | 12.5 pF | 0 ppm | 0 | 0 |
| 22 pF | 14.0 pF | −16.5 ppm | −1.42 | −8.7 |
Reading the table
The 12.5-pF mistake costs more than the crystal’s entire ±20 ppm tolerance, twice over. Using 22 pF, the value many reference designs copy from 8 MHz crystals, overshoots in the other direction by 16.5 ppm, still close to a full tolerance band. The “no capacitors” row is mostly theoretical: with so little load, many tuning-fork crystals won’t start reliably at all, and those that do run far off frequency.
Why it’s not symmetric
The error grows faster on the low side because the frequency depends on 1/(C0 + CL). Each missing picofarad matters more than each extra one, which is a reason to err slightly high when stray capacitance is uncertain.

Stray capacitance is the hard part
Where it comes from
Stray capacitance includes the microcontroller’s oscillator pins, the pads and traces on the board, and the crystal’s own package. It’s rarely listed in one place. ST’s note uses 5 pF in its example; this post used 3 pF. With 5 pF of stray, the right capacitor for a 12.5 pF crystal drops to 15 pF each.
Measuring instead of guessing
The reliable way to pin it down is to measure. Many microcontrollers can output the oscillator signal, or a divided version of it, on a pin. Measuring that frequency with a frequency counter, without touching the crystal with a probe, which adds its own capacitance, shows how far off the design is. At 12.2 ppm per picofarad, a measured error of 24 ppm means the load is about 2 pF off, so each capacitor should change by about 4 pF.
For an RTC, divide by seconds
For a real-time clock, a simpler test works: set it against a reliable time source, wait a week and compare. Each second gained or lost per day is about 11.6 ppm. ST’s note gives a similar conversion in its own example, where a 7.8 ppm error equals “~0.7 s/day.”
A small calculator
The two formulas in code
Everything above reduces to two functions. Capacitances are in picofarads, with C1 converted from femtofarads to picofarads:
def cap_each(CL, Cs):
"""Equal capacitor on each pin for a crystal of load CL, with stray Cs."""
return 2 * (CL - Cs)
def ppm_error(c_each, Cs, CL_nom, C0, C1):
"""Frequency error in ppm when c_each pF sits on each pin."""
CL = c_each / 2 + Cs
return C1 / 2 * (1 / (C0 + CL) - 1 / (C0 + CL_nom)) * 1e6
print(cap_each(12.5, 3)) # 19.0
print(ppm_error(18, 3, 12.5, 1.4, 0.0047)) # 6.3
print(ppm_error(20, 3, 12.5, 1.4, 0.0047)) # -5.9Picking a standard value
The ideal 19 pF isn’t a common capacitor value, so a real design chooses between 18 and 20 pF. The calculator shows 18 pF running 6.3 ppm fast and 20 pF running 5.9 ppm slow. Either is well inside the crystal’s ±20 ppm tolerance, and the two errors are close to mirror images, so the choice comes down to how confident the stray-capacitance estimate is.
Capacitor tolerance
Ordinary ceramic capacitors in these values are often specified to ±5 percent, around a picofarad either way at 20 pF. Since the two are in series, a one-picofarad error on one capacitor shifts the load by about half a picofarad, or about 6 ppm here. C0G (NP0) ceramics are the usual choice because their value barely changes with temperature or voltage.

Temperature matters as much as capacitors
The tuning-fork parabola
Tuning-fork crystals are most accurate at their turnover temperature, 25 °C for this part, and slow down on either side, following a parabola with the coefficient from the datasheet. Using −0.036 ppm/T², where T is the difference from turnover in degrees:
| Temperature | Error | Seconds per day |
|---|---|---|
| −10 °C | −44.1 ppm | −3.81 |
| 0 °C | −22.5 ppm | −1.94 |
| 10 °C | −8.1 ppm | −0.70 |
| 25 °C | 0 | 0 |
| 35 °C | −3.6 ppm | −0.31 |
| 45 °C | −14.4 ppm | −1.24 |
What that means for design
An outdoor sensor that spends its winter at −10 °C loses nearly four seconds a day from temperature alone, regardless of how well its capacitors were chosen. Getting the capacitors right removes the fixed offset; temperature-compensated real-time clock chips or periodic time synchronization handle the rest.
Starting reliably: gain margin
Enough drive to oscillate
Frequency accuracy is pointless if the oscillator won’t start. AN2867 defines a critical transconductance, gmcrit = 4 × ESR × (2πF)² × (C0 + CL)², the minimum gain the microcontroller’s oscillator must supply for that crystal, and asks for a gain margin, the ratio of the chip’s actual gain to that minimum, of at least 5.
Bigger load, harder start
Because CL appears squared in that formula, larger capacitors make the crystal harder to drive. That’s one reason not to oversize them just to be safe on frequency. ST’s worked example, an 8 MHz crystal with C0 of 7 pF, CL of 10 pF and ESR of 80 Ω, gives a gmcrit of about 0.23 mA/V, which the same calculation repeated for this post confirms at 0.234 mA/V. Against the STM32F1’s 25 mA/V, that’s a comfortable margin of about 107. Low-power 32.768 kHz oscillators, built to sip microamps, have far smaller margins, so crystals with low ESR and low CL options, such as the ABS07AIG’s 9, 7, 6 and 5 pF versions, exist for them.
Sources
- STMicroelectronics, AN2867, “Guidelines for oscillator design on STM8AF/AL/S and STM32 MCUs/MPUs”: https://www.st.com/resource/en/application_note/an2867-guidelines-for-oscillator-design-on-stm8afals-and-stm32-mcusmpus-stmicroelectronics.pdf
- Abracon, ABS07AIG 32.768 kHz crystal datasheet (rev. 06-07-22, hosted by Farnell): https://www.farnell.com/datasheets/3752350.pdf
