# Crystals

Written by

Many digital circuits rely on crystal oscillators to provide a stable and accurate clock. For the most part the oscillator is built into the IC, and it is left to the user to connect a crystal, a couple of capacitors and maybe a resistor. But how do we select these components?

Before getting into this we should back up and remind ourselves just what a crystal (or more properly a crystal resonator) is and how it regulates the frequency of oscillation. A crystal is an electromechanical device that rely on the piezoelectric effect in a small slice of synthetic quartz crystal. Piezoelectric materials produce a charge when mechanically deformed – and respond to an applied charge by changing shape.

A crystal resonator contains a small slice of crystal precisely dimensioned to resonate at a particular frequency. You can read more about the physics of this in the references below. I want to focus more on how we go about selecting a crystal and its associated components for a typical application.

This example we will use is an STM Arm Cortex M0+ microcontroller (STM32G0B0) with a nominal 12MHz crystal. This microcontroller uses a typical Pierce oscillator configuration shown in Figure 1. The inverter and feedback resistor are internal to the microcontroller, while the user must provide the crystal, C1, C2 and possibly R1. Note that Cs is the total shunt capacitance of the crystal, the PCB traces and the capacitance internal to the IC.

The most obvious place to start when selecting a crystal is the frequency. Figure 2 shows an extract from the data sheet of a typical 12MHz crystal (Raltron RH100-12.000-18-2020-TR) which shows a nominal frequency of 12.000MHz but also a figure for frequency tolerance and frequency stability. The former describes how close the crystal frequency will be to the nominal frequency at 25˚C. The latter describes how the frequency can vary over the nominal temperature range (–20˚C to +70˚C). In our case these are both ±20ppm so our worst-case frequency variation could be ±40ppm, or ±480 Hz over the temperature range.

Crystals also suffer from aging where the frequency can drift over very long periods of time. This is mainly caused by changes in stress in the crystal or contamination of the crystal lattice due to manufacturing imperfections. In our case the aging is specified as ±5ppm/year. This may be important to you depending on the application, so make sure you choose an initial accuracy tight enough to allow for aging.

Next, we need to look at the parameter for load capacitance. The crystal we have selected is specified for a load capacitance of 18pF. We need to make sure we get as close as we reasonably can to this figure for correct start up and operation of the oscillator. The load capacitance the crystal will see is the series combination of C1 and C2 in parallel with the shunt capacitance Cs.

Estimating Cs is always a bit of a challenge. We know that the crystal shunt capacitance is specified to be “5pF maximum”. The microcontroller datasheet says “10pF can be used as a rough estimate of the combined pin and board capacitance”. Given these vague estimates, I have assumed the total capacitance is about 13pF, meaning the series combination of C1 and C2 needs to be 5pF in order to bring the total load to 20pF. This means C1 and C2 should be 10pF each.

We now need to check that the oscillator will start and operate properly by verifying the transconductance is within limits. The microcontroller data sheet specifies a maximum critical crystal transconductance of 1.5 mA/V. We can calculate the critical crystal transconductance from the formula:

The frequency, series resistance, load and shunt capacitances are those specified in the crystal’s data sheet. In our example the resulting transconductance is 1.2 mA/V, less than the specified maximum so we are OK.

Finally, there is the matter of drive level and the series resistance R1. The drive level is the maximum power that can be dissipated in the crystal (100µW in our example). If the drive level is too high, adding series resistance can help. If the drive level is OK, you should omit R1 altogether.

The only way I know to verify that the drive level is OK is to measure it. There are a few ways to do this (see the references for details) but none of them are trivial. Overdriving the crystal may accelerate aging and could cause issues with the oscillator starting reliably. Most of the time, the design choices made by the IC designers mean that you won’t need any series resistance for standard crystals. If you do have to add series resistance, you will need to re-calculate the critical transconductance.

References
“Introduction to Quartz Crystal Oscillators – Technical Articles.” Accessed November 6, 2023. https://eepower.com/technical-articles/introduction-to-quartz-crystal-oscillators/.

ECS Inc. “Considerations When Designing Crystals into STM32 Microcontrollers.” Accessed November 6, 2023. https://ecsxtal.com/considerations-when-designing-crystals-into-stm32-microcontrollers/.

“Causes-of-Crystal-Aging-in-Oscillators.Pdf.” Accessed November 10, 2023. https://www.ctscorp.com/wp-content/uploads/Causes-of-crystal-aging-in-oscillators.pdf.

“RH100-12.000-18-2020-TR.Pdf.” Accessed November 10, 2023. https://www.raltron.com/webproducts/specs/CRYSTAL/RH100-12.000-18-2020-TR.pdf.

 Keep up-to-date with our FREE Weekly Newsletter! Don't miss out on upcoming issues of Circuit Cellar. Subscribe to Circuit Cellar Magazine Note: We’ve made the Dec 2022 issue of Circuit Cellar available as a free sample issue. In it, you’ll find a rich variety of the kinds of articles and information that exemplify a typical issue of the current magazine. Would you like to write for Circuit Cellar? We are always accepting articles/posts from the technical community. Get in touch with us and let's discuss your ideas.

##### Andrew Levido

Andrew Levido (andrew.levido@gmail.com) earned a bachelor’s degree in Electrical Engineering in Sydney, Australia, in 1986. He worked for several years in R&D for power electronics and telecommunication companies before moving into management roles. Andrew has maintained a hands-on interest in electronics, particularly embedded systems, power electronics, and control theory in his free time. Over the years he has written a number of articles for various electronics publications and occasionally provides consulting services as time allows.

## Crystals

by Andrew Levido time to read: 4 min