high voltage PCB

Crystal and Oscillator Layout: Rules for a Stable Clock

The crystal circuit is a handful of components that takes almost no board area and is responsible for whether the product works at all. A badly placed crystal can fail to start at low temperature, drift enough that a radio will not lock, or inject jitter directly into every digital signal on the board. The rules that keep it reliable are simple and are frequently ignored because the circuit looks too small to matter.

Why the Layout Matters

A crystal is a mechanical resonator with a very high quality factor. It works because energy circulates between the electrical circuit and the mechanical vibration, and anything that changes the electrical environment changes the frequency, the startup behaviour or the stability.

Three effects follow. The parasitic capacitance of the traces adds to the load capacitance, which pulls the frequency away from the intended value. The resistance and inductance of the routing reduce the loop gain, which makes starting slower and can prevent it entirely at the extremes of temperature. And any noise coupled into the oscillator pins appears as phase modulation, which is jitter on every clock derived from that oscillator. Our article on PCB jitter describes how that jitter propagates through a system.

The sensitivity is what makes the layout rules worth following. The oscillator pins are a high impedance node connected to an amplifier with gain, and a trace near that node behaves like an antenna for anything that can couple into it.

The Circuit Around the Crystal

Three external components usually appear with a crystal, and their placement is part of the same layout problem.

The load capacitors set the operating frequency together with the crystal specification, and they must be connected to the same ground reference as the oscillator ground pin. Their placement matters less than their grounding, but keeping them adjacent to the crystal is standard because it keeps the loop small.

The series resistor, where present, limits the drive level and reduces the risk of overdriving the crystal. It sits in series with the crystal and its position in the loop affects nothing electrically at these frequencies, so it can be placed where it fits best.

The ground connection is the component that is most often treated casually. The load capacitors and the ground side of the circuit should return to the same point as the oscillator ground pin, and that point should connect to the ground plane through a short path rather than through a shared trace that carries other currents. A crystal that returns through a noisy ground will drift with the switching activity of the board.

Crystal oscillator placed close to a microcontroller with load capacitors and guard ring

Layout Rules

  • Place the crystal and its load capacitors as close to the oscillator pins as the layout allows. A few millimetres of trace adds capacitance that pulls the frequency.
  • Keep the loop small. The traces from the pins to the crystal and back form a loop, and its area determines how much noise it picks up and how much it radiates.
  • Do not route any other signal between the two oscillator pins or underneath them on an adjacent layer, and do not route a signal through the loop.
  • Keep the traces short and, where the design allows, on the same layer as the pins so no vias are needed in the oscillator loop.
  • Provide a local ground reference: a small copper area connected to the ground plane with several vias, under the crystal and its capacitors.
  • Guard the oscillator pins with ground where the routing permits, and connect the crystal case to ground if it has one.
  • Keep the circuit away from switching regulators, inductors, high current loops, clock outputs and anything with a fast edge.
  • Keep the crystal away from board edges and from the bend region of a flexible circuit, since mechanical stress shifts the frequency.
  • Stay away from hot components, because the crystal frequency varies with temperature and a thermal gradient across the package produces a temperature dependent offset.
  • Check whether the crystal can be coated. A conformal coating over a crystal adds to the load capacitance and can shift the frequency, so the coating drawing should exclude it unless the effect has been measured.

The rule about traces between the pins deserves emphasis because it is the most common error. The two oscillator pins are connected through the crystal, which means the impedance between them is low at the resonant frequency, and a trace passing between them experiences a strong local field. A digital trace routed there will couple into the oscillator and will also pick up the clock, which is why that one trace can cause both a timing problem and an EMC failure. Our layout rules cover the general principle of keeping high impedance nodes separated.

Grounding and Guarding

The ground around a crystal serves two purposes, and both are worth the area they cost.

The first is to provide the reference for the load capacitors and the oscillator ground pin. A short, direct connection to a plane keeps the reference stable and stops the return current from sharing a path with other circuits.

The second is to shield the oscillator loop from its surroundings. A ring of copper connected to ground with vias around the crystal and the capacitors reduces coupling in both directions, and it is easy to add because the area is usually otherwise empty. Where the layout is tight, a partial ring on the side nearest the noisy circuitry is better than nothing.

The crystal case, where the package has a grounded lid, should be connected to the same ground. This is a separate connection from the electrical circuit, so it can go to the plane directly with its own vias rather than joining the oscillator ground trace.

Crystal, Oscillator or MEMS

Three technologies provide a clock, and the layout sensitivity differs enough that the choice should be made deliberately.

A crystal is the cheapest option and the most sensitive to layout. The oscillator circuit is inside the microcontroller, the crystal is external, and every parasitic on the board is part of the timing. It gives good stability when the layout is correct and it costs the least.

A crystal oscillator contains the resonator and the oscillator circuit in one package, with a buffered digital output. The sensitive node is inside the package, so the layout rules reduce to keeping the supply clean and the output trace controlled. It costs more and takes slightly more board area, but it removes an entire class of layout risk, and it is the right choice where the clock quality matters or where the layout is tight. Performance variants also give much lower jitter than a basic crystal, which is why they appear in communications and precision measurement.

A MEMS oscillator uses a silicon resonator rather than quartz. It is robust to shock and vibration and it is available in small packages, which suits portable and automotive products, at the cost of slightly different stability characteristics and a different set of supply requirements.

Where the design has an analog or radio section, the clock should be treated as part of the signal chain. Our article on mixed signal layout covers how clocking interacts with converter performance, and the short version is that converter specifications are quoted with a specific clock quality, so a poor clock degrades the measured performance regardless of the converter.

Failure Modes and Their Causes

The problems that appear in production follow a few patterns.

Fails to start. Usually insufficient loop gain, caused by excessive capacitance from long traces, by the wrong load capacitors, or by a series resistor that is too large. It is temperature dependent, so a board that starts on the bench may fail in a cold chamber.

Frequency offset. The load capacitance seen by the crystal differs from the design value, because of trace capacitance, a coating over the crystal, or a load capacitor of the wrong value. It shows up as a communication link that will not lock rather than as a visible fault.

Drift with temperature. The crystal specification sets the fundamental behaviour, but a thermal gradient across the board, caused by placing the crystal near a regulator, adds an offset that is not in the datasheet.

Jitter. Noise coupled into the oscillator pins, or a noisy supply, modulates the clock. It appears as degraded performance everywhere the clock is used.

Mechanical shift. Stress from a board that flexes, from a bend near the crystal, or from a mounting screw changes the frequency. This is why the crystal belongs away from board edges and mounting hardware.

PCB manufacturing process

FAQ

  • How close should a crystal be to the chip? As close as the layout allows, with the load capacitors between them or beside them. Every millimetre of trace adds capacitance and loop area.
  • Can I route signals under the crystal? Under the package is usually acceptable if the reference plane is continuous beneath it, but never under the oscillator traces or between the two pins.
  • Does a conformal coating affect the crystal? Yes. Coating over a crystal changes the load capacitance and can shift the frequency. Our article on conformal coating explains why the coating drawing should exclude the crystal unless the effect has been measured.
  • Is a crystal oscillator worth the extra cost? Where the clock quality matters or the layout is constrained, yes. It moves the sensitive node inside the package and removes the layout risk entirely.
  • Why does the crystal fail only at low temperature? The loop gain and the crystal activity both fall as the temperature drops, so a marginal design starts at room temperature and stops in a cold chamber.

Summary

The crystal circuit is small, high impedance and directly responsible for the timing of everything on the board. The layout rules exist because the resonator responds to capacitance, to noise and to mechanical stress: keep the traces short and the loop small, keep other signals away from the pins, give the circuit its own quiet ground with guarding vias, and keep the crystal away from heat, from the board edge and from switching circuits.

Where those rules cannot be met, the answer is a crystal oscillator, which costs more and removes the problem. Whichever is used, the clock should be treated as a component with a specification rather than as a formality, and it should be checked on the first assembled prototypes at temperature. The assembly and the board design both affect the result, which is why the crystal placement belongs in the design review rather than in a final tidy up of the layout.

Leave A Comment