# How do crystal oscillators work with feedback consisting of CMOS inverters?

For a crystal oscillator to work, there must exist a feedback path with properly designed specifications in order for all to work as expected. Broadly, the basic form of this control system is as follows: Where the transfer function of this control system is:

$$\frac{Vout(s)}{Vin(s)} = T(s) = \frac{G(s)}{1+k(s)G(s)}$$

The theory of this type of oscillating circuit is such that if we make

$$k(s)G(s) = -1$$

Then we will have

$$T(s) = \frac{G(s)}{0}=\infty$$

And with zero input to the system (i.e. self-contained feedback only)

$$Vout(s) = 0*\infty$$

Which is undefined and together with the -1 feedback we find the system to be unstable and oscillatory in nature. What practical circuits do is design such that we have a phase-shift of 180 degrees and a gain of 1 equating to the -1 requirement. Namely, the feedback path k provides the 180 degrees phase shift and the forward path, G, provide the unity gain.

All of this together (with the crystal oscillator and phase-shifting load capacitance) give a circuit that is unstable and will oscillate at the resonant frequency of the used crystal.

tl;dr

Now, the point of all of that was to setup for a simple question. Knowing that the gain in the forward path must be unity, it makes sense that we would use something like an op-amp configured as a voltage follower, or equivalent. Since the oscillator will oscillate in a sinusoidal manner, it makes sense that we would use an amplification method that would track the input. However, what I've found is that these circuits tend not to use op-amps but rather high bandwidth CMOS inverters (like CD4049). Of the type: How could it be that we are able to use an inverter to provide this unity gain with no additional phase shift?

The datasheet for the CD4049 cites that low voltages is anything below 1V, while high voltages are defined as being greater than 4V. That said, how can this be considered sufficient as a unity-gain amplifier when the output is either HIGH or LOW and not actually tracking the input as one would expect with something like a voltage follower?

I have actually constructed and measured this circuit; here are the results. • The phase shift of an inverter would be 180, not 0, degree. – Roland Mieslinger Feb 7 '15 at 20:00
• @RolandMieslinger, My question was more 'how can a digital inverter be used as an amplifier', I suppose. Also, it would seem that if the inverter indeed contributes an additional 180 degrees phase shift in this application then the theory would fail and the circuit would not oscillate. So there appears to be something else working in the background here. Although I am uncertain that a digital inverter of this type indeed can be characterized by imposed a phase shift; the output is always one of two states. – sherrellbc Feb 7 '15 at 20:14

Inside the data sheet you will see the basic circuit of a CD4049. Here: - If Vin is somewhere about halfway between Vcc and Vss, both transistors are conducting and the voltage at Vout will be neither 1 nor 0. In effect both transistors together act like a potential divider; an upper resistor and lower resistor.

This is the linear operating point of this digital circuit.

Next it should be noted that if Vin were taken slightly higher then Vout would fall to Vss much more rapidly than for the small change in Vin - this indicates that there is gain in the configuration and that it is an inverting type of gain.

Next, apply a high value resistor between output and input and the ouput will stabilize and some "halfway" voltage due to negative feedback just like an op-amp would.

Next apply an ac input to Vin via a small capacitor and resistor in series and you get an analogue AC amplifier.

Are you convinced that this type of digital gate can be made into an analogue amplifier? Here's and article showing how a CD4049 can be made into an op-amp. Below is a picture of a CD4049 being used as an AC amplifier: - Here is the article.

All that remains to make a crystal oscillator is to provide the feedback resistor (maybe 1Mohm to 10Mohm), add a couple of capacitors and the crystal and you have an oscillator. Note that the combination of output impedance and capacitor connected to the output produce a signal that is more sinusoidal that square hence you can make an approximate sine wave oscillator.

Note also that it is this network (together with the input cap to ground) AND the crystal that produces 180 degrees phase shift.

With a crystal that has a sufficient Q, you only need gain and 180° phase to get the oscillation. The non-linearity is used to control the oscillation amplitude.

A technical publication can be found here Micropower Crystal Oscillator Design Using RCA COS/MOS Inverters - 1971, and a simple presentation can be found here Ultra low-power circuits for watches in the 1960's... yes, that's nothing very new.

The inverter is being run in its' linear region and therefore acts like an amplifier with gain. The amount of gain available differs between manufacturers and even between parts from the same manufacturer. Nonetheless, there is sufficient gain for the circuit to oscillate.

Notice that any digital inverters used for this purpose are UN-BUFFERED. Look for the letters "UB" in the part number. Buffered CMOS gates have an extra pair of inverters following the logic itself and those chips won't run in the linear region (or won't run very well).

The crystal and associated capacitors provides the other 180 degrees of phase shift when the crystal is vibrating at its' resonant frequency.

• I was not aware of a 'linear region' with digital inverters. My experience has been that anything between the designed HIGH and LOW states specified in the datasheets results in undefined behavior. – sherrellbc Feb 7 '15 at 20:02
• Aren't the capacitors there to provide the additional phase shift? (90° each) I think I read that somewhere some time ago. – Arsenal Feb 7 '15 at 20:09
• @Arsenal, the crystal itself provides 90 degrees of phase shift, the capacitor on the output side provides the additional 90 degrees. The other capacitor is there for purposes related to RF and merely exists so that the impedance looking into either side of the crystal appears as symmetric - or something to that effect. I am by no means an RF expert. – sherrellbc Feb 7 '15 at 20:13
• @sherrellbc I think I read this note from TI, but it's not very clearly worded, just for C1 = C2 the current through them is equal and 180° out of phase. Also they state that either buffered or unbuffered inverters can be used, but buffered tend to be less stable. – Arsenal Feb 7 '15 at 20:18
• @sherrellbc: All digital circuits have analog properties. The purpose of the buffering is to increase the open loop gain of the inverter (which normally would work similar to an offset inverting op amp) by several orders of magnitude in order to slam the output against the rails. – Ignacio Vazquez-Abrams Feb 7 '15 at 20:30

1.) At first, a small correction: It is NOT required that the forward amplifier has unity gain. Instead the LOOP GAIN (in your terms. k*G) must be unity at one single frequency only (unity means: phase zero; for a safe start-up of oscillations slightly larger than unity).

Comment: In contrary, the amplifier must have a gain larger than unity - otherwise, the damping properties of the feedback path would not allow a loop gain of 0 dB.

2.) Yes - the CMOS inverter can work as a linear amplifier if operated in the middle of its transfer characteristic.

3.) To understand the princiople of the shown oscillator configuration: The feedback path consists of a THIRD order lowpass which allows a phase shift of -180deg at one single frequency. This lowpass consists of two parts: (a) first order lowpass (r,out-C) and (b) 2nd order lowpass (L-C). The resistance r,out is the finite output resistance of the CMOS inverter and the inductance L is provided by the crystal (which works as a high-quality inductor). The output of this 3rd order lowpass is fed back to the inverting CMOS amp.