Choosing a Crystal for a Microcontroller: Frequency Is Only the First Check
A crystal marked 16 MHz looks like an obvious choice for a microcontroller project that needs a 16 MHz clock. However, frequency is only one part of the match. The oscillator circuit must also suit the crystal's load capacitance, resistance and permissible drive level.
A poor match may run on one prototype and fail to start on another, or operate at a slightly different frequency from the one expected. Choosing the crystal and surrounding components together is more reliable than copying two capacitor values from an unrelated schematic.
Distinguish a crystal from a complete oscillator
A quartz crystal is a passive resonator. It needs an oscillator circuit, often provided inside a microcontroller, to produce a sustained clock. A complete oscillator module contains active circuitry and provides a clock output when appropriately powered. These parts have different connections and are not interchangeable simply because the frequency matches.
PMD Way's assorted HC-49S crystal pack is listed with ten frequencies in a through-hole crystal format. Although catalogue terminology sometimes uses “crystal oscillator” loosely, identify the actual component and pin function before connecting it. A two-terminal crystal is not wired like a powered clock module.
The assortment can be useful for learning and prototypes. For a design requiring specified accuracy or reliable start-up across conditions, obtain the exact crystal parameters rather than relying on frequency and package alone.
Make a compatibility worksheet
| Parameter | Why it matters |
|---|---|
| Frequency and operating mode | The oscillator circuit must support that frequency and crystal mode. |
| Load capacitance | Defines the loading at which the crystal's frequency is specified. |
| Equivalent series resistance | The oscillator must provide enough gain to start and sustain oscillation. |
| Drive level | Limits the power dissipated in the crystal. |
| Tolerance, stability and ageing | Contribute to the clock's total frequency error. |
| Package and environment | Affect fit, layout and the suitability of the selected part. |
Read the microcontroller's oscillator section as well as the crystal datasheet. Some clock inputs expect an external driven clock in one mode and a crystal in another. A configuration setting can therefore be wrong even when the physical circuit is correct.
Calculate load capacitors from the required load
In a common Pierce oscillator arrangement, two capacitors connect the crystal terminals to the circuit reference. Their combined effect, together with stray capacitance, determines the load seen by the crystal. A useful first approximation is CL = C1C2/(C1 + C2) + Cstray.
For equal capacitors, this becomes CL = C/2 + Cstray. In a hypothetical design requiring 12 pF load capacitance with an estimated 3 pF of stray capacitance, the initial equal capacitor value is 2 × (12 − 3), or 18 pF each. This is an example calculation, not a recommendation for every crystal in an assortment.
STMicroelectronics' AN2867 oscillator design guide explains this relationship. It also shows why the first calculation must be followed by compatibility and operating checks. Pin capacitance and PCB geometry are part of the load; the external capacitors are not the whole story.
Do not solve every start-up problem with larger capacitors
Increasing the load capacitors can shift frequency and make start-up more demanding. Reducing them indiscriminately can produce a different frequency error. Use the intended oscillator design method rather than trying values until one board happens to run.
Microchip's start-up discussion identifies load capacitance as one influence on start-up time. The microcontroller's clock-start delay or clock-ready check must also suit the real oscillator behaviour.
Drive level is another separate constraint. More drive is not automatically better: excessive crystal dissipation can affect performance or reliability. Epson's oscillator design precautions discusses drive level and load-related frequency effects. Any series resistor or drive-strength selection should come from a documented design procedure.
Keep the oscillator layout compact
Place the crystal and its associated components close to the intended oscillator pins. Keep the connections short and avoid running fast switching signals through the sensitive area. Follow the microcontroller manufacturer's layout example, including its treatment of ground and nearby copper.
A long solderless-breadboard arrangement adds uncertain capacitance and coupling. It may be adequate for an exploratory experiment but is a poor basis for concluding that a particular crystal will start reliably in a finished product. Likewise, changing the PCB layout can change the load enough to require another check.
For through-hole construction, prevent the metal crystal case from touching unintended conductors. Do not assume the case connection from appearance alone; check the package drawing where it matters.
Measure without stopping the clock
An ordinary oscilloscope probe adds capacitance. Connecting it directly to a crystal pin can shift frequency or stop oscillation, producing a misleading diagnosis. Where the microcontroller provides a buffered clock-output function, that can be a less intrusive way to check the clock.
Abracon's in-circuit crystal measurement note discusses evaluating frequency, drive and gain margin in the assembled circuit. Use the recommended measurement technique and suitable low-loading equipment for direct oscillator measurements.
For an accuracy calculation, remember that one part per million is one millionth of the frequency. A hypothetical 20 ppm error at 16 MHz is 320 Hz. The final clock-error budget may also include temperature, ageing and load mismatch; the initial tolerance is not the total under every condition.
Commission the clock as part of the whole board
- Confirm supply rails, reset behaviour and the oscillator wiring before changing clock settings.
- Check the exact microcontroller clock-source configuration and supported frequency range.
- Test repeated cold starts and power interruptions using the intended supply.
- Check operation across the intended load and environmental conditions.
- Save the crystal part number, capacitor values, layout revision and measurement method together.
When choosing from the crystal collection, start with frequency but finish with the complete compatibility check. A dependable clock is the result of a suitable resonator, oscillator circuit, configuration and layout working together.