AVR Hardware Design Considerations [APPLICATION NOTE]
Atmel-2521M-AVR-Hardware-Design-Considerations_ApplicationNote_092014
12
(B) is the circuit used for low frequency crystals on some AVRs - to be more specific - optimized for 32.768kHz
crystals. This circuit provides the capacitive load required by the crystal internally and further adds the resistor Rb
to bias the crystal and limit the drive current into the crystal. The resistor Rf is, when using CMOS inverters,
approximately 1MΩ, and provides a feedback to bias the inverter to operate it in its linear region. Consult data
sheet for the relevant device to see if it has internal circuitry for low frequency crystals.
When using resonators with the Atmel AVR, it is necessary to apply (external) capacitors according to the
requirements of the facilitated resonator. A parallel resonator will not be able to oscillate stable if the capacitive
load applied is insufficient. If the capacitive load is too high the oscillation may have problems starting due to
drive level dependency of the load. The trick is therefore to find an appropriate value for the capacitive load. The
value to look for in the data sheet of the crystal is CL, the recommended capacitive load of the resonator (viewed
from the terminals of the resonator). The capacitive load, CL, of the oscillator circuit, including stray capacitances
and the capacitances of the XTAL pins of the AVR can be determined empirically or it can be estimated by
Equation 4-1
.
Equation 4-1.
'
2
'
1
'
2
'
1
L
L
L
L
L
C
C
C
C
C
+
⋅
=
S
L
L
L
S
L
L
L
C
C
C
C
C
C
2
2
'
2
1
1
'
1
+
=
+
=
Where C
L1
and C
L2
refer to the external capacitors seen in
and C
L1S
and C
L2S
are stray capacitances at
the XTAL pins of the AVR. Assuming symmetric layout, so that C
L1
= C
L2
= C and C
L1S
= C
L2S
= C
S
, then the
external capacitors can be determined by
Equation 4-2
(C
S
can be estimated to be 5pF - 10pF):
Equation 4-2.
S
L
C
C
C
−
⋅
=
2
4.3 Recommended Capacitor Values
The recommendations here will work well in most applications, but there is no way to provide general values for
the external capacitors that can be guaranteed to work with all resonators.
When using the clock option “ext. crystal oscillator”, crystals with a nominal frequency from 400kHz and up can
be used. For these standard “high” frequency crystals the recommended capacitor value is in the range 22pF -
33pF.
The clock option “ext. low frequency crystal” is intended for 32.768kHz crystals. When selecting this clock source
the internal oscillator circuit might provide the required capacitive load. By programming the CKOPT Fuse, the
user can enable internal capacitors on XTAL1 and XTAL2. The value of the internal capacitors is typical 20pF,
but can vary. If using a 32.768kHz crystal that does not require more load than this, external capacitors can be
left out. Otherwise external capacitive load must be added. In this case the capacitive load value, given by the
manufacturer of the crystal, should be used. Then the value of the external capacitors can be determined by
Equation 4-2
. The CKOPT Fuse should not be programmed when using external capacitors.
Refer to the datasheet to assure whether the device has internal capacitors or not. Note that Atmel AT90S8535,
Atmega163, and Atmega103 do not have the CKOPT-fuse; instead they have dedicated pins (TOSC1-TOSC2),
to connect the 32.768kHz watch crystal to.
Using the clock option that selects “ext. ceramic resonator” it is strongly recommended to consult the datasheet
to determine the capacitors to apply. Always use the capacitive load recommended there since the resonant
frequency of the ceramic resonators is very sensitive to capacitive load.