AT91M402800A ARM7處理器
AT91M402800A ARM7處理器
•
– Software Programmable 8/16-bit External Data Bus
8-channel Peripheral Data Controller
AT91
• 8-level Priority, Individually Maskable, Vectored Interrupt Controller
– 5 External Interrupts, Including a High-priority, Low-latency Interrupt Request
ARM® Thumb®
• 54 Programmable I/O Lines
• 6-channel 16-bit Timer/Counter Microcontrollers
– 6 External Clock Inputs, 2 Multi-purpose I/O Pins per Channel
• 2 USARTs
– 2 Dedicated Peripheral Data Controller (PDC) Channels per USART
– Support for up to 9-bit Data Transfers AT91M42800A
• 2 Master/Slave SPI Interfaces
– 2 Dedicated Peripheral Data Controller (PDC) Channels per SPI
– 8- to 16-bit Programmable Data Length
– 4 External Slave Chip Selects per SPI
• 3 System Timers
– Period Interval Timer (PIT); Real-time Timer (RTT); Watchdog Timer (WDT)
• Power Management Controller (PMC)
– CPU and Peripherals Can be Deactivated Individually
• Clock Generator with 32.768 kHz Low-power Oscillator and PLL
– Support for 38.4 kHz Crystals
– Software Programmable System Clock (up to 33 MHz)
• IEEE 1149.1 JTAG Boundary Scan on All Active Pins
• Fully Static Operation: 0 Hz to 33 MHz, Internal Frequency Range at VDDCORE = 3.0V,
85°C
• 2.7V to 3.6V Core and PLL Operating Voltage Range; 2.7V to 5.5V I/O Operating Voltage
Range
• -40°C to +85°C Temperature Range
• Available in a 144-lead TQFP Package and in 144-ball BGA Package
Description
The AT91M42800A is a member of the Atmel AT91 16/32-bit microcontroller family,
which is based on the ARM7TDMI processor core. This processor has a high-perfor-
mance 32-bit RISC architecture with a high-density 16-bit instruction set and very low
power consumption. In addition, a large number of internally banked registers result in
very fast exception handling, making the device ideal for real-time control applications.
The AT91 ARM-based MCU family also features Atmel’s high-density, in-system pro-
grammable, nonvolatile memor y technology. The AT91M42800A has a direct
connection to off-chip memory, including Flash, through the External Bus Interface.
The Power Management Controller allows the user to adjust device activity according
to system requirements, and, with the 32.768 kHz low-power oscillator, enables the
AT91M42800A to reduce power requirements to an absolute minimum. The
AT91M42800A is manufactured using Atmel’s high-density CMOS technology. By
combining the ARM7TDMI processor core with on-chip SRAM and a wide range of
peripheral functions including timers, serial communication controllers and a versatile
clock generator on a monolithic chip, the AT91M42800A provides a highly flexible and Rev. 1779B–ATARM–03/02
cost-effective solution to many compute-intensive applications.
1
Pin Configuration
Figure 1. Pin Configuration in TQFP144 Package (Top View)
108 73
109 72
AT91M42800 33AI
144 37
1 36
2 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
3
1779B–ATARM–03/02
Table 2. AT91M42800A Pinout in BGA 144 Package
Pin# Name Pin# Name Pin# Name Pin# Name
A1 PB1/NCS3 D1 A2 G1 A17 K1 D1
A2 NCS0 D2 A3 G2 A16 K2 VDDCORE
A3 NCS1 D3 A4 G3 A11 K3 VDDIO
A4 GND D4 NWAIT G4 A13 K4 D9
A5 PLLRCB D5 PA29/PME G5 GND K5 D10
A6 GND D6 PA28 G6 GND K6 D14
A7 PLLRCA D7 TCK G7 GND K7 PB9/TCLK1
A8 GND D8 TMS G8 GND K8 PB13/TIOA2
A9 XOUT D9 MODE1 G9 PA9/TXD1/NTRI K9 PB11/TIOB1
A10 XIN D10 PA25/MCKO G10 PA10/RXD1 K10 VDDIO
A11 MODE0 D11 PA21/NPCSB0 G11 PA8/SCK1 K11 PB16/TIOA3
A12 PA22/NPCSB1 D12 PA18/SPCKB G12 PA7/RXD0 K12 PB23/TIOB5
B1 NUB/NWR1 E1 A7 H1 A18 L1 D3
B2 PB0/NCS2 E2 VDDIO H2 VDDIO L2 D2
B3 VDDCORE E3 A6 H3 A15 L3 D5
B4 NWE/NWR0 E4 A5 H4 A14 L4 D8
B5 VDDPLL E5 GND H5 A19 L5 VDDIO
B6 TDO E6 GND H6 GND L6 D13
B7 VDDPLL E7 GND H7 GND L7 PB8/TIOB0
B8 NWDOVF E8 NTRST H8 GND L8 VDDIO
B9 PA26 E9 PA13/MOSIA H9 PA6/TXD0 L9 PB17/TIOB3
B10 PA19/MISOB E10 PA16/NPCSA2 H10 PA4/FIQ L10 VDDCORE
B11 PA24/NPCSB3 E11 VDDIO H11 VDDIO L11 PB20/TIOB4
B12 PA23/NPCSB2 E12 PA17/NPCSA3 H12 PA5/SCK0 L12 PB22/TIOA5
C1 NLB/A0 F1 A8 J1 PB5/A23/CS4 M1 D4
C2 A1 F2 A12 J2 D0 M2 D6
C3 VDDIO F3 A9 J3 PB4/A22/CS5 M3 D7
C4 NOE/NRD F4 A10 J4 PB3/A21/CS6 M4 D11
C5 VDDIO F5 GND J5 PB2/A20/CS7 M5 D12
C6 NRST F6 GND J6 D15 M6 PB7/TIOA0
C7 TDI F7 GND J7 PB6/TCLK0 M7 PB12/TCLK2
C8 VDDIO F8 GND J8 PB10/TIOA1 M8 PB15/TCLK3
C9 PA27/BMS F9 PA12/MISOA J9 PA3/IRQ3 M9 PB14/TIOB2
C10 VDDIO F10 PA15/NPCSA1 J10 PA2/IRQ2 M10 PB18/TCLK4
C11 VDDCORE F11 PA11/SPCKA J11 PA0/IRQ0 M11 PB19/TIOA4
C12 PA20/MOSIB F12 PA14/NPCSA0 J12 PA1/IRQ1 M12 PB21/TCLK5
4 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
Pin Description
Table 3. AT91M42800A Pin Description
Active
Module Name Function Type Level Comments
A0 - A23 Address Bus Output – All valid after reset
D0 - D15 Data Bus I/O –
CS4 - CS7 Chip Select Output High A23 - A20 after reset
NCS0 - NCS3 Chip Select Output Low
NWR0 Lower Byte 0 Write Signal Output Low Used in Byte Write option
NWR1 Lower Byte 1 Write Signal Output Low Used in Byte Write option
NRD Read Signal Output Low Used in Byte Write option
EBI
NWE Write Enable Output Low Used in Byte Select option
NOE Output Enable Output Low Used in Byte Select option
NUB Upper Byte Select (16-bit SRAM) Output Low Used in Byte Select option
NLB Lower Byte Select (16-bit SRAM) Output Low Used in Byte Select option
NWAIT Wait Input Input Low
BMS Boot Mode Select Input – Sampled during reset
PME Protect Mode Enable Input High PIO-controlled after reset
IRQ0 - IRQ3 External Interrupt Request Input – PIO-controlled after reset
AIC
FIQ Fast External Interrupt Request Input – PIO-controlled after reset
TCLK0 - TCLK5 Timer External Clock Input – PIO-controlled after reset
TC TIOA0 - TIOA5 Multi-purpose Timer I/O Pin A I/O – PIO-controlled after reset
TIOB0 - TIOB5 Multi-purpose Timer I/O Pin B I/O – PIO-controlled after reset
SCK0 - SCK1 External Serial Clock I/O – PIO-controlled after reset
USART TXD0 - TXD1 Transmit Data Output Output – PIO-controlled after reset
RXD0 - RXD1 Receive Data Input Input – PIO-controlled after reset
SPCKA/SPCKB Clock I/O – PIO-controlled after reset
MISOA/MISOB Master In Slave Out I/O – PIO-controlled after reset
SPIA MOSIA/MOSIB Master Out Slave In I/O – PIO-controlled after reset
SPIB NSSA/NSSB Slave Select Input Low PIO-controlled after reset
NPCSA0 - NPCSA3
Peripheral Chip Selects Output Low PIO-controlled after reset
NPCSB0 - NPCSB3
PA0 - PA29 Programmable I/O Port A I/O – Input after reset
PIO
PB0 - PB23 Programmable I/O Port B I/O – Input after reset
ST NWDOVF Watchdog Timer Overflow Output Low Open drain
XIN Oscillator Input or External Clock Input –
XOUT Oscillator Output Output –
CLOCK PLLRCA RC Filter for PLL A Input –
PLLRCB RC Filter for PLL B Input –
MCKO Clock Output Output –
Test and NRST Hardware Reset Input Input Low Schmitt trigger
Reset MODE0 - MODE1 Mode Selection Input
5
1779B–ATARM–03/02
Table 3. AT91M42800A Pin Description (Continued)
Active
Module Name Function Type Level Comments
TMS Test Mode Select Input – Schmitt trigger, internal pull-up
TDI Test Data In Input – Schmitt trigger, internal pull-up
JTAG/ICE TDO Test Data Out Output –
TCK Test Clock Input – Schmitt trigger, internal pull-up
NTRST Test Reset Input Input Low Schmitt trigger, internal pull-up
Emulation NTRI Tri-state Mode Enable Input Low Sampled during reset
VDDIO I/O Power Power – 3V or 5V nominal supply
VDDCORE Core Power Power – 3V nominal supply
Power
VDDPLL PLL Power Power – 3V nominal supply
GND Ground Ground –
6 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
Block Diagram
Figure 3. AT91M42800A
NTRST
Selection
TMS
JTAG
Embedded Reset NRST
TDO
TDI ICE
TCK
D0-D15
JTAG
ARM7TDMI
MODE0 Core A0/NLB
MODE1 ASB A1-A19
NRD/NOE
NWR0/NWE
NWR1/NUB
XIN NWAIT
Bus Interface
EBI: External
XOUT Internal RAM NCS0
Generator
8K Bytes NCS1
PLLRCA
Clock
PLLRCB
PA27/BMS
PA29/PME
ASB
PA25/MCKO Controller
PA26 PB0/NCS2
PB1/NCS3
PA28 PB2/A20/CS7
AMBA™ Bridge
PB3/A21/CS6
PA0/IRQ0 PB4/A22/CS5
PA1/IRQ1 AIC: Advanced EBI User PB5/A23/CS4
PA2/IRQ2 Interrupt Controller Interface
PA3/IRQ3
PA4/FIQ
TC: Timer/ PB6/TCLK0
PA5/SCK0 2 PDC Counter
USART0 PB9/TCLK1
PA6/TXD0 Channels Block 0 PB12/TCLK2
PA7/RXD0
PB7/TIOA0
APB TC0
PA8/SCK1 PB8/TIOB0
PA9/TXD1/NTRI 2 PDC
USART1 Channels
PA10/RXD1 PB10/TIOA1
P TC1
PB11/TIOB1
I P
PA11/SPCKA O I PB13/TIOA2
TC2
PA12/MISOA O PB14/TIOB2
PA13/MOSIA SPIA: Serial
2 PDC
PA14/NPCSA0/NSSA Peripheral
PA15/NPCSA1 Channels TC: Timer/ PB15/TCLK3
Interface
PA16/NPCSA2 Counter PB18/TCLK4
PA17/NPCSA3 Block 1 PB21/TCLK5
PB16/TIOA3
TC3
PB17/TIOB3
PA18/SPCKB
PA19/MISOB
SPIB: Serial PB19/TIOA4
PA20/MOSIB TC4
2 PDC PB20/TIOB4
PA21/NPCSB0/NSSB Peripheral
PA22/NPCSB1 Channels
Interface PB22/TIOA5
PA23/NPCSB2 TC5
PB23/TIOB5
PA24/NPCSB3
System
Timers
PMC: Power Management
Watchdog NWDOVF
Controller
Real-time
Chip ID Period
Interval
7
1779B–ATARM–03/02
Architectural The AT91M42800A microcontroller integrates an ARM7TDMI with its embedded ICE
interface, memories and peripherals. Its architecture consists of two main buses, the
Overview
Advanced System Bus (ASB) and the Advanced Peripheral Bus (APB). Designed for
maximum performance and controlled by the memory controller, the ASB interfaces the
ARM7TDMI processor with the on-chip 32-bit memories, the External Bus Interface
(EBI) and the AMBA™ Bridge. The AMBA Bridge drives the APB, which is designed for
accesses to on-chip peripherals and optimized for low power consumption.
The AT91M42800A microcontroller implements the ICE port of the ARM7TDMI proces-
sor on dedicated pins, offering a complete, low-cost and easy-to-use debug solution for
target debugging.
Memories The AT91M42800A microcontroller embeds up to 8K bytes of internal SRAM. The inter-
nal memory is directly connected to the 32-bit data bus and is single-cycle accessible.
This provides maximum performance of 30 MIPS at 33 MHz by using the ARM instruc-
tion set of the processor. The on-chip memory significantly reduces the system power
consumption and improves its performance over external memory solutions.
The AT91M42800A microcontroller features an External Bus Interface (EBI), which
enables connection of external memories and application-specific peripherals. The EBI
supports 8- or 16-bit devices and can use two 8-bit devices to emulate a single 16-bit
device. The EBI implements the early read protocol, enabling single clock cycle memory
accesses two times faster than standard memory interfaces.
Peripherals The AT91M42800A microcontroller integrates several peripherals, which are classified
as system or user peripherals. All on-chip peripherals are 32-bit accessible by the
AMBA Bridge, and can be programmed with a minimum number of instructions. The
peripheral register set is composed of control, mode, data, status and enable/dis-
able/status registers.
An on-chip Peripheral Data Controller (PDC) transfers data between the on-chip
USARTs/SPIs and the on- and off-chip memories without processor intervention. Most
importantly, the PDC removes the processor interrupt handling overhead and signifi-
cantly reduces the number of clock cycles required for a data transfer. It can transfer up
to 64K continuous bytes without reprogramming the start address. As a result, the per-
formance of the microcontroller is increased and the power consumption reduced.
8 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
System Peripherals The External Bus Interface (EBI) controls the external memory and peripheral devices
via an 8- or 16-bit data bus and is programmed through the APB. Each chip select line
has its own programming register.
The Power Management Controller (PMC) optimizes power consumption of the product
by controlling the clocking elements such as the oscillator and the PLLs, system and
user peripheral clocks.
The Advanced Interrupt Controller (AIC) controls the internal sources from the internal
peripherals and the five external interrupt lines (including the FIQ) to provide an interrupt
and/or fast interrupt request to the ARM7TDMI. It integrates an 8-level priority controller,
and, using the Auto-vectoring feature, reduces the interrupt latency time.
The Parallel Input/Output Controllers (PIOA, PIOB) controls up to 54 I/O lines. It enables
the user to select specific pins for on-chip peripheral input/output functions, and general-
purpose input/output signal pins. The PIO controllers can be programmed to detect an
interrupt on a signal change from each line.
There are three embedded system timers. The Real-time Timer (RTT) counts elapsed
seconds and can generate periodic or programmed interrupts. The Period Interval Timer
(PIT) can be used as a user-programmable time-base, and can generate periodic ticks.
The Watchdog (WD) can be used to prevent system lock-up if the software becomes
trapped in a deadlock.
The Special Function (SF) module integrates the Chip ID and the Reset Status
registers.
User Peripherals Two USARTs, independently configurable, enable communication at a high baud rate in
synchronous or asynchronous mode. The format includes start, stop and parity bits and
up to 9 data bits. Each USART also features a Time-out and a Time-guard register, facil-
itating the use of the two dedicated Peripheral Data Controller (PDC) channels.
The two 3-channel, 16-bit Timer/Counters (TC) are highly-programmable and support
capture or waveform modes. Each TC channel can be programmed to measure or gen-
erate different kinds of waves, and can detect and control two input/output signals. Each
TC also has three external clock signals.
Two independently configurable SPIs provide communication with external devices in
master or slave mode. Each has four external chip selects which can be connected to
up to 15 devices. The data length is programmable, from 8- to 16-bit.
9
1779B–ATARM–03/02
Associated Documentation
Table 4. Associated Documentation
Information Document Title
Internal architecture of processor
ARM/Thumb instruction sets ARM7TDMI (Thumb) Datasheet
Embedded in-circuit-emulator
External memory interface mapping
Peripheral operations AT91M42800A Datasheet (this document)
Peripheral user interfaces
DC characteristics
Power consumption
AT91M42800A Electrical Characteristics Datasheet
Thermal and reliability chonsiderations
AC characteristics
Product overview
Ordering information
AT91M42800A Summary Datasheet
Packaging information
Soldering profile
10 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
Product Overview
Power Supply The AT91M42800A has three kinds of power supply pins:
• VDDCORE pins that power the chip core
• VDDIO pins that power the I/O lines
• VDDPLL pins that power the oscillator and PLL cells
VDDCORE and VDDIO pins allow core power consumption to be reduced by supplying
it with a lower voltage than the I/O lines. The VDDCORE pins must never be powered at
a voltage greater than the supply voltage applied to the VDDIO.
The VDDPLL pin is used to supply the oscillator and both PLLs. The voltage applied on
these pins is typically 3.3V, and it must not be lower than VDDCORE.
Typical supported voltage combinations are shown in the following table:
Input/Output After the reset, the peripheral I/Os are initialized as inputs to provide the user with maxi-
Considerations mum flexibility. It is recommended that in any application phase, the inputs to the
AT91M42800A microcontroller be held at valid logic levels to minimize the power
consumption.
Operating Modes The AT91M42800A has two pins dedicated to defining MODE0 and MODE1 operating
modes. These pins allow the user to enter the device in Boundary Scan mode. They
also allow the user to run the processor from the on-chip oscillator output and from an
external clock by bypassing the on-chip oscillator. The last mode is reserved for test
purposes. A chip reset must be performed (NRST and NTRST) after MODE0 and/or
MODE1 have been changed.
Warning: The user must take the external oscillator frequency into account so that it is
consistent with the minimum access time requested by the memory device used at the
boot. Both the default EBI setting (zero wait state) on Chip Select 0 (See “Boot on
NCS0” on page 28) and the minimum access time of the boot memory are two parame-
ters that determine this maximum frequency of the external oscillator.
Clock Generator The AT91M42800A microcontroller embeds a 32.768 kHz oscillator that generates the
Slow Clock (SLCK). This on-chip oscillator can be bypassed by setting the correct logi-
cal level on the MODE0 and MODE1 pins, as shown above. In this case, SLCK equals
XIN.
11
1779B–ATARM–03/02
The AT91M42800A microcontroller has a fully static design and works either on the
Master Clock (MCK), generated from the Slow Clock by means of the two integrated
PLLs, or on the Slow Clock (SLCK).
These clocks are also provided as an output of the device on the pin MCKO, which is
multiplexed with a general-purpose I/O line. While NRST is active, and after the reset,
the MCKO is valid and outputs an image of the SLCK signal. The PIO Controller must
be programmed to use this pin as standard I/O line.
Reset Reset initializes the user interface registers to their default states as defined in the
peripheral sections of this datasheet and forces the ARM7TDMI to perform the next
instruction fetch from address zero. Except for the program counter, the ARM core reg-
isters do not have defined reset states. When reset is active, the inputs of the
AT91M42800A must be held at valid logic levels. The EBI address lines drive low during
reset. All the peripheral clocks are disabled during reset to save power.
NRST Pin NRST is the active low reset input. It is asserted asynchronously, but exit from reset is
synchronized internally to the slow clock (SLCK). At power-up, NRST must be active
until the on-chip oscillator is stable. During normal operation, NRST must be active for a
minimum of 10 SLCK clock cycles to ensure correct initialization.
The pins BMS and NTRI are sampled during the 10 SLCK clock cycles just prior to the
rising edge of NRST.
The NRST pin has no effect on the on-chip Embedded ICE logic.
Watchdog Reset The internally generated watchdog reset has the same effect as the NRST pin, except
that the pins BMS and NTRI are not sampled. Boot mode and Tri-state mode are not
updated. The NRST pin has priority if both types of reset coincide.
Emulation Functions
Tri-state Mode The AT91M42800A provides a Tri-state mode, which is used for debug purposes in
order to connect an emulator probe to an application board. In Tri-state mode the
AT91M42800A continues to function, but all the output pin drivers are tri-stated.
To enter Tri-state mode, the pin NTRI must be held low during the last 10 SLCK clock
cycles before the rising edge of NRST. For normal operation, the pin NTRI must be held
high during reset, by a resistor of up to 400 kΩ. NTRI must be driven to a valid logic
value during reset.
NTRI is multiplexed with Parallel I/O PA9 and USART 1 serial data transmit line TXD1.
Standard RS232 drivers generally contain internal 400 kΩ pull-up resistors. If TXD1 is
connected to one of these drivers, this pull-up will ensure normal operation, without the
need for an additional external resistor.
Embedded ICE ARM standard embedded in-circuit emulation is supported via the JTAG/ICE port. It is
connected to a host computer via an embedded ICE Interface.
Embedded ICE mode is selected when MODE1 is low.
It is not possible to switch directly between ICE and JTAG operations. A chip reset must
be performed (NRST and NTRST) after MODE0 and/or MODE1 have/has been
changed. The reset input to the embedded ICE (NTRST) is provided separately to facili-
tate debug of boot programs.
12 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
IEEE 1149.1 JTAG Boundary IEEE 1149.1 JTAG Boundary Scan is enabled when MODE0 is low and MODE1 is high.
Scan The functions SAMPLE, EXTEST and BYPASS are implemented. In ICE Debug mode,
the ARM core responds with a non-JTAG chip ID that identifies the core to the ICE sys-
tem. This is not IEEE 1149.1 JTAG compliant. It is not possible to switch directly
between JTAG and ICE operations. A chip reset must be performed (NRST and
NTRST) after MODE0 and/or MODE1 have/has been changed.
Memory Controller The ARM7TDMI processor address space is 4G bytes. The memory controller decodes
the internal 32-bit address bus and defines three address spaces:
• Internal Memories in the four lowest megabytes
• Middle Space reserved for the external devices (memory or peripherals) controlled
by the EBI
• Internal Peripherals in the four highest megabytes
In any of these address spaces, the ARM7TDMI operates in little-endian mode only.
Protection Mode The embedded peripherals can be protected against unwanted access. The PME (Pro-
tect Mode Enable) pin must be tied high and validated in its peripheral operation (PIO
Disable) to enable the protection mode. When enabled, any peripheral access must be
done while the ARM7TDMI is running in Privileged mode (i.e., the accesses in user
mode result in an abort). Only the valid peripheral address space is protected and
requests to the undefined addresses will lead to a normal operation without abort.
Internal Memories The AT91M42800A microcontroller integrates an 8-Kbyte primary internal SRAM. All
internal memories are 32 bits wide and single-clock cycle accessible. Byte (8-bit), half-
word (16-bit) or word (32-bit) accesses are supported and are executed within one
cycle. Fetching Thumb or ARM instructions is supported and internal memory can store
twice as many Thumb instructions as ARM ones.
The SRAM bank is mapped at address 0x0 (after the remap command), and
ARM7TDMI exception vectors between 0x0 and 0x20 that can be modified by the soft-
ware. The rest of the bank can be used for stack allocation (to speed up context saving
and restoring), or as data and program storage for critical algorithms.
Boot Mode Select The ARM reset vector is at address 0x0. After the NRST line is released, the
ARM7TDMI executes the instruction stored at this address. This means that this
address must be mapped in non-volatile memory after the reset.
The input level on the BMS pin during the last 10 SLCK clock cycles before the rising
edge of the NRST selects the type of boot memory. The Boot mode depends on BMS
(see Table 5).
The pin BMS is multiplexed with the I/O line PA27 that can be programmed after reset
like any standard PIO line.
Table 5. Boot Mode Select
BMS Boot Memory
1 External 8-bit memory NCS0
0 External 16-bit memory on NCS0
Remap Command The ARM vectors (Reset, Abort, Data Abort, Prefetch Abort, Undefined Instruction,
Interrupt, Fast Interrupt) are mapped from address 0x0 to address 0x20. In order to
allow these vectors to be redefined dynamically by the software, the AT91M42800A
microcontroller uses a remap command that enables switching between the boot mem-
13
1779B–ATARM–03/02
ory and the internal SRAM bank addresses. The remap command is accessible through
the EBI User Interface, by writing one in RCB of EBI_RCR (Remap Control Register).
Performing a remap command is mandatory if access to the other external devices (con-
nected to chip selects 1 to 7) is required. The remap operation can only be changed
back by an internal reset or an NRST assertion.
Notes: 1. NIRQ de-assertion and automatic interrupt clearing if the source is programmed as
level sensitive.
Abort Control The abort signal providing a Data Abort or a Prefetch Abort exception to the ARM7TDMI
is asserted in the following cases:
• When accessing an undefined address in the EBI address space
• When the ARM7TDMI performs a misaligned access
No abort is generated when reading the internal memory or by accessing the internal
peripherals, whether the address is defined or not.
When the processor performs a forbidden write access in a mode-protected peripheral
register, the write is cancelled but no abort is generated.
The processor can perform word or half-word data access with a misaligned address
when a register relative load/store instruction is executed and the register contains a
misaligned address. In this case, whether the access is in write or in read, an abort is
generated but the access is not cancelled.
The Abort Status Register traces the source that caused the last abort. The address and
the type of abort are stored in registers of the External Bus Interface.
External Bus Interface The External Bus Interface handles the accesses between addresses 0x0040 0000 and
0xFFC0 0000. It generates the signals that control access to the external devices, and
can be configured from eight 1-Mbyte banks up to four 16-Mbyte banks. In all cases it
supports byte, half-word and word aligned accesses.
For each of these banks, the user can program:
• Number of wait states
• Number of data float times (wait time after the access is finished to prevent any bus
contention in case the device takes too long in releasing the bus)
• Data bus width (8-bit or 16-bit)
• With a 16-bit wide data bus, the user can program the EBI to control one 16-bit
device (Byte Access Select mode) or two 8-bit devices in parallel that emulate a
16-bit memory (Byte Write Access mode).
The External Bus Interface features also the Early Read Protocol, configurable for all the
devices, that significantly reduces access time requirements on an external device.
14 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
Peripherals The AT91M42800A peripherals are connected to the 32-bit wide Advanced Peripheral
Bus. Peripheral registers are only word accessible. Byte and half-word accesses are not
supported. If a byte or a half-word access is attempted, the memory controller automati-
cally masks the lowest address bits and generates a word access.
Each peripheral has a 16-Kbyte address space allocated (the AIC only has a 4-Kbyte
address space).
Peripheral Interrupt Control The Interrupt Control of each peripheral is controlled from the status register using the
interrupt mask. The status register bits are ANDed to their corresponding interrupt mask
bits and the result is then ORed to generate the Interrupt Source signal to the Advanced
Interrupt Controller.
The interrupt mask is read in the Interrupt Mask Register and is modified with the Inter-
rupt Enable Register and the Interrupt Disable Register. The enable/disable/status (or
mask) makes it possible to enable or disable peripheral interrupt sources with a non-
interruptible single instruction. This eliminates the need for interrupt masking at the AIC
or Core level in real-time and multi-tasking systems.
Peripheral Data Controller The AT91M42800A has an 8-channel PDC dedicated to the two on-chip USARTs and to
the two on-chip SPIs. One PDC channel is connected to the receiving channel and one
to the transmitting channel of each peripheral.
The user interface of a PDC channel is integrated in the memory space of each USART
channel and in the memory space of each SPI. It contains a 32-bit address pointer reg-
ister and a 16-bit count register. When the programmed data is transferred, an end-of-
transfer interrupt is generated by the corresponding peripheral. See the USART section
and the SPI section for more details on PDC operation and programming.
15
1779B–ATARM–03/02
System Peripherals
PMC: Power Management The AT91M42800A’s Power Management Controller optimizes the power consumption
Controller of the device. The PMC controls the clocking elements such as the oscillator and the
PLLs, and the System and the Peripheral Clocks. It also controls the MCKO pin and per-
mits to the user to select four different signals to be driven on this pin.
The AT91M42800A has the following clock elements:
• The oscillator providing a clock that depends on the crystal fundamental frequency
connected between the XIN and XOUT pins
• PLL A providing a low-to-middle frequency clock range
• PLL B providing a middle-to-high frequency range
• The Clock prescaler
• The ARM Processor Clock controller
• The Peripheral Clock controller
• The Master Clock Output controller
The on-chip low-power oscillator together with the PLL-based frequency multiplier and
the prescaler results in a programmable clock between 500 Hz and 66 MHz. It is the
responsibility of the user to make sure that the PMC programming does not result in a
clock over the acceptable limits.
ST: System Timer The System Timer module integrates three different free-running timers:
• A Period Interval Timer setting the base time for an Operating System.
• A Watchdog Timer that is built around a 16-bit counter, and is used to prevent
system lock-up if the software becomes trapped in a deadlock. It can generate an
internal reset or interrupt, or assert an active level on the dedicated pin NWDOVF.
• A Real-time Timer counting elapsed seconds.
These timers count using the Slow Clock. Typically, this clock has a frequency of 32768
Hz.
AIC: Advanced Interrupt The AT91M42800A has an 8-level priority, individually maskable, vectored interrupt
Controller controller. This feature substantially reduces the software and real-time overhead in
handling internal and external interrupts.
The interrupt controller is connected to the NFIQ (fast interrupt request) and the NIRQ
(standard interrupt request) inputs of the ARM7TDMI processor. The processor’s NFIQ
line can only be asserted by the external fast interrupt request input: FIQ. The NIRQ line
can be asserted by the interrupts generated by the on-chip peripherals and the external
interrupt request lines: IRQ0 to IRQ3.
The 8-level priority encoder allows the customer to define the priority between the differ-
ent NIRQ interrupt sources.
Internal sources are programmed to be level sensitive or edge triggered. External
sources can be programmed to be positive or negative edge triggered or high- or low-
level sensitive.
PIO: Parallel I/O Controller The AT91M42800A has 54 programmable I/O lines. I/O lines are multiplexed with an
external signal of a peripheral to optimize the use of available package pins. These lines
are controlled by two separate and identical PIO Controllers called PIOA and PIOB.
Each PIO controller also provides an internal interrupt signal to the Advanced Interrupt
Controller and insertion of a simple input glitch filter on any of the PIO pins.
16 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
SF: Special Function The AT91M42800A provides registers that implement the following special functions.
• Chip Identification
• RESET Status
User Peripherals
USART: Universal The AT91M42800A provides two identical, full-duplex, universal synchronous/asynchro-
Synchronous/ nous receiver/transmitters that interface to the APB and are connected to the Peripheral
Asynchronous Receiver Data Controller.
Transmitter
The main features are:
• Programmable Baud Rate Generator with External or Internal Clock, as well as Slow
Clock
• Parity, Framing and Overrun Error Detection
• Line Break Generation and Detection
• Automatic Echo, Local Loopback and Remote Loopback channel modes
• Multi-drop mode: Address Detection and Generation
• Interrupt Generation
• Two Dedicated Peripheral Data Controller channels
• 5-, 6-, 7-, 8- and 9-bit character length
TC: Timer/Counter The AT91M42800A features two Timer/Counter blocks, each containing three identical
16-bit Timer/Counter channels. Each channel can be independently programmed to per-
form a wide range of functions including frequency measurement, event counting,
interval measurement, pulse generation, delay timing and pulse-width modulation.
Each Timer/Counter (TC) channel has 3 external clock inputs, 5 internal clock inputs,
and 2 multi-purpose input/output signals that can be configured by the user. Each chan-
nel drives an internal interrupt signal that can be programmed to generate processor
interrupts via the AIC (Advanced Interrupt Controller).
The Timer/Counter block has two global registers that act upon all three TC channels.
The Block Control Register allows the three channels to be started simultaneously with
the same instruction. The Block Mode Register defines the external clock inputs for
each Timer/Counter channel, allowing them to be chained.
Each Timer/Counter block operates independently and has a complete set of block and
channel registers.
SPI: Serial Peripheral The AT91M42800A includes two SPIs that provide communication with external devices
Interface in Master or Slave mode. They are independent, and are referred to by the letters A and
B. Each SPI has four external chip selects that can be connected to up to 15 devices.
The data length is programmable from 8- to 16-bit.
17
1779B–ATARM–03/02
Memory Map
Figure 4. AT91M42800A Memory Map before Remap Command
Address Function Size Protection(1) Abort Control
0xFFFFFFFF
On-chip
Peripherals 4M Bytes Privileged Yes
0xFFC00000
0xFFBFFFFF
Reserved
0x00400000
0x003FFFFF
0x00300000
0x002FFFFF
Reserved
On-chip 1M Byte No No
Device
0x00200000
0x001FFFFF
Reserved
1M Byte No No
On-chip
Device
0x00100000
0x000FFFFF
External
1M Byte No No
Devices Selected
by NCS0
0x00000000
Note: 1. The ARM core modes are defined in the ARM7TDMI Datasheet. Privileged is a non-user mode. The protection is active only
if Protect mode is enabled.
18 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
0xFFFFFFFF
0xFFC00000
0xFFBFFFFF
External Up to 8 Devices
Devices Programmable Page Size No Yes
(up to 8) 1, 4, 16, 64M Bytes
0x00400000
0x003FFFFF
Reserved 1M Byte No No
0x00300000
0x002FFFFF
Reserved
On-chip 1M Byte No No
Device
0x00200000
0x001FFFFF
Reserved
1M Byte No No
On-chip
Device
0x00100000
0x000FFFFF
0x00000000
Note: 1. The ARM core modes are defined in the ARM7TDMI Datasheet. Privileged is a non-user mode. The protection is active only
if Protect mode is enabled.
19
1779B–ATARM–03/02
Peripheral Memory Map
Figure 6. AT91M42800A Peripheral Memory Map
Address Peripheral Peripheral Name Size Protection
0xFFFFFFFF
AIC Advanced Interrupt Controller 4K Bytes Privileged
0xFFFFF000
0xFFFFEFFF
Reserved
0xFFFFC000
0xFFFFBFFF
ST System Timer 16K Bytes Privileged
0xFFFF8000
0xFFFF7FFF
PMC Power Management Controller 16K Bytes Privileged
0xFFFF4000
0xFFFF3FFF
PIOB Parallel I/O Controller B 16K Bytes Privileged
0xFFFF0000
0xFFFEFFFF
PIOA Parallel I/O Controller A 16K Bytes Privileged
0xFFFEC000
0xFFFEBFFF
Reserved
0xFFFD8000
0xFFFD7FFF
TC1 Timer Counter 1 16K Bytes Privileged
Channels 3, 4 and 5
0xFFFD4000
0xFFFD3FFF
TC0 Timer Counter 0 16K Bytes Privileged
Channels 0,1 and 2
0xFFFD0000
0xFFFCFFFF
SPIB Serial Peripheral Interface B 16K Bytes Privileged
0xFFFCC000
0xFFFCBFFF
SPIA Serial Peripheral Interface A 16K Bytes Privileged
0xFFFC8000
0xFFFC4000 Receiver/Transmitter 1
0xFFFC0000 Receiver/Transmitter 0
0xFFFBFFFF
Reserved
0xFFF04000
0xFFF03FFF
SF Special Function 16K Bytes Privileged
0xFFF00000
0xFFEFFFFF
Reserved
0xFFF04000
0xFFE03FFF
EBI External Bus Interface 16K Bytes Privileged
0xFFE00000
0xFFDFFFFF
Reserved
0xFFD00000
Note: 1. The ARM core modes are defined in the ARM7TDMI Datasheet. Privileged is a non-user mode. The protection is active only
if Protect mode is enabled.
20 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
EBI: External Bus The EBI handles the access requests performed by the ARM core or the PDC. It gener-
ates the signals that control the access to the external memory or peripheral devices.
Interface
The EBI is fully programmable and can address up to 64M bytes. It has eight chip
selects and a 24-bit address bus, the upper four bits of which are multiplexed with a chip
select.
The 16-bit data bus can be configured to interface with 8- or 16-bit external devices.
Separate read and write control signals allow for direct memory and peripheral
interfacing.
The EBI supports different access protocols allowing single clock cycle memory
accesses.
The main features are:
• External memory mapping
• Up to 8 chip select lines
• 8- or 16-bit data bus
• Byte write or byte select lines
• Remap of boot memory
• Two different read protocols
• Programmable wait state generation
• External wait request
• Programmable data float time
The EBI User Interface is described on page 48.
External Memory The memory map associates the internal 32-bit address space with the external 24-bit
Mapping address bus.
The memory map is defined by programming the base address and page size of the
external memories (see EBI User Interface registers EBI_CSR0 to EBI_CSR7). Note
that A0 - A23 is only significant for 8-bit memory; A1 - A23 is used for 16-bit memory.
If the physical memory device is smaller than the programmed page size, it wraps
around and appears to be repeated within the page. The EBI correctly handles any valid
access to the memory device within the page (see Figure 7).
In the event of an access request to an address outside any programmed page, an abort
signal is generated. Two types of abort are possible: instruction prefetch abort and data
a bort. Th e corre spon din g exce ption vector ad dresse s are 0 x000 000 0C an d
0x00000010, respectively. It is up to the system programmer to program the error han-
dling routine to use in case of an abort (see the ARM7TDMI datasheet for further
information).
The chip selects can be defined to the same base address and an access to the over-
lapping address space asserts both NCS lines. The Chip Select Register, having the
smaller number, defines the characteristics of the external access and the behaviour of
the control signals.
21
1779B–ATARM–03/02
Figure 7. External Memory Smaller than Page Size
Base + 4M Bytes
Hi
1M Byte Device Repeat 3
Low
Base + 3M Bytes
Hi
1M Byte Device Repeat 2
Low
Memory Base + 2M Bytes
Map
Hi
1M Byte Device Repeat 1
Low
Base + 1M Byte
Hi
1M Byte Device
Low
Base
Abort Status When an abort is generated, the EBI_AASR (Abort Address Status Register) and the
EBI_ASR (Abort Status Register) provide the details of the source causing the abort.
Only the last abort is saved and registers are left in the last abort status. After the reset,
the registers are initialized to 0.
The following are saved:
In EBI_AASR:
• The address at which the abort is generated
In EBI_ASR:
• Whether or not the processor has accessed an undefined address in the EBI
address space
• Whether or not the processor required an access at a misaligned address
• The size of the access (byte, word or half-word)
• The type of the access (read, write or code fetch)
EBI Behavior During When the ARM core performs accesses in the internal memories or the embedded
Internal Accesses peripherals, the EBI signals behave as follows:
• The address lines remain at the level of the last external access.
• The data bus is tri-stated.
• The control signals remain in an inactive state.
22 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
Pin Description
Table 6. External Bus Interface Pin Description
Name Description Type
A0 - A23 Address bus Output
D0 - D15 Data bus I/O
NCS0 - NCS3 Active low chip selects Output
CS4 - CS7 Active high chip selects Output
NRD Read Enable Output
NWR0 - NWR1 Lower and upper write enable Output
NOE Output enable Output
NWE Write enable Output
NUB, NLB Upper and lower byte select Output
NWAIT Wait request Input
PME Protection Mode Enabled Input
23
1779B–ATARM–03/02
Chip Select Lines The EBI provides up to eight chip select lines:
• Chip select lines NCS0 - NCS3 are dedicated to the EBI (not multiplexed).
• Chip select lines CS4 - CS7 are multiplexed with the top four address lines A23 -
A20.
By exchanging address lines for chip select lines, the user can optimize the EBI to suit
the external memory requirements: more external devices or larger address range for
each device.
The selection is controlled by the ALE field in EBI_MCR (Memory Control Register). The
following combinations are possible:
A20, A21, A22, A23 (configuration by default)
A20, A21, A22, CS4
A20, A21, CS5, CS4
A20, CS6, CS5, CS4
CS7, CS6, CS5, CS4
Notes: 1. For four external devices, the maximum address space per device is 16M bytes.
24 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
Notes: 1. For eight external devices, the maximum address space per device is 1M byte.
Data Bus Width A data bus width of 8 or 16 bits can be selected for each chip select. This option is con-
trolled by the DBW field in the EBI_CSR (Chip Select Register) for the corresponding
chip select.
Figure 10 shows how to connect a 512K x 8-bit memory on NCS2.
D0 - D7 D0 - D7
D8 - D15
A1 - A18 A1 - A18
EBI A0 A0
NWR1
NWR0 Write Enable
NRD Output Enable
NCS2 Memory Enable
25
1779B–ATARM–03/02
Figure 11. Memory Connection for a 16-bit Data Bus
D0 - D7 D0 - D7
D8 - D15 D8 - D15
A1 - A19 A0 - A18
EBI
NLB Low Byte Enable
NUB High Byte Enable
NWE Write Enable
NOE Output Enable
NCS2 Memory Enable
Byte Write or Byte Select Each chip select with a 16-bit data bus can operate with one of two different types of
Access write access:
• Byte Write Access supports two byte write and a single read signal.
• Byte Select Access selects upper and/or lower byte with two byte select lines, and
separate read and write signals.
This option is controlled by the BAT field in the EBI_CSR (Chip Select Register) for the
corresponding chip select.
Byte Write Access is used to connect 2 x 8-bit devices as a 16-bit memory page.
• The signal A0/NLB is not used.
• The signal NWR1/NUB is used as NWR1 and enables upper byte writes.
• The signal NWR0/NWE is used as NWR0 and enables lower byte writes.
• The signal NRD/NOE is used as NRD and enables half-word and byte reads.
Figure 12 shows how to connect two 512K x 8-bit devices in parallel on NCS2.
26 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
D0 - D7 D0 - D7
D8 - D15
A1 - A19 A0 - A18
EBI
A0
NWR1
NWR0 Write Enable
NRD Read Enable
NCS2 Memory Enable
D8 - D15
A0 - A18
Write Enable
Read Enable
Memory Enable
Figure 13. Connection for a 16-bit Data Bus with Byte and Half-word Access
D0 - D7 D0 - D7
D8 - D15 D8 - D15
A1 - A19 A0 - A18
EBI
NLB Low Byte Enable
NUB High Byte Enable
NWE Write Enable
NOE Output Enable
NCS2 Memory Enable
27
1779B–ATARM–03/02
Figure 14 shows how to connect a 16-bit device without byte access (e.g., Flash) on
NCS2.
Figure 14. Connection for a 16-bit Data Bus without Byte Write Capability
D0 - D7 D0 - D7
D8 - D15 D8 - D15
A1 - A19 A0 - A18
EBI
NLB
NUB
NWE Write Enable
NOE Output Enable
NCS2 Memory Enable
Boot on NCS0 Depending on the device and the BMS pin level during the reset, the user can select
either an 8-bit or 16-bit external memory device connected on NCS0 as the Boot mem-
ory. In this case, EBI_CSR0 (Chip Select Register 0) is reset at the following
configuration for chip select 0:
• 0 wait states (WSE = 0, NWS = 7)
• 8-bit or 16-bit data bus width, depending on BMS
Byte access type and number of data float time are set to Byte Write Access and 0,
respectively.
Before the remap command, the user can modify the chip select 0 configuration, pro-
gramming the EBI_CSR0 with the exact Boot memory characteristics. The base
address becomes effective after the remap command.
Warning: In the internal oscillator bypass mode described in “Operating Modes” on
page 11, the user must take the external oscillator frequency into account according to
the minimum access time on the boot memory device.
As illustration, the following table gives examples of oscillator frequency limits according
to the time access without using NWAIT pin at the boot.
28 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
Read Protocols The EBI provides two alternative protocols for external memory read access: standard
and early read. The difference between the two protocols lies in the timing of the NRD
(read cycle) waveform.
The protocol is selected by the DRP field in EBI_MCR (Memory Control Register) and is
valid for all memory devices. Standard read protocol is the default protocol after reset.
Note: In the following waveforms and descriptions, NRD represents NRD and NOE since the
two signals have the same waveform. Likewise, NWE represents NWE, NWR0 and
NWR1 unless NWR0 and NWR1 are otherwise represented. ADDR represents A0 - A23
and/or
A1 - A23.
Standard Read Protocol Standard read protocol implements a read cycle in which NRD and NWE are similar.
Both are active during the second half of the clock cycle. The first half of the clock cycle
allows time to ensure completion of the previous access as well as the output of address
and NCS before the read cycle begins.
During a standard read protocol, external memory access, NCS is set low and ADDR is
valid at the beginning of the access while NRD goes low only in the second half of the
master clock cycle to avoid bus conflict (see Figure 15).
MCKI
ADDR
NCS
NRD
or
NWE
NWE is the same in both protocols. NWE always goes low in the second half of the mas-
ter clock cycle (see Figure 17).
29
1779B–ATARM–03/02
Early Read Protocol Early read protocol provides more time for a read access from the memory by asserting
NRD at the beginning of the clock cycle. In the case of successive read cycles in the
same memory, NRD remains active continuously. Since a read cycle normally limits the
speed of operation of the external memory system, early read protocol can allow a
faster clock frequency to be used. However, an extra wait state is required in some
cases to avoid contentions on the external bus.
MCKI
ADDR
NCS
NRD
or
NWE
Early Read Wait State In early read protocol, an early read wait state is automatically inserted when an exter-
nal write cycle is followed by a read cycle to allow time for the write cycle to end before
the subsequent read cycle begins (see Figure 17). This wait state is generated in addi-
tion to any other programmed wait states (i.e., data float wait).
No wait state is added when a read cycle is followed by a write cycle, between consecu-
tive accesses of the same type or between external and internal memory accesses.
Early read wait states affect the external bus only. They do not affect internal bus timing.
MCKI
ADDR
NCS
NRD
NWE
30 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
Write Data Hold Time During write cycles in both protocols, output data becomes valid after the falling edge of
the NWE signal and remains valid after the rising edge of NWE, as illustrated in Figure
18. The external NWE waveform (on the NWE pin) is used to control the output data tim-
ing to guarantee this operation.
It is therefore necessary to avoid excessive loading of the NWE pins, which could delay
the write signal too long and cause a contention with a subsequent read cycle in stan-
dard protocol.
MCKI
ADDR
NWE
Data Output
In early read protocol the data can remain valid longer than in standard read protocol
due to the additional wait cycle which follows a write access.
31
1779B–ATARM–03/02
Wait States The EBI can automatically insert wait states. The different types of wait states are listed
below:
• Standard wait states
• Data float wait states
• External wait states
• Chip select change wait states
• Early Read wait states (as described in “Read Protocols” on page 29)
Standard Wait States Each chip select can be programmed to insert one or more wait states during an access
on the corresponding device. This is done by setting the WSE field in the corresponding
EBI_CSR. The number of cycles to insert is programmed in the NWS field in the same
register.
Below is the correspondence between the number of standard wait states programmed
and the number of cycles during which the NWE pulse is held low:
0 wait states 1/2 cycle
1 wait state 1 cycle
For each additional wait state programmed, an additional cycle is added.
MCKI
ADDR
NCS
NWE
32 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
Data Float Wait State Some memory devices are slow to release the external bus. For such devices, it is nec-
essary to add wait states (data float waits) after a read access before starting a write
access or a read access to a different external memory.
The data float output time (tDF) for each external memory device is programmed in the
TDF field of the EBI_CSR register for the corresponding chip select. The value (0 - 7
clock cycles) indicates the number of data float waits to be inserted and represents the
time allowed for the data output to go high impedance after the memory is disabled.
Data float wait states do not delay internal memory accesses. Hence, a single access to
an external memory with long tDF will not slow down the execution of a program from
internal memory.
The EBI keeps track of the programmed external data float time during internal
accesses, to ensure that the external memory system is not accessed while it is still
busy.
Internal memory accesses and consecutive accesses to the same external memory do
not have added data float wait states.
MCKI
ADDR
NCS
D0-D15
33
1779B–ATARM–03/02
External Wait The NWAIT input can be used to add wait states at any time. NWAIT is active low and is
detected on the rising edge of the clock.
If NWAIT is low at the rising edge of the clock, the EBI adds a wait state and changes
neither the output signals nor its internal counters and state. When NWAIT is de-
asserted, the EBI finishes the access sequence.
The NWAIT signal must meet setup and hold requirements on the rising edge of the
clock.
MCKI
ADDR
NWAIT
NCS
NWE
NRD (2)
(1)
34 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
Chip Select Change Wait A chip select wait state is automatically inserted when consecutive accesses are made
States to two different external memories (if no wait states have already been inserted). If any
wait states have already been inserted, (e.g., data float wait) then none are added.
MCKI
NCS1
NCS2
NWE
35
1779B–ATARM–03/02
Memory Access Figures 23 through 26 show examples of the two alternative protocols for external mem-
Waveforms ory read access.
Read Mem 2
tWHDX
Write Mem 2
Read Mem 2
change wait
chip select
Read Mem 1
tWHDX
Write Mem 1
Read Mem 1
MCKI
A0-A23
NRD
NWE
NCS1
NCS2
D0 - D15 (Mem1)
D0 - D15 (AT91)
D0 - D15 (Mem 2)
36 AT91M42800A
1779B–ATARM–03/02
1779B–ATARM–03/02
MCKI
A0 - A23
NRD
NWE
NCS2
AT91M42800A
D0 - D15 (Mem 1)
D0 - D15 (AT91)
D0 - D15 (Mem 2)
37
38
AT91M42800A
MCKI
A0 - A23
NRD
NWE
NCS1
NCS2
tDF tDF
D0 - D15 (Mem 1)
1779B–ATARM–03/02
D0 - D15 (AT91)
tWHDX tDF
D0 - 15 (Mem 2)
1779B–ATARM–03/02
MCKI
A0 - A23
NRD
NWE
NCS1
NCS2
AT91M42800A
tDF tDF
D0 - D15 (Mem 1)
D0 - D15 (AT91)
tWHDX tDF
D0 - D15 (Mem 2)
39
Figures 27 through 33 show the timing cycles and wait states for read and write access
to the various AT91M42800A external memory devices. The configurations described
are shown in the following table:
Table 8. Memory Access Waveforms
Figure Number Number of Wait States Bus Width Size of Data Transfer
27 0 16 Word
28 1 16 Word
29 1 16 Half-word
30 0 8 Word
31 1 8 Half-word
32 1 8 Byte
33 0 16 Byte
40 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
MCKI
NCS
NLB
NUB
READ ACCESS
· Standard Protocol
NRD
D0 - D15 B2 B1 B 4 B3
Internal Bus X X B 2 B1 B4 B 3 B2 B 1
· Early Protocol
NRD
D0 - D15 B 2 B1 B 4 B3
WRITE ACCESS
· Byte Write/
Byte Select Option NWE
D0 - D15 B2 B 1 B 4 B3
41
1779B–ATARM–03/02
Figure 28. 1 Wait State, 16-bit Bus Width, Word Transfer
MCKI
NCS
NLB
NUB
READ ACCESS
· Standard Protocol
NRD
D0 - D15 B2 B 1 B4 B 3
Internal Bus X X B2 B1 B4 B 3 B2 B 1
· Early Protocol
NRD
WRITE ACCESS
· Byte Write/
Byte Select Option
NWE
42 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
1 Wait State
MCKI
A1 - A23
NCS
NLB
NUB
READ ACCESS
· Standard Protocol
NRD
D0 - D15 B2 B1
Internal Bus X X B 2 B1
· Early Protocol
NRD
D0 - D15 B2 B1
WRITE ACCESS
· Byte Write/
Byte Select Option
NWE
D0 - D15 B 2 B1
43
1779B–ATARM–03/02
Figure 30. 0 Wait States, 8-bit Bus Width, Word Transfer
MCKI
NCS
READ ACCESS
· Standard Protocol
NRD
D0 - D15 X B1 X B2 X B3 X B4
Internal Bus X X X B1 X X B 2 B1 X B 3 B2 B 1 B 4 B 3 B2 B 1
· Early Protocol
NRD
D0 - D15 X B1 X B2 X B3 X B4
WRITE ACCESS
NWR0
NWR1
D0 - D15 X B1 X B2 X B3 X B4
44 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
MCKI
NCS
READ ACCESS
· Standard Protocol
NRD
D0 - D15 X B1 X B2
Internal Bus X X X B1 X X B 2 B1
· Early Protocol
NRD
D0 - D15 X B1 X B2
WRITE ACCESS
NWR0
NWR1
D0 - D15 X B1 X B2
45
1779B–ATARM–03/02
Figure 32. 1 Wait State, 8-bit Bus Width, Byte Transfer
1 Wait State
MCKI
A0 - A23
NCS
READ ACCESS
· Standard Protocol
NRD
D0 - D15 XB1
Internal Bus X X X B1
· Early Protocol
NRD
D0 - D15 X B1
WRITE ACCESS
NWR0
NWR1
D0 - D15 X B1
46 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
MCKI
NCS
NLB
NUB
READ ACCESS
· Standard Protocol
NRD
D0 - D15 X B1 B2X
· Early Protocol
NRD
WRITE ACCESS
NWR1
47
1779B–ATARM–03/02
EBI User Interface The EBI is programmed using the registers listed in Table 9. The Remap Control Regis-
ter (EBI_RCR) controls exit from Boot mode (see “Boot on NCS0” on page 28). The
Memory Control Register (EBI_MCR) is used to program the number of active chip
selects and data read protocol. Eight Chip Select Registers (EBI_CSR0 to EBI_CSR7)
are used to program the parameters for the individual external memories. Each
EBI_CSR must be programmed with a different base address, even for unused chip
selects.
The Abort Status registers indicate the access address (EBI_AASR) and the reason for
the abort (EBI_ASR).
Base Address: 0xFFE00000 (Code Label EBI_BASE)
48 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
31 30 29 28 27 26 25 24
BA
23 22 21 20 19 18 17 16
BA – – – –
15 14 13 12 11 10 9 8
– – CSEN BAT TDF PAGES
7 6 5 4 3 2 1 0
PAGES – WSE NWS DBW
49
1779B–ATARM–03/02
• PAGES: Page Size
PAGES Page Size Active Bits in Base Address Code Label: EBI_PAGES
0 0 1M Byte 12 Bits (31 - 20) EBI_PAGES_1M
0 1 4M Bytes 10 Bits (31 - 22) EBI_PAGES_4M
1 0 16M Bytes 8 Bits (31 - 24) EBI_PAGES_16M
1 1 64M Bytes 6 Bits (31 - 26) EBI_PAGES_64M
TDF Number of Cycles Added after the Transfer Code Label: EBI_TDF
0 0 0 0 EBI_TDF_0
0 0 1 1 EBI_TDF_1
0 1 0 2 EBI_TDF_2
0 1 1 3 EBI_TDF_3
1 0 0 4 EBI_TDF_4
1 0 1 5 EBI_TDF_5
1 1 0 6 EBI_TDF_6
1 1 1 7 EBI_TDF_7
50 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – RCB
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – DRP – ALE
ALE Valid Address Bits Maximum Addressable Space Valid Chip Select Code Label: EBI_ALE
0 X X A20, A21, A22, A23 16M Bytes None EBI_ALE_16M
1 0 0 A20, A21, A22 8M Bytes CS4 EBI_ALE_8M
1 0 1 A20, A21 4M Bytes CS4, CS5 EBI_ALE_4M
1 1 0 A20 2M Bytes CS4, CS5, CS6 EBI_ALE_2M
1 1 1 None 1M Byte CS4, CS5, CS6, CS7 EBI_ALE_1M
51
1779B–ATARM–03/02
• DRP: Data Read Protocol
52 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – PDC ARM ABTTYP ABTSZ
7 6 5 4 3 2 1 0
– – – – – – MISADD UNDADD
53
1779B–ATARM–03/02
Abort Address Status Register
Register Name: EBI_AASR
Access Type: Read-only
Offset: 0x34
Reset Value: 0x0
31 30 29 28 27 26 25 24
ABTADD
23 22 21 20 19 18 17 16
ABTADD
15 14 13 12 11 10 9 8
ABTADD
7 6 5 4 3 2 1 0
ABTADD
54 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
PMC: Power The AT91M42800A’s Power Management Controller optimizes the power consumption
of the device. The PMC controls the clocking elements such as the oscillator and the
Management
PLLs, and the System and the Peripheral Clocks. It also controls the MCKO pin and
Controller enables the user to select four different signals to be driven on this pin.
The AT91M42800A has the following clock elements:
• The oscillator, which provides a clock that depends on the crystal fundamental
frequency connected between the XIN and XOUT pins
• PLL A, which provides a low-to-middle frequency clock range
• PLL B, which provides a middle-to-high frequency range
• The Clock prescaler
• The System Clock controller
• The Peripheral Clock controller
• The Master Clock Output controller
The on-chip low-power oscillator together with the PLL-based frequency multiplier and
the prescaler results in a programmable clock between 500 Hz and 66 MHz. It is the
responsibility of the user to make sure that the PMC programming does not result in a
clock over the acceptable limits.
PLLRCB PLLB
Peripheral
Clocks
User Interface
APB Bus
55
1779B–ATARM–03/02
Oscillator and Slow The integrated oscillator generates the Slow Clock. It is designed for use with a 32.768
Clock kHz fundamental crystal. A 38.4 kHz crystal can be used. The bias resistor is on-chip
and the oscillator integrates an equivalent load capacitance equal to 10 pF.
XIN 32 kHz
Oscillator
XOUT SLCK
Slow Clock
To operate correctly, the crystal must be as close to the XIN and XOUT pins as possi-
ble. An external variable capacitor can be added to adjust the oscillator frequency.
GND
GROUND
PLANE
C
XIN
XOUT
Master Clock The Master Clock (MCK) is generated from the Slow Clock by means of one of the two
integrated PLLs and the prescaler.
PLLCOUNT
PLLRCA
PLL Lock Timer
PLLA PLLS(1) Lock
MUL
PLLB
SLCK Prescaler
MCK
Slow Clock Master Clock
Source
Clock
56 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
Phase Locked Loops Two PLLs are integrated in the AT91M42800A in order to cover a larger frequency
range. Both PLLs have a Slow Clock input and a dedicated pin (PLLRCA or PLLRCB),
which must have appropriate capacitors and resistors. The capacitors and resistors
serve as a second order filter. The PLLRC pin (A or B) that corresponds to the PLL that
is disabled may be grounded if capacitors and resistors need to be saved.
PLLRC
PLL
C2
GND
With these parameters, the output frequency is stable (±10%) in 600 µs. This settling
time is the value to be programmed in the PLLCOUNT field of PMC_CGMR. The maxi-
mum frequency overshoot during this phase is 22.5 MHz.
PLLB:
FSCLK = 32.768 kHz
Fout_PLLB = 33.554 MHz
R = 800 Ohm
C = 1 µF
C2 = 100 nF
With these parameters, the output frequency is stable (±10%) in 4 ms. This settling time
is the value to be programmed in the PLLCOUNT field of PMC_CGMR. The maximum
frequency overshoot during this phase is 38 MHz.
PLL Selection The required PLL must be selected at the first writing access and cannot be changed
after that. The PLLS bit in PMC_CGMR (Clock Generator Mode Register) determines
which PLL module is activated. The other PLL is disabled in order to reduce power con-
sumption and can only be activated by another reset. Writing in PMC_CGMR with a
different value has no effect.
57
1779B–ATARM–03/02
Source Clock Selection The bit CSS in PMC_CGMR selects the Slow Clock or the output of the activated PLL
as the Source Clock of the prescaler. After reset, the CSS field is 0, selecting the Slow
Clock as Source Clock.
When switching from Slow Clock to PLL Output, the Source Clock takes effect after 3
Slow Clock cycles plus 2.5 PLL output signal cycles. This is a maximum value.
When switching from PLL Output to Slow Clock, the switch takes effect after 3.5 Slow
Clock cycles plus 2.5 PLL output signal cycles. This is a maximum value.
PLL Programming Once the PLL is selected, the output of the active PLL is a multiple of the Slow Clock,
determined by the MUL field of the PMC_CGMR. The value of the multiply factor can be
up to 2048. The multiplication factor is the programmed value plus one (MUL+1).
Each time PMC_CGMR is written with a MUL value different from the existing one, the
LOCK bit in PMC_SR is automatically cleared and the PLL Lock Timer is started (see
PLL Lock Timer). The LOCK bit is set when the PLL Lock Timer reaches 0.
If a null value is programmed in the MUL field, the PLL is automatically disabled and
bypassed to save power. The LOCK bit in PMC_SR is also automatically cleared.
The time during which the LOCK bit is cleared is user programmable in the field
PLLCOUNT in PMC_CGMR. The user must load this parameter with a value depending
on the active PLL and its start-up time or the frequency shift performed.
As long as the LOCK bit is 0, the PLL is automatically bypassed and its output is the
Slow Clock. This means:
• A switch from the PLL output to the Slow Clock and the associated delays, when the
PLL is locked.
• A switch from the Slow Clock to the PLL output and the associated delays, when the
LOCK bit is set.
PLL Lock Timer The Power Management Controller of the AT91M42800A integrates a dedicated 8-bit
timer for the locking time of the PLL. This timer is loaded with the value written in
PLLCOUNT each time the value in the field MUL changes. At the same time, the LOCK
bit in PMC_SR is cleared, and the PLL is bypassed.
The timer counts down the value written in PLLCOUNT on the Slow Clock. The count-
down value ranges from 30 µs to 7.8 ms.
When the PLL Lock Timer reaches 0, the LOCK bit is set and can provide an interrupt.
The PLLCOUNT field is defined by the user, and depends on the current state of the
PLL (unlocked or locked), the targeted output frequency and the filter implemented on
the PLLRC pin.
Prescaler The Clock Source (Slow Clock or PLL output) selected through the CSS field (Clock
Source Select) in PMC_CGMR can be divided by 1, 2, 4, 8, 16, 32 or 64. The default
divider after a reset is 1. The output of the prescaler is called Master Clock (MCK).
When the prescaler value is modified, the new defined Master Clock is effective after a
maximum delay of 64 Source Clock cycles.
58 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
Master Clock Output The clock output on MCKO pin can be selected to be the Slow Clock, the Master Clock,
Controller the Master Clock inverted or the Master Clock divided by two through the MCKOSS field
(Master Clock Output Source Select) in PMC_CGMR. The MCKO pad can be put in Tri-
state mode to save power consumption by setting the bit MCKODS (Master Clock Out-
put Disable) in PMC_CGMR. After a reset the MCKO pin is enabled and is driven by the
Slow Clock.
MCKOSS
SLCK
Slow Clock MCKODS
MCKO
Master Clock Output
MCK
Master Clock Divide by 2
ARM Processor Clock The AT91M42800A has only one System Clock. It can be enabled and disabled by writ-
Controller ing the System Clock Enable (PMC_SCER) and System Clock Disable Registers
(PMC_SCDR). The status of this clock (at least for debug purpose) can be read in the
System Clock Status Register (PMC_SCSR).
The system clock is enabled after a reset and is automatically re-enabled by any
enabled interrupt.
When the system clock is disabled, the current instruction is finished before the clock is
stopped.
Note: Stopping the ARM core does not prevent PDC transfers.
PMC_SCDR
Set
PMC_SCSR
Idle
Mode System
Register Clock
NIRQ Clear
NFIQ MCK
Master Clock
59
1779B–ATARM–03/02
Peripheral Clock The clock of each peripheral integrated in the AT91M42800A can be individually
Controller enabled and disabled by writing into the Peripheral Clock Enable (PMC_PCER) and
Peripheral Clock Disable (PMC_PCDR) registers. The status of the peripheral clock
activity can be read in the Peripheral Clock Status Register (PMC_PCSR).
When a peripheral clock is disabled, the clock is immediately stopped. When the clock is
re-enabled, the peripheral resumes action where it left off. The peripheral clocks are
automatically disabled after a reset.
In order to stop a peripheral, it is recommended that the system software waits until the
peripheral has executed its last programmed operation before disabling the clock. This
is to avoid data corruption or erroneous behavior of the system.
Note: The bits defined to control the Peripheral Clocks correspond to the bits controlling the
Interrupt Sources in the Interrupt Controller.
Peripheral
PMC_PCER
Clock X
Set
PMC_PCSR
Y X
Clear
PMC_PCDR
60 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
61
1779B–ATARM–03/02
PMC System Clock Enable Register
Register Name: PMC_SCER
Access Type: Write-only
Offset: 0x00
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – CPU
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – CPU
62 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – CPU
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– PIOB PIOA – TC5 TC4 TC3 TC2
7 6 5 4 3 2 1 0
TC1 TC0 SPIB SPIA US1 US0 – –
63
1779B–ATARM–03/02
PMC Peripheral Clock Disable Register
Register Name: PMC_PCDR
Access Type: Write-only
Offset: 0x14
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– PIOB PIOA – TC5 TC4 TC3 TC2
7 6 5 4 3 2 1 0
TC1 TC0 SPIB SPIA US1 US0 – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– PIOB PIOA – TC5 TC4 TC3 TC2
7 6 5 4 3 2 1 0
TC1 TC0 SPIB SPIA US1 US0 – –
64 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
23 22 21 20 19 18 17 16
– – – – – MUL
15 14 13 12 11 10 9 8
MUL
7 6 5 4 3 2 1 0
CSS MCKODS MCKOSS PLLS PRES
65
1779B–ATARM–03/02
• CSS: Clock Source Selection
0 = The clock source is the Slow Clock.
1 = The clock source is the output of the PLL.
• MUL: Phase Lock Loop Factor
0 = The PLL is disabled, reducing at the minimum its power consumption.
1 up to 2047 = The PLL output is at frequency (MUL+1) x Slow Clock frequency when the LOCK bit is set.
• PLLCOUNT: PLL Lock Counter
Specifies the number of 32,768 Hz clock cycles for the PLL lock timer to count before the PLL is locked, after the PLL is
started.
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – LOCK
66 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – LOCK
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – LOCK
67
1779B–ATARM–03/02
PMC Interrupt Mask Register
Register Name: PMC_IMR
Access Type: Read-only
Offset: 0x3C
Reset Value: 0x0
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – LOCK
68 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
ST: System Timer The System Timer module integrates three different free-running timers:
• A Period Interval Timer setting the base time for an Operating System.
• A Watchdog Timer having capabilities to reset the system in case of software
deadlock.
• A Real-time Timer counting elapsed seconds.
These timers count using the Slow Clock. Typically, this clock has a frequency of 32.768
kHz.
APB NWDOVF
Interface
PIT: Period Interval Timer The Period Interval Timer can be used to provide periodic interrupts for use by operating
systems. It is built around a 16-bit down counter, which is preloaded by a value pro-
grammed in ST_PIMR (Period Interval Mode Register). When the PIT counter reaches
0, the bit PITS is set in ST_SR (Status Register), and an interrupt is generated, if it is
enabled.
The counter is then automatically reloaded and restarted. Writing to the ST_PIMR at any
time immediately reloads and restarts the down counter with the new programmed
value.
16-bit
Down Counter
SLCK PITS
Slow Clock Period Interval
Timer Status
Note: If ST_PIMR is programmed with a period less or equal to the current MCK period, the
update of the PITS status bit and its associated interrupt generation are unpredictable.
WDT: Watchdog Timer The Watchdog Timer can be used to prevent system lock-up if the software becomes
trapped in a deadlock.
It is built around a 16-bit down counter loaded with the value defined in ST_WDMR
(Watchdog Mode Register). It uses the Slow Clock divided by 128. This allows the max-
imum watchdog period to be 256 seconds (with a typical Slow Clock of 32.768 kHz).
In normal operation, the user reloads the watchdog at regular intervals before the timer
overflow occurs. This is done by writing to the ST_CR (Control Register) with the bit
WDRST set.
69
1779B–ATARM–03/02
If an overflow does occur, the Watchdog Timer:
• Sets the WDOVF in ST_SR (Status Register) from which an interrupt can be
generated
• Generates a pulse for 8 slow clock cycles on the external signal NWDOVF if the bit
EXTEN in ST_WDMR is set
• Generates an internal reset if the parameter RSTEN in ST_WDMR is set
• Reloads and restarts the down counter
Writing the ST_WDMR does not reload or restart the down counter. When the ST_CR is
written the watchdog is immediately reloaded from ST_WDMR and restarted. The slow
clock 128 divider is also immediately reset and restarted. When the ARM7TDMI enters
debug mode, the output of the slow clock divider stops, preventing any internal or exter-
nal reset during the debugging phase.
NWDOVF
RTT: Real-time Timer The Real-time Timer can be used to count elapsed seconds. It is built around a 20-bit
counter fed by the Slow Clock divided by a programmable value. At reset this value is
set to 0x8000, corresponding to feeding the real-time counter with a 1 Hz signal when
the Slow Clock is 32.768 Hz. The 20-bit counter can count up to 1048576 seconds, cor-
responding to more than 12 days, then roll over to 0.
The Real-time Timer value can be read at any time in the register ST_CRTR (Current
Real-time Register). As this value can be updated asynchronously to the Master Clock,
it is advisable to read this register twice at the same value to improve accuracy of the
returned value.
This current value of the counter is compared with the value written in the Alarm Regis-
ter ST_RTAR (Real-time Alarm Register). If the counter value matches the alarm, the bit
ALMS in ST_SR is set. The Alarm Register is set to its maximum value, corresponding
to 0, after a reset.
The bit RTTINC in ST_SR is set each time the 20-bit counter is incremented. This bit
can be used to start an interrupt, or generate a one-second signal.
Writing the ST_RTMR immediately reloads and restarts the clock divider with the new
programmed value. This also resets the 20-bit counter.
70 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
16-bit
SLCK Divider RTTINC
Slow Clock Real-time Timer
20-bit Increment
Counter
=
ALMS
ALMV Alarm Status
Alarm Value
Note: If RTPRES is programmed with a period less or equal to the current MCK period, the
update of the RTTINC and ALMS status bits and their associated interrupt generation are
unpredictable.
71
1779B–ATARM–03/02
System Timer User Interface
System Timer Base Address: 0xFFFF8000
72 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – WDRST
73
1779B–ATARM–03/02
System Timer Period Interval Mode Register
Register Name: ST_PIMR
Access Type: Read/Write
Offset: 0x04
Reset Value: 0x0
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
PIV
7 6 5 4 3 2 1 0
PIV
23 22 21 20 19 18 17 16
– – – – – – EXTEN RSTEN
15 14 13 12 11 10 9 8
WDV
7 6 5 4 3 2 1 0
WDV
74 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
RTPRES
7 6 5 4 3 2 1 0
RTPRES
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – ALMS RTTINC WDOVF PITS
75
1779B–ATARM–03/02
System Timer Interrupt Enable Register
Register Name: ST_IER
Access Type: Write-only
Offset: 0x14
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – ALMS RTTINC WDOVF PITS
76 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – ALMS RTTINC WDOVF PITS
77
1779B–ATARM–03/02
System Timer Interrupt Mask Register
Register Name: ST_IMR
Access Type: Read-only
Offset: 0x1C
Reset Value: 0x0
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – ALMS RTTINC WDOVF PITS
23 22 21 20 19 18 17 16
ALMV
15 14 13 12 11 10 9 8
ALMV
7 6 5 4 3 2 1 0
ALMV
78 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
23 22 21 20 19 18 17 16
CRTV
15 14 13 12 11 10 9 8
CRTV
7 6 5 4 3 2 1 0
CRTV
79
1779B–ATARM–03/02
AIC: Advanced The AT91M42800A has an 8-level priority, individually maskable, vectored interrupt
controller. This feature substantially reduces the software and real-time overhead in
Interrupt Controller
handling internal and external interrupts.
The interrupt controller is connected to the NFIQ (fast interrupt request) and the NIRQ
(standard interrupt request) inputs of the ARM7TDMI processor. The processor’s NFIQ
line can only be asserted by the external fast interrupt request input: FIQ. The NIRQ line
can be asserted by the interrupts generated by the on-chip peripherals and the external
interrupt request lines: IRQ0 to IRQ3.
The 8-level priority encoder allows the customer to define the priority between the differ-
ent NIRQ interrupt sources.
Internal sources are programmed to be level sensitive or edge triggered. External
sources can be programmed to be positive or negative edge triggered or high- or low-
level sensitive.
The interrupt sources are listed in Table 12 and the AIC programmable registers in
Table 13.
Note: After a hardware reset, the external interrupt sources pins are controlled by the Controller. They must be configured to be con-
trolled by the peripheral before being used.
80 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
81
1779B–ATARM–03/02
Hardware Interrupt The hardware interrupt vectoring reduces the number of instructions to reach the inter-
Vectoring rupt handler to only one. By storing the following instruction at address 0x00000018, the
processor loads the program counter with the interrupt handler address stored in the
AIC_IVR register. Execution is then vectored to the interrupt handler corresponding to
the current interrupt.
ldr PC,[PC,# -&F20]
The current interrupt is the interrupt with the highest priority when the Interrupt Vector
Register (AIC_IVR) is read. The value read in the AIC_IVR corresponds to the address
stored in the Source Vector Register (AIC_SVR) of the current interrupt. Each interrupt
source has its corresponding AIC_SVR. In order to take advantage of the hardware
interrupt vectoring it is necessary to store the address of each interrupt handler in the
corresponding AIC_SVR, at system initialization.
Priority Controller The NIRQ line is controlled by an 8-level priority encoder. Each source has a program-
mable priority level of 7 to 0. Level 7 is the highest priority and level 0 the lowest.
When the AIC receives more than one unmasked interrupt at a time, the interrupt with
the highest priority is serviced first. If both interrupts have equal priority, the interrupt
with the lowest interrupt source number (see Table 12) is serviced first.
The current priority level is defined as the priority level of the current interrupt at the time
the register AIC_IVR is read (the interrupt which will be serviced).
In the case when a higher priority unmasked interrupt occurs while an interrupt already
exists, there are two possible outcomes depending on whether the AIC_IVR has been
read.
• If the NIRQ line has been asserted but the AIC_IVR has not been read, then the
processor will read the new higher priority interrupt handler address in the AIC_IVR
register and the current interrupt level is updated.
• If the processor has already read the AIC_IVR then the NIRQ line is reasserted.
When the processor has authorized nested interrupts to occur and reads the
AIC_IVR again, it reads the new, higher priority interrupt handler address. At the
same time the current priority value is pushed onto a first-in last-out stack and the
current priority is updated to the higher priority.
When the end of interrupt command register (AIC_EOICR) is written, the current inter-
rupt level is updated with the last stored interrupt level from the stack (if any). Hence at
the end of a higher priority interrupt, the AIC returns to the previous state corresponding
to the preceding lower priority interrupt which had been interrupted.
Interrupt Handling The interrupt handler must read the AIC_IVR as soon as possible. This de-asserts the
NIRQ request to the processor and clears the interrupt in case it is programmed to be
edge triggered. This permits the AIC to assert the NIRQ line again when a higher priority
unmasked interrupt occurs.
At the end of the interrupt service routine, the end of interrupt command register
(AIC_EOICR) must be written. This allows pending interrupts to be serviced.
Interrupt Masking Each interrupt source, including FIQ, can be enabled or disabled using the command
registers AIC_IECR and AIC_IDCR. The interrupt mask can be read in the Read-only
register AIC_IMR. A disabled interrupt does not affect the servicing of other interrupts.
82 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
Interrupt Clearing and All interrupt sources which are programmed to be edge triggered (including FIQ) can be
Setting individually set or cleared by respectively writing to the registers AIC_ISCR and
AIC_ICCR. This function of the interrupt controller is available for auto-test or software
debug purposes.
Fast Interrupt Request The external FIQ line is the only source which can raise a fast interrupt request to the
processor. Therefore, it has no priority controller.
The external FIQ line can be programmed to be positive or negative edge triggered or
high- or low-level sensitive in the AIC_SMR0 register.
The fast interrupt handler address can be stored in the AIC_SVR0 register. The value
written into this register is available by reading the AIC_FVR register when an FIQ inter-
rupt is raised. By storing the following instruction at address 0x0000001C, the processor
will load the program counter with the interrupt handler address stored in the AIC_FVR
register.
ldr PC,[PC,# -&F20]
Alternatively the interrupt handler can be stored starting from address 0x0000001C as
described in the ARM7TDMI datasheet.
Software Interrupt Interrupt source 1 of the advanced interrupt controller is a software interrupt. It must be
programmed to be edge triggered in order to set or clear it by writing to the AIC_ISCR
and AIC_ICCR.
This is totally independent of the SWI instruction of the ARM7TDMI processor.
Spurious Interrupt When the AIC asserts the NIRQ line, the ARM7TDMI enters IRQ mode and the interrupt
handler reads the IVR. It may happen that the AIC de-asserts the NIRQ line after the
core has taken into account the NIRQ assertion and before the read of the IVR.
This behavior is called a Spurious Interrupt.
The AIC is able to detect these Spurious Interrupts and returns the Spurious Vector
when the IVR is read. The Spurious Vector can be programmed by the user when the
vector table is initialized.
A spurious interrupt may occur in the following cases:
• With any sources programmed to be level sensitive, if the interrupt signal of the AIC
input is de-asserted at the same time as it is taken into account by the ARM7TDMI.
• If an interrupt is asserted at the same time as the software is disabling the
corresponding source through AIC_IDCR (this can happen due to the pipelining of
the ARM core).
The same mechanism of spurious interrupt occurs if the ARM7TDMI reads the IVR
(application software or ICE) when there is no interrupt pending. This mechanism is also
valid for the FIQ interrupts.
Once the AIC enters the spurious interrupt management, it asserts neither the NIRQ nor
the NFIQ lines to the ARM7TDMI as long as the spurious interrupt is not acknowledged.
Therefore, it is mandatory for the Spurious Interrupt Service Routine to acknowledge the
“spurious” behavior by writing to the AIC_EOICR (End of Interrupt) before returning to
the interrupted software. It also can perform other operation(s), e.g., trace possible
undesirable behavior.
83
1779B–ATARM–03/02
Protect Mode The Protect Mode permits reading of the Interrupt Vector Register without performing
the associated automatic operations. This is necessary when working with a debug
system.
When a Debug Monitor or an ICE reads the AIC User Interface, the IVR could be read.
This would have the following consequences in normal mode.
• If an enabled interrupt with a higher priority than the current one is pending, it is
stacked.
• If there is no enabled pending interrupt, the spurious vector is returned.
In either case, an End of Interrupt command would be necessary to acknowledge and to
restore the context of the AIC. This operation is generally not performed by the debug
system. Hence the debug system would become strongly intrusive, and could cause the
application to enter an undesired state.
This is avoided by using Protect mode.
The Protect mode is enabled by setting the AIC bit in the SF Protect Mode Register (see
“SF: Special Function Registers” on page 116).
When Protect mode is enabled, the AIC performs interrupt stacking only when a write
access is performed on the AIC_IVR. Therefore, the Interrupt Service Routines must
write (arbitrary data) to the AIC_IVR just after reading it.
The new context of the AIC, including the value of the Interrupt Status Register
(AIC_ISR), is updated with the current interrupt only when IVR is written.
An AIC_IVR read on its own (e.g., by a debugger), modifies neither the AIC context nor
the AIC_ISR.
Extra AIC_IVR reads performed in between the read and the write can cause unpredict-
able results. Therefore, it is strongly recommended not to set a breakpoint between
these two actions, nor to stop the software.
The debug system must not write to the AIC_IVR as this would cause undesirable
effects.
The following table shows the main steps of an interrupt and the order in which they are
performed according to the mode:
84 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
85
1779B–ATARM–03/02
AIC Source Mode Register
Register Name: AIC_SMR0..AIC_SMR31
Access Type: Read/Write
Reset Value: 0
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– SRCTYPE – – PRIOR
86 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
23 22 21 20 19 18 17 16
VECTOR
15 14 13 12 11 10 9 8
VECTOR
7 6 5 4 3 2 1 0
VECTOR
87
1779B–ATARM–03/02
AIC Interrupt Vector Register
Register Name: AIC_IVR
Access Type: Read-only
Offset: 0x100
31 30 29 28 27 26 25 24
IRQV
23 22 21 20 19 18 17 16
IRQV
15 14 13 12 11 10 9 8
IRQV
7 6 5 4 3 2 1 0
IRQV
31 30 29 28 27 26 25 24
FIQV
23 22 21 20 19 18 17 16
FIQV
15 14 13 12 11 10 9 8
FIQV
7 6 5 4 3 2 1 0
FIQV
88 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
31 30 29 28 27 26 25 24
– – – –– – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – IRQID
89
1779B–ATARM–03/02
AIC Interrupt Pending Register
Register Name: AIC_IPR
Access Type: Read-only
Offset: 0x10C
31 30 29 28 27 26 25 24
IRQ0 IRQ1 IRQ2 IRQ3 – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
PMC PIOB PIOA ST TC5 TC4 TC3 TC2
7 6 5 4 3 2 1 0
TC1 TC0 SPIB SPIA US1 US0 SW FIQ
• Interrupt Pending
0 = Corresponding interrupt is inactive.
1 = Corresponding interrupt is pending.
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
PMC PIOB PIOA ST TC5 TC4 TC3 TC2
7 6 5 4 3 2 1 0
TC1 TC0 SPIB SPIA US1 US0 SW FIQ
• Interrupt Mask
0 = Corresponding interrupt is disabled.
1 = Corresponding interrupt is enabled.
90 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – NIRQ NFIQ
31 30 29 28 27 26 25 24
IRQ0 IRQ1 IRQ2 IRQ3 – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
PMC PIOB PIOA ST TC5 TC4 TC3 TC2
7 6 5 4 3 2 1 0
TC1 TC0 SPIB SPIA US1 US0 SW FIQ
• Interrupt Enable
0 = No effect.
1 = Enables corresponding interrupt.
91
1779B–ATARM–03/02
AIC Interrupt Disable Command Register
Register Name: AIC_IDCR
Access Type: Write-only
Offset: 0x124
31 30 29 28 27 26 25 24
IRQ0 IRQ1 IRQ2 IRQ3 – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
PMC PIOB PIOA ST TC5 TC4 TC3 TC2
7 6 5 4 3 2 1 0
TC1 TC0 SPIB SPIA US1 US0 SW FIQ
• Interrupt Disable
0 = No effect.
1 = Disables corresponding interrupt.
92 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
31 30 29 28 27 26 25 24
IRQ0 IRQ1 IRQ2 IRQ3 – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
PMC PIOB PIOA ST TC5 TC4 TC3 TC2
7 6 5 4 3 2 1 0
TC1 TC0 SPIB SPIA US1 US0 SW FIQ
• Interrupt Clear
0 = No effect.
1 = Clears corresponding interrupt.
31 30 29 28 27 26 25 24
IRQ0 IRQ1 IRQ2 IRQ3 – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
PMC PIOB PIOA ST TC5 TC4 TC3 TC2
7 6 5 4 3 2 1 0
TC1 TC0 SPIB SPIA US1 US0 SW FIQ
• Interrupt Set
0 = No effect.
1 = Sets corresponding interrupt.
93
1779B–ATARM–03/02
AIC End of Interrupt Command Register
Register Name: AIC_EOICR
Access Type: Write-only
Offset: 0x130
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – –
The End of Interrupt Command Register is used by the interrupt routine to indicate that the interrupt treatment is complete.
Any value can be written because it is only necessary to make a write to this register location to signal the end of interrupt
treatment.
23 22 21 20 19 18 17 16
SPUVEC
15 14 13 12 11 10 9 8
SPUVEC
7 6 5 4 3 2 1 0
SPUVEC
94 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
95
1779B–ATARM–03/02
9. The SPSR (SPSR_irq) is restored. Finally, the saved value of the Link Register is
restored directly into the PC. This has effect of returning from the interrupt to
whatever was being executed before, and of loading the CPSR with the stored
SPSR, masking or unmasking the interrupts depending on the state saved in the
SPSR (the previous state of the ARM core).
Note: The I-bit in the SPSR is significant. If it is set, it indicates that the ARM core was just
about to mask IRQ interrupts when the mask instruction was interrupted. Hence, when
the SPSR is restored, the mask instruction is completed (IRQ is masked).
96 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
97
1779B–ATARM–03/02
PIO: Parallel I/O The AT91M42800A has 54 programmable I/O lines. I/O lines are multiplexed with an
external signal of a peripheral to optimize the use of available package pins (see Tables
Controller
14 and 15). These lines are controlled by two separate and identical PIO Controllers
called PIOA and PIOB. Each PIO controller also provides an internal interrupt signal to
the Advanced Interrupt Controller.
Note: After a hardware reset, the PIO clock is disabled by default (see Power Management
Controller on page 55). The user must configure the Power Management Controller
before any access to the User Interface of the PIO.
Multiplexed I/O Lines When a peripheral signal is not used in an application, the corresponding pin can be
used as a parallel I/O. Each parallel I/O line is bi-directional, whether the peripheral
defines the signal as input or output. Figure 47 shows the multiplexing of the peripheral
signals with Parallel I/O signals.
A pin is controlled by the registers PIO_PER (PIO Enable) and PIO_PDR (PIO Disable).
The register PIO_PSR (PIO Status) indicates whether the pin is controlled by the corre-
sponding peripheral or by the PIO Controller.
When the PIO is selected, the peripheral input line is connected to zero.
Output Selection The user can enable each individual I/O signal as an output with the registers PIO_OER
(Output Enable) and PIO_ODR (Output Disable). The output status of the I/O signals
can be read in the register PIO_OSR (Output Status). The direction defined has effect
only if the pin is configured to be controlled by the PIO Controller.
I/O Levels Each pin can be configured to be driven high or low. The level is defined in four different
ways, according to the following conditions.
• If a pin is controlled by the PIO Controller and is defined as an output (see Output
Selection above), the level is programmed using the registers PIO_SODR (Set
Output Data) and PIO_CODR (Clear Output Data). In this case, the programmed
value can be read in PIO_ODSR (Output Data Status).
• If a pin is controlled by the PIO Controller and is not defined as an output, the level is
determined by the external circuit.
• If a pin is not controlled by the PIO Controller, the state of the pin is defined by the
peripheral (see peripheral datasheets).
In all cases, the level on the pin can be read in the register PIO_PDSR (Pin Data
Status).
Filters Optional input glitch filtering is available on each pin and is controlled by the registers
PIO_IFER (Input Filter Enable) and PIO_IFDR (Input Filter Disable). The input glitch fil-
tering can be selected whether the pin is used for its peripheral function or as a parallel
I/O line. The register PIO_IFSR (Input Filter Status) indicates whether or not the filter is
activated for each pin.
Interrupts Each parallel I/O can be programmed to generate an interrupt when a level change
occurs. This is controlled by the PIO_IER (Interrupt Enable) and PIO_IDR (Interrupt Dis-
able) registers which enable/disable the I/O interrupt by setting/clearin g the
corresponding bit in the PIO_IMR. When a change in level occurs, the corresponding bit
in the PIO_ISR (Interrupt Status) is set whether the pin is used as a PIO or a peripheral
and whether it is defined as input or output. If the corresponding interrupt in PIO_IMR
(Interrupt Mask) is enabled, the PIO interrupt is asserted.
When PIO_ISR is read, the register is automatically cleared.
98 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
User Interface Each individual I/O is associated with a bit position in the Parallel I/O user interface reg-
isters. Each of these registers are 32 bits wide. If a parallel I/O line is not defined, writing
to the corresponding bits has no effect. Undefined bits read zero.
Multi-driver (Open Drain) Each I/O can be programmed for multi-driver option. This means that the I/O is config-
ured as open drain (can only drive a low level) in order to support external drivers on the
same pin. An external pull-up is necessary to guarantee a logic level of one when the
pin is not being driven.
Registers PIO_MDER (Multi-Driver Enable) and PIO_MDDR (Multi-Driver Disable) con-
trol this option. Multi-driver can be selected whether the I/O pin is controlled by the PIO
Controller or the peripheral. PIO_MDSR (Multi-Driver Status) indicates which pins are
configured to support external drivers.
99
1779B–ATARM–03/02
Figure 47. Parallel I/O Multiplexed with a Bi-directional Signal
PIO_OSR
1
Pad Output Enable
Peripheral
0
0 Output
Enable
1 PIO_PSR
PIO_ODSR
PIO_MDSR
1
Pad Output
Peripheral
0
Pad Output
Pad Input
Filter 1
0
Peripheral
0
Input
OFF 1
Value(1)
PIO_IFSR
PIO_PSR
PIO_PDSR
Event
Detection
PIO_ISR
PIO_IMR
PIOIRQ
100 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
101
1779B–ATARM–03/02
Table 15. PIO Controller B Connection Table
PIO Controller Peripheral
Bit Port Signal OFF(1) Pin
Number Name Port Name Signal Description Direction Value Reset State Number
0 PB0 NCS2 Chip Select 2 Output – NCS2 141
1 PB1 NCS3 Chip Select 3 Output – NCS3 142
2 PB2 A20/CS7 Address 20/Chip Select 7 Output – A20 27
3 PB3 A21/CS6 Address 21/Chip Select 6 Output – A21 28
4 PB4 A22/CS5 Address 22/Chip Select 5 Output – A22 29
5 PB5 A23/CS4 Address 23/Chip Select 4 Output – A23 30
6 PB6 TCLK0 Timer0 Clock Signal Input 0 PIO Input 53
7 PB7 TIOA0 Timer0 Signal A Bi-directional 0 PIO Input 54
8 PB8 TIOB0 Timer0 Signal B Bi-directional 0 PIO Input 55
9 PB9 TCLK1 Timer1 Clock Signal Input 0 PIO Input 56
10 PB10 TIOA1 Timer1 Signal A Bi-directional 0 PIO Input 57
11 PB11 TIOB1 Timer1 Signal B Bi-directional 0 PIO Input 58
12 PB12 TCLK2 Timer2 Clock Signal Input 0 PIO Input 59
13 PB13 TIOA2 Timer2 Signal A Bi-directional 0 PIO Input 62
14 PB14 TIOB2 Timer2 Signal B Bi-directional 0 PIO Input 63
15 PB15 TCLK3 Timer3 Clock Signal Input 0 PIO Input 64
16 PB16 TIOA3 Timer3 Signal A Bi-directional 0 PIO Input 65
17 PB17 TIOB3 Timer3 Signal B Bi-directional 0 PIO Input 66
18 PB18 TCLK4 Timer4 Clock Signal Input 0 PIO Input 67
19 PB19 TIOA4 Timer4 Signal A Bi-directional 0 PIO Input 68
20 PB20 TIOB4 Timer4 Signal B Bi-directional 0 PIO Input 69
21 PB21 TCLK5 Timer5 Clock Signal Input 0 PIO Input 70
22 PB22 TIOA5 Timer5 Signal A Bi-directional 0 PIO Input 75
23 PB23 TIOB5 Timer5 Signal B Bi-directional 0 PIO Input 76
Note: 1. The OFF value is the default level seen on the peripheral input when the PIO line is enabled.
102 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
103
1779B–ATARM–03/02
PIO Enable Register
Register Name: PIO_PER
Access Type: Write-only
Offset: 0x00
31 30 29 28 27 26 25 24
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register is used to enable individual pins to be controlled by the PIO Controller instead of the associated peripheral.
When the PIO is enabled, the associated peripheral (if any) is held at logic zero.
0 = No effect.
1 = Enables the PIO to control the corresponding pin (disables peripheral control of the pin).
31 30 29 28 27 26 25 24
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register is used to disable PIO control of individual pins. When the PIO control is disabled, the normal peripheral func-
tion is enabled on the corresponding pin.
0 = No effect.
1 = Disables PIO control (enables peripheral control) on the corresponding pin.
104 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register indicates which pins are enabled for PIO control. This register is updated when PIO lines are enabled or dis-
abled.
0 = PIO is inactive on the corresponding line (peripheral is active).
1 = PIO is active on the corresponding line (peripheral is inactive).
105
1779B–ATARM–03/02
PIO Output Enable Register
Register Name: PIO_OER
Access Type: Write-only
Offset: 0x10
31 30 29 28 27 26 25 24
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register is used to enable PIO output drivers. If the pin is driven by a peripheral, this has no effect on the pin, but the
information is stored. The register is programmed as follows:
0 = No effect.
1 = Enables the PIO output on the corresponding pin.
31 30 29 28 27 26 25 24
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register is used to disable PIO output drivers. If the pin is driven by the peripheral, this has no effect on the pin, but the
information is stored. The register is programmed as follows:
0 = No effect.
1 = Disables the PIO output on the corresponding pin.
106 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register shows the PIO pin control (output enable) status which is programmed in PIO_OER and PIO ODR. The
defined value is effective only if the pin is controlled by the PIO. The register reads as follows:
0 = The corresponding PIO is input on this line.
1 = The corresponding PIO is output on this line.
107
1779B–ATARM–03/02
PIO Input Filter Enable Register
Register Name: PIO_IFER
Access Type: Write-only
Offset: 0x20
31 30 29 28 27 26 25 24
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register is used to enable input glitch filters. It affects the pin whether or not the PIO is enabled. The register is pro-
grammed as follows:
0 = No effect.
1 = Enables the glitch filter on the corresponding pin.
31 30 29 28 27 26 25 24
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register is used to disable input glitch filters. It affects the pin whether or not the PIO is enabled. The register is pro-
grammed as follows:
0 = No effect.
1 = Disables the glitch filter on the corresponding pin.
108 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register indicates which pins have glitch filters selected. It is updated when PIO outputs are enabled or disabled by
writing to PIO_IFER or PIO_IFDR.
0 = Filter is not selected on the corresponding input.
1 = Filter is selected on the corresponding input (peripheral and PIO).
109
1779B–ATARM–03/02
PIO Set Output Data Register
Register Name: PIO_SODR
Access Type: Write-only
Offset: 0x30
31 30 29 28 27 26 25 24
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register is used to set PIO output data. It affects the pin only if the corresponding PIO output line is enabled and if the
pin is controlled by the PIO. Otherwise, the information is stored.
0 = No effect.
1 = PIO output data on the corresponding pin is set.
31 30 29 28 27 26 25 24
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register is used to clear PIO output data. It affects the pin only if the corresponding PIO output line is enabled and if the
pin is controlled by the PIO. Otherwise, the information is stored.
0 = No effect.
1 = PIO output data on the corresponding pin is cleared.
110 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register shows the output data status which is programmed in PIO_SODR or PIO_CODR. The defined value is effec-
tive only if the pin is controlled by the PIO Controller and only if the pin is defined as an output.
0 = The output data for the corresponding line is programmed to 0.
1 = The output data for the corresponding line is programmed to 1.
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register shows the state of the physical pin of the chip. The pin values are always valid, regardless of whether the pins
are enabled as PIO, peripheral, input or output. The register reads as follows:
0 = The corresponding pin is at logic 0.
1 = The corresponding pin is at logic 1.
111
1779B–ATARM–03/02
PIO Interrupt Enable Register
Register Name: PIO_IER
Access Type: Write-only
Offset: 0x40
31 30 29 28 27 26 25 24
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register is used to enable PIO interrupts on the corresponding pin. It has effect whether PIO is enabled or not.
0 = No effect.
1 = Enables an interrupt when a change of logic level is detected on the corresponding pin.
31 30 29 28 27 26 25 24
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register is used to disable PIO interrupts on the corresponding pin. It has effect whether the PIO is enabled or not.
0 = No effect.
1 = Disables the interrupt on the corresponding pin. Logic level changes are still detected.
112 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register shows which pins have interrupts enabled. It is updated when interrupts are enabled or disabled by writing to
PIO_IER or PIO_IDR.
0 = Interrupt is not enabled on the corresponding input pin.
1 = Interrupt is enabled on the corresponding input pin.
31 30 29 28 27 26 25 24
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register indicates for each pin when a logic value change has been detected (rising or falling edge). This is valid
whether the PIO is selected for the pin or not and whether the pin is an input or an output.
The register is reset to zero following a read, and at reset.
0 = No input change has been detected on the corresponding pin since the register was last read.
1 = At least one input change has been detected on the corresponding pin since the register was last read.
113
1779B–ATARM–03/02
PIO Multi-drive Enable Register
Register Name: PIO_MDER
Access Type: Write-only
Offset: 0x50
31 30 29 28 27 26 25 24
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register is used to enable PIO output drivers to be configured as open drain to support external drivers on the same
pin.
0 = No effect.
1 = Enables multi-drive option on the corresponding pin.
31 30 29 28 27 26 25 24
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register is used to disable the open drain configuration of the output buffer.
0 = No effect.
1 = Disables the multi-driver option on the corresponding pin.
114 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
This register indicates which pins are configured with open drain drivers.
0 = PIO is not configured as an open drain.
1 = PIO is configured as an open drain.
115
1779B–ATARM–03/02
SF: Special Function The AT91M42800A provides registers that implement the following special functions:
Registers • Chip Identification
• RESET Status
• Protect Mode (see "Protect Mode" on page 84)
SF User Interface
Chip ID Base Address: 0xFFF00000 (Code Label SF_BASE)
Table 17. SF Memory Map
Offset Register Name Access Reset State
0x00 Chip ID Register SF_CIDR Read-only Hardwired
0x04 Chip ID Extension Register SF_EXID Read-only Hardwired
0x08 Reset Status Register SF_RSR Read-only See register
description
0x0C Reserved – – –
0x10 Reserved – – –
0x14 Reserved – – –
116 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
Chip ID Register
Register Name: SF_CIDR
Access Type: Read-only
Offset: 0x00
31 30 29 28 27 26 25 24
EXT NVPTYP ARCH
23 22 21 20 19 18 17 16
ARCH VDSIZ
15 14 13 12 11 10 9 8
NVDSIZ NVPSIZ
7 6 5 4 3 2 1 0
0 1 0 VERSION
117
1779B–ATARM–03/02
• ARCH: Chip Architecture
Code of Architecture: Two BCD digits
This register is reserved for future use. It will be defined when needed.
118 AT91M42800A
1779B–ATARM–03/02
AT91M42800A
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
RESET
23 22 21 20 19 18 17 16
PMRKEY
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – AIC – – – – –
119
1779B–ATARM–03/02
USART: Universal The AT91M42800A provides two identical, full-duplex, universal synchronous/asynchro-
nous receiver/transmitters that interface to the APB and are connected to the Peripheral
Synchronous/
Data Controller.
Asynchronous
The main features are:
Receiver/Transmitter • Programmable Baud Rate Generator with External or Internal Clock, as well as Slow
Clock
• Parity, Framing and Overrun Error Detection
• Line Break Generation and Detection
• Automatic Echo, Local Loopback and Remote Loopback channel modes
• Multi-drop Mode: Address Detection and Generation
• Interrupt Generation
• Two Dedicated Peripheral Data Controller channels
• 5-, 6-, 7-, 8- and 9-bit character length
ASB
Peripheral Data Controller
AMBA
Receiver Transmitter
Channel Channel
PIO:
Parallel
USART Channel I/O
APB Controller
Control Logic
Receiver RXD
120 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
Pin Description
Each USART channel has the following external signals:
Name Description
USART Serial clock can be configured as input or output:
SCK SCK is configured as input if an External clock is selected (USCLKS = 3)
SCK is driven as output if the External Clock is disabled (USCLKS ≠ 3) and Clock output is enabled (CLKO = 1)
TXD Transmit Serial Data is an output
RXD Receive Serial Data is an input
Notes: 1. After a hardware reset, the USART clock is disabled by default (see “PMC: Power Management Controller” on page 55). The
user must configure the Power Management Controller before any access to the User Interface of the USART.
2. After a hardware reset, the USART pins are deselected by default (see “PIO: Parallel I/O Controller” on page 98). The user
must configure the PIO Controller before enabling the transmitter or receiver. If the user selects one of the internal clocks,
SCK can be configured as a PIO.
121
1779B–ATARM–22-Mar-02
Baud Rate Generator The Baud Rate Generator provides the bit period clock (the Baud Rate clock) to both the
Receiver and the Transmitter.
The Baud Rate Generator can select between external and internal clock sources. The
external clock source is SCK. The internal clock sources can be either the master clock
MCK or the master clock divided by 8 (MCK/8).
Note: In all cases, if an external clock is used, the duration of each of its levels must be longer
than the system clock (MCK) period. The external clock frequency must be at least 2.5
times lower than the system clock.
When the USART is programmed to operate in Asynchronous Mode (SYNC = 0 in the
Mode Register US_MR), the selected clock is divided by 16 times the value (CD) written
in US_BRGR (Baud Rate Generator Register). If US_BRGR is set to 0, the Baud Rate
Clock is disabled.
Selected Clock
Baud Rate =
16 x CD
When the USART is programmed to operate in Synchronous Mode (SYNC = 1) and the
selected clock is internal (USCLKS ≠ 3 in the Mode Register US_MR), the Baud Rate
Clock is the internal selected clock divided by the value written in US_BRGR. If
US_BRGR is set to 0, the Baud Rate Clock is disabled.
In Synchronous Mode with external clock selected (USCLKS = 3), the clock is provided
directly by the signal on the SCK pin. No division is active. The value written in
US_BRGR has no effect.
USCLKS CD
CD
MCK 0
MCK/8 CLK
16-bit Counter
SLCK OUT
SCK 1 >1 SYNC
1
0
0 0 Divide
0
by 16
Baud Rate
1
Clock
1
SYNC
122 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
Receiver
Asynchronous Receiver The USART is configured for asynchronous operation when SYNC = 0 (bit 7 of
US_MR). In asynchronous mode, the USART detects the start of a received character
by sampling the RXD signal until it detects a valid start bit. A low level (space) on RXD is
interpreted as a valid start bit if it is detected for more than 7 cycles of the sampling
clock, which is 16 times the baud rate. Hence a space which is longer than 7/16 of the
bit period is detected as a valid start bit. A space which is 7/16 of a bit period or shorter
is ignored and the receiver continues to wait for a valid start bit.
When a valid start bit has been detected, the receiver samples the RXD at the theoreti-
cal mid-point of each bit. It is assumed that each bit lasts 16 cycles of the sampling clock
(one bit period) so the sampling point is 8 cycles (0.5 bit periods) after the start of the bit.
The first sampling point is therefore 24 cycles (1.5 bit periods) after the falling edge of
the start bit was detected. Each subsequent bit is sampled 16 cycles (1 bit period) after
the previous one.
16 x Baud
Rate Clock
RXD
Sampling
True Start D0
Detection
0.5-bit 1-bit
period period
RXD
123
1779B–ATARM–22-Mar-02
Synchronous Receiver When configured for synchronous operation (SYNC = 1), the receiver samples the RXD
signal on each rising edge of the Baud Rate clock. If a low level is detected, it is consid-
ered as a start. Data bits, parity bit and stop bit are sampled and the receiver waits for
the next start bit. See example in Figure 52.
SCK
RXD
Receiver Ready When a complete character is received, it is transferred to the US_RHR and the RXRDY
status bit in US_CSR is set. If US_RHR has not been read since the last transfer, the
OVRE status bit in US_CSR is set.
Parity Error Each time a character is received, the receiver calculates the parity of the received data
bits, in accordance with the field PAR in US_MR. It then compares the result with the
received parity bit. If different, the parity error bit PARE in US_CSR is set.
Framing Error If a character is received with a stop bit at low level and with at least one data bit at high
level, a framing error is generated. This sets FRAME in US_CSR.
Time-out This function allows an idle condition on the RXD line to be detected. The maximum
delay for which the USART should wait for a new character to arrive while the RXD line
is inactive (high level) is programmed in US_RTOR (Receiver Tim-out). When this regis-
ter is set to 0, no time-out is detected. Otherwise, the receiver waits for a first character
and then initializes a counter which is decremented at each bit period and reloaded at
each byte reception. When the counter reaches 0, the TIMEOUT bit in US_CSR is set.
The user can restart the wait for a first character with the STTTO (Start Time-out) bit in
US_CR.
Calculation of time-out duration:
Duration = Value x 4 x Bit Period
124 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
Transmitter The transmitter has the same behavior in both synchronous and asynchronous operat-
ing modes. Start bit, data bits, parity bit and stop bits are serially shifted, lowest
significant bit first, on the falling edge of the serial clock. See example in Figure 53.
The number of data bits is selected in the CHRL field in US_MR.
The parity bit is set according to the PAR field in US_MR.
The number of stop bits is selected in the NBSTOP field in US_MR.
When a character is written to US_THR (Transmit Holding), it is transferred to the Shift
Register as soon as it is empty. When the transfer occurs, the TXRDY bit in US_CSR is
set until a new character is written to US_THR. If Transmit Shift Register and US_THR
are both empty, the TXEMPTY bit in US_CSR is set.
Time-guard The Time-guard function allows the transmitter to insert an idle state on the TXD line
between two characters. The duration of the idle state is programmed in US_TTGR
(Transmitter Time-guard). When this register is set to zero, no time-guard is generated.
Otherwise, the transmitter holds a high level on TXD after each transmitted byte during
the number of bit periods programmed in US_TTGR.
Idle state duration = Time-guard x Bit
between two characters Value Period
Baud Rate
Clock
TXD
Multi-drop Mode When the field PAR in US_MR equals 11X (binary value), the USART is configured to
run in Multi-drop mode. In this case, the parity error bit PARE in US_CSR is set when
data is detected with a parity bit set to identify an address byte. PARE is cleared with the
Reset Status Bits Command (RSTSTA) in US_CR. If the parity bit is detected low, iden-
tifying a data byte, PARE is not set.
The transmitter sends an address byte (parity bit set) when a Send Address Command
(SENDA) is written to US_CR. In this case, the next byte written to US_THR will be
transmitted as an address. After this any byte transmitted will have the parity bit cleared.
Break A break condition is a low signal level that has a duration of at least one character
(including start/stop bits and parity).
Transmit Break The transmitter generates a break condition on the TXD line when STTBRK is set in
US_CR (Control Register). In this case, the character present in the Transmit Shift Reg-
ister is completed before the line is held low.
To cancel a break condition on the TXD line, the STPBRK command in US_CR must be
set. The USART completes a minimum break duration of one character length. The TXD
line then returns to high level (idle state) for at least 12 bit periods, or the value of the
125
1779B–ATARM–22-Mar-02
Time-guard register if it is greater than 12, to ensure that the end of break is correctly
detected. Then the transmitter resumes normal operation.
The BREAK is managed like a character:
• The STTBRK and the STPBRK commands are performed only if the transmitter is
ready (bit TXRDY = 1 in US_CSR)
• The STTBRK command blocks the transmitter holding register (bit TXRDY is
cleared in US_CSR) until the break has started
• A break is started when the Shift Register is empty (any previous character is fully
transmitted). US_CSR.TXEMPTY is cleared. The break blocks the transmitter shift
register until it is completed (high level for at least 12 bit periods after the STPBRK
command is requested)
In order to avoid unpredictable states:
• STTBRK and STPBRK commands must not be requested at the same time
• Once an STTBRK command is requested, further STTBRK commands are ignored
until the BREAK is ended (high level for at least 12 bit periods)
• All STPBRK commands requested without a previous STTBRK command are
ignored
• A byte written into the Transmit Holding Register while a break is pending but not
started (bit TXRDY = 0 in US_CSR) is ignored
• It is not permitted to write new data in the Transmit Holding Register while a break is
in progress (STPBRK has not been requested), even though TXRDY = 1 in
US_CSR.
• A new STTBRK command must not be issued until an existing break has ended
(TXEMPTY=1 in US_CSR).
The standard break transmission sequence is:
1. Wait for the transmitter ready
(US_CSR.TXRDY = 1)
2. Send the STTBRK command
(write 0x0200 to US_CR)
3. Wait for the transmitter ready
(bit TXRDY = 1 in US_CSR)
4. Send the STPBRK command
(write 0x0400 to US_CR)
The next byte can then be sent:
5. Wait for the transmitter ready
(bit TXRDY = 1 in US_CSR)
6. Send the next byte
(write byte to US_THR)
Each of these steps can be scheduled by using the interrupt if the bit TXRDY in US_IMR
is set.
For character transmission, the USART channel must be enabled before sending a
break.
126 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
Receive Break The receiver detects a break condition when all data, parity and stop bits are low. When
the low stop bit is detected, the receiver asserts the RXBRK bit in US_CSR. An end of
receive break is detected by a high level for at least 2/16 of a bit period in asynchronous
operating mode or at least one sample in synchronous operating mode. RXBRK is also
asserted when an end of break is detected.
Both the beginning and the end of a break can be detected by interrupt if the bit
US_IMR.RXBRK is set.
Peripheral Data Each USART channel is closely connected to a corresponding Peripheral Data Control-
Controller ler channel. One is dedicated to the receiver. The other is dedicated to the transmitter.
The PDC is disabled if 9-bit character length is selected (MODE9 = 1) in US_MR.
The PDC channel is programmed using US_TPR (Transmit Pointer) and US_TCR
(Transmit Counter) for the transmitter and US_RPR (Receive Pointer) and US_RCR
(Receive Counter) for the receiver. The status of the PDC is given in US_CSR by the
ENDTX bit for the transmitter and by the ENDRX bit for the receiver.
The pointer registers (US_TPR and US_RPR) are used to store the address of the
transmit or receive buffers. The counter registers (US_TCR and US_RCR) are used to
store the size of these buffers.
The receiver data transfer is triggered by the RXRDY bit and the transmitter data trans-
fer is triggered by TXRDY. When a transfer is performed, the counter is decremented
and the pointer is incremented. When the counter reaches 0, the status bit is set
(ENDRX for the receiver, ENDTX for the transmitter in US_CSR) and can be pro-
grammed to generate an interrupt. Transfers are then disabled until a new non-zero
counter value is programmed.
Interrupt Generation Each status bit in US_CSR has a corresponding bit in US_IER (Interrupt Enable) and
US_IDR (Interrupt Disable) which controls the generation of interrupts by asserting the
USART interrupt line connected to the Advanced Interrupt Controller. US_IMR (Interrupt
Mask Register) indicates the status of the corresponding bits.
When a bit is set in US_CSR and the same bit is set in US_IMR, the interrupt line is
asserted.
Channel Modes The USART can be programmed to operate in three different test modes, using the field
CHMODE in US_MR.
Automatic echo mode allows bit by bit re-transmission. When a bit is received on the
RXD line, it is sent to the TXD line. Programming the transmitter has no effect.
Local loopback mode allows the transmitted characters to be received. TXD and RXD
pins are not used and the output of the transmitter is internally connected to the input of
the receiver. The RXD pin level has no effect and the TXD pin is held high, as in idle
state.
Remote loopback mode directly connects the RXD pin to the TXD pin. The Transmitter
and the Receiver are disabled and have no effect. This mode allows bit-by-bit re-
transmission.
127
1779B–ATARM–22-Mar-02
Figure 54. Channel Modes
Automatic Echo
Receiver RXD
Disabled
Transmitter TXD
Local Loopback
Disabled
Receiver RXD
VDD
Disabled
Transmitter TXD
Disabled
Transmitter TXD
128 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
129
1779B–ATARM–22-Mar-02
USART Control Register
Name: US_CR
Access Type: Write-only
Offset: 0x00
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – SENDA STTTO STPBRK STTBRK RSTSTA
7 6 5 4 3 2 1 0
TXDIS TXEN RXDIS RXEN RSTTX RSTRX – –
130 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
23 22 21 20 19 18 17 16
– – – – – CLKO MODE9 –
15 14 13 12 11 10 9 8
CHMODE NBSTOP PAR SYNC
7 6 5 4 3 2 1 0
CHRL USCLKS – – – –
Start, stop and parity bits are added to the character length.
• SYNC: Synchronous Mode Select (Code Label US_SYNC)
0 = USART operates in Asynchronous Mode.
1 = USART operates in Synchronous Mode.
• PAR: Parity Type
131
1779B–ATARM–22-Mar-02
• NBSTOP: Number of Stop Bits
The interpretation of the number of stop bits depends on SYNC.
Table 2.
NBSTOP Asynchronous (SYNC = 0) Synchronous (SYNC = 1) Code Label: US_NBSTOP
0 0 1 stop bit 1 stop bit US_NBSTOP_1
0 1 1.5 stop bits Reserved US_NBSTOP_1_5
1 0 2 stop bits 2 stop bits US_NBSTOP_2
1 1 Reserved Reserved –
Note: 1.5 or 2 stop bits are reserved for the TX function. The RX function uses only the 1 stop bit (there is no check on the 2 stop bit
timeslot if NBSTO P= 10).
Local Loopback
1 0 US_CHMODE_LOCAL_LOOPBACK
Transmitter Output Signal is connected to Receiver Input Signal.
132 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – TXEMPTY TIMEOUT
7 6 5 4 3 2 1 0
PARE FRAME OVRE ENDTX ENDRX RXBRK TXRDY RXRDY
133
1779B–ATARM–22-Mar-02
USART Interrupt Disable Register
Name: US_IDR
Access Type: Write-only
Offset: 0x0C
31 30 29 28 27 26 25 24
COMMRX COMMTX – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – TXEMPTY TIMEOUT
7 6 5 4 3 2 1 0
PARE FRAME OVRE ENDTX ENDRX RXBRK TXRDY RXRDY
134 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – TXEMPTY TIMEOUT
7 6 5 4 3 2 1 0
PARE FRAME OVRE ENDTX ENDRX RXBRK TXRDY RXRDY
135
1779B–ATARM–22-Mar-02
USART Channel Status Register
Name: US_CSR
Access Type: Read-only
Offset: 0x14
Reset Value: 0x18
31 30 29 28 27 26 25 24
COMMRX COMMTX – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – TXEMPTY TIMEOUT
7 6 5 4 3 2 1 0
PARE FRAME OVRE ENDTX ENDRX RXBRK TXRDY RXRDY
136 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – RXCHR
7 6 5 4 3 2 1 0
RXCHR
137
1779B–ATARM–22-Mar-02
USART Transmitter Holding Register
Name: US_THR
Access Type: Write-only
Offset: 0x1C
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – TXCHR
7 6 5 4 3 2 1 0
TXCHR
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
CD
7 6 5 4 3 2 1 0
CD
CD
0 Disables Clock
1 Clock Divisor Bypass (1)
Baud Rate (Asynchronous Mode (2)) = Selected Clock/(16 x CD)
2 to 65535
Baud Rate (Synchronous Mode) = Selected Clock/CD
Notes: 1. In Synchronous mode, the value programmed must be even to ensure a 50:50 mark:space ratio.
2. Clock divisor bypass (CD = 1) must not be used when internal clock MCK is selected (USCLKS = 0).
138 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
TO
TO
0 Disables the RX Time-out function.
The Time-out counter is loaded with TO when the Start Time-out Command is given or when each new data character is
1- 255
received (after reception has started).
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
TG
TG
0 Disables the TX Time-guard function.
1 - 255 TXD is inactive high after the transmission of each character for the time-guard duration.
139
1779B–ATARM–22-Mar-02
USART Receive Pointer Register
Name: US_RPR
Access Type: Read/Write
Offset: 0x30
Reset Value: 0x0
31 30 29 28 27 26 25 24
RXPTR
23 22 21 20 19 18 17 16
RXPTR
15 14 13 12 11 10 9 8
RXPTR
7 6 5 4 3 2 1 0
RXPTR
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
RXCTR
7 6 5 4 3 2 1 0
RXCTR
140 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
23 22 21 20 19 18 17 16
TXPTR
15 14 13 12 11 10 9 8
TXPTR
7 6 5 4 3 2 1 0
TXPTR
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
TXCTR
7 6 5 4 3 2 1 0
TXCTR
141
1779B–ATARM–22-Mar-02
TC: Timer/Counter The AT91M42800A features two Timer/Counter blocks, each containing three identical
16-bit Timer/Counter channels. Each channel can be independently programmed to per-
form a wide range of functions including frequency measurement, event counting,
interval measurement, pulse generation, delay timing and pulse width modulation.
Each Timer/Counter (TC) channel has 3 external clock inputs, 5 internal clock inputs,
and 2 multi-purpose input/output signals which can be configured by the user. Each
channel drives an internal interrupt signal which can be programmed to generate pro-
cessor interrupts via the AIC (Advanced Interrupt Controller).
The Timer/Counter block has two global registers which act upon all three TC channels.
The Block Control Register allows the three channels to be started simultaneously with
the same instruction. The Block Mode Register defines the external clock inputs for
each Timer/Counter channel, allowing them to be chained.
Each Timer/Counter block operates independently and has a complete set of block and
channel registers. Since they are identical in operation, only one block is described
below (see Timer/Counter Description on page 144). The internal configuration of a sin-
gle Timer/Counter Block is shown in Figure 55.
Parallel IO
MCK/2 Controller
TCLK0
TCLK0
TCLK1
MCK/8 TIOA1 TCLK2
TIOA2 XC0 Timer/Counter
MCK/32 TIOA
TCLK1 XC1 Channel 0 TIOA0 TIOA0
TIOB TIOB0
MCK/128 TCLK2 XC2 TIOB0
TC0XC0S SYNC
SLCK INT
TCLK0
TCLK2 SYNC
INT
TC1XC1S
Advanced
Interrupt
Controller
142 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
Notes: 1. After a hardware reset, the TC clock is disabled by default (see “PMC: Power Management Controller” on page 55). The
user must configure the Power Management Controller before any access to the User Interface of the TC.
2. After a hardware reset, the Timer/Counter block pins are controlled by the PIO Controller. They must be configured to be
controlled by the peripheral before being used.
143
1779B–ATARM–22-Mar-02
Timer/Counter Each Timer/Counter channel is identical in operation. The registers for channel pro-
Description gramming are listed in Table 19.
Counter Each Timer/Counter channel is organized around a 16-bit counter. The value of the
counter is incremented at each positive edge of the input clock. When the counter
reaches the value 0xFFFF and passes to 0x0000, an overflow occurs and the bit
COVFS in TC_SR (Status Register) is set.
The current value of the counter is accessible in real time by reading TC_CV. The
counter can be reset by a trigger. In this case, the counter value passes to 0x0000 on
the next valid edge of the clock.
Clock Selection At block level, input clock signals of each channel can either be connected to the exter-
nal inputs TCLK0, TCLK1 or TCLK2, or be connected to the configurable I/O signals
TIOA0, TIOA1 or TIOA2 for chaining by programming the TC_BMR (Block mode).
Each channel can independently select an internal or external clock source for its
counter:
• Internal clock signals: MCK/2, MCK/8, MCK/32,
MCK/128 and Slow Clock SLCK
• External clock signals: XC0, XC1 or XC2
The selected clock can be inverted with the CLKI bit in TC_CMR (Channel mode). This
allows counting on the opposite edges of the clock.
The burst function allows the clock to be validated when an external signal is high. The
BURST parameter in the Mode Register defines this signal (none, XC0, XC1, XC2).
Note: In all cases, if an external clock is used, the duration of each of its levels must be longer
than the system clock (MCK) period. The external clock frequency must be at least 2.5
times lower than the system clock.
CLKS
CLKI
MCK/2
MCK/8
MCK/32
MCK/128
Selected
SLCK
Clock
XC0
XC1
XC2
BURST
144 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
Clock Control The clock of each counter can be controlled in two different ways: it can be enabled/dis-
abled and started/stopped.
• The clock can be enabled or disabled by the user with the CLKEN and the CLKDIS
commands in the Control Register. In Capture Mode it can be disabled by an RB
load event if LDBDIS is set to 1 in TC_CMR. In Waveform Mode, it can be disabled
by an RC Compare event if CPCDIS is set to 1 in TC_CMR. When disabled, the
start or the stop actions have no effect: only a CLKEN command in the Control
Register can re-enable the clock. When the clock is enabled, the CLKSTA bit is set
in the Status Register.
• The clock can also be started or stopped: a trigger (software, synchro, external or
compare) always starts the clock. The clock can be stopped by an RB load event in
Capture Mode (LDBSTOP = 1 in TC_CMR) or a RC compare event in Waveform
Mode (CPCSTOP = 1 in TC_CMR). The start and the stop commands have effect
only if the clock is enabled.
Q S
R
Q S
R
Stop Disable
Counter Event Event
Clock
Timer/Counter Operating Each Timer/Counter channel can independently operate in two different modes:
Modes • Capture mode allows measurement on signals
• Waveform mode allows wave generation
The Timer/Counter mode is programmed with the WAVE bit in the TC Mode Register. In
Capture mode, TIOA and TIOB are configured as inputs. In Waveform mode, TIOA is
always configured to be an output and TIOB is an output if it is not selected to be the
external trigger.
Trigger A trigger resets the counter and starts the counter clock. Three types of triggers are
common to both modes, and a fourth external trigger is available to each mode.
The following triggers are common to both modes:
• Software Trigger: Each channel has a software trigger, available by setting SWTRG
in TC_CCR.
145
1779B–ATARM–22-Mar-02
• SYNC: Each channel has a synchronization signal SYNC. When asserted, this
signal has the same effect as a software trigger. The SYNC signals of all channels
are asserted simultaneously by writing TC_BCR (Block Control) with SYNC set.
• Compare RC Trigger: RC is implemented in each channel and can provide a trigger
when the counter value matches the RC value if CPCTRG is set in TC_CMR.
The Timer/Counter channel can also be configured to have an external trigger. In Cap-
ture Mode, the external trigger signal can be selected between TIOA and TIOB. In
Waveform Mode, an external event can be programmed on one of the following signals:
TIOB, XC0, XC1 or XC2. This external event can then be programmed to perform a trig-
ger by setting ENETRG in TC_CMR.
If an external trigger is used, the duration of the pulses must be longer than the system
clock (MCK) period in order to be detected.
Capture Operating Mode This mode is entered by clearing the WAVE parameter in TC_CMR (Channel Mode
Register). Capture Mode allows the TC Channel to perform measurements such as
pulse timing, frequency, period, duty cycle and phase on TIOA and TIOB signals which
are considered as input.
Figure 58 shows the configuration of the TC Channel when programmed in Capture
Mode.
Capture Registers A and B Registers A and B are used as capture registers. This means that they can be loaded
(RA and RB) with the counter value when a programmable event occurs on the signal TIOA.
The parameter LDRA in TC_CMR defines the TIOA edge for the loading of register A,
and the parameter LDRB defines the TIOA edge for the loading of Register B.
RA is loaded only if it has not been loaded since the last trigger or if RB has been loaded
since the last loading of RA.
RB is loaded only if RA has been loaded since the last trigger or the last loading of RB.
Loading RA or RB before the read of the last value loaded sets the Overrun Error Flag
(LOVRS) in TC_SR (Status Register). In this case, the old value is overwritten.
Trigger Conditions In addition to the SYNC signal, the software trigger and the RC compare trigger, an
external trigger can be defined.
Bit ABETRG in TC_CMR selects input signal TIOA or TIOB as an external trigger.
Parameter ETRGEDG defines the edge (rising, falling or both) detected to generate an
external trigger. If ETRGEDG = 0 (none), the external trigger is disabled.
146 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
Status Register The following bits in the status register are significant in Capture Operating mode.
• CPCS: RC Compare Status
There has been an RC Compare match at least once since the last read of the
status
• COVFS: Counter Overflow Status
The counter has attempted to count past $FFFF since the last read of the status
• LOVRS: Load Overrun Status
RA or RB has been loaded at least twice without any read of the corresponding reg-
ister, since the last read of the status
• LDRAS: Load RA Status
RA has been loaded at least once without any read, since the last read of the status
• LDRBS: Load RB Status
RB has been loaded at least once without any read, since the last read of the status
• ETRGS: External Trigger Status
An external trigger on TIOA or TIOB has been detected since the last read of the
status
147
1779B–ATARM–22-Mar-02
Figure 58. Capture Mode
148
AT91M42800A
TCCLKS
CLKSTA CLKEN CLKDIS
CLKI
MCK/2
MCK/8
MCK/32
Q S
MCK/128
SLCK
R
Q S
XC0
R
XC1
XC2
LDBSTOP LDBDIS
BURST
Register C
Capture Capture
1 Register A Register B Compare RC =
16-bit Counter
SWTRG
CLK
OVF
RESET
SYNC Trig
ABETRG
ETRGEDG CPCTRG
MTIOB Edge
Detector
ETRGS
COVFS
LOVRS
LDRAS
LDRBS
TC_SR
CPCS
MTIOA Edge Edge
Detector Detector
If RA is not loaded
or RB is loaded If RA is loaded
TC_IMR
TIOA
1779B–ATARM–22-Mar-02
INT
AT91M42800A
Waveform Operating This mode is entered by setting the WAVE parameter in TC_CMR (Channel Mode
Mode Register).
Waveform Operating Mode allows the TC Channel to generate 1 or 2 PWM signals with
the same frequency and independently programmable duty cycles, or to generate differ-
ent types of one-shot or repetitive pulses.
In this mode, TIOA is configured as output and TIOB is defined as output if it is not used
as an external event (EEVT parameter in TC_CMR).
Figure 59 shows the configuration of the TC Channel when programmed in Waveform
Operating Mode.
Compare Register A, B and C In Waveform Operating Mode, RA, RB and RC are all used as compare registers.
(RA, RB, and RC)
RA Compare is used to control the TIOA output. RB Compare is used to control the
TIOB (if configured as output). RC Compare can be programmed to control TIOA and/or
TIOB outputs.
RC Compare can also stop the counter clock (CPCSTOP = 1 in TC_CMR) and/or dis-
able the counter clock (CPCDIS = 1 in TC_CMR).
As in Capture Mode, RC Compare can also generate a trigger if CPCTRG = 1. Trigger
resets the counter so RC can control the period of PWM waveforms.
External Event/Trigger An external event can be programmed to be detected on one of the clock sources (XC0,
Conditions XC1, XC2) or TIOB. The external event selected can then be used as a trigger.
The parameter EEVT in TC_CMR selects the external trigger. The parameter EEVT-
EDG defines the trigger edge for each of the possible external triggers (rising, falling or
both). If EEVTEDG is cleared (none), no external event is defined.
If TIOB is defined as an external event signal (EEVT = 0), TIOB is no longer used as
output and the TC channel can only generate a waveform on TIOA.
When an external event is defined, it can be used as a trigger by setting bit ENETRG in
TC_CMR.
As in Capture Mode, the SYNC signal, the software trigger and the RC compare trigger
are also available as triggers.
Output Controller The output controller defines the output level changes on TIOA and TIOB following an
event. TIOB control is used only if TIOB is defined as output (not as an external event).
The following events control TIOA and TIOB: software trigger, external event and RC
compare. RA compare controls TIOA and RB compare controls TIOB. Each of these
events can be programmed to set, clear or toggle the output as defined in the corre-
sponding parameter in TC_CMR.
149
1779B–ATARM–22-Mar-02
The tables below show which parameter in TC_CMR is used to define the effect of each
event.
If two or more events occur at the same time, the priority level is defined as follows:
1. Software Trigger
2. External Event
3. RC Compare
4. RA or RB Compare
Status The following bits in the status register are significant in Waveform mode:
• CPAS: RA Compare Status
There has been a RA Compare match at least once since the last read of the status
• CPBS: RB Compare Status
There has been a RB Compare match at least once since the last read of the status
• CPCS: RC Compare Status
There has been a RC Compare match at least once since the last read of the status
• COVFS: Counter Overflow
Counter has attempted to count past $FFFF since the last read of the status
• ETRGS: External Trigger
External trigger has been detected since the last read of the status
150 AT91M42800A
1779B–ATARM–22-Mar-02
1779B–ATARM–22-Mar-02
Output Controller
SLCK
Q S
XC0
R
XC1
TIOA
XC2 CPCSTOP
AEEVT
BURST
Register A Register B Register C
ASWTRG
1 Compare RA = Compare RB = Compare RC =
16-bit Counter
CLK
OVF
RESET
SWTRG
BCPC
SYNC Trig
BCPB MTIOB
Output Controller
CPCTRG
EEVT TIOB
BEEVT
EEVTEDG
ENETRG
ETRGS
COVFS
TC_SR
CPCS
CPAS
CPBS
Edge
Detector BSWTRG
TIOB
TC_IMR
AT91M42800A
Timer Counter Channel
INT
151
TC User Interface
TC Block 0 Base Address: 0xFFFD0000 (Code Label TCB0_BASE)
TC Block 1 Base Address: 0xFFFD4000 (Code Label TCB1_BASE)
Table 18. TC Global Memory Map
Offset Channel/Register Name Access Reset State
0x00 TC Channel 0 See Table 19
0x40 TC Channel 1 See Table 19
0x80 TC Channel 2 See Table 19
0xC0 TC Block Control Register TC_BCR Write-only –
TC_BCR (Block Control Register) and TC_BMR (Block Mode Register) control the TC block. TC Channels are controlled
by the registers listed in Table 19. The offset of each of the Channel registers in Table 19 is in relation to the offset of the
corresponding channel as mentioned in Table 18.
0x0C Reserved –
152 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – SYNC
153
1779B–ATARM–22-Mar-02
TC Block Mode Register
Register Name: TC_BMR
Access Type: Read/Write
Offset: 0xC4
Reset Value: 0x0
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – TC2XC2S TC1XC1S TC0XC0S
154 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – SWTRG CLKDIS CLKEN
155
1779B–ATARM–22-Mar-02
TC Channel Mode Register: Capture Mode
Register Name: TC_CMR
Access Type: Read/Write
Offset: 0x04
Reset Value: 0x0
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – LDRB LDRA
15 14 13 12 11 10 9 8
WAVE=0 CPCTRG – – – ABETRG ETRGEDG
7 6 5 4 3 2 1 0
LDBDIS LDBSTOP BURST CLKI TCCLKS
156 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
157
1779B–ATARM–22-Mar-02
TC Channel Mode Register: Waveform Mode
Register Name: TC_CMR
Access Type: Read/Write
Offset: 0x04
Reset Value: 0x0
31 30 29 28 27 26 25 24
BSWTRG BEEVT BCPC BCPB
23 22 21 20 19 18 17 16
ASWTRG AEEVT ACPC ACPA
15 14 13 12 11 10 9 8
WAVE=1 CPCTRG – ENETRG EEVT EEVTEDG
7 6 5 4 3 2 1 0
CPCDIS CPCSTOP BURST CLKI TCCLKS
158 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
Signal Selected as
EEVT External Event TIOB Direction Code Label: TC_EEVT
(1)
0 0 TIOB Input TC_EEVT_TIOB
0 1 XC0 Output TC_EEVT_XC0
1 0 XC1 Output TC_EEVT_XC1
1 1 XC2 Output TC_EEVT_XC2
Note: If TIOB is chosen as the external event signal, it is configured as an input and no longer generates waveforms.
• ENETRG: External Event Trigger Enable (Code Label TC_ENETRG)
0 = The external event has no effect on the counter and its clock. In this case, the selected external event only controls
the TIOA output.
1 = The external event resets the counter and starts the counter clock.
• CPCTRG: RC Compare Trigger Enable (Code Label TC_CPCTRG)
0 = RC Compare has no effect on the counter and its clock.
1 = RC Compare resets the counter and starts the counter clock.
• WAVE = 1 (Code Label TC_WAVE)
0 = Waveform Mode is disabled (Capture Mode is enabled).
1 = Waveform Mode is enabled.
• ACPA: RA Compare Effect on TIOA
159
1779B–ATARM–22-Mar-02
• AEEVT: External Event Effect on TIOA
160 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
CV
7 6 5 4 3 2 1 0
CV
TC Register A
Register Name: TC_RA
Access Type: Read-only if WAVE = 0, Read/Write if WAVE = 1
Offset: 0x14
Reset Value: 0x0
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
RA
7 6 5 4 3 2 1 0
RA
161
1779B–ATARM–22-Mar-02
TC Register B
Register Name: TC_RB
Access Type: Read-only if WAVE = 0, Read/Write if WAVE = 1
Offset: 0x18
Reset Value: 0x0
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
RB
7 6 5 4 3 2 1 0
RB
TC Register C
Register Name: TC_RC
Access Type: Read/Write
Offset: 0x1C
Reset Value: 0x0
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
RC
7 6 5 4 3 2 1 0
RC
162 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
TC Status Register
Register Name: TC_SR
Access Type: Read-only
Offset: 0x20
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – MTIOB MTIOA CLKSTA
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
ETRGS LDRBS LDRAS CPCS CPBS CPAS LOVRS COVFS
163
1779B–ATARM–22-Mar-02
TC Interrupt Enable Register
Register Name: TC_IER
Access Type: Write-only
Offset: 0x24
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
ETRGS LDRBS LDRAS CPCS CPBS CPAS LOVRS COVFS
164 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
ETRGS LDRBS LDRAS CPCS CPBS CPAS LOVRS COVFS
165
1779B–ATARM–22-Mar-02
TC Interrupt Mask Register
Register Name: TC_IMR
Access Type: Read-only
Offset: 0x2C
Reset Value: 0x0
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
ETRGS LDRBS LDRAS CPCS CPBS CPAS LOVRS COVFS
166 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
SPI: Serial Peripheral The AT91M42800A includes two SPIs which provide communication with external
devices in master or slave mode. They are independent, and are referred to by the let-
Interface
ters A and B.
Pin Description Seven pins are associated with the SPI Interface. When not needed for the SPI function,
each of these pins can be configured as a PIO. Support for an external master is pro-
vided by the PIO Controller Multi-driver option. To configure an SPI pin as open-drain to
support external drivers, set the corresponding bits in the PIO_MDSR register (see page
115).
An input filter can be enabled on the SPI input pins by setting the corresponding bits in
the PIO_IFSR (see page 109). The NPCS0/NSS pin can function as a peripheral chip
select output or slave select input. Refer to Table 20 for a description of the SPI pins.
Advanced
Interrupt Controller
167
1779B–ATARM–22-Mar-02
Master Mode In Master mode, the SPI controls data transfers to and from the slave(s) connected to
the SPI bus. The SPI drives the chip select(s) to the slave(s) and the serial clock
(SPCK). After enabling the SPI, a data transfer begins when the ARM core writes to the
SP_TDR (Transmit Data Register). See Table 21.
Transmit and Receive buffers maintain the data flow at a constant rate with a reduced
requirement for high priority interrupt servicing. When new data is available in the
SP_TDR (Transmit Data Register) the SPI continues to transfer data. If the SP_RDR
(Receive Data Register) has not been read before new data is received, the Overrun
Error (OVRES) flag is set.
The delay between the activation of the chip select and the start of the data transfer
(DLYBS) as well as the delay between each data transfer (DLYBCT) can be pro-
grammed for each of the four external chip selects. All data transfer characteristics
including the two timing values are programmed in registers SP_CSR0 to SP_CSR3
(Chip Select Registers). See Table 21.
In master mode the peripheral selection can be defined in two different ways:
• Fixed Peripheral Select: SPI exchanges data with only one peripheral
• Variable Peripheral Select: Data can be exchanged with more than one peripheral
Figures 61 and 62 show the operation of the SPI in Master mode. For details concerning
the flag and control bits in these diagrams, see the tables in the Programmer’s Model,
starting on page 175.
Fixed Peripheral Select This mode is ideal for transferring memory blocks without the extra overhead in the
transmit data register to determine the peripheral.
Fixed Peripheral Select is activated by setting bit PS to zero in SP_MR (Mode Register).
The peripheral is defined by the PCS field, also in SP_MR.
This option is only available when the SPI is programmed in master mode.
Variable Peripheral Select Variable Peripheral Select is activated by setting bit PS to one. The PCS field in
SP_TDR (Transmit Data Register) is used to select the destination peripheral. The data
transfer characteristics are changed when the selected peripheral changes, according
to the associated chip select register.
The PCS field in the SP_MR has no effect.
This option is only available when the SPI is programmed in master mode.
Chip Selects The Chip Select lines are driven by the SPI only if it is programmed in Master mode.
These lines are used to select the destination peripheral. The PCSDEC field in SP_MR
(Mode Register) selects 1 to 4 peripherals (PCSDEC = 0) or up to 15 peripherals (PCS-
DEC = 1).
If Variable Peripheral Select is active, the chip select signals are defined for each trans-
fer in the PCS field in SP_TDR. Chip select signals can thus be defined independently
for each transfer.
If Fixed Peripheral Select is active, Chip Select signals are defined for all transfers by
the field PCS in SP_MR. If a transfer with a new peripheral is necessary, the software
must wait until the current transfer is completed, then change the value of PCS in
SP_MR before writing new data in SP_TDR.
The value on the NPCS pins at the end of each transfer can be read in the SP_RDR
(Receive Data Register). By default, all NPCS signals are high (equal to one) before and
after each transfer.
168 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
Mode Fault Detection A mode fault is detected when the SPI is programmed in Master Mode and a low level is
driven by an external master on the NPCSA/NSS signal.
When a mode fault is detected, the MODF bit in the SP_SR is set until the SP_SR is
read and the SPI is disabled until re-enabled by bit SPIEN in the SP_CR (Control
Register).
169
1779B–ATARM–22-Mar-02
Figure 61. Functional Flow Diagram in Master Mode
SPI Enable
1
TDRE
0 Fixed peripheral
PS
1 Variable peripheral
Delay DLYBS
Serializer = SP_TDR(TD)
TDRE = 1
Data Transfer
SP_RDR(RD) = Serializer
RDRF = 1
Delay DLYBCT
0
TDRE
1 0 Fixed peripheral
PS
NPCS = 0xF
1 Variable peripheral
Delay DLYBCS
Same peripheral
SP_TDR(PCS)
New peripheral
NPCS = 0xF
Delay DLYBCS
NPCS = SP_TDR(PCS)
170 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
SPIDIS SPIEN
Q
R
SP_RDR
PCS RD
LSB MSB
MISO Serializer MOSI
SP_TDR
PCS TD
NPCS3
NPCS2
NPCS1
SP_MR(PS)
NPCS0
SP_MR(PCS) 0
SP_MR(MSTR)
SP_SR M T R O S
O D D V P
D R R R I
F E F E E
N
S
SP_IER
SP_IDR
SP_IMR
SPIRQ
171
1779B–ATARM–22-Mar-02
Slave Mode In Slave Mode, the SPI waits for NSS to go active low before receiving the serial clock
from an external master.
In slave mode CPOL, NCPHA and BITS fields of SP_CSR0 are used to define the
transfer characteristics. The other Chip Select Registers are not used in slave mode.
SPCK
NSS
SPIDIS SPIEN
Q
R
SP_RDR
RD
LSB MSB
MOSI Serializer MISO
SP_TDR
TD
SP_SR S T R O
P D D V
I R R R
E E F E
N
S
SP_IER
SP_IDR
SP_IMR
SPIRQ
172 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
SPCK
(CPOL = 0)
SPCK
(CPOL = 1)
MOSI
(from Master)
MSB 6 5 4 3 2 1 LSB
MISO
(from Slave) MSB 6 5 4 3 2 1 LSB X
SPCK
(CPOL = 0)
SPCK
(CPOL = 1)
MOSI
(from Master)
MSB 6 5 4 3 2 1 LSB
MISO
(from Slave) X MSB 6 5 4 3 2 1 LSB
173
1779B–ATARM–22-Mar-02
Figure 66. Programmable Delays (DLYBCS, DLYBS and DLYBCT)
Chip Select 1
Change peripheral
Chip Select 2 No change
of peripheral
SPCK Output
DLYBCS DLYBS DLYBCT DLYBCT
Clock Generation In Master Mode the SPI Master Clock is either MCK or MCK/32, as defined by the
MCK32 field of SP_MR. The SPI baud rate clock is generated by dividing the SPI Mas-
ter Clock by a value between 4 and 510. The divisor is defined in the SCBR field in each
Chip Select Register. The transfer speed can thus be defined independently for each
chip select signal.
CPOL and NCPHA in the Chip Select Registers define the clock/data relationship
between master and slave devices. CPOL defines the inactive value of the SPCK.
NCPHA defines which edge causes data to change and which edge causes data to be
captured.
In Slave Mode, the input clock low and high pulse duration must strictly be longer than
two system clock (MCK) periods.
Peripheral Data Each SPI is closely connected to two Peripheral Data Controller channels. One is dedi-
Controller cated to the receiver. The other is dedicated to the transmitter.
The PDC channel is programmed using SP_TPR (Transmit Pointer) and SP_TCR
(Transmit Counter) for the transmitter and SP_RPR (Receive Pointer) and SP_RCR
(Receive Counter) for the receiver. The status of the PDC is given in SP_SR by the
SPENDTX bit for the transmitter and by the SPENDRX bit for the receiver.
The pointer registers (SP_TPR and SP_RPR) are used to store the address of the
transmit or receive buffers. The counter registers (SP_TCR and SP_RCR) are used to
store the size of these buffers.
The receiver data transfer is triggered by the RDRF bit and the transmitter data transfer
is triggered by TDRE. When a transfer is performed, the counter is decremented and the
pointer is incremented. When the counter reaches 0, the status bit is set (SPENDRX for
the receiver, SPENDTX for the transmitter in SP_SR) and can be programmed to gener-
ate an interrupt. While the counter is at zero, the status bit is asserted and transfers are
disabled.
174 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
175
1779B–ATARM–22-Mar-02
SPI Control Register
Register Name: SP_CR
Access Type: Write-only
Offset: 0x00
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
SWRST – – – – – SPIDIS SPIEN
176 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
23 22 21 20 19 18 17 16
– – – – PCS
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
LLB – – – MCK32 PCSDEC PS MSTR
177
1779B–ATARM–22-Mar-02
• DLYBCS: Delay Between Chip Selects (Code Label SP_DLYBCS)
This field defines the delay from NPCS inactive to the activation of another NPCS. The DLYBCS time guarantees non-
overlapping chip selects and solves bus contentions in case of peripherals having long data float times.
If DLYBCS is less than or equal to six, six SPI Master Clock periods will be inserted by default.
Otherwise, the following equation determines the delay:
Delay_ Between_Chip_Selects = DLYBCS • SPI_Master_Clock_period
23 22 21 20 19 18 17 16
– – – – PCS
15 14 13 12 11 10 9 8
RD
7 6 5 4 3 2 1 0
RD
178 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
23 22 21 20 19 18 17 16
– – – – PCS
15 14 13 12 11 10 9 8
TD
7 6 5 4 3 2 1 0
TD
179
1779B–ATARM–22-Mar-02
SPI Status Register
Register Name: SP_SR
Access Type: Read-only
Offset: 0x10
Reset Value: 0x0
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – SPIENS
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – SPENDTX SPENDRX OVRES MODF TDRE RDRF
180 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – SPENDTX SPENDRX OVRES MODF TDRE RDRF
• RDRF: Receive Data Register Full Interrupt Enable (Code Label SP_RDRF)
0 = No effect.
1 = Enables the Receiver Data Register Full Interrupt.
• TDRE: SPI Transmit Data Register Empty Interrupt Enable (Code Label SP_TDRE)
0 = No effect.
1 = Enables the Transmit Data Register Empty Interrupt.
• MODF: Mode Fault Error Interrupt Enable (Code Label SP_MODF)
0 = No effect.
1 = Enables the Mode Fault Interrupt.
• OVRES: Overrun Error Interrupt Enable (Code Label SP_OVRES)
0 = No effect.
1 = Enables the Overrun Error Interrupt.
• SPENDRX: End of Receiver Transfer Interrupt Enable (Code Label SP_SPENDRX)
0 = No effect.
1 = Enables the End of Receiver Transfer Interrupt.
• SPENDTX: End of Transmitter Transfer Interrupt Enable (Code Label SP_SPENDTX)
0 = No effect.
1 = Enables the End of Transmitter Transfer Interrupt.
181
1779B–ATARM–22-Mar-02
SPI Interrupt Disable Register
Register Name: SP_IDR
Access Type: Write-only
Offset: 0x18
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – SPENDTX SPENDRX OVRES MODF TDRE RDRF
• RDRF: Receive Data Register Full Interrupt Disable (Code Label SP_RDRF)
0 = No effect.
1 = Disables the Receiver Data Register Full Interrupt.
• TDRE: Transmit Data Register Empty Interrupt Disable (Code Label SP_TDRE)
0 = No effect.
1 = Disables the Transmit Data Register Empty Interrupt.
• MODF: Mode Fault Interrupt Disable (Code Label SP_MODF)
0 = No effect.
1 = Disables the Mode Fault Interrupt.
• OVRES: Overrun Error Interrupt Disable (Code Label SP_OVRES)
0 = No effect.
1 = Disables the Overrun Error Interrupt.
• SPENDRX: End of Receiver Transfer Interrupt Disable (Code Label SP_SPENDRX)
0 = No effect.
1 = Disables the End of Receiver Transfer Interrupt.
• SPENDTX: End of Transmitter Transfer Interrupt Disable (Code Label SP_SPENDTX)
0 = No effect.
1 = Disables the End of Transmitter Transfer Interrupt.
182 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – SPENDTX SPENDRX OVRES MODF TDRE RDRF
• RDRF: Receive Data Register Full Interrupt Mask (Code Label SP_RDRF)
0 = Receive Data Register Full Interrupt is disabled.
1 = Receive Data Register Full Interrupt is enabled.
• TDRE: Transmit Data Register Empty Interrupt Mask (Code Label SP_TDRE)
0 = Transmit Data Register Empty Interrupt is disabled.
1 = Transmit Data Register Empty Interrupt is enabled.
• MODF: Mode Fault Interrupt Mask (Code Label SP_MODF)
0 = Mode Fault Interrupt is disabled.
1 = Mode Fault Interrupt is enabled.
• OVRES: Overrun Error Interrupt Mask (Code Label SP_OVRES)
0 = Overrun Error Interrupt is disabled.
1 = Overrun Error Interrupt is enabled.
• SPENDRX: End of Receiver Transfer Interrupt Mask (Code Label SP_SPENDRX)
0 = End of Receiver Transfer Interrupt is disabled.
1 = End of Receiver Transfer Interrupt is enabled.
• SPENDTX: End of Transmitter Transfer Interrupt Mask (Code Label SP_SPENDTX)
0 = End of Transmitter Transfer Interrupt is disabled.
1 = End of Transmitter Transfer Interrupt is enabled.
183
1779B–ATARM–22-Mar-02
SPI Receive Pointer Register
Name: SP_RPR
Access Type: Read/Write
Offset: 0x20
Reset Value: 0x0
31 30 29 28 27 26 25 24
RXPTR
23 22 21 20 19 18 17 16
RXPTR
15 14 13 12 11 10 9 8
RXPTR
7 6 5 4 3 2 1 0
RXPTR
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
RXCTR
7 6 5 4 3 2 1 0
RXCTR
184 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
23 22 21 20 19 18 17 16
TXPTR
15 14 13 12 11 10 9 8
TXPTR
7 6 5 4 3 2 1 0
TXPTR
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
TXCTR
7 6 5 4 3 2 1 0
TXCTR
185
1779B–ATARM–22-Mar-02
SPI Chip Select Register
Register Name: SP_CSR0..SP_CSR3
Access Type: Read/Write
Reset Value: 0x0
31 30 29 28 27 26 25 24
DLYBCT
23 22 21 20 19 18 17 16
DLYBS
15 14 13 12 11 10 9 8
SCBR
7 6 5 4 3 2 1 0
BITS – – NCPHA CPOL
186 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
187
1779B–ATARM–22-Mar-02
JTAG Boundary-scan The Boundary-scan Register (BSR) contains 237 bits which correspond to active pins
and associated control signals.
Register
Each AT91M42800A input pin has a corresponding bit in the Boundary-scan Register
for observability.
Each AT91M42800A output pin has a corresponding 2-bit register in the BSR. The
OUTPUT bit contains data that can be forced on the pad. The CTRL bit can put the pad
into high impedance.
Each AT91M42800A in/out pin corresponds to a 3-bit register in the BSR. The OUTPUT
bit contains data that can be forced on the pad. The INPUT bit is for the observability of
data applied to the pad. The CTRL bit selects the direction of the pad.
188 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
189
1779B–ATARM–22-Mar-02
Table 22. Boundary-scan Register (Continued)
Bit Associated Bit Associated
Number Pin Name Pin Type BSR Cells Number Pin Name Pin Type BSR Cells
153 OUTPUT 120 OUTPUT
152 PB21/TCLK5 IN/OUT INPUT 119 PB10/TIOA1 IN/OUT INPUT
151 CTRL 118 CTRL
117 OUTPUT 82 D5 IN/OUT INPUT
116 PB9/TCLK1 IN/OUT INPUT 81 OUTPUT
D4 IN/OUT
115 CTRL 80 INPUT
114 OUTPUT 79 D[7:4] IN/OUT CTRL
113 PB8/TIOB0 IN/OUT INPUT 78 OUTPUT
D3 IN/OUT
112 CTRL 77 INPUT
111 OUTPUT 76 OUTPUT
D2 IN/OUT
110 PB7/TIOA0 IN/OUT INPUT 75 INPUT
109 CTRL 74 OUTPUT
D1 IN/OUT
108 IN/OUT OUTPUT 73 INPUT
107 PB6/TCLK0 INPUT 72 OUTPUT
D0 IN/OUT
106 CTRL 71 INPUT
105 OUTPUT 70 D[3:0] IN/OUT CTRL
D15 IN/OUT
104 INPUT 69 OUTPUT
103 OUTPUT 68 PB5/A23/CS4 IN/OUT INPUT
D14 IN/OUT
102 INPUT 67 CTRL
101 OUTPUT 66 OUTPUT
D13 IN/OUT
100 INPUT 65 PB4/A22/CS5 IN/OUT INPUT
99 OUTPUT 64 CTRL
D12 IN/OUT
98 INPUT 63 OUTPUT
97 D[15:12] IN/OUT CTRL 62 PB3/A21/CS6 IN/OUT INPUT
96 OUTPUT 61 CTRL
D11 IN/OUT
95 INPUT 60 OUTPUT
94 OUTPUT 59 PB2/A20/CS7 IN/OUT INPUT
D10 IN/OUT
93 INPUT 58 CTRL
92 OUTPUT 57 A19 OUTPUT OUTPUT
D9 IN/OUT
91 INPUT 56 A18 OUTPUT OUTPUT
90 OUTPUT 55 A17 OUTPUT OUTPUT
D8 IN/OUT
89 INPUT 54 A16 OUTPUT OUTPUT
88 D[11:8] IN/OUT CTRL 53 A[19:16] OUTPUT CTRL
87 OUTPUT 52 A15 OUTPUT OUTPUT
D7 IN/OUT
86 INPUT 51 A14 OUTPUT OUTPUT
190 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
191
1779B–ATARM–22-Mar-02
Document Details
Title AT91M42800A Datasheet
Revision History
192 AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
Description ............................................................................................ 1
Pin Configuration.................................................................................. 2
Block Diagram....................................................................................... 7
Architectural Overview......................................................................... 8
Memories .............................................................................................................. 8
Peripherals............................................................................................................ 8
Peripherals .......................................................................................... 15
System Peripherals............................................................................................. 16
User Peripherals ................................................................................................. 17
Memory Map........................................................................................ 18
i
1779B–ATARM–22-Mar-02
Memory Access Waveforms ............................................................................... 36
EBI User Interface .............................................................................................. 48
EBI Chip Select Register .................................................................................... 49
EBI Remap Control Register .............................................................................. 51
EBI Memory Control Register ............................................................................. 51
Abort Status Register.......................................................................................... 53
Abort Address Status Register ........................................................................... 54
ii AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
iii
1779B–ATARM–22-Mar-02
PIO Multi-drive Status Register ........................................................................ 115
iv AT91M42800A
1779B–ATARM–22-Mar-02
AT91M42800A
v
1779B–ATARM–22-Mar-02
Atmel Headquarters Atmel Operations
Corporate Headquarters Memory RF/Automotive
2325 Orchard Parkway Atmel Corporate Atmel Heilbronn
San Jose, CA 95131 2325 Orchard Parkway Theresienstrasse 2
TEL 1(408) 441-0311 San Jose, CA 95131 Postfach 3535
FAX 1(408) 487-2600 TEL 1(408) 436-4270 74025 Heilbronn, Germany
FAX 1(408) 436-4314 TEL (49) 71-31-67-0
Europe FAX (49) 71-31-67-2340
Atmel SarL Microcontrollers
Route des Arsenaux 41 Atmel Corporate Atmel Colorado Springs
Casa Postale 80 2325 Orchard Parkway 1150 East Cheyenne Mtn. Blvd.
CH-1705 Fribourg San Jose, CA 95131 Colorado Springs, CO 80906
Switzerland TEL 1(408) 436-4270 TEL 1(719) 576-3300
TEL (41) 26-426-5555 FAX 1(408) 436-4314 FAX 1(719) 540-1759
FAX (41) 26-426-5500
Atmel Nantes Biometrics/Imaging/Hi-Rel MPU/
Asia La Chantrerie High Speed Converters/RF Datacom
Atmel Asia, Ltd. BP 70602 Atmel Grenoble
Room 1219 44306 Nantes Cedex 3, France Avenue de Rochepleine
Chinachem Golden Plaza TEL (33) 2-40-18-18-18 BP 123
77 Mody Road Tsimhatsui FAX (33) 2-40-18-19-60 38521 Saint-Egreve Cedex, France
East Kowloon TEL (33) 4-76-58-30-00
Hong Kong ASIC/ASSP/Smart Cards FAX (33) 4-76-58-34-80
TEL (852) 2721-9778 Atmel Rousset
FAX (852) 2722-1369 Zone Industrielle
13106 Rousset Cedex, France
Japan TEL (33) 4-42-53-60-00
Atmel Japan K.K. FAX (33) 4-42-53-60-01
9F, Tonetsu Shinkawa Bldg.
1-24-8 Shinkawa Atmel Colorado Springs
Chuo-ku, Tokyo 104-0033 1150 East Cheyenne Mtn. Blvd.
Japan Colorado Springs, CO 80906
TEL (81) 3-3523-3551 TEL 1(719) 576-3300
FAX (81) 3-3523-7581 FAX 1(719) 540-1759
e-mail
literature@atmel.com
Web Site
http://www.atmel.com
1779B–ATARM–22-Mar-02 0M