Crystal oscillator notes

Typical options

  • On chip oscillator, external crystal
  • External oscillator module
  • Crystal and logic gate oscillator
  • Crystal and transistor oscillator
  • Crystal and oscillator IC oscillator

On Chip oscillator, external crystal

In my opinion this is an easy option for crystals below 10MHz and devices using the single inverter "Pierce" configuration. It is certainly the cheap option if only a single IC needs a clock or if the IC has a facility to output derived clocks. I would advise against trying to share a crystal, with some devices you may get away with connecting Xout of one device to Xin of another but the extra loading may affect the oscillation.

Above 10MHz you should pay more attention to guidelines and above 20MHz things will get more complicated as you may have to consider "third overtone" crystals. Using an overtone crystal you need to suppress its fundamental resonant frequency. The simplest way is to use a feedback resistor with a lower than normal value, at some value the oscillation will switch from fundamental to overtone, but an oscillator using this method may change frequency unexpectedly, for example switching back to the fundamental at low temperature.

A more reliable way to use overtone crystals is to add some form of LC circuit to select the desired oscillation mode.

If you are using an overtone crystal in a mass-production design I would strongly advise contacting the crystal manufacturer and if possible getting them to perform tests on prototype or production units

Another observation I'd make about crystals is that I would strongly recommend checking whether the crystal-to-can capacitance has any influence on the circuit. It shouldn't, but some oscillators may show sensitivity to touching the can. It is worth considering grounding the can even though strictly speaking the crystal is a two-terminal device.

I've probably been "spoiled" in that working with Microchip devices I can't recall a case of an oscillator not running. These would have been in the range of 2.5MHz to 8MHz and I always just used the minimum of the crystal and two loading caps.

Some care should be taken in layout. Most good datasheets give guidelines but generally the connections must be short, kept away from strong signals and the loading capacitors should return to an IC ground pin and not just be stuck on a ground mesh anywhere convenient. Occasionally loading capacitors are required to return to the positive rail not ground.

I have limited experience of 32.768kHz devices but years ago I used an ADC that required a 32.768kHz crystal clock and I don't remember any issues until I moved to an external oscillator IC when I ran into some odd starting issues.

External oscillator module

This is definitely the safe option, generally if you can get a crystal you can get an oscillator. There is a penalty to pay, the oscillator may be 5-10 times the cost of the crystal.

A benefit of an oscillator is it produces a strongly buffered signal that can be distributed to multiple parts.

It also avoids the need for special placement of parts close to the microcontroller since the sensitive crystal connections are inside the oscillator, and only the well buffered output connects to a pin. It is unlikely to be influenced by nearby data lines.

An oscillator may also be helpful in prototyping if an IC is fitted to a footprint adapter or some other non-optimal connection. The adapter may prevent putting the crystal near the IC and will probably require poor loading capacitor placement. Some adapters have provision for a capacitor from each pin in which case a directly connected crystal may still work.

For frequencies above 20MHz I would strongly recommend using an oscillator module unless one of the following is true:

  • You are a hobbyist who doesn't mind fiddling a bit and has the tools to diagnose a non-starter
  • You are mass-producing and are prepared to carry out the margin testing on a prototype batch to verify that the crystal will always work Failure to carry this out may leave you with either a completely unresponsive project or a pile of rejects

32.768kHz oscillators do exist, but generally the on-chip oscillator will be acceptable. Where you need absolute minimum current drain driving the input from an external oscillator may outperform using the on-chip one as the external oscillator can use dedicated analogue parts rather than abusing a CMOS inverter. Using the inverter as an oscillator will effectively operate it in class A, whereas driving from an external source keeps it fully high or low with minimal transition time.

An ultra-low-power 32kHz oscillator can take a substantial time to start, sometimes over a second.

Crystal and logic gate oscillator

Three parts strongly stand out as candidates for building oscillators owing to them containing single unbuffered gates:

The 74HCU04 is like the 74HC04 hex inverter but unbuffered. Normally a CMOS inverter would actually be three inverters cascaded inside the IC for higher gain. In the HCU04 each inverter is just the two FETs, making it possible to bias into its linear region. It will require a feedback resistor to bias it into its linear region otherwise your circuit will be dependent on leakage currents for correct operation. If you fail to bias it you may end up with a design that requires a layer of dirt under the crystal to complete the circuit.

The 74LVC1GX04 is an unbuffered inverter and a buffered inverter in the same transistor-size package, well suited for building logic-gate oscillators. Just like the 74HCU04 It will require a feedback resistor.

The CD4007UBE is far more interesting and its datasheet only touches on its potential. It isn't so much a logic IC, rather it is six complimentary MOSFETS with some interconnections. It is well suited to making low speed ultra low power oscillators, Unfortunately many of the designs were in various print publications years ago and are not easy to find now.

The general principle of 4007 oscillators is to run one gate in a "starved" configuration either by using source resistors or using a single unbalanced FET with a very high value drain load resistor. The resistors suppress the "shoot-through" current when the gate is in its "linear" region. The weak output of this gate is usually then buffered by the two remaining gates.

Crystal and transistor oscillator

I have encountered these circuits as radio frequency sources. Even the low frequency designs can be difficult to set up and may need handcrafted inductors. A 168MHz design had to be fitted in a shielding can. Also expect to need a buffer with high isolation to prevent "load pull" .

If you believe that the Colpitts oscillator is somehow "better" than Pierce I would advise reading https://www.maximintegrated.com/en/app-notes/index.mvp/id/5265 where it is shown that in AC terms once you ignore how DC is fed in they are almost the same circuit.

More specifically it shows that to convert between them all you do is move the AC ground point. Grounded Emitter: Pierce, Grounded Collector: Colpitts. The Crystal and capacitors stay in the same place, and both designs expect the crystal to supply a positive Z to offset the negative Z of the capacitors.

Crystal and oscillator IC oscillators

  • SN74LVC1GX04
  • MAX2620 is clearly intended as a RF IC for use with a varactor tuned LC resonator, but the datasheet also shows a crystal circuit.
  • Various parts intended for use inside sealed-can oscillator products. As far as I can tell these are not generally available in quantities below 1000 so there's no point listing the numbers here.


Please log in to post comments.