Atmel AVR042: AVR Hardware Design Considerations: Features
Atmel AVR042: AVR Hardware Design Considerations: Features
Considerations
Rev. 2521K-AVR-03/11
2 Power Supply
Two aspects should be considered when designing the power supply for the
discrete/digital elements of an Atmel®AVR®; ESD protection and noise emission. Both
these topics are treated in details in the AVR040 application note, and only a short
summary is included in this document.
Figure 2-1 shows an example of insufficient decoupling. The capacitor is placed too
far away from the microcontroller, creating a large high current loop. The power and
ground planes here are parts of the high current loop. As a result of this, noise is
spread more easily to other devices on the board, and radiated emission from the
board is increased even further. The whole ground plane will act as an antenna for
the noise, instead of only the high current loop. This will be the case if the power and
ground pins are connected directly to the planes (typical for hole-mounted
components) and the decoupling capacitor is connected the same way. The same is
often seen for boards with surface-mount components if the integrated circuits are
placed on one side of the board and the decoupling capacitors are placed on the
other.
Figure 2-2 shows a better placement of the capacitor. The lines that are part of the
high current loop are not part of the power or ground planes. This is important, as the
power and ground planes otherwise will spread a lot of noise. Further, the figure
2 AVR042
2521K-AVR-03/11
AVR042
shows another improvement of the decoupling. A series ferrite bead is inserted to
reduce the switching noise on the power plane. The series resistance of the ferrite
bead must of course be low enough to ensure that there will be no significant DC
voltage drop.
Generally, the Atmel®AVR® devices where power and ground lines are placed close
together (like the ATmega8535) will get better decoupling than devices with industry
standard pin-out (like the ATmega8515), where the power and ground pins are placed
in opposite corners of the DIP package. This disadvantage can be overcome by using
for example a TQFP package, which allows decoupling capacitors to be placed very
close to the die. For devices with multiple pairs of power and ground pins, it is
essential that every pair of pins get its own decoupling capacitor.
The main supply should also have a tantalum or ceramic capacitor of some μF to
stabilize it.
3
2521K-AVR-03/11
2. To enter programming mode (for some parts also the PEN line is used to enter
programming mode). Furthermore it is possible to enter high-voltage/parallel
programming mode by drawing the RESET pin “very” high, where very high means
11.5 – 12.5V (refer to the datasheet of the device for more information).
The reset line has an internal pull-up resistor, but if the environment is noisy it can be
insufficient and reset can therefore occur sporadically. Refer to datasheet for value of
pull-up resistor on specific devices.
Connecting the RESET so that it is possible to enter both high-voltage programming
and ordinary low level reset can be achieved by applying a pull-up resistor to the
RESET line. This pull-up resistor makes sure that reset does not go low unintended.
® ®
The pull-up resistor can in theory be of any size, but if the Atmel AVR should be
programmed from e.g. STK500/AVRISP the pull-up should not be so strong that the
programmer cannot activate RESET by draw the RESET line low. The recommended
pull-up resistor is 4.7kΩ or larger when using STK500 for programming. For
debugWIRE to function properly, the pull-up must not be smaller than 10kΩ.
To protect the RESET line further from noise, it is an advantage to connect a
capacitor from the RESET pin to ground. This is not directly required since the AVR
internally have a low-pass filter to eliminate spikes and noise that could cause reset.
Applying an extra capacitor is thus an additional protection. However, note that this
capacitor cannot be present if debugWIRE or PDI is used.
If not using High Voltage Programming it is recommended to add an ESD protecting
diode from RESET to Vcc, since this is not internally provided due to High Voltage
Programming. Alternatively, or in addition, a zener diode can be used to limit the
RESET voltage relative to GND. The zener diode is highly recommended in noisy
environments. The components should be located physically close to the RESET pin
of the AVR. Figure 3-1 shows the recommended circuit on the RESET line.
4 AVR042
2521K-AVR-03/11
AVR042
Figure 3-1. Recommended Reset Pin connection.
5
2521K-AVR-03/11
(MOSI and MISO) and the bus clock (SCK), target voltage VTG, GND and RESET
(RST) are provided through these connectors.
Figure 4-1. Standard ISP connectors on STK500, AVR ISP and STK200/STK300
Some ISP programmers are powered by the target power supply. In this way they
easily adapt to the correct voltage level of the target board. Other ISP programmers,
like STK500, can alternatively power the target board via the VTG line. In that case it
is important that the power supply on the target is not switched on. Read the User
Guide for your ISP programmer for details on its capabilities and physical interface
6 AVR042
2521K-AVR-03/11
AVR042
Multiple Atmel®AVR® in a single application can share the same ISP interface to allow
for programming of all the devices through a minimal interface. However, the AVR
devices will all respond to the ISP instructions if special design considerations are not
made.
If it is desired to have only one ISP interface on the target board, the ISP
programming can be designed so that only one of the AVR devices is provided with a
SPI clock at a time. All other SPI lines can then be shared. This way, several AVRs
can be located “behind” the same protection resistors, since they are all held in
RESET while the ISP reset line is activated. The gating of the ISP clock can be
accomplished by use of, e.g., jumpers or DIP switches. An alternate solution is to
have multiple ISP interfaces, one for each device, all protected as shown in Figure
4-2.
Figure 4-3. Standard JTAG connector used on e.g. JTAGICE mkII and AVR ONE!
7
2521K-AVR-03/11
Figure 4-4: JTAG daisy-chain.
Protection resistors, as shown in Figure 4-2, are necessary if the JTAG lines are also
used for other purposes. For example, if they are used for analog input to the
Atmel®AVR®, there are often analog filters on the lines. If such filters are present on
the JTAG lines, it may be required to eliminate the filter capacitor during programming
to ensure that the load is mainly resistive. Figure 4-5 illustrates how this can be done.
Figure 4-5. Filters on JTAG pins – correct and incorrect ways to connect.
8 AVR042
2521K-AVR-03/11
AVR042
4.3 PDI interface
The Program and Debug Interface (PDI) is an Atmel proprietary two-line interface that
was introduced with the AVR XMEGA microcontroller family. As the name implies,
this interface can be used for both In-System Programming and on-chip debugging of
devices.
Figure 4-6 shows the standard PDI connector supplied with Atmel programmers. Only
two pins on the device are needed for use of this interface: RESET, also called
PDI_CLK, and the dedicated PDI_DATA pin. The target’s voltage supply is made
available to allow for powering of the device or ensuring correct signal levels during
programming.
Figure 4-6: Standard PDI connector used on e.g. STK600 and JTAGICE mkII.
Figure 4-7: Standard TPI connector used on e.g. STK600 and AVRISP mkII.
9
2521K-AVR-03/11
4.4.1 Disabling RESET pin functionality
The RESET pin can be reconfigured as an I/O pin by programming the RSTDISBL
fuse of the device. This disables the reset functionality, and requires +12V to be
applied to RESET for programming to work. Not all programming tools are capable of
generating this voltage.
Several sub-settings relating to the start-up time of the AVR can be selected, but the
3 clock options mentioned are the fundamental settings that should be focused on.
The clock options available can vary between AVR devices, - not all devices have the
ability to run on various external oscillators. Check the datasheet for the relevant
device to determine the clock options.
One should be aware that if selecting a different clock source than is actually applied,
the AVR might not run since different oscillator circuits are activated internally in the
AVR dependent on the selected clock option. Since the fuses are not cleared by a
memory erase, it can cause problems if incorrect settings are chosen.
10 AVR042
2521K-AVR-03/11
AVR042
a desired frequency, but is also more sensitive to temperature and load changes,
causing undesired frequency variations. The advantage of the ceramic resonators is
that it has a faster start-up than crystals.
In general there will not be distinguished between crystals and ceramic resonators in
this section and the term “resonator” will thus refer to both devices.
Table 5-1. Technical differences between ceramic resonators and quarts crystal
Ceramic resonator Quartz crystal
Aging ±3000ppm ± 10ppm
Frequency tolerance ± 2000-5000ppm ± 20ppm
Freq. temperature characteristics ± 20-50ppm/˚C ± 0.5ppm/˚C
Frequency pullability ± 100-350ppm/pF ± 15ppm/pF
Oscillator rise time 0.01-0.5ms 1-10ms
Quality factor (Qm) 100-5000 103-5·105
Figure 5-1. Basic inverter circuits equivivalent to the oscillator circuits in AVRs.
Rf Rf
XTAL1 XTAL2
CL1 CL2
Rb
CL1 Xtal CL2
XTAL1/ XTAL2/
TOSC1 TOSC2
Xtal
(A) (B)
Notes: i. Oscillator circuit for crystals and ceramic resonators faster than 400kHz
ii. Circuit for low frequency crystals (32.768kHz) (not on all Atmel®AVR®)
Simplifying the description of the Atmel®AVR® built-in oscillator circuits they can be
understood as the inverter based oscillator circuits illustrated in Figure 5-1. The circuit
used with resonators of frequencies above 400kHz is depicted in (A). When using this
circuit, capacitive load must be applied externally. The oscillator circuit seen in (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 is has internal
circuitry for low frequency crystals.
11
2521K-AVR-03/11
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 5-1.
Equation 5-1.
C L' 1 ⋅ C L' 2 C L' 1 = C L1 + C L1S
CL = ,
C L' 1 + C L' 2 C L' 2 = C L 2 + C L 2 S
Where CL1 and CL2 refer to the external capacitors seen in Figure 5-1 and CL1S and
CL2S are stray capacitances at the XTAL pins of the AVR. Assuming symmetric layout,
so that CL1 = CL2 = C and CL1S = CL2S = CS, then the external capacitors can be
determined by Equation 5-2 (CS can be estimated to be 5-10pF):
Equation 5-2.
C = 2 ⋅ CL − CS
12 AVR042
2521K-AVR-03/11
AVR042
5.4 Unbalanced external capacitors
In noisy environments the oscillator can be affected crucially by the noise. If the noise
is strong enough the oscillator can “lock up” and stop oscillating. To make the
oscillator less sensitive to noise the size of the capacitor at the high impedance input
of the oscillator circuit, XTAL1 can be increased slightly. Increasing only one of the
capacitors does not affect the total capacitive load much, but unbalanced capacitors
can affect the resonant frequency to a higher degree than the change of the total
capacitive load. However, unbalanced capacitive loads will affect the duty cycle of the
oscillation and therefore one should in general not use unbalanced capacitive loads.
® ®
This is especially critical if running the Atmel AVR close to its maximum speed limit.
6 Example layout
Figure 6-1 (A-C) shows a schematic and PCB layout using a crystal oscillator for
ATxmega32A4; This example assumes a multilayer design with supply and ground
plane on separate layers. Decoupling of all digital supply pairs from VCC and isolating
AVCC from VCC is seen. Note the short distance between the crystal/capacitors and
the ATxmega32A4, the ground plane surrounding the crystal and how close the vias
that connect to the planes are to the ATxmega32A4 pins in the layout.
13
2521K-AVR-03/11
Figure 6-1. (A) Basic schematic of required/recommended connections for
ATxmega32A4. (B) Copper PCB layout and (C) top silk prints.
(A)
14 AVR042
2521K-AVR-03/11
AVR042
(B) (C)
15
2521K-AVR-03/11
Atmel Corporation Atmel Asia Limited Atmel Munich GmbH Atmel Japan
2325 Orchard Parkway Unit 01-5 & 16, 19F Business Campus 9F, Tonetsu Shinkawa Bldg.
San Jose, CA 95131 BEA Tower, Milennium City 5 Parkring 4 1-24-8 Shinkawa
USA 418 Kwun Tong Road D-85748 Garching b. Munich Chou-ku, Tokyo 104-0033
Tel: (+1)(408) 441-0311 Kwun Tong, Kowloon GERMANY JAPAN
Fax: (+1)(408) 487-2600 HONG KONG Tel: (+49) 89-31970-0 Tel: (+81) 3523-3551
www.atmel.com Tel: (+852) 2245-6100 Fax: (+49) 89-3194621 Fax: (+81) 3523-7581
Fax: (+852) 2722-1369
Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to
any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL
TERMS AND CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS
ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE
LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION,
DAMAGES FOR LOSS AND PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO
USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or
warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and
product descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically
provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel products are not intended, authorized, or
warranted for use as components in applications intended to support or sustain life.
2521K-AVR-03/11
Mouser Electronics
Authorized Distributor
Atmel:
ATXMEGA32A4-CCUR