Secret of AT94K40AL-25BQC-Atmel
Secret of AT94K40AL-25BQC-Atmel
Secret of AT94K40AL-25BQC-Atmel
Notes: 1. FPSLIC parts with JTAG ICE support can be identified by the letter “J” after the device date
code, e.g., 4201 (no ICE support) and 4201J (with ICE support), see Figure 1-1.
2. FPSLIC devices should be laid out during PCB design to support a split power supply. Please
refer to the “Designing in Split Power Supply Support for AT94KAL and AT94SAL Devices”
application note, available on the Atmel web site at
http://www.atmel.com/atmel/acrobat/doc2308.pdf.
AT94K40AL-25DQC
0H1230
4201J Date Code
"J" indicates JTAG ICE support
PROGRAMMABLE I/O
Up to 16 Interrupt Lines
Up to 16
Addr Decoder
Up to 16K x 16
Program
SRAM Memory
4 Interrupt Lines
I/O
with
Multiply
Two 8-bit
Timer/Counters
Up to
16K x 8
JTAG ICE Data
SRAM
3
1138H–FPSLI–6/05
The embedded AVR core achieves throughputs approaching 1 MIPS per MHz by executing
powerful instructions in a single-clock cycle, and allows system designers to optimize power
consumption versus processing speed. The AVR core is based on an enhanced RISC architec-
ture that combines a rich instruction set with 32 general-purpose working registers. All 32
registers are directly connected to the Arithmetic Logic Unit (ALU), allowing two independent
registers to be accessed in one single instruction executed in one clock cycle. The resulting
architecture is more code-efficient while achieving throughputs up to ten times faster than con-
ventional CISC microcontrollers at the same clock frequency. The AVR executes out of on-chip
SRAM. Both the FPGA configuration SRAM and the AVR instruction code SRAM can be auto-
matically loaded at system power-up using Atmel’s In-System Programmable (ISP) AT17 Series
EEPROM Configuration Memories or ATFS FPSLIC Support Devices.
State-of-the-art FPSLIC design tools, System Designer, were developed in conjunction with the
FPSLIC architecture to help reduce overall time-to-market by integrating microcontroller devel-
opment and debug, FPGA development and Place and Route, and complete system
co-verification in one easy-to-use software tool.
2. FPGA Core
The AT40K core can be used for high-performance designs, by implementing a variety of com-
pute-intensive arithmetic functions. These include adaptive finite impulse response (FIR) filters,
fast Fourier transforms (FFT), convolvers, interpolators, and discrete-cosine transforms (DCT)
that are required for video compression and decompression, encryption, convolution and other
multimedia applications.
5
1138H–FPSLI–6/05
2.6 The Busing Network
Interface to AVR
Figure 2-2 depicts one of five identical FPGA busing planes. Each plane has three bus
resources: a local-bus resource (the middle bus) and two express-bus resources. Bus resources
are connected via repeaters. Each repeater has connections to two adjacent local-bus segments
and two express-bus segments. Each local-bus segment spans four cells and connects to con-
secutive repeaters. Each express-bus segment spans eight cells and bypasses a repeater.
Repeaters regenerate signals and can connect any bus to any other bus (all pathways are legal)
on the same plane. Although not shown, a local bus can bypass a repeater via a programmable
pass gate, allowing long on-chip tri-state buses to be created. Local/local turns are implemented
through pass gates in the cell-bus interface. Express/express turns are implemented through
separate pass gates distributed throughout the array.
= Row Repeater
= Column
7
1138H–FPSLI–6/05
2.7 Cell Connections
In Figure 2-3 section (a) depicts direct connections between an FPGA cell and its eight nearest
neighbors. Section (b) of Figure 2-3 shows the connections between a cell five horizontal local
buses (one per busing plane) and five vertical local buses (one per busing plane).
Y WXYZL
X X
W
X
CELL Y CELL Y CELL Y
Z CELL
L
X X
Y
X W Y
Z X W Y
FB
8 X 1 LUT 8 X 1 LUT
OUT OUT
"1"
"0" "1"
V1 V2 V3 V4 V5
H1 H2 H3 H4 H5
1 0
Z "1" OEH OEV L
D CLOCK
Q RESET/SET
X Y
NW NE SE SW N E S W
9
1138H–FPSLI–6/05
Figure 2-5. Some Single Cell Modes
4 LUT
Synthesis Mode B DQ Q (Registered)
C and/or
D
Q
SUM
3 LUT
or
A DQ SUM (Registered)
Arithmetic Mode B
C and/or
3 LUT
CARRY
3 LUT
DQ PRODUCT (Registered)
A or
DSP/Multiplier Mode B PRODUCT
C
D and/or
3 LUT
CARRY
3 LUT
DQ Q
CARRY
2:1 MUX
A
Tri-State/Mux Mode B Q
C
EN
2.9 RAM
There are two types of RAM in the FPSLIC device: the FreeRAM distributed through the FPGA
Core and the SRAM shared by the AVR and FPGA. The SRAM is described in “FPGA/AVR
Interface and System Control” on page 21. The 32 x 4 dual-ported FPGA FreeRAM blocks are
dispersed throughout the array and are connected in each sector as shown in Figure 2-6. A four-
bit Input Data bus connects to four horizontal local buses (Plane 1) distributed over four sector
rows. A four-bit Output Data bus connects to four horizontal local buses (Plane 2) distributed
over four sector rows. A five-bit Input-address bus connects to five vertical express buses in the
same sector column (column 3). A five-bit Output-address bus connects to five vertical express
buses in the same column. WAddr (Write Address) and RAddr (Read Address) alternate posi-
CLK
CLK
CLK
CLK
11
1138H–FPSLI–6/05
Figure 2-7. FreeRAM Logic(1)
CLOCK
"1" "1"
Load
5
READ ADDR Read
5 Load
WRITE ADDR Write 32 x 4
Latch
Dual-port
RAM
"1" OE
WE Load Write
Latch
4 Load 4
DATA IN Data Data DATA
Latch
Clear
RAM-Clear
Note: 1. For dual port, the switches on READ ADDR and DATA OUT would be on. The other two would be off. The reverse is true for
single port.
Note:
Figure 2-8.
1. These layouts can be generated automatically using the Macro Generators.
WE
Din(0) Dout(0)
Din(1) Dout(1)
Din(2) Dout(2)
Din(3) Dout(3)
WE WE WE WE
OE OE OE OE
Din(4) Dout(4)
Din(5) Dout(5)
Din(6) Dout(6)
Din(7) Dout(7)
Din Dout Din Dout Din Dout Din Dout
RAddr WAddr WAddr RAddr RAddr WAddr WAddr RAddr
Local Buses
WE WE WE WE
OE OE OE OE Express Buses
Dedicated Connections
13
2.10 Clocking and Set/Reset
Six of the eight dedicated Global Clock buses (1, 2, 3, 4, 7 and 8) are connected to a dual-use
Global Clock pin. In addition, two Global Clock buses (5 and 6) are driven from clock signals
generated within the AVR microcontroller core, see Figure 2-9.
An FPGA core internal signal can be placed on any Global Clock bus by routing that signal to a
Global Clock access point in the corners of the embedded core. Each column of the array has a
Column Clock selected from one of the eight Global Clock buses. The left edge Column Clock
mux has two additional inputs from dual-use pins FCK1, see Figure 2-6, and FCK2 to provide
fast clocking to left-side I/O. Each sector column of four cells can be clocked from a (Plane 4)
express bus or from the Column Clock. Clocking to the 4 cells of a sector can be disabled. The
Plane 4 express bus used for clocking is half length at the array edge. The clock provided to
each sector column of four cells can be either inverted or not inverted. The register in each cell is
triggered on a rising clock edge. On power-up, constant “0” is provided to each register’s clock
pins. A dedicated Global Set/Reset bus, see Figure 2-7, can be driven by any USER I/O pad,
except those used for clocking, Global or Fast. An internal signal can be placed on the Global
Set/Reset bus by routing that signal to the pad programmed as the Global Set/Reset input. Glo-
bal Set/Reset is distributed to each column of the array. Each sector column of four cells can be
Set/Reset by a (Plane 5) express bus or by the Global Set/Reset. The Plane 5 express bus used
for Set/Reset is half length at array edge. The Set/Reset provided to each sector column of four
cells can be either inverted or not inverted. The function of the Set/Reset input of a register
(either Set or Reset) is determined by a configuration bit for each cell. The Set/Reset input of a
register is Active Low (logic 0). Setting or resetting of a register is asynchronous. On power-up, a
logic 1 (High) is provided by each register, i.e., all registers are set at power-up.
"1"
15
1138H–FPSLI–6/05
Figure 2-10. Clocking (for One Column of Cells)
} FCK(1)
} GCK1 − GCK8
"1"
Express Bus
(Plane 4; Half Length at Edge)
"1"
Repeater
"1"
"1"
Note: 1. Two on left edge column of the embedded FPGA array only.
Repeater
"1"
"1"
Express Bus
(Plane 5; Half Length at Edge)
"1"
"1"
Some of the bus resources on the embedded FPGA core are used as dual-function resources.
Table 2-2 shows which buses are used in a dual-function mode and which bus plane is used.
The FPGA software tools are designed to automatically accommodate dual-function buses in an
efficient manner.
17
1138H–FPSLI–6/05
Table 2-2. Dual-function Buses
Function Type Plane(s) Direction Comments
Horizontal
Cell Output Enable Local 5 and
Vertical
FreeRAM Output Bus full length at array edge bus in first
Express 2 Vertical
Enable column to left of RAM block
FreeRAM Write Bus full length at array edge bus in first
Express 1 Vertical
Enable column to left of RAM block
Buses full length at array edge
FreeRAM Address Express 1-5 Vertical buses in second column to left of
RAM block
FreeRAM
Local 1 Horizontal
Data In
FreeRAM
Local 2 Horizontal
Data Out
Clocking Express 4 Vertical Bus full length at array edge
Set/Reset Express 5 Vertical Bus full length at array edge
CELL
TRI-STATE
"0"
"1"
VCC
DRIVE
PULL-UP "0"
"1"
PAD
CELL
RST
CLK
PULL-DOWN
SCHMITT
TTL/CMOS
DELAY
GND
CLK
RST
CELL
TRI-STATE "0"
"1"
VCC
CELL
DRIVE
PULL-UP
"0"
"1"
PAD
RST
CLK
PULL-DOWN
TTL/CMOS
DELAY
SCHMITT
GND
CLK
RST
CELL
p p p p
cell cell cell cell
s s s s
p p p p
p cell cell cell cell
ss s s s
p p p p
s = secondary I/O cell cell cell cell
p = primary I/O
19
1138H–FPSLI–6/05
Figure 2-15. Corner I/Os
PULL-DOWN
PULL-DOWN
PULL-UP
PULL-UP
PAD PAD
TTL/CMOS TTL/CMOS
DRIVE DRIVE
SCHMITT SCHMITT
TRI-ST ATE TRI-ST ATE
DELAY DELAY
CLK CLK
RST RST
RST RST
CLK CLK
"1"
"1"
"0"
"0"
"0"
"0"
"1"
"1"
TRI-STATE
"0"
"1"
VCC
DRIVE
PULL-UP "0"
PAD "1"
RST
CLK
CELL CELL
PULL-DOWN
TTL/CMOS
DELAY
SCHMITT
CLK
RST
GND
CELL
The FPGA I/O selection is controlled by the AVR. This is described in detail beginning on
page 55. The FPGA I/O interrupts are described beginning on page 59.
21
1138H–FPSLI–6/05
3.2 Program and Data SRAM
Up to 36 Kbytes of 15 ns dual-port SRAM reside between the FPGA and the AVR. This SRAM is
used by the AVR for program instruction and general-purpose data storage. The AVR is con-
nected to one side of this SRAM; the FPGA is connected to the other side. The port connected
to the FPGA is used to store data without using up bandwidth on the AVR system data bus.
The FPGA core communicates directly with the data SRAM(1) block, viewing all SRAM memory
space as 8-bit memory.
Note: 1. The unused bits for the FPGA-SRAM address must tie to ‘0’ because there is no pull-down
circuitry.
For the AT94K10 and AT94K40, the internal program and data SRAM is divided into three
blocks: 10 Kbytes x 16 dedicated program SRAM, 4 Kbytes x 8 dedicated data SRAM and 6
Kbytes x 16 or 12 Kbytes x 8 configurable SRAM, which may be swapped between program and
data memory spaces in 2 Kbytes x 16 or 4 Kbytes x 8 partitions.
For the AT94K05, the internal program and data SRAM is divided into three blocks: 4 Kbytes 16
dedicated program SRAM, 4 Kbytes x 8 dedicated data SRAM and 6 Kbytes x 16 or 12
Kbytes x 8 configurable SRAM, which may be swapped between program and data memory
spaces in 2 Kbytes x 16 or 4 Kbytes x 8 partitions.
The addressing scheme for the configurable SRAM partitions prevents program instructions
from overwriting data words and vice versa. Once configured (SCR41:40 – See “System Control
Register – FPGA/AVR” on page 30.), the program memory space remains isolated from the data
memory space. SCR41:40 controls internal muxes. Write enable signals allow the memory to be
safely segmented. Figure 3-2 shows the FPSLIC configurable allocation SRAM memory.
$2000 $37FF
$1FFF $3800
OPTIONAL OPTIONAL
4 Kbytes x 8 2 Kbytes x 16
$1000 $3FFF
$0FFF
FIXED
4 Kbytes x 8
$005F
AVR
DATA MEMORY
SRAM MAPPED
FPGA I/O
ACCESS
$001F ONLY
AVR REG.
$0000 SPACE (2)
Notes: 1. The Soft “BOOT BLOCK” is an area of memory that is first loaded when the part is powered up
and configured. The remainder of the memory can be reprogrammed while the device is in
operation for switching functions in and out of memory. The Soft “BOOT BLOCK” can only be
programmed by a full device configuration on power-up.
2. The lower portion of the Data memory is not shared between the AVR and FPGA. The AVR
uses addresses $0000 - $001F for the AVR CPU general working registers. $001F - $005F are
the addresses used for Memory Mapped I/O and store the information in dedicated registers.
Therefore, on the FPGA side $0000 - $005F are available for data that is only needed by the
FPGA.
23
1138H–FPSLI–6/05
3.3 Data SRAM Access by FPGA – FPGAFrame Mode
The FPGA user logic has access to the data SRAM directly through the FPGA side of the dual-
port memory, see Figure 3-3. A single bit in the configuration control register (SCR63 – see
“System Control Register – FPGA/AVR” on page 30) enables this interface. The interface is dis-
abled during configuration downloads. Express buses on the East edge of the array are used to
interface the memory. Full read and write access is available. To allow easy implementation, the
interface itself is dedicated in routing resources, and is controlled in the System Designer soft-
ware suite using the AVR FPGA interface dialog.
16 Address Lines:
FPGA Edge Express Buses 16-bit Data Address Bus
WE FPGA WE AVR
EMBEDDED EMBEDDED
FPGA CORE DATA SRAM RE AVR AVR CORE
CLK FPGA CLK AVR
4 Kbytes x 8
SCR38 UP TO
16 Kbytes x 8
8-bit Data Read 8-bit Data Read/Write
B Side A Side
Once the SCR63 bit is set there is no additional read enable from the FPGA side. This means
that the read is always enabled. You can also perform a read or write from the AVR at the same
time as an FPGA read or write. If there is a possibility of a write address being accessed by both
devices at the same time, the designer should add arbitration to the FPGA Logic to control who
has priority. In most cases the AVR would be used to restrict access by the FPGA using the
FMXOR bit, see “Software Control Register – SFTCR” on page 52. You can read from the same
location from both sides simultaneously.
SCR bit 38 controls the polarity of the clock to the SRAM from the AT40K FPGA.
3.4.1 Accessing and Modifying the Program Memory from the AVR
The FPSLIC SRAM is up to 36 x 8 Kbytes of dual port, see Figure 3-2):
• The A side (port) is accessed by the AVR.
• The B side (port) is accessed by the FPGA/Configuration Logic.
• The B side (port) can be accessed by the AVR with ST and LD instructions in DBG mode for
code self-modify.
Structurally, the [(n • 2) Kbytes 8] memory is built from (n)2 Kbytes 8 blocks, numbered SRAM0
through SRAM(n).
25
1138H–FPSLI–6/05
Table 3-2. AVR Data Decode for SRAM 0:17 (16K8)
Address Range SRAM Comments
$07FF – $0000 00 AVR Data Read/Write
$0FFF – $0800 01 AVR Data Read/Write
$17FF – $1000 02
CR41:40 = 11,10,01
$1FFF – $1800 03
$27FF – $2000 04
CR41:40 = 11,10
$2FFF – $2800 05
$37FF – $3000 06
CR41:40 = 11
$3FFF – $3800 07
3.4.3 B Side
The B side is not partitioned; the FPGA (and AVR debug mode) views the memory space as
36 x 8 Kbytes.
• The B side is accessed by the FPGA/Configuration Logic.
• The B side is accessed by the AVR with ST and LD instructions in DBG mode for code self-
modify.
To activate the debug mode and allow the AVR to access the program code space (with ST
– see Figure 3-4 – and LD – see Figure 3-5 – instructions), the DBG bit (bit 1) of the SFTCR
$3A ($5A) register has to be set. When this bit is set, SCR36 and SCR37 are ignored – you
can overwrite anything in the AVR program memory.
The FPGA memory access interface should be disabled while in debug mode. This is to
ensure that there is no contention between the FPGA address and data signals and the
AVR-generated address and data signals. To ensure the AVR has control over the “B side”
memory interface, the FMXOR bit (bit 3) of the SFTCR $3A ($5A) register should be used in
conjunction with the SCR63 system control register bit.
The FMXOR bit is XORed with the System Control Register’s Enable FPGA SRAM Interface
bit (SCR63). The behavior when this bit is set to 1 is dependent on how the SCR was initial-
ized. If the Enable FPGA SRAM Interface bit (SCR63) in the SCR is 0, the FMXOR bit
enables the FPGA SRAM Interface when set to 1. If the Enable FPGA SRAM Interface bit in
the SCR is 1, the FMXOR bit disables the FPGA SRAM Interface when set to 1. During AVR
reset, the FMXOR bit is cleared by the hardware.
Even though the FPGA (and AVR debug mode) views the memory space as
36 x 8 Kbytes, an awareness of the 2K x 8 partitions (or SRAM labels) is required if Frame
(and AVR debug mode) read/writes are to be meaningful to the AVR.
• AVR data to FPGA addressing is 1:1 mapping.
• AVR program to FPGA addressing requires 16-bit to 8-bit mapping and an understanding of
the partitions in Table 3-3.
27
1138H–FPSLI–6/05
Figure 3-4. AVR SRAM Data Memory Write Using “ST” Instruction
CLOCK
RAMWE
RAMADR VALID
DBUS VALID
DBUSOUT
(REGISTERED) VALID
ST cycle 1 ST cycle 2 next instruction
Figure 3-5. AVR SRAM Data Memory Read Using “LD” Instruction
CLOCK
RAMRE
RAMADR VALID
DBUS VALID
The AVR Cache Logic access mode is write only. Transfers may be aborted at any time due to
AVR program wishes or external interrupts.
The FPGA CHECK function is not supported by the AVR Cache mode.
A typical application for this mode is for the AVR to accept serial data through a UART for exam-
ple, and port it as configuration data to the FPGA, thereby affecting a download, or allowing
reconfigurable systems where the FPGA is updated algorithmically by the AVR. For more infor-
mation, refer to the “AT94K Series Configuration” application note available on the Atmel web
site, at: http://www.atmel.com/atmel/acrobat/doc2313.pdf.
3.6 Resets
The user must have the flexibility to issue resets and reconfiguration commands to separate por-
tions of the device. There are two Reset pins on the FPSLIC device. The first, RESET, results in
a clearing of all FPGA configuration SRAM and the System Control Register, and initiates a
download if in mode 0. The AVR will stop and be reset.
A second reset pin, AVRReset, is implemented to reset the AVR portion of the FPSLIC func-
tional blocks. This is described in the “Reset Sources” on page 63.
29
1138H–FPSLI–6/05
3.7 System Control
Modes 2 and 3 are reserved and are used for factory test.
Modes 0 and 1 are pin-compatible with the appropriate AT40K counterpart. AVR I/O will be
taken over by the configuration logic for the CHECK pin during both modes.
Refer to the “AT94K Series Configuration” application note for details on downloading
bitstreams.
31
1138H–FPSLI–6/05
Table 3-7. FPSLIC System Control Register (Continued)
Bit Description
0 = Disable I/O Tri-state
1 = I/O Tri-state During (Internal and External) Configuration Download.
SCR31 SCR31 forces all user defined I/O pins to go tri-state during configuration
download. Tri-state is released at the end of configuration download on the rising
edge of CON, if set.
SCR32 - SCR34 Reserved
0 = AVR Reset Pin Disabled
SCR35 1 = AVR Reset Pin Enabled (active Low Reset)
SCR35 allows the AVR Reset pin to reset the AVR only.
0 = Protect AVR Program SRAM
SCR36 1 = Allow Writes to AVR Program SRAM (Excluding Boot Block)
SCR36 protects AVR program code from writes by the FPGA.
0 = AVR Program SRAM Boot Block Protect
SCR37
1 = AVR Program SRAM Boot Block Allows Overwrite
0 = (default) Frame Clock Inverted to AVR Data/Program SRAM
SCR38
1 = Non-inverting Clock Into AVR Data/Program SRAM
SCR39 Reserved
SCR41 = 0, SCR40 = 0 16 Kbytes x 16 Program/4 Kbytes x 8 Data
SCR41 = 0, SCR40 = 1 14 Kbytes x 16 Program/8 Kbytes x 8 Data
SCR41 = 1, SCR40 = 0 12 Kbytes x 16 Program/12 Kbytes x 8 Data
SCR40 - SCR41
SCR41 = 1, SCR40 = 1 10 Kbytes x 16 Program/16 Kbytes x 8 Data
SCR40 : SCR41 AVR program/data SRAM partitioning (set by using the AT94K
Device Options in System Designer).
SCR 42 -
Reserved
SCR47
0 = EXT-INT0 Driven By Port E<4>
SCR48 1 = EXT-INT0 Driven By INTP0 pad
SCR48 : SCR53 Defaults dependent on package selected.
0 = EXT-INT1 Driven By Port E<5>
SCR49 1 = EXT-INT1 Driven By INTP1 pad
SCR48 : SCR53 Defaults dependent on package selected.
0 = EXT-INT2 Driven By Port E<6>
SCR50 1 = EXT-INT2 Driven By INTP2 pad
SCR48 : SCR53 Defaults dependent on package selected.
0 = EXT-INT3 Driven By Port E<7>
SCR51 1 = EXT-INT3 Driven By INTP3 pad
SCR48 : SCR53 Defaults dependent on package selected.
0 = UART0 Pins Assigned to Port E<1:0>
SCR52 1 = UART0 Pins Assigned to UART0 pads
SCR48 : SCR53 Defaults dependent on package selected.
0 = UART1 Pins Assigned to Port E<3:2>
1 = UART1 Pins Assigned to UART1 pads
SCR48 : SCR53 Defaults dependent on package selected.
SCR53 On packages less than 144-pins, there is reduced access to AVR ports. Port D is
not available externally in the smallest package and Port E becomes dual-purpose
I/O to maintain access to the UARTs and external interrupt pins. The Pin List (East
Side) on page 189 shows exactly which pins are available in each package.
33
1138H–FPSLI–6/05
4. AVR Core and Peripherals
• AVR Core
• Watchdog Timer/On-chip Oscillator
• Oscillator-to-Internal Clock Circuit
• Oscillator-to-Timer/Counter for Real-time Clock
• 16-bit Timer/Counter and Two 8-bit Timer/Counters
• Interrupt Unit
• Multiplier
• UART (0)
• UART (1)
• I/O Port D (full 8 bits available on 144-pin or higher devices)
• I/O Port E
The embedded AVR core is a low-power CMOS 8-bit microcontroller based on the AVR RISC
architecture. The embedded AVR core achieves throughputs approaching 1 MIPS per MHz by
executing powerful instructions in a single-clock-cycle, and allows the system architect to opti-
mize power consumption versus processing speed.
The AVR core is based on an enhanced RISC architecture that combines a rich instruction set
with 32 x 8 general-purpose working registers. All the 32 x 8 registers are directly connected to
the Arithmetic Logic Unit (ALU), allowing two independent register bytes to be accessed in one
single instruction executed in one clock cycle. The resulting architecture is more code efficient
while achieving throughputs up to ten times faster than conventional CISC microcontrollers.
The embedded AVR core provides the following features: 16 general-purpose I/O lines, 32 x 8
general-purpose working registers, Real-time Counter (RTC), 3 flexible timer/counters with com-
pare modes and PWM, 2 UARTs, programmable Watchdog Timer with internal oscillator, 2-wire
serial port, and three software-selectable Power-saving modes. The Idle mode stops the CPU
while allowing the SRAM, timer/counters, two-wire serial port, and interrupt system to continue
functioning. The Power-down mode saves the register contents but freezes the oscillator, dis-
abling all other chip functions until the next interrupt or hardware reset. In Power-save mode, the
timer oscillator continues to run, allowing the user to maintain a timer base while the rest of the
device is sleeping.
The embedded AVR core is supported with a full suite of program and system development
tools, including C compilers, macro assemblers, program debugger/simulators and evaluation
kits.
4.1.3.1 Stack
STACK: Stack for return address and pushed registers
SP: Stack Pointer to STACK
4.1.3.2 Flags
⇔: Flag affected by instruction
0: Flag cleared by instruction
1: Flag set by instruction
-: Flag not affected by instruction
The instructions EIJMP, EICALL, ELPM, GPM, ESPM (from the megaAVR Instruction Set) are
not supported in the FPSLIC device.
35
1138H–FPSLI–6/05
Table 4-1. Conditional Branch Summary
37
1138H–FPSLI–6/05
Table 4-2. Instruction Set Summary (Continued)
Mnemonics Operands Description Operation Flags #Clock
BRLO k Branch if Lower if (C = 1) then PC ← PC + k + 1 None 1/2
BRMI k Branch if Minus if (N = 1) then PC ← PC + k + 1 None 1/2
BRPL k Branch if Plus if (N = 0) then PC ← PC + k + 1 None 1/2
BRGE k Branch if Greater or Equal, Signed if (N ⊕ V= 0) then PC ← PC + k + 1 None 1/2
BRLT k Branch if Less Than, Signed if (N ⊕ V= 1) then PC ← PC + k + 1 None 1/2
BRHS k Branch if Half-carry Flag Set if (H = 1) then PC ← PC + k + 1 None 1/2
BRHC k Branch if Half-carry Flag Cleared if (H = 0) then PC ← PC + k + 1 None 1/2
BRTS k Branch if T Flag Set if (T = 1) then PC ← PC + k + 1 None 1/2
BRTC k Branch if T Flag Cleared if (T = 0) then PC ← PC + k + 1 None 1/2
BRVS k Branch if Overflow Flag is Set if (V = 1) then PC ← PC + k + 1 None 1/2
BRVC k Branch if Overflow Flag is Cleared if (V = 0) then PC ← PC + k + 1 None 1/2
BRIE k Branch if Interrupt Enabled if (I = 1) then PC ← PC + k + 1 None 1/2
BRID k Branch if Interrupt Disabled if (I = 0) then PC ← PC + k + 1 None 1/2
Data Transfer Instructions
MOV Rd, Rr Copy Register Rd ← Rr None 1
MOVW Rd, Rr Copy Register Pair Rd+1:Rd ← Rr+1:Rr None 1
LDI Rd, K Load Immediate Rd ← K None 1
LDS Rd, k Load Direct from Data Space Rd ← (k) None 2
LD Rd, X Load Indirect Rd ← (X) None 2
LD Rd, X+ Load Indirect and Post-Increment Rd ← (X), X ← X + 1 None 2
LD Rd, -X Load Indirect and Pre-Decrement X ← X - 1, Rd ← (X) None 2
LD Rd, Y Load Indirect Rd ← (Y) None 2
LD Rd, Y+ Load Indirect and Post-Increment Rd ← (Y), Y ← Y + 1 None 2
LD Rd, -Y Load Indirect and Pre-Decrement Y ← Y - 1, Rd ← (Y) None 2
LDD Rd, Y+q Load Indirect with Displacement Rd ← (Y + q) None 2
LD Rd, Z Load Indirect Rd ← (Z) None 2
LD Rd, Z+ Load Indirect and Post-Increment Rd ← (Z), Z ← Z+1 None 2
LD Rd, -Z Load Indirect and Pre-Decrement Z ← Z - 1, Rd ← (Z) None 2
LDD Rd, Z+q Load Indirect with Displacement Rd ← (Z + q) None 2
STS k, Rr Store Direct to Data Space Rd ← (k) None 2
ST X, Rr Store Indirect (X) ← Rr None 2
ST X+, Rr Store Indirect and Post-Increment (X) ← Rr, X ← X + 1 None 2
ST -X, Rr Store Indirect and Pre-Decrement X ← X - 1, (X) ← Rr None 2
ST Y, Rr Store Indirect (Y) ← Rr None 2
ST Y+, Rr Store Indirect and Post-Increment (Y) ← Rr, Y ← Y + 1 None 2
ST -Y, Rr Store Indirect and Pre-Decrement Y ← Y - 1, (Y) ← Rr None 2
39
1138H–FPSLI–6/05
Table 4-2. Instruction Set Summary (Continued)
Mnemonics Operands Description Operation Flags #Clock
SEV Set Two’s Complement Overflow V←1 V 1
CLV Clear Two’s Complement Overflow V←0 V 1
SET Set T in SREG T←1 T 1
CLT Clear T in SREG T←0 T 1
SEH Set Half-carry Flag in SREG H←1 H 1
CLH Clear Half-carry Flag in SREG H←0 H 1
NOP No Operation None 1
SLEEP Sleep (See specific description for Sleep) None 1
WDR Watchdog Reset (See specific description for WDR) None 1
BREAK Break For on-chip debug only None N/A
4.3.1 VCC
Supply voltage
4.3.2 GND
Ground
4.3.5 RX0
Input (receive) to UART(0) – See SCR52
4.3.6 TX0
Output (transmit) from UART(0) – See SCR52
4.3.8 TX1
Output (transmit) from UART(1) – See SCR53
4.3.9 XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
4.3.10 XTAL2
Output from the inverting oscillator amplifier
4.3.11 TOSC1
Input to the inverting timer/counter oscillator amplifier
4.3.12 TOSC2
Output from the inverting timer/counter oscillator amplifier
4.3.13 SCL
2-wire serial input/output clock
4.3.14 SDA
2-wire serial input/output data
MAX 1 HC BUFFER
HC
C2 XTAL2 C2 = 27 pf
RBIAS
C1 C1 = 33 pf
XTAL1
GND
41
1138H–FPSLI–6/05
4.4.2 External Clock
To drive the device from an external clock source, XTAL2 should be left unconnected while
XTAL1 is driven as shown in Figure 4-2.
NC XTAL2
EXTERNAL
OSCILLATOR XTAL1
SIGNAL
GND
RPD = 4.7 KΩ
NC XTAL2
XTAL1
RPD
GND
C1 = 33 pF
C1 RS C2 = 27 pF
TOSC2 RB = 10M
RS = 200K
RB
TOSC1
C2
43
1138H–FPSLI–6/05
4.6 General-purpose Register File
Figure 4-5 shows the structure of the 32 x 8 general-purpose working registers in the CPU.
7 0 Addr.
R0 $00
R1 $01
R2 $02
...
R13 $0D
R14 $0E
General-purpose R15 $0F
Working Registers R16 $10
R17 $11
...
R26 $1A AVR X-register Low Byte
R27 $1B AVR X-register High Byte
R28 $1C AVR Y-register Low Byte
R29 $1D AVR Y-register High Byte
R30 $1E AVR Z-register Low Byte
R31 $1F AVR Z-register High Byte
All the register operating instructions in the instruction set have direct- and single-cycle access
to all registers. The only exception is the five constant arithmetic and logic instructions SBCI,
SUBI, CPI, ANDI and ORI between a constant and a register and the LDI instruction for load-
immediate constant data. These instructions apply to the second half of the registers in the reg-
ister file – R16..R31. The general SBC, SUB, CP, AND and OR and all other operations between
two registers or on a single-register apply to the entire register file.
As shown in Figure 4-5 each register is also assigned a data memory address, mapping the reg-
isters directly into the first 32 locations of the user Data Space. Although not being physically
implemented as SRAM locations, this memory organization provides great flexibility in access of
the registers, as the X, Y and Z registers can be set to index any register in the file.
The 4 to 16 Kbytes of data SRAM, as configured during FPSLIC download, are available for gen-
eral data are implemented starting at address $0060 as follows:
Addresses beyond the maximum amount of data SRAM are unavailable for write or read and will
return unknown data if accessed. Ghost memory is not implemented.
I/O Direct
Operand address is contained in 6 bits of the instruction word. n is the destination or source reg-
ister address.
45
1138H–FPSLI–6/05
Data Direct
A 16-bit data address is contained in the 16 LSBs of a two-word instruction. Rd/Rr specify the
destination or source register.
Data Indirect
Operand address is the contents of the X-, Y- or the Z-register.
AVR CLK
Figure 4-7 shows the internal timing concept for the register file. In a single clock cycle an ALU
operation using two register operands is executed, and the result is stored back to the destina-
tion register.
AVR CLK
Total ExecutionTime
The internal data SRAM access is performed in two system clock cycles as described in
Figure 4-8.
AVR CLK
Data
Write
WR
Data
Read
RD
47
1138H–FPSLI–6/05
4.11 Memory-mapped I/O
The I/O space definition of the embedded AVR core is shown in the following table:
$3E ($5E) SPH SP15 SP14 SP13 SP12 SP11 SP10 SP9 SP8 57
$3D ($5D) SPL SP7 SP6 SP5 SP4 SP3 SP2 SP1 SP0 51
$3B ($5B) EIMF INTF3 INTF2 INTF1 INTF0 INT3 INT2 INT1 INT0 62
$39 ($59) TIMSK TOIE1 OCIE1A OCIE1B TOIE2 TICIE1 OCIE2 TOIE0 OCIE0 62
$38 ($58) TIFR TOV1 OCF1A OCF1B TOV2 ICF1 OCF2 TOV0 OCF0 63
$36 ($56) TWCR TWINT TWEA TWSTA TWSTO TWWC TWEN TWIE 110
$35 ($55) MCUR JTRF JTD SE SM1 SM0 PORF WDRF EXTRF 51
$33 ($53) TCCR0 FOC0 PWM0 COM01 COM00 CTC0 CS02 CS01 CS00 69
$2F ($4F) TCCR1A COM1A1 COM1A0 COM1B1 COM1B0 FOC1A FOC1B PWM11 PWM10 76
$2E ($4E) TCCR1B ICNC1 ICES1 ICPE CTC1 CS12 CS11 CS10 77
$27 ($47) TCCR2 FOC2 PWM2 COM21 COM20 CTC2 CS22 CS21 CS20 69
$20 ($40) UBRRHI UART1 Baud Rate High Nibble [11..8] UART0 Baud Rate Low Nibble [11..8] 105
$1A ($3A) FPGAZ FPGA Cache Z Address Register (T3 - T0) (Z3 - Z0) 53
$17 ($37) FISUD FPGA I/O Select, Interrupt Mask/Flag Register D (Reserved on AT94K05) 54, 56
$16 ($36) FISUC FPGA I/O Select, Interrupt Mask/Flag Register C (Reserved on AT94K05) 54, 56
$15 ($35) FISUB FPGA I/O Select, Interrupt Mask/Flag Register B 54, 56
$14 ($34) FISUA FPGA I/O Select, Interrupt Mask/Flag Register A 54, 56
$12 ($32) PORTD PORTD7 PORTD6 PORTD5 PORTD4 PORTD3 PORTD2 PORTD1 PORTD0 124
$11 ($31) DDRD DDRD7 DDRD6 DDRD5 DDRD4 DDRD3 DDRD2 DDRD1 DDRD0 124
$10 ($30) PIND PIND7 PIND6 PIND5 PIND4 PIND3 PIND2 PIND1 PIND0 124
$0B ($2B) UCSR0A RXC0 TXC0 UDRE0 FE0 OR0 U2X0 MPCM0 101
$0A ($2A) UCSR0B RXCIE0 TXCIE0 UDRIE0 RXEN0 TXEN0 CHR90 RXB80 TXB80 103
OCDR
$08 ($28) IDRD Reserved(1)
(Reserved)
$07 ($27) PORTE PORTE7 PORTE6 PORTE5 PORTE4 PORTE3 PORTE2 PORTE1 PORTE0 126
$06 ($26) DDRE DDRE7 DDRE6 DDRE5 DDRE4 DDRE3 DDRE2 DDRE1 DDRE0 126
$05 ($25) PINE PINE7 PINE6 PINE5 PINE4 PINE3 PINE2 PINE1 PINE0 126
$02 ($22) UCSR1A RXC1 TXC1 UDRE1 FE1 OR1 U2X1 MPCM1 101
$01 ($21) UCSR1B RXCIE1 TXCIE1 UDRIE1 RXEN1 TXEN1 CHR91 RXB81 TXB81 103
Note: 1. The On-chip Debug Register (OCDR) is detailed on the “FPSLIC On-chip Debug System” distributed within Atmel and select
third-party vendors only under Non-Disclosure Agreement (NDA). Contact [email protected] for a copy of this document.
The embedded AVR core I/Os and peripherals, and all the virtual FPGA peripherals are placed
in the I/O space. The different I/O locations are directly accessed by the IN and OUT instructions
transferring data between the 32 x 8 general-purpose working registers and the I/O space. I/O
registers within the address range $00 – $1F are directly bit-accessible using the SBI and CBI
instructions. In these registers, the value of single bits can be checked by using the SBIS and
SBIC instructions. When using the I/O specific instructions IN, OUT, the I/O register address
$00 – $3F are used, see Figure 4-9. When addressing I/O registers as SRAM, $20 must be
added to this address. All I/O register addresses throughout this document are shown with the
SRAM address in parentheses.
49
1138H–FPSLI–6/05
Figure 4-9. Memory-mapped I/O
SRAM Space
$5F
I/O Space
Memory-mapped
$3F
I/O
$1F
Registers r0 - r31
$00 $00
Used for In/Out Used for all
Instructions Other Instructions
For single-cycle access (In/Out Commands) to I/O, the instruction has to be less than 16 bits:
In the data SRAM, the registers are located at memory addresses $00 - $1F and the I/O space is
located at memory addresses $20 - $5F.
As there are only 6 bits available to refer to the I/O space, the address is re-mapped down 2 bits.
This means the In/Out commands access $00 to $3F which goes directly to the I/O and maps to
$20 to $5F in SRAM. All other instructions access the I/O space through the $20 - $5F
addressing.
For compatibility with future devices, reserved bits should be written zero if accessed. Reserved
I/O memory addresses should never be written.
The status flags are cleared by writing a logic 1 to them. Note that the CBI and SBI instructions
will operate on all bits in the I/O register, writing a one back into any flag read as set, thus clear-
ing the flag. The CBI and SBI instructions work with registers $00 to $1F only.
Note: 1. Note that the status register is not automatically stored when entering an interrupt routine and
restored when returning from an interrupt routine. This must be handled by software.
51
1138H–FPSLI–6/05
Stack Pointer – SP
The general AVR 16-bit Stack Pointer is effectively built up of two 8-bit registers in the I/O space
locations $3E ($5E) and $3D ($5D). Future versions of FPSLIC may support up to 64K Bytes of
memory; therefore, all 16 bits are used.
Bit 15 14 13 12 11 10 9 8
$3E ($5E) SP15 SP14 SP13 SP12 SP11 SP10 SP9 SP8 SPH
$3D ($5D) SP7 SP6 SP5 SP4 SP3 SP2 SP1 SP0 SPL
7 6 5 4 3 2 1 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
R/W R/W R/W R/W R/W R/W R/W R/W
Initial Value 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
The Stack Pointer points to the data SRAM stack area where the Subroutine and Interrupt
Stacks are located. This Stack space in the data SRAM must be defined by the program before
any subroutine calls are executed or interrupts are enabled. The stack pointer must be set to
point above $60. The Stack Pointer is decremented by one when data is pushed onto the Stack
with the PUSH instruction, and it is decremented by two when an address is pushed onto the
Stack with subroutine calls and interrupts. The Stack Pointer is incremented by one when data is
popped from the Stack with the POP instruction, and it is incremented by two when an address
is popped from the Stack with return from subroutine RET or return from interrupt RETI.
53
1138H–FPSLI–6/05
• Bit 0 - EXTRF: External (Software) Reset Flag
This flag is set (one) in three separate circumstances: power-on reset, use of Resetn/AVRRe-
setn and writing a one to the SRST bit in the Software Control Register – SFTCR. The PORF
flag can be checked to eliminate power-on reset as a cause for this flag to be set. There is no
way to differentiate between use of Resetn/AVRResetn and software reset. The flag can only be
cleared (zero) by writing a zero to the EXTRF bit. The bit will not be cleared by the hardware dur-
ing AVR reset.
The FPGAD I/O Register address is not supported by a physical register; it is simply the I/O
address that, if written to, generates the FPGA Cache I/O write strobe. The CACHEIOWE signal
is a qualified version of the AVR IOWE signal. It will only be active if an OUT or ST (store to)
instruction references the FPGAD I/O address. The FPGAD I/O address is write-sensitive-only;
an I/O read to this location is ignored. If the AVR Cache Interface bit in the SCR [BIT62] is set
(one), the data being “written” to this address is cached to the FPGA address specified by the
FPGAX..Z registers (see below) during the active CACHEIOWE strobe.
Bit 7 6 5 4 3 2 1 0
$18 ($38) FCX7 FCX6 FCX5 FCX4 FCX3 FCX2 FCX1 FCX0 FPGAX
$19 ($39) FCY7 FCY6 FCY5 FCY4 FCY3 FCY2 FCY1 FCY0 FPGAY
$1A ($3A) FCT3 FCT2 FCT1 FCT0 FCZ3 FCZ2 FCZ1 FCZ0 FPGAZ
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
Initial Value 0 0 0 0 0 0 0 0
The three FPGA Cache address registers combine to form the 24-bit address, CAC-
HEADDR[23:0], delivered to the FPGA cache logic outside the AVR block during a write to the
FPGAD I/O Register (see above).
55
1138H–FPSLI–6/05
Table 4-4. FPGA I/O Select Line Scheme
FISCR Register FPGA I/O Select Lines
Read or Write
I/O Address XFIS1 XFIS0 15..12 11..8 7..4 3..0
0 0 0000 0000 0000 0001
0 1 0000 0000 0000 0010
FISUA $14 ($34)
1 0 0000 0000 0000 0100
1 1 0000 0000 0000 1000
0 0 0000 0000 0001 0000
0 1 0000 0000 0010 0000
FISUB $15 ($35)
1 0 0000 0000 0100 0000
1 1 0000 0000 1000 0000
0 0 0000 0001 0000 0000
0 1 0000 0010 0000 0000
FISUC $16 ($36)(1)
1 0 0000 0100 0000 0000
1 1 0000 1000 0000 0000
0 0 0001 0000 0000 0000
0 1 0010 0000 0000 0000
FISUD $17 ($37)(1)
1 0 0100 0000 0000 0000
1 1 1000 0000 0000 0000
Note: 1. Not available on AT94K05.
In summary, 16 select signals are sent to the FPGA for I/O addressing. These signals are
decoded from four base I/O Register addresses (FISUA..D) and extended to 16 with two bits
from the FPGA I/O Select Control Register, XFIS1 and XFIS0. The FPGA I/O read and write sig-
nals, FPGAIORE and FPGAIOWE, are qualified versions of the AVR IORE and IOWE signals.
Each will only be active if one of the four base I/O addresses is accessed.
Reset: all select lines become active and an FPGAIOWE strobe is enabled. This is to allow the
FPGA design to load zeros (8’h00) from the D-bus into appropriate registers.
;---------------------------------------------
io_select13_read:
ldi r16,0x01 ;FIADR=0,XFIS1=0,XFIS0=1 ->I/O select line=13
out FISCR,r16 ;load I/O select values into FISCR register
in r18,FISUD ;select line 13 high. Read data on AVR<->FPGA bus
;which was placed into register FISUD.
ret
57
1138H–FPSLI–6/05
Figure 4-10. Out Instruction – AVR Writing to the FPGA
AVR INST OUT INSTRUCTION
AVR CLOCK
AVR IOWE
AVR IOADR
(FISUA, B, C or D)
FPGA IOWE
FPGA I/O
SELECT "n"
FPGA CLOCK
(SET TO AVR
SYSTEM CLOCK) (1)
Note: 1. AVR expects Write to be captured by the FPGA upon posedge of the AVR clock.
(2)
AVR IORE
(2)
AVR IOADR
(FISUA, B, C or D)
FPGA IORE
FPGA I/O
SELECT "n"
Notes: 1. AVR captures read data upon posedge of the AVR clock.
2. At the end of an FPGA read cycle, there is a chance for the AVR data bus contention between
the FPGA and another peripheral to start to drive (active IORE at new address versus
FPGAIORE + Select “n”), but since the AVR clock would have already captured the data from
AVR DBUS (= FPGA Data Out), this is a “don’t care” situation.
59
1138H–FPSLI–6/05
• Bits 3..0 - FINT11 - 8: FPGA Interrupt Masks 11 - 8
See Bits 3..0 - FINT3 - 0: FPGA Interrupt Masks 3 - 0. Not available on the AT94K05.
61
1138H–FPSLI–6/05
The most typical program setup for the Reset and Interrupt Vector Addresses are:
Address Labels Code Comments
$0000 jmp RESET Reset Handle: Program Execution Starts Here
$0002 jmp FPGA_INT0 ; FPGA Interrupt0 Handle
$0004 jmp EXT_INT0 ; External Interrupt0 Handle
$0006 jmp FPGA_INT1 ; FPGA Interrupt1 Handle
$0008 jmp EXT_INT1 ; External Interrupt1 Handle
$000A jmp FPGA_INT2 ; FPGA Interrupt2 Handle
$000C jmp EXT_INT2 ; External Interrupt2 Handle
$000E jmp FPGA_INT3 ; FPGA Interrupt3 Handle
$0010 jmp EXT_INT3 ; External Interrupt3 Handle
$0012 jmp TIM2_COMP ; Timer/Counter2 Compare Match Interrupt Handle
$0014 jmp TIM2_OVF ; Timer/Counter2 Overflow Interrupt Handle
$0016 jmp TIM1_CAPT ; Timer/Counter1 Capture Event Interrupt Handle
$0018 jmp TIM1_COMPA ; Timer/Counter1 Compare Match A Interrupt Handle
$001A jmp TIM1_COMPB ; Timer/Counter1 Compare Match B Interrupt Handle
$001C jmp TIM1_OVF ; Timer/Counter1 Overflow Interrupt Handle
$001E jmp TIM0_COMP ; Timer/Counter0 Compare Match Interrupt Handle
$0020 jmp TIM0_OVF ; Timer/Counter0 Overflow Interrupt Handle
$0022 jmp FPGA_INT4 ; FPGA Interrupt4 Handle
$0024 jmp FPGA_INT5 ; FPGA Interrupt5 Handle
$0026 jmp FPGA_INT6 ; FPGA Interrupt6 Handle
$0028 jmp FPGA_INT7 ; FPGA Interrupt7 Handle
$002A jmp UART0_RXC ; UART0 Receive Complete Interrupt Handle
$002C jmp UART0_DRE ; UART0 Data Register Empty Interrupt Handle
$002E jmp UART0_TXC ; UART0 Transmit Complete Interrupt Handle
$0030 jmp FPGA_INT8 ; FPGA Interrupt8 Handle(1)
$0032 jmp FPGA_INT9 ; FPGA Interrupt9 Handle(1)
$0034 jmp FPGA_INT10 ; FPGA Interrupt10 Handle(1)
$0036 jmp FPGA_INT11 ; FPGA Interrupt11 Handle(1)
$0038 jmp UART1_RXC ; UART1 Receive Complete Interrupt Handle
$003A jmp UART1_DRE ; UART1 Data Register Empty Interrupt Handle
$003C jmp UART1_TXC ; UART1 Transmit Complete Interrupt Handle
$003E jmp FPGA_INT12 ; FPGA Interrupt12 Handle(1)
$0040 jmp FPGA_INT13 ; FPGA Interrupt13 Handle(1)
$0042 jmp FPGA_INT14 ; FPGA Interrupt14 Handle(1)
$0044 jmp FPGA_INT15 ; FPGA Interrupt15 Handle(1)
$0046 jmp TWS_INT ; 2-wire Serial Interrupt
;
RESET:
$0048 ldi r16,high(RAMEND) ; Main program start
$0049 out SPH,r16
$004A ldi r16,low(RAMEND)
$004B out SPL,r16
$004C <instr> xxx
... ... ...
Note: 1. Not Available on AT94K05. However, the vector jump table positions must be maintained for
appropriate UART and 2-wire serial interrupt jumps.
MCU STATUS
POR
EXTRF
WDRF
PORF
JT RF
FPGA
RESET/ CONFIG
LOGIC S Q INTERNAL
AVR RESET
COUNTER RESET
RESET
SFTCR
BIT 0
INTERNAL
OSCILLATOR
DELAY COUNTERS
SYSTEM
CLOCK
SEL [4:0] CONTROLLED
BY FPGA CONFIGURATION
63
1138H–FPSLI–6/05
Table 4-7. Reset Characteristics (VCC = 3.3V)
Symbol Parameter Minimum Typical Maximum Units
Power-on Reset Threshold
1.0 1.4 1.8 V
(Rising)
VPOT(1)
Power-on Reset Threshold
0.4 0.6 0.8 V
(Falling)
RESET Pin Threshold
VRST VCC/2 V
Voltage
CPU
5
cycles
TTOUT Reset Delay Time-out Period 0.4 0.5 0.6
3.2 4.0 4.8 ms
12.8 16.0 19.2
Note: 1. The Power-on Reset will not work unless the supply voltage has been below VPOT (falling).
VCC VPOT
RESET VRST
TIME-OUT tTOUT
INTERNAL RESET
VCC (HIGH)
RESET (HIGH)
1 XTAL CYCLE
WDT TIME-OUT
INTERNAL RESET
VCC VPOT
RESET VRST
TIME-OUT tTOUT
INTERNAL RESET
65
1138H–FPSLI–6/05
If an interrupt condition occurs when the corresponding interrupt enable bit is cleared (zero), the
interrupt flag will be set and remembered until the interrupt is enabled, or the flag is cleared by
software.
If one or more interrupt conditions occur when the global interrupt enable bit is cleared (zero),
the corresponding interrupt flag(s) will be set and remembered until the global interrupt enable
bit is set (one), and will be executed by order of priority.
The status register is not automatically stored when entering an interrupt routine and restored
when returning from an interrupt routine. This must be handled by software.
67
1138H–FPSLI–6/05
• Bit 6 - OCF1A: Output Compare Flag 1A
The OCF1A bit is set (one) when compare match occurs between the Timer/Counter1 and the
data in OCR1A – Output Compare Register 1A. OCF1A is cleared by the hardware when exe-
cuting the corresponding interrupt handling vector. Alternatively, OCF1A is cleared by writing a
logic 1 to the flag. When the I-bit in SREG, and OCIE1A (Timer/Counter1 Compare Interrupt
Enable), and the OCF1A are set (one), the Timer/Counter1 Compare A match Interrupt is
executed.
69
1138H–FPSLI–6/05
When waking up from Power-down mode, there is a delay from the wake-up condition occurs
until the wake-up becomes effective. This allows the clock to restart and become stable after
having been stopped. The wake-up period is defined by the same time-set bits that define the
reset time-out period. The wake-up period is equal to the clock reset period, as shown in
Figure 1 on page 93.
If the wake-up condition disappears before the MCU wakes up and starts to execute, the inter-
rupt causing the wake-up will not be executed.
4.18.1 Features
• JTAG (IEEE std. 1149.1 Compliant) Interface
• AVR I/O Boundary-scan Capabilities According to the JTAG Standard
• Debugger Access to:
– All Internal Peripheral Units
– AVR Program and Data SRAM
– The Internal Register File
– Program Counter/Instruction
– FPGA/AVR Interface
• Extensive On-chip Debug Support for Break Conditions, Including
– Break on Change of Program Memory Flow
– Single Step Break
– Program Memory Breakpoints on Single Address or Address Range
– Data Memory Breakpoints on Single Address or Address Range
– FPGA Hardware Break
– Frame Memory Breakpoint on Single Address
• On-chip Debugging Supported by AVR Studio version 4 or above
4.18.2 Overview
The AVR IEEE std. 1149.1 compliant JTAG interface is used for on-chip debugging.
The On-Chip Debug support is considered being private JTAG instructions, and distributed
within ATMEL and to selected third-party vendors only.
Figure 4-16 shows a block diagram of the JTAG interface and the On-Chip Debug system. The
TAP Controller is a state machine controlled by the TCK and TMS signals. The TAP Controller
selects either the JTAG Instruction Register or one of several Data Registers as the scan chain
(shift register) between the TDI - input and TDO - output. The Instruction Register holds JTAG
instructions controlling the behavior of a Data Register.
Of the Data Registers, the ID-Register, Bypass Register, and the AVR I/O Boundary-Scan Chain
are used for board-level testing. The Internal Scan Chain and Break-Point Scan Chain are used
for On-Chip debugging only.
71
1138H–FPSLI–6/05
When the JTAGEN bit is unprogrammed, these four TAP pins revert to normal operation. When
programmed, the input TAP signals are internally pulled High and the JTAG is enabled for
Boundary-Scan. System Designer sets this bit by default.
For the On-Chip Debug system, in addition the RESET pin is monitored by the debugger to be
able to detect external reset sources. The debugger can also pull the RESET pin Low to reset
the whole system, assuming only open collectors on reset line are used in the application.
DEVICE BOUNDARY
TDI
FPGA-SRAM
TDO TAP SCAN CHAIN
TCK CONTROLLER
TMS
AVR CPU
PROGRAM/DATA INTERNAL
SRAM SCAN PC
JTAG INSTRUCTION CHAIN Instruction
REGISTER
DEVICE ID
REGISTER BREAKPOINT
UNIT
M FLOW CONTROL
U BYPASS
UNIT
X REGISTER DIGITAL
M PERIPHERAL
U UNITS
BREAKPOINT X
SCAN CHAIN
OCD / AVR CORE
COMMUNICATION
ADDRESS INTERFACE
DECODER OCD STATUS
AND CONTROL
2-wire Serial
1 Test-Logic-Reset
0 1 1 1
Run-Test/Idle Select-DR Scan Select-IR Scan
0 0
1 1
Capture-DR Capture-IR
0 0
Shift-DR 0 Shift-IR 0
1 1
1 1
Exit1-DR Exit1-IR
0 0
Pause-DR 0 Pause-IR 0
1 1
0 0
Exit2-DR Exit2-IR
1 1
Update-DR Update-IR
1 0 1 0
73
1138H–FPSLI–6/05
4.18.3.1 TAP Controller
The TAP controller is a 16-state finite state machine that controls the operation of the Boundary-
Scan circuitry and On-Chip Debug system. The state transitions depicted in Figure 4-17 depend
on the signal present on TMS (shown adjacent to each state transition) at the time of the rising
edge at TCK. The initial state after a Power-On Reset is Test-Logic-Reset.
As a definition in this document, the LSB is shifted in and out first for all shift registers.
Assuming Run-Test/Idle is the present state, a typical scenario for using the JTAG interface is
• At the TMS input, apply the sequence 1, 1, 0, 0 at the rising edges of TCK to enter the Shift
Instruction Register - Shift-IR state. While TMS is Low, shift the 4 bit JTAG instructions into
the JTAG instruction register from the TDI input at the rising edge of TCK, while the captured
IR-state 0x01 is shifts out on the TDO pin. The JTAG Instruction selects a particular Data
Register as path between TDI and TDO and controls the circuitry surrounding the selected
Data Register.
• Apply the TMS sequence 1, 1, 0 to re-enter the Run-Test/Idle state. The instruction is latched
onto the parallel output from the shift register path in the Update-IR state. The Exit-IR, Pause-
IR, and Exit2-IR states are only used for navigating the state machine.
• At the TMS input, apply the sequence 1, 0, 0 at the rising edges of TCK to enter the Shift
Data Register - Shift-DR state. While TMS is Low, upload the selected Data Register
(selected by the present JTAG instruction in the JTAG Instruction Register) from the TDI input
at the rising edge of TCK. At the same time, the parallel inputs to the Data Register captured
in the Capture-DR state shifts out on the TDO pin.
• Apply the TMS sequence 1, 1, 0 to re-enter the Run-Test/Idle state. If the selected Data
Register has a latched parallel-output, the latching takes place in the Update-DR state. The
Exit-DR, Pause-DR, and Exit2-DR states are only used for navigating the state machine.
As shown in Figure 4-17 on page 73, the Run-Test/Idle(1) state need not be entered between
selecting JTAG instruction and using Data Registers, and some JTAG instructions may select
certain functions to be performed in the Run-Test/Idle, making it unsuitable as an Idle state.
Note: 1. Independent of the initial state of the TAP Controller, the Test-Logic-Reset state can always be
entered by holding TMS High for 5 TCK clock periods.
75
1138H–FPSLI–6/05
4.18.6 On-chip Debug Specific JTAG Instructions
The On-Chip debug support is considered being private JTAG instructions, and distributed
within ATMEL and to selected third-party vendors only. Table 4-8 lists the instruction opcode.
4.19.1 Features
• JTAG (IEEE std. 1149.1 compliant) Interface
• Boundary-scan Capabilities According to the JTAG Standard
• Full Scan of All Port Functions
• Supports the Optional IDCODE Instruction
• Additional Public AVR_RESET Instruction to Reset the AVR
77
1138H–FPSLI–6/05
4.21 Device Identification Register
Figure 4-18 shows the structure of the Device Identification register.
MSB LSB
Bit 31 28 27 12 11 1 0
Device ID Version Part Number Manufacturer ID 1
4 bits 16 bits 11 bits 1 bit
Version
Version is a 4-bit number identifying the revision of the component. The relevant version num-
bers are shown in Table 4-9.
Part Number
The part number is a 16 bit code identifying the component. The JTAG Part Number for AVR
devices is listed in Table 4-10.
Manufacturer ID
The manufacturer ID for ATMEL is 0x01F (11 bits).
ClockDR · AVR_RESET
4.22.2.1 EXTEST; $0
Mandatory JTAG instruction for selecting the Boundary-Scan Chain as Data Register for testing
circuitry external to the AVR package. For port-pins, Pull-up Disable, Output Control, Output
Data, and Input Data are all accessible in the scan chain. For Analog circuits having off-chip
connections, the interface between the analog and the digital logic is in the scan chain. The con-
tents of the latched outputs of the Boundary-Scan chain are driven out as soon as the JTAG IR-
register is loaded by the EXTEST instruction.
The active states are:
79
1138H–FPSLI–6/05
• Capture-DR: Data on the external pins are sampled into the Boundary-Scan Chain.
• Shift-DR: The Internal Scan Chain is shifted by the TCK input.
• Update-DR: Data from the scan chain is applied to output pins.
4.22.2.2 IDCODE; $1
Optional JTAG instruction selecting the 32-bit ID register as Data Register. The ID register con-
sists of a version number, a device number and the manufacturer code chosen by JEDEC. This
is the default instruction after power-up.
The active states are:
• Capture-DR: Data in the IDCODE register is sampled into the Boundary-Scan Chain.
• Shift-DR: The IDCODE scan chain is shifted by the TCK input.
4.22.2.3 SAMPLE_PRELOAD; $2
Mandatory JTAG instruction for pre-loading the output latches and taking a snap-shot of the
input/output pins without affecting the system operation. However, the output latches are not
connected to the pins. The Boundary-Scan Chain is selected as Data Register.
The active states are:
• Capture-DR: Data on the external pins are sampled into the Boundary-Scan Chain.
• Shift-DR: The Boundary-Scan Chain is shifted by the TCK input.
• Update-DR: Data from the Boundary-Scan chain is applied to the output latches. However,
the output latches are not connected to the pins.
4.22.2.4 AVR_RESET; $C
The AVR specific public JTAG instruction for forcing the AVR device into the Reset Mode or
releasing the JTAG reset source. The TAP controller is not reset by this instruction. The one bit
Reset Register is selected as Data Register. Note that the reset will be active as long as there is
a logic “1” in the Reset Chain. The output from this chain is not latched.
The active state is:
• Shift-DR: The Reset Register is shifted by the TCK input.
4.22.2.5 BYPASS; $F
Mandatory JTAG instruction selecting the Bypass Register for Data Register.
The active states are:
• Capture-DR: Loads a logic “0” into the Bypass Register.
• Shift-DR: The Bypass Register cell between TDI and TDO is shifted.
FF1 LD1 0
0
D Q D Q 1
1
G
81
1138H–FPSLI–6/05
Figure 4-21 shows a simple digital Port Pin as described in the section “I/O Ports” on page 158.
The Boundary-Scan details from Figure 4-20 replaces the dashed box in Figure 4-21.
RD
PLD
PULL-UP PUD
RESET
Q D
DDXn
C
WD
DATA BUS
OC
RESET
OD
PXn Q D
PORTXn
C
ID RL
WP
RP
From ClockDR
Previous
Cell
83
1138H–FPSLI–6/05
4.22.3.3 Scanning 2-wire Serial
The SCL and SDA pins are open drain, bi-directional and enabled separately. The “Enable Out-
put” bits (active High) in the scan chain are supported by general boundary-scan cells. Enabling
the output will drive the pin Low from a tri-state. External pull-ups on the 2-wire bus are required
to pull the pins High if the output is disabled. The “Data Out/In” and “Clock Out/In” bits in the
scan chain are observe-only cells. Figure 4-23 shows how each pin is connected in the scan
chain.
Figure 4-23. Boundary-scan Cells for 2-wire Serial
To 2-wire
Serial Logic
Data or Clock Out/In
(Observe Only Cell) SDA or
SCL
To Next Cell
To
next To
ShiftDR cell EXTEST Oscillator next
ShiftDR cell
From digital logic
0 To system logic
ENABLE OUTPUT
1
0 FF1
D Q D Q 0
1 D Q
G 1
85
1138H–FPSLI–6/05
Table 4-11. AVR I/O Boundary Scan – JTAG Instructions $0/$2 (Continued)
I/O Ports Description Bit
Data Out/In - PD7 44
Enable Output - PD7 43
Pull-up - PD7 42
Data Out/In - PD6 41
Enable Output - PD6 40
Pull-up - PD6 39
Data Out/In - PD5 38
Enable Output - PD5 37
Pull-up - PD5 36
Data Out/In - PD4 35
Enable Output - PD4 34
Pull-up - PD4 33
PORTD
Data Out/In - PD3 32
Enable Output - PD3 31
Pull-up - PD3 30
Data Out/In - PD2 29
Enable Output - PD2 28
Pull-up - PD2 27
Data Out/In - PD1 26
Enable Output - PD1 25
Pull-up - PD1 24
Data Out/In - PD0 23
Enable Output - PD0 22
Pull-up - PD0 21
Input with Pull-up - INTP3 20(1)
Input with Pull-up - INTP2 19(1)
EXT. INTERRUPTS
Input with Pull-up - INTP1 18(1)
Input with Pull-up - INTP0 17(1)
Data Out/In - TX1 16
Enable Output - TX1 15
UART1
Pull-up - TX1 14
Input with Pull-up - RX1 13(1)
Data Out/In - TX0 12
Enable Output - TX0 11
UART0
Pull-up - TX0 10
Input with Pull-up - RX0 9(1)
Clock In - XTAL1 8(1)
XTAL
Enable Clock - XTAL 1 7
87
1138H–FPSLI–6/05
Table 4-12. Bit EXTEST and SAMPLE_PRELOAD (Continued)
Bit Type EXTEST SAMPLE_PRELOAD
1 = clock disabled. Capture-DR Capture-DR grabs enable from
Enable Clock - TOSC 1
grabs clock enable from the AVR. the AVR.
Observe only. Capture-DR grabs Capture-DR grabs signal from
Data Out/In - SDA
signal from pad. pad.
1 = drive “0”
0 = drive disabled, bus pull-up Capture-DR grabs output enable
Enable Output - SDA
Capture-DR grabs output enable from the AVR.
scan latch.
Observe only. Capture-DR grabs Capture-DR grabs signal from
Clock Out/In - SCL
signal from pad. pad.
1 = drive “0”
0 = drive disabled, bus pull-up Capture-DR grabs output enable
Enable Output - SCL
Capture-DR grabs output enable from the AVR.
scan latch.
Internal, observe only.
Capture-DR grabs internal AVR
AVR Reset Capture-DR grabs internal AVR
reset signal.
reset signal.
Clear
PSR10
TCK1 TCK0
The clock source for Timer/Counter2 prescaler, see Figure 4-26, is named PCK2. PCK2 is by
default connected to the main system clock CK. By setting the AS2 bit in ASSR, Timer/Counter2
is asynchronously clocked from the TOSC1 pin. This enables use of Timer/Counter2 as a Real-
time Clock (RTC). When AS2 is set, pins TOSC1 and TOSC2 are disconnected from Port D. A
crystal can then be connected between the TOSC1 and TOSC2 pins to serve as an independent
clock source for Timer/Counter2. The oscillator is optimized for use with a 32.768 kHz crystal.
Alternatively, an external clock signal can be applied to TOSC1. The frequency of this clock
must be lower than one fourth of the CPU clock and not higher than 1 MHz. Setting the PSR2 bit
in SFIOR resets the prescaler. This allows the user to operate with a predictable prescaler.
89
1138H–FPSLI–6/05
Figure 4-26. Timer/Counter2 Prescaler
CK PCK2
10-BIT T/C PRESCALER
Clear
TOSC1
PCK2/8
PCK2/32
PCK2/64
PCK2/128
PCK2/256
PCK2/1024
AS2
PSR2 0
CS20
CS21
CS22
OCIE1A
OCIE1B
TICIE1
OCIE2
OCIE0
TOIE1
TOIE2
TOIE0
OCF0
TOV0
TIMER INT. MASK TIMER INT. FLAG T/C0 CONTROL SPECIAL FUNCTIONS
REGISTER (TIMSK) REGISTER (TIFR) REGISTER (TCCR0) IO REGISTER (SFIOR)
8-BIT DATA BUS
FOC0
PWM0
COM01
COM00
CTC0
CS02
CS01
CS00
PSR2
PSR10
TOV1
OCF1A
OCF1B
TOV2
ICF1
OCF2
TOV0
OCF0
7 0 T/C CLEAR
TIMER/COUNTER0 T/C CLK SOURCE CK
(TCNT0) CONTROL
UP/DOWN
LOGIC T0
7 0
8-BIT COMPARATOR
7 0
OUTPUT COMPARE
REGISTER0 (OCR0)
TICIE1
OCIE2
OCIE0
TOIE1
TOIE2
TOIE0
OCF2
TOV2
TIMER INT. MASK TIMER INT. FLAG T/C2 CONTROL SPECIAL FUNCTIONS
REGISTER (TIMSK) REGISTER (TIFR) REGISTER (TCCR2) IO REGISTER (SFIOR)
PSR2
PSR10
FOC2
PWM2
COM21
COM20
CTC2
CS22
CS21
CS20
TOV1
OCF1A
OCF1B
TOV2
ICF1
OCF2
TOV0
OCF0
7 0 T/C CLEAR
TIMER/COUNTER2 T/C CLK SOURCE CK
(TCNT2) CONTROL
UP/DOWN
LOGIC
TOSC1
7 0
8-BIT COMPARATOR
7 0
OUTPUT COMPARE ASYNCH. STATUS
REGISTER2 (OCR2) REGISTER (ASSR)
AS2
ICR2UB
OCR2UB
TC2UB
CK
SYNCH UNIT
TCK2
91
1138H–FPSLI–6/05
The 8-bit Timer/Counter0 can select the clock source from CK, prescaled CK, or an external pin.
The 8-bit Timer/Counter2 can select the clock source from CK, prescaled CK or external
TOSC1.
Both Timers/Counters can be stopped as described in section “Timer/Counter0 Control Register
– TCCR0” on page 92 and “Timer/Counter2 Control Register – TCCR2” on page 92.
The various status flags (overflow and compare match) are found in the Timer/Counter Interrupt
Flag Register (TIFR). Control signals are found in the Timer/Counter Control Register (TCCR0
and TCCR2). The interrupt enable/disable settings are found in the Timer/Counter Interrupt
Mask Register – TIMSK.
When Timer/Counter0 is externally clocked, the external signal is synchronized with the oscilla-
tor frequency of the CPU. To assure proper sampling of the external clock, the minimum time
between two external clock transitions must be at least one internal CPU clock period. The
external clock signal is sampled on the rising edge of the internal CPU clock.
The 8-bit Timer/Counters feature both a high-resolution and a high-accuracy usage with the
lower prescaling opportunities. Similarly, the high prescaling opportunities make the
Timer/Counter0 useful for lower speed functions or exact-timing functions with infrequent
actions.
Timer/Counters 0 and 2 can also be used as 8-bit Pulse Width Modulators (PWM). In this mode,
the Timer/Counter and the output compare register serve as a glitch-free, stand-alone PWM with
centered pulses. See “Timer/Counter 0 and 2 in PWM Mode” on page 95 for a detailed descrip-
tion on this function.
• Bits 5,4 - COM01, COM00/COM21, COM20: Compare Output Mode, Bits 1 and 0
The COMn1 and COMn0 control bits determine any output pin action following a compare match
in Timer/Counter0 or Timer/Counter2. Output pin actions affect pins PE1(OC0) or PE3(OC2).
This is an alternative function to an I/O port, and the corresponding direction control bit must be
set (one) to control an output pin. The control configuration is shown in Table 1.
Notes: 1. In PWM mode, these bits have a different function. Refer to Table 4-15 for a detailed
description.
2. n = 0 or 2
• Bits 2,1,0 - CS02, CS01, CS00/ CS22, CS21, CS20: Clock Select Bits 2,1 and 0
The Clock Select bits 2,1 and 0 define the prescaling source of Timer/Counter0 and
Timer/Counter2, see Table 4-13 and Table 4-14.
93
1138H–FPSLI–6/05
Table 4-13. Clock 0 Prescale Select
CS02 CS01 CS00 Description
0 0 0 Stop, the Timer/Counter0 is stopped
0 0 1 CK
0 1 0 CK/8
0 1 1 CK/64
1 0 0 CK/256
1 0 1 CK/1024
1 1 0 External pin PE0(T0), falling edge
1 1 1 External pin PE0(T0), rising edge
The Stop condition provides a Timer Enable/Disable function. The prescaled modes are scaled
directly from the CK oscillator clock for Timer/Counter0 and PCK2 for Timer/Counter2. If the
external pin modes are used for Timer/Counter0, transitions on PE0/(T0) will clock the counter
even if the pin is configured as an output. This feature can give the user SW control of the
counting.
Timer/Counter2 – TCNT2
Bit 7 6 5 4 3 2 1 0
$23 ($43) MSB LSB TCNT2
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
Initial Value 0 0 0 0 0 0 0 0
The output compare registers are 8-bit read/write registers. The Timer/Counter Output Compare
Registers contains the data to be continuously compared with the Timer/Counter. Actions on
compare matches are specified in TCCR0 and TCCR2. A compare match does only occur if the
Timer/Counter counts to the OCR value. A software write that sets Timer/Counter and Output
Compare Register to the same value does not generate a compare match.
A compare match will set the compare interrupt flag in the CPU clock-cycle following the com-
pare event.
95
1138H–FPSLI–6/05
Table 4-15. Compare Mode Select in PWM Mode
(1)
CTCn COMn1(1) COMn0(1) Effect on Compare Pin Frequency
(2) (2)
x 0 x Not connected –
Cleared on compare match, up-counting. Set
0 1 0 on compare match, down-counting (non- fTCK0/2/510
inverted PWM)
Cleared on compare match, down-counting.
0 1 1 Set on compare match, up-counting (inverted fTCK0/2/510
PWM)
Cleared on compare match,
1 1 0 fTCK0/2/256
set on overflow
1 1 1 Set on compare match, cleared on overflow fTCK0/2/256
Notes: 1. n = 0 or 2
2. x = don’ t care
In PWM mode, the value to be written to the Output Compare Register is first transferred to a
temporary location, and then latched into the OCR when the Timer/Counter reaches $FF. This
prevents the occurrence of odd-length PWM pulses (glitches) in the event of an unsynchronized
OCR0 or OCR2 write. See Figure 4-29 and Figure 4-30 for examples.
(1)
PWM Output OCn
(1)
Synchronized OCn Latch
Note: 1. n = 0 or 2
Note: 1. n = 0 or 2
During the time between the write and the latch operation, a read from the Output Compare
Registers will read the contents of the temporary location. This means that the most recently
written value always will read out of OCR0 and OCR2.
When the Output Compare Register contains $00 or $FF, and the up/down PWM mode is
selected, the output PE1(OC0/PWM0)/PE3(OC2/PWM2) is updated to Low or High on the next
compare match according to the settings of COMn1/COMn0. This is shown in Table 4-16. In
overflow PWM mode, the output PE1(OC0/PWM0)/PE3(OC2/PWM2) is held Low or High only
when the Output Compare Register contains $FF.
97
1138H–FPSLI–6/05
Table 4-16. PWM Outputs OCRn = $00 or $FF(1)
COMn1(2) COMn0(2) OCRn(2) Output PWMn(2)
1 0 $00 L
1 0 $FF H
1 1 $00 H
1 1 $FF L
Notes: 1. n overflow PWM mode, this table is only valid for OCRn = $FF
2. n = 0 or 2
In up/down PWM mode, the Timer Overflow Flag, TOV0 or TOV2, is set when the counter
advances from $00. In overflow PWM mode, the Timer Overflow Flag is set as in normal
Timer/Counter mode. Timer Overflow Interrupts 0 and 2 operate exactly as in normal
Timer/Counter mode, i.e. they are executed when TOV0 or TOV2 are set provided that Timer
Overflow Interrupt and global interrupts are enabled. This does also apply to the Timer Output
Compare flag and interrupt.
99
1138H–FPSLI–6/05
down, the user should be aware of the fact that this oscillator might take as long as one
second to stabilize. Therefore, the contents of all Timer2 registers must be considered lost
after a wake-up from power-down, due to the unstable clock signal. The user is advised to
wait for at least one second before using Timer/Counter2 after power-up or wake-up from
power-down.
• Description of wake-up from Power-save mode when the timer is clocked asynchronously.
When the interrupt condition is met, the wake-up process is started on the following cycle of
the timer clock, that is, the timer is always advanced by at least one before the processor can
read the counter value. The interrupt flags are updated three processor cycles after the
processor clock has started. During these cycles, the processor executes instructions, but
the interrupt condition is not readable, and the interrupt routine has not started yet.
• During asynchronous operation, the synchronization of the interrupt flags for the
asynchronous timer takes three processor cycles plus one timer cycle. The timer is therefore
advanced by at least one before the processor can read the timer value causing the setting of
the interrupt flag. The output compare pin is changed on the timer clock and is not
synchronized to the processor clock.
OCIE1A
OCIE1B
OCF1A
OCF1B
TICIE1
OCIE2
OCIE0
TOIE1
TOIE2
TOIE0
OCF2
OCF0
TOV1
TOV2
TOV0
ICF1
TIMER INT. MASK TIMER INT. FLAG T/C1 CONTROL T/C1 CONTROL SPECIAL FUNCTIONS
REGISTER (TIMSK) REGISTER (TIFR) REGISTER A (TCCR1A) REGISTER B (TCCR1B) IO REGISTER (SFIOR)
PSR2
PSR10
COM1A1
COM1A0
COM1B0
COM1B1
FOC1A
FOC1B
PWM11
PWM10
ICNC1
ICES1
CTC1
CS12
CS11
CS10
TOV1
OCF1A
OCF1B
TOV2
ICF1
OCF2
TOV0
OCF0
15 8 7 0
15 8 7 0 T/C CLEAR
T/C CLOCK SOURCE
TIMER/COUNTER1 (TCNT1)
UP/DOWN
15 8 7 0 15 8 7 0
15 8 7 0 15 8 7 0
The 16-bit Timer/Counter1 can select the clock source from CK, prescaled CK, or an external
pin. In addition it can be stopped as described in section “Timer/Counter1 Control Register B –
TCCR1B” on page 104. The different status flags (overflow, compare match and capture event)
are found in the Timer/Counter Interrupt Flag Register – TIFR. Control signals are found in the
Timer/Counter1 Control Registers – TCCR1A and TCCR1B. The interrupt enable/disable set-
tings for Timer/Counter1 are found in the Timer/Counter Interrupt Mask Register – TIMSK.
When Timer/Counter1 is externally clocked, the external signal is synchronized with the oscilla-
tor frequency of the CPU. To assure proper sampling of the external clock, the minimum time
between two external clock transitions must be at least one internal CPU clock period. The
external clock signal is sampled on the rising edge of the internal CPU clock.
The 16-bit Timer/Counter1 features both a high-resolution and a high-accuracy usage with the
lower prescaling opportunities. Similarly, the high-prescaling opportunities makes the
101
1138H–FPSLI–6/05
Timer/Counter1 useful for lower speed functions or exact-timing functions with infrequent
actions.
The Timer/Counter1 supports two Output Compare functions using the Output Compare Regis-
ter 1 A and B – OCR1A and OCR1B as the data sources to be compared to the Timer/Counter1
contents. The Output Compare functions include optional clearing of the counter on compareA
match, and actions on the Output Compare pins on both compare matches.
Timer/Counter1 can also be used as a 8-, 9- or 10-bit Pulse Width Modulator. In this mode, the
counter and the OCR1A/OCR1B registers serve as a dual-glitch-free stand-alone PWM with
centered pulses. Alternatively, the Timer/Counter1 can be configured to operate at twice the
speed in PWM mode, but without centered pulses. Refer to page 107 for a detailed description
on this function.
The Input Capture function of Timer/Counter1 provides a capture of the Timer/Counter1 con-
tents to the Input Capture Register – ICR1, triggered by an external event on the Input Capture
Pin – PE7(ICP). The actual capture event settings are defined by the Timer/Counter1 Control
Register – TCCR1B.
ICPE
If the noise canceler function is enabled, the actual trigger condition for the capture event is
monitored over four samples, and all four must be equal to activate the capture flag.
103
1138H–FPSLI–6/05
Timer/Counter1 Control Register B – TCCR1B
Bit 7 6 5 4 3 2 1 0
$2E ($4E) ICNC1 ICES1 ICPE - CTC1 CS12 CS11 CS10 TCCR1B
Read/Write R/W R/W R/W R R/W R/W R/W R/W
Initial Value 0 0 0 0 0 0 0 0
The Stop condition provides a Timer Enable/Disable function. The CK down-divided modes are
scaled directly from the CK oscillator clock. If the external pin modes are used for
Timer/Counter1, transitions on PE4/(T1) will clock the counter even if the pin is configured as an
output. This feature can give the user SW control of the counting.
This 16-bit register contains the prescaled value of the 16-bit Timer/Counter1. To ensure that
both the High and low bytes are read and written simultaneously when the CPU accesses these
registers, the access is performed using an 8-bit temporary register (TEMP). This temporary reg-
ister is also used when accessing OCR1A, OCR1B and ICR1. If the main program and also
interrupt routines perform access to registers using TEMP, interrupts must be disabled during
access from the main program and interrupt routines.
105
1138H–FPSLI–6/05
The Timer/Counter1 is realized as an up or up/down (in PWM mode) counter with read and write
access. If Timer/Counter1 is written to and a clock source is selected, the Timer/Counter1 con-
tinues counting in the timer clock-cycle after it is preset with the written value.
107
1138H–FPSLI–6/05
Table 4-20. Timer TOP Values and PWM Frequency
CTC1 PWM11 PWM10 PWM Resolution Timer TOP Value Frequency
0 0 1 8-bit $00FF (255) fTCK1/510
0 1 0 9-bit $01FF (511) fTCK1/1022
0 1 1 10-bit $03FF(1023) fTCK1/2046
1 0 1 8-bit $00FF (255) fTCK1/256
1 1 0 9-bit $01FF (511) fTCK1/512
1 1 1 10-bit $03FF(1023) fTCK1/1024
Notes: 1. X = A or B
2. x = Don’t care
In the PWM mode, the 8, 9 or 10 least significant OCR1A/OCR1B bits (depends of resolution),
when written, are transferred to a temporary location. They are latched when Timer/Counter1
reaches the value TOP. This prevents the occurrence of odd-length PWM pulses (glitches) in
the event of an unsynchronized OCR1A/OCR1B write. See Figure 4-33 and Figure 4-34 for an
example in each mode.
(1)
PWM OutputOC1X
(1)
Synchronized OCR1X Latch
(1)
PWM OutputOC1X
(1)
Unsynchronized OCR1X Latch Glitch
Note: 1. X = A or B
Note: 1. X = A or B
During the time between the write and the latch operation, a read from OCR1A or OCR1B will
read the contents of the temporary location. This means that the most recently written value
always will read out of OCR1A/B.
When the OCR1X contains $0000 or TOP, and the up/down PWM mode is selected, the output
OC1A/OC1B is updated to Low or High on the next compare match according to the settings of
COM1A1/COM1A0 or COM1B1/COM1B0. This is shown in Table 4-22. In overflow PWM mode,
the output OC1A/OC1B is held Low or High only when the Output Compare Register contains
TOP.
109
1138H–FPSLI–6/05
Table 4-22. PWM Outputs OCR1X = $0000 or TOP(1)
COM1X1(2) COM1X0(2) OCR1X(2) Output OC1X(2)
1 0 $0000 L
1 0 TOP H
1 1 $0000 H
1 1 TOP L
Notes: 1. In overflow PWM mode, this table is only valid for OCR1X = TOP.
2. X = A or B
In up/down PWM mode, the Timer Overflow Flag1, TOV1, is set when the counter advances
from $0000. In overflow PWM mode, the Timer Overflow flag is set as in normal Timer/Counter
mode. Timer Overflow Interrupt1 operates exactly as in normal Timer/Counter mode, i.e., it is
executed when TOV1 is set provided that Timer Overflow Interrupt1 and global interrupts are
enabled. This also applies to the Timer Output Compare1 flags and interrupts.
Bit 7 6 5 4 3 2 1 0
$21 ($41) - - - WDTOE WDE WDP2 WDP1 WDP0 WDTCR
Read/Write R R R R/W R/W R/W R/W R/W
Initial Value 0 0 0 0 0 0 0 0
Note: 1. The frequency of the watchdog oscillator is voltage dependent as shown in the Electrical Char-
acteristics section. The WDR (watchdog reset) instruction should always be executed before
the Watchdog Timer is enabled. This ensures that the reset period will be in accordance with
the Watchdog Timer prescale settings. If the Watchdog Timer is enabled without reset, the
Watchdog Timer may not start counting from zero.
111
1138H–FPSLI–6/05
4.28 Multiplier
The multiplier is capable of multiplying two 8-bit numbers, giving a 16-bit result using only two
clock cycles. The multiplier can handle both signed and unsigned integer and fractional numbers
without speed or code size penalty. Below are some examples of using the multiplier for 8-bit
arithmetic.
To be able to use the multiplier, six new instructions are added to the AVR instruction set. These
are:
• MUL, multiplication of unsigned integers
• MULS, multiplication of signed integers
• MULSU, multiplication of a signed integer with an unsigned integer
• FMUL, multiplication of unsigned fractional numbers
• FMULS, multiplication of signed fractional numbers
• FMULSU, multiplication of a signed fractional number and with an unsigned fractional
number
The MULSU and FMULSU instructions are included to improve the speed and code density for
multiplication of 16-bit operands. The second section will show examples of how to efficiently
use the multiplier for 16-bit arithmetic.
The component that makes a dedicated digital signal processor (DSP) specially suitable for sig-
nal processing is the multiply-accumulate (MAC) unit. This unit is functionally equivalent to a
multiplier directly connected to an arithmetic logic unit (ALU). The FPSLIC-based AVR Core is
designed to give FPSLIC the ability to effectively perform the same multiply-accumulate
operation.
The multiply-accumulate operation (sometimes referred to as multiply-add operation) has one
critical drawback. When adding multiple values to one result variable, even when adding positive
and negative values to some extent, cancel each other; the risk of the result variable to overrun
its limits becomes evident, i.e. if adding 1 to a signed byte variable that contains the value +127,
the result will be -128 instead of +128. One solution often used to solve this problem is to intro-
duce fractional numbers, i.e. numbers that are less than 1 and greater than or equal to -1. Some
issues regarding the use of fractional numbers are discussed.
A list of all implementations with key performance specifications is given in Table 4-24.
113
1138H–FPSLI–6/05
4.28.1.1 Example 1 – Basic Usage
The first example shows an assembly code that reads the port B input value and multiplies this
value with a constant (5) before storing the result in register pair R17:R16.
AH AL X BH BL
(sign ext) AL * BL
(sign
+ ext) AL * BH
(sign
+ ext) AH * BL
+ AH * BH
= CH CMH CML CL
115
1138H–FPSLI–6/05
4.28.3 16-bit x 16-bit = 16-bit Operation
This operation is valid for both unsigned and signed numbers, even though only the unsigned
multiply instruction (MUL) is needed, see Figure 4-38. A mathematical explanation is given:
When A and B are positive numbers, or at least one of them is zero, the algorithm is clearly cor-
rect, provided that the product C = A • B is less than 2 16 if the product is to be used as an
unsigned number, or less than 215 if the product is to be used as a signed number.
When both factors are negative, the two’s complement notation is used:
A = 216 - |A| and B = 216 - |B|:
C = A • B = (216 - |A|) • (216 - |B|) = |A • B| + 232 - 216 • (|A| + |B|)
Here we are only concerned with the 16 LSBs; the last part of this sum will be discarded and we
will get the (correct) result C = |A • B|.
AH AL X BH BL
AL * BL 1
+ AL * BH 2
+ AH * BL 3
= CH CL
When one factor is negative and one factor is positive, for example, A is negative and B is
positive:
The MSBs will be discarded and the correct two’s complement notation result will be
C = 216 - |A • B|.
The product must be in the range 0 ≤ C ≤ 216 - 1 if unsigned numbers are used, and in the range
-215 ≤ C ≤ 215 - 1 if signed numbers are used.
When doing integer multiplication in C language, this is how it is done. The algorithm can be
expanded to do 32-bit multiplication with 32-bit result.
ldi R23,HIGH(672)
ldi R22,LOW(672) ; Load the number 672 into r23:r22
ldi R21,HIGH(1844)
ldi R20,LOW(1844); Load the number 1844 into r21:r20
callmul16x16_32 ; Call 16bits x 16bits = 32bits
; multiply routine
AH AL X BH BL
(sign
ext) AL * BH 3
(sign
+ ext) AH * BL 4
+ AH * BH AL * BL 1+2
= CH CMH CML CL
The 32-bit result of the unsigned multiplication of 672 and 1844 will now be in the registers
R19:R18:R17:R16. If “muls16x16_32” is called instead of “mul16x16_32”, a signed multiplication
will be executed. If “mul16x16_16” is called, the result will only be 16 bits long and will be stored
in the register pair R17:R16. In this example, the 16-bit result will not be correct.
117
1138H–FPSLI–6/05
4.28.5 16-bit Multiply-accumulate Operation
AH AL X BH BL
(sign ext) AL * BL
(sign
+ ext) AL * BH
(sign
+ ext) AH * BL
+ AH * BH
Using the FMUL, FMULS and FMULSU instructions should not be more complex than the MUL,
MULS and MULSU instructions. However, one potential problem is to assign fractional variables
right values in a simple way. The fraction 0.75 (= 0.5 + 0.25) will, for example, be “0110 0000” if
8 bits are used.
To convert a positive fractional number in the range [0, 2> (for example 1.8125) to the format
used in the AVR, the following algorithm, illustrated by an example, should be used:
Is there a “1” in the number?
Yes, 1.8125 is higher than or equal to 1.
Byte is now “1xxx xxxx”
Is there a “0.5” in the rest?
0.8125 / 0.5 = 1.625
Yes, 1.625 is higher than or equal to 1.
Byte is now “11xx xxxx”
Is there a “0.25” in the rest?
0.625 / 0.5 = 1.25
Yes, 1.25 is higher than or equal to 1.
Byte is now “111x xxxx”
Is there a “0.125” in the rest?
0.25 / 0.5 = 0.5
No, 0.5 is lower than 1.
Byte is now “1110 xxxx”
Is there a “0.0625” in the rest?
0.5 / 0.5 = 1
Yes, 1 is higher than or equal to 1.
Byte is now “1110 1xxx”
119
1138H–FPSLI–6/05
Since we do not have a rest, the remaining three bits will be zero, and the final result is “1110
1000”, which is 1 + 0.5 + 0.25 + 0.0625 = 1.8125.
To convert a negative fractional number, first add 2 to the number and then use the same algo-
rithm as already shown.
16-bit fractional numbers use a format similar to that of 8-bit fractional numbers; the high 8 bits
have the same format as the 8-bit format. The low 8 bits are only an increase of accuracy of the
8-bit format; while the 8-bit format has an accuracy of ± 2-8, the16-bit format has an accuracy of
± 2-16. Then again, the 32-bit fractional numbers are an increase of accuracy to the
16-bit fractional numbers. Note the important difference between integers and fractional num-
bers when extra byte(s) are used to store the number: while the accuracy of the numbers is
increased when fractional numbers are used, the range of numbers that may be represented is
extended when integers are used.
As mentioned earlier, using signed fractional numbers in the range [-1, 1> has one main advan-
tage to integers: when multiplying two numbers in the range [-1, 1>, the result will be in the
range [-1, 1], and an approximation (the highest byte(s)) of the result may be stored in the same
number of bytes as the factors, with one exception: when both factors are -1, the product should
be 1, but since the number 1 cannot be represented using this number format, the FMULS
instruction will instead place the number -1 in R1:R0. The user should therefore assure that at
least one of the operands is not -1 when using the FMULS instruction. The
16-bit x 16-bit fractional multiply also has this restriction.
4.28.6.1 Example 5 – Basic Usage 8-bit x 8-bit = 16-bit Signed Fractional Multiply
This example shows an assembly code that reads the port E input value and multiplies this
value with a fractional constant (-0.625) before storing the result in register pair R17:R16.
4.28.7 Implementations
4.28.7.1 mul16x16_16
Description
Multiply of two 16-bit numbers with a 16-bit result.
Usage
R17:R16 = R23:R22 • R21:R20
Statistics
Cycles: 9 + ret
Words: 6 + ret
Register usage: R0, R1 and R16 to R23 (8 registers)(1)
Note: 1. Full orthogonality, i.e., any register pair can be used as long as the result and the two oper-
ands do not share register pairs. The routine is non-destructive to the operands.
mul16x16_16:
mul r22, r20 ; al * bl
movw r17:r16, r1:r0
mul r23, r20 ; ah * bl
add r17, r0
mul r21, r22 ; bh * al
add r17, r0
ret
121
1138H–FPSLI–6/05
4.28.7.2 mul16x16_32
Description
Unsigned multiply of two 16-bit numbers with a 32-bit result.
Usage
R19:R18:R17:R16 = R23:R22 • R21:R20
Statistics
Cycles: 17 + ret
Words: 13 + ret
Register usage: R0 to R2 and R16 to R23 (11 registers)(1)
Note: 1. Full orthogonality, i.e., any register pair can be used as long as the result and the two oper-
ands do not share register pairs. The routine is non-destructive to the operands.
mul16x16_32:
clr r2
mul r23, r21 ; ah * bh
movw r19:r18, r1:r0
mul r22, r20 ; al * bl
movw r17:r16, r1:r0
mul r23, r20 ; ah * bl
add r17, r0
adc r18, r1
adc r19, r2
mul r21, r22 ; bh * al
add r17, r0
adc r18, r1
adc r19, r2
ret
123
1138H–FPSLI–6/05
4.28.7.4 mac16x16_32
Description
Signed multiply-accumulate of two 16-bit numbers with a 32-bit result.
Usage
R19:R18:R17:R16 += R23:R22 • R21:R20
Statistics
Cycles: 23 + ret
Words: 19 + ret
Register usage: R0 to R2 and R16 to R23 (11 registers)
mac16x16_32: ; Register Usage Optimized
clr r2
ret
add r16, r0
adc r17, r1
adc r18, r4
adc r19, r5
ret
125
1138H–FPSLI–6/05
4.28.7.5 fmuls16x16_32
Description
Signed fractional multiply of two 16-bit numbers with a 32-bit result.
Usage
R19:R18:R17:R16 = (R23:R22 • R21:R20) << 1
Statistics
Cycles: 20 + ret
Words: 16 + ret
Register usage: R0 to R2 and R16 to R23 (11 registers)(1)
Note: 1. The routine is non-destructive to the operands.
fmuls16x16_32:
clr r2
fmuls r23, r21 ; ( (signed)ah * (signed)bh ) << 1
movw r19:r18, r1:r0
fmul r22, r20 ; ( al * bl ) << 1
adc r18, r2
movw r17:r16, r1:r0
fmulsu r23, r20 ; ( (signed)ah * bl ) << 1
sbc r19, r2 ; Sign extend
add r17, r0
adc r18, r1
adc r19, r2
fmulsu r21, r22 ; ( (signed)bh * al ) << 1
sbc r19, r2 ; Sign extend
add r17, r0
adc r18, r1
adc r19, r2
ret
ret
127
1138H–FPSLI–6/05
fmuls r23, r21 ; ( (signed)ah * (signed)bh ) << 1
movw r5:r4,r1:r0
fmul r22, r20 ; ( al * bl ) << 1
adc r4, r2
add r16, r0
adc r17, r1
adc r18, r4
adc r19, r5
fmulsu r23, r20 ; ( (signed)ah * bl ) << 1
sbc r19, r2
add r17, r0
adc r18, r1
adc r19, r2
fmulsu r21, r22 ; ( (signed)bh * al ) << 1
sbc r19, r2
add r17, r0
adc r18, r1
adc r19, r2
ret
STORE UDRn
SHIFT ENABLE
PIN CONTROL
LOGIC
BAUD 10(11)-BIT TX TXDn PE0/
CONTROL LOGIC SHIFT REGISTER PE2
IDLE
MPCMPn
UDREn
RXENn
CHR9n
TXENn
RXCn
RXB8n
TXCn
TXB8n
U2Xn
ORn
FEn
TXCn
UDREn
DATA BUS
TXCn UDREn
IRQ IRQ
Note: 1. n = 0, 1
129
1138H–FPSLI–6/05
Data transmission is initiated by writing the data to be transmitted to the UART I/O Data Regis-
ter, UDRn. Data is transferred from UDRn to the Transmit shift register when:
• A new character has been written to UDRn after the stop bit from the previous character has
been shifted out. The shift register is loaded immediately.
• A new character has been written to UDRn before the stop bit from the previous character
has been shifted out. The shift register is loaded when the stop bit of the character currently
being transmitted has been shifted out.
If the 10(11)-bit Transmitter shift register is empty, data is transferred from UDRn to the shift reg-
ister. At this time the UDREn (UART Data Register Empty) bit in the UART Control and Status
Register, UCSRnA, is set. When this bit is set (one), the UART is ready to receive the next char-
acter. At the same time as the data is transferred from UDRn to the 10(11)-bit shift register, bit 0
of the shift register is cleared (start bit) and bit 9 or 10 is set (stop bit). If a 9-bit data word is
selected (the CHR9n bit in the UART Control and Status Register, UCSRnB is set), the TXB8 bit
in UCSRnB is transferred to bit 9 in the Transmit shift register.
On the Baud-rate clock following the transfer operation to the shift register, the start bit is shifted
out on the TXDn pin. Then follows the data, LSB first. When the stop bit has been shifted out,
the shift register is loaded if any new data has been written to the UDRn during the transmission.
During loading, UDREn is set. If there is no new data in the UDRn register to send when the stop
bit is shifted out, the UDREn flag will remain set until UDRn is written again. When no new data
has been written, and the stop bit has been present on TXDn for one bit length, the TX Complete
flag, TXCn, in UCSRnA is set.
The TXENn bit in UCSRnB enables the UART transmitter when set (one). When this bit is
cleared (zero), the PE0 (UART0) or PE2 (UART1) pin can be used for general I/O. When TXENn
is set, the UART Transmitter will be connected to PE0 (UART0) or PE2 (UART1), which is
forced to be an output pin regardless of the setting of the DDE0 bit in DDRE (UART0) or DDE2
in DDRE (UART1).
MPCMPn
UDREn
RXENn
CHR9n
TXENn
RXB8n
TXB8n
RXCn
TXCn
U2Xn
ORn
FEn
UART CONTROL AND UART CONTROL AND
STATUS REGISTER STATUS REGISTER
(UCSRnB) (UCSRnA)
RXCIEn
TXCIEn
UDRIEn
RXCn
DATA BUS
RXCn
IRQ
Note: 1. n = 0, 1
The receiver front-end logic samples the signal on the RXDn pin at a frequency 16 times the
baud-rate. While the line is idle, one single sample of logic 0 will be interpreted as the falling
edge of a start bit, and the start bit detection sequence is initiated. Let sample 1 denote the first
zero-sample. Following the 1-to-0 transition, the receiver samples the RXDn pin at samples 8, 9
and 10. If two or more of these three samples are found to be logic 1s, the start bit is rejected as
a noise spike and the receiver starts looking for the next 1-to-0 transition.
131
1138H–FPSLI–6/05
If however, a valid start bit is detected, sampling of the data bits following the start bit is per-
formed. These bits are also sampled at samples 8, 9 and 10. The logical value found in at least
two of the three samples is taken as the bit value. All bits are shifted into the transmitter shift reg-
ister as they are sampled. Sampling of an incoming character is shown in Figure 4-43. Note that
the description above is not valid when the UART transmission speed is doubled. See “Double
Speed Transmission” on page 138 for a detailed description.
Note: 1. This figure is not valid when the UART speed is doubled. See “Double Speed Transmis-
sion” on page 138 for a detailed description.
When the stop bit enters the receiver, the majority of the three samples must be one to accept
the stop bit. If two or more samples are logic 0s, the Framing Error (FEn) flag in the UART Con-
trol and Status Register (UCSRnA) is set. Before reading the UDRn register, the user should
always check the FEn bit to detect Framing Errors.
Whether or not a valid stop bit is detected at the end of a character reception cycle, the data is
transferred to UDRn and the RXCn flag in UCSRnA is set. UDRn is in fact two physically sepa-
rate registers, one for transmitted data and one for received data. When UDRn is read, the
Receive Data register is accessed, and when UDRn is written, the Transmit Data register is
accessed. If the 9-bit data word is selected (the CHR9n bit in the UART Control and Status Reg-
ister, UCSRnB is set), the RXB8n bit in UCSRnB is loaded with bit 9 in the Transmit shift register
when data is transferred to UDRn.
If, after having received a character, the UDRn register has not been read since the last receive,
the OverRun (ORn) flag in UCSRnB is set. This means that the last data byte shifted into to the
shift register could not be transferred to UDRn and has been lost. The ORn bit is buffered, and is
updated when the valid data byte in UDRn is read. Thus, the user should always check the ORn
bit after reading the UDRn register in order to detect any overruns if the baud-rate is High or
CPU load is High.
When the RXEN bit in the UCSRnB register is cleared (zero), the receiver is disabled. This
means that the PE1 (n=0) or PE3 (n=1) pin can be used as a general I/O pin. When RXENn is
set, the UART Receiver will be connected to PE1 (UART0) or PE3 (UART1), which is forced to
be an input pin regardless of the setting of the DDE1 in DDRE (UART0) or DDB2 bit in DDRB
(UART1). When PE1 (UART0) or PE3 (UART1) is forced to input by the UART, the PORTE1
(UART0) or PORTE3 (UART1) bit can still be used to control the pull-up resistor on the pin.
When the CHR9n bit in the UCSRnB register is set, transmitted and received characters are 9
bits long plus start and stop bits. The 9th data bit to be transmitted is the TXB8n bit in UCSRnB
register. This bit must be set to the wanted value before a transmission is initiated by writing to
the UDRn register. The 9th data bit received is the RXB8n bit in the UCSRnB register.
The UDRn register is actually two physically separate registers sharing the same I/O address.
When writing to the register, the UART Transmit Data register is written. When reading from
UDRn, the UART Receive Data register is read.
133
1138H–FPSLI–6/05
UART0 Control and Status Registers – UCSR0A
Bit 7 6 5 4 3 2 1 0
$0B ($2B) RXC0 TXC0 UDRE0 FE0 OR0 - U2X0 MPCM0 UCSR0A
Read/Write R R/W R R R R R/W R/W
Initial Value 0 0 1 0 0 0 0 0
135
1138H–FPSLI–6/05
• Bit 3 - TXEN0/TXEN1: Transmitter Enable
This bit enables the UART transmitter when set (one). When disabling the transmitter while
transmitting a character, the transmitter is not disabled before the character in the shift register
plus any following character in UDRn has been completely transmitted.
• BAUD = Baud-rate
• fCK = Crystal Clock Frequency
• UBR = Contents of the UBRRHI and UBRRn Registers, (0 - 4095)
Note: 1. This equation is not valid when the UART transmission speed is doubled. See “Double Speed
Transmission” on page 138 for a detailed description.
For standard crystal frequencies, the most commonly used baud-rates can be generated by
using the UBR settings in Table 2. UBR values which yield an actual baud-rate differing less
than 2% from the target baud-rate, are bold in the table. However, using baud-rates that have
more than 1% error is not recommended. High error ratings give less noise resistance.
Clock UBRRHI UBR Actual Desired % Clock UBRRHI UBR Actual Desired %
MHz 7:4 or 3:0 UBRRn HEX UBR Freq Freq. Error MHz 7:4 or 3:0 UBRRn HEX UBR Freq Freq. Error
9.216 0000 11101111 0EF 239 2400 2400 0.0 18.432 0001 11011111 1DF 479 2400 2400 0.0
0000 01110111 077 119 4800 4800 0.0 0000 11101111 0EF 239 4800 4800 0.0
0000 00111011 03B 59 9600 9600 0.0 0000 01110111 077 119 9600 9600 0.0
0000 00100111 027 39 14400 14400 0.0 0000 01001111 04F 79 14400 14400 0.0
0000 00011101 01D 29 19200 19200 0.0 0000 00111011 03B 59 19200 19200 0.0
0000 00010011 013 19 28800 28880 0.3 0000 00100111 027 39 28800 28880 0.3
0000 00001110 00E 14 38400 38400 0.0 0000 00011101 01D 29 38400 38400 0.0
0000 00001001 009 9 57600 57600 0.0 0000 00010011 013 19 57600 57600 0.0
0000 00000111 007 7 72000 76800 6.7 0000 00001110 00E 14 76800 76800 0.0
0000 00000100 004 4 115200 115200 0.0 0000 00001001 009 9 115200 115200 0.0
0000 00000001 001 1 288000 230400 20.0 0000 00000100 004 4 230400 230400 0.0
0000 00000000 000 0 576000 460800 20.0 0000 00000001 001 1 576000 460800 20.0
0000 00000000 000 0 576000 912600 58.4 0000 00000000 000 0 1152000 912600 20.8
Clock UBRRHI UBR Actual Desired % Clock UBRRHI UBR Actual Desired %
MHz 7:4 or 3:0 UBRRn HEX UBR Freq Freq. Error MHz 7:4 or 3:0 UBRRn HEX UBR Freq Freq. Error
25.576 0010 10011001 299 665 2400 2400 0.0 40 0100 00010001 411 1041 2399 2400 0.0
0001 01001100 14C 332 4800 4800 0.0 0010 00001000 208 520 4798 4800 0.0
0000 10100110 0A6 166 9572 9600 0.3 0001 00000011 103 259 9615 9600 0.2
0000 01101110 06E 110 14401 14400 0.0 0000 10101100 0AC 172 14451 14400 0.4
0000 01010010 052 82 19259 19200 0.3 0000 10000001 081 129 19231 19200 0.2
0000 00110110 036 54 29064 28880 0.6 0000 01010110 056 86 28736 28880 0.5
0000 00101001 029 41 38060 38400 0.9 0000 01000000 040 64 38462 38400 0.2
0000 00011011 01B 27 57089 57600 0.9 0000 00101010 02A 42 58140 57600 0.9
0000 00010100 014 20 76119 76800 0.9 0000 00100000 020 32 75758 76800 1.4
0000 00001101 00D 13 114179 115200 0.9 0000 00010101 015 21 113636 115200 1.4
0000 00000110 006 6 228357 230400 0.9 0000 00001010 00A 10 227273 230400 1.4
0000 00000011 003 3 399625 460800 15.3 0000 00000100 004 4 500000 460800 7.8
0000 00000001 001 1 799250 912600 14.2 0000 00000010 002 2 833333 912600 9.5
The UART baud register is a 12-bit register. The 4 most significant bits are located in a separate
register, UBRRHI. Note that both UART0 and UART1 share this register. Bit 7 to bit 4 of
UBRRHI contain the 4 most significant bits of the UART1 baud register. Bit 3 to bit 0 contain the
4 most significant bits of the UART0 baud register.
137
1138H–FPSLI–6/05
UART0 Baud-rate Register Low Byte – UBRR0
Bit 7 6 5 4 3 2 1 0
$09 ($29) MSB LSB UBRR0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
Initial Value 0 0 0 0 0 0 0 0
UBRRn stores the 8 least significant bits of the UART baud-rate register.
Figure 4-44. Sampling Received Data when the Transmission Speed is Doubled
RXD
START BIT D0 D1 D2 D3 D4 D5 D6 D7 STOP BIT
RECEIVER
SAMPLING
• BAUD = Baud-rate
• fCK= Crystal Clock Frequency
• UBR = Contents of the UBRRHI and UBRRn Registers, (0 - 4095)
Note: 1. This equation is only valid when the UART transmission speed is doubled.
For standard crystal frequencies, the most commonly used baud-rates can be generated by
using the UBR settings in Table 2. UBR values which yield an actual baud-rate differing less
than 1.5% from the target baud-rate, are bold in the table. However since the number of samples
Clock UBRRHI UBR Actual Desired % Clock UBRRHI UBR Actual Desired %
MHz 7:4 or 3:0 UBRRn HEX UBR Freq Freq. Error MHz 7:4 or 3:0 UBRRn HEX UBR Freq Freq. Error
1 0000 00110011 033 51 2404 2400 0.2 1.843 0000 01011111 05F 95 2400 2400 0.0
0000 00011001 019 25 4808 4800 0.2 0000 00101111 02F 47 4800 4800 0.0
0000 00001100 00C 12 9615 9600 0.2 0000 00010111 017 23 9600 9600 0.0
0000 00001000 008 8 13889 14400 3.7 0000 00001111 00F 15 14400 14400 0.0
0000 00000110 006 6 17857 19200 7.5 0000 00001011 00B 11 19200 19200 0.0
0000 00000011 003 3 31250 28880 7.6 0000 00000111 007 7 28800 28880 0.3
0000 00000010 002 2 41667 38400 7.8 0000 00000101 005 5 38400 38400 0.0
0000 00000001 001 1 62500 57600 7.8 0000 00000011 003 3 57600 57600 0.0
0000 00000001 001 1 62500 76800 22.9 0000 00000010 002 2 76800 76800 0.0
0000 00000000 000 0 125000 115200 7.8 0000 00000001 001 1 115200 115200 0.0
Clock UBRRHI UBR Actual Desired % Clock UBRRHI UBR Actual Desired %
MHz 7:4 or 3:0 UBRRn HEX UBR Freq Freq. Error MHz 7:4 or 3:0 UBRRn HEX UBR Freq Freq. Error
9.216 0001 11011111 1DF 479 2400 2400 0.0 18.43 0011 10111111 3BF 959 2400 2400 0.0
0000 11101111 0EF 239 4800 4800 0.0 0001 11011111 1DF 479 4800 4800 0.0
0000 01110111 077 119 9600 9600 0.0 0000 11101111 0EF 239 9600 9600 0.0
0000 01001111 04F 79 14400 14400 0.0 0000 10011111 09F 159 14400 14400 0.0
0000 00111011 03B 59 19200 19200 0.0 0000 01110111 077 119 19200 19200 0.0
0000 00100111 027 39 28800 28880 0.3 0000 01001111 04F 79 28800 28880 0.3
0000 00011101 01D 29 38400 38400 0.0 0000 00111011 03B 59 38400 38400 0.0
0000 00010011 013 19 57600 57600 0.0 0000 00100111 027 39 57600 57600 0.0
0000 00001110 00E 14 76800 76800 0.0 0000 00011101 01D 29 76800 76800 0.0
0000 00001001 009 9 115200 115200 0.0 0000 00010011 013 19 115200 115200 0.0
0000 00000100 004 4 230400 230400 0.0 0000 00001001 009 9 230400 230400 0.0
0000 00000010 002 2 384000 460800 20.0 0000 00000100 004 4 460800 460800 0.0
0000 00000000 000 0 1152000 912600 20.8 0000 00000010 002 2 768000 912600 18.8
Clock UBRRHI UBR Actual Desired % Clock UBRRHI UBR Actual Desired %
MHz 7:4 or 3:0 UBRRn HEX UBR Freq Freq. Error MHz 7:4 or 3:0 UBRRn HEX UBR Freq Freq. Error
25.576 0101 00110011 533 1331 2400 2400 0.0 40 1000 00100010 822 2082 2400 2400 0.0
0010 10011001 299 665 4800 4800 0.0 0100 00010001 411 1041 4798 4800 0.0
0001 01001110 14E 334 9543 9600 0.6 0010 00001000 208 520 9597 9600 0.0
0000 11011101 0DD 221 14401 14400 0.0 0001 01011010 15A 346 14409 14400 0.1
0000 10100110 0A6 166 19144 19200 0.3 0001 00000011 103 259 19231 19200 0.2
0000 01101110 06E 110 28802 28880 0.3 0000 10101100 0AC 172 28902 28880 0.1
0000 01010010 052 82 38518 38400 0.3 0000 10000001 081 129 38462 38400 0.2
0000 00110111 037 55 57089 57600 0.9 0000 01010110 056 86 57471 57600 0.2
0000 00101001 029 41 76119 76800 0.9 0000 01000000 040 64 76923 76800 0.2
0000 00011011 01B 27 114179 115200 0.9 0000 00101010 02A 42 116279 115200 0.9
0000 00001101 00D 13 228357 230400 0.9 0000 00010101 015 21 227273 230400 1.4
0000 00000110 006 6 456714 460800 0.9 0000 00001010 00A 10 454545 460800 1.4
0000 00000011 003 3 799250 912600 14.2 0000 00000100 004 4 1000000 912600 8.7
139
1138H–FPSLI–6/05
4.30 2-wire Serial Interface (Byte Oriented)
The 2-wire Serial Bus is a bi-directional two-wire serial communication standard. It is designed
primarily for simple but efficient integrated circuit (IC) control. The system is comprised of two
lines, SCL (Serial Clock) and SDA (Serial Data) that carry information between the ICs con-
nected to them. Various communication configurations can be designed using this bus.
Figure 4-45 shows a typical 2-wire Serial Bus configuration. Any device connected to the bus
can be Master or Slave.
VCC
SCL
SDA
The 2-wire Serial Interface provides a serial interface that meets the 2-wire Serial Bus specifica-
tion and supports Master/Slave and Transmitter/Receiver operation at up to 400 kHz bus clock
rate. The 2-wire Serial Interface has hardware support for the 7-bit addressing, but is easily
extended to 10-bit addressing format in software. When operating in 2-wire Serial mode, i.e.,
when TWEN is set, a glitch filter is enabled for the input signals from the pins SCL and SDA, and
the output from these pins are slew-rate controlled. The 2-wire Serial Interface is byte oriented.
The operation of the serial 2-wire Serial Bus is shown as a pulse diagram in Figure 4-46, includ-
ing the START and STOP conditions and generation of ACK signal by the bus receiver.
SCL 1 2 7 8 9 1 2 8 9
START ACK ACK
CONDITION REPEATED START CONDITION
The block diagram of the 2-wire Serial Bus interface is shown in Figure 4-47.
ADDRESS REGISTER
AND
COMPARATOR
TWAR
STATE MACHINE
STATUS
AND
REGISTER
STATUS DECODER
TWSR
The CPU interfaces with the 2-wire Serial Interface via the following five I/O registers: the 2-wire
Serial Bit-rate Register (TWBR), the 2-wire Serial Control Register (TWCR), the 2-wire Serial
Status Register (TWSR), the 2-wire Serial Data Register (TWDR), and the 2-wire Serial Address
Register (TWAR, used in Slave mode).
141
1138H–FPSLI–6/05
• Bits 7..0 - 2-wire Serial Bit-rate Register
TWBR selects the division factor for the bit-rate generator. The bit-rate generator is a frequency
divider which generates the SCL clock frequency in the Master modes according to the following
equation:
f CK
Bit-rate = -------------------------------------
-
16 + 2(TWBR)
143
1138H–FPSLI–6/05
The 2-wire Serial Data Register – TWDR
Bit 7 6 5 4 3 2 1 0
$1F ($3F) MSB LSB TWDR
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
Initial Value 1 1 1 1 1 1 1 1
TWEN must be set to enable the 2-wire Serial Interface, TWSTA and TWSTO must be cleared.
The Master Transmitter mode may now be entered by setting the TWSTA bit. The 2-wire Serial
Logic will now test the 2-wire Serial Bus and generate a START condition as soon as the bus
becomes free. When a START condition is transmitted, the 2-wire Serial Interrupt flag (TWINT)
is set by the hardware, and the status code in TWSR will be $08. TWDR must then be loaded
with the Slave address and the data direction bit (SLA+W). The TWINT flag must then be
145
1138H–FPSLI–6/05
cleared by software before the 2-wire Serial Transfer can continue. The TWINT flag is cleared by
writing a logic 1 to the flag.
When the Slave address and the direction bit have been transmitted and an acknowledgment bit
has been received, TWINT is set again and a number of status codes in TWSR are possible.
Status codes $18, $20, or $38 apply to Master mode, and status codes $68, $78, or $B0 apply to
Slave mode. The appropriate action to be taken for each of these status codes is detailed in
Table 4-29. The data must be loaded when TWINT is High only. If not, the access will be dis-
carded, and the Write Collision bit, TWWC, will be set in the TWCR register. This scheme is
repeated until a STOP condition is transmitted by writing a logic 1 to the TWSTO bit in the
TWCR register.
After a repeated START condition (state $10) the 2-wire Serial Interface may switch to the Mas-
ter Receiver mode by loading TWDR with SLA+R.
The upper 7 bits are the address to which the 2-wire Serial Interface will respond when
addressed by a Master. If the LSB is set, the 2-wire Serial Interface will respond to the general
call address ($00), otherwise it will ignore the general call address.
147
1138H–FPSLI–6/05
4.30.1.5 Miscellaneous States
There are two status codes that do not correspond to a defined 2-wire Serial Interface state: Sta-
tus $F8 and Status $00, see Table 4-33.
Status $F8 indicates that no relevant information is available because the 2-wire Serial Interrupt
flag (TWINT) is not set yet. This occurs between other states, and when the 2-wire Serial Inter-
face is not involved in a serial transfer.
Status $00 indicates that a bus error has occurred during a 2-wire serial transfer. A bus error
occurs when a START or STOP condition occurs at an illegal position in the format frame.
Examples of such illegal positions are during the serial transfer of an address byte, a data byte
or an acknowledge bit. When a bus error occurs, TWINT is set. To recover from a bus error, the
TWSTO flag must set and TWINT must be cleared by writing a logic 1 to it. This causes the 2-
wire Serial Interface to enter the not addressed Slave mode and to clear the TWSTO flag (no
other bits in TWCR are affected). The SDA and SCL lines are released and no STOP condition
is transmitted.
149
1138H–FPSLI–6/05
Figure 4-48. Formats and States in the Master Transmitter Mode
MT
Successfull
transmission S SLA W A DATA A P
to a slave
receiver
Next transfer
started with a S SLA W
repeated start
condition
$10
Not acknowledge R
received after the A P
slave address
$20
MR
Not acknowledge
received after a data A P
byte
$30
$38 $38
To corresponding
$68 $78 $B0 states in slave mode
No TWDR action or 0 0 1 0 Data byte will be received and NOT ACK will
SLA+R has been be returned
$40 transmitted;
Data byte will be received and ACK will be
ACK has been received No TWDR action 0 0 1 1
returned
Read data byte or 0 0 1 0 Data byte will be received and NOT ACK will
Data byte has been be returned
$50 received;
Data byte will be received and ACK will be
ACK has been returned Read data byte 0 0 1 1
returned
151
1138H–FPSLI–6/05
Figure 4-49. Formats and States in the Master Receiver Mode
MR
Successfull
reception S SLA R A DATA A DATA A P
from a slave
receiver
Next transfer
started with a S SLA R
repeated start
condition
$10
Not acknowledge W
received after the A P
slave address
$48
MT
Arbitration lost in slave Other master Other master
address or data byte A or A continues A continues
$38 $38
To corresponding
$68 $78 $B0 states in slave mode
153
1138H–FPSLI–6/05
Table 4-31. Status Codes for Slave Receiver Mode (Continued)
Application Software Response
Status Status of the 2-wire To TWCR
Code Serial Bus and 2-wire Next Action Taken by 2-wire
(TWSR) Serial Hardware To/From TWDR STA STO TWINT TWEA Serial Hardware
$88
$68
$98
$78
155
1138H–FPSLI–6/05
Table 4-32. Status Codes for Slave Transmitter Mode
Application Software Response
Status Status of the 2-wire
To TWCR
Code Serial Bus and 2-wire Next Action Taken by 2-wire
(TWSR) Serial Hardware To/From TWDR STA STO TWINT TWEA Serial Hardware
Last data byte will be transmitted and NOT
Own SLA+R has been Load data byte or X 0 1 0
ACK should be received
$A8 received;
Data byte will be transmitted and ACK should
ACK has been returned Load data byte X 0 1 1
be received
Arbitration lost in
Last data byte will be transmitted and NOT
SLA+R/W as Master; Load data byte or X 0 1 0
ACK should be received
$B0 own SLA+R has been
received; Data byte will be transmitted and ACK should
Load data byte X 0 1 1
be received
ACK has been returned
$B0
$C8
No relevant state
$F8 information available; No TWDR action No TWCR action Wait or proceed current transfer
TWINT = “0”
157
1138H–FPSLI–6/05
4.31 I/O Ports
All AVR ports have true read-modify-write functionality when used as general I/O ports. This
means that the direction of one port pin can be changed without unintentionally changing the
direction of any other pin with the SBI and CBI instructions. The same applies for changing drive
value (if configured as output) or enabling/disabling of pull-up resistors (if configured as input).
4.31.1 PortD
PortD is an 8-bit bi-directional I/O port with internal pull-up resistors.
Three I/O memory address locations are allocated for the PortD, one each for the Data Register
– PORTD, $12($32), Data Direction Register – DDRD, $11($31) and the Port D Input Pins –
PIND, $10($30). The Port D Input Pins address is read only, while the Data Register and the
Data Direction Register are read/write.
The PortD output buffers can sink 20 mA. As inputs, PortD pins that are externally pulled Low
will source current if the pull-up resistors are activated.
The PortD Input Pins address – PIND – is not a register, and this address enables access to the
physical value on each PortD pin. When reading PORTD, the PortD Data Latch is read, and
when reading PIND, the logical values present on the pins are read.
MOS
PULLUP
DL
RESET
RD
RESET
R
Q D
DDD*
DL
GTS
WD
DATA BUS
RL
RESET
PD*
R
Q D
PORTD*
WL
4.31.2 PortE
PortE is an 8-bit bi-directional I/O port with internal pull-up resistors.
Three I/O memory address locations are allocated for the PortE, one each for the Data Register
– PORTE, $07($27), Data Direction Register – DDRE, $06($26) and the PortE Input Pins –
PINE, $05($25). The PortE Input Pins address is read only, while the Data Register and the
Data Direction Register are read/write.
The PortE output buffers can sink 20 mA. As inputs, PortE pins that are externally pulled Low
will source current if the pull-up resistors are activated.
All PortE pins have alternate functions as shown in Table 4-35.
159
1138H–FPSLI–6/05
Table 4-35. PortE Pins Alternate Functions Controlled by SCR and AVR I/O Registers
Port Pin Alternate Function Input Output
TX0
PE0 External Timer0 clock -
(UART0 transmit pin)
RX0 Output compare
PE1 -
(UART0 receive pin) Timer0/PWM0
TX1
PE2 - -
(UART1 transmit pin)
RX1 Output compare
PE3 -
(UART1 receive pin) Timer2/PWM2
INT0
PE4 External Timer1 clock -
(external Interrupt0 input)
INT1 Output compare
PE5 -
(external Interrupt0 input) Timer1B/PWM1B
INT2 Output compare
PE6 -
(external Interrupt0 input) Timer1A/PWM1A
INT3
PE7 Input capture Counter1
(external Interrupt0 input)
When the pins are used for the alternate function the DDRE and PORTE register has to be set
according to the alternate function description.
The PortE Input Pins address – PINE – is not a register, and this address enables access to the
physical value on each PortE pin. When reading PORTE, the PortE Data Latch is read, and
when reading PINE, the logical values present on the pins are read.
• PortE, Bit 0
UART0 Transmit Pin.
• PortE, Bit 1
UART0 Receive Pin. Receive Data (Data input pin for the UART0). When the UART0 receiver is
enabled this pin is configured as an input regardless of the value of DDRE0. When the UART0
forces this pin to be an input, a logic 1 in PORTE0 will turn on the internal pull-up.
• PortE, Bit 2
UART1 Transmit Pin. The alternate functions of Port E as UART0 pins are enabled by setting bit
SCR52 in the FPSLIC System Control Register. This is necessary only in smaller pinout pack-
ages where the UART signals are not bonded out. The alternate functions of Port E as UART1
pins are enabled by setting bit SCR53 in the FPSLIC System Control Register.
• PortE, Bit 3
UART1 Receive Pin. Receive Data (Data input pin for the UART1). When the UART1 receiver is
enabled this pin is configured as an input regardless of the value of DDRE2. When the UART1
forces this pin to be an input, a logic 1 in PORTE2 will turn on the internal pull-up.
161
1138H–FPSLI–6/05
immediately tri-state. This function happens only if the Check pin has been enabled in the sys-
tem control register. The use of the Check pin will NOT disable the use of that pin as an input to
PE7 nor as an input as alternate INT3.
MOS
PULL-UP
DL
RESET
RD
RESET
R
Q D
DDE0
DL
GTS
WD
TX0ENABLE
SCR(52)
DATA BUS
RL
0 TX0D
RESET
PE0
1 R
Q D
PORTE0
WL
RP
MOS
PULL-UP
DL
RESET
RD
RESET
R
Q D
DDE1
DL
WD
GTS
DATA BUS
SCR(52)
RL
0
RESET
PE1
OC0/PMW0 R
1
Q D
PORTE1
COM00
COM01
WL
RP
RX0
163
1138H–FPSLI–6/05
Figure 4-55. PortE Schematic Diagram (Pin PE2)
MOS
PULL-UP
DL
RESET
RD
RESET
R
Q D
DDE2
DL
GTS
WD
TX1ENABLE
SCR(53)
DATA BUS
RL
0 TX1D
RESET
PE2
1 R
Q D
PORTE2
WL
RP
TX1ENABLE
MOS
SCR(53)
PULL-UP
GTS: Global Tri-State
DL
DL: Configuration Download
RESET
WL: Write PORTE
WD: Write DDRE
DL RL: Read PORTE Latch
MOS
PULL-UP
DL
RESET
RD
RESET
R
Q D
DDE3
DL
WD
GTS
DATA BUS
SCR(53)
RL
0
RESET
PE3
OC2/PMW2 R
1
Q D
PORTE3
COM20
COM21
WL
RP
SCR(53)
165
1138H–FPSLI–6/05
Figure 4-57. PortE Schematic Diagram (Pin PE4)
MOS
PULL-UP
DL
RESET
RD
RESET
R
Q D
DDE4
DL
WD
GTS
DATA BUS
SCR(48)
RL
RESET
PE4
R
Q D
PORTE4
WL
RP
T1
SCR(48)
MOS
PULL-UP
DL
RESET
RD
RESET
R
Q D
DDE5
DL
WD
GTS
DATA BUS
SCR(49)
RL
0
RESET
PE5
OC1B R
1
Q D
PORTE5
COM1B0
COM1B1
WL
RP
GTS: Global Tri-State
DL: Configuration Download
WL: Write PORTE
SCR(49) WD: Write DDRE
RL: Read PORTE Latch
MOS RD: Read DDRE
PULL-UP RP: Read PORTE Pin
0 extintp1: External Interrupt 1
extintp1 SCR: System Control Register
OC1B: Timer/Counter1 Output Compare B
1 COM1B*: Timer/Counter1 B Control Bits
INTP1
167
1138H–FPSLI–6/05
Figure 4-59. PortE Schematic Diagram (Pin PE6)
MOS
PULL-UP
DL
RESET
RD
RESET
R
Q D
DDE6
DL
WD
GTS
SCR(50)
DATA BUS
RL
0
RESET
PE6
OC1A R
1
Q D
PORTE6
COM1A0
COM1A1
WL
RP
MOS
PULL-UP
DL
RESET
RD
RESET
R
Q D
DDE7
DL
WD
GTS
DATA BUS
SCR(51)
RL
RESET
PE7
R
Q D
PORTE7
WL
RP
ICP
SCR(51)
169
1138H–FPSLI–6/05
5. AC & DC Timing Characteristics
171
1138H–FPSLI–6/05
6. Power-On Power Supply Requirements
Atmel FPGAs require a minimum rated power supply current capacity to insure proper initializa-
tion, and the power supply ramp-up time does affect the current required. A fast ramp-up time
requires more current than a slow ramp-up time.
Notes: 1. This specification applies to Commercial and Industrial grade products only.
2. Devices are guaranteed to initialize properly at 50% of the minimum current listed above. A
larger capacity power supply may result in a larger initialization current.
3. Ramp-up time is measured from 0 V DC to 3.6 V DC. Peak current required lasts less than 2
ms, and occurs near the internal power on reset threshold voltage.
t ACC
DATA READ Previous Data Output Valid
WE
t WDS t WDH
t WDS t WDH
DATA WRITE Data Valid
173
1138H–FPSLI–6/05
6.1.1 Frame Interface
The FPGA Frame Clock phase is selectable (see “System Control Register – FPGA/AVR” on
page 30). This document refers to the clock at the FPGA/Dual-port SRAM interface as ME (the
relation of ME to data, address and write enable does not change). By default, FrameClock is
inverted (ME = ~FrameClock). Selecting the non-inverted phase assigns ME = FrameClock.
Recall, the Dual-port SRAM operates in single-edge clock controlled mode during read opera-
tions, and double-edge clock controlled mode during writes. Addresses are clocked internally on
the rising edge of the clock signal (ME). Any change of address without a rising edge of ME is
not considered.
175
1138H–FPSLI–6/05
6.2 External Clock Drive Waveforms
VIH1
VIL1
177
1138H–FPSLI–6/05
6.4 AC Timing Characteristics – 3.3V Operation
Delays are based on fixed loads and are described in the notes.
Maximum times based on worst case: VCC = 3.0V, temperature = 70°C
Minimum times based on best case: VCC = 3.6V, temperature = 0°C
Maximum delays are the average of tPDLH and tPDHL.
All input IO characteristics measured from a VIH of 50% of VDD at the pad (CMOS threshold) to the internal VIH of 50% of VDD. All
output IO characteristics are measured as the average of tPDLH and tPDHL to the pad VIH of 50% of VDD.
Cell Function Parameter Path -25 Units Notes
Repeaters
Repeater tPD (Maximum) L -> E 2.2 ns 1 Unit Load
Repeater tPD (Maximum) E -> E 2.2 ns 1 Unit Load
Repeater tPD (Maximum) L -> L 2.2 ns 1 Unit Load
Repeater tPD (Maximum) E -> L 2.2 ns 1 Unit Load
Repeater tPD (Maximum) E -> IO 1.4 ns 1 Unit Load
Repeater tPD (Maximum) L -> IO 1.4 ns 1 Unit Load
All input IO characteristics measured from a VIH of 50% of VDD at the pad (CMOS threshold) to the internal VIH of 50% of
VDD. All output IO characteristics are measured as the average of tPDLH and tPDHL to the pad VIH of 50% of VDD.
Cell Function Parameter Path -25 Units Notes
IO
Input tPD (Maximum) pad -> x/y 1.9 ns No Extra Delay
Input tPD (Maximum) pad -> x/y 5.8 ns 1 Extra Delay
Input tPD (Maximum) pad -> x/y 11.5 ns 2 Extra Delays
Input tPD (Maximum) pad -> x/y 17.4 ns 3 Extra Delays
Output, Slow tPD (Maximum) x/y/E/L -> pad 9.1 ns 50 pf Load
Output, Medium tPD (Maximum) x/y/E/L -> pad 7.6 ns 50 pf Load
Output, Fast tPD (Maximum) x/y/E/L -> pad 6.2 ns 50 pf Load
Output, Slow tPZX (Maximum) oe -> pad 9.5 ns 50 pf Load
Output, Slow tPXZ (Maximum) oe -> pad 2.1 ns 50 pf Load
Output, Medium tPZX (Maximum) oe -> pad 7.4 ns 50 pf Load
Output, Medium tPXZ (Maximum) oe -> pad 2.7 ns 50 pf Load
Output, Fast tPZX (Maximum) oe -> pad 5.9 ns 50 pf Load
Output, Fast tPXZ (Maximum) oe -> pad 2.4 ns 50 pf Load
179
1138H–FPSLI–6/05
6.6 AC Timing Characteristics – 3.3V Operation
Delays are based on fixed loads and are described in the notes.
Maximum times based on worst case: VCC = 3.0V, temperature = 70°C
Minimum times based on best case: VCC = 3.6V, temperature = 0°C
Cell Function Parameter Path -25 Units Notes
Async RAM
Write tWECYC (Minimum) cycle time 12.0 ns –
Write tWEL (Minimum) we 5.0 ns Pulse Width Low
Write tWEH (Minimum) we 5.0 ns Pulse Width High
Write tsetup (Minimum) wr addr setup-> we 5.3 ns
Write thold (Minimum) wr addr hold -> we 0.0 ns –
Write tsetup (Minimum) din setup -> we 5.0 ns
Write thold (Minimum) din hold -> we 0.0 ns –
Write thold (Minimum) oe hold -> we 0.0 ns
Write/Read tPD (Maximum) din -> dout 8.7 ns rd addr = wr addr
Read tPD (Maximum) rd addr -> dout 6.3 ns
Read tPZX (Maximum) oe -> dout 2.9 ns –
Read tPXZ (Maximum) oe -> dout 3.5 ns
Sync RAM
Write tCYC (Minimum) cycle time 12.0 ns
Write tCLKL (Minimum) clk 5.0 ns –
Write tCLKH (Minimum) clk 5.0 ns Pulse Width High
Write tsetup (Minimum) we setup-> clk 3.2 ns
Write thold (Minimum) we hold -> clk 0.0 ns –
Write tsetup (Minimum) wr addr setup-> clk 5.0 ns
Write thold (Minimum) wr addr hold -> clk 0.0 ns –
Write tsetup (Minimum) wr data setup-> clk 3.9 ns
Write thold (Minimum) wr data hold -> clk 0.0 ns –
Write/Read tPD (Maximum) din -> dout 8.7 ns rd addr = wr addr
Write/Read tPD (Maximum) clk -> dout 5.8 ns rd addr = wr addr
Read tPD (Maximum) rd addr -> dout 6.3 ns
Read tPZX (Maximum) oe -> dout 2.9 ns –
Read tPXZ (Maximum) oe -> dout 3.5 ns
CMOS buffer delays are measured from a VIH of 1/2 VCC at the pad to the internal VIH at A. The input buffer load is con-
stant. Buffer delay is to a pad voltage of 1.5V with one output switching. Parameter based on characterization and
simulation; not tested in production. An FPGA power calculation is available in Atmel’s System Designer software (see also
page 171).
West Side
GND
I/O7
I/O8
Notes: 1. VCC is I/O high voltage. Please refer to the “Designing in Split Power Supply Support for
AT94KAL and AT94SAL Devices” application note.
2. VDD is core high voltage. Please refer to the “Designing in Split Power Supply Support
for AT94KAL and AT94SAL Devices” application note.
3. Unbonded pins are No Connects.
181
1138H–FPSLI–6/05
Table 7-3. AT94K Pin List (Continued)
Packages
AT94K05 AT94K10 AT94K40
96 FPGA I/O 192 FPGA I/O 384 FPGA I/O PC84 TQ100 PQ144 PQ208
I/O9
I/O10
I/O11
I/O12
VCC(1)
GND
I/O13
I/O14
I/O7 I/O7 I/O15 10
I/O9 I/O17 12
I/O10 I/O18 13
GND
I/O19
I/O20
I/O11 I/O21
I/O12 I/O22
I/O23
I/O24
I/O17 I/O29
I/O18 I/O30
GND
I/O31
I/O32
I/O33
I/O34
I/O35
Notes: 1. VCC is I/O high voltage. Please refer to the “Designing in Split Power Supply Support for
AT94KAL and AT94SAL Devices” application note.
2. VDD is core high voltage. Please refer to the “Designing in Split Power Supply Support
for AT94KAL and AT94SAL Devices” application note.
3. Unbonded pins are No Connects.
I/O36
GND
VCC(1)
I/O37
I/O38
I/O39
I/O40
I/O19 I/O41 19
I/O20 I/O42 20
GND
I/O45
I/O46
I/O51
I/O52
I/O29 I/O55 31
I/O30 I/O56 32
I/O57
I/O58
I/O59
I/O60
VCC(1)
GND
Notes: 1. VCC is I/O high voltage. Please refer to the “Designing in Split Power Supply Support for
AT94KAL and AT94SAL Devices” application note.
2. VDD is core high voltage. Please refer to the “Designing in Split Power Supply Support
for AT94KAL and AT94SAL Devices” application note.
3. Unbonded pins are No Connects.
183
1138H–FPSLI–6/05
Table 7-3. AT94K Pin List (Continued)
Packages
AT94K05 AT94K10 AT94K40
96 FPGA I/O 192 FPGA I/O 384 FPGA I/O PC84 TQ100 PQ144 PQ208
I/O61
I/O62
I/O63
I/O64
I/O65
I/O66
GND
I/O31 I/O67
I/O32 I/O68
VDD(2) VDD(2)
I/O74
I/O37 I/O75
I/O38 I/O76
I/O77
I/O78
GND
I/O79
I/O80
I/O39 I/O81 38
I/O40 I/O82 39
GND
VCC(1)
I/O85
I/O86
I/O87
Notes: 1. VCC is I/O high voltage. Please refer to the “Designing in Split Power Supply Support for
AT94KAL and AT94SAL Devices” application note.
2. VDD is core high voltage. Please refer to the “Designing in Split Power Supply Support
for AT94KAL and AT94SAL Devices” application note.
3. Unbonded pins are No Connects.
I/O88
GND
I/O91
I/O92
M0 M0 M0 32 24 36 50
South Side
(1) (1) (1)
VCC VCC VCC 33 25 37 55
M2 M2 M2 34 26 38 56
I/O37 I/O53
I/O101 29 43 61
Not a User I/O Not a User I/O
I/O38 I/O54 I/O102
37 30 44 62
(LDC/TDO) (LDC/TDO) (LDC/TDO)
GND
I/O103
I/O104
I/O105
I/O106
I/O107
I/O108
VCC(1)
GND
Notes: 1. VCC is I/O high voltage. Please refer to the “Designing in Split Power Supply Support for
AT94KAL and AT94SAL Devices” application note.
2. VDD is core high voltage. Please refer to the “Designing in Split Power Supply Support
for AT94KAL and AT94SAL Devices” application note.
3. Unbonded pins are No Connects.
185
1138H–FPSLI–6/05
Table 7-3. AT94K Pin List (Continued)
Packages
AT94K05 AT94K10 AT94K40
96 FPGA I/O 192 FPGA I/O 384 FPGA I/O PC84 TQ100 PQ144 PQ208
I/O58 I/O112 66
I/O113
I/O114
GND
I/O115
I/O116
I/O59 I/O117
I/O60 I/O118
I/O119
I/O120
I/O65 I/O125 72
I/O66 I/O126 73
GND
I/O127
I/O128
I/O129
I/O130
I/O131
I/O132
GND
VCC(1)
I/O133
I/O134
I/O67 I/O135
Notes: 1. VCC is I/O high voltage. Please refer to the “Designing in Split Power Supply Support for
AT94KAL and AT94SAL Devices” application note.
2. VDD is core high voltage. Please refer to the “Designing in Split Power Supply Support
for AT94KAL and AT94SAL Devices” application note.
3. Unbonded pins are No Connects.
I/O68 I/O136
GND
I/O139
I/O140
I/O141
I/O142
I/O47 (TD7) I/O71 (TD7) I/O143 (TD7) 40 35 52 76
I/O147
I/O148
I/O149
I/O150
GND
I/O78 I/O154 85
I/O155
I/O156
VCC(1)
GND
I/O157
I/O158
I/O159
I/O160
I/O161
I/O162
Notes: 1. VCC is I/O high voltage. Please refer to the “Designing in Split Power Supply Support for
AT94KAL and AT94SAL Devices” application note.
2. VDD is core high voltage. Please refer to the “Designing in Split Power Supply Support
for AT94KAL and AT94SAL Devices” application note.
3. Unbonded pins are No Connects.
187
1138H–FPSLI–6/05
Table 7-3. AT94K Pin List (Continued)
Packages
AT94K05 AT94K10 AT94K40
96 FPGA I/O 192 FPGA I/O 384 FPGA I/O PC84 TQ100 PQ144 PQ208
GND
I/O79 I/O163
I/O80 I/O164
VCC(1) VCC(1)
I/O169
I/O170
I/O85 I/O171
I/O86 I/O172
I/O173
I/O174
GND
I/O175
I/O176
I/O87 I/O177 91
I/O88 I/O178 92
GND
VCC(1)
I/O181
I/O182
I/O185
I/O186
GND
I/O187
I/O188
Notes: 1. VCC is I/O high voltage. Please refer to the “Designing in Split Power Supply Support for
AT94KAL and AT94SAL Devices” application note.
2. VDD is core high voltage. Please refer to the “Designing in Split Power Supply Support
for AT94KAL and AT94SAL Devices” application note.
3. Unbonded pins are No Connects.
East Side
GND
VCC(1)
GND
VCC(1) VCC(1)
GND
GND
VCC(1)
189
1138H–FPSLI–6/05
Table 7-3. AT94K Pin List (Continued)
Packages
AT94K05 AT94K10 AT94K40
96 FPGA I/O 192 FPGA I/O 384 FPGA I/O PC84 TQ100 PQ144 PQ208
GND
VCC(1)
GND
GND
GND
GND
VCC(1)
TOSC1 TOSC1 TOSC1 69 70 101 147
GND
RX1 RX1 RX1 103 149
D0 D0 D0 71 72 105 151
INTP3 (CSOUT) INTP3 (CSOUT) INTP3 (CSOUT) 72 73 106 152
I/O293
I/O294
GND
I/O295
I/O296
I/O101 (CS1, I/O149 (CS1, I/O297 (CS1,
79 80 115 165
A2) A2) A2)
I/O300
VCC(1)
GND
I/O306
GND
I/O307
I/O308
I/O311
Notes: 1. VCC is I/O high voltage. Please refer to the “Designing in Split Power Supply Support for
AT94KAL and AT94SAL Devices” application note.
2. VDD is core high voltage. Please refer to the “Designing in Split Power Supply Support
for AT94KAL and AT94SAL Devices” application note.
3. Unbonded pins are No Connects.
191
1138H–FPSLI–6/05
Table 7-3. AT94K Pin List (Continued)
Packages
AT94K05 AT94K10 AT94K40
96 FPGA I/O 192 FPGA I/O 384 FPGA I/O PC84 TQ100 PQ144 PQ208
I/O312
I/O159 I/O315
I/O160 I/O316
VCC(1) VCC(1)
I/O317
I/O318
GND
I/O319
I/O320
I/O321
I/O322
I/O323
I/O324
GND
VCC(1)
I/O107 (A4) I/O161 (A4) I/O325 (A4) 81 82 121 174
GND
I/O163 I/O327 176
GND
I/O331
I/O332
I/O333
I/O334
I/O111 (A6) I/O167 (A6) I/O335 (A6) 83 86 125 180
I/O339
I/O340
I/O341
I/O342
GND
I/O115 I/O171 I/O343 92 131 186
VCC(1)
GND
I/O349
I/O350
I/O351
I/O352
I/O353
I/O354
GND
I/O355
I/O356
VDD(2) VDD(2)
I/O177 I/O357
I/O178 I/O358
I/O361
I/O362
Notes: 1. VCC is I/O high voltage. Please refer to the “Designing in Split Power Supply Support for
AT94KAL and AT94SAL Devices” application note.
2. VDD is core high voltage. Please refer to the “Designing in Split Power Supply Support
for AT94KAL and AT94SAL Devices” application note.
3. Unbonded pins are No Connects.
193
1138H–FPSLI–6/05
Table 7-3. AT94K Pin List (Continued)
Packages
AT94K05 AT94K10 AT94K40
96 FPGA I/O 192 FPGA I/O 384 FPGA I/O PC84 TQ100 PQ144 PQ208
I/O366
GND
I/O367
I/O368
VCC(1)
I/O373
I/O374
I/O375
I/O376
I/O377
I/O378
GND
I/O187 I/O379
I/O188 I/O380
8. Ordering Information
Usable Gates Speed Grade Ordering Code Package Operation Range
AT94K05AL-25AJC 84J
AT94K05AL-25AQC 100A Commercial
AT94K05AL-25BQC 144L1 (0°C - 70°C)
AT94K05AL-25DQC 208Q1
5,000 -25 MHz
AT94K05AL-25AJI 84J
AT94K05AL-25AQI 100A Industrial
AT94K05AL-25BQI 144L1 (-40°C - 85°C)
AT94K05AL-25DQI 208Q1
AT94K10AL-25AJC 84J
AT94K10AL-25AQC 100A Commercial
AT94K10AL-25BQC 144L1 (0°C - 70°C)
AT94K10AL-25DQC 208Q1
10,000 -25 MHz
AT94K10AL-25AJI 84J
AT94K10AL-25AQI 100A Industrial
AT94K10AL-25BQI 144L1 (-40°C - 85°C)
AT94K10AL-25DQI 208Q1
AT94K40AL-25BQC 144L1 Commercial
AT94K40AL-25DQC 208Q1 (0°C - 70°C)
40,000 -25 MHz
AT94K40AL-25BQI 144L1 Industrial
AT94K40AL-25DQI 208Q1 (-40°C - 85°C)
Package Type
84J 84-lead, Plastic J-leaded Chip Carrier (PLCC)
100A 100-lead, Thin (1.0 mm) Plastic Quad Flat Package (TQFP)
144L1 144-lead, Low Profile Plastic Gull Wing Quad Flat Package (LQFP)
208Q1 208-lead, Plastic Gull Wing Quad Flat Package (PQFP)
195
1138H–FPSLI–6/05
9. Packaging Information
1.14(0.045) X 45˚
1.14(0.045) X 45˚ PIN NO. 1
0.318(0.0125)
IDENTIFIER 0.191(0.0075)
E1 E B1 D2/E2
B
e
A2
D1
A1
D
A
0.51(0.020)MAX
45˚ MAX (3X)
COMMON DIMENSIONS
(Unit of Measure = mm)
10/04/01
PIN 1
B
PIN 1 IDENTIFIER
e E1 E
D1
D
C 0˚~7˚
A1 A2 A
L
COMMON DIMENSIONS
(Unit of Measure = mm)
10/5/2001
TITLE DRAWING NO. REV.
2325 Orchard Parkway
100A, 100-lead, 14 x 14 mm Body Size, 1.0 mm Body Thickness,
R San Jose, CA 95131 100A C
0.5 mm Lead Pitch, Thin Profile Plastic Quad Flat Package (TQFP)
197
1138H–FPSLI–6/05
9.3 144L1 – LQFP
D1 D
XX
e
E1 E
UN T
CO
RY
b
Bottom View
Top View
COMMON DIMENSIONS
(Unit of Measure = mm)
Notes: 1. This drawing is for general information only; refer to JEDEC Drawing MS-026 for additional information.
2. The top package body size may be smaller than the bottom package size by as much as 0.15 mm.
3. Dimensions D1 and E1 do not include mold protrusions. Allowable protrusion is 0.25 mm per side. D1 and E1 are maximum plastic
body size dimensions including mold mismatch.
4. Dimension b does not include Dambar protrusion. Allowable Dambar protrusion shall not cause the lead width to exceed the maximum
b dimension by more than 0.08 mm. Dambar cannot be located on the lower radius or the foot. Minimum space between protrusion and
an adjacent lead is 0.07 mm for 0.4 and 0.5 mm pitch packages.
5. These dimensions apply to the flat section of the lead between 0.10 mm and 0.25 mm from the lead tip.
6. A1 is defined as the distance from the seating place to the lowest point on the package body.
11/30/01
TITLE DRAWING NO. REV.
2325 Orchard Parkway 144L1, 144-lead (20 x 20 x 1.4 mm Body), Low Profile
San Jose, CA 95131 144L1 A
R
Plastic Quad Flat Pack (LQFP)
D1
A2
L1 A1
E1 Side View
Top View
D
COMMON DIMENSIONS
(Unit of Measure = mm)
199
1138H–FPSLI–6/05
10. Thermal Coefficient Table
Theta J-A Theta J-A Theta J-A
Package Style Lead Count 0 LFPM 225 LFPM 500 LPFM Theta J-C
PLCC 84 37 30 25 12
TQFP 100 47 39 33 22
LQFP 144 33 27 23 8.5
PQFP 208 32 28 24 10
1 Description .................................................................................................. 2
i
1138H–FPSLI–2/3/05
4.12 Software Control of System Configuration ..........................................................52
4.13 FPGA Cache Logic .............................................................................................54
4.14 FPGA I/O Selection by AVR ................................................................................55
4.15 FPGA I/O Interrupt Control by AVR ....................................................................59
4.16 Reset and Interrupt Handling ..............................................................................60
4.17 Sleep Modes .......................................................................................................69
4.18 JTAG Interface and On-chip Debug System .......................................................71
4.19 IEEE 1149.1 (JTAG) Boundary-scan ..................................................................76
4.20 Bypass Register ..................................................................................................77
4.21 Device Identification Register ..............................................................................78
4.22 AVR Reset Register ............................................................................................79
4.23 Timer/Counters ...................................................................................................89
4.24 Timer/Counter Prescalers ...................................................................................89
4.25 8-bit Timers/Counters T/C0 and T/C2 .................................................................90
4.26 Timer/Counter1 .................................................................................................101
4.27 Watchdog Timer ................................................................................................110
4.28 Multiplier ............................................................................................................112
4.29 UARTs ...............................................................................................................129
4.30 2-wire Serial Interface (Byte Oriented) ..............................................................140
4.31 I/O Ports ............................................................................................................158
Table of Contents....................................................................................... i
iii
1138H–FPSLI–2/3/05
Atmel Corporation Atmel Operations
2325 Orchard Parkway Memory RF/Automotive
San Jose, CA 95131, USA 2325 Orchard Parkway Theresienstrasse 2
Tel: 1(408) 441-0311 San Jose, CA 95131, USA Postfach 3535
Fax: 1(408) 487-2600 Tel: 1(408) 441-0311 74025 Heilbronn, Germany
Fax: 1(408) 436-4314 Tel: (49) 71-31-67-0
Fax: (49) 71-31-67-2340
Regional Headquarters Microcontrollers
Europe 2325 Orchard Parkway 1150 East Cheyenne Mtn. Blvd.
Atmel Sarl San Jose, CA 95131, USA Colorado Springs, CO 80906, USA
Route des Arsenaux 41 Tel: 1(408) 441-0311 Tel: 1(719) 576-3300
Case Postale 80 Fax: 1(408) 436-4314 Fax: 1(719) 540-1759
CH-1705 Fribourg
Switzerland La Chantrerie Biometrics/Imaging/Hi-Rel MPU/
Tel: (41) 26-426-5555 BP 70602 High Speed Converters/RF Datacom
Fax: (41) 26-426-5500 44306 Nantes Cedex 3, France Avenue de Rochepleine
Tel: (33) 2-40-18-18-18 BP 123
Asia Fax: (33) 2-40-18-19-60 38521 Saint-Egreve Cedex, France
Room 1219 Tel: (33) 4-76-58-30-00
Chinachem Golden Plaza ASIC/ASSP/Smart Cards Fax: (33) 4-76-58-34-80
77 Mody Road Tsimshatsui Zone Industrielle
East Kowloon 13106 Rousset Cedex, France
Hong Kong Tel: (33) 4-42-53-60-00
Tel: (852) 2721-9778 Fax: (33) 4-42-53-60-01
Fax: (852) 2722-1369
1150 East Cheyenne Mtn. Blvd.
Japan Colorado Springs, CO 80906, USA
9F, Tonetsu Shinkawa Bldg. Tel: 1(719) 576-3300
1-24-8 Shinkawa Fax: 1(719) 540-1759
Chuo-ku, Tokyo 104-0033
Japan Scottish Enterprise Technology Park
Tel: (81) 3-3523-3551 Maxwell Building
Fax: (81) 3-3523-7581 East Kilbride G75 0QR, Scotland
Tel: (44) 1355-803-000
Fax: (44) 1355-242-743
Literature Requests
www.atmel.com/literature
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 ATMEL’S TERMS AND CONDI-
TIONS OF SALE LOCATED ON ATMEL’S WEB SITE, 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 INCIDEN-
TAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF 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. Atmel’s products are not
intended, authorized, or warranted for use as components in applications intended to support or sustain life.
© Atmel Corporation 2005. All rights reserved. Atmel®, logo and combinations thereof, Everywhere You Are ® and others, are registered trade-
marks or trademarks of Atmel Corporation or its subsidiaries. Microsoft ®, Windows ® and Windows NT® are the registered trademarks of
Microsoft Corporation. Other terms and product names may be trademarks of others.
1138H–FPSLI–2/3/05