8051 Crystal
8051 Crystal
8051 Crystal
80C51 MCUs
This application note explains how an oscillator functions and which methods can be used to check if the oscillation conditions are met in order to ensure a good start-up when power is applied.
Application Note
Oscillator Fundamentals
A microcontroller integrates on-chip an oscillator to generate a stable clock used to synchronize the CPU and the peripherals. Figure 1. Basic Oscillator Architecture Noise Xtal1 Amplifier Xtal2
G(f)
Feed-back Loop H(f) The basic architecture of an oscillator (regardless of its structure) is shown in Figure 1 and built around an amplifier, a feed-back and noise applied on Xtal1 input. The role of each elements is explained hereafter: Amplifier: Used to amplify the signal applied on Xtal1 and to lock the oscillations exhibit Xtal2. The class A structure is the most popular but new ones are currently used in order to optimize the consumption or other criterion, Feed-back loop: Used to filter the output signal and to send it to the Xtal1 input. The oscillator stability is linked to the bandwidth of the loop. The narrower the filter, the more stable the oscillator. Crystals or ceramic resonators are generally used because they have the narrowest bandwidth and efficiency for the stability of the frequency.
Rev. 4363A80C5107/04
Noise: Thanks to the noise an oscillator is able to startup. This noise has different origins: thermal noise due to the transistor junctions and resistors, RF noise: a wide band noise is present in the air and consequently on all the pins of the chip and in particular on Xtal1 input of the amplifier. The noise origin can be industrial, astronomic, semiconductor, ... transient noise during the power-up.
The noise is coupled to the amplifier from the inside and outside of the chip through the package, the internal power rails, .... Figure 2 shows the typical oscillator structure used in most microcontroller chips. An onchip amplifier connected to an external feed-back consists in a crystal or a resonator and two capacitors (a). Sometimes a resistor is inserted (b) between the amplifier output and the crystal in order to limit the power applied, avoiding the destruction of the crystal. Figure 2. Typical Oscillator Structures Xtal1 Xtal2 Xtal1 Xtal2
a)
b)
2
4363A80C5107/04
The process involved in start-up and locking of oscillator is explained hereafter (see Figure 3): Biasing process. The power-up is applied and the amplifier output follows the power until it reaches its biasing level where it can amplify the noise signal on its input. Oscillation. The amplified noise on the output ( Xtal2) is filtered by the feed-back loop which has a pass-band frequency corresponding to the nominal oscillator frequency. The filtered output noise is amplified again and starts to increase. The oscillation level continue to grow and reaches the non-linear area. Lock. In the non-linear area both the gain and the oscillation level starts to reduce. Steady State . A stabilization point is found where the closed-loop gain is maintained with the unity.
VDD
Bias Level
Vxtal2
Each element plays a role and their electrical characteristics have to be understood. The next sections explain this matter.
Crystal and ceramic resonators are piezoelectric devices which transform voltage energy to mechanical vibrations and vice-versa. At certain vibrational frequencies, there is a mechanical resonance. Main resonances are called: fundamental, third, fifth, ... overtones. Overtones are not harmonics but different mechanical vibrational modes. This crystal is an efficient pass-band filter which exhibits a good frequency stability. The equivalent model, shown in Figure 4, consists of two resonant circuits: C1, L1 and R1 is a series resonant circuit (fs), In addition the series circuit, C0 in parallel forms a parallel circuit which has a parallel resonance frequency (fa) .
3
4363A80C5107/04
C0
R1 Q1
L1
C1 Q2
Figure 5 plots the module and phase of the impedance crystal and shows both the series and parallel resonance frequencies. Figure 5. Phase and Module Versus the Frequency Z(f) dB
)
100
96.034
75
fs
:=
1 6.28
Rp
C1
50 25
C1 L1
fa L1
fa := fs 1 + C1 C0
C0
( f )
fs
R1
0 9.998
f
7
1.0001
. 10
9.998
9.999
10
. 10
Series
. 10
. 10
1.0002
Parallel
f
. 10
1.0003
. 10
1.0004
. 10
1.0005
. 10
1
(f) degree
90 ) )
90
45
360 6.28 0
45
f
6 6 7 7 7 7 7 7
90
90
The behavior of the crystal depends on the frequency and is summarized in Table 1. Table 1. Nature of the Impedance Versus the Frequency
Frequency Z(f) Phase() f < fs Capacitive C1 -90 f=fs Resistance R1 0 fs < f < fa Inductive L1 +90 f=fa Resistance Rp 0 f>fa Capacitive C0 -90
4
4363A80C5107/04
The impedance phase is related to the frequency and each elements of the model plays a role in specific frequency ranges. The main electrical characteristics of these elements are summarized hereafter. Series resonance frequency
L1 6.28 fs R1
fs
:=
1 6.28
C1 L1
Quality factor
Qs
:=
Quality factor
Qp
:=
1 C0 6.28 fp R1
:= fs 1 +
Qp
C1 2 ( C0
CL)
ESR
ESR := R1 1 +
C0 CL
Quality factor
:=
1 CL 6.28 fp ESR
Table 2 gives some typical crystal characteristics. Table 2. Examples of Crystal Characteristics
Frequency MHz 32 30 (2) 30 (1) 20 16 10 8 6 2 Note: R1 ohms 35 20 40 50 80 20 7 8 100 L1 mH 11.25 11 33.94 20 11.641 0.025 0.0862 0.0848 520 C1 fF 2.2 2.6 0.83 3.2 8.5 10 4.6 8.3 12 C0 pF 7 6 3.8 10 3 20 40 40 4 fs MHz 32 30 30 20 16 10 8 6 2 fp MHz 32.005 30.0065 30.00328 20.0032 16.022 10.00025 8.00026 6.000356 2.003 Qs 646k 102k 160k 497k 146k 159.2k 618k 533k 66K Qp 3.11 6.14 3.48 2.98 3.42 80 17.4 37 198
There is no such thing as a series cut crystal as opposed to a parallel cut crystal. Both modes exist in a crystal. Only the oscillator structures (Pierce, Colpitts, ..) will oscillate the crystal close to the fs or between fs and fa resonance frequencies. The first structure is called a series resonant oscillator and the second a parallel resonant oscillator. It should be noted that no oscillator structure is able to oscillate at the exact fa frequency. This is due to the high quality factor at fa and the difficulty to stabilize an oscillator at this frequency.
5
4363A80C5107/04
Vibrational mode is used to reduce the crystal cost. Above 20MHz it is costly to produce such crystals tuned on the fundamental mode. To avoid that, an overtone mode is used to tune the oscillation frequency. To work properly, this vibrational mode needs a specific schematic where a frequency trap is installed on the oscillator output to short-circuit the fundamental mode and force the overtone mode. The trap is an LC filter installed between the Xtal2 and the ground. The frequency on this filter is calculated on the fundamental mode using the Thomson equation (see Figure 6). Figure 6. A LC trap is Used for an Overtone Oscillator Xtal1 Xtal2
Ltrap X1 C1 C2 Ctrap
Ftrap
= -
Ltrap Ctrap
Drive Level
The characteristics of quartz crystals are influenced by the drive level. In particular, when the drive level increases, the frequency and the resistance change through nonlinear effects. In extreme cases an inharmonic mode may replace the main mode as the selective element and cause the frequency of the oscillator jump to a different frequency. With an overdrive level, the crystal substrate itself may be damaged. Typical characteristic of frequency vs. drive levels is shown in Figure 7. Figure 7. Frequency Shift vs. Drive Level
Drive level is a measurement of the total power dissipated through the crystal operating in the circuit. Typical drive levels are between 50 uW and 1000 uW (1 mW). Drive levels should be kept at the minimum level that will initiate and maintain oscillation. It should be less than half of the maximum drive level. Excessive drive may cause correlation difficulties, frequency drift, spurious emissions, "ringing" wave forms, excessive ageing, and/or fatal structural damage to the crystal.
6
4363A80C5107/04
The maximum drive, PMax, is specified by the crystal manufacturer. The maximum RMS current which can flow in the crystal and it is given by the following expression:
IMrms :=
PMrms ESR
For example, 0.1 Watt Maximum power with an ESR of 32 ohms gives a 56mA maximum RMS current.
The RMS voltage across the crystal can be evaluated in the same manner:
For example, if PMrms is 0.1Watt and ESR =32Ohms, the maximum RMS voltage accross the crystal is 1.8V. In case of overdrive power, a resistor must be connected between the amplifier output and the crystal as shown in Table 2.
Class-A Amplifier
Figure 8 gives an example of a class-A amplifier. Resistance Rf is used to bias the output stage to VDD/2. Cxtal1 and Cxtal2 are the parasitic capacitors due to input and output amplifier pads plus the parasitic capacitances of the package. Rout is the equivalent output resistance of the amplifier. The equivalent schematic is true only for the linear area of the gain and for small signal conditions. This linear operation occurs during the startup when the power is applied. The transfer function is often first order and low-pass filter type. VDD Xtal1 Xtal1 Rf Xtal2 vin Cxtal1 b) VSS Cxtal2 c) vout f G0 Rout Xtal2 G(f)
G0
a)
VSS
Figure 8. (a) Typical structure of a class-A amplifier. (b) Equivalent schematic. (c) Gain response. Next section explains the two specific amplifier areas needed to startup and lock an oscillator.
7
4363A80C5107/04
The Two Operating Areas Figure 9 illustrates the transfer function of a CMOS amplifier. An amplifier such as that
shown in Figure 8 has two operating regions. These regions determine the oscillator operation at start-up and during steady state while oscillations are stabilized. Figure 9 shows these two regions: Region A, is the linear region . The gain is constant, and vout is proportional to vin:
vout ( f )
G ( f ) vin ( f ) )
The dynamic range of this linear region is typically +/- 1 volt around the quiescent point Q at 5v VDD. Region B, is the non-linear region. The gain is no longer linear, and becomes dependent on the vout level. The higher the vout, the lower the gain. The amplification is automatically reduced while the output oscillation increases until a stabilization point is found (amplitude limitation).
vs
Non-Linear region
A
VDD/2
ve
VDD/2 The oscillations start gradually. The noise on its input is amplified until the level reaches VDD. If conditions (gain and phase) as specified above are fulfilled, startup is normally guaranteed at circuit power-on time. Indeed, during power-on, noise over a large spectrum appears and is sufficient to start-up the system. Only a few microvolts or millivolts are needed but the startup time is inversely proportional to this level. Typical waveform of an oscillation is shown in Figure 10. Figure 10. Start and Lock of a Feedback Oscillator Vxtal2
Steady State
8
4363A80C5107/04
Some oscillator architectures force the crystal to operate around the series frequency and some others to work around the parallel frequency. This section gives information about these working modes. This structure used a non inverted amplifier to force oscillation at its the natural series resonant frequency fs. The crystal phase is zero, the resistance is minimum (R1) and the current flow is maximum. Figure 11. Series Resonant Structure Xtal1
Q1
Xtal2
Q2
Q1
Xtal1
R1
Xtal2
Q2
X1
The feedback (X1) filters the oscillation frequency and send this signal in phase to Q1 input.
This structure used an inverted amplifier to force oscillation between fs and fa resonance frequencies where the crystal impedance appears inductive (L1). This structure is called Pierce. To have this frequency resonant, fp , the imaginary part of the crystal impedance must be zero. So only capacitive reactance can cancel the inductive one. This is why the C1 and C2 capacitors are added on Xtal1 and Xtal2 (see Figure 12). Figure 12. Parallel Resonant Structure Xtal1
Q1
Xtal2
Q2
L1
Xtal1
Q1
CL ESR
Xtal2
Q2
X1 C1 C2
fp
CL)
The equivalent series resistance (ESR) is a little higher than for fs and is given with the next expression:
9
4363A80C5107/04
required CL must be respected. Here are some standard values are 13, 20, 24,30, and 32 pF.
Analysis Method
Two methods of oscillator analysis are considered in this application note. One method involves the open-loop gain and phase response versus frequency. A second method considers the amplifier as a one-port with negative real impedance to which the filter is attached. The second one will be preferred for very low frequency (32KHz). The next sections explains the basics of these two methods and how to use them.
This first method analyzes the product of the gain of the amplifier and the feed-back loop. Figure 13. Basic Oscillator Architecture Amplifier Noise
+
G(f) vin(f) Feed-back Loop H(f) vout(f)
vn(f)
The general equation to start-up the oscillation process is shown hereafter. Lets express vout(f):
vout ( f ) = G ( f ) Hf ( f ) vout ( f ) + G ( f ) vn ( f )
the transfer function between vout(f) and vn(f) is:
----------------- = ------------------------------------1 G (f ) H( f) vn ( f )
the start-up condition can now be evaluated with the Barkhausen criteria:
vout ( f)
G (f )
G ( f ) H ( f)
>1
G ( f) H( f ) =
This start-up condition depends on the product of the gain and feed-back but also on the frequency. The lock condition is controlled by the non-linear area of the amplifier output. The gain is automatically reduced while the output oscillation increased until a stabilization point is found.
10
4363A80C5107/04
To analyze the oscillation conditions, it is useful to use a Spice simulator. Some freeware are available on the Web and only the basic functions of Spice are required. Figure 14 shows a typical oscillator Spice circuit use to demonstrate the AC small signal analysis. Figure 14. Typical crystal oscillator structure.
As seen previously, the open-loop gain is analyzed to check the oscillation conditions. To do that the feed-back loop is broken. The crystal has to be loaded with the same impedance than the input impedance of the amplifier. Figure 15 shows the Spice circuit used to analyses the oscillation conditions. A 16MHz crystal is used for this analysis and CP1 and CP2 are tuned to have the oscillation conditions (G> 0dB, Phase=0). Figure 15. Spice Circuit Used to Analyze the Oscillation Conditions
Xtal1
38pF
Xtal2
Figure 16 plots the gain and the phase of the open-loop circuit. At 16.001MHZ the gain is greater than unity (38dB) and the phase is zero. The oscillation conditions are met ensuring a good oscillator startup.
11
4363A80C5107/04
Figure 16. Gain and Phase response for the open-loop gain. Gain(dB) Phase() 180 40 187 30 144 Phase = 0 Gain = 38dB Phase 20 108
100
Gain 10 72
36
16.001MHz -10 0
-55
16.007MHz
This method allows to check the maximum capacitive loads and the maximum electrical characteristics of the crystal. Figure 17 (a) plots the gain and phase when Cp1 and CP2 are too big. The gain is now too small to guarantee a proper startup. The phase begins to shift and is no longer zero. Figure 17 (b) plots the gain and phase when the equivalent resistance of the crystal (R1) is too big. The gain is now negative and the phase is not zero. The oscillation conditions are not met and this oscillator will not start. Figure 17. Gain and phase for two conditions
1.1
8.3
Phase > 0
0
G=-3dB
G=0.3dB
0
a)
16.00188MHz
16.00796MHz
a) Cp1 and Cp2 are too big (56pF), b) R1 is too big = 40ohms. Table 3 resumes the case studies analyze with the spice model and tool.
12
4363A80C5107/04
CP1 and CP2 are generally chosen to be equal maintaining a gain in closed loop equal to the unity.
The second method analyzes the real part on the input impedance of the amplifier and compares it with the real part of the pass-band filter. The impedance seen on the input amplifier is negative under certain conditions and cancelled the crystal resistance. In that case there is no more lost of energy and oscillations are stabilized. Figure 18 shows the equivalent model of an oscillator. The crystal is equivalent to a RLC filter corresponding to the motional arm. Z3 in the equivalent impedance accross Xtal1 and Xtal2 pins including the C0 crystal capacitor and Cx3. Z1 and Z2 are the input and output impedances including the two external capacitors Cp1 and Cp2 used to adjust the oscillator operating point. Figure 18. a) Oscillator Equivalent model b) Equivalent model around the resonance. a) b)
Crystal
R1 L1 C1
R1
Crystal
L1 C1
Z3
Rin Cin
Xtal1
Xtal2
Amplifier
Z1
Z2
Amplifier
Figure 18 shows in what conditions the oscillator will oscillate. To have an oscillation stable in steady condition, the lost of energy in the crystal has to be cancelled. This condition occurs when:
Rin = R 1
13
4363A80C5107/04
and at the frequency: 1 f = ----------------------------------------------------------C 1 Cin 6, 28 L 1 ---------------------C 1 + Cin Cin is the equivalent capacitor seen between Xtal1 and Xtal2 and is equal to: 1 Cx 2 --------------------------Cin = C 0 + Cx 3 + Cx C 1 x + Cx 2 where Cx1 and Cx2 are the global capacitors seen on the input and output pins. Cx3 is the capacitor seen between Xtal1 and Xtal2 pins.
To ensure a good startup of the oscillator, Cx1 and Cx2 have to be correctly adjusted. In order to define them, the amplifier impedance must respect the conditions on Rin and Cin parameters: Rin: Cx1 and Cx2 has to be adjusted to have Rin > R1: ( Cx 1 Cx 2 ) gm Rin ( Zc ) = ----------------------------------------------------------------------------------------------------------------------------------------------------------2 2 2 ( gm Cx 3 ) + ( Cx 1 Cx 2 + Cx 2 Cx 3 + Cx 1 Cx 3 ) Cin: Cx1 and Cx2 have to be adjusted to obtain a negative imaginary part and finally a input capacitor.
gm 2 Cx 3 + 2 ( Cx 1 + Cx 2 ) ( Cx 1 Cx 2 + Cx 1 Cx 3 + Cx 2 Cx 3 )2 Im ( Zc ) = -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------2 2 2 ( ( gm Cx 3 ) + ( xC 1 Cx 2 + Cx 2 Cx 3 + Cx 1 Cx 3 ) ) Im ( Zc ) C = -------------------6, 28 f
gm is the amplifier gain.
An example is given hereafter. The main characteristics of this case study is: Amplifier: gm=0.01A/V, Cxtal1=5pf, Cxtal2=8pF, Cxtal3=5pf Crystal: R1=80, L1=11.64mH, C1=8.5fF, C0=5pF
14
4363A80C5107/04
Crystal
R1
L1 C0 5p
C1
Xtal1
Cxtal3 5p
Xtal2
Cp1 Cxtal1 5p
gm
0.01A/V 0 0 0
Cxtal2 8p
Cp2
Amplifier
Table 4 shows two cases: first, there is no external additional capacitors and second two capacitors are adjusted to the oscillation frequency. When there is no capacitor Rin is less than R1 (80 ohms) and no oscillation occurs. With Cp1=Cp2=5pf, Rin is -175 ohms and is greater than R1 and the condition to have oscillations is met. As with the previous method, Cp1 and Cp2 can be tuned and the electrical characteristics can be checked. Table 4 resumes the case studies. Table 4. Cp1 and Cp2 capacitors with R1=80ohms.
Cp1(pF) 0 5 Cp2(pF) 0 5 Rin(ohms) -60 -175 Cin(pF) 8.26 9.2 Oscillation Condition No Yes
Conclusions
Two methods have been presented to analyze and to check the oscillation conditions.They have shown the possibility to predict the added capacitors in versus the electrical characteristics of the crystal or resonator devices. It will help to specify the margin of the crystal and resonator devices.
15
4363A80C5107/04
Atmel Corporation
2325 Orchard Parkway San Jose, CA 95131 Tel: 1(408) 441-0311 Fax: 1(408) 487-2600
Atmel Operations
Memory
2325 Orchard Parkway San Jose, CA 95131 Tel: 1(408) 441-0311 Fax: 1(408) 436-4314
RF/Automotive
Theresienstrasse 2 Postfach 3535 74025 Heilbronn, Germany Tel: (49) 71-31-67-0 Fax: (49) 71-31-67-2340 1150 East Cheyenne Mtn. Blvd. Colorado Springs, CO 80906 Tel: 1(719) 576-3300 Fax: 1(719) 540-1759
Regional Headquarters
Europe
Atmel Sarl Route des Arsenaux 41 Case Postale 80 CH-1705 Fribourg Switzerland Tel: (41) 26-426-5555 Fax: (41) 26-426-5500
Microcontrollers
2325 Orchard Parkway San Jose, CA 95131 Tel: 1(408) 441-0311 Fax: 1(408) 436-4314 La Chantrerie BP 70602 44306 Nantes Cedex 3, France Tel: (33) 2-40-18-18-18 Fax: (33) 2-40-18-19-60
Asia
Room 1219 Chinachem Golden Plaza 77 Mody Road Tsimshatsui East Kowloon Hong Kong Tel: (852) 2721-9778 Fax: (852) 2722-1369
ASIC/ASSP/Smart Cards
Zone Industrielle 13106 Rousset Cedex, France Tel: (33) 4-42-53-60-00 Fax: (33) 4-42-53-60-01 1150 East Cheyenne Mtn. Blvd. Colorado Springs, CO 80906 Tel: 1(719) 576-3300 Fax: 1(719) 540-1759 Scottish Enterprise Technology Park Maxwell Building East Kilbride G75 0QR, Scotland Tel: (44) 1355-803-000 Fax: (44) 1355-242-743
Japan
9F, Tonetsu Shinkawa Bldg. 1-24-8 Shinkawa Chuo-ku, Tokyo 104-0033 Japan Tel: (81) 3-3523-3551 Fax: (81) 3-3523-7581
e-mail
[email protected]
Web Site
http://www.atmel.com
Disclaimer: Atmel Corporation makes no warranty for the use of its products, other than those expressly contained in the Companys standard warranty which is detailed in Atmels Terms and Conditions located on the Companys web site. The Company assumes no responsibility for any errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without notice, and does not make any commitment to update the information contained herein. No licenses to patents or other intellectual property of Atmel are granted by the Company in connection with the sale of Atmel products, expressly or by implication. Atmels products are not authorized for use as critical components in life support devices or systems.
Atmel Corporation 2004. All rights reserved. Atmel and combinations thereof are the registered trademarks of Atmel Corporation or its subsidiaries. Other terms and product names may be the trademarks of others.