TLA Microsystems - Microcontroller crystal oscillators (TLA_TOP.GIF-23k)

Microcontroller crystal oscillators.

Using the internal oscillator module of a microcontroller with a quartz crystal is one of those subjects that seems to come under the "Black magic" label. It's not surprising with many contradicting papers on the subject, micro datasheets saying "see the crystal manufacturer", crystal documentation saying "as per micro datasheet" and magazine articles devoting 95% to how the manufacturer makes the part.

The following paragraphs just touch on each of the most commonly asked questions. Something with more depth will follow but in the meantime, any comments or questions are welcome.

Serial or Parallel resonance.

When a crystal is described as being a particular frequency series or parallel resonant, it is analogous to any other part being specified at a temperature of 20 or 25 degrees. The part is the same but the frequency has been determined under those defined parameters. At series resonance, the crystal appears as a series resonant RLC circuit with 0 phase shift, so to use it in an oscillator you need to provide the 360 degree phase shift needed. At parallel resonance, the crystal is predominantly inductive and with the external capacitors, provides 180 degrees of phase shift at the specified frequency. The other 180 degrees is provided by the inverting amplifier provided in the micro. The difference in frequency between series resonance and parallel resonance is about 0.05%.

Load capacitance.

Once again, the crystal has been measured under the stated conditions. In this case, the load capacitance and it is only relevant at parallel resonance. If you use a different load capacitance, the crystal is in a different situation from that stated on the can and will behave differently. This may be a small shift in the frequency or may prevent the oscillator from starting, depending on how far away from the stated value you take it. Obviously, the crystal manufacturer will use/state the most appropriate value for the part so it makes sense to aim for that value in your application. The load capacitance is that seen by the crystal, looking out from its pins. In a typical micro oscillator circuit, that is the two capacitors on either side (seen as being in series by the crystal) in parallel with the capacitance of the micro, tracks, lead-frame, etc. A reasonable estimate for the parasitic capacitances is around 7-12pF.

So if we assume the two capacitors (C1 & C2) to be of equal value then

C1 = C2 = 2 * (CL-Cp)
where C1 and C2 are the parts to be added, CL is the manufacturers specified load capacitance and Cp is the combined parasitic capacitances. Because of the extremely high Q of the crystal, the value of the load capacitance doesn't have a huge influence on the oscillation frequency but it does influence how the oscillator starts.

Drive Level

The amount of drive into the crystal is important. Too little and the attenuation will be higher than the gain of the amplifier and oscillation won't occur. Too much drive can excessively age the crystal or force it to oscillate in spurious or overtone modes. If the motional parameters for the crystal are given, then the power dissipation can be calculated for a given frequency and voltage. Usually they aren't published so you are out of luck. However, if the crystal is sold "for microprocessor use", it will be rated for 5V operation at the given frequency.

Equivalent Series Resistance (ESR)

This is another figure derived from the motional parameters and on its own is not much use to the designer. Where it is useful is in comparing various parts versus their price. The lower the ESR, the faster the crystal will start to oscillate and getting it started is the most important part of an oscillator.

Crystal cuts

The angle at which the crystal is cut at manufacture determines how the frequency varies with temperature. Nearly all crystals for microprocessor use are AT cut, as this cut has a flat temperature response around room temperature. Almost every paper dealing with crystals covers this subject at great length so it's not repeated here.

Feedback Resistor

For a CMOS inverter to act as an amplifier for an oscillator, it needs to be biased into the linear region of highest gain. This is accomplished with a feedback resistor from the output to the input. The actual value here isn't too critical, but should be about 200 times the ESR of the crystal. Many microcontrollers have this resistor internally and may have different values for different frequency operations. If so, then the external resistor is not needed.

32kHz crystals

A 32.768kHz 'watch' crystal can be used to reduce power consumption and form the basis of a 1 second timebase with Real Time Clocks. Although the cut is still AT, the crystal has a different mechanical format and must be driven at a lower power than a crystal in the MHz region. This is achieved with a resistor (around 100k) between the amplifier output and the crystal/capacitor network. Because of the higher overall impedance, the feedback resistor (still between the amplifier terminals) also needs to be higher (eg. 10M). Some devices have oscillator modules that are optimized for use with a 32kHz crystal and won't work with the external components included. Check the datasheet and example applications. Conversely, a micro may have a reduced gain at low frequencies in order to remain stable at high clock rates. Low frequency oscillation isn't always guaranteed.


The whole concept of oscillation relies on amplification, so careful attention to layout is important. Tracks between the passive components, crystal and amplifier should be short as possible and the ground connections should be direct to the micro Vss pin (not through a ground plane or on a common track). Layout causes far more oscillator problems than it should. If you can't get the crystal close to the micro for mechanical reasons, consider making an oscillator with a single gate HCU04 or using a canned oscillator module.


If you try to test for oscillation by thrusting an oscilloscope probe into the circuit, you will likely be very disappointed. The additional capacitance of a probe can be enough to stop an oscillator or reduce the amplitude enough to have it become unstable. Many expanded micros have an output (ALE or ECLK) that is active whenever the clock is running and these can be probed without affecting the oscillator. A sensitive current probe is the real tool to use, but if you don't have one of those, there are a couple of other tricks you can use. The simplest is to use a bit of test software that will toggle a pin. Another is to wind up the sensitivity on the scope and put the AC coupled probe on the supply rails. When the oscillator starts, you'll see the switching transitions from the internal logic.


The most important part of the oscillator to test is that it will start. Once started, they are unlikely to stop. Test that it starts with both a rapid power-on (such as being switched on) and by winding the supply voltage up slowly from zero. If the micro can be put into a sleep mode and then restarted without power being removed (whether the application will do this or not), this is a very good test of the starting ability. If the crystal is being used in a situation with a backup battery, perform the tests using the battery voltage as the threshold.

Tolerance and ageing

A typical AT cut micro crystal will have an initial tolerance of 50-100ppm. As with most components, some manufacturers will have a higher tolerance for their standard parts and most will offer higher tolerances with a cost increase. Some manufacturers will provide the tolerance over a temperature range and some at a specified temperature. Both the center frequency tolerance and the temperature effects are determined by the quality of manufacturing so an AT cut crystal could have +/- 5ppm error solely due to temperature (-20C to 70C) or +/- 25ppm. Quartz crystals exhibit a shift in frequency over time but it is both close to linear and comparatively small (eg. < 1ppm/year).

Overtone crystals

The crystal frequency is inversely proportional to the thickness and that means that they get too thin to manufacture economically at about 25MHz. Special techniques can be used to make fundamental mode crystals up to 100MHz but they are expensive. The alternative is to use an overtone frequency. Every crystal has mechanical resonances at odd multiples of the fundamental (although grinding techniques can be used to enhance or suppress them) and the oscillator can be used at one of these by suppressing the fundamental with a filter.

Harmonic problems

Often the markings on a crystal may not make it apparent that it is rated at an overtone. If a crystal >20Mhz appears to run near a third of the marked frequency, this is probably the cause. The opposite can also happen with poor layout or if the crystal is overdriven. Here the circuit may be better suited to oscillation at an overtone, rather than the expected fundamental. There are also spurious frequencies near to each of the resonant modes and the crystal may jump to one of those. Usually it will jump right back again but such behavior does indicate that the oscillator is marginal.

Ceramic resonators

A ceramic resonator works in the same way as a crystal except that it is initially made from a pressed ceramic substrate (rather than cut from a crystal) making it much cheaper to manufacture. The Q of a ceramic resonator is a lot lower than for a crystal of the same frequency and the initial frequency tolerance is also wider. In general, they have a lower ESR and consequently, start faster. Ceramic resonators are available in two lead and three lead configurations, the later having the two load capacitors built into the package. They are usually sold in cerdip packaging and care must be exercised in mounting the device to prevent the package from fracturing.


Technical Topics

Next Page


Any comments or requests for further information are most welcome

ph:  +64 9 820-2221