The Oscillator

The Barkhausen stability criteria are two conditions used to determine when an electronic circuit will oscillate. They state that if A is the gain of the amplifying element in the electronic circuit and β(jω) is the transfer function of the feedback path, steady-state oscillations will be sustained only at frequencies for which:

The first criterion will ensure a constant amplitude signal. A number less than 1 will attenuate the signal, and a number greater than 1 will amplify the signal to infinity. The second criterion will ensure a stable frequency. For other phase shift values, the sine wave output will be canceled due to the feedback loop.

Figure 1. Feedback Loop

The 32.768 kHz oscillator in Microchip AVR microcontrollers is shown in Figure 2 and consists of an inverting amplifier (internal) and a crystal (external). Capacitors (CL1 and CL2) represent internal parasitic capacitance. Some AVR devices also have selectable internal load capacitors, which may be used to reduce the need for external load capacitors, depending on the crystal used.

The inverting amplifier gives a π radian (180 degrees) phase shift. The remaining π radian phase shift is provided by the crystal and the capacitive load at 32.768 kHz, causing a total phase shift of 2π radian. During start-up, the amplifier output will increase until steady-state oscillation is established with a loop gain of 1, causing the Barkhausen criteria to be fulfilled. This is controlled automatically by the AVR microcontroller's oscillator circuitry.

Figure 2. Pierce Crystal Oscillator Circuit in AVR® Devices (simplified)