At91sam9 PDF
At91sam9 PDF
At91sam9 PDF
•
Interface
External Bus Interface (EBI)
Preliminary
– Supports SDRAM, Static Memory, ECC-enabled NAND Flash and CompactFlash™
• USB 2.0 Full Speed (12 Mbits per second) Device Port
– On-chip Transceiver, 2,688-byte Configurable Integrated DPRAM
• USB 2.0 Full Speed (12 Mbits per second) Host Single Port in the 208-pin PQFP Device
and Double Port in 217-ball LFBGA Device
– Single or Dual On-chip Transceivers
– Integrated FIFOs and Dedicated DMA Channels
• Ethernet MAC 10/100 Base-T
– Media Independent Interface or Reduced Media Independent Interface
– 128-byte FIFOs and Dedicated DMA Channels for Receive and Transmit
• Image Sensor Interface
– ITU-R BT. 601/656 External Interface, Programmable Frame Capture Rate
– 12-bit Data Interface for Support of High Sensibility Sensors
– SAV and EAV Synchronization, Preview Path with Scaler, YCbCr Format
• Bus Matrix
– Six 32-bit-layer Matrix
– Remap Command
• Fully-featured System Controller, including
– Reset Controller, Shutdown Controller
– Four 32-bit Battery Backup Registers for a Total of 16 Bytes
– Clock Generator and Power Management Controller
– Advanced Interrupt Controller and Debug Unit
– Periodic Interval Timer, Watchdog Timer and Real-time Timer
6254C–ATARM–22-Jan-10
• Reset Controller (RSTC)
– Based on a Power-on Reset Cell, Reset Source Identification and Reset Output Control
• Clock Generator (CKGR)
– Selectable 32,768 Hz Low-power Oscillator or Internal Low Power RC Oscillator on Battery Backup Power Supply,
Providing a Permanent Slow Clock
– 3 to 20 MHz On-chip Oscillator, One Up to 240 MHz PLL and One Up to 100 MHz PLL
• Power Management Controller (PMC)
– Very Slow Clock Operating Mode, Software Programmable Power Optimization Capabilities
– Two Programmable External Clock Signals
• Advanced Interrupt Controller (AIC)
– Individually Maskable, Eight-level Priority, Vectored Interrupt Sources
– Three External Interrupt Sources and One Fast Interrupt Source, Spurious Interrupt Protected
• Debug Unit (DBGU)
– 2-wire UART and support for Debug Communication Channel, Programmable ICE Access Prevention
– Mode for General Purpose Two-wire UART Serial Communication
• Periodic Interval Timer (PIT)
– 20-bit Interval Timer Plus 12-bit Interval Counter
• Watchdog Timer (WDT)
– Key-protected, Programmable Only Once, Windowed 16-bit Counter Running at Slow Clock
• Real-Time Timer (RTT)
– 32-bit Free-running Backup Counter Running at Slow Clock with 16-bit Prescaler
• One 4-channel 10-bit Analog to Digital Converter
• Three 32-bit Parallel Input/Output Controllers (PIOA, PIOB, PIOC,)
– 96 Programmable I/O Lines Multiplexed with up to Two Peripheral I/Os
– Input Change Interrupt Capability on Each I/O Line
– Individually Programmable Open-drain, Pull-up Resistor and Synchronous Output
• Peripheral DMA Controller Channels (PDC)
• Two-slot Multimedia Card Interface (MCI)
– SDCard/SDIO and MultiMediaCard™ Compliant
– Automatic Protocol Control and Fast Automatic Data Transfers with PDC
• One Synchronous Serial Controllers (SSC)
– Independent Clock and Frame Sync Signals for Each Receiver and Transmitter
– I²S Analog Interface Support, Time Division Multiplex Support
– High-speed Continuous Data Stream Capabilities with 32-bit Data Transfer
• Four Universal Synchronous/Asynchronous Receiver Transmitters (USART)
– Individual Baud Rate Generator, IrDA® Infrared Modulation/Demodulation, Manchester Encoding/Decoding
– Support for ISO7816 T0/T1 Smart Card, Hardware Handshaking, RS485 Support
– Full Modem Signal Control on USART0
• One 2-wire UART
• Two Master/Slave Serial Peripheral Interface (SPI)
– 8- to 16-bit Programmable Data Length, Four External Peripheral Chip Selects
– Synchronous Communications
• Two Three-channel 16-bit Timer/Counters (TC)
– Three External Clock Inputs, Two Multi-purpose I/O Pins per Channel
– Double PWM Generation, Capture/Waveform Mode, Up/Down Capability
– High-Drive Capability on Outputs TIOA0, TIOA1, TIOA2
• Two Two-wire Interfaces (TWI)
– Master, Multi-master and Slave Mode Operation
– General Call Supported in Slave Mode
– Connection to PDC Channel to Optimize Data Transfers in Master Mode Only
2 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
1. AT91SAM9XE128/256/512 Description
The AT91SAM9XE128/256/512 is based on the integration of an ARM926EJ-S processor with
fast ROM and RAM, 128, 256 or 512 Kbytes of Flash and a wide range of peripherals.
The embedded Flash memory can be programmed in-system via the JTAG-ICE interface or via
a parallel interface on a production programmer prior to mounting. Built-in lock bits a security bit
and MMU protect the firmware from accidental overwrite and preserve its confidentiality.
The AT91SAM9XE128/256/512 embeds an Ethernet MAC, one USB Device Port, and a USB
Host Controller. It also integrates several standard peripherals, like six UARTs, SPI, TWI, Timer
Counters, Synchronous Serial Controller, ADC and a MultiMedia/SD Card Interface.
The AT91SAM9XE128/256/512 system controller includes a reset controller capable of manag-
ing the power-on sequence of the microcontroller and the complete system. Correct device
operation can be monitored by a built-in brownout detector and a watchdog running off an inte-
grated RC oscillator.
The AT91SAM9XE128/256/512 is architectured on a 6-layer matrix, allowing a maximum inter-
nal bandwidth of six 32-bit buses. It also features an External Bus Interface capable of
interfacing with a wide range of memory devices.
The pinout and ball-out are fully compatible with the AT91SAM9260 with the exception that the
pin BMS is replaced by the pin ERASE.
3
6254C–ATARM–22-Jan-10
2. AT91SAM9XE128/256/512 Block Diagram
The block diagram shows all the features for the 217-LFBGA package. Some functions are not
accessible in the 208-PQFP package and the unavailable pins are highlighted in “Multiplexing
on PIO Controller A” on page 36, “Multiplexing on PIO Controller B” on page 37, “Multiplexing on
PIO Controller C” on page 38. The USB Host Port B is also not available. Table 2-1 on page 4
defines all the multiplexed and not multiplexed pins not available in the 208-PQFP package.
Table 2-1. Unavailable Signals in 208-pin PQFP Device
PIO Peripheral A Peripheral B
- HDPB -
- HDMB -
PA30 SCK2 RXD4
PA31 SCK0 TXD4
PB12 TWD1 ISI_D10
PB13 TWCK1 ISI_D11
PC2 AD2 PCK1
PC3 AD3 SPI1_NPCS3
PC12 IRQ0 NCS7
4 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
Figure 2-1.
R
T
L
NC
MASTER SLAVE
E
R O
K
B
N
- R
A
SE
SY C
M
P
H
M
AS
V
D
CK
R
_ K
00
_M
AG
I_
I
D - X
D
I_ N D7
I
H
T
T
I_ O-I
HD B
6254C–ATARM–22-Jan-10
HD
HD PA
ER
TD ST
TDI
TMO
TC S
RTK
JT
E
E XC
ECXE -E
ERRS -E XC
ERXE -EC XE K
ET X0 -E L R
M X0 ER XD
M C ETX 3 V
F1 IO
IS CK
IS PC
S
IS SY SI_
NT
IS
I D
TST System JTAG Selection and Boundary Scan
Controller Transc. Transc.
Filter
XIN OSC
XOUT
WDT PIT
6-layer Matrix
RC 4GPREG
OSCSEL
XIN32 OSC RTT
AT91SAM9XE128/256/512 Block Diagram
XOUT32
D0-D15
SHDN PIOA A0/NBS0
SHDC Flash ROM Fast SRAM
WKUP EBI A1/NBS2/NWR2
PIOB 128, 256 32 Kbytes 16 or 32 Peripheral 24-channel A2-A15, A18-A20
or 512 Kbytes Bridge Peripheral CompactFlash A16/BA0
VDDBU POR
PIOC Kbytes DMA NAND Flash A17/BA1
NCS0
VDDCORE POR NCS1/SDCS
RSTC
BOD NRD
NRST NWR0/NWE
APB NWR1/NBS1
NWR3/NBS3
SDRAM SDCK, SDCKE
Controller RAS, CAS
SDWE, SDA10
PDC PDC PDC PDC PDC PDC DPRAM NANDOE, NANDWE
Static A21/NANDALE
USART0
MCI SPI0 TC0 TC3 SSC 4-channel USB Memory A22/NANDCLE
TWI0 USART1 D16-D31
SPI1 TC1 TC4 10-bit ADC Device Controller
TWI1 USART2 NWAIT
TC2 TC5
USART3 A23-A24
USART4 ECC NCS4/CFCS0
Controller NCS5/CFCS1
A25/CFRNW
CFCE1-CFCE2
Transceiver NCS2, NCS6, NCS7
NCS3/NANDCS
A
EF
NA
AN
VR
IG
DA
K
P
O
B5
TF
TK
D
R0
TD
RF
ND
D
RK
RD
R0
D
OK
IS
AD
TR
X
S
C 1
VD
CC
G
DDM
T
IO 5
-A
D
R 3
C
MC
M SI
S 3
DT I0
CD
D D5
DCR0
SP S0
CC 3
-T D5
M A
-T OA
AD D3
NP
NPCS
NPCS3
NPCS2
M
D0
M DA
3
-M B
D -RX 3
A
0-
B I 5
A0 CD
B
O -T
O -
L
O 0-T LK
L -T 2
O -T LK
RTS0- CK
CT TWWD
T D0 CK
I
SC S0- TS
RX K0- TS
SPI0_, SPI1_
TI K0
TI K3 IOB
T A C
TI A3 TC 2
CD MC B3
CD
TC
TC B0 IOA2
5
AT91SAM9XE128/256/512 Preliminary
3. Signal Description
Table 3-1 gives details on the signal name classified by peripheral.
6 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
7
6254C–ATARM–22-Jan-10
Table 3-1. Signal Description List (Continued)
Active Reference
Signal Name Function Type Level Voltage Comments
CompactFlash Support
CFCE1 - CFCE2 CompactFlash Chip Enable Output Low VDDIOM
CFOE CompactFlash Output Enable Output Low VDDIOM
CFWE CompactFlash Write Enable Output Low VDDIOM
CFIOR CompactFlash IO Read Output Low VDDIOM
CFIOW CompactFlash IO Write Output Low VDDIOM
CFRNW CompactFlash Read Not Write Output VDDIOM
CFCS0 - CFCS1 CompactFlash Chip Select Lines Output Low VDDIOM
NAND Flash Support
NANDCS NAND Flash Chip Select Output Low VDDIOM
NANDOE NAND Flash Output Enable Output Low VDDIOM
NANDWE NAND Flash Write Enable Output Low VDDIOM
SDRAM Controller
SDCK SDRAM Clock Output VDDIOM
SDCKE SDRAM Clock Enable Output High VDDIOM
SDCS SDRAM Controller Chip Select Output Low VDDIOM
BA0 - BA1 Bank Select Output VDDIOM
SDWE SDRAM Write Enable Output Low VDDIOM
RAS - CAS Row and Column Signal Output Low VDDIOM
SDA10 SDRAM Address 10 Line Output VDDIOM
Multimedia Card Interface MCI
MCCK Multimedia Card Clock Output VDDIOP0
MCCDA Multimedia Card Slot A Command I/O VDDIOP0
MCDA0 -
Multimedia Card Slot A Data I/O VDDIOP0
MCDA3
MCCDB Multimedia Card Slot B Command I/O VDDIOP0
MCDB0 -
Multimedia Card Slot B Data I/O VDDIOP0
MCDB3
Universal Synchronous Asynchronous Receiver Transmitter USARTx
(2)
SCKx USARTx Serial Clock I/O
(2)
TXDx USARTx Transmit Data I/O
(2)
RXDx USARTx Receive Data Input
(2)
RTSx USARTx Request To Send Output
(2)
CTSx USARTx Clear To Send Input
(2)
DTR0 USART0 Data Terminal Ready Output
(2)
DSR0 USART0 Data Set Ready Input
(2)
DCD0 USART0 Data Carrier Detect Input
(2)
RI0 USART0 Ring Indicator Input
8 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
9
6254C–ATARM–22-Jan-10
Table 3-1. Signal Description List (Continued)
Active Reference
Signal Name Function Type Level Voltage Comments
Ethernet 10/100
ETXCK Transmit Clock or Reference Clock Input VDDIOP0 MII only, REFCK in RMII
ERXCK Receive Clock Input VDDIOP0 MII only
ETXEN Transmit Enable Output VDDIOP0
ETX0-ETX3 Transmit Data Output VDDIOP0 ETX0-ETX1 only in RMII
ETXER Transmit Coding Error Output VDDIOP0 MII only
ERXDV Receive Data Valid Input VDDIOP0 RXDV in MII, CRSDV in RMII
ERX0-ERX3 Receive Data Input VDDIOP0 ERX0-ERX1 only in RMII
ERXER Receive Error Input VDDIOP0
ECRS Carrier Sense and Data Valid Input VDDIOP0 MII only
ECOL Collision Detect Input VDDIOP0 MII only
EMDC Management Data Clock Output VDDIOP0
EMDIO Management Data Input/Output I/O VDDIOP0
EF100 Force 100Mbit/sec. Output High VDDIOP0
Image Sensor Interface
ISI_D0-ISI_D11 Image Sensor Data Input VDDIOP1
ISI_MCK Image sensor Reference clock output VDDIOP1
ISI_HSYNC Image Sensor Horizontal Synchro input VDDIOP1
ISI_VSYNC Image Sensor Vertical Synchro input VDDIOP1
ISI_PCK Image Sensor Data clock input VDDIOP1
Analog to Digital Converter
AD0-AD3 Analog Inputs Analog VDDANA Digital pulled-up inputs at reset
ADVREF Analog Positive Reference Analog VDDANA
ADTRG ADC Trigger Input VDDANA
Fast Flash Programming Interface
PGMEN[3:0] Programming Enabling Input VDDIOP0
PGMNCMD Programming Command Input Low VDDIOP0
PGMRDY Programming Ready Output High VDDIOP0
PGMNOE Programming Read Input Low VDDIOP0
PGMNVALID Data Direction Output Low VDDIOP0
PGMM[3:0] Programming Mode Input VDDIOP0
PGMD[15:0] Programming Data I/O VDDIOP0
Notes: 1. Programming of this pull-up resistor is performed independently for each I/O line through the PIO Controllers. After reset, all
the I/O lines default as inputs with pull-up resistors enabled, except those which are multiplexed with the External Bus Inter-
face signals that require to be enabled as Peripheral at reset. This is explicitly indicated in the column “Reset State” of the
peripheral multiplexing tables.
2. Refer to PIO Multiplexing (see Section 10.3 “Peripheral Signals Multiplexing on I/O Lines”).
10 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
157 104
208
53
1 52
11
6254C–ATARM–22-Jan-10
4.2 208-pin PQFP Package Pinout
Table 4-1. Pinout for 208-pin PQFP Package
Pin Signal Name Pin Signal Name Pin Signal Name Pin Signal Name
1 PA24 53 GND 105 RAS 157 ADVREF
2 PA25 54 DDM 106 D0 158 PC0
3 PA26 55 DDP 107 D1 159 PC1
4 PA27 56 PC13 108 D2 160 VDDANA
5 VDDIOP0 57 PC11 109 D3 161 PB10
6 GND 58 PC10 110 D4 162 PB11
7 PA28 59 PC14 111 D5 163 PB20
8 PA29 60 PC9 112 D6 164 PB21
9 PB0 61 PC8 113 GND 165 PB22
10 PB1 62 PC4 114 VDDIOM 166 PB23
11 PB2 63 PC6 115 SDCK 167 PB24
12 PB3 64 PC7 116 SDWE 168 PB25
13 VDDIOP0 65 VDDIOM 117 SDCKE 169 VDDIOP1
14 GND 66 GND 118 D7 170 GND
15 PB4 67 PC5 119 D8 171 PB26
16 PB5 68 NCS0 120 D9 172 PB27
17 PB6 69 CFOE/NRD 121 D10 173 GND
18 PB7 70 CFWE/NWE/NWR0 122 D11 174 VDDCORE
19 PB8 71 NANDOE 123 D12 175 PB28
20 PB9 72 NANDWE 124 D13 176 PB29
21 PB14 73 A22 125 D14 177 PB30
22 PB15 74 A21 126 D15 178 PB31
23 PB16 75 A20 127 PC15 179 PA0
24 VDDIOP0 76 A19 128 PC16 180 PA1
25 GND 77 VDDCORE 129 PC17 181 PA2
26 PB17 78 GND 130 PC18 182 PA3
27 PB18 79 A18 131 PC19 183 PA4
28 PB19 80 BA1/A17 132 VDDIOM 184 PA5
29 TDO 81 BA0/A16 133 GND 185 PA6
30 TDI 82 A15 134 PC20 186 PA7
31 TMS 83 A14 135 PC21 187 VDDIOP0
32 VDDIOP0 84 A13 136 PC22 188 GND
33 GND 85 A12 137 PC23 189 PA8
34 TCK 86 A11 138 PC24 190 PA9
35 NTRST 87 A10 139 PC25 191 PA10
36 NRST 88 A9 140 PC26 192 PA11
37 RTCK 89 A8 141 PC27 193 PA12
38 VDDCORE 90 VDDIOM 142 PC28 194 PA13
39 GND 91 GND 143 PC29 195 PA14
40 ERASE 92 A7 144 PC30 196 PA15
41 OSCSEL 93 A6 145 PC31 197 PA16
42 TST 94 A5 146 GND 198 PA17
43 JTAGSEL 95 A4 147 VDDCORE 199 VDDIOP0
44 GNDBU 96 A3 148 VDDPLL 200 GND
45 XOUT32 97 A2 149 XIN 201 PA18
46 XIN32 98 NWR2/NBS2/A1 150 XOUT 202 PA19
47 VDDBU 99 NBS0/A0 151 GNDPLL 203 VDDCORE
48 WKUP 100 SDA10 152 NC 204 GND
49 SHDN 101 CFIOW/NBS3/NWR3 153 GNDPLL 205 PA20
50 HDMA 102 CFIOR/NBS1/NWR1 154 PLLRCA 206 PA21
51 HDPA 103 SDCS/NCS1 155 VDDPLL 207 PA22
52 VDDIOP0 104 CAS 156 GNDANA 208 PA23
12 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
A B C D E F G H J K L M N P R T U
Ball A1
13
6254C–ATARM–22-Jan-10
4.4 217-ball LFBGA Package Pinout
Table 4-2. Pinout for 217-ball LFBGA Package
Pin Signal Name Pin Signal Name Pin Signal Name Pin Signal Name
A1 CFIOW/NBS3/NWR3 D5 A5 J14 TDO P17 PB5
A2 NBS0/A0 D6 GND J15 PB19 R1 NC
A3 NWR2/NBS2/A1 D7 A10 J16 TDI R2 GNDANA
A4 A6 D8 GND J17 PB16 R3 PC29
A5 A8 D9 VDDCORE K1 PC24 R4 VDDANA
A6 A11 D10 GND K2 PC20 R5 PB12
A7 A13 D11 VDDIOM K3 D15 R6 PB23
A8 BA0/A16 D12 GND K4 PC21 R7 GND
A9 A18 D13 DDM K8 GND R8 PB26
A10 A21 D14 HDPB K9 GND R9 PB28
A11 A22 D15 NC K10 GND R10 PA0
A12 CFWE/NWE/NWR0 D16 VDDBU K14 PB4 R11 PA4
A13 CFOE/NRD D17 XIN32 K15 PB17 R12 PA5
A14 NCS0 E1 D10 K16 GND R13 PA10
A15 PC5 E2 D5 K17 PB15 R14 PA21
A16 PC6 E3 D3 L1 GND R15 PA23
A17 PC4 E4 D4 L2 PC26 R16 PA24
B1 SDCK E14 HDPA L3 PC25 R17 PA29
B2 CFIOR/NBS1/NWR1 E15 HDMA L4 VDDIOP0 T1 PLLRCA
B3 SDCS/NCS1 E16 GNDBU L14 PA28 T2 GNDPLL
B4 SDA10 E17 XOUT32 L15 PB9 T3 PC0
B5 A3 F1 D13 L16 PB8 T4 PC1
B6 A7 F2 SDWE L17 PB14 T5 PB10
B7 A12 F3 D6 M1 VDDCORE T6 PB22
B8 A15 F4 GND M2 PC31 T7 GND
B9 A20 F14 OSCSEL M3 GND T8 PB29
B10 NANDWE F15 ERASE M4 PC22 T9 PA2
B11 PC7 F16 JTAGSEL M14 PB1 T10 PA6
B12 PC10 F17 TST M15 PB2 T11 PA8
B13 PC13 G1 PC15 M16 PB3 T12 PA11
B14 PC11 G2 D7 M17 PB7 T13 VDDCORE
B15 PC14 G3 SDCKE N1 XIN T14 PA20
B16 PC8 G4 VDDIOM N2 VDDPLL T15 GND
B17 WKUP G14 GND N3 PC23 T16 PA22
C1 D8 G15 NRST N4 PC27 T17 PA27
C2 D1 G16 RTCK N14 PA31 U1 GNDPLL
C3 CAS G17 TMS N15 PA30 U2 ADVREF
C4 A2 H1 PC18 N16 PB0 U3 PC2
C5 A4 H2 D14 N17 PB6 U4 PC3
C6 A9 H3 D12 P1 XOUT U5 PB20
C7 A14 H4 D11 P2 VDDPLL U6 PB21
C8 BA1/A17 H8 GND P3 PC30 U7 PB25
C9 A19 H9 GND P4 PC28 U8 PB27
C10 NANDOE H10 GND P5 PB11 U9 PA12
C11 PC9 H14 VDDCORE P6 PB13 U10 PA13
C12 PC12 H15 TCK P7 PB24 U11 PA14
C13 DDP H16 NTRST P8 VDDIOP1 U12 PA15
C14 HDMB H17 PB18 P9 PB30 U13 PA19
C15 NC J1 PC19 P10 PB31 U14 PA17
C16 VDDIOP0 J2 PC17 P11 PA1 U15 PA16
C17 SHDN J3 VDDIOM P12 PA3 U16 PA18
D1 D9 J4 PC16 P13 PA7 U17 VDDIOP0
D2 D2 J8 GND P14 PA9
D3 RAS J9 GND P15 PA26
D4 D0 J10 GND P16 PA25
14 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
5. Power Considerations
15
6254C–ATARM–22-Jan-10
1 MΩ. The resisitor value is calculated according to the regulator enable implementation and the
SHDN level.
The WKUP pin is an input-only. It can accept voltages only between 0V and VDDBU.
16 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
17
6254C–ATARM–22-Jan-10
Table 7-2. List of Bus Matrix Slaves (Continued)
Slave 3 Internal Flash
Slave 4 Internal Peripherals
Slave 5 Reserved
18 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
19
6254C–ATARM–22-Jan-10
8. Memories
Figure 8-1. AT91SAM9XE128/256/512 Memory Mapping
Address Memory Space Internal Memory Mapping Notes : (1) Can be ROM or Flash
depending on GPNVM[3]
0x0000 0000 0x0000 0000
Boot Memory (1)
Internal Memories 256M Bytes 0x10 0000
ROM 32K Bytes
0x0FFF FFFF
0x1000 0000 0x10 8000
Reserved
EBI 0x20 0000
Chip Select 0 256M Bytes
Flash 128, 256 or 512K Bytes
0x1FFF FFFF 0x28 0000
0x2000 0000 Reserved
EBI 0x30 0000
Chip Select 1/ 256M Bytes SRAM 32K Bytes
SDRAMC 0x30 8000
0x2FFF FFFF
0x3000 0000 Reserved
0x50 0000
EBI UHP 16K Bytes
Chip Select 2 256M Bytes 0x50 4000
0x3FFF FFFF
0x4000 0000 Reserved
EBI
Chip Select 3/ 256M Bytes 0x0FFF FFFF
NANDFlash
0x4FFF FFFF
0x5000 0000
EBI
Chip Select 4/
256M Bytes
Compact Flash
0x5FFF FFFF
Slot 0
0x6000 0000 EBI Peripheral Mapping
Chip Select 5/ 256M Bytes
Compact Flash 0xF000 0000 System Controller Mapping
0x6FFF FFFF Slot 1 Reserved
0x7000 0000 0xFFFA 0000
0xFFFF C000
EBI TCO, TC1, TC2 16K Bytes
Chip Select 6 256M Bytes 0xFFFA 4000 Reserved
0xFFFF E800
0x7FFF FFFF UDP 16K Bytes
0x8000 0000 0xFFFA 8000 ECC 512 Bytes
EBI 16K Bytes 0xFFFF EA00
256M Bytes MCI
Chip Select 7 0xFFFA C000
SDRAMC 512 Bytes
0x8FFF FFFF TWI0 16K Bytes
0x9000 0000 0xFFFF EC00
0xFFFB 0000
USART0 16K Bytes SMC 512 Bytes
0xFFFB 4000 0xFFFF EE00
USART1 16K Bytes MATRIX
0xFFFF EF10 512 Bytes
0xFFFB 8000
0xFFFF F000 CCFG
USART2 16K Bytes
0xFFFB C000 512 Bytes
AIC
SSC 16K Bytes 0xFFFF F200
0xFFFC 0000
DBGU 512 Bytes
ISI 16K Bytes
0xFFFF F400
0xFFFC 4000
EMAC 16K Bytes PIOA 512 Bytes
0xFFFC 8000 0xFFFF F600
Undefined 1,518M Bytes
SPI0 16K Bytes 512 bytes
(Abort) PIOB
0xFFFC C000 0xFFFF F800
SPI1 16K Bytes
PIOC 512 bytes
0xFFFD 0000
0xFFFF FA00
USART3 16K Bytes
EEFC 512 bytes
0xFFFD 4000
16K Bytes 0xFFFF FC00
USART4
PMC 256 Bytes
0xFFFD 8000
16K Bytes 0xFFFF FD00
TWI1 RSTC 16 Bytes
0xFFFD C000 0xFFFF FD10
SHDC 16 Bytes
TC3, TC4, TC5 16K Bytes 0xFFFF FD20
RTTC 16 Bytes
0xFFFE 0000 0xFFFF FD30
ADC 16K Bytes PITC 16 Bytes
0xEFFF FFFF 0xFFFF FD40
0xF000 0000 0xFFFE 4000 WDTC 16 Bytes
Reserved 0xFFFF FD50
Reserved
Internal Peripherals 256M Bytes 0xFFFF C000 0xFFFF FD60
16K Bytes GPBR 16 Bytes
SYSC 0xFFFF FD70
0xFFFF FFFF
0xFFFF FFFF Reserved
0xFFFF FFFF
20 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
A first level of address decoding is performed by the Bus Matrix, i.e., the implementation of the
Advanced High performance Bus (AHB) for its Master and Slave interfaces with additional
features.
Decoding breaks up the 4 Gbytes of address space into 16 banks of 256 Mbytes. The banks 1 to
7 are directed to the EBI that associates these banks to the external chip selects EBI_NCS0 to
EBI_NCS7. Bank 0 is reserved for the addressing of the internal memories, and a second level
of decoding provides 1 Mbyte of internal memory area. Bank 15 is reserved for the peripherals
and provides access to the Advanced Peripheral Bus (APB).
Other areas are unused and performing an access within them provides an abort to the master
requesting such an access.
Each Master has its own bus and its own decoder, thus allowing a different memory mapping
per Master. However, in order to simplify the mappings, all the masters have a similar address
decoding.
Regarding Master 0 and Master 1 (ARM926 Instruction and Data), three different Slaves are
assigned to the memory space decoded at address 0x0: one for internal boot, one for external
boot, one after remap, refer to Table 8-3, “Internal Memory Mapping,” on page 25 for details.
A complete memory map is presented in Figure 8-1 on page 20.
8.1.1 AT91SAM9XE128
• 32 Kbytes ROM
– Single Cycle Access at full matrix speed
• 16 Kbytes Fast SRAM
– Single Cycle Access at full matrix speed
• 128 Kbytes Embedded Flash
8.1.2 AT91SAM9XE256
• 32 Kbytes ROM
– Single Cycle Access at full matrix speed
• 32 Kbytes Fast SRAM
– Single Cycle Access at full matrix speed
• 256 Kbytes Embedded Flash
8.1.3 AT91SAM9XE512
• 32 Kbytes ROM
– Single Cycle Access at full matrix speed
• 32 Kbytes Fast SRAM
– Single Cycle Access at full matrix speed
• 512 Kbytes Embedded Flash
21
6254C–ATARM–22-Jan-10
at address zero depends on the combination of the TST pin and PA0 to PA3 pins. Figure 8-2
shows the contents of the ROM and the program available at address zero.
SAM-BA
Program
SAM-BA FFPI
Program Program
FFPI
Program
22 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
• Communication through the DBGU supports a wide range of crystals from 3 to 20 MHz via
software auto-detection.
• Communication through the USB Device Port is depends on crystal selected:
– limited to an 18,432 Hz crystal if the internal RC oscillator is selected
– supports a wide range of crystals from 3 to 20 MHz if the 32,768 Hz crystal is
selected
The SAM-BA Boot provides an interface with SAM-BA Graphic User Interface (GUI).
23
6254C–ATARM–22-Jan-10
Figure 8-3. Flash First Memory Plane Mapping
0x0020 0000
Locked Region 0 Page 0
24 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
The system always boots at address 0x0. To ensure a maximum number of possibilities for boot,
the memory layout can be configured with two parameters.
REMAP allows the user to lay out the first internal SRAM bank to 0x0 to ease development. This
is done by software once the system has booted. Refer to the section “AT91SAM9XE Bus
Matrix” in the product datasheet for more details.
When REMAP = 0, a non volatile bit stored in Flash memory (GPNVMBit[3]) allows the user to
lay out to 0x0, at his convenience, the ROM or the Flash. Refer to the section “Enhanced
Embedded Flash Controller (EEFC)” in the product datasheet for more details.
Note: Memory blocks not affected by these parameters can always be seen at their specified base
addresses. See the complete memory map presented in Figure 8-1 on page 20.
The AT91SAM9XE Matrix manages a boot memory that depends on the value of GPNVMBit[3]
at reset. The internal memory area mapped between address 0x0 and 0x0FFF FFFF is reserved
for this purpose.
If GPNVMBit[3] is set, the boot memory is the internal Flash memory
If GPNVMBit[3] is clear (Flash reset State), the boot memory is the embedded ROM. After a
Flash erase, the boot memory is the internal ROM.
25
6254C–ATARM–22-Jan-10
8.1.6.2 GPNVMBit[3] = 1, Boot on Internal Flash
• Boot on slow clock (On-chip RC oscillator or 32,768 Hz low-power oscillator)
The customer-programmed software must perform a complete configuration.
To speed up the boot sequence when booting at 32 kHz, the user must take the following steps:
1. Program the PMC (main oscillator enable or bypass mode)
2. Program and start the PLL
3. Switch the main clock to the new value.
26 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
27
6254C–ATARM–22-Jan-10
9. System Controller
The System Controller is a set of peripherals that allows handling of key elements of the system,
such as power, resets, clocks, time, interrupts, watchdog, etc.
The System Controller User Interface also embeds the registers that configure the Matrix and a
set of registers for the chip configuration. The chip configuration registers configure the EBI chip
select assignment and voltage range for external memories.
The System Controller’s peripherals are all mapped within the highest 16 Kbytes of address
space, between addresses 0xFFFF E800 and 0xFFFF FFFF.
However, all the registers of System Controller are mapped on the top of the address space. All
the registers of the System Controller can be addressed from a single pointer by using the stan-
dard ARM instruction set, as the Load/Store instruction have an indexing mode of ±4 Kbytes.
Figure 9-1 on page 29 shows the System Controller block diagram.
Figure 8-1 on page 20 shows the mapping of the User Interfaces of the System Controller
peripherals.
28 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
SLCK
UHPCK
SHDN
periph_clk[20]
WKUP Shutdown USB Host
RC Controller periph_nreset Port
backup_nreset
OSC
OSCSEL rtt0_alarm periph_irq[20]
SLOW
XIN32 CLOCK 4 General-Purpose
OSC Backup Registers
XOUT32
SLCK
UDPCK
int
XIN periph_clk[2..27] periph_clk[10]
MAIN MAINCK pck[0-1] USB
XOUT OSC periph_nreset Device
Power PCK Port
Management UDPCK periph_irq[10]
PLLRCA PLLA PLLACK Controller UHPCK
MCK
PLLB PLLBCK
periph_nreset pmc_irq
periph_clk[6..24]
idle
periph_nreset
periph_nreset periph_irq[2..4] Embedded
periph_clk[2..4] irq0-irq2 Peripherals
dbgu_rxd PIO fiq periph_irq[6..24]
PA0-PA31 Controllers dbgu_txd
PB0-PB31 in
PC0-PC31 out
enable
29
6254C–ATARM–22-Jan-10
9.2 Reset Controller
• Based on two Power-on reset cells
– One on VDDBU and one on VDDCORE
• Status of the last reset
– Either general reset (VDDBU rising), wake-up reset (VDDCORE rising), software
reset, user reset or watchdog reset
• Controls the internal resets and the NRST pin output
– Allows shaping a reset signal for the external devices
– At reset the NRST pin is an output
30 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
31
6254C–ATARM–22-Jan-10
9.10 General-purpose Back-up Registers
• Four 32-bit backup general-purpose registers
32 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
33
6254C–ATARM–22-Jan-10
10. Peripherals
Note: Setting AIC, SYSC, UHP, ADC and IRQ0-2 bits in the clock set/clear registers of the PMC has no
effect. The ADC clock is automatically started for the first conversion. In Sleep Mode the ADC
clock is automatically stopped after each conversion.
34 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
35
6254C–ATARM–22-Jan-10
10.3.1 PIO Controller A Multiplexing
36 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
37
6254C–ATARM–22-Jan-10
10.3.3 PIO Controller C Multiplexing
38 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
10.4.3 USART
• Programmable Baud Rate Generator
• 5- to 9-bit full-duplex synchronous or asynchronous serial communications
– 1, 1.5 or 2 stop bits in Asynchronous Mode or 1 or 2 stop bits in Synchronous Mode
– Parity generation and error detection
– Framing error detection, overrun error detection
– MSB- or LSB-first
– Optional break generation and detection
– By 8 or by 16 oversampling receiver frequency
– Hardware handshaking RTS-CTS
– Receiver time-out and transmitter timeguard
– Optional Multi-drop Mode with address generation and detection
– Optional Manchester Encoding
• RS485 with driver control signal
• ISO7816, T = 0 or T = 1 Protocols for interfacing with smart cards
– NACK handling, error counter with repetition and iteration limit
39
6254C–ATARM–22-Jan-10
• IrDA modulation and demodulation
– Communication at up to 115.2 Kbps
• Test Modes
– Remote Loopback, Local Loopback, Automatic Echo
40 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
41
6254C–ATARM–22-Jan-10
• Preview scaler to generate smaller size image
42 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
11.1 Overview
The ARM926EJ-S processor is a member of the ARM9™ family of general-purpose microproces-
sors. The ARM926EJ-S implements ARM architecture version 5TEJ and is targeted at multi-
tasking applications where full memory management, high performance, low die size and low
power are all important features.
The ARM926EJ-S processor supports the 32-bit ARM and 16-bit THUMB instruction sets,
enabling the user to trade off between high performance and high code density. It also supports
8-bit Java instruction set and includes features for efficient execution of Java bytecode, provid-
ing a Java performance similar to a JIT (Just-In-Time compilers), for the next generation of Java-
powered wireless and embedded devices. It includes an enhanced multiplier design for
improved DSP performance.
The ARM926EJ-S processor supports the ARM debug architecture and includes logic to assist
in both hardware and software debug.
The ARM926EJ-S provides a complete high performance processor subsystem, including:
• an ARM9EJ-S™ integer core
• a Memory Management Unit (MMU)
• separate instruction and data AMBA AHB bus interfaces
• separate instruction and data TCM interfaces
43
6254C–ATARM–22-Jan-10
11.2 Block Diagram
Write Data
ARM9EJ-S
Processor Core
Instruction
Read Fetches
Data
Data Instruction
Address Address
MMU
Instruction
DTCM Data TLB TLB ITCM
Interface Interface
Data Instruction
Address Address
AHB Interface Instruction
Data Cache and Cache
Write Buffer
AMBA AHB
44 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
45
6254C–ATARM–22-Jan-10
Minimum interrupt latency is maintained across both ARM state and Java state. Since byte
codes execution can be restarted, an interrupt automatically triggers the core to switch from
Java state to ARM state for the execution of the interrupt handler. This means that no special
provision has to be made for handling interrupts while executing byte codes, whether in hard-
ware or in software.
46 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
The ARM state register set contains 16 directly-accessible registers, r0 to r15, and an additional
register, the Current Program Status Register (CPSR). Registers r0 to r13 are general-purpose
registers used to hold either data or address values. Register r14 is used as a Link register that
holds a value (return address) of r15 when BL or BLX is executed. Register r15 is used as a pro-
gram counter (PC), whereas the Current Program Status Register (CPSR) contains condition
code flags and the current mode bits.
In privileged modes (FIQ, Supervisor, Abort, IRQ, Undefined), mode-specific banked registers
(r8 to r14 in FIQ mode or r13 to r14 in the other modes) become available. The corresponding
banked registers r14_fiq, r14_svc, r14_abt, r14_irq, r14_und are similarly used to hold the val-
47
6254C–ATARM–22-Jan-10
ues (return address for each mode) of r15 (PC) when interrupts and exceptions arise, or when
BL or BLX instructions are executed within interrupt or exception routines. There is another reg-
ister called Saved Program Status Register (SPSR) that becomes available in privileged modes
instead of CPSR. This register contains condition code flags and the current mode bits saved as
a result of the exception that caused entry to the current (privileged) mode.
In all modes and due to a software agreement, register r13 is used as stack pointer.
The use and the function of all the registers described above should obey ARM Procedure Call
Standard (APCS) which defines:
• constraints on the use of registers
• stack conventions
• argument passing and result return
For more details, refer to ARM Software Development Kit.
The Thumb state register set is a subset of the ARM state set. The programmer has direct
access to:
• Eight general-purpose registers r0-r7
• Stack pointer, SP
• Link register, LR (ARM r14)
• PC
• CPSR
There are banked registers SPs, LRs and SPSRs for each privileged mode (for more details see
the ARM9EJ-S Technical Reference Manual, revision r1p2 page 2-12).
N Z C V Q J Reserved I F T Mode
48 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
• The Sticky Overflow (Q) flag can be set by certain multiply and fractional arithmetic
instructions like QADD, QDADD, QSUB, QDSUB, SMLAxy, and SMLAWy needed to achieve
DSP operations.
The Q flag is sticky in that, when set by an instruction, it remains set until explicitly cleared by
an MSR instruction writing to the CPSR. Instructions cannot execute conditionally on the
status of the Q flag.
• The J bit in the CPSR indicates when the ARM9EJ-S core is in Jazelle state, where:
– J = 0: The processor is in ARM or Thumb state, depending on the T bit
– J = 1: The processor is in Jazelle state.
• Mode: five bits to encode the current processor mode
11.3.7.2 Exceptions
49
6254C–ATARM–22-Jan-10
1. Preserves the address of the next instruction in the appropriate Link Register that cor-
responds to the new mode that has been entered. When the exception entry is from:
– ARM and Jazelle states, the ARM9EJ-S copies the address of the next instruction
into LR (current PC(r15) + 4 or PC + 8 depending on the exception).
– THUMB state, the ARM9EJ-S writes the value of the PC into LR, offset by a value
(current PC + 2, PC + 4 or PC + 8 depending on the exception) that causes the
program to resume from the correct place on return.
2. Copies the CPSR into the appropriate SPSR.
3. Forces the CPSR mode bits to a value that depends on the exception.
4. Forces the PC to fetch the next instruction from the relevant exception vector.
The register r13 is also banked across exception modes to provide each exception handler with
private stack pointer.
The ARM9EJ-S can also set the interrupt disable flags to prevent otherwise unmanageable
nesting of exceptions.
When an exception has completed, the exception handler must move both the return value in
the banked LR minus an offset to the PC and the SPSR to the CPSR. The offset value varies
according to the type of exception. This action restores both PC and the CPSR.
The fast interrupt mode has seven private registers r8 to r14 (banked registers) to reduce or
remove the requirement for register saving which minimizes the overhead of context switching.
The Prefetch Abort is one of the aborts that indicates that the current memory access cannot be
completed. When a Prefetch Abort occurs, the ARM9EJ-S marks the prefetched instruction as
invalid, but does not take the exception until the instruction reaches the Execute stage in the
pipeline. If the instruction is not executed, for example because a branch occurs while it is in the
pipeline, the abort does not take place.
The breakpoint (BKPT) instruction is a new feature of ARM9EJ-S that is destined to solve the
problem of the Prefetch Abort. A breakpoint instruction operates as though the instruction
caused a Prefetch Abort.
A breakpoint instruction does not cause the ARM9EJ-S to take the Prefetch Abort exception until
the instruction reaches the Execute stage of the pipeline. If the instruction is not executed, for
example because a branch occurs while it is in the pipeline, the breakpoint does not take place.
50 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
LDRT Load Register with Translation STRT Store Register with Translation
51
6254C–ATARM–22-Jan-10
11.3.9 New ARM Instruction Set
.
Notes: 1. A Thumb BLX contains two consecutive Thumb instructions, and takes four cycles.
52 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
53
6254C–ATARM–22-Jan-10
Table 11-5. CP15 Registers
Register Name Read/Write
7 Cache Operations Read/Write
8 TLB operations Unpredictable/Write
(2)
9 cache lockdown Read/write
9 TCM region Read/write
10 TLB lockdown Read/write
11 Reserved None
12 Reserved None
13 FCSE PID(1) Read/write
(1)
13 Context ID Read/Write
14 Reserved None
15 Test configuration Read/Write
Notes: 1. Register locations 0,5, and 13 each provide access to more than one register. The register
accessed depends on the value of the opcode_2 field.
2. Register location 9 provides access to more than one register. The register accessed depends
on the value of the CRm field.
54 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
31 30 29 28 27 26 25 24
cond 1 1 1 0
23 22 21 20 19 18 17 16
opcode_1 L CRn
15 14 13 12 11 10 9 8
Rd 1 1 1 1
7 6 5 4 3 2 1 0
opcode_2 1 CRm
55
6254C–ATARM–22-Jan-10
11.5 Memory Management Unit (MMU)
The ARM926EJ-S processor implements an enhanced ARM architecture v5 MMU to provide vir-
tual memory features required by operating systems like Symbian® OS, WindowsCE®, and
Linux®. These virtual memory features are memory access permission controls and virtual to
physical address translations.
The Virtual Address generated by the CPU core is converted to a Modified Virtual Address
(MVA) by the FCSE (Fast Context Switch Extension) using the value in CP15 register13. The
MMU translates modified virtual addresses to physical addresses by using a single, two-level
page table set stored in physical memory. Each entry in the set contains the access permissions
and the physical address that correspond to the virtual address.
The first level translation tables contain 4096 entries indexed by bits [31:20] of the MVA. These
entries contain a pointer to either a 1 MB section of physical memory along with attribute infor-
mation (access permissions, domain, etc.) or an entry in the second level translation tables;
coarse table and fine table.
The second level translation tables contain two subtables, coarse table and fine table. An entry
in the coarse table contains a pointer to both large pages and small pages along with access
permissions. An entry in the fine table contains a pointer to large, small and tiny pages.
Table 11-6 shows the different attributes of each page in the physical memory.
56 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
fied Virtual Address), the access control logic determines if the access is permitted and outputs
the appropriate physical address corresponding to the MVA. If access is not permitted, the MMU
signals the CPU core to abort.
If the TLB does not contain an entry for the MVA, the translation table walk hardware is invoked
to retrieve the translation information from the translation table in physical memory.
57
6254C–ATARM–22-Jan-10
11.6 Caches and Write Buffer
The ARM926EJ-S contains a 16-Kbyte Instruction Cache (ICache), a 8-Kbyte Data Cache
(DCache), and a write buffer. Although the ICache and DCache share common features, each
still has some specific mechanisms.
The caches (ICache and DCache) are four-way set associative, addressed, indexed and tagged
using the Modified Virtual Address (MVA), with a cache line length of eight words with two dirty
bits for the DCache. The ICache and DCache provide mechanisms for cache lockdown, cache
pollution control, and line replacement.
A new feature is now supported by ARM926EJ-S caches called allocate on read-miss commonly
known as wrapping. This feature enables the caches to perform critical word first cache refilling.
This means that when a request for a word causes a read-miss, the cache performs an AHB
access. Instead of loading the whole line (eight words), the cache loads the critical word first, so
the processor can reach it quickly, and then the remaining words, no matter where the word is
located in the line.
The caches and the write buffer are controlled by the CP15 register 1 (Control), CP15 register 7
(cache operations) and CP15 register 9 (cache lockdown).
11.6.2.1 DCache
The DCache needs the MMU to be enabled. All data accesses are subject to MMU permission
and translation checks. Data accesses that are aborted by the MMU do not cause linefills or data
accesses to appear on the AMBA ASB interface. If the MMU is disabled, all data accesses are
noncachable, nonbufferable, with no protection checks, and appear on the AHB bus. All
addresses are flat-mapped, VA = MVA = PA, which incurs DCache cleaning and/or invalidating
every time a context switch occurs.
The DCache stores the Physical Address Tag (PA Tag) from which every line was loaded and
uses it when writing modified lines back to external memory. This means that the MMU is not
involved in write-back operations.
Each line (8 words) in the DCache has two dirty bits, one for the first four words and the other
one for the second four words. These bits, if set, mark the associated half-lines as dirty. If the
58 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
cache line is replaced due to a linefill or a cache clean operation, the dirty bits are used to decide
whether all, half or none is written back to memory.
DCache can be enabled or disabled by writing either 1 or 0 to bit C in register 1 of CP15 (see
Tables 4-3 and 4-4 on page 4-5 in ARM926EJ-S TRM).
The DCache supports write-through and write-back cache operations, selected by memory
region using the C and B bits in the MMU translation tables.
The DCache contains an eight data word entry, single address entry write-back buffer used to
hold write-back data for cache line eviction or cleaning of dirty cache lines.
The Write Buffer can hold up to 16 words of data and four separate addresses. DCache and
Write Buffer operations are closely connected as their configuration is set in each section by the
page descriptor in the MMU translation table.
59
6254C–ATARM–22-Jan-10
11.7 Bus Interface Unit
The ARM926EJ-S features a Bus Interface Unit (BIU) that arbitrates and schedules AHB
requests. The BIU implements a multi-layer AHB, based on the AHB-Lite protocol, that enables
parallel access paths between multiple AHB masters and slaves in a system. This is achieved by
using a more complex interconnection matrix and gives the benefit of increased overall bus
bandwidth, and a more flexible system architecture.
The multi-master bus architecture has a number of benefits:
• It allows the development of multi-master systems with an increased bus bandwidth and a
flexible architecture.
• Each AHB layer becomes simple because it only has one master, so no arbitration or master-
to-slave muxing is required. AHB layers, implementing AHB-Lite protocol, do not have to
support request and grant, nor do they have to support retry and split transactions.
• The arbitration becomes effective when more than one master wants to access the same
slave simultaneously.
60 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
12.1 Overview
The AT91SAM9XE features a number of complementary debug and test capabilities. A common
JTAG/ICE (In-Circuit Emulator) port is used for standard debugging functions, such as down-
loading code and single-stepping through programs. The Debug Unit provides a two-pin UART
that can be used to upload an application into internal SRAM. It manages the interrupt handling
of the internal COMMTX and COMMRX signals that trace the activity of the Debug Communica-
tion Channel.
A set of dedicated debug and test input/output pins gives direct access to these capabilities from
a PC-based test environment.
61
6254C–ATARM–22-Jan-10
12.2 Block Diagram
TMS
TCK
TDI
NTRST
ICE/JTAG JTAGSEL
Boundary TAP
Port
TDO
RTCK
POR
Reset
and
Test TST
ARM9EJ-S ICE-RT
ARM926EJ-S
DTXD
PIO
PDC DBGU
DRXD
62 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Host Debugger
ICE/JTAG
Interface
ICE/JTAG
Connector
AT91SAM9XE RS232
Terminal
Connector
63
6254C–ATARM–22-Jan-10
12.3.2 Test Environment
Figure 12-3 on page 64 shows a test environment example. Test vectors are sent and inter-
preted by the tester. In this example, the “board in test” is designed using a number of JTAG-
compliant devices. These devices can be connected to form a single scan chain.
Test Adaptor
Tester
JTAG
Interface
ICE/JTAG
Connector Chip n Chip 2
AT91SAM9XE Chip 1
64 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
65
6254C–ATARM–22-Jan-10
12.6.4 IEEE 1149.1 JTAG Boundary Scan
IEEE 1149.1 JTAG Boundary Scan allows pin-level access independent of the device packaging
technology.
IEEE 1149.1 JTAG Boundary Scan is enabled when JTAGSEL is high. The SAMPLE, EXTEST
and BYPASS functions are implemented. In ICE debug mode, the ARM processor responds
with a non-JTAG chip ID that identifies the processor to the ICE system. 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 per-
formed after JTAGSEL is changed.
A Boundary-scan Descriptor Language (BSDL) file is provided to set up test.
66 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
67
6254C–ATARM–22-Jan-10
Table 12-2.AT91SAM9XE JTAG Boundary Scan Register
246 CONTROL
D14 IN/OUT
245 INPUT/OUTPUT
244 CONTROL
D15 IN/OUT
243 INPUT/OUTPUT
242 CONTROL
D2 IN/OUT
241 INPUT/OUTPUT
240 CONTROL
D3 IN/OUT
239 INPUT/OUTPUT
238 CONTROL
D4 IN/OUT
237 INPUT/OUTPUT
236 CONTROL
D5 IN/OUT
235 INPUT/OUTPUT
234 CONTROL
D6 IN/OUT
233 INPUT/OUTPUT
232 CONTROL
D7 IN/OUT
231 INPUT/OUTPUT
230 CONTROL
D8 IN/OUT
229 INPUT/OUTPUT
228 CONTROL
D9 IN/OUT
227 INPUT/OUTPUT
226 CONTROL
NANDOE IN/OUT
225 INPUT/OUTPUT
224 CONTROL
NANDWE IN/OUT
223 INPUT/OUTPUT
222 CONTROL
NCS0 IN/OUT
221 INPUT/OUTPUT
220 CONTROL
NCS1 IN/OUT
219 INPUT/OUTPUT
218 CONTROL
NRD IN/OUT
217 INPUT/OUTPUT
216 CONTROL
NRST IN/OUT
215 INPUT/OUTPUT
214 CONTROL
NWR0 IN/OUT
213 INPUT/OUTPUT
212 CONTROL
NWR1 IN/OUT
211 INPUT/OUTPUT
210 CONTROL
NWR3 IN/OUT
209 INPUT/OUTPUT
208 OSCSEL INPUT INPUT
68 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
69
6254C–ATARM–22-Jan-10
Table 12-2.AT91SAM9XE JTAG Boundary Scan Register
167 CONTROL
PA27 IN/OUT
166 INPUT/OUTPUT
165 CONTROL
PA28 IN/OUT
164 INPUT/OUTPUT
163 CONTROL
PA29 IN/OUT
162 INPUT/OUTPUT
161 CONTROL
PA3 IN/OUT
160 INPUT/OUTPUT
159 internal
158 internal
157 internal
156 internal
155 CONTROL
PA4 IN/OUT
154 INPUT/OUTPUT
153 CONTROL
PA5 IN/OUT
152 INPUT/OUTPUT
151 CONTROL
PA6 IN/OUT
150 INPUT/OUTPUT
149 CONTROL
PA7 IN/OUT
148 INPUT/OUTPUT
147 CONTROL
PA8 IN/OUT
146 INPUT/OUTPUT
145 CONTROL
PA9 IN/OUT
144 INPUT/OUTPUT
143 CONTROL
PB0 IN/OUT
142 INPUT/OUTPUT
141 CONTROL
PB1 IN/OUT
140 INPUT/OUTPUT
139 CONTROL
PB10 IN/OUT
138 INPUT/OUTPUT
137 CONTROL
PB11 IN/OUT
136 INPUT/OUTPUT
135 internal
134 internal
133 internal
132 internal
131 CONTROL
PB14 IN/OUT
130 INPUT/OUTPUT
129 CONTROL
PB15 IN/OUT
128 INPUT/OUTPUT
70 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
71
6254C–ATARM–22-Jan-10
Table 12-2.AT91SAM9XE JTAG Boundary Scan Register
87 CONTROL
PB6 IN/OUT
86 INPUT/OUTPUT
85 CONTROL
PB7 IN/OUT
84 INPUT/OUTPUT
83 CONTROL
PB8 IN/OUT
82 INPUT/OUTPUT
81 CONTROL
PB9 IN/OUT
80 INPUT/OUTPUT
79 CONTROL
PC0 IN/OUT
78 INPUT/OUTPUT
77 CONTROL
PC1 IN/OUT
76 INPUT/OUTPUT
75 CONTROL
PC10 IN/OUT
74 INPUT/OUTPUT
73 CONTROL
PC11 IN/OUT
72 INPUT/OUTPUT
71 internal
70 internal
69 CONTROL
PC13 IN/OUT
68 INPUT/OUTPUT
67 CONTROL
PC14 IN/OUT
66 INPUT/OUTPUT
65 CONTROL
PC15 IN/OUT
64 INPUT/OUTPUT
63 CONTROL
PC16 IN/OUT
62 INPUT/OUTPUT
61 CONTROL
PC17 IN/OUT
60 INPUT/OUTPUT
59 CONTROL
PC18 IN/OUT
58 INPUT/OUTPUT
57 CONTROL
PC19 IN/OUT
56 INPUT/OUTPUT
55 internal
54 internal
53 CONTROL
PC20 IN/OUT
52 INPUT/OUTPUT
51 CONTROL
PC21 IN/OUT
50 INPUT/OUTPUT
49 CONTROL
PC22 IN/OUT
48 INPUT/OUTPUT
72 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
73
6254C–ATARM–22-Jan-10
Table 12-2.AT91SAM9XE JTAG Boundary Scan Register
07 CONTROL
SDCKE IN/OUT
06 INPUT/OUTPUT
05 CONTROL
SDWE IN/OUT
04 INPUT/OUTPUT
03 CONTROL
SHDN OUT
02 OUTPUT
01 TST INPUT INPUT
00 WKUP INPUT INPUT
23 22 21 20 19 18 17 16
PART NUMBER
15 14 13 12 11 10 9 8
PART NUMBER MANUFACTURER IDENTITY
7 6 5 4 3 2 1 0
MANUFACTURER IDENTITY 1
• MANUFACTURER IDENTITY[11:1]
Set to 0x01F.
Bit[0] Required by IEEE Std. 1149.1.
Set to 0x1.
JTAG ID Code value is 0x05B1_303F.
74 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
13.1 Overview
The Boot Program integrates different programs permitting download and/or upload into the dif-
ferent memories of the product.
First, it initializes the Debug Unit serial port (DBGU) and the USB Device Port.
SAM-BA Boot is then executed. It waits for transactions either on the USB device, or on the
DBGU serial port.
Start
Yes Yes
Internal RC Oscillator Main Oscillator Bypass
No No
No
No
USB Enumeration Character(s) received
SAM-BA Boot
Successful ? on DBGU ?
Yes Yes
75
6254C–ATARM–22-Jan-10
13.3 Device Initialization
Initialization follows the steps described below:
1. FIQ Initialization
2. Stack setup for ARM supervisor mode
3. External Clock Detection
4. Switch Master Clock on Main Oscillator
5. C variable initialization
6. Main oscillator frequency detection if no external clock detected
7. PLL setup: PLLB is initialized to generate a 48 MHz clock necessary to use the USB
Device. A register located in the Power Management Controller (PMC) determines the
frequency of the main oscillator and thus the correct factor for the PLLB.
a. If Internal RC Oscillator is used (OSCSEL = 0) and Main Oscillator is active, Table
13-1 defines the crystals supported by the Boot Program when using the internal
RC oscillator.
Note: Any other crystal can be used but it prevents using the USB.
Note: Any other input frequency can be used but it prevents using the USB.
76 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Start
No
End
No (USB) Yes (DBGU)
Autobaudrate ?
End End
77
6254C–ATARM–22-Jan-10
13.4 SAM-BA Boot
The SAM-BA boot principle is to:
– Wait for USB Device enumeration.
– In parallel, wait for character(s) received on the DBGU if MCK is configured to 48
MHz (OSCSEL = 1).
– If not, the auto baud rate sequence is executed in parallel (see Figure 13-3).
Device
Setup
Character '0x80' No
1st measurement
received ?
Yes
Yes
Yes
78 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
• Write commands: Write a byte (O), a halfword (H) or a word (W) to the target.
– Address: Address in hexadecimal.
– Value: Byte, halfword or word to write in hexadecimal.
– Output: ‘>’.
• Read commands: Read a byte (o), a halfword (h) or a word (w) from the target.
– Address: Address in hexadecimal
– Output: The byte, halfword or word read in hexadecimal following by ‘>’
• Send a file (S): Send a file to a specified address
– Address: Address in hexadecimal
– Output: ‘>’.
Note: There is a time-out on this command which is reached when the prompt ‘>’ appears before the
end of the command execution.
• Receive a file (R): Receive data into a file from a specified address
– Address: Address in hexadecimal
– NbOfBytes: Number of bytes in hexadecimal to receive
– Output: ‘>’
• Go (G): Jump to a specified address and execute the code
– Address: Address to jump in hexadecimal
– Output: ‘>’
• Get Version (V): Return the SAM-BA boot version
– Output: ‘>’
79
6254C–ATARM–22-Jan-10
13.4.1 DBGU Serial Port
Communication is performed through the DBGU serial port initialized to 115200 Baud, 8, n, 1.
The Send and Receive File commands use the Xmodem protocol to communicate. Any terminal
performing this protocol can be used to send the application file to the target. The size of the
binary file to send depends on the SRAM size embedded in the product. In all cases, the size of
the binary file must be lower than the SRAM size because the Xmodem protocol requires some
SRAM memory to work.
Host Device
ACK
ACK
ACK
EOT
ACK
80 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
www.usb.org, describes a way to implement devices such as ISDN modems and virtual COM
ports.
The Vendor ID is Atmel’s vendor ID 0x03EB. The product ID is 0x6124. These references are
used by the host operating system to mount the correct driver. On Windows systems, the INF
files contain the correspondence between vendor ID and product ID.
Atmel provides an INF example to see the device as a new serial port and also provides another
custom driver used by the SAM-BA application: atm6124.sys.
The device also handles some class requests defined in the CDC class.
81
6254C–ATARM–22-Jan-10
13.4.4 In-Application Programming (IAP) Feature
The IAP feature is a function located in ROM that can be called by any software application.
When called, this function sends the desired FLASH command to the EEFC and waits for the
FLASH to be ready (looping while the FRDY bit is not set in the MC_FSR register).
Since this function is executed from ROM, this allows FLASH programming (like sector write) to
be done by code running in FLASH.
The IAP function entry point is retrieved by reading the SWI vector in ROM (0x100008).
This function takes one argument in parameter: the command to be sent to the EEFC.
This function returns the value of the MC_FSR register.
IAP software code example:
{
unsigned long FlashSectorNum = 200;
unsigned long flash_cmd = 0;
unsigned long flash_status = 0;
82 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
83
6254C–ATARM–22-Jan-10
84 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
14.1 Description
The Fast Flash Programming Interface provides two solutions - parallel or serial - for high-vol-
ume programming using a standard gang programmer. The parallel interface is fully
handshaked and the device is considered to be a standard EEPROM. Additionally, the parallel
protocol offers an optimized access to all the embedded Flash functionalities. The serial inter-
face uses the standard IEEE 1149.1 JTAG protocol. It offers an optimized access to all the
embedded Flash functionalities.
Although the Fast Flash Programming Mode is a dedicated mode for high volume programming,
this mode not designed for in-situ programming.
VDDBU TST
VDDIO PGMEN0
VDDIO PGMEN1
GND PGMEN2 VDDCORE
GND PGMEN3
VDDIO
NCMD PGMNCMD
RDY PGMRDY VDDPLL
NOE PGMNOE
NVALID PGMNVALID GND
MODE[3:0] PGMM[3:0]
DATA[15:0] PGMD[15:0]
0 - 50MHz XIN
85
6254C–ATARM–22-Jan-10
Table 14-1. Signal Description List (Continued)
Active
Signal Name Function Type Level Comments
Clocks
Main Clock Input.
This input can be tied to GND. In this
XIN Input 32KHz to 50MHz
case, the device is clocked by the internal
RC oscillator.
Test
TST Test Mode Select Input High Must be connected to VDDBU
PGMEN0 Test Mode Select Input High Must be connected to VDDIO
PGMEN1 Test Mode Select Input High Must be connected to VDDIO
PGMEN2 Test Mode Select Input Low Must be connected to GND
PGMEN3 Test Mode Select Input Low Must be connected to GND
PIO
PGMNCMD Valid command available Input Low Pulled-up input at reset
0: Device is busy
PGMRDY Output High Pulled-up input at reset
1: Device is ready for a new command
PGMNOE Output Enable (active high) Input Low Pulled-up input at reset
0: DATA[15:0] is in input mode
PGMNVALID Output Low Pulled-up input at reset
1: DATA[15:0] is in output mode
PGMM[3:0] Specifies DATA type (See Table 14-2) Input Pulled-up input at reset
PGMD[15:0] Bi-directional data bus Input/Output Pulled-up input at reset
When MODE is equal to CMDE, then a new command (strobed on DATA[15:0] signals) is stored
in the command register.
86 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
87
6254C–ATARM–22-Jan-10
Figure 14-2. Parallel Programming Timing, Write Sequence
NCMD 2 4
3 5
RDY
NOE
NVALID
DATA[15:0]
1
MODE[3:0]
NCMD 2 12
3 13
RDY
NOE 5 9
NVALID 7 11
4 6 8 10
MODE[3:0] ADDR
88 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
89
6254C–ATARM–22-Jan-10
Table 14-6. Read Command
Step Handshake Sequence MODE[3:0] DATA[15:0]
n+2 Read handshaking DATA *Memory Address++
n+3 Read handshaking DATA *Memory Address++
... ... ... ...
The Flash command Write Page and Lock (WPL) is equivalent to the Flash Write Command.
However, the lock bit is automatically set at the end of the Flash write operation. As a lock region
is composed of several pages, the programmer writes to the first pages of the lock region using
Flash write commands and writes to the last page of the lock region using a Flash write and lock
command.
The Flash command Erase Page and Write (EWP) is equivalent to the Flash Write Command.
However, before programming the load buffer, the page is erased.
The Flash command Erase Page and Write the Lock (EWPL) combines EWP and WPL
commands.
90 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
All lock regions must be unlocked before the Full Erase command by using the CLB command.
Otherwise, the erase command is aborted and no page is erased.
Lock bits can be read using Get Lock Bit command (GLB). The nth lock bit is active when the bit
n of the bit mask is set..
91
6254C–ATARM–22-Jan-10
General-purpose NVM bits can be read using the Get GPNVM Bit command (GGPB). The nth
GP NVM bit is active when bit n of the bit mask is set..
Once the security bit is set, it is not possible to access FFPI. The only way to erase the security
bit is to erase the Flash.
In order to erase the Flash, the user must perform the following:
• Power-off the chip
• Power-on the chip with TST = 0
• Assert Erase during a period of more than 220 ms
• Power-off the chip
Then it is possible to return to FFPI mode and check that Flash is erased.
92 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
93
6254C–ATARM–22-Jan-10
14.3 Serial Fast Flash Programming
The Serial Fast Flash programming interface is based on IEEE Std. 1149.1 “Standard Test
Access Port and Boundary-Scan Architecture”. Refer to this standard for an explanation of terms
used in this chapter and for a description of the TAP controller states.
In this mode, data read/written from/to the embedded Flash of the device are transmitted
through the JTAG interface of the device.
VDDBU TST
VDDIO PGMEN0
VDDIO PGMEN1
GND PGMEN2 VDDCORE
GND PGMEN3
VDDIO
TDI
TDO VDDPLL
TMS
TCK GND
0-50MHz XIN
94 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
95
6254C–ATARM–22-Jan-10
14.3.3 Read/Write Handshake
The read/write handshake is done by carrying out read/write operations on two registers of the
device that are accessible through the JTAG:
• Debug Comms Control Register: DCCR
• Debug Comms Data Register: DCDR
Access to these registers is done through the TAP 38-bit DR register comprising a 32-bit data
field, a 5-bit address field and a read/write bit. The data to be written is scanned into the 32-bit
data field with the address of the register to the 5-bit address field and 1 to the read/write bit. A
register is read by scanning its address into the address field and 0 into the read/write bit, going
through the UPDATE-DR TAP state, then scanning out the data.
Refer to the ARM7TDMI reference manuel for more information on Comm channel operations.
5 32
A read or write takes place when the TAP controller enters UPDATE-DR state. Refer to the IEEE
1149.1 for more details on JTAG operations.
• The address of the Debug Comms Control Register is 0x04.
• The address of the Debug Comms Data Register is 0x05.
The Debug Comms Control Register is read-only and allows synchronized handshaking
between the processor and the debugger.
– Bit 1 (W): Denotes whether the programmer can read a data through the Debug
Comms Data Register. If the device is busy W = 0, then the programmer must poll
until W = 1.
– Bit 0 (R): Denotes whether the programmer can send data from the Debug Comms
Data Register. If R = 1, data previously placed there through the scan chain has not
been collected by the device and so the programmer must wait.
The write handshake is done by polling the Debug Comms Control Register until the R bit is
cleared. Once cleared, data can be written to the Debug Comms Data Register.
The read handshake is done by polling the Debug Comms Control Register until the W bit is set.
Once set, data can be read in the Debug Comms Data Register.
96 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Flash Write Page and Lock command (WPL) is equivalent to the Flash Write Command. How-
ever, the lock bit is automatically set at the end of the Flash write operation. As a lock region is
composed of several pages, the programmer writes to the first pages of the lock region using
Flash write commands and writes to the last page of the lock region using a Flash write and lock
command.
Flash Erase Page and Write command (EWP) is equivalent to the Flash Write Command. How-
ever, before programming the load buffer, the page is erased.
Flash Erase Page and Write the Lock command (EWPL) combines EWP and WPL
commands.
97
6254C–ATARM–22-Jan-10
14.3.4.3 Flash Full Erase Command
This command is used to erase the Flash memory planes.
All lock bits must be deactivated before using the Full Erase command. This can be done by
using the CLB command.
Lock bits can be read using Get Lock Bit command (GLB). When a bit set in the Bit Mask is
returned, then the corresponding lock bit is active.
98 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
GP NVM bits can be read using Get GPNVM Bit command (GGPB). When a bit set in the Bit
Mask is returned, then the corresponding GPNVM bit is set.
Once the security bit is set, it is not possible to access FFPI. The only way to erase the security
bit is to erase the Flash.
In order to erase the Flash, the user must perform the following:
• Power-off the chip
• Power-on the chip with TST = 0
• Assert Erase during a period of more than 220 ms
• Power-off the chip
Then it is possible to return to FFPI mode and check that Flash is erased.
99
6254C–ATARM–22-Jan-10
14.3.4.8 Get Version Command
The Get Version (GVE) command retrieves the version of the FFPI interface.
15.1 Description
The Reset Controller (RSTC), based on power-on reset cells, handles all the resets of the sys-
tem without any external components. It reports which reset occurred last.
The Reset Controller also drives independently or simultaneously the external reset and the
peripheral and processor resets.
A brownout detection is also available to prevent the processor from falling into an unpredictable
state.
Reset Controller
bod_rst_en Brownout bod_reset
brown_out Manager
Main Supply
POR
Reset
State rstc_irq
Backup Supply Startup
POR Counter Manager
user_reset
NRST proc_nreset
NRST
Manager
nrst_out periph_nreset
exter_nreset
backup_neset
WDRPROC
wd_fault
SLCK
101
6254C–ATARM–22-Jan-10
These reset signals are asserted by the Reset Controller, either on external events or on soft-
ware action. The Reset State Manager controls the generation of reset signals and provides a
signal to the NRST Manager when an assertion of the NRST pin is required.
The NRST Manager shapes the NRST assertion during a programmable time, thus controlling
external device resets.
The startup counter waits for the complete crystal oscillator startup. The wait delay is given by
the crystal oscillator startup time maximum value that can be found in the section Crystal Oscil-
lator Characteristics in the Electrical Characteristics section of the product documentation.
The Reset Controller Mode Register (RSTC_MR), allowing the configuration of the Reset Con-
troller, is powered with VDDBU, so that its configuration is saved as long as VDDBU is on.
URSTS
rstc_irq
NRSTL RSTC_MR Other
interrupt
URSTEN
sources
user_reset
NRST RSTC_MR
ERSTL
nrst_out
External Reset Timer exter_nreset
2(ERSTL+1) Slow Clock cycles. This gives the approximate duration of an assertion between 60 µs
and 2 seconds. Note that ERSTL at 0 defines a two-cycle duration for the NRST pulse.
This feature allows the Reset Controller to shape the NRST pin level, and thus to guarantee that
the NRST line is driven low for a time compliant with potential external devices connected on the
system reset.
As the field is within RSTC_MR, which is backed-up, this field can be used to shape the system
power-up reset for devices requiring a longer startup time than the Slow Clock Oscillator.
RSTC_MR
BODIEN
RSTC_SR
brown_out BODSTS rstc_irq
Other
interrupt
sources
103
6254C–ATARM–22-Jan-10
When VDDBU is detected low by the Backup Supply POR Cell, all resets signals are immedi-
ately asserted, even if the Main Supply POR Cell does not report a Main Supply shutdown.
VDDBU only activates the backup_nreset signal.
The backup_nreset must be released so that any other reset can be generated by VDDCORE
(Main Supply POR output).
Figure 15-4 shows how the General Reset affects the reset signals.
SLCK
Any
MCK Freq.
Backup Supply
POR output
Startup Time
Main Supply
POR output
backup_nreset
Processor Startup
= 3 cycles
proc_nreset
periph_nreset
NRST
(nrst_out)
BMS Sampling
SLCK
Any
MCK Freq.
Main Supply
POR output
backup_nreset
Resynch. Processor Startup
2 cycles = 3 cycles
proc_nreset
periph_nreset
NRST
(nrst_out)
105
6254C–ATARM–22-Jan-10
When the processor reset signal is released, the RSTTYP field of the Status Register
(RSTC_SR) is loaded with the value 0x4, indicating a User Reset.
The NRST Manager guarantees that the NRST line is asserted for
EXTERNAL_RESET_LENGTH Slow Clock cycles, as programmed in the field ERSTL. How-
ever, if NRST does not rise after EXTERNAL_RESET_LENGTH because it is driven low
externally, the internal reset lines remain asserted until NRST actually rises.
SLCK
Any
MCK Freq.
NRST
proc_nreset
periph_nreset
NRST
(nrst_out)
SLCK
MCK Any
Freq.
brown_out
or bod_reset
proc_nreset
periph_nreset
NRST
(nrst_out)
107
6254C–ATARM–22-Jan-10
If and only if the PROCRST bit is set, the Reset Controller reports the software status in the field
RSTTYP of the Status Register (RSTC_SR). Other Software Resets are not reported in
RSTTYP.
As soon as a software operation is detected, the bit SRCMP (Software Reset Command in Prog-
ress) is set in the Status Register (RSTC_SR). It is cleared as soon as the software reset is left.
No other software reset can be performed while the SRCMP bit is set, and writing any value in
RSTC_CR has no effect.
SLCK
Any
MCK Freq.
Write RSTC_CR
Resynch. Processor Startup
1 cycle = 3 cycles
proc_nreset
if PROCRST=1
periph_nreset
if PERRST=1
NRST
(nrst_out)
if EXTRST=1
EXTERNAL RESET LENGTH
8 cycles (ERSTL=2)
SRCMP in RSTC_SR
SLCK
Any
MCK Freq.
wd_fault
Processor Startup
= 3 cycles
proc_nreset
periph_nreset
Only if
WDRPROC = 0
NRST
(nrst_out)
109
6254C–ATARM–22-Jan-10
• RSTTYP field: This field gives the type of the last reset, as explained in previous sections.
• SRCMP bit: This field indicates that a Software Reset Command is in progress and that no
further software reset should be performed until the end of the current one. This bit is
automatically cleared at the end of the current software reset.
• NRSTL bit: The NRSTL bit of the Status Register gives the level of the NRST pin sampled on
each MCK rising edge.
• URSTS bit: A high-to-low transition of the NRST pin sets the URSTS bit of the RSTC_SR
register. This transition is also detected on the Master Clock (MCK) rising edge (see Figure
15-10). If the User Reset is disabled (URSTEN = 0) and if the interruption is enabled by the
URSTIEN bit in the RSTC_MR register, the URSTS bit triggers an interrupt. Reading the
RSTC_SR status register resets the URSTS bit and clears the interrupt.
• BODSTS bit: This bit indicates a brownout detection when the brownout reset is disabled
(bod_rst_en = 0). It triggers an interrupt if the bit BODIEN in the RSTC_MR register enables
the interrupt. Reading the RSTC_SR register resets the BODSTS bit and clears the interrupt.
MCK
read
Peripheral Access RSTC_SR
2 cycle 2 cycle
resynchronization resynchronization
NRST
NRSTL
URSTS
rstc_irq
if (URSTEN = 0) and
(URSTIEN = 1)
111
6254C–ATARM–22-Jan-10
15.4.1 Reset Controller Control Register
Name: RSTC_CR
Address: 0xFFFFFD00
Access Type: Write-only
31 30 29 28 27 26 25 24
KEY
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – –
7 6 5 4 3 2 1 0
– – – – EXTRST PERRST – PROCRST
• KEY: Password
Should be written at value 0xA5. Writing any other value in this field aborts the write operation.
23 22 21 20 19 18 17 16
– – – – – – SRCMP NRSTL
15 14 13 12 11 10 9 8
– – – – – RSTTYP
7 6 5 4 3 2 1 0
– – – – – – –BODSTS URSTS
113
6254C–ATARM–22-Jan-10
15.4.3 Reset Controller Mode Register
Name: RSTC_MR
Address: 0xFFFFFD08
Access Type: Read-write
31 30 29 28 27 26 25 24
KEY
23 22 21 20 19 18 17 16
– – – – – – – BODIEN
15 14 13 12 11 10 9 8
– – – – ERSTL
7 6 5 4 3 2 1 0
– – URSTIEN – – – URSTEN
• KEY: Password
Should be written at value 0xA5. Writing any other value in this field aborts the write operation.
16.1 Description
The Real-time Timer is built around a 32-bit counter and used to count elapsed seconds. It gen-
erates a periodic interrupt and/or triggers an alarm on a programmed value.
RTT_MR
reload RTTINCIEN
SLCK 16-bit
Divider
0 set
RTT_MR RTT_SR RTTINC
RTTRST 1 0 reset
rtt_int
32-bit
Counter read
RTT_MR
RTT_SR
ALMIEN
reset
RTT_VR CRTV
RTT_SR ALMS
set
rtt_alarm
=
RTT_AR ALMV
115
6254C–ATARM–22-Jan-10
The Real-time Timer value (CRTV) can be read at any time in the register RTT_VR (Real-time
Value Register). As this value can be updated asynchronously from the Master Clock, it is advis-
able to read this register twice at the same value to improve accuracy of the returned value.
The current value of the counter is compared with the value written in the alarm register
RTT_AR (Real-time Alarm Register). If the counter value matches the alarm, the bit ALMS in
RTT_SR is set. The alarm register is set to its maximum value, corresponding to 0xFFFF_FFFF,
after a reset.
The bit RTTINC in RTT_SR is set each time the Real-time Timer counter is incremented. This bit
can be used to start a periodic interrupt, the period being one second when the RTPRES is pro-
grammed with 0x8000 and Slow Clock equal to 32.768 Hz.
Reading the RTT_SR status register resets the RTTINC and ALMS fields.
Writing the bit RTTRST in RTT_MR immediately reloads and restarts the clock divider with the
new programmed value. This also resets the 32-bit counter.
Note: Because of the asynchronism between the Slow Clock (SCLK) and the System Clock (MCK):
1) The restart of the counter and the reset of the RTT_VR current value register is effective only 2
slow clock cycles after the write of the RTTRST bit in the RTT_MR register.
2) The status register flags reset is taken into account only 2 slow clock cycles after the read of the
RTT_SR (Status Register).
MCK
RTPRES - 1
Prescaler
RTTINC (RTT_SR)
ALMS (RTT_SR)
APB Interface
read RTT_SR
117
6254C–ATARM–22-Jan-10
16.4.1 Real-time Timer Mode Register
Register Name: RTT_MR
Address: 0xFFFFFD20
Access Type: Read/Write
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – RTTRST RTTINCIEN ALMIEN
15 14 13 12 11 10 9 8
RTPRES
7 6 5 4 3 2 1 0
RTPRES
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
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
119
6254C–ATARM–22-Jan-10
16.4.4 Real-time Timer Status Register
Register Name: RTT_SR
Address: 0xFFFFFD2C
Access Type: Read-only
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
– – – – – – RTTINC ALMS
17.1 Description
The Periodic Interval Timer (PIT) provides the operating system’s scheduler interrupt. It is
designed to offer maximum accuracy and efficient management, even for systems with long
response time .
PIV
=? PIT_MR
PITIEN
set
0 pit_irq
PIT_SR PITS
reset
0 0 1
12-bit
0 1
Adder
read PIT_PIVR
MCK 20-bit
Counter
MCK/16
Prescaler CPIV PIT_PIVR PICNT
121
6254C–ATARM–22-Jan-10
17.3 Functional Description
The Periodic Interval Timer aims at providing periodic interrupts for use by operating systems.
The PIT provides a programmable overflow counter and a reset-on-read feature. It is built
around two counters: a 20-bit CPIV counter and a 12-bit PICNT counter. Both counters work at
Master Clock /16.
The first 20-bit CPIV counter increments from 0 up to a programmable overflow value set in the
field PIV of the Mode Register (PIT_MR). When the counter CPIV reaches this value, it resets to
0 and increments the Periodic Interval Counter, PICNT. The status bit PITS in the Status Regis-
ter (PIT_SR) rises and triggers an interrupt, provided the interrupt is enabled (PITIEN in
PIT_MR).
Writing a new PIV value in PIT_MR does not reset/restart the counters.
When CPIV and PICNT values are obtained by reading the Periodic Interval Value Register
(PIT_PIVR), the overflow counter (PICNT) is reset and the PITS is cleared, thus acknowledging
the interrupt. The value of PICNT gives the number of periodic intervals elapsed since the last
read of PIT_PIVR.
When CPIV and PICNT values are obtained by reading the Periodic Interval Image Register
(PIT_PIIR), there is no effect on the counters CPIV and PICNT, nor on the bit PITS. For exam-
ple, a profiler can read PIT_PIIR without clearing any pending interrupt, whereas a timer
interrupt clears the interrupt by reading PIT_PIVR.
The PIT may be enabled/disabled using the PITEN bit in the PIT_MR register (disabled on
reset). The PITEN bit only becomes effective when the CPIV value is 0. Figure 17-2 illustrates
the PIT counting. After the PIT Enable bit is reset (PITEN= 0), the CPIV goes on counting until
the PIV value is reached, and is then reset. PIT restarts counting, only if the PITEN is set again.
The PIT is stopped when the core enters debug state.
MCK
15
MCK Prescaler 0
PITEN
PICNT 0 1 0
PITS (PIT_SR)
APB Interface
read PIT_PIVR
123
6254C–ATARM–22-Jan-10
17.4 Periodic Interval Timer (PIT) User Interface
23 22 21 20 19 18 17 16
– – – – PIV
15 14 13 12 11 10 9 8
PIV
7 6 5 4 3 2 1 0
PIV
125
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – PITS
126
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
PICNT CPIV
15 14 13 12 11 10 9 8
CPIV
7 6 5 4 3 2 1 0
CPIV
127
6254C–ATARM–22-Jan-10
17.4.4 Periodic Interval Timer Image Register
Register Name: PIT_PIIR
Address: 0xFFFFFD3C
Access Type: Read-only
31 30 29 28 27 26 25 24
PICNT
23 22 21 20 19 18 17 16
PICNT CPIV
15 14 13 12 11 10 9 8
CPIV
7 6 5 4 3 2 1 0
CPIV
18.1 Description
The Watchdog Timer can be used to prevent system lock-up if the software becomes trapped in
a deadlock. It features a 12-bit down counter that allows a watchdog period of up to 16 seconds
(slow clock at 32.768 kHz). It can generate a general reset or a processor reset only. In addition,
it can be stopped while the processor is in debug mode or idle mode.
write WDT_MR
WDT_MR
WDV
WDT_CR
WDRSTT reload
1 0
12-bit Down
Counter
WDT_MR
reload
WDD Current
1/128 SLCK
Value
<= WDD
WDT_MR
WDRSTEN
= 0
wdt_fault
(to Reset Controller)
set
WDUNF wdt_int
set reset
WDERR
read WDT_SR reset WDFIEN
or
reset WDT_MR
129
6254C–ATARM–22-Jan-10
18.3 Functional Description
The Watchdog Timer can be used to prevent system lock-up if the software becomes trapped in
a deadlock. It is supplied with VDDCORE. It restarts with initial values on processor reset.
The Watchdog is built around a 12-bit down counter, which is loaded with the value defined in
the field WDV of the Mode Register (WDT_MR). The Watchdog Timer uses the Slow Clock
divided by 128 to establish the maximum Watchdog period to be 16 seconds (with a typical Slow
Clock of 32.768 kHz).
After a Processor Reset, the value of WDV is 0xFFF, corresponding to the maximum value of
the counter with the external reset generation enabled (field WDRSTEN at 1 after a Backup
Reset). This means that a default Watchdog is running at reset, i.e., at power-up. The user must
either disable it (by setting the WDDIS bit in WDT_MR) if he does not expect to use it or must
reprogram it to meet the maximum Watchdog period the application requires.
The Watchdog Mode Register (WDT_MR) can be written only once. Only a processor reset
resets it. Writing the WDT_MR register reloads the timer with the newly programmed mode
parameters.
In normal operation, the user reloads the Watchdog at regular intervals before the timer under-
flow occurs, by writing the Control Register (WDT_CR) with the bit WDRSTT to 1. The
Watchdog counter is then immediately reloaded from WDT_MR and restarted, and the Slow
Clock 128 divider is reset and restarted. The WDT_CR register is write-protected. As a result,
writing WDT_CR without the correct hard-coded key has no effect. If an underflow does occur,
the “wdt_fault” signal to the Reset Controller is asserted if the bit WDRSTEN is set in the Mode
Register (WDT_MR). Moreover, the bit WDUNF is set in the Watchdog Status Register
(WDT_SR).
To prevent a software deadlock that continuously triggers the Watchdog, the reload of the
Watchdog must occur while the Watchdog counter is within a window between 0 and WDD,
WDD is defined in the WatchDog Mode Register WDT_MR.
Any attempt to restart the Watchdog while the Watchdog counter is between WDV and WDD
results in a Watchdog error, even if the Watchdog is disabled. The bit WDERR is updated in the
WDT_SR and the “wdt_fault” signal to the Reset Controller is asserted.
Note that this feature can be disabled by programming a WDD value greater than or equal to the
WDV value. In such a configuration, restarting the Watchdog Timer is permitted in the whole
range [0; WDV] and does not generate an error. This is the default configuration on reset (the
WDD and WDV values are equal).
The status bits WDUNF (Watchdog Underflow) and WDERR (Watchdog Error) trigger an inter-
rupt, provided the bit WDFIEN is set in the mode register. The signal “wdt_fault” to the reset
controller causes a Watchdog reset if the WDRSTEN bit is set as already explained in the reset
controller programmer Datasheet. In that case, the processor and the Watchdog Timer are
reset, and the WDERR and WDUNF flags are reset.
If a reset is generated or if WDT_SR is read, the status bits are reset, the interrupt is cleared,
and the “wdt_fault” signal to the reset controller is deasserted.
Writing the WDT_MR reloads and restarts the down counter.
While the processor is in debug state or in idle mode, the counter may be stopped depending on
the value programmed for the bits WDIDLEHLT and WDDBGHLT in the WDT_MR.
if WDRSTEN is 1
FFF
Forbidden
Window
WDD
Permitted
Window
WDT_CR = WDRSTT
Watchdog
Fault
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – WDRSTT
• KEY: Password
Should be written at value 0xA5. Writing any other value in this field aborts the write operation.
23 22 21 20 19 18 17 16
WDD
15 14 13 12 11 10 9 8
WDDIS WDRPROC WDRSTEN WDFIEN WDV
7 6 5 4 3 2 1 0
WDV
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – WDERR WDUNF
19.1 Description
The Shutdown Controller controls the power supplies VDDIO and VDDCORE and the wake-up
detection on debounced input lines.
Shutdown Controller
CPTWK0 reset
read SHDW_SR
Wake-up
reset
137
6254C–ATARM–22-Jan-10
A typical application connects the pin SHDN to the shutdown input of the DC/DC Converter pro-
viding the main power supplies of the system, and especially VDDCORE and/or VDDIO. The
wake-up inputs (WKUP0) connect to any push-buttons or signal that wake up the system.
The software is able to control the pin SHDN by writing the Shutdown Control Register
(SHDW_CR) with the bit SHDW at 1. The shutdown is taken into account only 2 slow clock
cycles after the write of SHDW_CR. This register is password-protected and so the value written
should contain the correct key for the command to be taken into account. As a result, the system
should be powered down.
A level change on WKUP0 is used as wake-up. Wake-up is configured in the Shutdown Mode
Register (SHDW_MR). The transition detector can be programmed to detect either a positive or
negative transition or any level change on WKUP0. The detection can also be disabled. Pro-
gramming is performed by defining WKMODE0.
Moreover, a debouncing circuit can be programmed for WKUP0. The debouncing circuit filters
pulses on WKUP0 shorter than the programmed number of 16 SLCK cycles in CPTWK0 of the
SHDW_MR register. If the programmed level change is detected on a pin, a counter starts.
When the counter reaches the value programmed in the corresponding field, CPTWK0, the
SHDN pin is released. If a new input change is detected before the counter reaches the corre-
sponding value, the counter is stopped and cleared. WAKEUP0 of the Status Register
(SHDW_SR) reports the detection of the programmed events on WKUP0 with a reset after the
read of SHDW_SR.
The Shutdown Controller can be programmed so as to activate the wake-up using the RTT
alarm (the detection of the rising edge of the RTT alarm is synchronized with SLCK). This is
done by writing the SHDW_MR register using the RTTWKEN fields. When enabled, the detec-
tion of the RTT alarm is reported in the RTTWK bit of the SHDW_SR Status register. It is reset
after the read of SHDW_SR. When using the RTT alarm to wake up the system, the user must
ensure that the RTT alarm status flag is cleared before shutting down the system. Otherwise, no
rising edge of the status flag may be detected and the wake-up fails.
139
6254C–ATARM–22-Jan-10
19.6.1 Shutdown Control Register
Register Name: SHDW_CR
Address: 0xFFFFFD10
Access Type: Write-only
31 30 29 28 27 26 25 24
KEY
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – SHDW
• KEY: Password
Should be written at value 0xA5. Writing any other value in this field aborts the write operation.
23 22 21 20 19 18 17 16
– – – – – – – RTTWKEN
15 14 13 12 11 10 9 8
– – – –
7 6 5 4 3 2 1 0
CPTWK0 – – WKMODE0
141
6254C–ATARM–22-Jan-10
19.6.3 Shutdown Status Register
Register Name: SHDW_SR
Address: 0xFFFFFD18
Access Type: Read-only
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – RTTWK
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – WAKEUP0
20.1 Description
The Enhanced Embedded Flash Controller (EEFC) ensures the interface of the Flash block with
the 32-bit internal bus. Its 128-bit wide memory interface increases performance. It also man-
ages the programming, erasing, locking and unlocking sequences of the Flash using a full set of
commands. One of the commands returns the embedded Flash descriptor definition that informs
the system about the Flash organization, thus making the software generic.
143
6254C–ATARM–22-Jan-10
Figure 20-1. Embedded Flash Organization
Memory Plane
Page 0
Start Address
Page (m-1)
Master Clock
ARM Request
(32-bit)
@Byte 0 @Byte 4 @Byte 8 @Byte 12 @Byte 16 @Byte 20 @Byte 24 @Byte 28 @Byte 32
Data To ARM XXX Bytes 0-3 Bytes 4-7 Bytes 8-11 Bytes 12-15 Bytes 16-19 Bytes 20-23 Bytes 24-27 Bytes 28-31
Note: When FWS is equal to 0, all the accesses are performed in a single-cycle access.
145
6254C–ATARM–22-Jan-10
Figure 20-3. Code Read Optimization in ARM Mode for FWS = 3
Master Clock
ARM Request
(32-bit)
@Byte 0 @4 @8 @12 @16 @20 @24 @28 @32 @36 @40 @44 @48 @52
Flash Access Bytes 0-15 Bytes 16-31 Bytes 32-47 Bytes 48-63
Data To ARM XXX 0-3 4-7 8-11 12-15 16-19 20-23 24-27 28-31 32-35 36-39 40-43 44-47 48-51
Note: When FWS is included between 1 and 3, in case of sequential reads, the first access takes (FWS+1) cycles, the other ones only
1 cycle.
ARM Request
(32-bit)
@Byte 0 @4 @8 @12 @16 @20 @24 @28 @32 @36 @40
Flash Access Bytes 0-15 Bytes 16-31 Bytes 32-47 Bytes 48-63
Data To ARM XXX 0-3 4-7 8-11 12-15 16-19 20-23 24-27 28-31 32-35 36-39
Note: When FWS is included between 4 and 10, in case of sequential reads, the first access takes (FWS+1) cycles, each first access
of the 128-bit read (FWS-2) cycles, and the others only 1 cycle.
Master Clock
ARM Request
(32-bit)
@Byte 0 @4 @8 @ 12 @ 16 @ 20 @ 24 @ 28 @ 32 @ 36
Data To ARM XXX Bytes 0-3 4-7 8-11 12-15 16-19 20-23 24-27 28-31 32-35
147
6254C–ATARM–22-Jan-10
20.3.3 Flash Commands
The Enhanced Embedded Flash Controller (EEFC) offers a set of commands such as program-
ming the memory Flash, locking and unlocking lock regions, consecutive programming and
locking and full Flash erasing, etc.
Commands and read operations can be performed in parallel only on different memory planes.
Code can be fetched from one memory plane while a write or an erase operation is performed
on another.
In order to perform one of these commands, the Flash Command Register (EEFC_FCR) has to
be written with the correct command using the field FCMD. As soon as the EEFC_FCR register
is written, the FRDY flag and the field FVALUE in the EEFC_FRR register are automatically
cleared. Once the current command is achieved, then the FRDY flag is automatically set. If an
interrupt has been enabled by setting the bit FRDY in EEFC_FMR, the interrupt line of the Sys-
tem Controller is activated.
All the commands are protected by the same keyword, which has to be written in the 8 highest
bits of the EEFC_FCR register.
Writing EEFC_FCR with data that does not contain the correct key and/or with an invalid com-
mand has no effect on the whole memory plane, but the FCMDE flag is set in the EEFC_FSR
register. This flag is automatically cleared by a read access to the EEFC_FSR register.
When the current command writes or erases a page in a locked region, the command has no
effect on the whole memory plane, but the FLOCKE flag is set in the EEFC_FSR register. This
flag is automatically cleared by a read access to the EEFC_FSR register.
No
Check if FRDY flag Set
Yes
No
Check if FRDY flag Set
Yes
Yes
Check if FLOCKE flag Set Locking region violation
No
Yes
Check if FCMDE flag Set Bad keyword violation
No
Command Successfull
149
6254C–ATARM–22-Jan-10
ations to the EEFC_FRR register are done after the last word of the descriptor has been
returned, then the EEFC_FRR register value is 0 until the next valid command.
• a Command Error: a bad keyword has been written in the EEFC_FCR register.
• a Lock Error: the page to be programmed belongs to a locked region. A command must be
previously run to unlock the corresponding region.
By using the WP command, a page can be programmed in several steps if it has been erased
before (see Figure 20-7).
FF FF FF FF FF FF FF FF FF FF FF FF
... ... ...
X words FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF CA FE CA FE CA FE CA FE
... ... ...
X words FF FF FF FF CA FE CA FE CA FE CA FE
FF FF FF FF CA FE CA FE CA FE CA FE
FF FF FF FF FF FF FF FF DE CA DE CA
... ... ...
X words FF FF FF FF FF FF FF FF DE CA DE CA
FF FF FF FF FF FF FF FF DE CA DE CA
FF FF FF FF FF FF FF FF FF FF FF FF
... ... ...
X words FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF
The Partial Programming mode works only with 32-bit (or higher) boundaries. It can not be used
with boundaries lower than 32 bits (one or two bytes, for example).
151
6254C–ATARM–22-Jan-10
• The Set Lock command (SLB) and a page number to be protected are written in the Flash
Command Register.
• When the locking completes, the bit FRDY in the Flash Programming Status Register
(EEFC_FSR) rises. If an interrupt has been enabled by setting the bit FRDY in EEFC_FMR,
the interrupt line of the System Controller is activated.
• If the lock bit number is greater than the total number of lock bits, then the command has no
effect. The result of the SLB command can be checked running a GLB (Get Lock Bit)
command.
One error can be detected in the EEFC_FSR register after a programming sequence:
• a Command Error: a bad keyword has been written in the EEFC_FCR register.
It is possible to clear lock bits previously set. Then the locked region can be erased or pro-
grammed. The unlock sequence is:
• The Clear Lock command (CLB) and a page number to be unprotected are written in the
Flash Command Register.
• When the unlock completes, the bit FRDY in the Flash Programming Status Register
(EEFC_FSR) rises. If an interrupt has been enabled by setting the bit FRDY in EEFC_FMR,
the interrupt line of the System Controller is activated.
• If the lock bit number is greater than the total number of lock bits, then the command has no
effect.
One error can be detected in the EEFC_FSR register after a programming sequence:
• a Command Error: a bad keyword has been written in the EEFC_FCR register.
The status of lock bits can be returned by the Enhanced Embedded Flash Controller (EEFC).
The Get Lock Bit status sequence is:
• The Get Lock Bit command (GLB) is written in the Flash Command Register. FARG field is
meaningless.
• When the command completes, the bit FRDY in the Flash Programming Status Register
(EEFC_FSR) rises. If an interrupt has been enabled by setting the bit FRDY in EEFC_FMR,
the interrupt line of the System Controller is activated.
• Lock bits can be read by the software application in the EEFC_FRR register. The first word
read corresponds to the 32 first lock bits, next reads providing the next 32 lock bits as long as
it is meaningful. Extra reads to the EEFC_FRR register return 0.
For example, if the third bit of the first word read in the EEFC_FRR is set, then the third lock
region is locked.
One error can be detected in the EEFC_FSR register after a programming sequence:
• a Command Error: a bad keyword has been written in the EEFC_FCR register.
Note: Access to the Flash in read is permitted when a set, clear or get lock bit command is performed.
• When the GPVNM bit is set, the bit FRDY in the Flash Programming Status Register
(EEFC_FSR) rises. If an interrupt was enabled by setting the bit FRDY in EEFC_FMR, the
interrupt line of the System Controller is activated.
• If the GPNVM bit number is greater than the total number of GPNVM bits, then the command
has no effect. The result of the SGPB command can be checked by running a GGPB (Get
GPNVM Bit) command.
One error can be detected in the EEFC_FSR register after a programming sequence:
• A Command Error: a bad keyword has been written in the EEFC_FCR register.
It is possible to clear GPNVM bits previously set. The clear GPNVM bit sequence is:
• Start the Clear GPNVM Bit command (CGPB) by writing the Flash Command Register with
CGPB and the number of the GPNVM bit to be cleared.
• When the clear completes, the bit FRDY in the Flash Programming Status Register
(EEFC_FSR) rises. If an interrupt has been enabled by setting the bit FRDY in EEFC_FMR,
the interrupt line of the System Controller is activated.
• If the GPNVM bit number is greater than the total number of GPNVM bits, then the command
has no effect.
One error can be detected in the EEFC_FSR register after a programming sequence:
• A Command Error: a bad keyword has been written in the EEFC_FCR register.
The status of GPNVM bits can be returned by the Enhanced Embedded Flash Controller
(EEFC). The sequence is:
• Start the Get GPNVM bit command by writing the Flash Command Register with GGPB. The
FARG field is meaningless.
• When the command completes, the bit FRDY in the Flash Programming Status Register
(EEFC_FSR) rises. If an interrupt has been enabled by setting the bit FRDY in EEFC_FMR,
the interrupt line of the System Controller is activated.
• GPNVM bits can be read by the software application in the EEFC_FRR register. The first
word read corresponds to the 32 first GPNVM bits, following reads provide the next 32
GPNVM bits as long as it is meaningful. Extra reads to the EEFC_FRR register return 0.
For example, if the third bit of the first word read in the EEFC_FRR is set, then the third GPNVM
bit is active.
One error can be detected in the EEFC_FSR register after a programming sequence:
• a Command Error: a bad keyword has been written in the EEFC_FCR register.
Note: Access to the Flash in read is permitted when a set, clear or get GPNVM bit command is
performed.
153
6254C–ATARM–22-Jan-10
20.4 Enhanced Embedded Flash Controller (EEFC) User Interface
The User Interface of the Enhanced Embedded Flash Controller (EEFC) is integrated within the System Controller with
base address 0xFFFF FA00.
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – FWS
7 6 5 4 3 2 1 0
– – – – – – FRDY
155
6254C–ATARM–22-Jan-10
20.4.2 EEFC Flash Command Register
Register Name: EEFC_FCR
Address: 0xFFFFFA04
Access Type: Write-only
Offset: 0x64
31 30 29 28 27 26 25 24
FKEY
23 22 21 20 19 18 17 16
FARG
15 14 13 12 11 10 9 8
FARG
7 6 5 4 3 2 1 0
FCMD
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – FLOCKE FCMDE FRDY
157
6254C–ATARM–22-Jan-10
20.4.4 EEFC Flash Result Register
Register Name: EEFC_FRR
Address: 0xFFFFFA0C
Access Type: Read-only
Offset: 0x6C
31 30 29 28 27 26 25 24
FVALUE
23 22 21 20 19 18 17 16
FVALUE
15 14 13 12 11 10 9 8
FVALUE
7 6 5 4 3 2 1 0
FVALUE
21.1 Description
Bus Matrix implements a multi-layer AHB, based on AHB-Lite protocol, that enables parallel
access paths between multiple AHB masters and slaves in a system, which increases the over-
all bandwidth. Bus Matrix interconnects 6 AHB Masters to 5 AHB Slaves. The normal latency to
connect a master to a slave is one cycle except for the default master of the accessed slave
which is connected directly (zero cycle latency).
The Bus Matrix user interface is compliant with ARM® Advance Peripheral Bus and provides a
Chip Configuration User Interface with Registers that allow the Bus Matrix to support application
specific features.
159
6254C–ATARM–22-Jan-10
FIXED_DEFMSTR field allows to choose a fixed default master provided that DEFMSTR_TYPE
is set to fixed default master. Please refer to the Bus Matrix user interface description.
21.4 Arbitration
The Bus Matrix provides an arbitration mechanism that allows to reduce latency when conflict
cases occur, basically when two or more masters try to access the same slave at the same time.
One arbiter per AHB slave is provided, allowing to arbitrate each slave differently.
The Bus Matrix provides to the user the possibility to choose between 2 arbitration types, and
this for each slave:
1. Round-Robin Arbitration (the default)
2. Fixed Priority Arbitration
This choice is given through the field ARBT of the Slave Configuration Registers
(MATRIX_SCFG).
Each algorithm may be complemented by selecting a default master configuration for each
slave.
When a re-arbitration has to be done, it is realized only under some specific conditions detailed
in the following paragraph.
This selection can be done through the field ULBT of the Master Configuration Registers
(MATRIX_MCFG).
161
6254C–ATARM–22-Jan-10
more master’s requests with the same priority are active at the same time, the master with the
highest number is serviced first.
For each slave, the priority of each master may be defined through the Priority Registers for
Slaves (MATRIX_PRAS and MATRIX_PRBS).
163
6254C–ATARM–22-Jan-10
21.5.1 Bus Matrix Master Configuration Registers
Name: MATRIX_MCFG0...MATRIX_MCFG5
Address: 0xFFFFEE00
Access: Read-write
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
– – – – – ULBT
23 22 21 20 19 18 17 16
– FIXED_DEFMSTR DEFMSTR_TYPE
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
SLOT_CYCLE
165
6254C–ATARM–22-Jan-10
21.5.3 Bus Matrix Priority Registers For Slaves
Name: MATRIX_PRS0...MATRIX_PRS4
Access: Read-write
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – M5PR – – M4PR
15 14 13 12 11 10 9 8
– – M3PR – – M2PR
7 6 5 4 3 2 1 0
– – M1PR – – M0PR
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – -
7 6 5 4 3 2 1 0
– – – – – – RCB1 RCB0
167
6254C–ATARM–22-Jan-10
21.6.1 EBI Chip Select Assignment Register
Name: EBI_CSA
Access: Read-write
Reset: 0x0001_0000
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – EBI_DRIVE
15 14 13 12 11 10 9 8
– – – – – – – EBI_DBPUC
7 6 5 4 3 2 1 0
– – EBI_CS5A EBI_CS4A EBI_CS3A – EBI_CS1A –
22.1 Description
The External Bus Interface (EBI) is designed to ensure the successful data transfer between
several external devices and the embedded Memory Controller of an ARM®-based device. The
Static Memory, SDRAM and ECC Controllers are all featured external Memory Controllers on
the EBI. These external Memory Controllers are capable of handling several types of external
memory and peripheral devices, such as SRAM, PROM, EPROM, EEPROM, Flash, and
SDRAM.
The EBI also supports the CompactFlash and the NAND Flash protocols via integrated circuitry
that greatly reduces the requirements for external components. Furthermore, the EBI handles
data transfers with up to six external devices, each assigned to six address spaces defined by
the embedded Memory Controller. Data transfers are performed through a 16-bit or 32-bit data
bus, an address bus of up to 26 bits, up to eight chip select lines (NCS[7:0]) and several control
pins that are generally multiplexed between the different external Memory Controllers.
169
6254C–ATARM–22-Jan-10
22.2 Block Diagram
A[15:2], A[22:18]
A16/BA0
MUX
Static
Logic A17/BA1
Memory
Controller
NCS0
NCS1/SDCS
NRD/NOE/CFOE
NWR0/NWE/CFWE
NWR1/NBS1/CFIOR
NWR3/NBS3/CFIOW
CompactFlash SDCK
Logic
SDCKE
RAS
CAS
NAND Flash SDWE
Logic
SDA10
NANDOE
NANDWE
ECC
D[31:16]
Controller
PIO A[25:23]
CFRNW/A25
Chip Select
Address Decoders NCS4/CFCS0
Assignor
NCS5/CFCS1
NCS2/NCS6/NCS7
NWAIT
User Interface CFCE1
CFCE2
NCS3/NANDCS
APB
171
6254C–ATARM–22-Jan-10
The connection of some signals through the MUX logic is not direct and depends on the Memory
Controller in use at the moment.
Table 22-2 on page 172 details the connections between the two Memory Controllers and the
EBI pins.
Table 22-2. EBI Pins and Memory Controllers I/O Lines Connections
EBIx Pins SDRAMC I/O Lines SMC I/O Lines
EBI_NWR1/NBS1/CFIOR NBS1 NWR1/NUB
EBI_A0/NBS0 Not Supported SMC_A0/NLB
EBI_A1/NBS2/NWR2 Not Supported SMC_A1
EBI_A[11:2] SDRAMC_A[9:0] SMC_A[11:2]
EBI_SDA10 SDRAMC_A10 Not Supported
EBI_A12 Not Supported SMC_A12
EBI_A[14:13] SDRAMC_A[12:11] SMC_A[14:13]
EBI_A[22:15] Not Supported SMC_A[22:15]
EBI_A[25:23] Not Supported SMC_A[25:23]
EBI_D[31:0] D[31:0] D[31:0]
Controller SMC
D0 - D7 D0 - D7 D0 - D7 D0 - D7 D0 - D7 D0 - D7 D0 - D7
NCS1/SDCS CS CS CS CS CS CS
NCS2 CS CS CS CS CS CS
NCS3/NANDCS CS CS CS CS CS CS
NCS4/CFCS0 CS CS CS CS CS CS
NCS5/CFCS1 CS CS CS CS CS CS
NCS6 CS CS CS CS CS CS
NCS7 CS CS CS CS CS CS
NRD/CFOE OE OE OE OE OE OE
(1) (2)
NWR0/NWE WE WE WE WE WE WE
(1) (2) (3)
NWR1/NBS1 – WE NUB WE NUB BE1(5)
173
6254C–ATARM–22-Jan-10
Table 22-4. EBI Pins and External Devices Connections
Pins of the Interfaced Device
CompactFlash
CompactFlash
Signals: SDRAM True IDE Mode NAND Flash
(EBI only)
EBI_ (EBI only)
Controller SDRAMC SMC
D0 - D7 D0 - D7 D0 - D7 D0 - D7 I/O0-I/O7
A0/NBS0 DQM0 A0 A0 –
A1/NWR2/NBS2 DQM2 A1 A1 –
A11 A9 – – –
SDA10 A10 – – –
A12 – – – –
A15 – – – –
A16/BA0 BA0 – – –
A17/BA1 BA1 – – –
A18 - A20 – – – –
A21 – – – ALE
A23 - A24 – – – –
(1) (1)
A25 – CFRNW CFRNW –
NCS0 – – – –
NCS1/SDCS CS – – –
NCS2 – – – –
NCS3/NANDCS – – – –
(1) (1)
NCS4/CFCS0 – CFCS0 CFCS0 –
(1) (1)
NCS5/CFCS1 – CFCS1 CFCS1 –
NCS6 – – – –
NCS7 – – – –
NANDOE – – – RE
NANDWE – – – WE
NRD/CFOE – OE – –
NWR0/NWE/CFWE – WE WE –
SDCK CLK – – –
SDCKE CKE – – –
RAS RAS – – –
CAS CAS – – –
SDWE WE – – –
175
6254C–ATARM–22-Jan-10
22.4.2 Connection Examples
Figure 22-2 shows an example of connections between the EBI and external devices.
EBI
D0-D31
RAS
CAS 2M x 8 2M x 8
SDCK
SDCKE D0-D7
SDRAM D8-D15
SDRAM
D0-D7 D0-D7
SDWE
A0/NBS0 CS CS
NWR1/NBS1 CLK CLK
A1/NWR2/NBS2 A0-A9, A11 A2-A11, A13 A0-A9, A11 A2-A11, A13
CKE CKE
NWR3/NBS3 SDWE WE A10 SDA10 SDWE A10 SDA10
WE
NRD/NOE BA0 A16/BA0 BA0 A16/BA0
RAS RAS
NWR0/NWE BA1 A17/BA1 BA1 A17/BA1
CAS CAS
DQM DQM
NBS0 NBS1
SDA10
A2-A15
A16/BA0
A17/BA1
A18-A25
2M x 8 2M x 8
D16-D23 D0-D7 SDRAM D24-D31
SDRAM
D0-D7
NCS0
NCS1/SDCS CS CS
NCS2 CLK CLK
CKE A0-A9, A11 A2-A11, A13
NCS3 CKE A0-A9, A11
SDWE WE A10 SDA10 SDWE
NCS4 WE A10 A2-A11, A13
RAS BA0 A16/BA0
NCS5 RAS BA0 SDA10
CAS BA1 A17/BA1
CAS BA1 A16/BA0
DQM DQM A17/BA1
NBS3
NBS2
128K x 8 128K x 8
SRAM SRAM
A1-A17 A1-A17
D0-D7 D0-D7 A0-A16 D8-D15 D0-D7 A0-A16
CS CS
OE OE
NRD/NOE NRD/NOE
WE WE
A0/NWR0/NBS0 NWR1/NBS1
177
6254C–ATARM–22-Jan-10
22.6.6.1 I/O Mode, Common Memory Mode, Attribute Memory Mode and True IDE Mode
Within the NCS4 and/or NCS5 address space, the current transfer address is used to distinguish
I/O mode, common memory mode, attribute memory mode and True IDE mode.
The different modes are accessed through a specific memory mapping as illustrated on Figure
22-3. A[23:21] bits of the transfer address are used to select the desired mode as described in
Table 22-5 on page 178.
Note: The A22 pin is used to drive the REG signal of the CompactFlash Device (except in True IDE
mode).
The CFCE1 and CFCE2 waveforms are identical to the corresponding NCSx waveform. For
details on these waveforms and timings, refer to the Static Memory Controller section.
179
6254C–ATARM–22-Jan-10
Figure 22-4. CompactFlash Read/Write Control Signals
A23
1
0
1
0
0 CFOE
1
1 1 CFWE
A22
NRD_NOE
0
NWR0_NWE CFIOR
1 CFIOW
1
1
181
6254C–ATARM–22-Jan-10
Figure 22-5. CompactFlash Application Example
EBI CompactFlash Connector
D[15:0] D[15:0]
DIR /OE
A25/CFRNW
NCS4/CFCS0
_CD1
CD (PIO)
_CD2
/OE
A[10:0] A[10:0]
A22/REG _REG
NOE/CFOE _OE
NWE/CFWE _WE
NWR1/CFIOR _IORD
NWR3/CFIOW _IOWR
CFCE1 _CE1
CFCE2 _CE2
NWAIT _WAIT
NCSx NANDOE
NANDOE
NRD_NOE
NANDWE
NANDWE
NWR0_NWE
183
6254C–ATARM–22-Jan-10
Figure 22-7. NAND Flash Application Example
D[7:0]
AD[7:0]
A[22:21]
ALE
CLE
NCSx/NANDCS
Not Connected
EBI
NAND Flash
NANDOE
NOE
NANDWE
NWE
PIO CE
PIO R/B
Note: The External Bus Interface is also able to support 16-bit devices.
D[0..15]
A[0..14]
U1
(Not used A12) A2 23 2 D0
A3 A0 DQ0 D1
24 A1 DQ1 4
A4 25 5 D2
A5 A2 DQ2 D3
26 A3 DQ3 7
A6 29 8 D4
A7 A4 DQ4 D5
30 A5 DQ5 10
A8 31 11 D6
A9 A6 DQ6 D7
32 A7 DQ7 13
A10 33 42 D8
A11 A8 DQ8 D9
34 A9 DQ9 44
SDA10 22 45 D10
SDA10 A10 DQ10
A13 35 47 D11
A11 DQ11 D12
DQ12 48
BA0 20 50 D13
BA0 BA0 DQ13
BA1 21 51 D14
BA1 BA1 DQ14
53 D15
A14 DQ15
36 A12 3V3
40 N.C VDD 1 C1 100NF
VDD 14 C2 100NF
SDCKE 37 27 C3 100NF
SDCKE CKE VDD
VDDQ 3 C4 100NF
SDCK 38 9 C5 100NF
SDCK CLK VDDQ
VDDQ 43 C6 100NF
A0 15 49 C7 100NF
DQML VDDQ
CFIOR_NBS1_NWR1 39 DQMH
VSS 28
CAS 17 41
CAS CAS VSS
RAS 18 54
RAS RAS VSS
VSSQ 6
VSSQ 12
SDWE 16 46
SDWE WE VSSQ
SDCS_NCS1 19 CS VSSQ 52
185
6254C–ATARM–22-Jan-10
22.7.2 32-bit SDRAM
A[0..14]
U1 U2
(Not used A12) A2 23 2 D0 A2 23 2 D16
A3 A0 DQ0 D1 A3 A0 DQ0 D17
24 A1 DQ1 4 24 A1 DQ1 4
A4 25 5 D2 A4 25 5 D18
A5 A2 DQ2 D3 A5 A2 DQ2 D19
26 A3 DQ3 7 26 A3 DQ3 7
A6 29 8 D4 A6 29 8 D20
A7 A4 DQ4 D5 A7 A4 DQ4 D21
30 A5 DQ5 10 30 A5 DQ5 10
A8 31 11 D6 A8 31 11 D22
A9 A6 DQ6 D7 A9 A6 DQ6 D23
32 A7 DQ7 13 32 A7 DQ7 13
A10 33 42 D8 A10 33 42 D24
A11 A8 DQ8 D9 A11 A8 DQ8 D25
34 A9 DQ9 44 34 A9 DQ9 44
SDA10 22 45 D10 SDA10 22 45 D26
SDA10 A10 DQ10 A10 DQ10
A13 35 47 D11 A13 35 47 D27
A11 DQ11 D12 A11 DQ11 D28
DQ12 48 DQ12 48
BA0 20 50 D13 BA0 20 50 D29
BA0 BA0 DQ13 BA0 DQ13
BA1 21 51 D14 BA1 21 51 D30
BA1 BA1 DQ14 BA1 DQ14
53 D15 53 D31
A14 DQ15 A14 DQ15
36 A12 3V3 36 A12 3V3
40 N.C VDD 1 C1 100NF 40 N.C VDD 1 C8 100NF
VDD 14 C2 100NF VDD 14 C9 100NF
SDCKE 37 27 C3 100NF SDCKE 37 27 C10 100NF
SDCKE CKE VDD CKE VDD
VDDQ 3 C4 100NF VDDQ 3 C11 100NF
SDCK 38 9 C5 100NF SDCK 38 9 C12 100NF
SDCK CLK VDDQ CLK VDDQ
VDDQ 43 C6 100NF VDDQ 43 C13 100NF
A0 15 49 C7 100NF A1 15 49 C14 100NF
DQML VDDQ DQML VDDQ
CFIOR_NBS1_NWR1 39 CFIOW_NBS3_NWR3 39
DQMH DQMH
VSS 28 VSS 28
CAS 17 41 CAS 17 41
CAS CAS VSS CAS VSS
RAS 18 54 RAS 18 54
RAS RAS VSS RAS VSS
VSSQ 6 VSSQ 6
VSSQ 12 VSSQ 12
SDWE 16 46 SDWE 16 46
SDWE WE VSSQ WE VSSQ
19 CS VSSQ 52 19 CS VSSQ 52
SDCS_NCS1
D[0..7]
U1
CLE 16 29 D0
CLE I/O0 D1
ALE 17 ALE I/O1 30
NANDOE 8 31 D2
RE I/O2 D3
NANDWE 18 WE I/O3 32
(ANY PIO) 9 41 D4
CE I/O4 D5
I/O5 42
7 43 D6
(ANY PIO) R/B I/O6
R1 10K 44 D7
I/O7
3V3 19 WP
R2 10K N.C 48
N.C 47
1 N.C N.C 46
2 N.C N.C 45
3 N.C N.C 40
4 N.C N.C 39
5 N.C PRE 38
6 N.C N.C 35
10 N.C N.C 34
11 N.C N.C 33
14 N.C N.C 28
15 N.C N.C 27 3V3
20 N.C
21 N.C VCC 37
22 N.C VCC 12
23 C2
N.C
24 N.C
25 36 100NF
N.C VSS
26 N.C VSS 13
C1
100NF
187
6254C–ATARM–22-Jan-10
22.7.4 16-bit NAND FLASH
Hardware Configuration
D[0..15]
U1
CLE 16 26 D0
CLE I/O0 D1
ALE 17 ALE I/O1 28
NANDOE 8 30 D2
RE I/O2 D3
NANDWE 18 WE I/O3 32
(ANY PIO) 9 40 D4
CE I/O4 D5
I/O5 42
7 44 D6
(ANY PIO) R/B I/O6
R1 10K 46 D7
I/O7 D8
3V3 19 WP I/O8 27
R2 10K 29 D9
I/O9 D10
I/O10 31
1 33 D11
N.C I/O11 D12
2 N.C I/O12 41
3 43 D13
N.C I/O13 D14
4 N.C I/O14 45
5 47 D15
N.C I/O15
6 N.C
10 N.C N.C 39
11 N.C PRE 38
14 N.C N.C 36
15 3V3
N.C
20 N.C
21 N.C VCC 37
22 N.C VCC 12
23 N.C
24 48 C2
N.C VSS 100NF
34 N.C VSS 25
35 N.C VSS 13
C1
100NF
D[0..15]
A[1..22]
U1
A1 25 29 D0
A2 A0 DQ0 D1
24 A1 DQ1 31
A3 23 33 D2
A4 A2 DQ2 D3
22 A3 DQ3 35
A5 21 38 D4
A6 A4 DQ4 D5
20 A5 DQ5 40
A7 19 42 D6
A8 A6 DQ6 D7
18 A7 DQ7 44
A9 8 30 D8
A10 A8 DQ8 D9
7 A9 DQ9 32
A11 6 34 D10
A12 A10 DQ10 D11
5 A11 DQ11 36
A13 4 39 D12
A14 A12 DQ12 D13
3 A13 DQ13 41
A15 2 43 D14
A16 A14 DQ14 D15
1 A15 DQ15 45
A17 48
A18 A16
17 A17
A19 16
A20 A18
15 A19
A21 10 3V3
A22 A20
9 A21
VCCQ 47
NRST 12 RESET
NWE 11 WE
14 WP VCC 37 C2
3V3 13 VPP 100NF
NCS0 26 CE
NRD 28 OE VSS 46
VSS 27
C1
100NF
189
6254C–ATARM–22-Jan-10
22.7.6 Compact Flash
T3 4DIR
T4 4OE
74ALVCH32245
1
MN3A
SN74ALVC125
CFCE2 2 3 CE2
4
MN3B
SN74ALVC125
CFCE1 5 6 CE1
10
MN3C
SN74ALVC125
(ANY PIO) CFRST 9 8 RESET
13
MN3D R3
SN74ALVC125 10K
(ANY PIO) CFIRQ 11 12 RDY/BSY 3V3
MN4
3V3 5 VCC 1
R4
10K
NWAIT 4 2 WAIT# 3V3
GND 3
SN74LVC1G125-Q1
191
6254C–ATARM–22-Jan-10
22.7.7 Compact Flash True IDE
T3 4DIR
T4 4OE
74ALVCH32245
1
MN3A
SN74ALVC125
CFCE2 2 3 CE2
4
MN3B
SN74ALVC125
CFCE1 5 6 CE1
10
MN3C
SN74ALVC125
(ANY PIO) CFRST 9 8 RESET#
13
MN3D R3
SN74ALVC125 10K
(ANY PIO) CFIRQ 11 12 INTRQ 3V3
MN4
3V3 5 VCC 1
R4
10K
NWAIT 4 2 IORDY 3V3
GND 3
SN74LVC1G125-Q1
193
6254C–ATARM–22-Jan-10
194 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23.1 Description
The Static Memory Controller (SMC) generates the signals that control the access to the exter-
nal memory devices or peripheral devices. It has 8 Chip Selects and a 26-bit address bus. The
32-bit data bus can be configured to interface with 8-, 16-, or 32-bit external devices. Separate
read and write control signals allow for direct memory and peripheral interfacing. Read and write
signal waveforms are fully parametrizable.
The SMC can manage wait requests from external devices to extend the current access. The
SMC is provided with an automatic slow clock mode. In slow clock mode, it switches from user-
programmed waveforms to slow-rate specific waveforms on read and write signals. The SMC
supports asynchronous burst read in page mode access for page size up to 32 bytes.
195
6254C–ATARM–22-Jan-10
23.4 Application Example
D0-D31
A0/NBS0
NWR0/NWE
128K x 8 128K x 8
NWR1/NBS1
D0 - D7 SRAM D8-D15 SRAM
A1/NWR2/NBS2 D0 - D7 D0-D7
NWR3/NBS3
CS CS
128K x 8 128K x 8
D16 - D23 SRAM D24-D31 SRAM
A2 - A25 D0 - D7 D0-D7
CS CS
A2 - A18
A2 - A18
A0 - A16 A0 - A16
NRD NRD
OE OE
A1/NWR2/NBS2 NWR3/NBS3
WE WE
Static Memory
Controller
NCS[0] - NCS[7]
NCS7
Memory Enable
NRD NCS6
Memory Enable
SMC NWE NCS5
Memory Enable
A[25:0] NCS4
Memory Enable
D[31:0] NCS3
Memory Enable
NCS2
Memory Enable
NCS1
Memory Enable
NCS0
Memory Enable
Output Enable
Write Enable
A[25:0]
8 or 16 or 32
D[31:0] or D[15:0] or
D[7:0]
197
6254C–ATARM–22-Jan-10
Figure 23-3. Memory Connection for an 8-bit Data Bus
D[7:0] D[7:0]
A[18:2] A[18:2]
A0 A0
SMC A1 A1
D[15:0] D[15:0]
A[19:2] A[18:1]
A1 A[0]
D[31:16]
D[31:16]
D[15:0] D[15:0]
A[20:2] A[18:0]
199
6254C–ATARM–22-Jan-10
Figure 23-6. Connection of 2 x 8-bit Devices on a 16-bit Bus: Byte Write Option
D[7:0] D[7:0]
D[15:8]
A[24:2] A[23:1]
SMC A1 A[0]
NWR0 Write Enable
NWR1
NRD Read Enable
NCS[3] Memory Enable
D[15:8]
A[23:1]
A[0]
Write Enable
Read Enable
Memory Enable
Figure 23-7. Connection of 2x16-bit Data Bus on a 32-bit Data Bus (Byte Select Option)
D[15:0] D[15:0]
D[31:16]
A[25:2] A[23:0]
NWE Write Enable
NBS0 Low Byte Enable
SMC NBS2
NBS3
D[31:16]
A[23:0]
Write Enable
201
6254C–ATARM–22-Jan-10
23.8 Standard Read and Write Protocols
In the following sections, the byte access type is not considered. Byte select lines (NBS0 to
NBS3) always have the same timing as the A address bus. NWE represents either the NWE sig-
nal in byte select access type or one of the byte write lines (NWR0 to NWR3) in byte write
access type. NWR0 to NWR3 have the same timings and protocol as NWE. In the same way,
NCS represents one of the NCS[0..7] chip select lines.
MCK
A[25:2]
NBS0,NBS1,
NBS2,NBS3,
A0, A1
NRD
NCS
D[31:0]
NRD_CYCLE
203
6254C–ATARM–22-Jan-10
Figure 23-9. No Setup, No Hold On NRD and NCS Read Signals
MCK
A[25:2]
NBS0,NBS1,
NBS2,NBS3,
A0, A1
NRD
NCS
D[31:0]
Figure 23-10. READ_MODE = 1: Data is sampled by SMC before the rising edge of NRD
MCK
A[25:2]
NBS0,NBS1,
NBS2,NBS3,
A0, A1
NRD
NCS
tPACC
D[31:0]
Data Sampling
Figure 23-11. READ_MODE = 0: Data is sampled by SMC before the rising edge of NCS
MCK
A[25:2]
NBS0,NBS1,
NBS2,NBS3,
A0, A1
NRD
NCS
tPACC
D[31:0]
Data Sampling
205
6254C–ATARM–22-Jan-10
23.8.3 Write Waveforms
The write protocol is similar to the read protocol. It is depicted in Figure 23-12. The write cycle
starts with the address setting on the memory address bus.
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0, A1
NWE
NCS
NWE_CYCLE
Figure 23-13. Null Setup and Hold Values of NCS and NWE in Write Cycle
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0, A1
NWE,
NWR0, NWR1,
NWR2, NWR3
NCS
D[31:0]
207
6254C–ATARM–22-Jan-10
23.8.4 Write Mode
The WRITE_MODE parameter in the SMC_MODE register of the corresponding chip select indi-
cates which signal controls the write operation.
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0, A1
NWE,
NWR0, NWR1,
NWR2, NWR3
NCS
D[31:0]
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0, A1
NWE,
NWR0, NWR1,
NWR2, NWR3
NCS
D[31:0]
209
6254C–ATARM–22-Jan-10
23.8.6 Reset Values of Timing Parameters
Table 23-8, “Register Mapping,” gives the default value of timing parameters at reset.
Figure 23-16. Chip Select Wait State between a Read Access on NCS0 and a Write Access on
NCS2
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0,A1
NRD
NWE
NCS0
NCS2
NRD_CYCLE NWE_CYCLE
D[31:0]
211
6254C–ATARM–22-Jan-10
• in NCS write controlled mode (WRITE_MODE = 0), if there is no hold timing on the NCS
signal and the NCS_RD_SETUP parameter is set to 0, regardless of the read mode (Figure
23-18). The write operation must end with a NCS rising edge. Without an Early Read Wait
State, the write operation could not complete properly.
• in NWE controlled mode (WRITE_MODE = 1) and if there is no hold timing (NWE_HOLD =
0), the feedback of the write control signal is used to control address, data, chip select and
byte select lines. If the external write control signal is not inactivated as expected due to load
capacitances, an Early Read Wait State is inserted and address, data and control signals are
maintained one more cycle. See Figure 23-19.
Figure 23-17. Early Read Wait State: Write with No Hold Followed by Read with No Setup
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0, A1
NWE
NRD
no hold
no setup
D[31:0]
Figure 23-18. Early Read Wait State: NCS Controlled Write with No Hold Followed by a Read with No NCS Setup
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0,A1
NCS
NRD
no hold no setup
D[31:0]
Figure 23-19. Early Read Wait State: NWE-controlled Write with No Hold Followed by a Read with one Set-up Cycle
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0, A1
internal write controlling signal
D[31:0]
213
6254C–ATARM–22-Jan-10
23.9.3 Reload User Configuration Wait State
The user may change any of the configuration parameters by writing the SMC user interface.
When detecting that a new user configuration has been written in the user interface, the SMC
inserts a wait state before starting the next access. The so called “Reload User Configuration
Wait State” is used by the SMC to load the new set of parameters to apply to next accesses.
The Reload Configuration Wait State is not applied in addition to the Chip Select Wait State. If
accesses before and after re-programming the user interface are made to different devices
(Chip Selects), then one single Chip Select Wait State is applied.
On the other hand, if accesses before and after writing the user interface are made to the same
device, a Reload Configuration Wait State is inserted, even if the change does not concern the
current Chip Select.
23.10.1 READ_MODE
Setting the READ_MODE to 1 indicates to the SMC that the NRD signal is responsible for turn-
ing off the tri-state buffers of the external memory device. The Data Float Period then begins
after the rising edge of the NRD signal and lasts TDF_CYCLES MCK cycles.
When the read operation is controlled by the NCS signal (READ_MODE = 0), the TDF field gives
the number of MCK cycles during which the data bus remains busy after the rising edge of NCS.
Figure 23-20 illustrates the Data Float Period in NRD-controlled mode (READ_MODE =1),
assuming a data float period of 2 cycles (TDF_CYCLES = 2). Figure 23-21 shows the read oper-
ation when controlled by NCS (READ_MODE = 0) and the TDF_CYCLES parameter equals 3.
215
6254C–ATARM–22-Jan-10
Figure 23-20. TDF Period in NRD Controlled Read Access (TDF = 2)
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0, A1
NRD
NCS
tpacc
D[31:0]
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0,A1
NRD
NCS
tpacc
D[31:0]
Figure 23-22. TDF Optimization: No TDF wait states are inserted if the TDF period is over when the next access begins
MCK
A[25:2]
NRD
NRD_HOLD= 4
NWE
NWE_SETUP= 3
NCS0
TDF_CYCLES = 6
D[31:0]
read access on NCS0 (NRD controlled) Read to Write write access on NCS0 (NWE controlled)
Wait State
217
6254C–ATARM–22-Jan-10
Figure 23-23. TDF Optimization Disabled (TDF Mode = 0). TDF wait states between 2 read accesses on different chip
selects
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0, A1
D[31:0]
Figure 23-24. TDF Mode = 0: TDF wait states between a read and a write access on different chip selects
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0, A1
read1 controlling signal
(NRD) read1 hold = 1 write2 setup = 1
D[31:0]
Figure 23-25. TDF Mode = 0: TDF wait states between read and write accesses on the same chip select
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0, A1
D[31:0]
219
6254C–ATARM–22-Jan-10
23.11 External Wait
Any access can be extended by an external device using the NWAIT input signal of the SMC.
The EXNW_MODE field of the SMC_MODE register on the corresponding chip select must be
set to either to “10” (frozen mode) or “11” (ready mode). When the EXNW_MODE is set to “00”
(disabled), the NWAIT signal is simply ignored on the corresponding chip select. The NWAIT
signal delays the read or write operation in regards to the read or write controlling signal,
depending on the read and write modes of the corresponding chip select.
23.11.1 Restriction
When one of the EXNW_MODE is enabled, it is mandatory to program at least one hold cycle
for the read/write controlling signal. For that reason, the NWAIT signal cannot be used in Page
Mode (“Asynchronous Page Mode” on page 229), or in Slow Clock Mode (“Slow Clock Mode” on
page 226).
The NWAIT signal is assumed to be a response of the external device to the read/write request
of the SMC. Then NWAIT is examined by the SMC only in the pulse state of the read or write
controlling signal. The assertion of the NWAIT signal outside the expected period has no impact
on SMC behavior.
Figure 23-26. Write Access with NWAIT Assertion in Frozen Mode (EXNW_MODE = 10)
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0,A1 FROZEN STATE
4 3 2 1 1 1 1 0
NWE
6 5 4 3 2 2 2 2 1 0
NCS
D[31:0]
NWAIT
internally synchronized
NWAIT signal
Write cycle
EXNW_MODE = 10 (Frozen)
WRITE_MODE = 1 (NWE_controlled)
NWE_PULSE = 5
NCS_WR_PULSE = 7
221
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Figure 23-27. Read Access with NWAIT Assertion in Frozen Mode (EXNW_MODE = 10)
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0,A1
FROZEN STATE
4 3 2 2 2 1 0
NCS 2 1 0
1 0
NRD 5 5 5 4 3 2 1 0
NWAIT
internally synchronized
NWAIT signal
Read cycle
EXNW_MODE = 10 (Frozen)
READ_MODE = 0 (NCS_controlled)
Assertion is ignored
NRD_PULSE = 2, NRD_HOLD = 6
NCS_RD_PULSE =5, NCS_RD_HOLD =3
222
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Figure 23-28. NWAIT Assertion in Write Access: Ready Mode (EXNW_MODE = 11)
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0,A1
Wait STATE
4 3 2 1 0 0 0
NWE
6 5 4 3 2 1 1 1 0
NCS
D[31:0]
NWAIT
internally synchronized
NWAIT signal
Write cycle
NWE_PULSE = 5
NCS_WR_PULSE = 7
223
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Figure 23-29. NWAIT Assertion in Read Access: Ready Mode (EXNW_MODE = 11)
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0,A1
Wait STATE
6 5 4 3 2 1 0 0
NCS
6 5 4 3 2 1 1 0
NRD
NWAIT
internally synchronized
NWAIT signal
Read cycle
EXNW_MODE = 11(Ready mode)
READ_MODE = 0 (NCS_controlled)
Assertion is ignored Assertion is ignored
NRD_PULSE = 7
NCS_RD_PULSE =7
224
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0,A1 WAIT STATE
4 3 2 1 0 0 0
NRD
minimal pulse length
NWAIT
Read cycle
EXNW_MODE = 10 or 11
READ_MODE = 1 (NRD_controlled)
NRD_PULSE = 5
225
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
MCK MCK
A[25:2] A[25:2]
NRD
NWE 1 1 1
1 1
NCS
NCS
NWE_CYCLE = 3 NRD_CYCLE = 2
Table 23-5. Read and Write Timing Parameters in Slow Clock Mode
Read Parameters Duration (cycles) Write Parameters Duration (cycles)
NRD_SETUP 1 NWE_SETUP 1
NRD_PULSE 1 NWE_PULSE 1
NCS_RD_SETUP 0 NCS_WR_SETUP 0
NCS_RD_PULSE 2 NCS_WR_PULSE 3
NRD_CYCLE 2 NWE_CYCLE 3
226
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23.12.2 Switching from (to) Slow Clock Mode to (from) Normal Mode
When switching from slow clock mode to the normal mode, the current slow clock mode transfer
is completed at high clock rate, with the set of slow clock mode parameters.See Figure 23-32 on
page 227. The external device may not be fast enough to support such timings.
Figure 23-33 illustrates the recommended procedure to properly switch from one mode to the
other.
Figure 23-32. Clock Rate Transition Occurs while the SMC is Performing a Write Operation
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0,A1
NWE
1 1 1 1 1 1 2 3 2
NCS
NWE_CYCLE = 3 NWE_CYCLE = 7
SLOW CLOCK MODE WRITE SLOW CLOCK MODE WRITE NORMAL MODE WRITE
This write cycle finishes with the slow clock mode set Slow clock mode transition is detected:
of parameters after the clock rate transition Reload Configuration Wait State
227
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Figure 23-33. Recommended Procedure to Switch from Slow Clock Mode to Normal Mode or from Normal Mode to Slow
Clock Mode
Slow Clock Mode
internal signal from PMC
MCK
A[25:2]
NBS0, NBS1,
NBS2, NBS3,
A0,A1
NWE
1 1 1 2 3 2
NCS
Reload Configuration
Wait State
228
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Figure 23-34. Page Mode Read Protocol (Address MSB and LSB are defined in Table 23-6)
MCK
A[MSB]
A[LSB]
NRD
D[31:0]
The NRD and NCS signals are held low during all read transfers, whatever the programmed val-
ues of the setup and hold timings in the User Interface may be. Moreover, the NRD and NCS
229
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
timings are identical. The pulse length of the first access to the page is defined with the
NCS_RD_PULSE field of the SMC_PULSE register. The pulse length of subsequent accesses
within the page are defined using the NRD_PULSE parameter.
In page mode, the programming of the read timings is described in Table 23-7:
The SMC does not check the coherency of timings. It will always apply the NCS_RD_PULSE
timings as page access timing (tpa) and the NRD_PULSE for accesses to the page (tsa), even if
the programmed value for tpa is shorter than the programmed value for tsa.
230
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
MCK
A[2], A1, A0 A1 A3 A7
NRD
NCS
D[7:0] D1 D3 D7
231
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
232
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
31 30 29 28 27 26 25 24
– – NCS_RD_SETUP
23 22 21 20 19 18 17 16
– – NRD_SETUP
15 14 13 12 11 10 9 8
– – NCS_WR_SETUP
7 6 5 4 3 2 1 0
– – NWE_SETUP
233
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
31 30 29 28 27 26 25 24
– NCS_RD_PULSE
23 22 21 20 19 18 17 16
– NRD_PULSE
15 14 13 12 11 10 9 8
– NCS_WR_PULSE
7 6 5 4 3 2 1 0
– NWE_PULSE
234
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
31 30 29 28 27 26 25 24
– – – – – – – NRD_CYCLE
23 22 21 20 19 18 17 16
NRD_CYCLE
15 14 13 12 11 10 9 8
– – – – – – – NWE_CYCLE
7 6 5 4 3 2 1 0
NWE_CYCLE
235
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – TDF_MODE TDF_CYCLES
15 14 13 12 11 10 9 8
– – DBW – – – BAT
7 6 5 4 3 2 1 0
– – EXNW_MODE – – WRITE_MODE READ_MODE
• READ_MODE:
1: The read operation is controlled by the NRD signal.
– If TDF cycles are programmed, the external bus is marked busy after the rising edge of NRD.
– If TDF optimization is enabled (TDF_MODE =1), TDF wait states are inserted after the setup of NRD.
0: The read operation is controlled by the NCS signal.
– If TDF cycles are programmed, the external bus is marked busy after the rising edge of NCS.
– If TDF optimization is enabled (TDF_MODE =1), TDF wait states are inserted after the setup of NCS.
• WRITE_MODE
1: The write operation is controlled by the NWE signal.
– If TDF optimization is enabled (TDF_MODE =1), TDF wait states will be inserted after the setup of NWE.
0: The write operation is controlled by the NCS signal.
– If TDF optimization is enabled (TDF_MODE =1), TDF wait states will be inserted after the setup of NCS.
• Disabled Mode: The NWAIT input signal is ignored on the corresponding Chip Select.
• Frozen Mode: If asserted, the NWAIT signal freezes the current read or write cycle. After deassertion, the read/write
cycle is resumed from the point where it was stopped.
236
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
• Ready Mode: The NWAIT signal indicates the availability of the external device at the end of the pulse of the controlling
read or write signal, to complete the access. If high, the access normally completes. If low, the access is extended until
NWAIT returns high.
PS Page Size
0 0 4-byte page
0 1 8-byte page
1 0 16-byte page
1 1 32-byte page
237
6254C–ATARM–22-Jan-10
238 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
24.1 Description
The SDRAM Controller (SDRAMC) extends the memory capabilities of a chip by providing the
interface to an external 16-bit or 32-bit SDRAM device. The page size supports ranges from
2048 to 8192 and the number of columns from 256 to 2048. It supports byte (8-bit), half-word
(16-bit) and word (32-bit) accesses.
The SDRAM Controller supports a read or write burst length of one location. It keeps track of the
active row in each bank, thus maximizing SDRAM performance, e.g., the application may be
placed in one bank and data in the other banks. So as to optimize performance, it is advisable to
avoid accessing different rows in the same bank.
The SDRAM controller supports a CAS latency of 1, 2 or 3 and optimizes the read access
depending on the frequency.
The different modes available - self-refresh, power-down and deep power-down modes - mini-
mize power consumption on the SDRAM device.
239
6254C–ATARM–22-Jan-10
24.3 Application Example
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
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
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
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
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
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
241
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
242
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
SDCK
SDRAMC_A[9:0]
A10
SDRAMC_A[12:11]
SDCS
RAS
CAS
SDWE
NBS
Inputs Stable for Precharge All Banks 1st Auto-refresh 8th Auto-refresh MRS Command Valid Command
200 μsec
24.4.3 Interrupt
The SDRAM Controller interrupt (Refresh Error notification) is connected to the Memory Control-
ler. This interrupt may be ORed with other System Peripheral interrupt lines and is finally
provided as the System Interrupt Source (Source 1) to the AIC (Advanced Interrupt Controller).
Using the SDRAM Controller interrupt requires the AIC to be programmed first.
243
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
SDCS
SDCK
SDRAMC_A[12:0] Row n col a col b col c col d col e col f col g col h col i col j col k col l
RAS
CAS
SDWE
D[31:0] Dna Dnb Dnc Dnd Dne Dnf Dng Dnh Dni Dnj Dnk Dnl
244
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
For a single access or an incremented burst of unspecified length, the SDRAM Controller antici-
pates the next access. While the last value of the column is returned by the SDRAM Controller
on the bus, the SDRAM Controller anticipates the read to the next column and thus anticipates
the CAS latency. This reduces the effect of the CAS latency on the internal bus.
For burst access of specified length (4, 8, 16 words), access is not anticipated. This case leads
to the best performance. If the burst is broken (border, busy mode, etc.), the next access is han-
dled as an incrementing burst of unspecified length.
tRCD = 3 CAS = 2
SDCS
SDCK
RAS
CAS
SDWE
245
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
SDCS
SDCK
Row n
SDRAMC_A[12:0] col a col b col c col d Row m col a col b col c col d col e
RAS
CAS
SDWE
D[31:0] Dna Dnb Dnc Dnd Dma Dmb Dmc Dmd Dme
246
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
SDCS
SDCK
Row n
SDRAMC_A[12:0] col c col d Row m col a
RAS
CAS
SDWE
D[31:0] Dma
Dnb Dnc Dnd
(input)
247
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
SDRAMC_A[12:0] Row
SDCK
SDCKE
SDCS
RAS
CAS
SDWE
Access Request
to the SDRAM Controller
248
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
SDCS
SDCK
RAS
CAS
SDCKE
D[31:0]
Dna Dnb Dnc Dnd Dne Dnf
(input)
249
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
tRP = 3
SDCS
SDCK
Row n
SDRAMC_A[12:0] col c col d
RAS
CAS
SDWE
CKE
D[31:0]
Dnb Dnc Dnd
(input)
250
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
251
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – MODE
MODE Description
Normal mode. Any access to the SDRAM is decoded normally. To activate this mode, command must be
0 0 0
followed by a write to the SDRAM.
The SDRAM Controller issues a NOP command when the SDRAM device is accessed regardless of the
0 0 1
cycle. To activate this mode, command must be followed by a write to the SDRAM.
The SDRAM Controller issues an “All Banks Precharge” command when the SDRAM device is accessed
0 1 0
regardless of the cycle. To activate this mode, command must be followed by a write to the SDRAM.
The SDRAM Controller issues a “Load Mode Register” command when the SDRAM device is accessed
0 1 1
regardless of the cycle. To activate this mode, command must be followed by a write to the SDRAM.
The SDRAM Controller issues an “Auto-Refresh” Command when the SDRAM device is accessed
1 0 0 regardless of the cycle. Previously, an “All Banks Precharge” command must be issued. To activate this
mode, command must be followed by a write to the SDRAM.
The SDRAM Controller issues an “Extended Load Mode Register” command when the SDRAM device is
accessed regardless of the cycle. To activate this mode, the “Extended Load Mode Register” command
1 0 1
must be followed by a write to the SDRAM. The write in the SDRAM must be done in the appropriate bank;
most low-power SDRAM devices use the bank 1.
1 1 0 Deep power-down mode. Enters deep power-down mode.
252
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – COUNT
7 6 5 4 3 2 1 0
COUNT
253
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
TRCD TRP
15 14 13 12 11 10 9 8
TRC TWR
7 6 5 4 3 2 1 0
DBW CAS NB NR NC
NC Column Bits
0 0 8
0 1 9
1 0 10
1 1 11
NR Row Bits
0 0 11
0 1 12
1 0 13
1 1 Reserved
NB Number of Banks
0 2
1 4
254
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
255
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – TIMEOUT DS TCSR
7 6 5 4 3 2 1 0
– PASR – – LPCB
Low Power Feature is inhibited: no Power-down, Self-refresh or Deep Power-down command is issued to
00
the SDRAM device.
The SDRAM Controller issues a Self-refresh command to the SDRAM device, the SDCLK clock is
01 deactivated and the SDCKE signal is set low. The SDRAM device leaves the Self Refresh Mode when
accessed and enters it after the access.
The SDRAM Controller issues a Power-down Command to the SDRAM device after each access, the
10 SDCKE signal is set to low. The SDRAM device leaves the Power-down Mode when accessed and
enters it after the access.
The SDRAM Controller issues a Deep Power-down command to the SDRAM device. This mode is
11
unique to low-power SDRAM.
256
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
00 The SDRAM controller activates the SDRAM low-power mode immediately after the end of the last transfer.
The SDRAM controller activates the SDRAM low-power mode 64 clock cycles after the end of the last
01
transfer.
The SDRAM controller activates the SDRAM low-power mode 128 clock cycles after the end of the last
10
transfer.
11 Reserved.
257
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – RES
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – RES
258
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – RES
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – RES
259
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – MD
00 SDRAM
01 Low-power SDRAM
10 Reserved
11 Reserved.
260
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
25.1 Description
NAND Flash/SmartMedia devices contain by default invalid blocks which have one or more
invalid bits. Over the NAND Flash/SmartMedia lifetime, additional invalid blocks may occur
which can be detected/corrected by ECC code.
The ECC Controller is a mechanism that encodes data in a manner that makes possible the
identification and correction of certain errors in data. The ECC controller is capable of single bit
error correction and 2-bit random detection. When NAND Flash/SmartMedia have more than 2
bits of errors, the data cannot be corrected.
The ECC user interface is compliant with the ARM® Advanced Peripheral Bus (APB rev2).
NAND Flash
Static
Memory
SmartMedia
Controller
Logic
ECC
Controller
Ctrl/ECC Algorithm
User Interface
APB
261
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
mend to utilize either 1 ECC per 256 bytes of data, 1 ECC per 512 bytes of data or 1 ECC for all
of the page.
The only configurations required for ECC are the NAND Flash or the SmartMedia page size
(528/2112/4224) and the type of correction wanted (1 ECC for all the page/1 ECC per 256 bytes
of data /1 ECC per 512 bytes of data). Page size is configured setting the PAGESIZE field in the
ECC Mode Register (ECC_MR). Type of correction is configured setting the TYPCORRECT
field in the ECC Mode Register (ECC_MR).
ECC is automatically computed as soon as a read (00h)/write (80h) command to the NAND
Flash or the SmartMedia is detected. Read and write access must start at a page boundary.
ECC results are available as soon as the counter reaches the end of the main area. Values in
the ECC Parity Registers (ECC_PR0 to ECC_PR15) are then valid and locked until a new start
condition occurs (read/write command followed by address cycles).
262
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
ECC Status Registers, ECC Parity Registers are cleared when a read/write command is
detected or a software reset is performed.
For Single-bit Error Correction and Double-bit Error Detection (SEC-DED) hsiao code is used.
24-bit ECC is generated in order to perform one bit correction per 256 or 512 bytes for pages of
512/2048/4096 8-bit words. 32-bit ECC is generated in order to perform one bit correction per
512/1024/2048/4096 8- or 16-bit words.They are generated according to the schemes shown in
Figure 25-2 and Figure 25-3.
(page size -3 )th byte Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 P8
P16
(page size -2 )th byte Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 P8' PX'
P32
(page size -1 )th byte Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 P8
P16'
Page size th byte Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 P8'
P2 P2' P2 P2'
P4 P4'
for i =0 to n
begin
for (j = 0 to page_size_byte)
begin
if(j[i] ==1)
P[2i+3]=bit7(+)bit6(+)bit5(+)bit4(+)bit3(+)
bit2(+)bit1(+)bit0(+)P[2i+3]
else
P[2i+3]’=bit7(+)bit6(+)bit5(+)bit4(+)bit3(+)
bit2(+)bit1(+)bit0(+)P[2i+3]'
end
end
263
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
(+)
(Page size -3 )th word
(Page size -2 )th word
(Page size -1 )th word
Page size th word
1st word
2nd word
3rd word
4th word
264
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
To calculate P8’ to PX’ and P8 to PX, apply the algorithm that follows.
Page size = 2n
for i =0 to n
begin
for (j = 0 to page_size_word)
begin
if(j[i] ==1)
P[2i+3]= bit15(+)bit14(+)bit13(+)bit12(+)
bit11(+)bit10(+)bit9(+)bit8(+)
bit7(+)bit6(+)bit5(+)bit4(+)bit3(+)
bit2(+)bit1(+)bit0(+)P[2n+3]
else
P[2i+3]’=bit15(+)bit14(+)bit13(+)bit12(+)
bit11(+)bit10(+)bit9(+)bit8(+)
bit7(+)bit6(+)bit5(+)bit4(+)bit3(+)
bit2(+)bit1(+)bit0(+)P[2i+3]'
end
end
265
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
266
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
267
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
A word has a value of 8 bits or 16 bits, depending on the NAND Flash or SmartMedia memory organization.
268
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
• RECERR1: Recoverable Error in the page between the 256th and the 511th bytes or the 512th and the 1023rd
bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = Errors Detected. If MUL_ERROR is 0, a single correctable error was detected. Otherwise multiple uncorrected errors
were detected.
• ECCERR1: ECC Error in the page between the 256th and the 511th bytes or the 512th and the 1023rd bytes
Fixed to 0 if TYPECORREC = 0
0 = No Errors Detected.
1 = A single bit error occurred in the ECC bytes.
Read ECC Parity 1 register, the error occurred at the location which contains a 1 in the least significant 24 bits.
• MULERR1: Multiple Error in the page between the 256th and the 511th bytes or the 512th and the 1023rd bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Multiple Errors Detected.
1 = Multiple Errors Detected.
269
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
• RECERR2: Recoverable Error in the page between the 512th and the 767th bytes or the 1024th and the 1535th
bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = Errors Detected. If MUL_ERROR is 0, a single correctable error was detected. Otherwise, multiple uncorrected errors
were detected.
• ECCERR2: ECC Error in the page between the 512th and the 767th bytes or the 1024th and the 1535th bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = A single bit error occurred in the ECC bytes.
Read ECC Parity 2 register, the error occurred at the location which contains a 1 in the least significant 24 bits.
• MULERR2: Multiple Error in the page between the 512th and the 767th bytes or the 1024th and the 1535th bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Multiple Errors Detected.
1 = Multiple Errors Detected.
• RECERR3: Recoverable Error in the page between the 768th and the 1023rd bytes or the 1536th and the 2047th
bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = Errors Detected. If MUL_ERROR is 0, a single correctable error was detected. Otherwise multiple uncorrected errors
were detected.
• ECCERR3: ECC Error in the page between the 768th and the 1023rd bytes or the 1536th and the 2047th bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = A single bit error occurred in the ECC bytes.
Read ECC Parity 3 register, the error occurred at the location which contains a 1 in the least significant 24 bits.
• MULERR3: Multiple Error in the page between the 768th and the 1023rd bytes or the 1536th and the 2047th bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Multiple Errors Detected.
1 = Multiple Errors Detected.
• RECERR4: Recoverable Error in the page between the 1024th and the 1279th bytes or the 2048th and the 2559th
bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = Errors Detected. If MUL_ERROR is 0, a single correctable error was detected. Otherwise multiple uncorrected errors
were detected.
• ECCERR4: ECC Error in the page between the 1024th and the 1279th bytes or the 2048th and the 2559th bytes
Fixed to 0 if TYPECORREC = 0.
270
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
0 = No Errors Detected.
1 = A single bit error occurred in the ECC bytes.
Read ECC Parity 4 register, the error occurred at the location which contains a 1 in the least significant 24 bits.
• MULERR4: Multiple Error in the page between the 1024th and the 1279th bytes or the 2048th and the 2559th
bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Multiple Errors Detected.
1 = Multiple Errors Detected.
• RECERR5: Recoverable Error in the page between the 1280th and the 1535th bytes or the 2560th and the 3071st
bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = Errors Detected. If MUL_ERROR is 0, a single correctable error was detected. Otherwise multiple uncorrected errors
were detected
• ECCERR5: ECC Error in the page between the 1280th and the 1535th bytes or the 2560th and the 3071st bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = A single bit error occurred in the ECC bytes.
Read ECC Parity 5 register, the error occurred at the location which contains a 1 in the least significant 24 bits.
• MULERR5: Multiple Error in the page between the 1280th and the 1535th bytes or the 2560th and the 3071st
bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Multiple Errors Detected.
1 = Multiple Errors Detected.
• RECERR6: Recoverable Error in the page between the 1536th and the 1791st bytes or the 3072nd and the 3583rd
bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = Errors Detected. If MUL_ERROR is 0, a single correctable error was detected. Otherwise multiple uncorrected errors
were detected.
• ECCERR6: ECC Error in the page between the 1536th and the 1791st bytes or the 3072nd and the 3583rd bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = A single bit error occurred in the ECC bytes.
Read ECC Parity 6 register, the error occurred at the location which contains a 1 in the least significant 24 bits.
271
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
• MULERR6: Multiple Error in the page between the 1536th and the 1791st bytes or the 3072nd and the 3583rd
bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Multiple Errors Detected.
1 = Multiple Errors Detected.
• RECERR7: Recoverable Error in the page between the 1792nd and the 2047th bytes or the 3584th and the 4095th
bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = Errors Detected. If MUL_ERROR is 0, a single correctable error was detected. Otherwise, multiple uncorrected errors
were detected.
• ECCERR7: ECC Error in the page between the 1792nd and the 2047th bytes or the 3584th and the 4095th bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = A single bit error occurred in the ECC bytes.
Read ECC Parity 7 register, the error occurred at the location which contains a 1 in the least significant 24 bits.
• MULERR7: Multiple Error in the page between the 1792nd and the 2047th bytes or the 3584th and the 4095th
bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Multiple Errors Detected.
1 = Multiple Errors Detected.
272
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
• RECERR8: Recoverable Error in the page between the 2048th and the 2303rd bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = Errors Detected. If MUL_ERROR is 0, a single correctable error was detected. Otherwise multiple uncorrected errors
were detected
• ECCERR8: ECC Error in the page between the 2048th and the 2303rd bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = A single bit error occurred in the ECC bytes.
Read ECC Parity 8 register, the error occurred at the location which contains a 1 in the least significant 24 bits.
• MULERR8: Multiple Error in the page between the 2048th and the 2303rd bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Multiple Errors Detected.
1 = Multiple Errors Detected.
• RECERR9: Recoverable Error in the page between the 2304th and the 2559th bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = Errors Detected. If MUL_ERROR is 0, a single correctable error was detected. Otherwise multiple uncorrected errors
were detected.
• ECCERR9: ECC Error in the page between the 2304th and the 2559th bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = A single bit error occurred in the ECC bytes.
Read ECC Parity 9 register, the error occurred at the location which contains a 1 in the least significant 24 bits.
273
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
• MULERR9: Multiple Error in the page between the 2304th and the 2559th bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Multiple Errors Detected.
1 = Multiple Errors Detected.
• RECERR10: Recoverable Error in the page between the 2560th and the 2815th bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = Errors Detected. If MUL_ERROR is 0, a single correctable error was detected. Otherwise, multiple uncorrected errors
were detected.
• ECCERR10: ECC Error in the page between the 2560th and the 2815th bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = A single bit error occurred in the ECC bytes.
Read ECC Parity 10 register, the error occurred at the location which contains a 1 in the least significant 24 bits.
• MULERR10: Multiple Error in the page between the 2560th and the 2815th bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Multiple Errors Detected.
1 = Multiple Errors Detected.
• RECERR11: Recoverable Error in the page between the 2816th and the 3071st bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = Errors Detected.. If MUL_ERROR is 0, a single correctable error was detected. Otherwise, multiple uncorrected errors
were detected.
• ECCERR11: ECC Error in the page between the 2816th and the 3071st bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = A single bit error occurred in the ECC bytes.
Read ECC Parity 11 register, the error occurred at the location which contains a 1 in the least significant 24 bits.
• MULERR11: Multiple Error in the page between the 2816th and the 3071st bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Multiple Errors Detected.
1 = Multiple Errors Detected.
• RECERR12: Recoverable Error in the page between the 3072nd and the 3327th bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
274
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
1 = Errors Detected. If MUL_ERROR is 0, a single correctable error was detected. Otherwise multiple uncorrected errors
were detected.
• ECCERR12: ECC Error in the page between the 3072nd and the 3327th bytes
Fixed to 0 if TYPECORREC = 0
0 = No Errors Detected
1 = A single bit error occurred in the ECC bytes.
Read ECC Parity 12 register, the error occurred at the location which contains a 1 in the least significant 24 bits.
• MULERR12: Multiple Error in the page between the 3072nd and the 3327th bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Multiple Errors Detected.
1 = Multiple Errors Detected.
• RECERR13: Recoverable Error in the page between the 3328th and the 3583rd bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = Errors Detected. If MUL_ERROR is 0, a single correctable error was detected. Otherwise multiple uncorrected errors
were detected.
• ECCERR13: ECC Error in the page between the 3328th and the 3583rd bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = A single bit error occurred in the ECC bytes.
Read ECC Parity 13 register, the error occurred at the location which contains a 1 in the least significant 24 bits.
• MULERR13: Multiple Error in the page between the 3328th and the 3583rd bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Multiple Errors Detected.
1 = Multiple Errors Detected.
• RECERR14: Recoverable Error in the page between the 3584th and the 3839th bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = Errors Detected. If MUL_ERROR is 0, a single correctable error was detected. Otherwise, multiple uncorrected errors
were detected.
• ECCERR14: ECC Error in the page between the 3584th and the 3839th bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = A single bit error occurred in the ECC bytes.
Read ECC Parity 14 register, the error occurred at the location which contains a 1 in the least significant 24 bits.
275
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
• MULERR14: Multiple Error in the page between the 3584th and the 3839th bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Multiple Errors Detected.
1 = Multiple Errors Detected.
• RECERR15: Recoverable Error in the page between the 3840th and the 4095th bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Errors Detected.
1 = Errors Detected. If MUL_ERROR is 0, a single correctable error was detected. Otherwise, multiple uncorrected errors
were detected
• ECCERR15: ECC Error in the page between the 3840th and the 4095th bytes
Fixed to 0 if TYPECORREC = 0
0 = No Errors Detected.
1 = A single bit error occurred in the ECC bytes.
Read ECC Parity 15 register, the error occurred at the location which contains a 1 in the least significant 24 bits.
• MULERR15: Multiple Error in the page between the 3840th and the 4095th bytes
Fixed to 0 if TYPECORREC = 0.
0 = No Multiple Errors Detected.
1 = Multiple Errors Detected.
276
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
277
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
• NPARITY:
Parity N
278
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
25.6 Registers for 1 ECC per 512 bytes for a page of 512/2048/4096 bytes, 8-bit word
23 22 21 20 19 18 17 16
NPARITY0
15 14 13 12 11 10 9 8
NPARITY0 WORDADD0
7 6 5 4 3 2 1 0
WORDADDR0 BITADDR0
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR0: corrupted Bit Address in the page between the first byte and the 511th bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR0: corrupted Word Address in the page between the first byte and the 511th bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY0:
Parity N
279
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
NPARITY1
15 14 13 12 11 10 9 8
NPARITY1 WORDADD1
7 6 5 4 3 2 1 0
WORDADDR1 BITADDR1
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR1: corrupted Bit Address in the page between the 512th and the 1023rd bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR1: corrupted Word Address in the page between the 512th and the 1023rd bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY1:
Parity N
280
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
NPARITY2
15 14 13 12 11 10 9 8
NPARITY2 WORDADD2
7 6 5 4 3 2 1 0
WORDADDR2 BITADDR2
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR2: corrupted Bit Address in the page between the 1023rd and the 1535th bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR2: corrupted Word Address in the page in the page between the 1023rd and the 1535th bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY2:
Parity N
281
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
NPARITY3
15 14 13 12 11 10 9 8
NPARITY3 WORDADD3
7 6 5 4 3 2 1 0
WORDADDR3 BITADDR3
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR3: corrupted Bit Address in the page between the1536th and the 2047th bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR3 corrupted Word Address in the page between the 1536th and the 2047th bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY3
Parity N
282
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
NPARITY4
15 14 13 12 11 10 9 8
NPARITY4 WORDADD4
7 6 5 4 3 2 1 0
WORDADDR4 BITADDR4
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR4: corrupted Bit Address in the page between the 2048th and the 2559th bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR4: corrupted Word Address in the page between the 2048th and the 2559th bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY4:
Parity N
283
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
NPARITY5
15 14 13 12 11 10 9 8
NPARITY5 WORDADD5
7 6 5 4 3 2 1 0
WORDADDR5 BITADDR5
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR5: corrupted Bit Address in the page between the 2560th and the 3071st bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR5: corrupted Word Address in the page between the 2560th and the 3071st bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY5:
Parity N
284
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
NPARITY6
15 14 13 12 11 10 9 8
NPARITY6 WORDADD6
7 6 5 4 3 2 1 0
WORDADDR6 BITADDR6
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR6: corrupted Bit Address in the page between the 3072nd and the 3583rd bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR6: corrupted Word Address in the page between the 3072nd and the 3583rd bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY6:
Parity N
285
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
NPARITY7
15 14 13 12 11 10 9 8
NPARITY7 WORDADD7
7 6 5 4 3 2 1 0
WORDADDR7 BITADDR7
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR7: corrupted Bit Address in the page between the 3584h and the 4095th bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR7: corrupted Word Address in the page between the 3584th and the 4095th bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY7:
Parity N
286
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
25.7 Registers for 1 ECC per 256 bytes for a page of 512/2048/4096 bytes, 8-bit word
23 22 21 20 19 18 17 16
0 NPARITY0
15 14 13 12 11 10 9 8
NPARITY0 0 WORDADD0
7 6 5 4 3 2 1 0
WORDADDR0 BITADDR0
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR0: corrupted Bit Address in the page between the first byte and the 255th bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR0: corrupted Word Address in the page between the first byte and the 255th bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY0:
Parity N
287
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
0 NPARITY1
15 14 13 12 11 10 9 8
NPARITY1 0 WORDADD1
7 6 5 4 3 2 1 0
WORDADDR1 BITADDR1
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area
• BITADDR1: corrupted Bit Address in the page between the 256th and the 511th bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR1: corrupted Word Address in the page between the 256th and the 511th bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY1:
Parity N
288
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
0 NPARITY2
15 14 13 12 11 10 9 8
NPARITY2 0 WORDADD2
7 6 5 4 3 2 1 0
WORDADDR2 BITADDR2
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR2: corrupted Bit Address in the page between the 512th and the 767th bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR2: corrupted Word Address in the page between the 512th and the 767th bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY2:
Parity N
289
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
0 NPARITY3
15 14 13 12 11 10 9 8
NPARITY3 0 WORDADD3
7 6 5 4 3 2 1 0
WORDADDR3 BITADDR3
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR3: corrupted Bit Address in the page between the 768th and the 1023rd bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR3: corrupted Word Address in the page between the 768th and the 1023rd bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless
• NPARITY3:
Parity N
290
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
0 NPARITY4
15 14 13 12 11 10 9 8
NPARITY4 0 WORDADD4
7 6 5 4 3 2 1 0
WORDADDR4 BITADDR4
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area
• BITADDR4: corrupted bit address in the page between the 1024th and the 1279th bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR4: corrupted word address in the page between the 1024th and the 1279th bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY4
Parity N
291
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
0 NPARITY5
15 14 13 12 11 10 9 8
NPARITY5 0 WORDADD5
7 6 5 4 3 2 1 0
WORDADDR5 BITADDR5
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR5: corrupted Bit Address in the page between the 1280th and the 1535th bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR5: corrupted Word Address in the page between the 1280th and the 1535th bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY5:
Parity N
292
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
0 NPARITY6
15 14 13 12 11 10 9 8
NPARITY6 0 WORDADDR6
7 6 5 4 3 2 1 0
WORDADDR6 BITADDR6
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR6: corrupted bit address in the page between the 1536th and the1791st bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR6: corrupted word address in the page between the 1536th and the1791st bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY6:
Parity N
293
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
0 NPARITY7
15 14 13 12 11 10 9 8
NPARITY7 0 WORDADDR7
7 6 5 4 3 2 1 0
WORDADDR7 BITADDR7
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR7: corrupted Bit Address in the page between the 1792nd and the 2047th bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR7: corrupted Word Address in the page between the 1792nd and the 2047th bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY7:
Parity N
294
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
0 NPARITY8
15 14 13 12 11 10 9 8
NPARITY8 0 WORDADDR8
7 6 5 4 3 2 1 0
WORDADDR8 BITADDR8
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR8: corrupted Bit Address in the page between the 2048th and the2303rd bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR8: corrupted Word Address in the page between the 2048th and the 2303rd bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY8:
Parity N.
295
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
0 NPARITY9
15 14 13 12 11 10 9 8
NPARITY9 0 WORDADDR9
7 6 5 4 3 2 1 0
WORDADDR9 BITADDR9
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area
• BITADDR9: corrupted bit address in the page between the 2304th and the 2559th bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR9: corrupted word address in the page between the 2304th and the 2559th bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless
• NPARITY9
Parity N
296
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
0 NPARITY10
15 14 13 12 11 10 9 8
NPARITY10 0 WORDADDR10
7 6 5 4 3 2 1 0
WORDADDR10 BITADDR10
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR10: corrupted Bit Address in the page between the 2560th and the2815th bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR10: corrupted Word Address in the page between the 2560th and the 2815th bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY10:
Parity N
297
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
0 NPARITY11
15 14 13 12 11 10 9 8
NPARITY11 0 WORDADDR11
7 6 5 4 3 2 1 0
WORDADDR11 BITADDR11
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR11: corrupted Bit Address in the page between the 2816th and the 3071st bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR11: corrupted Word Address in the page between the 2816th and the 3071st bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY11:
Parity N
298
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
0 NPARITY12
15 14 13 12 11 10 9 8
NPARITY12 0 WORDADDR12
7 6 5 4 3 2 1 0
WORDADDR12 BITADDR12
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR12; corrupted Bit Address in the page between the 3072nd and the 3327th bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR12: corrupted Word Address in the page between the 3072nd and the 3327th bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY12:
Parity N
299
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
0 NPARITY13
15 14 13 12 11 10 9 8
NPARITY13 0 WORDADDR13
7 6 5 4 3 2 1 0
WORDADDR13 BITADDR13
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR13: corrupted Bit Address in the page between the 3328th and the 3583rd bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR13: corrupted Word Address in the page between the 3328th and the 3583rd bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY13:
Parity N
300
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
0 NPARITY14
15 14 13 12 11 10 9 8
NPARITY14 0 WORDADDR14
7 6 5 4 3 2 1 0
WORDADDR14 BITADDR14
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area.
• BITADDR14: corrupted Bit Address in the page between the 3584th and the 3839th bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR14: corrupted Word Address in the page between the 3584th and the 3839th bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY14:
Parity N
301
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
0 NPARITY15
15 14 13 12 11 10 9 8
NPARITY15 0 WORDADDR15
7 6 5 4 3 2 1 0
WORDADDR15 BITADDR15
Once the entire main area of a page is written with data, the register content must be stored at any free location of the
spare area
• BITADDR15: corrupted Bit Address in the page between the 3840th and the 4095th bytes
During a page read, this value contains the corrupted bit offset where an error occurred, if a single error was detected. If
multiple errors were detected, this value is meaningless.
• WORDADDR15: corrupted Word Address in the page between the 3840th and the 4095th bytes
During a page read, this value contains the word address (8-bit word) where an error occurred, if a single error was
detected. If multiple errors were detected, this value is meaningless.
• NPARITY15
Parity N
302
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
26.1 Description
The Peripheral DMA Controller (PDC) transfers data between on-chip serial peripherals and the
on- and/or off-chip memories. The link between the PDC and a serial peripheral is operated by
the AHB to ABP bridge.
The PDC contains 22 channels. The full-duplex peripherals feature 21 mono directional chan-
nels used in pairs (transmit only or receive only). The half-duplex peripherals feature 1 bi-
directional channels.
The user interface of each PDC channel is integrated into the user interface of the peripheral it
serves. The user interface of mono directional channels (receive only or transmit only), contains
two 32-bit memory pointers and two 16-bit counters, one set (pointer, counter) for current trans-
fer and one set (pointer, counter) for next transfer. The bi-directional channel user interface
contains four 32-bit memory pointers and four 16-bit counters. Each set (pointer, counter) is
used by current transmit, next transmit, current receive and next receive.
Using the PDC removes processor overhead by reducing its intervention during the transfer.
This significantly reduces the number of clock cycles required for a data transfer, which
improves microcontroller performance.
To launch a transfer, the peripheral triggers its associated PDC channels by using transmit and
receive signals. When the programmed data is transferred, an end of transfer interrupt is gener-
ated by the peripheral itself.
303
6254C–ATARM–22-Jan-10
26.2 Block Diagram
HALF DUPLEX
PERIPHERAL Control
THR
PDC Channel C
RHR
RECEIVE or TRANSMIT
PERIPHERAL
26.3.1 Configuration
The PDC channel user interface enables the user to configure and control data transfers for
each channel. The user interface of each PDC channel is integrated into the associated periph-
eral user interface.
The user interface of a serial peripheral, whether it is full or half duplex, contains four 32-bit
pointers (RPR, RNPR, TPR, TNPR) and four 16-bit counter registers (RCR, RNCR, TCR,
TNCR). However, the transmit and receive parts of each type are programmed differently: the
transmit and receive parts of a full duplex peripheral can be programmed at the same time,
whereas only one part (transmit or receive) of a half duplex peripheral can be programmed at a
time.
32-bit pointers define the access location in memory for current and next transfer, whether it is
for read (transmit) or write (receive). 16-bit counters define the size of current and next transfers.
It is possible, at any moment, to read the number of transfers left for each channel.
The PDC has dedicated status registers which indicate if the transfer is enabled or disabled for
each channel. The status for each channel is located in the associated peripheral status register.
Transfers can be enabled and/or disabled by setting TXTEN/TXTDIS and RXTEN/RXTDIS in
the peripheral’s Transfer Control Register.
At the end of a transfer, the PDC channel sends status flags to its associated peripheral. These
flags are visible in the peripheral status register (ENDRX, ENDTX, RXBUFF, and TXBUFE).
Refer to Section 26.3.3 and to the associated peripheral user interface.
305
6254C–ATARM–22-Jan-10
26.3.4 Data Transfers
The serial peripheral triggers its associated PDC channels’ transfers using transmit enable
(TXEN) and receive enable (RXEN) flags in the transfer control register integrated in the periph-
eral’s user interface.
When the peripheral receives an external data, it sends a Receive Ready signal to its PDC
receive channel which then requests access to the Matrix. When access is granted, the PDC
receive channel starts reading the peripheral Receive Holding Register (RHR). The read data
are stored in an internal buffer and then written to memory.
When the peripheral is about to send data, it sends a Transmit Ready to its PDC transmit chan-
nel which then requests access to the Matrix. When access is granted, the PDC transmit
channel reads data from memory and puts them to Transmit Holding Register (THR) of its asso-
ciated peripheral. The same peripheral sends data according to its mechanism.
307
6254C–ATARM–22-Jan-10
26.4.1 Receive Pointer Register
Register Name: PERIPH_RPR
Access Type: Read-write
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
309
6254C–ATARM–22-Jan-10
26.4.3 Transmit Pointer Register
Register Name: PERIPH_TPR
Access Type: Read-write
31 30 29 28 27 26 25 24
TXPTR
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
23 22 21 20 19 18 17 16
RXNPTR
15 14 13 12 11 10 9 8
RXNPTR
7 6 5 4 3 2 1 0
RXNPTR
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
RXNCTR
7 6 5 4 3 2 1 0
RXNCTR
311
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
TXNPTR
15 14 13 12 11 10 9 8
TXNPTR
7 6 5 4 3 2 1 0
TXNPTR
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
TXNCTR
7 6 5 4 3 2 1 0
TXNCTR
312
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – TXTDIS TXTEN
7 6 5 4 3 2 1 0
– – – – – – RXTDIS RXTEN
313
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – TXTEN
7 6 5 4 3 2 1 0
– – – – – – – RXTEN
314
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
27.1 Description
The Clock Generator is made up of 2 PLL, a Main Oscillator, as well as an RC Oscillator and a
32,768 Hz low-power Oscillator.
It provides the following clocks:
• SLCK, the Slow Clock, which is the only permanent clock within the system
• MAINCK is the output of the Main Oscillator
The Clock Generator User Interface is embedded within the Power Management Controller one
and is described in Section 28.9. However, the Clock Generator registers are named CKGR_.
• PLLACK is the output of the Divider and PLL A block
• PLLBCK is the output of the Divider and PLL B block
Clock Generator
OSC_SEL
On Chip
RC OSC
Slow Clock
XIN32 Slow Clock SLCK
Oscillator
XOUT32
XIN
Main Main Clock
Oscillator MAINCK
XOUT
Status Control
Power
Management
Controller
315
6254C–ATARM–22-Jan-10
Figure 27-2. Typical Slow Clock Crystal Oscillator Connection
XIN32 XOUT32 GNDBU
32,768 Hz
Crystal
MOSCEN
OSCOUNT
Main
SLCK Oscillator MOSCS
Slow Clock
Counter
required for crystals with frequencies lower than 8 MHz. For further details on the electrical char-
acteristics of the Main Oscillator, see the section “DC Characteristics” of the product datasheet.
AT91 Microcontroller
1K
317
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Clock Frequency Register) is set and the counter stops counting. Its value can be read in the
MAINF field of CKGR_MCFR and gives the number of Main Clock cycles during 16 periods of
Slow Clock, so that the frequency of the crystal connected on the Main Oscillator can be
determined.
PLLACK
Divider A PLL A
PLLRCA
PLLBCOUNT
PLL B
LOCKB
Counter
PLLACOUNT
SLCK PLL A
LOCKA
Counter
318
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
C2
C1
GND
319
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
28.1 Description
The Power Management Controller (PMC) optimizes power consumption by controlling all sys-
tem and user peripheral clocks. The PMC enables/disables the clock inputs to many of the
peripherals and the ARM Processor.
The Power Management Controller provides the following clocks:
• MCK, the Master Clock, programmable from a few hundred Hz to the maximum operating
frequency of the device. It is available to the modules running permanently, such as the AIC
and the Memory Controller.
• Processor Clock (PCK), must be switched off when entering processor in Idle Mode.
• Peripheral Clocks, typically MCK, provided to the embedded peripherals (USART, SSC, SPI,
TWI, TC, MCI, etc.) and independently controllable. In order to reduce the number of clock
names in a product, the Peripheral Clocks are named MCK in the product datasheet.
• UHP Clock (UHPCK), required by USB Host Port operations.
• Programmable Clock Outputs can be selected from the clocks provided by the clock
generator and driven on the PCKx pins.
• Five flexible operating modes:
– Normal Mode, processor and peripherals running at a programmable frequency
– Idle Mode, processor stopped waiting for an interrupt
– Slow Clock Mode, processor and peripherals running at low frequency
– Standby Mode, mix of Idle and Backup Mode, peripheral running at low frequency,
processor stopped waiting for an interrupt
– Backup Mode, Main Power Supplies off, VDDBU powered by a battery
SLCK ON/OFF
MAINCK Prescaler pck[..]
PLLACK /1,/2,/4,...,/64
PLLBCK
320
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Each time PMC_MCKR is written to define a new Master Clock, the MCKRDY bit is cleared in
PMC_SR. It reads 0 until the Master Clock is established. Then, the MCKRDY bit is set and can
trigger an interrupt to the processor. This feature is useful when switching from a high-speed
clock to a lower one to inform the software when the change is actually done.
321
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
USBDIV
322
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Moreover, like the PCK, a status bitin PMC_SR indicates that the Programmable Clock is actu-
ally what has been programmed in the Programmable Clock registers.
As the Programmable Clock Controller does not manage with glitch prevention when switching
clocks, it is strongly recommended to disable the Programmable Clock before any configuration
change and to re-enable it after the change is actually performed.
323
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
waiting the interrupt line to be raised if the associated interrupt to LOCKA has been enabled
in the PMC_IER register.
All parameters in CKGR_PLLAR can be programmed in a single write operation. If at some
stage one of the following parameters, SRCA, MULA, DIVA is modified, LOCKA bit will go
low to indicate that PLL A is not ready yet. When PLL A is locked, LOCKA will be set again.
User has to wait for LOCKA bit to be set before using the PLL A output clock.
Code Example:
write_register(CKGR_PLLAR,0x20030605)
PLL A and divider A are enabled. PLL A input clock is main clock divided by 5. PLL An out-
put clock is PLL A input clock multiplied by 4. Once CKGR_PLLAR has been written,
LOCKA bit will be set after six slow clock cycles.
4. Setting PLL B and divider B:
All parameters needed to configure PLL B and divider B are located in the CKGR_PLLBR
register. ICPPLLB in PMC_PLLICPR register must be set to 1 before configuring the
CKGR_PLLBR register.
The DIVB field is used to control divider B itself. A value between 0 and 255 can be pro-
grammed. Divider B output is divider B input divided by DIVB parameter. By default DIVB
parameter is set to 0 which means that divider B is turned off.
The OUTB field is used to select the PLL B output frequency range.
The MULB field is the PLL B multiplier factor. This parameter can be programmed between
0 and 2047. If MULB is set to 0, PLL B will be turned off, otherwise the PLL B output fre-
quency is PLL B input frequency multiplied by (MULB + 1).
The PLLBCOUNT field specifies the number of slow clock cycles before LOCKB bit is set in
the PMC_SR register after CKGR_PLLBR register has been written.
Once the PMC_PLLB register has been written, the user must wait for the LOCKB bit to be
set in the PMC_SR register. This can be done either by polling the status register or by wait-
ing the interrupt line to be raised if the associated interrupt to LOCKB has been enabled in
the PMC_IER register. All parameters in CKGR_PLLBR can be programmed in a single
write operation. If at some stage one of the following parameters, MULB, DIVB is modified,
LOCKB bit will go low to indicate that PLL B is not ready yet. When PLL B is locked, LOCKB
will be set again. The user is constrained to wait for LOCKB bit to be set before using the
PLL A output clock.
The USBDIV field is used to control the additional divider by 1, 2 or 4, which generates the
USB clock(s).
Code Example:
write_register(CKGR_PLLBR,0x00040805)
If PLL B and divider B are enabled, the PLL B input clock is the main clock. PLL B output
clock is PLL B input clock multiplied by 5. Once CKGR_PLLBR has been written, LOCKB bit
will be set after eight slow clock cycles.
5. Selection of Master Clock and Processor Clock
The Master Clock and the Processor Clock are configurable via the PMC_MCKR register.
324
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
The CSS field is used to select the Master Clock divider source. By default, the selected
clock source is slow clock.
The PRES field is used to control the Master Clock prescaler. The user can choose between
different values (1, 2, 4, 8, 16, 32, 64). Master Clock output is prescaler input divided by
PRES parameter. By default, PRES parameter is set to 0 which means that master clock is
equal to slow clock.
The MDIV field is used to control the Master Clock divider. It is possible to choose between
different values (0, 1, 2). The Master Clock output is Processor Clock divided by 1, 2 or 4,
depending on the value programmed in MDIV. By default, MDIV is set to 0, which indicates
that the Processor Clock is equal to the Master Clock.
Once the PMC_MCKR register has been written, the user must wait for the MCKRDY bit to
be set in the PMC_SR register. This can be done either by polling the status register or by
waiting for the interrupt line to be raised if the associated interrupt to MCKRDY has been
enabled in the PMC_IER register.
The PMC_MCKR register must not be programmed in a single write operation. The pre-
ferred programming sequence for the PMC_MCKR register is as follows:
• If a new value for CSS field corresponds to PLL Clock,
– Program the PRES field in the PMC_MCKR register.
– Wait for the MCKRDY bit to be set in the PMC_SR register.
– Program the CSS field in the PMC_MCKR register.
– Wait for the MCKRDY bit to be set in the PMC_SR register.
• If a new value for CSS field corresponds to Main Clock or Slow Clock,
– Program the CSS field in the PMC_MCKR register.
– Wait for the MCKRDY bit to be set in the PMC_SR register.
– Program the PRES field in the PMC_MCKR register.
– Wait for the MCKRDY bit to be set in the PMC_SR register.
If at some stage one of the following parameters, CSS or PRES, is modified, the MCKRDY
bit will go low to indicate that the Master Clock and the Processor Clock are not ready yet.
The user must wait for MCKRDY bit to be set again before using the Master and Processor
Clocks.
Note: IF PLLx clock was selected as the Master Clock and the user decides to modify it by writing in
CKGR_PLLR (CKGR_PLLAR or CKGR_PLLBR), the MCKRDY flag will go low while PLL is
unlocked. Once PLL is locked again, LOCK (LOCKA or LOCKB) goes high and MCKRDY is set.
While PLLA is unlocked, the Master Clock selection is automatically changed to Slow Clock. While
PLLB is unlocked, the Master Clock selection is automatically changed to Main Clock. For further
information, see Section 28.8.2. “Clock Switching Waveforms” on page 329.
Code Example:
write_register(PMC_MCKR,0x00000001)
wait (MCKRDY=1)
write_register(PMC_MCKR,0x00000011)
wait (MCKRDY=1)
325
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Code Example:
write_register(PMC_PCK0,0x00000015)
Code Examples:
326
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
write_register(PMC_PCER,0x00000110)
write_register(PMC_PCDR,0x00000010)
327
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Table 28-2. Clock Switching Timings Between Two PLLs (Worst Case)
From PLLA Clock PLLB Clock
To
2.5 x PLLA Clock + 3 x PLLA Clock +
PLLA Clock 4 x SLCK + 4 x SLCK +
PLLACOUNT x SLCK 1.5 x PLLA Clock
3 x PLLB Clock + 2.5 x PLLB Clock +
PLLB Clock 4 x SLCK + 4 x SLCK +
1.5 x PLLB Clock PLLBCOUNT x SLCK
328
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Figure 28-4. Switch Master Clock from Slow Clock to PLL Clock
Slow Clock
PLL Clock
LOCK
MCKRDY
Master Clock
Write PMC_MCKR
Figure 28-5. Switch Master Clock from Main Clock to Slow Clock
Slow Clock
Main Clock
MCKRDY
Master Clock
Write PMC_MCKR
329
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Slow Clock
PLLA Clock
LOCK
MCKRDY
Master Clock
Slow Clock
Write CKGR_PLLAR
Main Clock
PLLB Clock
LOCK
MCKRDY
Master Clock
Main Clock
Write CKGR_PLLBR
330
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
PLL Clock
PCKRDY
PCKx Output
Write PMC_SCER
PCKx is enabled
331
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
332
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – PCK1 PCK0
7 6 5 4 3 2 1 0
UDP UHP – – – – – –
333
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – PCK1 PCK0
7 6 5 4 3 2 1 0
UDP UHP – – – – – PCK
334
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – PCK1 PCK0
7 6 5 4 3 2 1 0
UDP UHP – – – – – PCK
335
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
PID23 PID22 PID21 PID20 PID19 PID18 PID17 PID16
15 14 13 12 11 10 9 8
PID15 PID14 PID13 PID12 PID11 PID10 PID9 PID8
7 6 5 4 3 2 1 0
PID7 PID6 PID5 PID4 PID3 PID2 - -
23 22 21 20 19 18 17 16
PID23 PID22 PID21 PID20 PID19 PID18 PID17 PID16
15 14 13 12 11 10 9 8
PID15 PID14 PID13 PID12 PID11 PID10 PID9 PID8
7 6 5 4 3 2 1 0
PID7 PID6 PID5 PID4 PID3 PID2 - -
336
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
PID23 PID22 PID21 PID20 PID19 PID18 PID17 PID16
15 14 13 12 11 10 9 8
PID15 PID14 PID13 PID12 PID11 PID10 PID9 PID8
7 6 5 4 3 2 1 0
PID7 PID6 PID5 PID4 PID3 PID2 – –
337
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
OSCOUNT
7 6 5 4 3 2 1 0
– – – – – – OSCBYPASS MOSCEN
338
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – MAINRDY
15 14 13 12 11 10 9 8
MAINF
7 6 5 4 3 2 1 0
MAINF
339
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
MULA
15 14 13 12 11 10 9 8
OUTA PLLACOUNT
7 6 5 4 3 2 1 0
DIVA
Possible limitations on PLL A input frequencies and multiplier factors should be checked before using the PMC.
Warning: Bit 29 must always be set to 1 when programming the CKGR_PLLAR register.
• DIVA: Divider A
340
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
MULB
15 14 13 12 11 10 9 8
OUTB PLLBCOUNT
7 6 5 4 3 2 1 0
DIVB
Possible limitations on PLL B input frequencies and multiplier factors should be checked before using the PMC.
• DIVB: Divider B
341
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – MDIV
7 6 5 4 3 2 1 0
– – – PRES CSS
342
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – PRES CSS
343
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – PCKRDY1 PCKRDY0
7 6 5 4 3 2 1 0
– – – – MCKRDY LOCKB LOCKA MOSCS
344
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – PCKRDY1 PCKRDY0
7 6 5 4 3 2 1 0
– – – – MCKRDY LOCKB LOCKA MOSCS
345
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – PCKRDY1 PCKRDY0
7 6 5 4 3 2 1 0
OSC_SEL – – – MCKRDY LOCKB LOCKA MOSCS
346
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – PCKRDY1 PCKRDY0
7 6 5 4 3 2 1 0
– – – – MCKRDY LOCKB LOCKA MOSCS
347
6254C–ATARM–22-Jan-10
28.9.17 .PLL Charge Pump Current Register
Register Name: PMC_PLLICPR
Address: 0xFFFFFC80
Access Type: Write-only
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – ICPPLLB
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – ICPPLLA
29.1 Description
The Advanced Interrupt Controller (AIC) is an 8-level priority, individually maskable, vectored
interrupt controller, providing handling of up to thirty-two interrupt sources. It is designed to sub-
stantially reduce the software and real-time overhead in handling internal and external
interrupts.
The AIC drives the nFIQ (fast interrupt request) and the nIRQ (standard interrupt request) inputs
of an ARM processor. Inputs of the AIC are either internal peripheral interrupts or external inter-
rupts coming from the product's pins.
The 8-level Priority Controller allows the user to define the priority for each interrupt source, thus
permitting higher priority interrupts to be serviced even if a lower priority interrupt is being
treated.
Internal interrupt sources can be programmed to be level sensitive or edge triggered. External
interrupt sources can be programmed to be positive-edge or negative-edge triggered or high-
level or low-level sensitive.
The fast forcing feature redirects any internal or external interrupt source to provide a fast inter-
rupt rather than a normal interrupt.
349
6254C–ATARM–22-Jan-10
29.2 Block Diagram
FIQ AIC
ARM
IRQ0-IRQn Processor
Up to
Thirty-two nFIQ
Embedded Sources
PeripheralEE
Embedded nIRQ
Peripheral
Embedded
Peripheral
APB
OS-based Applications
Standalone
Applications OS Drivers RTOS Drivers
Hard Real Time Tasks
General OS Interrupt Handler
External Peripherals
Embedded Peripherals
(External Interrupts)
APB
351
6254C–ATARM–22-Jan-10
29.7 Functional Description
AIC_ICCR
AIC_IDCR
Level/ AIC_IPR
Edge
AIC_IMR
Source i
Fast Interrupt Controller
or
Priority Controller
Pos./Neg. AIC_IECR
Edge
Detector FF
Set Clear
AIC_ISCR AIC_IDCR
AIC_ICCR
353
6254C–ATARM–22-Jan-10
29.7.2 Interrupt Latencies
Global interrupt latencies depend on several parameters, including:
• The time the software masks the interrupts.
• Occurrence, either at the processor level or at the AIC level.
• The execution time of the instruction in progress when the interrupt occurs.
• The treatment of higher priority interrupts and the resynchronization of the hardware signals.
This section addresses only the hardware resynchronizations. It gives details of the latency
times between the event on an external interrupt leading in a valid interrupt (edge or level) or the
assertion of an internal interrupt source and the assertion of the nIRQ or nFIQ line on the pro-
cessor. The resynchronization time depends on the programming of the interrupt source and on
its type (internal or external). For the standard interrupt, resynchronization times are given
assuming there is no higher priority in progress.
The PIO Controller multiplexing has no effect on the interrupt latencies of the external interrupt
sources.
IRQ or FIQ
(Positive Edge)
IRQ or FIQ
(Negative Edge)
nIRQ
Maximum IRQ Latency = 4 Cycles
nFIQ
Maximum FIQ Latency = 4 Cycles
MCK
IRQ or FIQ
(High Level)
IRQ or FIQ
(Low Level)
nIRQ
Maximum IRQ
Latency = 3 Cycles
nFIQ
Maximum FIQ
Latency = 3 cycles
MCK
nIRQ
Peripheral Interrupt
Becomes Active
MCK
nIRQ
Peripheral Interrupt
Becomes Active
355
6254C–ATARM–22-Jan-10
The nIRQ line can be asserted only if an interrupt condition occurs on an interrupt source with a
higher priority. If an interrupt condition happens (or is pending) during the interrupt treatment in
progress, it is delayed until the software indicates to the AIC the end of the current service by
writing the AIC_EOICR (End of Interrupt Command Register). The write of AIC_EOICR is the
exit point of the interrupt handling.
It is assumed that:
1. The Advanced Interrupt Controller has been programmed, AIC_SVR registers are
loaded with corresponding interrupt service routine addresses and interrupts are
enabled.
2. The instruction at the ARM interrupt exception vector address is required to work with
the vectoring
LDR PC, [PC, # -&F20]
When nIRQ is asserted, if the bit “I” of CPSR is 0, the sequence is as follows:
1. The CPSR is stored in SPSR_irq, the current value of the Program Counter is loaded in
the Interrupt link register (R14_irq) and the Program Counter (R15) is loaded with 0x18.
In the following cycle during fetch at address 0x1C, the ARM core adjusts R14_irq, dec-
rementing it by four.
2. The ARM core enters Interrupt mode, if it has not already done so.
3. When the instruction loaded at address 0x18 is executed, the program counter is
loaded with the value read in AIC_IVR. Reading the AIC_IVR has the following effects:
– Sets the current interrupt to be the pending and enabled interrupt with the highest
priority. The current level is the priority level of the current interrupt.
– De-asserts the nIRQ line on the processor. Even if vectoring is not used, AIC_IVR
must be read in order to de-assert nIRQ.
– Automatically clears the interrupt, if it has been programmed to be edge-triggered.
– Pushes the current level and the current interrupt number on to the stack.
– Returns the value written in the AIC_SVR corresponding to the current interrupt.
4. The previous step has the effect of branching to the corresponding interrupt service
routine. This should start by saving the link register (R14_irq) and SPSR_IRQ. The link
register must be decremented by four when it is saved if it is to be restored directly into
the program counter at the end of the interrupt. For example, the instruction SUB PC,
LR, #4 may be used.
5. Further interrupts can then be unmasked by clearing the “I” bit in CPSR, allowing re-
assertion of the nIRQ to be taken into account by the core. This can happen if an inter-
rupt with a higher priority than the current interrupt occurs.
6. The interrupt handler can then proceed as required, saving the registers that will be
used and restoring them at the end. During this phase, an interrupt of higher priority
than the current level will restart the sequence from step 1.
Note: If the interrupt is programmed to be level sensitive, the source of the interrupt must be cleared dur-
ing this phase.
7. The “I” bit in CPSR must be set in order to mask interrupts before exiting to ensure that
the interrupt is completed in an orderly manner.
8. The End of Interrupt Command Register (AIC_EOICR) must be written in order to indi-
cate to the AIC that the current interrupt is finished. This causes the current level to be
popped from the stack, restoring the previous current level if one exists on the stack. If
another interrupt is pending, with lower or equal priority than the old current level but
with higher priority than the new current level, the nIRQ line is re-asserted, but the inter-
rupt sequence does not immediately start because the “I” bit is set in the core.
SPSR_irq is restored. Finally, the saved value of the link register is restored directly into
the PC. This has the effect of returning from the interrupt to whatever was being exe-
cuted before, and of loading the CPSR with the stored SPSR, masking or unmasking
the interrupts depending on the state saved in SPSR_irq.
357
6254C–ATARM–22-Jan-10
Note: The “I” bit in SPSR is significant. If it is set, it indicates that the ARM core was on the verge of
masking an interrupt when the mask instruction was interrupted. Hence, when SPSR is restored,
the mask instruction is completed (interrupt is masked).
the following cycle, during fetch at address 0x20, the ARM core adjusts R14_fiq, decre-
menting it by four.
2. The ARM core enters FIQ mode.
3. When the instruction loaded at address 0x1C is executed, the program counter is
loaded with the value read in AIC_FVR. Reading the AIC_FVR has effect of automati-
cally clearing the fast interrupt, if it has been programmed to be edge triggered. In this
case only, it de-asserts the nFIQ line on the processor.
4. The previous step enables branching to the corresponding interrupt service routine. It is
not necessary to save the link register R14_fiq and SPSR_fiq if nested fast interrupts
are not needed.
5. The Interrupt Handler can then proceed as required. It is not necessary to save regis-
ters R8 to R13 because FIQ mode has its own dedicated registers and the user R8 to
R13 are banked. The other registers, R0 to R7, must be saved before being used, and
restored at the end (before the next step). Note that if the fast interrupt is programmed
to be level sensitive, the source of the interrupt must be cleared during this phase in
order to de-assert the interrupt source 0.
6. Finally, the Link Register R14_fiq is restored into the PC after decrementing it by four
(with instruction SUB PC, LR, #4 for example). This has the effect of returning from
the interrupt to whatever was being executed before, loading the CPSR with the SPSR
and masking or unmasking the fast interrupt depending on the state saved in the
SPSR.
Note: The “F” bit in SPSR is significant. If it is set, it indicates that the ARM core was just about to mask
FIQ interrupts when the mask instruction was interrupted. Hence when the SPSR is restored, the
interrupted instruction is completed (FIQ is masked).
Another way to handle the fast interrupt is to map the interrupt service routine at the address of
the ARM vector 0x1C. This method does not use the vectoring, so that reading AIC_FVR must
be performed at the very beginning of the handler operation. However, this method saves the
execution of a branch instruction.
359
6254C–ATARM–22-Jan-10
The FIQ Vector Register (AIC_FVR) reads the contents of the Source Vector Register 0
(AIC_SVR0), whatever the source of the fast interrupt may be. The read of the FVR does not
clear the Source 0 when the fast forcing feature is used and the interrupt source should be
cleared by writing to the Interrupt Clear Command Register (AIC_ICCR).
All enabled and pending interrupt sources that have the fast forcing feature enabled and that are
programmed in edge-triggered mode must be cleared by writing to the Interrupt Clear Command
Register. In doing so, they are cleared independently and thus lost interrupts are prevented.
The read of AIC_IVR does not clear the source that has the fast forcing feature enabled.
The source 0, reserved to the fast interrupt, continues operating normally and becomes one of
the Fast Interrupt sources.
AIC_FFSR
Source n AIC_IPR
Input Stage
Priority
Manager
Automatic Clear AIC_IMR nIRQ
Interrupt Status Register (AIC_ISR), is updated with the current interrupt only when AIC_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 perform the same operations. However, it is recommended to
not stop the processor between the read and the write of AIC_IVR of the interrupt service routine
to make sure the debugger does not modify the AIC context.
To summarize, in normal operating mode, the read of AIC_IVR performs the following opera-
tions within the AIC:
1. Calculates active interrupt (higher than current or spurious).
2. Determines and returns the vector of the active interrupt.
3. Memorizes the interrupt.
4. Pushes the current priority level onto the internal stack.
5. Acknowledges the interrupt.
However, while the Protect Mode is activated, only operations 1 to 3 are performed when
AIC_IVR is read. Operations 4 and 5 are only performed by the AIC when AIC_IVR is written.
Software that has been written and debugged using the Protect Mode runs correctly in Normal
Mode without modification. However, in Normal Mode the AIC_IVR write has no effect and can
be removed to optimize the code.
361
6254C–ATARM–22-Jan-10
29.8 Advanced Interrupt Controller (AIC) User Interface
Notes: 1. The reset value of this register depends on the level of the external interrupt source. All other sources are cleared at reset,
thus not pending.
2. PID2...PID31 bit fields refer to the identifiers as defined in the Peripheral Identifiers Section of the product datasheet.
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
363
6254C–ATARM–22-Jan-10
29.8.3 AIC Source Vector Register
Register Name: AIC_SVR0..AIC_SVR31
Address: 0xFFFFF080
Access Type: Read-write
Reset Value: 0x0
31 30 29 28 27 26 25 24
VECTOR
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
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
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
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
365
6254C–ATARM–22-Jan-10
29.8.7 AIC Interrupt Pending Register
Register Name: AIC_IPR
Address: 0xFFFFF10C
Access Type: Read-only
Reset Value: 0x0
31 30 29 28 27 26 25 24
PID31 PID30 PID29 PID28 PID27 PID26 PID25 PID24
23 22 21 20 19 18 17 16
PID23 PID22 PID21 PID20 PID19 PID18 PID17 PID16
15 14 13 12 11 10 9 8
PID15 PID14 PID13 PID12 PID11 PID10 PID9 PID8
7 6 5 4 3 2 1 0
PID7 PID6 PID5 PID4 PID3 PID2 SYS FIQ
23 22 21 20 19 18 17 16
PID23 PID22 PID21 PID20 PID19 PID18 PID17 PID16
15 14 13 12 11 10 9 8
PID15 PID14 PID13 PID12 PID11 PID10 PID9 PID8
7 6 5 4 3 2 1 0
PID7 PID6 PID5 PID4 PID3 PID2 SYS FIQ
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
23 22 21 20 19 18 17 16
PID23 PID22 PID21 PID20 PID19 PID18 PID17 PID16
15 14 13 12 11 10 9 8
PID15 PID14 PID13 PID12 PID11 PID10 PID9 PID8
7 6 5 4 3 2 1 0
PID7 PID6 PID5 PID4 PID3 PID2 SYS FIQ
367
6254C–ATARM–22-Jan-10
29.8.11 AIC Interrupt Disable Command Register
Register Name: AIC_IDCR
Address: 0xFFFFF124
Access Type: Write-only
31 30 29 28 27 26 25 24
PID31 PID30 PID29 PID28 PID27 PID26 PID25 PID24
23 22 21 20 19 18 17 16
PID23 PID22 PID21 PID20 PID19 PID18 PID17 PID16
15 14 13 12 11 10 9 8
PID15 PID14 PID13 PID12 PID11 PID10 PID9 PID8
7 6 5 4 3 2 1 0
PID7 PID6 PID5 PID4 PID3 PID2 SYS FIQ
23 22 21 20 19 18 17 16
PID23 PID22 PID21 PID20 PID19 PID18 PID17 PID16
15 14 13 12 11 10 9 8
PID15 PID14 PID13 PID12 PID11 PID10 PID9 PID8
7 6 5 4 3 2 1 0
PID7 PID6 PID5 PID4 PID3 PID2 SYS FIQ
23 22 21 20 19 18 17 16
PID23 PID22 PID21 PID20 PID19 PID18 PID17 PID16
15 14 13 12 11 10 9 8
PID15 PID14 PID13 PID12 PID11 PID10 PID9 PID8
7 6 5 4 3 2 1 0
PID7 PID6 PID5 PID4 PID3 PID2 SYS FIQ
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.
369
6254C–ATARM–22-Jan-10
29.8.15 AIC Spurious Interrupt Vector Register
Register Name: AIC_SPU
Address: 0xFFFFF134
Access Type: Read-write
Reset Value: 0x0
31 30 29 28 27 26 25 24
SIVR
23 22 21 20 19 18 17 16
SIVR
15 14 13 12 11 10 9 8
SIVR
7 6 5 4 3 2 1 0
SIVR
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – GMSK PROT
23 22 21 20 19 18 17 16
PID23 PID22 PID21 PID20 PID19 PID18 PID17 PID16
15 14 13 12 11 10 9 8
PID15 PID14 PID13 PID12 PID11 PID10 PID9 PID8
7 6 5 4 3 2 1 0
PID7 PID6 PID5 PID4 PID3 PID2 SYS –
23 22 21 20 19 18 17 16
PID23 PID22 PID21 PID20 PID19 PID18 PID17 PID16
15 14 13 12 11 10 9 8
PID15 PID14 PID13 PID12 PID11 PID10 PID9 PID8
7 6 5 4 3 2 1 0
PID7 PID6 PID5 PID4 PID3 PID2 SYS –
371
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
PID23 PID22 PID21 PID20 PID19 PID18 PID17 PID16
15 14 13 12 11 10 9 8
PID15 PID14 PID13 PID12 PID11 PID10 PID9 PID8
7 6 5 4 3 2 1 0
PID7 PID6 PID5 PID4 PID3 PID2 SYS –
372
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
30.1 Description
The Debug Unit provides a single entry point from the processor for access to all the debug
capabilities of Atmel’s ARM-based systems.
The Debug Unit features a two-pin UART that can be used for several debug and trace purposes
and offers an ideal medium for in-situ programming solutions and debug monitor communica-
tions. The Debug Unit two-pin UART can be used stand-alone for general purpose serial
communication. Moreover, the association with two peripheral data controller channels permits
packet handling for these tasks with processor time reduced to a minimum.
The Debug Unit also makes the Debug Communication Channel (DCC) signals provided by the
In-circuit Emulator of the ARM processor visible to the software. These signals indicate the sta-
tus of the DCC read and write registers and generate an interrupt to the ARM processor, making
possible the handling of the DCC under interrupt control.
Chip Identifier registers permit recognition of the device and its revision. These registers inform
as to the sizes and types of the on-chip memories, as well as the set of embedded peripherals.
Finally, the Debug Unit features a Force NTRST capability that enables the software to decide
whether to prevent access to the system via the In-circuit Emulator. This permits protection of
the code, stored in ROM.
373
6254C–ATARM–22-Jan-10
30.2 Block Diagram
Peripheral
Bridge
COMMRX
DCC
R Chip ID
ARM COMMTX Handler
Processor
nTRST
ICE
Interrupt
Access dbgu_irq
Control
Handler
Power-on
Reset
force_ntrst
Debug Unit
RS232 Drivers
MCK
Baud Rate = ----------------------
16 × CD
375
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
CD
30.4.2 Receiver
376
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
DRXD
True Start D0
Detection
Baud Rate
Clock
DRXD
RXRDY
Read DBGU_RHR
RXRDY
OVRE
RSTSTA
377
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
bit. If different, the parity error bit PARE in DBGU_SR is set at the same time the RXRDY is set.
The parity bit is cleared when the control register DBGU_CR is written with the bit RSTSTA
(Reset Status) at 1. If a new character is received before the reset status command is written,
the PARE bit remains at 1.
RXRDY
PARE
RXRDY
FRAME
30.4.3 Transmitter
378
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
PARE in the mode register DBGU_MR defines whether or not a parity bit is shifted out. When a
parity bit is enabled, it can be selected between an odd parity, an even parity, or a fixed space or
mark bit.
Baud Rate
Clock
DTXD
TXRDY
TXEMPTY
379
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
The RXRDY bit triggers the PDC channel data transfer of the receiver. This results in a read of
the data in DBGU_RHR. The TXRDY bit triggers the PDC channel data transfer of the transmit-
ter. This results in a write of a data in DBGU_THR.
Receiver RXD
Disabled
Transmitter TXD
Local Loopback
Disabled
Receiver RXD
VDD
Disabled
Transmitter TXD
Disabled
Transmitter TXD
380
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
The Debug Communication Channel contains two registers that are accessible through the ICE
Breaker on the JTAG side and through the coprocessor 0 on the ARM Processor side.
As a reminder, the following instructions are used to read and write the Debug Communication
Channel:
MRC p14, 0, Rd, c1, c0, 0
Returns the debug communication data read register into Rd
381
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
382
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – RSTSTA
7 6 5 4 3 2 1 0
TXDIS TXEN RXDIS RXEN RSTTX RSTRX – –
383
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
CHMODE – – PAR –
7 6 5 4 3 2 1 0
– – – – – – – –
384
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – RXBUFF TXBUFE – TXEMPTY –
7 6 5 4 3 2 1 0
PARE FRAME OVRE ENDTX ENDRX – TXRDY RXRDY
385
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – RXBUFF TXBUFE – TXEMPTY –
7 6 5 4 3 2 1 0
PARE FRAME OVRE ENDTX ENDRX – TXRDY RXRDY
386
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – RXBUFF TXBUFE – TXEMPTY –
7 6 5 4 3 2 1 0
PARE FRAME OVRE ENDTX ENDRX – TXRDY RXRDY
387
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – RXBUFF TXBUFE – TXEMPTY –
7 6 5 4 3 2 1 0
PARE FRAME OVRE ENDTX ENDRX – TXRDY RXRDY
388
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
389
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
RXCHR
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
TXCHR
390
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
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
391
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
ARCH SRAMSIZ
15 14 13 12 11 10 9 8
NVPSIZ2 NVPSIZ
7 6 5 4 3 2 1 0
EPROC VERSION
EPROC Processor
0 0 1 ARM946ES
0 1 0 ARM7TDMI
1 0 0 ARM920T
1 0 1 ARM926EJS
NVPSIZ Size
0 0 0 0 None
0 0 0 1 8K bytes
0 0 1 0 16K bytes
0 0 1 1 32K bytes
0 1 0 0 Reserved
0 1 0 1 64K bytes
0 1 1 0 Reserved
0 1 1 1 128K bytes
1 0 0 0 Reserved
1 0 0 1 256K bytes
1 0 1 0 512K bytes
1 0 1 1 Reserved
1 1 0 0 1024K bytes
1 1 0 1 Reserved
1 1 1 0 2048K bytes
1 1 1 1 Reserved
392
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
NVPSIZ2 Size
0 0 0 0 None
0 0 0 1 8K bytes
0 0 1 0 16K bytes
0 0 1 1 32K bytes
0 1 0 0 Reserved
0 1 0 1 64K bytes
0 1 1 0 Reserved
0 1 1 1 128K bytes
1 0 0 0 Reserved
1 0 0 1 256K bytes
1 0 1 0 512K bytes
1 0 1 1 Reserved
1 1 0 0 1024K bytes
1 1 0 1 Reserved
1 1 1 0 2048K bytes
1 1 1 1 Reserved
SRAMSIZ Size
0 0 0 0 Reserved
0 0 0 1 1K bytes
0 0 1 0 2K bytes
0 0 1 1 6K bytes
0 1 0 0 112K bytes
0 1 0 1 4K bytes
0 1 1 0 80K bytes
0 1 1 1 160K bytes
1 0 0 0 8K bytes
1 0 0 1 16K bytes
1 0 1 0 32K bytes
1 0 1 1 64K bytes
1 1 0 0 128K bytes
1 1 0 1 256K bytes
1 1 1 0 96K bytes
1 1 1 1 512K bytes
393
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
ARCH
Hex Bin Architecture
0x19 0001 1001 AT91SAM9xx Series
0x29 0010 1001 AT91SAM9XExx Series
0x34 0011 0100 AT91x34 Series
0x37 0011 0111 CAP7 Series
0x39 0011 1001 CAP9 Series
0x3B 0011 1011 CAP11 Series
0x40 0100 0000 AT91x40 Series
0x42 0100 0010 AT91x42 Series
0x55 0101 0101 AT91x55 Series
0x60 0110 0000 AT91SAM7Axx Series
0x61 0110 0001 AT91SAM7AQxx Series
0x63 0110 0011 AT91x63 Series
0x70 0111 0000 AT91SAM7Sxx Series
0x71 0111 0001 AT91SAM7XCxx Series
0x72 0111 0010 AT91SAM7SExx Series
0x73 0111 0011 AT91SAM7Lxx Series
0x75 0111 0101 AT91SAM7Xxx Series
0x92 1001 0010 AT91x92 Series
0xF0 1111 0000 AT75Cxx Series
NVPTYP Memory
0 0 0 ROM
0 0 1 ROMless or on-chip Flash
1 0 0 SRAM emulating ROM
0 1 0 Embedded Flash Memory
ROM and Embedded Flash Memory
0 1 1 NVPSIZ is ROM size
NVPSIZ2 is Flash size
394
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
EXID
15 14 13 12 11 10 9 8
EXID
7 6 5 4 3 2 1 0
EXID
395
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – – FNTRST
396
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
31.1 Description
The Parallel Input/Output Controller (PIO) manages up to 32 fully programmable input/output
lines. Each I/O line may be dedicated as a general-purpose I/O or be assigned to a function of
an embedded peripheral. This assures effective optimization of the pins of a product.
Each I/O line is associated with a bit number in all of the 32-bit registers of the 32-bit wide User
Interface.
Each I/O line of the PIO Controller features:
• An input change interrupt enabling level change detection on any I/O line.
• A glitch filter providing rejection of pulses lower than one-half of clock cycle.
• Multi-drive capability similar to an open drain I/O line.
• Control of the the pull-up of the I/O line.
• Input visibility and output control.
The PIO Controller also features a synchronous output providing up to 32 bits of data output in a
single write operation.
397
6254C–ATARM–22-Jan-10
31.2 Block Diagram
PIO Controller
PIO Interrupt
AIC
PIO Clock
PMC
Data, Enable
Up to 32
peripheral IOs
Embedded
Peripheral
PIN 0
Data, Enable
PIN 1
Up to 32 pins
Up to 32
Embedded peripheral IOs
Peripheral PIN 31
APB
PIO Controller
399
6254C–ATARM–22-Jan-10
31.4 Functional Description
The PIO Controller features up to 32 fully-programmable I/O lines. Most of the control logic asso-
ciated to each I/O is represented in Figure 31-3. In this description each signal shown
represents but one of up to 32 possible indexes.
PIO_OER[0]
PIO_OSR[0]
PIO_ODR[0] PIO_PUER[0]
PIO_PUSR[0]
1 PIO_PUDR[0]
Peripheral A
Output Enable 0
0
Peripheral B
0
Output Enable 1
PIO_ASR[0] PIO_PER[0]
PIO_ABSR[0] PIO_PSR[0] 1
Peripheral B 1 0
PIO_SODR[0]
Output
PIO_ODSR[0] 1 Pad
PIO_CODR[0] 1
Peripheral A
Input
Peripheral B
PIO_PDSR[0] PIO_ISR[0] Input
0
(Up to 32 possible inputs)
Edge
Detector
Glitch 1 PIO Interrupt
Filter
PIO_IFER[0]
PIO_IFSR[0] PIO_IER[0]
PIO_IFDR[0] PIO_IMR[0]
PIO_IDR[0]
PIO_ISR[31]
PIO_IER[31]
PIO_IMR[31]
PIO_IDR[31]
401
6254C–ATARM–22-Jan-10
The results of these write operations are detected in PIO_OSR (Output Status Register). When
a bit in this register is at 0, the corresponding I/O line is used as an input only. When the bit is at
1, the corresponding I/O line is driven by the PIO controller.
The level driven on an I/O line can be determined by writing in PIO_SODR (Set Output Data
Register) and PIO_CODR (Clear Output Data Register). These write operations respectively set
and clear PIO_ODSR (Output Data Status Register), which represents the data driven on the I/O
lines. Writing in PIO_OER and PIO_ODR manages PIO_OSR whether the pin is configured to
be controlled by the PIO controller or assigned to a peripheral function. This enables configura-
tion of the I/O line prior to setting it to be managed by the PIO Controller.
Similarly, writing in PIO_SODR and PIO_CODR effects PIO_ODSR. This is important as it
defines the first level driven on the I/O line.
MCK
PIO_ODSR
2 cycles 2 cycles
PIO_PDSR
31.4.8 Inputs
The level on each I/O line can be read through PIO_PDSR (Pin Data Status Register). This reg-
ister indicates the level of the I/O lines regardless of their configuration, whether uniquely as an
input or driven by the PIO controller or driven by a peripheral.
Reading the I/O line levels requires the clock of the PIO controller to be enabled, otherwise
PIO_PDSR reads the levels present on the I/O line at the time the clock was disabled.
403
6254C–ATARM–22-Jan-10
Figure 31-5. Input Glitch Filter Timing
MCK
up to 1.5 cycles
Pin Level
1 cycle 1 cycle 1 cycle 1 cycle
PIO_PDSR
if PIO_IFSR = 0
2 cycles 1 cycle
MCK
Pin Level
PIO_ISR
• Four output signals on I/O lines 4 to 7 (to drive LEDs for example), driven high and low, no
pull-up resistor
• Four input signals on I/O lines 8 to 11 (to read push-button states for example), with pull-up
resistors, glitch filters and input change interrupts
• Four input signals on I/O line 12 to 15 to read an external device status (polled, thus no input
change interrupt), no pull-up resistor, no glitch filter
• I/O lines 16 to 19 assigned to peripheral A functions with pull-up resistor
• I/O lines 20 to 23 assigned to peripheral B functions, no pull-up resistor
• I/O line 24 to 27 assigned to peripheral A with Input Change Interrupt and pull-up resistor
405
6254C–ATARM–22-Jan-10
31.6 Parallel Input/Output Controller (PIO) User Interface
Each I/O line controlled by the PIO Controller is associated with a bit in each of the PIO Control-
ler User Interface registers. Each register is 32 bits wide. If a parallel I/O line is not defined,
writing to the corresponding bits has no effect. Undefined bits read zero. If the I/O line is not mul-
tiplexed with any peripheral, the I/O line is controlled by the PIO Controller and PIO_PSR returns
1 systematically.
407
6254C–ATARM–22-Jan-10
31.6.1 PIO Controller PIO Enable Register
Name: PIO_PER
Addresses: 0xFFFFF400 (PIOA), 0xFFFFF600 (PIOB), 0xFFFFF800 (PIOC)
Access Type: Write-only
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
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
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
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
409
6254C–ATARM–22-Jan-10
31.6.5 PIO Controller Output Disable Register
Name: PIO_ODR
Addresses: 0xFFFFF414 (PIOA), 0xFFFFF614 (PIOB), 0xFFFFF814 (PIOC)
Access Type: Write-only
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
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
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
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
411
6254C–ATARM–22-Jan-10
31.6.9 PIO Controller Input Filter Status Register
Name: PIO_IFSR
Addresses: 0xFFFFF428 (PIOA), 0xFFFFF628 (PIOB), 0xFFFFF828 (PIOC)
Access Type: Read-only
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
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
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
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
413
6254C–ATARM–22-Jan-10
31.6.13 PIO Controller Pin Data Status Register
Name: PIO_PDSR
Addresses: 0xFFFFF43C (PIOA), 0xFFFFF63C (PIOB), 0xFFFFF83C (PIOC)
Access Type: Read-only
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
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
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
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
415
6254C–ATARM–22-Jan-10
31.6.17 PIO Controller Interrupt Status Register
Name: PIO_ISR
Addresses: 0xFFFFF44C (PIOA), 0xFFFFF64C (PIOB), 0xFFFFF84C (PIOC)
Access Type: Read-only
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
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
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
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
417
6254C–ATARM–22-Jan-10
31.6.21 PIO Pull Up Disable Register
Name: PIO_PUDR
Addresses: 0xFFFFF460 (PIOA), 0xFFFFF660 (PIOB), 0xFFFFF860 (PIOC)
Access Type: Write-only
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
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
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
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
419
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
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
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
420
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
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
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
421
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
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
422
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
32.1 Description
The Serial Peripheral Interface (SPI) circuit is a synchronous serial data link that provides com-
munication with external devices in Master or Slave Mode. It also enables communication
between processors if an external processor is connected to the system.
The Serial Peripheral Interface is essentially a shift register that serially transmits data bits to
other SPIs. During a data transfer, one SPI system acts as the “master”' which controls the data
flow, while the other devices act as “slaves'' which have data shifted into and out by the master.
Different CPUs can take turn being masters (Multiple Master Protocol opposite to Single Master
Protocol where one CPU is always the master while all of the others are always slaves) and one
master may simultaneously shift data into multiple slaves. However, only one slave may drive its
output to write data back to the master at any given time.
A slave device is selected when the master asserts its NSS signal. If multiple slave devices
exist, the master generates a separate slave select signal for each slave (NPCS).
The SPI system consists of two data lines and two control lines:
• Master Out Slave In (MOSI): This data line supplies the output data from the master shifted
into the input(s) of the slave(s).
• Master In Slave Out (MISO): This data line supplies the output data from a slave to the input
of the master. There may be no more than one slave transmitting data during any particular
transfer.
• Serial Clock (SPCK): This control line is driven by the master and regulates the flow of the
data bits. The master may transmit data at a variety of baud rates; the SPCK line cycles once
for each bit that is transmitted.
• Slave Select (NSS): This control line allows slaves to be turned on and off by hardware.
423
6254C–ATARM–22-Jan-10
32.2 Block Diagram
PDC
APB
SPCK
MISO
MCK MOSI
PMC
SPI Interface PIO NPCS0/NSS
NPCS1
NPCS2
Interrupt Control
NPCS3
SPI Interrupt
SPCK SPCK
MISO MISO
Slave 0
MOSI MOSI
SPCK
NPCS1
MISO
NPCS2 NC Slave 1
NPCS3 MOSI
NSS
SPCK
MISO
Slave 2
MOSI
NSS
32.5.3 Interrupt
The SPI interface has an interrupt line connected to the Advanced Interrupt Controller (AIC).
Handling the SPI interrupt requires programming the AIC before configuring the SPI.
425
6254C–ATARM–22-Jan-10
32.6 Functional Description
SPCK
(CPOL = 0)
SPCK
(CPOL = 1)
MOSI
MSB 6 5 4 3 2 1 LSB
(from master)
MISO
(from slave)
MSB 6 5 4 3 2 1 LSB *
NSS
(to slave)
SPCK
(CPOL = 0)
SPCK
(CPOL = 1)
MISO
(from slave) * MSB 6 5 4 3 2 1 LSB
NSS
(to slave)
427
6254C–ATARM–22-Jan-10
32.6.3 Master Mode Operations
When configured in Master Mode, the SPI operates on the clock generated by the internal pro-
grammable baud rate generator. It fully controls the data transfers to and from the slave(s)
connected to the SPI bus. The SPI drives the chip select line to the slave and the serial clock
signal (SPCK).
The SPI features two holding registers, the Transmit Data Register and the Receive Data Regis-
ter, and a single Shift Register. The holding registers maintain the data flow at a constant rate.
After enabling the SPI, a data transfer begins when the processor writes to the SPI_TDR (Trans-
mit Data Register). The written data is immediately transferred in the Shift Register and transfer
on the SPI bus starts. While the data in the Shift Register is shifted on the MOSI line, the MISO
line is sampled and shifted in the Shift Register. Transmission cannot occur without reception.
Before writing the TDR, the PCS field must be set in order to select a slave.
If new data is written in SPI_TDR during the transfer, it stays in it until the current transfer is
completed. Then, the received data is transferred from the Shift Register to SPI_RDR, the data
in SPI_TDR is loaded in the Shift Register and a new transfer starts.
The transfer of a data written in SPI_TDR in the Shift Register is indicated by the TDRE bit
(Transmit Data Register Empty) in the Status Register (SPI_SR). When new data is written in
SPI_TDR, this bit is cleared. The TDRE bit is used to trigger the Transmit PDC channel.
The end of transfer is indicated by the TXEMPTY flag in the SPI_SR register. If a transfer delay
(DLYBCT) is greater than 0 for the last transfer, TXEMPTY is set after the completion of said
delay. The master clock (MCK) can be switched off at this time.
The transfer of received data from the Shift Register in SPI_RDR is indicated by the RDRF bit
(Receive Data Register Full) in the Status Register (SPI_SR). When the received data is read,
the RDRF bit is cleared.
If the SPI_RDR (Receive Data Register) has not been read before new data is received, the
Overrun Error bit (OVRES) in SPI_SR is set. As long as this flag is set, data is loaded in
SPI_RDR. The user has to read the status register to clear the OVRES bit.
Figure 32-5, shows a block diagram of the SPI when operating in Master Mode. Figure 32-6 on
page 430 shows a flow chart describing how transfers are handled.
SPI
Clock
SPI_CSR0..3
BITS SPI_RDR RDRF
NCPHA RD OVRES
CPOL
SPI_TDR
TD TDRE
SPI_CSR0..3
SPI_RDR
CSAAT PCS
PS
NPCS3
SPI_MR PCSDEC
PCS Current NPCS2
0 Peripheral
NPCS1
SPI_TDR
PCS NPCS0
1
MSTR
MODF
NPCS0
MODFDIS
429
6254C–ATARM–22-Jan-10
32.6.3.2 Master Mode Flow Diagram
Fixed
1 0 peripheral
CSAAT ? PS ?
Variable
0 1 peripheral
Fixed
0 peripheral yes
PS ? SPI_TDR(PCS) SPI_MR(PCS)
= NPCS ? = NPCS ?
Variable
1 peripheral no no
NPCS = SPI_TDR(PCS) NPCS = SPI_MR(PCS) NPCS = 0xF NPCS = 0xF
Delay DLYBS
Serializer = SPI_TDR(TD)
TDRE = 1
Data Transfer
SPI_RDR(RD) = Serializer
RDRF = 1
Delay DLYBCT
0
TDRE ?
1
CSAAT ?
NPCS = 0xF
Delay DLYBCS
Chip Select 1
Chip Select 2
SPCK
DLYBCS DLYBS DLYBCT DLYBCT
431
6254C–ATARM–22-Jan-10
• Variable Peripheral Select: Data can be exchanged with more than one peripheral
Fixed Peripheral Select is activated by writing the PS bit to zero in SPI_MR (Mode Register). In
this case, the current peripheral is defined by the PCS field in SPI_MR and the PCS field in the
SPI_TDR has no effect.
Variable Peripheral Select is activated by setting PS bit to one. The PCS field in SPI_TDR is
used to select the current peripheral. This means that the peripheral selection can be defined for
each new data.
The Fixed Peripheral Selection allows buffer transfers with a single peripheral. Using the PDC is
an optimal means, as the size of the data transfer between the memory and the SPI is either 8
bits or 16 bits. However, changing the peripheral selection requires the Mode Register to be
reprogrammed.
The Variable Peripheral Selection allows buffer transfers with multiple peripherals without repro-
gramming the Mode Register. Data written in SPI_TDR is 32 bits wide and defines the real data
to be transmitted and the peripheral it is destined to. Using the PDC in this mode requires 32-bit
wide buffers, with the data in the Lisps and the PCS and LASTXFER fields in the MSBs, how-
ever the SPI still controls the number of bits (8 to16) to be transferred through MISO and MOSI
lines with the chip select configuration registers. This is not the optimal means in term of mem-
ory size for the buffers, but it provides a very effective means to exchange data with several
peripherals without any intervention of the processor.
Figure 32-8 shows different peripheral deselction cases and the effect of the CSAAT bit.
TDRE
DLYBCT DLYBCT
NPCS[0..3] A A A A A
DLYBCS DLYBCS
PCS = A PCS = A
Write SPI_TDR
TDRE
DLYBCT DLYBCT
NPCS[0..3] A A A A A
DLYBCS DLYBCS
PCS=A PCS = A
Write SPI_TDR
TDRE
DLYBCT DLYBCT
NPCS[0..3] A B A B
DLYBCS DLYBCS
PCS = B PCS = B
Write SPI_TDR
433
6254C–ATARM–22-Jan-10
32.6.4 SPI Slave Mode
When operating in Slave Mode, the SPI processes data bits on the clock provided on the SPI
clock pin (SPCK).
The SPI waits for NSS to go active before receiving the serial clock from an external master.
When NSS falls, the clock is validated on the serializer, which processes the number of bits
defined by the BITS field of the Chip Select Register 0 (SPI_CSR0). These bits are processed
following a phase and a polarity defined respectively by the NCPHA and CPOL bits of the
SPI_CSR0. Note that BITS, CPOL and NCPHA of the other Chip Select Registers have no
effect when the SPI is programmed in Slave Mode.
The bits are shifted out on the MISO line and sampled on the MOSI line.
(Note:)
(For more information on BITS field, see also, the below the register table; Section 32.7.9
“SPI Chip Select Register” on page 447.)
When all the bits are processed, the received data is transferred in the Receive Data Register
and the RDRF bit rises. If the SPI_RDR (Receive Data Register) has not been read before new
data is received, the Overrun Error bit (OVRES) in SPI_SR is set. As long as this flag is set, data
is loaded in SPI_RDR. The user has to read the status register to clear the OVRES bit.
When a transfer starts, the data shifted out is the data present in the Shift Register. If no data
has been written in the Transmit Data Register (SPI_TDR), the last data received is transferred.
If no data has been received since the last reset, all bits are transmitted low, as the Shift Regis-
ter resets at 0.
When a first data is written in SPI_TDR, it is transferred immediately in the Shift Register and the
TDRE bit rises. If new data is written, it remains in SPI_TDR until a transfer occurs, i.e. NSS falls
and there is a valid clock on the SPCK pin. When the transfer occurs, the last data written in
SPI_TDR is transferred in the Shift Register and the TDRE bit rises. This enables frequent
updates of critical variables with single transfers.
Then, a new data is loaded in the Shift Register from the Transmit Data Register. In case no
character is ready to be transmitted, i.e. no character has been written in SPI_TDR since the last
load from SPI_TDR to the Shift Register, the Shift Register is not modified and the last received
character is retransmitted.
Figure 32-9 shows a block diagram of the SPI when operating in Slave Mode.
NSS SPI
Clock
SPIEN
SPIENS
SPIDIS
SPI_CSR0
BITS SPI_RDR RDRF
NCPHA RD OVRES
CPOL
SPI_TDR
TD TDRE
435
6254C–ATARM–22-Jan-10
32.7 Serial Peripheral Interface (SPI) User Interface
Table 32-3. Register Mapping
Offset Register Name Access Reset
0x00 Control Register SPI_CR Write-only ---
0x04 Mode Register SPI_MR Read-write 0x0
0x08 Receive Data Register SPI_RDR Read-only 0x0
0x0C Transmit Data Register SPI_TDR Write-only ---
0x10 Status Register SPI_SR Read-only 0x000000F0
0x14 Interrupt Enable Register SPI_IER Write-only ---
0x18 Interrupt Disable Register SPI_IDR Write-only ---
0x1C Interrupt Mask Register SPI_IMR Read-only 0x0
0x20 - 0x2C Reserved
0x30 Chip Select Register 0 SPI_CSR0 Read-write 0x0
0x34 Chip Select Register 1 SPI_CSR1 Read-write 0x0
0x38 Chip Select Register 2 SPI_CSR2 Read-write 0x0
0x3C Chip Select Register 3 SPI_CSR3 Read-write 0x0
0x004C - 0x00F8 Reserved – – –
0x004C - 0x00FC Reserved – – –
0x100 - 0x124 Reserved for the PDC
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
437
6254C–ATARM–22-Jan-10
32.7.2 SPI Mode Register
Name: SPI_MR
Addresses: 0xFFFC8004 (0), 0xFFFCC004 (1)
Access Type: Read/Write
31 30 29 28 27 26 25 24
DLYBCS
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 – 0 MODFDIS – PCSDEC PS MSTR
DLYBCS
Delay Between Chip Selects = -------------------------
MCK
439
6254C–ATARM–22-Jan-10
32.7.3 SPI Receive Data Register
Name: SPI_RDR
Addresses: 0xFFFC8008 (0), 0xFFFCC008 (1)
Access Type: Read-only
31 30 29 28 27 26 25 24
– – – – – – – –
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
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
441
6254C–ATARM–22-Jan-10
32.7.5 SPI Status Register
Name: SPI_SR
Addresses: 0xFFFC8010 (0), 0xFFFCC010 (1)
Access Type: Read-only
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
– – – – – 0 TXEMPTY NSSR
7 6 5 4 3 2 1 0
TXBUFE RXBUFF ENDTX ENDRX OVRES MODF TDRE RDRF
Note: 1. SPI_RCR, SPI_RNCR, SPI_TCR, SPI_TNCR are physically located in the PDC.
443
6254C–ATARM–22-Jan-10
32.7.6 SPI Interrupt Enable Register
Name: SPI_IER
Addresses: 0xFFFC8014 (0), 0xFFFCC014 (1)
Access Type: Write-only
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – 0 TXEMPTY NSSR
7 6 5 4 3 2 1 0
TXBUFE RXBUFF ENDTX ENDRX OVRES MODF TDRE RDRF
0 = No effect.
1 = Enables the corresponding interrupt.
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – 0 TXEMPTY NSSR
7 6 5 4 3 2 1 0
TXBUFE RXBUFF ENDTX ENDRX OVRES MODF TDRE RDRF
0 = No effect.
1 = Disables the corresponding interrupt.
445
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – 0 TXEMPTY NSSR
7 6 5 4 3 2 1 0
TXBUFE RXBUFF ENDTX ENDRX OVRES MODF TDRE RDRF
446
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
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 CSAAT – NCPHA CPOL
Note: SPI_CSRx registers must be written even if the user wants to use the defaults. The BITS field will not be updated with the trans-
lated value unless the register is written.
• BITS: Bits Per Transfer (See the (Note:) below the register table; Section 32.7.9 “SPI Chip Select Register” on page 447.)
The BITS field determines the number of data bits transferred. Reserved values should not be used.
447
6254C–ATARM–22-Jan-10
BITS Bits Per Transfer
1000 16
1001 Reserved
1010 Reserved
1011 Reserved
1100 Reserved
1101 Reserved
1110 Reserved
1111 Reserved
MCK
SPCK Baudrate = -----------------
SCBR
Programming the SCBR field at 0 is forbidden. Triggering a transfer while SCBR is at 0 can lead to unpredictable results.
At reset, SCBR is 0 and the user has to program it at a valid value before performing the first transfer.
DLYBS
Delay Before SPCK = ---------------------
MCK
32 × DLYBCT-
Delay Between Consecutive Transfers = --------------------------------------
MCK
33.1 Description
The Atmel Two-wire Interface (TWI) interconnects components on a unique two-wire bus, made
up of one clock line and one data line with speeds of up to 400 Kbits per second, based on a
byte-oriented transfer format. It can be used with any Atmel Two-wire Interface bus Serial
EEPROM and IðC compatible device such as Real Time Clock (RTC), Dot Matrix/Graphic LCD
Controllers and Temperature Sensor, to name but a few. The TWI is programmable as a master
or a slave with sequential or single-byte access. Multiple master capability is supported. Arbitra-
tion of the bus is performed internally and puts the TWI in slave mode automatically if the bus
arbitration is lost.
A configurable baud rate generator permits the output data rate to be adapted to a wide range of
core clock frequencies.
Below, Table 33-1 lists the compatibility level of the Atmel Two-wire Interface in Master Mode and
a full I2C compatible device.
449
6254C–ATARM–22-Jan-10
Table 33-2. Abbreviations
Abbreviation Description
ADR Any address except SADR
R Read
W Write
APB Bridge
TWCK
PIO
Two-wire TWD
Interface
MCK
PMC
TWI
Interrupt
AIC
Rp Rp
TWD
Host with
TWI
Interface TWCK
33.5.3 Interrupt
The TWI interface has an interrupt line connected to the Advanced Interrupt Controller (AIC). In
order to handle interrupts, the AIC must be programmed before configuring the TWI.
TWD
TWCK
Start Stop
TWD
TWCK
33.7.1 Definition
The Master is the device that starts a transfer, generates a clock and stops it.
Rp Rp
TWD
Host with
TWI
Interface TWCK
TXCOMP
TXRDY
TWCK
TXCOMP
TXRDY
TWCK
TXCOMP
TXRDY
TXCOMP
Read RHR
TXCOMP
Write START Bit
RXRDY
•S Start
• Sr Repeated Start
•P Stop
•W Write
•R Read
•A Acknowledge
•N Not Acknowledge
• DADR Device Address
• IADR Internal Address
Figure 33-12. Master Read with One, Two or Three Bytes Internal Address and One Data Byte
Three bytes internal address
TWD S DADR W A IADR(23:16) A IADR(15:8) A IADR(7:0) A Sr DADR R A
DATA N P
M LR A M A LA A
S S / C S C SC C
B BW K B K BK K
TXCOMP
TXRDY
BEGIN
No
TXRDY = 1?
Yes
No
TXCOMP = 1?
Yes
Transfer finished
BEGIN
No
TXRDY = 1?
Yes
TXCOMP = 1?
No
Yes
Transfer finished
BEGIN
No
Internal address size = 0?
Yes
Data to send?
Yes
Yes
No
TXCOMP = 1?
END
BEGIN
No
RXRDY = 1?
Yes
No
TXCOMP = 1?
Yes
END
BEGIN
No
RXRDY = 1?
Yes
No
TXCOMP = 1?
Yes
END
No
RXRDY = 1?
Yes
Yes
No
RXRDY = 1?
Yes
No
TXCOMP = 1?
Yes
END
33.8.1 Definition
More than one master may handle the bus at the same time without data corruption by using
arbitration.
Arbitration starts as soon as two or more masters place information on the bus at the same time,
and stops (arbitration is lost) for the master that intends to send a logical one while the other
master sends a logical zero.
As soon as arbitration is lost by a master, it stops sending data and listens to the bus in order to
detect a stop. When the stop is detected, the master who has lost arbitration may put its data on
the bus by respecting arbitration.
Arbitration is illustrated in Figure 33-22 on page 466.
TWCK
TWCK
TWD
TWCK
Arbitration is lost
Data from a Master S 1 0 0 1 1 P S 1 0 1
The master stops sending data
Arbitration is lost
Data from TWI S 1 0 1 S 1 0 0 1 1
TWI stops sending data
ARBLST
Bus is busy Bus is free
The flowchart shown in Figure 33-23 on page 467 gives an example of read and write operations
in Multi-master mode.
START
Yes No
SVACC = 1 ? GACC = 1 ?
No
No SVREAD = 0 ?
No No
EOSACC = 1 ? Yes TXRDY= 1 ?
Yes Yes
No Write in TWI_THR
TXCOMP = 1 ? No
RXRDY= 0 ?
Yes
Yes
Prog seq No
OK ?
Change SADR
Yes No
ARBLST = 1 ?
Yes No
MREAD = 1 ?
Yes Yes
RXRDY= 0 ? TXRDY= 0 ?
No No
Yes Yes
Read TWI_RHR Data to read? Data to send ? Write in TWI_THR
No No
Stop Transfer
TWI_CR = STOP
Yes No
TXCOMP = 0 ?
33.9.1 Definition
The Slave Mode is defined as a mode where the device receives the clock and the address from
another device called the master.
In this mode, the device never initiates and never completes the transmission (START,
REPEATED_START and STOP conditions are always provided by the master).
VDD
R R
Master
TWD
Host with
TWI
Interface TWCK
33.9.4.5 PDC
As it is impossible to know the exact number of data to receive/send, the use of PDC is NOT rec-
ommended in SLAVE mode.
TXRDY
Write THR Read RHR
NACK
SVACC
SVREAD SVREAD has to be taken into account only while SVACC is active
EOSVACC
RXRDY
SVACC
SVREAD SVREAD has to be taken into account only while SVACC is active
EOSVACC
TXD S GENERAL CALL A Reset or write DADD A DATA1 A DATA2 A New SADR A P
New SADR
Programming sequence
GCACC
Reset after read
SVACC
Note: This method allows the user to create an own programming sequence by choosing the program-
ming bytes and the number of them. The programming sequence has to be provided to the
master.
TWCK
CLOCK is tied low by the TWI
as long as THR is empty
Write THR
SCLWS
TXRDY
SVACC
SVREAD
As soon as a START is detected
TXCOMP
TWI_THR is transmitted to the shift register Ack or Nack from the master
Notes: 1. TXRDY is reset when data has been written in the TWI_THR to the shift register and set when this data has been acknowl-
edged or non acknowledged.
2. At the end of the read sequence, TXCOMP is set after a STOP or after a REPEATED_START + an address different from
SADR.
3. SCLWS is automatically set when the clock synchronization mechanism is started.
TWCK
CLOCK is tied low by the TWI as long as RHR is full
SCLWS
SCL is stretched on the last bit of DATA1
RXRDY
Rd DATA0 Rd DATA1 Rd DATA2
SVACC
SVREAD
As soon as a START is detected
TXCOMP
Notes: 1. At the end of the read sequence, TXCOMP is set after a STOP or after a REPEATED_START + an address different from
SADR.
2. SCLWS is automatically set when the clock synchronization mechanism is started and automatically reset when the mecha-
nism is finished.
TWI_THR
DATA0 DATA1
SVACC
SVREAD
TXRDY
RXRDY
EOSACC Cleared after read
TXCOMP As soon as a START is detected
1. TXCOMP is only set at the end of the transmission because after the repeated start, SADR is detected again.
SVACC
SVREAD
TXRDY
RXRDY
Read TWI_RHR
EOSACC Cleared after read
Notes: 1. In this case, if TWI_THR has not been written at the end of the read command, the clock is automatically stretched before
the ACK.
2. TXCOMP is only set at the end of the transmission because after the repeated start, SADR is detected again.
No
SVACC = 1 ? GACC = 1 ?
No SVREAD = 0 ?
No No
EOSACC = 1 ? No TXRDY= 1 ?
No Write in TWI_THR
TXCOMP = 1 ?
No
RXRDY= 0 ?
END
Read TWI_RHR
Decoding of the
programming sequence
Prog seq No
OK ?
Change SADR
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 QUICK SVDIS SVEN MSDIS MSEN STOP START
23 22 21 20 19 18 17 16
– DADR
15 14 13 12 11 10 9 8
– – – MREAD – – IADRSZ
7 6 5 4 3 2 1 0
– – – – – – – –
IADRSZ[9:8]
0 0 No internal device address
0 1 One-byte internal device address
1 0 Two-byte internal device address
1 1 Three-byte internal device address
23 22 21 20 19 18 17 16
– SADR
15 14 13 12 11 10 9 8
– – – – – –
7 6 5 4 3 2 1 0
– – – – – – – –
23 22 21 20 19 18 17 16
IADR
15 14 13 12 11 10 9 8
IADR
7 6 5 4 3 2 1 0
IADR
23 22 21 20 19 18 17 16
CKDIV
15 14 13 12 11 10 9 8
CHDIV
7 6 5 4 3 2 1 0
CLDIV
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
TXBUFE RXBUFF ENDTX ENDRX EOSACC SCLWS ARBLST NACK
7 6 5 4 3 2 1 0
– OVRE GACC SVACC SVREAD TXRDY RXRDY TXCOMP
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
TXBUFE RXBUFF ENDTX ENDRX EOSACC SCL_WS ARBLST NACK
7 6 5 4 3 2 1 0
– OVRE GACC SVACC – TXRDY RXRDY TXCOMP
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
TXBUFE RXBUFF ENDTX ENDRX EOSACC SCL_WS ARBLST NACK
7 6 5 4 3 2 1 0
– OVRE GACC SVACC – TXRDY RXRDY TXCOMP
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
TXBUFE RXBUFF ENDTX ENDRX EOSACC SCL_WS ARBLST NACK
7 6 5 4 3 2 1 0
– OVRE GACC SVACC – TXRDY RXRDY TXCOMP
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
RXDATA
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
TXDATA
34.1 Description
The Universal Synchronous Asynchronous Receiver Transceiver (USART) provides one full
duplex universal synchronous asynchronous serial link. Data frame format is widely programma-
ble (data length, parity, number of stop bits) to support a maximum of standards. The receiver
implements parity error, framing error and overrun error detection. The receiver time-out enables
handling variable-length frames and the transmitter timeguard facilitates communications with
slow remote devices. Multidrop communications are also supported through address bit han-
dling in reception and transmission.
The USART features three test modes: remote loopback, local loopback and automatic echo.
The USART supports specific operating modes providing interfaces on RS485 buses, with
ISO7816 T = 0 or T = 1 smart card slots, infrared transceivers and connection to modem ports.
The hardware handshaking feature enables an out-of-band flow control by automatic manage-
ment of the pins RTS and CTS.
The USART supports the connection to the Peripheral DMA Controller, which enables data
transfers to the transmitter and from the receiver. The PDC provides chained buffer manage-
ment without any intervention of the processor.
491
6254C–ATARM–22-Jan-10
34.2 Block Diagram
Peripheral DMA
Controller
Channel Channel
PIO
USART Controller
RXD
Receiver
RTS
DTR
PMC Modem
MCK Signals DSR
Control
MCK/DIV DCD
DIV
RI
SLCK SCK
Baud Rate
Generator
User Interface
APB
PPP IrLAP
Field Bus EMV
Modem Serial Driver Driver IrDA
Driver Driver Driver
USART
493
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
494
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
34.5.3 Interrupt
The USART interrupt line is connected on one of the internal sources of the Advanced Interrupt
Controller. Using the USART interrupt requires the AIC to be programmed first. Note that it is not
recommended to use the USART interrupt line in edge sensitive mode.
495
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
496
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
USCLKS CD
MCK CD
0 SCK
MCK/DIV
1
Reserved 16-bit Counter
SCK 2 FIDI
>1 SYNC
3 OVER
1 0
0 0 Sampling 0
Divider
Baud Rate
1 Clock
1
SYNC
Sampling
USCLKS = 3 Clock
SelectedClock-
Baudrate = ---------------------------------------------
( 8 ( 2 – Over )CD )
This gives a maximum baud rate of MCK divided by 8, assuming that MCK is the highest possi-
ble clock and that OVER is programmed at 1.
497
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
ExpectedBaudRate
Error = 1 – ⎛⎝ ---------------------------------------------------------⎞⎠
ActualBaudRate
498
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
clock divider. This feature is only available when using USART normal mode. The fractional
Baud Rate is calculated using the following formula:
SelectedClock
Baudrate = ------------------------------------------------------------------
⎛ 8 ( 2 – Over ) ⎛ CD + FP --------⎞⎠ ⎞⎠
⎝ ⎝ 8
USCLKS Modulus
CD
Control
FP
MCK CD
0 SCK
MCK/DIV
1
Reserved 16-bit Counter
SCK 2 glitch-free FIDI
logic >1 SYNC
3 OVER
1 0
0 0 Sampling 0
Divider
Baud Rate
1 Clock
1
SYNC Sampling
USCLKS = 3 Clock
BaudRate = SelectedClock
-----------------------------------------
CD
In synchronous mode, if the external clock is selected (USCLKS = 3), the clock is provided
directly by the signal on the USART SCK pin. No division is active. The value written in
US_BRGR has no effect. The external clock frequency must be at least 4.5 times lower than the
system clock.
When either the external clock SCK or the internal clock divided (MCK/DIV) is selected, the
value programmed in CD must be even if the user has to ensure a 50:50 mark/space ratio on the
SCK pin. If the internal clock MCK is selected, the Baud Rate Generator ensures a 50:50 duty
cycle on the SCK pin, even if the value programmed in CD is odd.
499
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Di
B = ------ × f
Fi
where:
• B is the bit rate
• Di is the bit-rate adjustment factor
• Fi is the clock frequency division factor
• f is the ISO7816 clock frequency (Hz)
Di is a binary value encoded on a 4-bit field, named DI, as represented in Table 34-3.
Fi is a binary value encoded on a 4-bit field, named FI, as represented in Table 34-4.
Table 34-5 shows the resulting Fi/Di Ratio, which is the ratio between the ISO7816 clock and the
baud rate clock.
500
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
ISO7816 Clock
on SCK
1 ETU
501
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Baud Rate
Clock
TXD
The characters are sent by writing in the Transmit Holding Register (US_THR). The transmitter
reports two status bits in the Channel Status Register (US_CSR): TXRDY (Transmitter Ready),
which indicates that US_THR is empty and TXEMPTY, which indicates that all the characters
written in US_THR have been processed. When the current character processing is completed,
the last character written in US_THR is transferred into the Shift Register of the transmitter and
US_THR becomes empty, thus TXRDY rises.
Both TXRDY and TXEMPTY bits are low when the transmitter is disabled. Writing a character in
US_THR while TXRDY is low has no effect and the written character is lost.
TXD
Start Parity Stop Start Parity Stop
D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7
Bit Bit Bit Bit Bit Bit
Write
US_THR
TXRDY
TXEMPTY
502
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
The Manchester encoded character can also be encapsulated by adding both a configurable
preamble and a start frame delimiter pattern. Depending on the configuration, the preamble is a
training sequence, composed of a pre-defined pattern with a programmable length from 1 to 15
bit times. If the preamble length is set to 0, the preamble waveform is not generated prior to any
character. The preamble pattern is chosen among the following sequences: ALL_ONE,
ALL_ZERO, ONE_ZERO or ZERO_ONE, writing the field TX_PP in the US_MAN register, the
field TX_PL is used to configure the preamble length. Figure 34-9 illustrates and defines the
valid patterns. To improve flexibility, the encoding scheme can be configured using the
TX_MPOL field in the US_MAN register. If the TX_MPOL field is set to zero (default), a logic
zero is encoded with a zero-to-one transition and a logic one is encoded with a one-to-zero tran-
sition. If the TX_MPOL field is set to one, a logic one is encoded with a one-to-zero transition
and a logic zero is encoded with a zero-to-one transition.
Manchester
encoded SFD DATA
data Txd
Manchester
encoded SFD DATA
data Txd
Manchester
encoded SFD
Txd DATA
data
Manchester
encoded SFD DATA
data Txd
A start frame delimiter is to be configured using the ONEBIT field in the US_MR register. It con-
sists of a user-defined pattern that indicates the beginning of a valid data. Figure 34-10
illustrates these patterns. If the start frame delimiter, also known as start bit, is one bit, (ONEBIT
at 1), a logic zero is Manchester encoded and indicates that a new character is being sent seri-
ally on the line. If the start frame delimiter is a synchronization pattern also referred to as sync
(ONEBIT at 0), a sequence of 3 bit times is sent serially on the line to indicate the start of a new
503
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
character. The sync waveform is in itself an invalid Manchester waveform as the transition
occurs at the middle of the second bit time. Two distinct sync patterns are used: the command
sync and the data sync. The command sync has a logic one level for one and a half bit times,
then a transition to logic zero for the second one and a half bit times. If the MODSYNC field in
the US_MR register is set to 1, the next character is a command. If it is set to 0, the next charac-
ter is a data. When direct memory access is used, the MODSYNC field can be immediately
updated with a modified character located in memory. To enable this mode, VAR_SYNC field in
US_MR register must be set to 1. In this case, the MODSYNC field in US_MR is bypassed and
the sync configuration is held in the TXSYNH in the US_THR register. The USART character for-
mat is modified and includes sync information.
SFD
Manchester
encoded DATA
data Txd
Command Sync
start frame delimiter
SFD
Manchester
encoded DATA
data Txd
Data Sync
start frame delimiter
504
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Oversampling
16x Clock
RXD
Sampling
point
Expected edge
Synchro. Tolerance Sync Synchro.
Synchro. Jump Jump Error
Error
505
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Sampling
Clock (x16)
RXD
Sampling
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
D0
Start Sampling
Detection
RXD
Sampling
1 2 3 4 5 6 7 0 1 2 3 4
Start
Rejection
Baud Rate
Clock
RXD
Start 16 16 16 16 16 16 16 16 16 16
Detection samples samples samples samples samples samples samples samples samples samples
D0 D1 D2 D3 D4 D5 D6 D7 Parity Stop
Bit Bit
506
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
The receiver is activated and starts Preamble and Frame Delimiter detection, sampling the data
at one quarter and then three quarters. If a valid preamble pattern or start frame delimiter is
detected, the receiver continues decoding with the same synchronization. If the stream does not
match a valid pattern or a valid start frame delimiter, the receiver re-synchronizes on the next
valid edge.The minimum time threshold to estimate the bit value is three quarters of a bit time.
If a valid preamble (if used) followed with a valid start frame delimiter is detected, the incoming
stream is decoded into NRZ data and passed to USART for processing. Figure 34-15 illustrates
Manchester pattern mismatch. When incoming data stream is passed to the USART, the
receiver is also able to detect Manchester code violation. A code violation is a lack of transition
in the middle of a bit cell. In this case, MANE flag in US_CSR register is raised. It is cleared by
writing the Control Register (US_CR) with the RSTSTA bit at 1. See Figure 34-16 for an exam-
ple of Manchester error detection during data phase.
Manchester
encoded SFD DATA
data Txd
sampling points
507
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
When the start frame delimiter is a sync pattern (ONEBIT field at 0), both command and data
delimiter are supported. If a valid sync is detected, the received character is written as RXCHR
field in the US_RHR register and the RXSYNH is updated. RXCHR is set to 1 when the received
character is a command, and it is set to 0 if the received character is a data. This mechanism
alleviates and simplifies the direct memory access as the character contains its own sync field in
the same register.
As the decoder is setup to be used in unipolar mode, the first bit of the frame has to be a zero-to-
one transition.
ASK/FSK
Upstream Receiver
Upstream
LNA Serial
Emitter VCO Configuration
RF filter Interface
Demod
ASK/FSK
downstream transmitter
Manchester USART
Downstream encoder Emitter
Receiver PA
RF filter
Mod
VCO
control
508
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
From the receiver side, another carrier frequency is used. The RF receiver performs a bit check
operation examining demodulated data stream. If a valid pattern is detected, the receiver
switches to receiving mode. The demodulated stream is sent to the Manchester decoder.
Because of bit checking inside RF IC, the data transferred to the microcontroller is reduced by a
user-defined number of bits. The Manchester preamble length is to be defined in accordance
with the RF IC configuration.
Manchester
encoded
data Txd
default polarity
unipolar output
FSK Modulator
Output
Uptstream Frequencies
[F0, F0+offset]
509
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Baud Rate
Clock
RXD
Sampling
Start D0 D1 D2 D3 D4 D5 D6 D7 Stop Bit
Parity Bit
Baud Rate
Clock
RXD
Start Parity Stop Start Parity Stop
D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7
Bit Bit Bit Bit Bit Bit
RSTSTA = 1
Write
US_CR
Read
US_RHR
RXRDY
OVRE
510
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
34.6.3.9 Parity
The USART supports five parity modes selected by programming the PAR field in the Mode
Register (US_MR). The PAR field also enables the Multidrop mode, see “Multidrop Mode” on
page 512. Even and odd parity bit generation and error detection are supported.
If even parity is selected, the parity generator of the transmitter drives the parity bit at 0 if a num-
ber of 1s in the character data bit is even, and at 1 if the number of 1s is odd. Accordingly, the
receiver parity checker counts the number of received 1s and reports a parity error if the sam-
pled parity bit does not correspond. If odd parity is selected, the parity generator of the
transmitter drives the parity bit at 1 if a number of 1s in the character data bit is even, and at 0 if
the number of 1s is odd. Accordingly, the receiver parity checker counts the number of received
1s and reports a parity error if the sampled parity bit does not correspond. If the mark parity is
used, the parity generator of the transmitter drives the parity bit at 1 for all characters. The
receiver parity checker reports an error if the parity bit is sampled at 0. If the space parity is
used, the parity generator of the transmitter drives the parity bit at 0 for all characters. The
receiver parity checker reports an error if the parity bit is sampled at 1. If parity is disabled, the
transmitter does not generate any parity bit and the receiver does not report any parity error.
Table 34-6 shows an example of the parity bit for the character 0x41 (character ASCII “A”)
depending on the configuration of the USART. Because there are two bits at 1, 1 bit is added
when a parity is odd, or 0 is added when a parity is even.
When the receiver detects a parity error, it sets the PARE (Parity Error) bit in the Channel Status
Register (US_CSR). The PARE bit can be cleared by writing the Control Register (US_CR) with
the RSTSTA bit at 1. Figure 34-22 illustrates the parity bit status setting and clearing.
511
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Baud Rate
Clock
RXD
Start Bad Stop
D0 D1 D2 D3 D4 D5 D6 D7
Bit Parity Bit
Bit RSTSTA = 1
Write
US_CR
PARE
RXRDY
512
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
TXD
Start Parity Stop Start Parity Stop
D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7
Bit Bit Bit Bit Bit Bit
Write
US_THR
TXRDY
TXEMPTY
Table 34-7 indicates the maximum length of a timeguard period that the transmitter can handle
in relation to the function of the Baud Rate.
513
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
on RXD before a new character is received will not provide a time-out. This prevents having
to handle an interrupt before a character is received and allows waiting for the next idle state
on RXD after a frame is received.
• Obtain an interrupt while no character is received. This is performed by writing US_CR with
the RETTO (Reload and Start Time-out) bit at 1. If RETTO is performed, the counter starts
counting down immediately from the value TO. This enables generation of a periodic interrupt
so that a user time-out can be handled, for example when no key is pressed on a keyboard.
If STTTO is performed, the counter clock is stopped until a first character is received. The idle
state on RXD before the start of the frame does not provide a time-out. This prevents having to
obtain a periodic interrupt and enables a wait of the end of frame when the idle state on RXD is
detected.
If RETTO is performed, the counter starts counting down immediately from the value TO. This
enables generation of a periodic interrupt so that a user time-out can be handled, for example
when no key is pressed on a keyboard.
Figure 34-24 shows the block diagram of the Receiver Time-out feature.
Baud Rate TO
Clock
16-bit
Value
1 D Q Clock 16-bit Time-out
Counter
STTTO = TIMEOUT
Load 0
Clear
Character
Received
RETTO
Table 34-8 gives the maximum time-out period for some standard baud rates.
514
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Baud Rate
Clock
RXD
Start Parity Stop
D0 D1 D2 D3 D4 D5 D6 D7
Bit Bit Bit
RSTSTA = 1
Write
US_CR
FRAME
RXRDY
515
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
The transmitter considers the break as though it is a character, i.e. the STTBRK and STPBRK
commands are taken into account only if the TXRDY bit in US_CSR is at 1 and the start of the
break condition clears the TXRDY and TXEMPTY bits as if a character is processed.
Writing US_CR with the both STTBRK and STPBRK bits at 1 can lead to an unpredictable
result. 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, is
ignored.
After the break condition, the transmitter returns the TXD line to 1 for a minimum of 12 bit times.
Thus, the transmitter ensures that the remote receiver detects correctly the end of break and the
start of the next character. If the timeguard is programmed with a value higher than 12, the TXD
line is held high for the timeguard period.
After holding the TXD line for this period, the transmitter resumes normal operations.
Figure 34-26 illustrates the effect of both the Start Break (STTBRK) and Stop Break (STPBRK)
commands on the TXD line.
Baud Rate
Clock
TXD
Start Parity Stop
Bit
D0 D1 D2 D3 D4 D5 D6 D7
Bit Bit
Break Transmission End of Break
STTBRK = 1 STPBRK = 1
Write
US_CR
TXRDY
TXEMPTY
516
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
USART Remote
Device
TXD RXD
RXD TXD
CTS RTS
RTS CTS
Setting the USART to operate with hardware handshaking is performed by writing the
USART_MODE field in the Mode Register (US_MR) to the value 0x2.
The USART behavior when hardware handshaking is enabled is the same as the behavior in
standard synchronous or asynchronous mode, except that the receiver drives the RTS pin as
described below and the level on the CTS pin modifies the behavior of the transmitter as
described below. Using this mode requires using the PDC channel for reception. The transmitter
can handle hardware handshaking in any case.
Figure 34-28 shows how the receiver operates if hardware handshaking is enabled. The RTS
pin is driven high if the receiver is disabled and if the status RXBUFF (Receive Buffer Full) com-
ing from the PDC channel is high. Normally, the remote device does not start transmitting while
its CTS pin (driven by RTS) is high. As soon as the Receiver is enabled, the RTS falls, indicating
to the remote device that it can start transmitting. Defining a new buffer to the PDC clears the
status bit RXBUFF and, as a result, asserts the pin RTS low.
RXD
RXEN = 1 RXDIS = 1
Write
US_CR
RTS
RXBUFF
Figure 34-29 shows how the transmitter operates if hardware handshaking is enabled. The CTS
pin disables the transmitter. If a character is being processing, the transmitter is disabled only
after the completion of the current character and transmission of the next character happens as
soon as the pin CTS falls.
CTS
TXD
517
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
USART
CLK
SCK Smart
Card
I/O
TXD
When operating in ISO7816, either in T = 0 or T = 1 modes, the character format is fixed. The
configuration is 8 data bits, even parity and 1 or 2 stop bits, regardless of the values pro-
grammed in the CHRL, MODE9, PAR and CHMODE fields. MSBF can be used to transmit LSB
or MSB first. Parity Bit (PAR) can be used to transmit in normal or inverse mode. Refer to
“USART Mode Register” on page 530 and “PAR: Parity Type” on page 531.
The USART cannot operate concurrently in both receiver and transmitter modes as the commu-
nication is unidirectional at a time. It has to be configured according to the required mode by
enabling or disabling either the receiver or the transmitter as desired. Enabling both the receiver
and the transmitter at the same time in ISO7816 mode may lead to unpredictable results.
The ISO7816 specification defines an inverse transmission format. Data bits of the character
must be transmitted on the I/O line at their negative value. The USART does not support this for-
mat and the user has to perform an exclusive OR on the data before writing it in the Transmit
Holding Register (US_THR) or after reading it in the Receive Holding Register (US_RHR).
34.6.4.2 Protocol T = 0
In T = 0 protocol, a character is made up of one start bit, eight data bits, one parity bit and one
guard time, which lasts two bit times. The transmitter shifts out the bits and does not drive the
I/O line during the guard time.
If no parity error is detected, the I/O line remains at 1 during the guard time and the transmitter
can continue with the transmission of the next character, as shown in Figure 34-31.
518
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
If a parity error is detected by the receiver, it drives the I/O line at 0 during the guard time, as
shown in Figure 34-32. This error bit is also named NACK, for Non Acknowledge. In this case,
the character lasts 1 bit time more, as the guard time length is the same and is added to the
error bit time which lasts 1 bit time.
When the USART is the receiver and it detects an error, it does not load the erroneous character
in the Receive Holding Register (US_RHR). It appropriately sets the PARE bit in the Status Reg-
ister (US_SR) so that the software can handle the error.
RXD
I/O Error
519
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
When the USART repetition number reaches MAX_ITERATION, the ITERATION bit is set in the
Channel Status Register (US_CSR). If the repetition of the character is acknowledged by the
receiver, the repetitions are stopped and the iteration counter is cleared.
The ITERATION bit in US_CSR can be cleared by writing the Control Register with the RSIT bit
at 1.
34.6.4.7 Protocol T = 1
When operating in ISO7816 protocol T = 1, the transmission is similar to an asynchronous for-
mat with only one stop bit. The parity is generated when transmitting and checked when
receiving. Parity error detection sets the PARE bit in the Channel Status Register (US_CSR).
USART IrDA
Transceivers
Receiver Demodulator RXD RX
TX
Transmitter Modulator TXD
The receiver and the transmitter must be enabled or disabled according to the direction of the
transmission to be managed.
To receive IrDA signals, the following needs to be done:
• Disable TX and Enable RX
520
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
• Configure the TXD pin as PIO and set it as an output at 0 (to avoid LED emission). Disable
the internal pull-up (better for power consumption).
• Receive data
TXD
Bit Period 3
16 Bit Period
521
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
RXD
Counter
Value 6 5 4 3 2 6 6 5 4 3 2 1 0
Pulse Pulse
Rejected Accepted
Receiver
Input
As the IrDA mode uses the same logic as the ISO7816, note that the FI_DI_RATIO field in
US_FIDI must be set to a value higher than 0 in order to assure IrDA communications operate
correctly.
522
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
USART
RXD
Differential
TXD Bus
RTS
The USART is set in RS485 mode by programming the USART_MODE field in the Mode Regis-
ter (US_MR) to the value 0x1.
The RTS pin is at a level inverse to the TXEMPTY bit. Significantly, the RTS pin remains high
when a timeguard is programmed so that the line can remain driven after the last character com-
pletion. Figure 34-37 gives an example of the RTS waveform during a character transmission
when the timeguard is enabled.
TXD
Start Parity Stop
D0 D1 D2 D3 D4 D5 D6 D7
Bit Bit Bit
Write
US_THR
TXRDY
TXEMPTY
RTS
523
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
The control of the DTR output pin is performed by writing the Control Register (US_CR) with the
DTRDIS and DTREN bits respectively at 1. The disable command forces the corresponding pin
to its inactive level, i.e. high. The enable command forces the corresponding pin to its active
level, i.e. low. RTS output pin is automatically controlled in this mode
The level changes are detected on the RI, DSR, DCD and CTS pins. If an input change is
detected, the RIIC, DSRIC, DCDIC and CTSIC bits in the Channel Status Register (US_CSR)
are set respectively and can trigger an interrupt. The status is automatically cleared when
US_CSR is read. Furthermore, the CTS automatically disables the transmitter when it is
detected at its inactive state. If a character is being transmitted when the CTS rises, the charac-
ter transmission is completed before the transmitter is actually disabled.
524
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
TXD
Transmitter
TXD
Transmitter
TXD
Transmitter 1
525
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
TXD
Transmitter
526
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
527
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – RTSDIS RTSEN DTRDIS DTREN
15 14 13 12 11 10 9 8
RETTO RSTNACK RSTIT SENDA STTTO STPBRK STTBRK RSTSTA
7 6 5 4 3 2 1 0
TXDIS TXEN RXDIS RXEN RSTTX RSTRX – –
528
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
529
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– VAR_SYNC DSNACK INACK OVER CLKO MODE9 MSBF
15 14 13 12 11 10 9 8
CHMODE NBSTOP PAR SYNC
7 6 5 4 3 2 1 0
CHRL USCLKS USART_MODE
• USART_MODE
530
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
531
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
• MAX_ITERATION
Defines the maximum number of iterations in mode ISO7816, protocol T= 0.
532
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – MANE CTSIC DCDIC DSRIC RIIC
15 14 13 12 11 10 9 8
– – NACK RXBUFF TXBUFE ITER TXEMPTY TIMEOUT
7 6 5 4 3 2 1 0
PARE FRAME OVRE ENDTX ENDRX RXBRK TXRDY RXRDY
533
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – MANE CTSIC DCDIC DSRIC RIIC
15 14 13 12 11 10 9 8
– – NACK RXBUFF TXBUFE ITER TXEMPTY TIMEOUT
7 6 5 4 3 2 1 0
PARE FRAME OVRE ENDTX ENDRX RXBRK TXRDY RXRDY
534
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – MANE CTSIC DCDIC DSRIC RIIC
15 14 13 12 11 10 9 8
– – NACK RXBUFF TXBUFE ITER TXEMPTY TIMEOUT
7 6 5 4 3 2 1 0
PARE FRAME OVRE ENDTX ENDRX RXBRK TXRDY RXRDY
535
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
CTS DCD DSR RI CTSIC DCDIC DSRIC RIIC
15 14 13 12 11 10 9 8
– – NACK RXBUFF TXBUFE ITER TXEMPTY TIMEOUT
7 6 5 4 3 2 1 0
PARE FRAME OVRE ENDTX ENDRX RXBRK TXRDY RXRDY
536
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
537
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
538
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
RXSYNH – – – – – – RXCHR
7 6 5 4 3 2 1 0
RXCHR
539
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
TXSYNH – – – – – – TXCHR
7 6 5 4 3 2 1 0
TXCHR
540
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – FP–
15 14 13 12 11 10 9 8
CD
7 6 5 4 3 2 1 0
CD
USART_MODE ≠ ISO7816
SYNC = 0 SYNC = 1
USART_MODE =
CD OVER = 0 OVER = 1 ISO7816
0 Baud Rate Clock Disabled
Baud Rate = Baud Rate = Baud Rate = Baud Rate = Selected
1 to 65535
Selected Clock/16/CD Selected Clock/8/CD Selected Clock /CD Clock/CD/FI_DI_RATIO
541
6254C–ATARM–22-Jan-10
34.7.10 USART Receiver Time-out Register
Name: US_RTOR
Addresses: 0xFFFB0024 (0), 0xFFFB4024 (1), 0xFFFB8024 (2), 0xFFFD0024 (3), 0xFFFD4024 (4)
Access Type: Read-write
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
TO
7 6 5 4 3 2 1 0
TO
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
543
6254C–ATARM–22-Jan-10
34.7.12 USART FI DI RATIO Register
Name: US_FIDI
Addresses: 0xFFFB0040 (0), 0xFFFB4040 (1), 0xFFFB8040 (2), 0xFFFD0040 (3), 0xFFFD4040 (4)
Access Type: Read-write
Reset Value: 0x174
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – FI_DI_RATIO
7 6 5 4 3 2 1 0
FI_DI_RATIO
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
NB_ERRORS
545
6254C–ATARM–22-Jan-10
34.7.14 USART IrDA FILTER Register
Name: US_IF
Addresses: 0xFFFB004C (0), 0xFFFB404C (1), 0xFFFB804C (2), 0xFFFD004C (3), 0xFFFD404C (4)
Access Type: Read-write
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
IRDA_FILTER
23 22 21 20 19 18 17 16
– – – – RX_PL
15 14 13 12 11 10 9 8
– – – TX_MPOL – – TX_PP
7 6 5 4 3 2 1 0
– – – – TX_PL
TX_PP Preamble Pattern default polarity assumed (TX_MPOL field not set)
0 0 ALL_ONE
0 1 ALL_ZERO
1 0 ZERO_ONE
1 1 ONE_ZERO
RX_PP Preamble Pattern default polarity assumed (RX_MPOL field not set)
0 0 ALL_ONE
0 1 ALL_ZERO
1 0 ZERO_ONE
1 1 ONE_ZERO
547
6254C–ATARM–22-Jan-10
• RX_MPOL: Receiver Manchester Polarity
0: Logic Zero is coded as a zero-to-one transition, Logic One is coded as a one-to-zero transition.
1: Logic Zero is coded as a one-to-zero transition, Logic One is coded as a zero-to-one transition.
35.1 Description
The Atmel Synchronous Serial Controller (SSC) provides a synchronous communication link
with external devices. It supports many serial synchronous communication protocols generally
used in audio and telecom applications such as I2S, Short Frame Sync, Long Frame Sync, etc.
The SSC contains an independent receiver and transmitter and a common clock divider. The
receiver and the transmitter each interface with three signals: the TD/RD signal for data, the
TK/RK signal for the clock and the TF/RF signal for the Frame Sync. The transfers can be pro-
grammed to start automatically or on different events detected on the Frame Sync signal.
The SSC’s high-level of programmability and its two dedicated PDC channels of up to 32 bits
permit a continuous high bit rate data transfer without processor intervention.
Featuring connection to two PDC channels, the SSC permits interfacing with low processor
overhead to the following:
• CODEC’s in master or slave mode
• DAC through dedicated serial interface, particularly I2S
• Magnetic card reader
549
6254C–ATARM–22-Jan-10
35.2 Block Diagram
System
Bus
APB Bridge
PDC
Peripheral
Bus
TF
TK
TD
MCK
PMC
SSC Interface PIO
RF
RK
Interrupt Control
RD
SSC Interrupt
SSC
35.5.3 Interrupt
The SSC interface has an interrupt line connected to the Advanced Interrupt Controller (AIC).
Handling interrupts requires programming the AIC before configuring the SSC.
All SSC interrupts can be enabled/disabled configuring the SSC Interrupt mask register. Each
pending and unmasked SSC interrupt will assert the SSC interrupt line. The SSC interrupt ser-
vice routine can get the interrupt origin by reading the SSC interrupt status register.
551
6254C–ATARM–22-Jan-10
Figure 35-3. SSC Functional Block Diagram
Transmitter
Clock Output
TK
Controller
TK Input
MCK Clock Transmit Clock TX clock Frame Sync TF
Divider Controller Controller
RX clock
TF
Start
RF Transmit Shift Register TD
Selector
TX PDC Transmit Holding Transmit Sync
Register Holding Register
APB
Load Shift
User
Interface
RK Input
Receive Clock RX Clock Frame Sync
Controller RF
Controller
TX Clock
RF
Start
TF Receive Shift Register RD
Selector
AIC
SSC_CMR
The Master Clock divider is determined by the 12-bit field DIV counter and comparator (so its
maximal value is 4095) in the Clock Mode Register SSC_CMR, allowing a Master Clock division
by up to 8190. The Divided Clock is provided to both the Receiver and Transmitter. When this
field is programmed to 0, the Clock Divider is not used and remains inactive.
When DIV is set to a value equal to or greater than 1, the Divided Clock has a frequency of Mas-
ter Clock divided by 2 times DIV. Each level of the Divided Clock has a duration of the Master
Clock multiplied by DIV. This ensures a 50% duty cycle for the Divided Clock regardless of
whether the DIV value is even or odd.
Divided Clock
DIV = 1
Master Clock
Divided Clock
DIV = 3
Table 35-2.
Maximum Minimum
MCK / 2 MCK / 8190
553
6254C–ATARM–22-Jan-10
The transmitter can also drive the TK I/O pad continuously or be limited to the actual data trans-
fer. The clock output is configured by the SSC_TCMR register. The Transmit Clock Inversion
(CKI) bits have no effect on the clock outputs. Programming the TCMR register to select TK pin
(CKS field) and at the same time Continuous Transmit Clock (CKO field) might lead to unpredict-
able results.
Divider
Clock
CKI CKG
Divider
Clock
CKI CKG
555
6254C–ATARM–22-Jan-10
Figure 35-8. Transmitter Block Diagram
SSC_CR.TXEN
SSC_SR.TXEN
SSC_CR.TXDIS
SSC_TFMR.DATDEF SSC_TCMR.STTDLY
SSC_TFMR.FSDEN
SSC_TFMR.DATNB
1
SSC_TFMR.MSBF 0 TD
RF TF
Transmitter Clock
Start
Transmit Shift Register
Selector
SSC_TFMR.FSDEN 0 1
SSC_TCMR.STTDLY
SSC_CR.RXEN
SSC_SR.RXEN
SSC_CR.RXDIS
SSC_RFMR.MSBF SSC_RFMR.DATNB
RF TF
Receiver Clock
Start
Receive Shift Register RD
Selector
SSC_RSHR SSC_RHR
SSC_RCMR.STTDLY
SSC_RFMR.FSLEN SSC_RFMR.DATLEN
35.6.4 Start
The transmitter and receiver can both be programmed to start their operations when an event
occurs, respectively in the Transmit Start Selection (START) field of SSC_TCMR and in the
Receive Start Selection (START) field of SSC_RCMR.
Under the following conditions the start event is independently programmable:
• Continuous. In this case, the transmission starts as soon as a word is written in SSC_THR
and the reception starts as soon as the Receiver is enabled.
• Synchronously with the transmitter/receiver
• On detection of a falling/rising edge on TF/RF
• On detection of a low level/high level on TF/RF
• On detection of a level change or an edge on TF/RF
A start can be programmed in the same manner on either side of the Transmit/Receive Clock
Register (RCMR/TCMR). Thus, the start could be on TF (Transmit) or RF (Receive).
Moreover, the Receiver can start when data is detected in the bit stream with the Compare
Functions.
Detection on TF/RF input/output is done by the field FSOS of the Transmit/Receive Frame Mode
Register (TFMR/RFMR).
557
6254C–ATARM–22-Jan-10
Figure 35-10. Transmit Start Mode
TK
TF
(Input)
TD
Start = Low Level on TF X BO B1
(Output)
STTDLY
TD
Start = Level Change on TF X BO B1 BO B1
(Output)
STTDLY
TD
Start = Any Edge on TF (Output) X BO B1 BO B1
STTDLY
RF
(Input)
RD
Start = Low Level on RF X BO B1
(Input)
STTDLY
RD
Start = Level Change on RF X BO B1 BO B1
(Input)
STTDLY
RD
Start = Any Edge on RF (Input) X BO B1 BO B1
STTDLY
RK
559
6254C–ATARM–22-Jan-10
35.6.6.1 Compare Functions
Length of the comparison patterns (Compare 0, Compare 1) and thus the number of bits they
are compared to is defined by FSLEN, but with a maximum value of 16 bits. Comparison is
always done by comparing the last bits received with the comparison pattern. Compare 0 can be
one start event of the Receiver. In this case, the receiver compares at each new sample the last
bits received at the Compare 0 pattern contained in the Compare 0 Register (SSC_RC0R).
When this start event is selected, the user can program the Receiver to start a new data transfer
either by writing a new Compare 0, or by receiving continuously until Compare 1 occurs. This
selection is done with the bit (STOP) in SSC_RCMR.
Figure 35-13. Transmit and Receive Frame Format in Edge/Pulse Start Modes
Start Start
PERIOD
(1)
TF/RF
FSLEN
DATNB
Start
DATLEN DATLEN
Note: 1. STTDLY is set to 0. In this example, SSC_THR is loaded twice. FSDEN value has no effect on
the transmission. SyncData cannot be output in continuous mode.
RD Data Data
To SSC_RHR To SSC_RHR
DATLEN DATLEN
561
6254C–ATARM–22-Jan-10
35.6.8 Loop Mode
The receiver can be programmed to receive transmissions from the transmitter. This is done by
setting the Loop Mode (LOOP) bit in SSC_RFMR. In this case, RD is connected to TD, RF is
connected to TF and RK is connected to TK.
35.6.9 Interrupt
Most bits in SSC_SR have a corresponding bit in interrupt management registers.
The SSC can be programmed to generate an interrupt when it detects an event. The interrupt is
controlled by writing SSC_IER (Interrupt Enable Register) and SSC_IDR (Interrupt Disable Reg-
ister) These registers enable and disable, respectively, the corresponding interrupt by setting
and clearing the corresponding bit in SSC_IMR (Interrupt Mask Register), which controls the
generation of interrupts by asserting the SSC interrupt line connected to the AIC.
SSC_IMR
SSC_IER SSC_IDR
PDC Set Clear
TXBUFE
ENDTX
Transmitter
TXRDY
TXEMPTY
TXSYNC
Interrupt SSC Interrupt
RXBUFF Control
ENDRX
Receiver
RXRDY
OVRUN
RXSYNC
Clock SCK
TK
Word Select WS
TF I2S
RECEIVER
Data SD
TD
SSC
RD Clock SCK
RF Word Select WS
RK
Data SD MSB LSB MSB
RF
Serial Data Clock (SCLK)
Serial Data In
563
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
SSC
Data in
RD
RF
RK
CODEC
Second
Time Slot
Serial Data in
564
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
565
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
SWRST – – – – – TXDIS TXEN
7 6 5 4 3 2 1 0
– – – – – – RXDIS RXEN
566
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – DIV
7 6 5 4 3 2 1 0
DIV
567
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
STTDLY
15 14 13 12 11 10 9 8
– – – STOP START
7 6 5 4 3 2 1 0
CKG CKI CKO CKS
568
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
569
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– FSOS FSLEN
15 14 13 12 11 10 9 8
– – – – DATNB
7 6 5 4 3 2 1 0
MSBF – LOOP DATLEN
570
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
571
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
STTDLY
15 14 13 12 11 10 9 8
– – – – START
7 6 5 4 3 2 1 0
CKG CKI CKO CKS
572
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
573
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
FSDEN FSOS FSLEN
15 14 13 12 11 10 9 8
– – – – DATNB
7 6 5 4 3 2 1 0
MSBF – DATDEF DATLEN
574
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
575
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
RDAT
15 14 13 12 11 10 9 8
RDAT
7 6 5 4 3 2 1 0
RDAT
23 22 21 20 19 18 17 16
TDAT
15 14 13 12 11 10 9 8
TDAT
7 6 5 4 3 2 1 0
TDAT
576
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
RSDAT
7 6 5 4 3 2 1 0
RSDAT
577
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
TSDAT
7 6 5 4 3 2 1 0
TSDAT
578
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
CP0
7 6 5 4 3 2 1 0
CP0
579
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
CP1
7 6 5 4 3 2 1 0
CP1
580
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – RXEN TXEN
15 14 13 12 11 10 9 8
– – – – RXSYN TXSYN CP1 CP0
7 6 5 4 3 2 1 0
RXBUFF ENDRX OVRUN RXRDY TXBUFE ENDTX TXEMPTY TXRDY
581
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
• CP0: Compare 0
0 = A compare 0 has not occurred since the last read of the Status Register.
1 = A compare 0 has occurred since the last read of the Status Register.
• CP1: Compare 1
0 = A compare 1 has not occurred since the last read of the Status Register.
1 = A compare 1 has occurred since the last read of the Status Register.
582
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – RXSYN TXSYN CP1 CP0
7 6 5 4 3 2 1 0
RXBUFF ENDRX OVRUN RXRDY TXBUFE ENDTX TXEMPTY TXRDY
583
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
584
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – RXSYN TXSYN CP1 CP0
7 6 5 4 3 2 1 0
RXBUFF ENDRX OVRUN RXRDY TXBUFE ENDTX TXEMPTY TXRDY
585
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
586
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – RXSYN TXSYN CP1 CP0
7 6 5 4 3 2 1 0
RXBUF ENDRX OVRUN RXRDY TXBUFE ENDTX TXEMPTY TXRDY
587
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
588
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
36.1 Description
The Timer Counter (TC) includes three identical 16-bit Timer Counter channels.
Each channel can be independently programmed to perform a wide range of functions including
frequency measurement, event counting, interval measurement, pulse generation, delay timing
and pulse width modulation.
Each channel has three external clock inputs, five internal clock inputs and two multi-purpose
input/output signals which can be configured by the user. Each channel drives an internal inter-
rupt signal which can be programmed to generate processor interrupts.
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 channel, allowing them to be
chained.
Table 36-1 gives the assignment of the device Timer Counter clock inputs common to Timer
Counter 0 to 2
589
6254C–ATARM–22-Jan-10
36.2 Block Diagram
Parallel I/O
TIMER_CLOCK1 Controller
TCLK0
TCLK0
TIMER_CLOCK2 TCLK1
TIOA1 TCLK2
TCLK0
TCLK2 SYNC
INT1
TC1XC1S
Timer Counter
Advanced
Interrupt
Controller
36.4.3 Interrupt
The TC has an interrupt line connected to the Advanced Interrupt Controller (AIC). Handling the
TC interrupt requires programming the AIC before configuring the TC.
36.5.1 TC Description
The three channels of the Timer Counter are independent and identical in operation. The regis-
ters for channel programming are listed in Table 36-4 on page 605.
Timer/Counter
TCLK0 Channel 0
TIOA1
XC0 TIOA0
TIOA2
XC1 = TCLK1
XC2 = TCLK2 TIOB0
SYNC
TC1XC1S
Timer/Counter
Channel 1
TCLK1 XC0 = TCLK2 TIOA1
TIOA0
XC1
TIOA2
XC2 = TCLK2 TIOB1
SYNC
Timer/Counter
TC2XC2S Channel 2
XC0 = TCLK0 TIOA2
TCLK2 XC1 = TCLK1
TIOA0
XC2 TIOB2
TIOA1
SYNC
TCCLKS
TIMER_CLOCK1
TIMER_CLOCK2 CLKI
TIMER_CLOCK3
TIMER_CLOCK4
TIMER_CLOCK5
Selected
XC0 Clock
XC1
XC2
BURST
Q S
R
Q S
R
Stop Disable
Counter Event Event
Clock
36.5.6 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:
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
AT91SAM9XE128/256/512 Preliminary
TIOB
LDRA LDRB
CPCS
LDRAS
LDRBS
LOVRS
ETRGS
COVFS
TC1_SR
Timer/Counter Channel
INT
6254C–ATARM–22-Jan-10
36.5.10 Waveform Operating Mode
Waveform operating mode is entered by setting the WAVE parameter in TC_CMR (Channel
Mode Register).
In Waveform Operating Mode the TC channel generates 1 or 2 PWM signals with the same fre-
quency and independently programmable duty cycles, or generates different types of one-shot
or repetitive pulses.
In this mode, TIOA is configured as an output and TIOB is defined as an output if it is not used
as an external event (EEVT parameter in TC_CMR).
Figure 36-6 shows the configuration of the TC channel when programmed in Waveform Operat-
ing Mode.
Output Controller
16-bit Counter
CLK
OVF
RESET
SWTRG
BCPC
SYNC
Trig
AT91SAM9XE128/256/512 Preliminary
BCPB MTIOB
WAVSEL
EEVT
TIOB
BEEVT
EEVTEDG
ENETRG
Output Controller
CPAS
CPBS
CPCS
ETRGS
COVFS
Edge
TC1_SR
Detector BSWTRG
TIOB
TC1_IMR
Timer/Counter Channel
INT
6254C–ATARM–22-Jan-10
36.5.11.1 WAVSEL = 00
When WAVSEL = 00, the value of TC_CV is incremented from 0 to 0xFFFF. Once 0xFFFF has
been reached, the value of TC_CV is reset. Incrementation of TC_CV starts again and the cycle
continues. See Figure 36-7.
An external event trigger or a software trigger can reset the value of TC_CV. It is important to
note that the trigger may occur at any time. See Figure 36-8.
RC Compare cannot be programmed to generate a trigger in this configuration. At the same
time, RC Compare can stop the counter clock (CPCSTOP = 1 in TC_CMR) and/or disable the
counter clock (CPCDIS = 1 in TC_CMR).
0xFFFF
Counter decremented by compare match with RC
RC
RB
RA
Waveform Examples
TIOB
TIOA
0xFFFF
RB
RA
Time
Waveform Examples
TIOB
TIOA
36.5.11.2 WAVSEL = 10
When WAVSEL = 10, the value of TC_CV is incremented from 0 to the value of RC, then auto-
matically reset on a RC Compare. Once the value of TC_CV has been reset, it is then
incremented and so on. See Figure 36-9.
It is important to note that TC_CV can be reset at any time by an external event or a software
trigger if both are programmed correctly. See Figure 36-10.
In addition, RC Compare can stop the counter clock (CPCSTOP = 1 in TC_CMR) and/or disable
the counter clock (CPCDIS = 1 in TC_CMR).
0xFFFF
Counter cleared by compare match with RC
RC
RB
RA
TIOB
TIOA
0xFFFF
Counter dec
by trigger
RC
RB
RA
Waveform Examples
TIOB
TIOA
36.5.11.3 WAVSEL = 01
When WAVSEL = 01, the value of TC_CV is incremented from 0 to 0xFFFF. Once 0xFFFF is
reached, the value of TC_CV is decremented to 0, then re-incremented to 0xFFFF and so on.
See Figure 36-11.
A trigger such as an external event or a software trigger can modify TC_CV at any time. If a trig-
ger occurs while TC_CV is incrementing, TC_CV then decrements. If a trigger is received while
TC_CV is decrementing, TC_CV then increments. See Figure 36-12.
RC Compare cannot be programmed to generate a trigger in this configuration.
At the same time, RC Compare can stop the counter clock (CPCSTOP = 1) and/or disable the
counter clock (CPCDIS = 1).
0xFFFF
RC
RB
RA
TIOB
TIOA
0xFFFF
Counter decremented
by trigger
RC
RB
Counter incremented
by trigger
RA
TIOB
TIOA
36.5.11.4 WAVSEL = 11
When WAVSEL = 11, the value of TC_CV is incremented from 0 to RC. Once RC is reached, the
value of TC_CV is decremented to 0, then re-incremented to RC and so on. See Figure 36-13.
A trigger such as an external event or a software trigger can modify TC_CV at any time. If a trig-
ger occurs while TC_CV is incrementing, TC_CV then decrements. If a trigger is received while
TC_CV is decrementing, TC_CV then increments. See Figure 36-14.
RC Compare can stop the counter clock (CPCSTOP = 1) and/or disable the counter clock (CPC-
DIS = 1).
0xFFFF
Counter decremented by compare match with RC
RC
RB
RA
TIOB
TIOA
0xFFFF
Counter decremented by compare match with RC
RC
Counter decremented
by trigger
RB
Counter incremented
by trigger
RA
TIOB
TIOA
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
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
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
23 22 21 20 19 18 17 16
– – – – LDRB LDRA
15 14 13 12 11 10 9 8
WAVE CPCTRG – – – ABETRG ETRGEDG
7 6 5 4 3 2 1 0
LDBDIS LDBSTOP BURST CLKI TCCLKS
BURST
0 0 The clock is not gated by an external signal.
0 1 XC0 is ANDed with the selected clock.
1 0 XC1 is ANDed with the selected clock.
1 1 XC2 is ANDed with the selected clock.
ETRGEDG Edge
0 0 none
0 1 rising edge
1 0 falling edge
1 1 each edge
• WAVE
0 = Capture Mode is enabled.
1 = Capture Mode is disabled (Waveform Mode is enabled).
LDRA Edge
0 0 none
0 1 rising edge of TIOA
1 0 falling edge of TIOA
1 1 each edge of TIOA
LDRB Edge
0 0 none
0 1 rising edge of TIOA
1 0 falling edge of TIOA
1 1 each edge of TIOA
23 22 21 20 19 18 17 16
ASWTRG AEEVT ACPC ACPA
15 14 13 12 11 10 9 8
WAVE WAVSEL ENETRG EEVT EEVTEDG
7 6 5 4 3 2 1 0
CPCDIS CPCSTOP BURST CLKI TCCLKS
BURST
0 0 The clock is not gated by an external signal.
0 1 XC0 is ANDed with the selected clock.
1 0 XC1 is ANDed with the selected clock.
1 1 XC2 is ANDed with the selected clock.
EEVTEDG Edge
0 0 none
0 1 rising edge
1 0 falling edge
1 1 each edge
WAVSEL Effect
0 0 UP mode without automatic trigger on RC Compare
1 0 UP mode with automatic trigger on RC Compare
0 1 UPDOWN mode without automatic trigger on RC Compare
1 1 UPDOWN mode with automatic trigger on RC Compare
• WAVE
0 = Waveform Mode is disabled (Capture Mode is enabled).
1 = Waveform Mode is enabled.
ACPA Effect
0 0 none
0 1 set
1 0 clear
1 1 toggle
ACPC Effect
0 0 none
0 1 set
1 0 clear
1 1 toggle
AEEVT Effect
0 0 none
0 1 set
1 0 clear
1 1 toggle
ASWTRG Effect
0 0 none
0 1 set
1 0 clear
1 1 toggle
BCPB Effect
0 0 none
0 1 set
1 0 clear
1 1 toggle
BCPC Effect
0 0 none
0 1 set
1 0 clear
1 1 toggle
BEEVT Effect
0 0 none
0 1 set
1 0 clear
1 1 toggle
BSWTRG Effect
0 0 none
0 1 set
1 0 clear
1 1 toggle
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
36.6.7 TC Register A
Register Name: TC_RAx [x=0..2]
Addresses: 0xFFFA0014 (0)[0], 0xFFFA0054 (0)[1], 0xFFFA0094 (0)[2], 0xFFFDC014 (1)[0], 0xFFFDC054
(1)[1], 0xFFFDC094 (1)[2]
Access Type: Read-only if WAVE = 0, Read-write if WAVE = 1
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
• RA: Register A
RA contains the Register A value in real time.
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
• RB: Register B
RB contains the Register B value in real time.
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
• RC: Register C
RC contains the Register C value in real time.
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
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
• CPAS: RA Compare
0 = No effect.
1 = Enables the RA Compare Interrupt.
• CPBS: RB Compare
0 = No effect.
1 = Enables the RB Compare Interrupt.
• CPCS: RC Compare
0 = No effect.
1 = Enables the RC Compare Interrupt.
• LDRAS: RA Loading
0 = No effect.
1 = Enables the RA Load Interrupt.
• LDRBS: RB Loading
0 = No effect.
1 = Enables the RB Load Interrupt.
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
• CPAS: RA Compare
0 = No effect.
1 = Disables the RA Compare Interrupt (if WAVE = 1).
• CPBS: RB Compare
0 = No effect.
1 = Disables the RB Compare Interrupt (if WAVE = 1).
• CPCS: RC Compare
0 = No effect.
1 = Disables the RC Compare Interrupt.
• LDRAS: RA Loading
0 = No effect.
1 = Disables the RA Load Interrupt (if WAVE = 0).
• LDRBS: RB Loading
0 = No effect.
1 = Disables the RB Load Interrupt (if WAVE = 0).
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
• CPAS: RA Compare
0 = The RA Compare Interrupt is disabled.
1 = The RA Compare Interrupt is enabled.
• CPBS: RB Compare
0 = The RB Compare Interrupt is disabled.
1 = The RB Compare Interrupt is enabled.
• CPCS: RC Compare
0 = The RC Compare Interrupt is disabled.
1 = The RC Compare Interrupt is enabled.
• LDRAS: RA Loading
0 = The Load RA Interrupt is disabled.
1 = The Load RA Interrupt is enabled.
• LDRBS: RB Loading
0 = The Load RB Interrupt is disabled.
1 = The Load RB Interrupt is enabled.
37.1 Description
The MultiMedia Card Interface (MCI) supports the MultiMedia Card (MMC) Specification V3.11,
the SDIO Specification V1.1 and the SD Memory Card Specification V1.0.
The MCI includes a command register, response registers, data registers, timeout counters and
error detection logic that automatically handle the transmission of commands and, when
required, the reception of the associated responses and data with a limited processor overhead.
The MCI supports stream, block and multi-block data read and write, and is compatible with the
Peripheral DMA Controller (PDC) channels, minimizing processor intervention for large buffer
transfers.
The MCI operates at a rate of up to Master Clock divided by 2 and supports the interfacing of 2
slot(s). Each slot may be used to interface with a MultiMediaCard bus (up to 30 Cards) or with a
SD Memory Card. Only one slot can be selected at a time (slots are multiplexed). A bit field in
the SD Card Register performs this selection.
The SD Memory Card communication is based on a 9-pin interface (clock, command, four data
and three power lines) and the MultiMedia Card on a 7-pin interface (clock, command, one data,
three power lines and one reserved for future use).
The SD Memory Card interface also supports MultiMedia Card operations. The main differences
between SD and MultiMedia Cards are the initialization process and the bus topology.
623
6254C–ATARM–22-Jan-10
37.2 Block Diagram
APB Bridge
PDC
APB
MCCK(1)
MCCDA(1)
MCDA0(1)
MCK
PMC
MCDA1(1)
MCDA2(1)
MCDA3(1)
MCI Interface PIO
MCCDB(1)
MCDB0(1)
MCDB1(1)
MCDB2(1)
Interrupt Control
MCDB3(1)
MCI Interrupt
Note: 1. When several MCI (x MCI) are embedded in a product, MCCK refers to MCIx_CK, MCCDA to
MCIx_CDA, MCCDB to MCIx_CDB,MCDAy to MCIx_DAy, MCDBy to MCIx_DBy.
Application Layer
ex: File System, Audio, Security, etc.
Physical Layer
MCI Interface
1 2 3 4 5 6 78
1234567 9
SDCard
MMC
625
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
37.5.3 Interrupt
The MCI interface has an interrupt line connected to the Advanced Interrupt Controller (AIC).
Handling the MCI interrupt requires programming the AIC before configuring the MCI.
1234567
MMC
The MultiMedia Card communication is based on a 7-pin serial bus interface. It has three com-
munication lines and four supply lines.
MCI
MCDA0
MCCDA
MCCK
Note: When several MCI (x MCI) are embedded in a product, MCCK refers to MCIx_CK, MCCDA to MCIx_CDA MCDAy to MCIx_DAy.
626
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
1 2 3 4 5 6 78
9
SD CARD
The SD Memory Card bus includes the signals listed in Table 37-3.
MCDA0 - MCDA3
MCCK SD CARD
MCCDA
9
Note: When several MCI (x MCI) are embedded in a product, MCCK refers to MCIx_CK, MCCDA to
MCIx_CDA MCDAy to MCIx_DAy.
627
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
1 2 3 4 5 6 78
MCDA0 - MCDA3
MCCK SD CARD 1
MCCDA
9
1 2 3 4 5 6 78
MCDB0 - MCDB3
SD CARD 2
MCCDB
9
Note: When several MCI (x MCI) are embedded in a product, MCCK refers to MCIx_CK,MCCDA to MCIx_CDA, MCDAy to MCIx_DAy,
MCCDB to MCIx_CDB, MCDBy to MCIx_DBy.
Figure 37-8. Mixing MultiMedia and SD Memory Cards with Two Slots
MCDA0
MCCDA
MCCK
MCDB0 - MCDB3
SD CARD
MCCDB
9
Note: When several MCI (x MCI) are embedded in a product, MCCK refers to MCIx_CK, MCCDA to MCIx_CDA, MCDAy to
MCIx_DAy, MCCDB to MCIx_CDB, MCDBy to MCIx_DBy.
When the MCI is configured to operate with SD memory cards, the width of the data bus can be
selected in the MCI_SDCR register. Clearing the SDCBUS bit in this register means that the
width is one bit; setting it means that the width is four bits. In the case of multimedia cards, only
the data line 0 is used. The other data lines can be used as independent PIOs.
628
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
629
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
The two bus modes (open drain and push/pull) needed to process all the operations are defined
in the MCI command register. The MCI_CMDR allows a command to be carried out.
For example, to perform an ALL_SEND_CID command:
The command ALL_SEND_CID and the fields and values for the MCI_CMDR Control Register
are described in Table 37-4 and Table 37-5.
630
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Read MCI_SR
RETURN ERROR(1)
RETURN OK
Note: 1. If the command is SEND_OP_COND, the CRC error flag is always present (refer to R3
response in the MultiMedia Card specification).
631
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
632
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
(1)
Send SET_BLOCKLEN command
No Yes
Read with PDC
Yes
Number of words to read = 0 ?
Read status register MCI_SR
No
No
RETURN
Read data = MCI_RDR
RETURN
Notes: 1. It is assumed that this command has been correctly sent (see Figure 37-9).
2. This field is also accessible in the MCI Block Register (MCI_BLKR).
633
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
634
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Send SELECT/DESELECT_CARD
command(1) to select the card
No Yes
Write using PDC
MCI_PTCR = TXTEN
Yes
Number of words to write = 0 ?
No
RETURN
Notes: 1. It is assumed that this command has been correctly sent (see Figure 37-9).
2. This field is also accessible in the MCI Block Register (MCI_BLKR).
635
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
The following flowchart, (Figure 37-12) shows how to manage a multiple write block transfer with
the PDC. Polling or interrupt method can be used to wait for the end of write according to the
contents of the Interrupt Mask Register (MCI_IMR).
Send SELECT/DESELECT_CARD
command(1) to select the card
(1)
Send SET_BLOCKLEN command
Send WRITE_MULTIPLE_BLOCK
command(1)
MCI_PTCR = TXTEN
No
Send STOP_TRANSMISSION
(1)
command
No
RETURN
Notes: 1. It is assumed that this command has been correctly sent (see Figure 37-9).
2. This field is also accessible in the MCI Block Register (MCI_BLKR).
636
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
637
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Note: 1. The response register can be read by N accesses at the same MCI_RSPR or at consecutive addresses (0x20 to 0x2C).
N depends on the size of the response.
638
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
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 – – – PWSDIS PWSEN MCIDIS MCIEN
639
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
BLKLEN
15 14 13 12 11 10 9 8
PDCMODE PDCPADV PDCFBYTE WRPROOF RDPROOF PWSDIV
7 6 5 4 3 2 1 0
CLKDIV
640
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
641
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– DTOMUL DTOCYC
DTOMUL Multiplier
0 0 0 1
0 0 1 16
0 1 0 128
0 1 1 256
1 0 0 1024
1 0 1 4096
1 1 0 65536
1 1 1 1048576
If the data time-out set by DTOCYC and DTOMUL has been exceeded, the Data Time-out Error flag (DTOE) in the MCI
Status Register (MCI_SR) raises.
642
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
SDCBUS – – – – – SDCSEL
643
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
ARG
15 14 13 12 11 10 9 8
ARG
7 6 5 4 3 2 1 0
ARG
644
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – TRTYP TRDIR TRCMD
15 14 13 12 11 10 9 8
– – – MAXLAT OPDCMD SPCMD
7 6 5 4 3 2 1 0
RSPTYP CMDNB
This register is write-protected while CMDRDY is 0 in MCI_SR. If an Interrupt command is sent, this register is only write-
able by an interrupt response (field SPCMD). This means that the current command execution cannot be interrupted or
modified.
SPCMD Command
0 0 0 Not a special CMD.
Initialization CMD:
0 0 1
74 clock cycles for initialization sequence.
Synchronized CMD:
0 1 0 Wait for the end of the current data block transfer before sending the
pending command.
0 1 1 Reserved.
Interrupt command:
1 0 0
Corresponds to the Interrupt Mode (CMD40).
Interrupt response:
1 0 1
Corresponds to the Interrupt Mode (CMD40).
645
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
646
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
BLKLEN
15 14 13 12 11 10 9 8
BCNT
7 6 5 4 3 2 1 0
BCNT
Warning: In SDIO Byte and Block modes, writing to the 7 last bits of BCNT field, is forbidden and may lead to unpredict-
able results.
647
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
RSP
15 14 13 12 11 10 9 8
RSP
7 6 5 4 3 2 1 0
RSP
• RSP: Response
Note: 1. The response register can be read by N accesses at the same MCI_RSPR or at consecutive addresses (0x20 to 0x2C).
N depends on the size of the response.
648
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
DATA
15 14 13 12 11 10 9 8
DATA
7 6 5 4 3 2 1 0
DATA
23 22 21 20 19 18 17 16
DATA
15 14 13 12 11 10 9 8
DATA
7 6 5 4 3 2 1 0
DATA
649
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– DTOE DCRCE RTOE RENDE RCRCE RDIRE RINDE
15 14 13 12 11 10 9 8
TXBUFE RXBUFF – – – – SDIOIRQB SDIOIRQA
7 6 5 4 3 2 1 0
ENDTX ENDRX NOTBUSY DTIP BLKE TXRDY RXRDY CMDRDY
650
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
line (DAT0) to LOW. The card stops pulling down the data line as soon as at least one receive buffer for the defined data
transfer block length becomes free.
The NOTBUSY flag allows to deal with these different states.
0 = The MCI is not ready for new data transfer. Cleared at the end of the card response.
1 = The MCI is ready for new data transfer. Set when the busy state on the data line has ended. This corresponds to a free
internal data receive buffer of the card.
Refer to the MMC or SD Specification for more details concerning the busy behavior.
651
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
• OVRE: Overrun
0 = No error.
1 = At least one 8-bit received data has been lost (not read). Cleared when sending a new data transfer command.
• UNRE: Underrun
0 = No error.
1 = At least one 8-bit data has been sent without valid information (not written). Cleared when sending a new data transfer
command.
652
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– DTOE DCRCE RTOE RENDE RCRCE RDIRE RINDE
15 14 13 12 11 10 9 8
TXBUFE RXBUFF – – – – SDIOIRQB SDIOIRQA
7 6 5 4 3 2 1 0
ENDTX ENDRX NOTBUSY DTIP BLKE TXRDY RXRDY CMDRDY
653
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
654
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– DTOE DCRCE RTOE RENDE RCRCE RDIRE RINDE
15 14 13 12 11 10 9 8
TXBUFE RXBUFF – – – – SDIOIRQB SDIOIRQA
7 6 5 4 3 2 1 0
ENDTX ENDRX NOTBUSY DTIP BLKE TXRDY RXRDY CMDRDY
655
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
656
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– DTOE DCRCE RTOE RENDE RCRCE RDIRE RINDE
15 14 13 12 11 10 9 8
TXBUFE RXBUFF – – – – SDIOIRQB SDIOIRQA
7 6 5 4 3 2 1 0
ENDTX ENDRX NOTBUSY DTIP BLKE TXRDY RXRDY CMDRDY
657
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
658
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
38.1 Description
The EMAC module implements a 10/100 Ethernet MAC compatible with the IEEE 802.3 stan-
dard using an address checker, statistics and control registers, receive and transmit blocks, and
a DMA interface.
The address checker recognizes four specific 48-bit addresses and contains a 64-bit hash regis-
ter for matching multicast and unicast addresses. It can recognize the broadcast address of all
ones, copy all frames, and act on an external address match signal.
The statistics register block contains registers for counting various types of event associated
with transmit and receive operations. These registers, along with the status words stored in the
receive buffer list, enable software to generate network management statistics compatible with
IEEE 802.3.
Address Checker
APB
Slave
Register Interface
Statistics Registers
MDIO
Control Registers
DMA Interface
RX FIFO TX FIFO
Ethernet Receive
MII/RMII
AHB
Master
Ethernet Transmit
659
6254C–ATARM–22-Jan-10
38.3 Functional Description
The MACB has several clock domains:
• System bus clock (AHB and APB): DMA and register blocks
• Transmit clock: transmit block
• Receive clock: receive and address checker blocks
The only system constraint is 160 MHz for the system bus clock, above which MDC would toggle
at above 2.5 MHz.
The system bus clock must run at least as fast as the receive clock and transmit clock (25 MHz
at 100 Mbps, and 2.5 MHZ at 10 Mbps).
Figure 38-1 illustrates the different blocks of the EMAC module.
The control registers drive the MDIO interface, setup up DMA activity, start frame transmission
and select modes of operation such as full- or half-duplex.
The receive block checks for valid preamble, FCS, alignment and length, and presents received
frames to the address checking block and DMA interface.
The transmit block takes data from the DMA interface, adds preamble and, if necessary, pad
and FCS, and transmits data according to the CSMA/CD (carrier sense multiple access with col-
lision detect) protocol. The start of transmission is deferred if CRS (carrier sense) is active.
If COL (collision) becomes active during transmission, a jam sequence is asserted and the
transmission is retried after a random back off. CRS and COL have no effect in full duplex mode.
The DMA block connects to external memory through its AHB bus interface. It contains receive
and transmit FIFOs for buffering frame data. It loads the transmit FIFO and empties the receive
FIFO using AHB bus master operations. Receive data is not sent to memory until the address
checking logic has determined that the frame should be copied. Receive or transmit frames are
stored in one or more buffers. Receive buffers have a fixed length of 128 bytes. Transmit buffers
range in length between 0 and 2047 bytes, and up to 128 buffers are permitted per frame. The
DMA block manages the transmit and receive framebuffer queues. These queues can hold mul-
tiple frames.
38.3.1 Clock
Synchronization module in the EMAC requires that the bus clock (hclk) runs at the speed of the
macb_tx/rx_clk at least, which is 25 MHz at 100 Mbps, and 2.5 MHz at 10 Mbps.
38.3.2.1 FIFO
The FIFO depths are 128 bytes for receive and 128 bytes for transmit and are a function of the
system clock speed, memory latency and network speed.
Data is typically transferred into and out of the FIFOs in bursts of four words. For receive, a bus
request is asserted when the FIFO contains four words and has space for 28 more. For transmit,
a bus request is generated when there is space for four words, or when there is space for 27
words if the next transfer is to be only one or two words.
Thus the bus latency must be less than the time it takes to load the FIFO and transmit or receive
three words (112 bytes) of data.
At 100 Mbit/s, it takes 8960 ns to transmit or receive 112 bytes of data. In addition, six master
clock cycles should be allowed for data to be loaded from the bus and to propagate through the
FIFOs. For a 133 MHz master clock this takes 45 ns, making the bus latency requirement 8915
ns.
661
6254C–ATARM–22-Jan-10
Table 38-1. Receive Buffer Descriptor Entry (Continued)
Bit Function
29 Unicast hash match
28 External address match
27 Reserved for future use
26 Specific address register 1 match
25 Specific address register 2 match
24 Specific address register 3 match
23 Specific address register 4 match
22 Type ID match
21 VLAN tag detected (i.e., type id of 0x8100)
20 Priority tag detected (i.e., type id of 0x8100 and null VLAN identifier)
19:17 VLAN priority (only valid if bit 21 is set)
16 Concatenation format indicator (CFI) bit (only valid if bit 21 is set)
End of frame - when set the buffer contains the end of a frame. If end of frame is not set, then the only other valid status
15
are bits 12, 13 and 14.
Start of frame - when set the buffer contains the start of a frame. If both bits 15 and 14 are set, then the buffer contains a
14
whole frame.
Receive buffer offset - indicates the number of bytes by which the data in the first buffer is offset from the word address.
Updated with the current values of the network configuration register. If jumbo frame mode is enabled through bit 3 of the
13:12
network configuration register, then bits 13:12 of the receive buffer descriptor entry are used to indicate bits 13:12 of the
frame length.
11:0 Length of frame including FCS (if selected). Bits 13:12 are also used if jumbo frame mode is selected.
To receive frames, the buffer descriptors must be initialized by writing an appropriate address to
bits 31 to 2 in the first word of each list entry. Bit zero must be written with zero. Bit one is the
wrap bit and indicates the last entry in the list.
The start location of the receive buffer descriptor list must be written to the receive buffer queue
pointer register before setting the receive enable bit in the network control register to enable
receive. As soon as the receive block starts writing received frame data to the receive FIFO, the
receive buffer manager reads the first receive buffer location pointed to by the receive buffer
queue pointer register.
If the filter block then indicates that the frame should be copied to memory, the receive data
DMA operation starts writing data into the receive buffer. If an error occurs, the buffer is recov-
ered. If the current buffer pointer has its wrap bit set or is the 1024th descriptor, the next receive
buffer location is read from the beginning of the receive descriptor list. Otherwise, the next
receive buffer location is read from the next word in memory.
There is an 11-bit counter to count out the 2048 word locations of a maximum length, receive
buffer descriptor list. This is added with the value originally written to the receive buffer queue
pointer register to produce a pointer into the list. A read of the receive buffer queue pointer reg-
ister returns the pointer value, which is the queue entry currently being accessed. The counter is
reset after receive status is written to a descriptor that has its wrap bit set or rolls over to zero
after 1024 descriptors have been accessed. The value written to the receive buffer pointer regis-
ter may be any word-aligned address, provided that there are at least 2048 word locations
available between the pointer and the top of the memory.
Section 3.6 of the AMBA 2.0 specification states that bursts should not cross 1K boundaries. As
receive buffer manager writes are bursts of two words, to ensure that this does not occur, it is
best to write the pointer register with the least three significant bits set to zero. As receive buffers
are used, the receive buffer manager sets bit zero of the first word of the descriptor to indicate
used. If a receive error is detected the receive buffer currently being written is recovered. Previ-
ous buffers are not recovered. Software should search through the used bits in the buffer
descriptors to find out how many frames have been received. It should be checking the start-of-
frame and end-of-frame bits, and not rely on the value returned by the receive buffer queue
pointer register which changes continuously as more buffers are used.
For CRC errored frames, excessive length frames or length field mismatched frames, all of
which are counted in the statistics registers, it is possible that a frame fragment might be stored
in a sequence of receive buffers. Software can detect this by looking for start of frame bit set in a
buffer following a buffer with no end of frame bit set.
For a properly working Ethernet system, there should be no excessively long frames or frames
greater than 128 bytes with CRC/FCS errors. Collision fragments are less than 128 bytes long.
Therefore, it is a rare occurrence to find a frame fragment in a receive buffer.
If bit zero is set when the receive buffer manager reads the location of the receive buffer, then
the buffer has already been used and cannot be used again until software has processed the
frame and cleared bit zero. In this case, the DMA block sets the buffer not available bit in the
receive status register and triggers an interrupt.
If bit zero is set when the receive buffer manager reads the location of the receive buffer and a
frame is being received, the frame is discarded and the receive resource error statistics register
is incremented.
A receive overrun condition occurs when bus was not granted in time or because HRESP was
not OK (bus error). In a receive overrun condition, the receive overrun interrupt is asserted and
the buffer currently being written is recovered. The next frame received with an address that is
recognized reuses the buffer.
If bit 17 of the network configuration register is set, the FCS of received frames shall not be cop-
ied to memory. The frame length indicated in the receive status field shall be reduced by four
bytes in this case.
663
6254C–ATARM–22-Jan-10
descriptor is initialized with control information that indicates the length of the buffer, whether or
not it is to be transmitted with CRC and whether the buffer is the last buffer in the frame.
After transmission, the control bits are written back to the second word of the first buffer along
with the “used” bit and other status information. Bit 31 is the “used” bit which must be zero when
the control word is read if transmission is to happen. It is written to one when a frame has been
transmitted. Bits 27, 28 and 29 indicate various transmit error conditions. Bit 30 is the “wrap” bit
which can be set for any buffer within a frame. If no wrap bit is encountered after 1024 descrip-
tors, the queue pointer rolls over to the start in a similar fashion to the receive queue.
The transmit buffer queue pointer register must not be written while transmit is active. If a new
value is written to the transmit buffer queue pointer register, the queue pointer resets itself to
point to the beginning of the new queue. If transmit is disabled by writing to bit 3 of the network
control, the transmit buffer queue pointer register resets to point to the beginning of the transmit
queue. Note that disabling receive does not have the same effect on the receive queue pointer.
Once the transmit queue is initialized, transmit is activated by writing to bit 9, the Transmit Start
bit of the network control register. Transmit is halted when a buffer descriptor with its used bit set
is read, or if a transmit error occurs, or by writing to the transmit halt bit of the network control
register. (Transmission is suspended if a pause frame is received while the pause enable bit is
set in the network configuration register.) Rewriting the start bit while transmission is active is
allowed.
Transmission control is implemented with a Tx_go variable which is readable in the transmit sta-
tus register at bit location 3. The Tx_go variable is reset when:
– transmit is disabled
– a buffer descriptor with its ownership bit set is read
– a new value is written to the transmit buffer queue pointer register
– bit 10, tx_halt, of the network control register is written
– there is a transmit error such as too many retries or a transmit underrun.
To set tx_go, write to bit 9, tx_start, of the network control register. Transmit halt does not take
effect until any ongoing transmit finishes. If a collision occurs during transmission of a multi-buf-
fer frame, transmission automatically restarts from the first buffer of the frame. If a “used” bit is
read midway through transmission of a multi-buffer frame, this is treated as a transmit error.
Transmission stops, tx_er is asserted and the FCS is bad.
If transmission stops due to a transmit error, the transmit queue pointer resets to point to the
beginning of the transmit queue. Software needs to re-initialize the transmit queue after a trans-
mit error.
If transmission stops due to a “used” bit being read at the start of the frame, the transmission
queue pointer is not reset and transmit starts from the same transmit buffer descriptor when the
transmit start bit is written
665
6254C–ATARM–22-Jan-10
whenever it sees an incoming frame to force a collision. This provides a way of implementing
flow control in half-duplex mode.
The network configuration register contains a receive pause enable bit (13). If a valid pause
frame is received, the pause time register is updated with the frame’s pause time, regardless of
its current contents and regardless of the state of the configuration register bit 13. An interrupt
(12) is triggered when a pause frame is received, assuming it is enabled in the interrupt mask
register. If bit 13 is set in the network configuration register and the value of the pause time reg-
ister is non-zero, no new frame is transmitted until the pause time register has decremented to
zero.
The loading of a new pause time, and hence the pausing of transmission, only occurs when the
EMAC is configured for full-duplex operation. If the EMAC is configured for half-duplex, there is
no transmission pause, but the pause frame received interrupt is still triggered.
A valid pause frame is defined as having a destination address that matches either the address
stored in specific address register 1 or matches 0x0180C2000001 and has the MAC control
frame type ID of 0x8808 and the pause opcode of 0x0001. Pause frames that have FCS or other
errors are treated as invalid and are discarded. Valid pause frames received increment the
Pause Frame Received statistic register.
The pause time register decrements every 512 bit times (i.e., 128 rx_clks in nibble mode)
once transmission has stopped. For test purposes, the register decrements every rx_clk cycle
once transmission has stopped if bit 12 (retry test) is set in the network configuration register. If
the pause enable bit (13) is not set in the network configuration register, then the decrementing
occurs regardless of whether transmission has stopped or not.
An interrupt (13) is asserted whenever the pause time register decrements to zero (assuming it
is enabled in the interrupt mask register).
specification and is disabled by default. When jumbo frames are enabled, frames received with a
frame size greater than 10240 bytes are discarded.
667
6254C–ATARM–22-Jan-10
SA (MSB) 43
SA (LSB) 21
The sequence above shows the beginning of an Ethernet frame. Byte order of transmission is
from top to bottom as shown. For a successful match to specific address 1, the following
address matching registers must be set up:
• Base address + 0x98 0x87654321 (Bottom)
• Base address + 0x9C 0x0000CBA9 (Top)
And for a successful match to the Type ID register, the following should be set up:
• Base address + 0xB8 0x00004321
da[0] represents the least significant bit of the first byte received, that is, the multicast/unicast
indicator, and da[47] represents the most significant bit of the last byte received.
If the hash index points to a bit that is set in the hash register, then the frame is matched accord-
ing to whether the frame is multicast or unicast.
A multicast match is signalled if the multicast hash enable bit is set. da[0] is 1 and the hash index
points to a bit set in the hash register.
A unicast match is signalled if the unicast hash enable bit is set. da[0] is 0 and the hash index
points to a bit set in the hash register.
To receive all multicast frames, the hash register should be set with all ones and the multicast
hash enable bit should be set in the network configuration register.
The VLAN tag is inserted at the 13th byte of the frame, adding an extra four bytes to the frame. If
the VID (VLAN identifier) is null (0x000), this indicates a priority-tagged frame. The MAC can
support frame lengths up to 1536 bytes, 18 bytes more than the original Ethernet maximum
frame length of 1518 bytes. This is achieved by setting bit 8 in the network configuration register.
The following bits in the receive buffer descriptor status word give information about VLAN
tagged frames:
• Bit 21 set if receive frame is VLAN tagged (i.e. type id of 0x8100)
• Bit 20 set if receive frame is priority tagged (i.e. type id of 0x8100 and null VID). (If bit 20 is
set bit 21 is set also.)
• Bit 19, 18 and 17 set to priority if bit 21 is set
• Bit 16 set to CFI if bit 21 is set
669
6254C–ATARM–22-Jan-10
The MDIO interface can read IEEE 802.3 clause 45 PHYs as well as clause 22 PHYs. To read
clause 45 PHYs, bits[31:28] should be written as 0x0011. For a description of MDC generation,
see the network configuration register in the “Network Control Register” on page 676.
The intent of the RMII is to provide a reduced pin count alternative to the IEEE 802.3u MII. It
uses 2 bits for transmit (ETX0 and ETX1) and two bits for receive (ERX0 and ERX1). There is a
Transmit Enable (ETXEN), a Receive Error (ERXER), a Carrier Sense (ECRS_DV), and a 50
MHz Reference Clock (ETXCK_EREFCK) for 100Mb/s data rate.
38.4.1 Initialization
38.4.1.1 Configuration
Initialization of the EMAC configuration (e.g., loop-back mode, frequency ratios) must be done
while the transmit and receive circuits are disabled. See the description of the network control
register and network configuration register earlier in this document.
To change loop-back mode, the following sequence of operations must be followed:
1. Write to network control register to disable transmit and receive circuits.
2. Write to network control register to change loop-back mode.
3. Write to network control register to re-enable transmit or receive circuits.
Note: These writes to network control register cannot be combined in any way.
Receive Buffer 0
Receive Buffer Queue Pointer
(MAC Register)
Receive Buffer 1
Receive Buffer N
671
6254C–ATARM–22-Jan-10
38.4.1.3 Transmit Buffer List
Transmit data is read from areas of data (the buffers) in system memory These buffers are listed
in another data structure that also resides in main memory. This data structure (Transmit Buffer
Queue) is a sequence of descriptor entries (as defined in Table 38-2 on page 664) that points to
this data structure.
To create this list of buffers:
1. Allocate a number (n) of buffers of between 1 and 2047 bytes of data to be transmitted
in system memory. Up to 128 buffers per frame are allowed.
2. Allocate an area 2n words for the transmit buffer descriptor entry in system memory
and create N entries in this list. Mark all entries in this list as owned by EMAC, i.e. bit 31
of word 1 set to 0.
3. If fewer than 1024 buffers are defined, the last descriptor must be marked with the wrap
bit — bit 30 in word 1 set to 1.
4. Write address of transmit buffer descriptor entry to EMAC register transmit_buffer
queue pointer.
5. The transmit circuits can then be enabled by writing to the network control register.
38.4.1.5 Interrupts
There are 14 interrupt conditions that are detected within the EMAC. These are ORed to make a
single interrupt. Depending on the overall system design, this may be passed through a further
level of interrupt collection (interrupt controller). On receipt of the interrupt signal, the CPU
enters the interrupt handler (Refer to the AIC programmer datasheet). To ascertain which inter-
rupt has been generated, read the interrupt status register. Note that this register clears itself
when read. At reset, all interrupts are disabled. To enable an interrupt, write to interrupt enable
register with the pertinent interrupt bit set to 1. To disable an interrupt, write to interrupt disable
register with the pertinent interrupt bit set to 1. To check whether an interrupt is enabled or dis-
abled, read interrupt mask register: if the bit is set to 1, the interrupt is disabled.
673
6254C–ATARM–22-Jan-10
38.5 Ethernet MAC 10/100 (EMAC) User Interface
Table 38-6. Register Mapping
Offset Register Name Access Reset
0x00 Network Control Register EMAC_NCR Read-write 0
0x04 Network Configuration Register EMAC_NCFG Read-write 0x800
0x08 Network Status Register EMAC_NSR Read-only -
0x0C Reserved
0x10 Reserved
0x14 Transmit Status Register EMAC_TSR Read-write 0x0000_0000
0x18 Receive Buffer Queue Pointer Register EMAC_RBQP Read-write 0x0000_0000
0x1C Transmit Buffer Queue Pointer Register EMAC_TBQP Read-write 0x0000_0000
0x20 Receive Status Register EMAC_RSR Read-write 0x0000_0000
0x24 Interrupt Status Register EMAC_ISR Read-write 0x0000_0000
0x28 Interrupt Enable Register EMAC_IER Write-only -
0x2C Interrupt Disable Register EMAC_IDR Write-only -
0x30 Interrupt Mask Register EMAC_IMR Read-only 0x0000_3FFF
0x34 Phy Maintenance Register EMAC_MAN Read-write 0x0000_0000
0x38 Pause Time Register EMAC_PTR Read-write 0x0000_0000
0x3C Pause Frames Received Register EMAC_PFR Read-write 0x0000_0000
0x40 Frames Transmitted Ok Register EMAC_FTO Read-write 0x0000_0000
0x44 Single Collision Frames Register EMAC_SCF Read-write 0x0000_0000
0x48 Multiple Collision Frames Register EMAC_MCF Read-write 0x0000_0000
0x4C Frames Received Ok Register EMAC_FRO Read-write 0x0000_0000
0x50 Frame Check Sequence Errors Register EMAC_FCSE Read-write 0x0000_0000
0x54 Alignment Errors Register EMAC_ALE Read-write 0x0000_0000
0x58 Deferred Transmission Frames Register EMAC_DTF Read-write 0x0000_0000
0x5C Late Collisions Register EMAC_LCOL Read-write 0x0000_0000
0x60 Excessive Collisions Register EMAC_ECOL Read-write 0x0000_0000
0x64 Transmit Underrun Errors Register EMAC_TUND Read-write 0x0000_0000
0x68 Carrier Sense Errors Register EMAC_CSE Read-write 0x0000_0000
0x6C Receive Resource Errors Register EMAC_RRE Read-write 0x0000_0000
0x70 Receive Overrun Errors Register EMAC_ROV Read-write 0x0000_0000
0x74 Receive Symbol Errors Register EMAC_RSE Read-write 0x0000_0000
0x78 Excessive Length Errors Register EMAC_ELE Read-write 0x0000_0000
0x7C Receive Jabbers Register EMAC_RJA Read-write 0x0000_0000
0x80 Undersize Frames Register EMAC_USF Read-write 0x0000_0000
0x84 SQE Test Errors Register EMAC_STE Read-write 0x0000_0000
0x88 Received Length Field Mismatch Register EMAC_RLE Read-write 0x0000_0000
675
6254C–ATARM–22-Jan-10
38.5.1 Network Control Register
Register Name: EMAC_NCR
Address: 0xFFFC4000
Access Type: Read-write
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – THALT TSTART BP
7 6 5 4 3 2 1 0
WESTAT INCSTAT CLRSTAT MPE TE RE LLB LB
• LB: LoopBack
Asserts the loopback signal to the PHY.
677
6254C–ATARM–22-Jan-10
38.5.2 Network Configuration Register
Register Name: EMAC_NCFG
Address: 0xFFFC4004
Access Type: Read-write
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – IRXFCS EFRHD DRFCS RLCE
15 14 13 12 11 10 9 8
RBOF PAE RTY CLK – BIG
7 6 5 4 3 2 1 0
UNI MTI NBC CAF JFRAME – FD SPD
• SPD: Speed
Set to 1 to indicate 100 Mbit/s operation, 0 for 10 Mbit/s. The value of this pin is reflected on the speed pin.
• NBC: No Broadcast
When set to 1, frames addressed to the broadcast address of all ones are not received.
CLK MDC
00 MCK divided by 8 (MCK up to 20 MHz)
01 MCK divided by 16 (MCK up to 40 MHz)
10 MCK divided by 32 (MCK up to 80 MHz)
11 MCK divided by 64 (MCK up to 160 MHz)
RBOF Offset
00 No offset from start of receive buffer
01 One-byte offset from start of receive buffer
10 Two-byte offset from start of receive buffer
11 Three-byte offset from start of receive buffer
• EFRHD:
Enable Frames to be received in half-duplex mode while transmitting.
679
6254C–ATARM–22-Jan-10
38.5.3 Network Status Register
Register Name: EMAC_NSR
Address: 0xFFFC4008
Access Type: Read-only
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
– – – – – IDLE MDIO –
• MDIO
Returns status of the mdio_in pin. Use the PHY maintenance register for reading managed frames rather than this bit.
• IDLE
0 = The PHY logic is running.
1 = The PHY management logic is idle (i.e., has completed).
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– UND COMP BEX TGO RLE COL UBR
This register, when read, provides details of the status of a transmit. Once read, individual bits may be cleared by writing 1
to them. It is not possible to set a bit to 1 by writing to the register.
• TGO: Transmit Go
If high transmit is active.
681
6254C–ATARM–22-Jan-10
38.5.5 Receive Buffer Queue Pointer Register
Register Name: EMAC_RBQP
Address: 0xFFFC4018
Access Type: Read-write
31 30 29 28 27 26 25 24
ADDR
23 22 21 20 19 18 17 16
ADDR
15 14 13 12 11 10 9 8
ADDR
7 6 5 4 3 2 1 0
ADDR – –
This register points to the entry in the receive buffer queue (descriptor list) currently being used. It is written with the start
location of the receive buffer descriptor list. The lower order bits increment as buffers are used up and wrap to their original
values after either 1024 buffers or when the wrap bit of the entry is set.
Reading this register returns the location of the descriptor currently being accessed. This value increments as buffers are
used. Software should not use this register for determining where to remove received frames from the queue as it con-
stantly changes as new frames are received. Software should instead work its way through the buffer descriptor queue
checking the used bits.
Receive buffer writes also comprise bursts of two words and, as with transmit buffer reads, it is recommended that bit 2 is
always written with zero to prevent a burst crossing a 1K boundary, in violation of section 3.6 of the AMBA specification.
23 22 21 20 19 18 17 16
ADDR
15 14 13 12 11 10 9 8
ADDR
7 6 5 4 3 2 1 0
ADDR – –
This register points to the entry in the transmit buffer queue (descriptor list) currently being used. It is written with the start
location of the transmit buffer descriptor list. The lower order bits increment as buffers are used up and wrap to their original
values after either 1024 buffers or when the wrap bit of the entry is set. This register can only be written when bit 3 in the
transmit status register is low.
As transmit buffer reads consist of bursts of two words, it is recommended that bit 2 is always written with zero to prevent a
burst crossing a 1K boundary, in violation of section 3.6 of the AMBA specification.
683
6254C–ATARM–22-Jan-10
38.5.7 Receive Status Register
Register Name: EMAC_RSR
Address: 0xFFFC4020
Access Type: Read-write
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
– – – – – OVR REC BNA
This register, when read, provides details of the status of a receive. Once read, individual bits may be cleared by writing 1
to them. It is not possible to set a bit to 1 by writing to the register.
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – PTZ PFR HRESP ROVR – –
7 6 5 4 3 2 1 0
TCOMP TXERR RLE TUND TXUBR RXUBR RCOMP MFD
685
6254C–ATARM–22-Jan-10
38.5.9 Interrupt Enable Register
Register Name: EMAC_IER
Address: 0xFFFC4028
Access Type: Write-only
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – PTZ PFR HRESP ROVR – –
7 6 5 4 3 2 1 0
TCOMP TXERR RLE TUND TXUBR RXUBR RCOMP MFD
• TXERR
Enable transmit buffers exhausted in mid-frame interrupt.
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – PTZ PFR HRESP ROVR – –
7 6 5 4 3 2 1 0
TCOMP TXERR RLE TUND TXUBR RXUBR RCOMP MFD
• TXERR
Disable transmit buffers exhausted in mid-frame interrupt.
687
6254C–ATARM–22-Jan-10
38.5.11 Interrupt Mask Register
Register Name: EMAC_IMR
Address: 0xFFFC4030
Access Type: Read-only
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – PTZ PFR HRESP ROVR – –
7 6 5 4 3 2 1 0
TCOMP TXERR RLE TUND TXUBR RXUBR RCOMP MFD
• TXERR
Transmit buffers exhausted in mid-frame interrupt masked.
23 22 21 20 19 18 17 16
PHYA REGA CODE
15 14 13 12 11 10 9 8
DATA
7 6 5 4 3 2 1 0
DATA
• DATA
For a write operation this is written with the data to be written to the PHY.
After a read operation this contains the data read from the PHY.
• CODE:
Must be written to 10. Reads as written.
• RW: Read-write
10 is read; 01 is write. Any other value is an invalid PHY management frame
689
6254C–ATARM–22-Jan-10
38.5.13 Pause Time Register
Register Name: EMAC_PTR
Address: 0xFFFC4038
Access Type: Read-write
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
PTIME
7 6 5 4 3 2 1 0
PTIME
23 22 21 20 19 18 17 16
ADDR
15 14 13 12 11 10 9 8
ADDR
7 6 5 4 3 2 1 0
ADDR
• ADDR:
Bits 31:0 of the hash address register. See “Hash Addressing” on page 668.
23 22 21 20 19 18 17 16
ADDR
15 14 13 12 11 10 9 8
ADDR
7 6 5 4 3 2 1 0
ADDR
• ADDR:
Bits 63:32 of the hash address register. See “Hash Addressing” on page 668.
691
6254C–ATARM–22-Jan-10
38.5.16 Specific Address 1 Bottom Register
Register Name: EMAC_SA1B
Address: 0xFFFC4098
Access Type: Read-write
31 30 29 28 27 26 25 24
ADDR
23 22 21 20 19 18 17 16
ADDR
15 14 13 12 11 10 9 8
ADDR
7 6 5 4 3 2 1 0
ADDR
• ADDR
Least significant bits of the destination address. Bit zero indicates whether the address is multicast or unicast and corre-
sponds to the least significant bit of the first byte received.
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
ADDR
7 6 5 4 3 2 1 0
ADDR
• ADDR
The most significant bits of the destination address, that is bits 47 to 32.
23 22 21 20 19 18 17 16
ADDR
15 14 13 12 11 10 9 8
ADDR
7 6 5 4 3 2 1 0
ADDR
• ADDR
Least significant bits of the destination address. Bit zero indicates whether the address is multicast or unicast and corre-
sponds to the least significant bit of the first byte received.
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
ADDR
7 6 5 4 3 2 1 0
ADDR
• ADDR
The most significant bits of the destination address, that is bits 47 to 32.
693
6254C–ATARM–22-Jan-10
38.5.20 Specific Address 3 Bottom Register
Register Name: EMAC_SA3B
Address: 0xFFFC40A8
Access Type: Read-write
31 30 29 28 27 26 25 24
ADDR
23 22 21 20 19 18 17 16
ADDR
15 14 13 12 11 10 9 8
ADDR
7 6 5 4 3 2 1 0
ADDR
• ADDR
Least significant bits of the destination address. Bit zero indicates whether the address is multicast or unicast and corre-
sponds to the least significant bit of the first byte received.
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
ADDR
7 6 5 4 3 2 1 0
ADDR
• ADDR
The most significant bits of the destination address, that is bits 47 to 32.
23 22 21 20 19 18 17 16
ADDR
15 14 13 12 11 10 9 8
ADDR
7 6 5 4 3 2 1 0
ADDR
• ADDR
Least significant bits of the destination address. Bit zero indicates whether the address is multicast or unicast and corre-
sponds to the least significant bit of the first byte received.
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
ADDR
7 6 5 4 3 2 1 0
ADDR
• ADDR
The most significant bits of the destination address, that is bits 47 to 32.
695
6254C–ATARM–22-Jan-10
38.5.24 Type ID Checking Register
Register Name: EMAC_TID
Address: 0xFFFC40B8
Access Type: Read-write
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
TID
7 6 5 4 3 2 1 0
TID
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – CLKEN RMII
• RMII
When set, this bit enables the RMII operation mode. When reset, it selects the MII mode.
• CLKEN
When set, this bit enables the transceiver input clock.
Setting this bit to 0 reduces power consumption when the treasurer is not used.
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
FROK
7 6 5 4 3 2 1 0
FROK
23 22 21 20 19 18 17 16
FTOK
15 14 13 12 11 10 9 8
FTOK
7 6 5 4 3 2 1 0
FTOK
697
6254C–ATARM–22-Jan-10
38.5.26.3 Single Collision Frames Register
Register Name: EMAC_SCF
Address: 0xFFFC4044
Access Type: Read-write
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
SCF
7 6 5 4 3 2 1 0
SCF
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
MCF
7 6 5 4 3 2 1 0
MCF
23 22 21 20 19 18 17 16
FROK
15 14 13 12 11 10 9 8
FROK
7 6 5 4 3 2 1 0
FROK
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
FCSE
699
6254C–ATARM–22-Jan-10
38.5.26.7 Alignment Errors Register
Register Name: EMAC_ALE
Address: 0xFFFC4054
Access Type: Read-write
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
ALE
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
DTF
7 6 5 4 3 2 1 0
DTF
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
LCOL
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
EXCOL
701
6254C–ATARM–22-Jan-10
38.5.26.11 Transmit Underrun Errors Register
Register Name: EMAC_TUND
Address: 0xFFFC4064
Access Type: Read-write
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
TUND
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
CSE
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
RRE
7 6 5 4 3 2 1 0
RRE
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
ROVR
703
6254C–ATARM–22-Jan-10
38.5.26.15 Receive Symbol Errors Register
Register Name: EMAC_RSE
Address: 0xFFFC4074
Access Type: Read-write
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
RSE
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
EXL
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
RJB
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
USF
705
6254C–ATARM–22-Jan-10
38.5.26.19 SQE Test Errors Register
Register Name: EMAC_STE
Address: 0xFFFC4084
Access Type: Read-write
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
SQER
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
RLFM
39.1 Description
The USB Device Port (UDP) is compliant with the Universal Serial Bus (USB) V2.0 full-speed
device specification.
Each endpoint can be configured in one of several USB transfer types. It can be associated with
one or two banks of a dual-port RAM used to store the current data payload. If two banks are
used, one DPR bank is read or written by the processor, while the other is read or written by the
USB device peripheral. This feature is mandatory for isochronous endpoints. Thus the device
maintains the maximum bandwidth (1M bytes/s) by working with endpoints with two banks of
DPR.
Suspend and resume are automatically detected by the USB device, which notifies the proces-
sor by raising an interrupt. Depending on the product, an external signal can be used to send a
wake up to the USB host controller.
707
6254C–ATARM–22-Jan-10
39.2 Block Diagram
Atmel Bridge
USB Device
APB
to
MCU txoen
Bus eopn
MCK U W W
s r Dual r Serial DP
txd
UDPCK e a Port a Interface Embedded
r p RAM p Engine USB
p p rxdm DM
Transceiver
I e e rxd
n FIFO 12 MHz SIE
r r
t rxdp
e
r
f
udp_int a
c
e Suspend/Resume Logic
Access to the UDP is via the APB bus interface. Read and write to the data FIFO are done by
reading and writing 8-bit values to APB registers.
The UDP peripheral requires two clocks: one peripheral clock used by the Master Clock domain
(MCK) and a 48 MHz clock (UDPCK) used by the 12 MHz domain.
A USB 2.0 full-speed pad is embedded and controlled by the Serial Interface Engine (SIE).
The signal external_resume is optional. It allows the UDP peripheral to wake up once in system
mode. The host is then notified that the device asks for a resume. This optional feature must be
also negotiated with the host during the enumeration.
39.3.3 Interrupt
The USB device interface has an interrupt line connected to the Advanced Interrupt Controller
(AIC).
Handling the USB device interrupt requires programming the AIC before configuring the UDP.
47 K
REXT
2 1
DDM
DDP
3 Type B 4
REXT Connector
The Control Transfer endpoint EP0 is always used when a USB device is first configured (USB v. 2.0 specifications).
A status transaction is a special type of host-to-device transaction used only in a control transfer.
The control transfer must be performed using endpoints with no ping-pong attributes. According
to the control sequence (read or write), the USB device sends or receives a status transaction.
No Data
Control Setup TX Status IN TX
Notes: 1. During the Status IN stage, the host waits for a zero length packet (Data IN transaction with no
data) from the device using DATA1 PID. Refer to Chapter 8 of the Universal Serial Bus Specifi-
cation, Rev. 2.0, for more information on the protocol layer.
2. During the Status OUT stage, the host emits a zero length packet to the device (Data OUT
transaction with no data).
USB Setup Data Setup ACK Data OUT Data OUT NAK Data OUT Data OUT ACK
Bus Packets PID PID PID PID PID PID
USB Bus Packets Data IN Data IN 1 ACK Data IN NAK Data IN Data IN 2 ACK
PID PID PID PID PID PID
TXPKTRDY Flag
(UDP_CSRx)
Set by the firmware Set by the firmware Cleared by Hw
Cleared by Hw
Interrupt Pending Interrupt
TXCOMP Flag Pending
(UDP_CSRx) Payload in FIFO
Cleared by Firmware Cleared by
DPR access by the hardware Firmware
DPR access by the firmware
FIFO (DPR)
Content Data IN 1 Load In Progress Data IN 2
Write Read
1st Data Payload
Bank 0
Endpoint 1
Read and Write at the Same Time
Data IN Packet
Bank 0
Endpoint 1 3rd Data Payload
TXPKTRDY Flag
(UDP_MCSRx) Cleared by USB Device,
Data Payload Fully Transmitted Set by Firmware,
Set by Firmware, Data Payload Written in FIFO Bank 1
Data Payload Written in FIFO Bank 0
Interrupt Pending
Set by USB
TXCOMP Flag Device Set by USB Device
(UDP_CSRx)
Interrupt Cleared by Firmware
Warning: There is software critical path due to the fact that once the second bank is filled, the
driver has to wait for TX_COMP to set TX_PKTRDY. If the delay between receiving TX_COMP
is set and TX_PKTRDY is set too long, some Data IN packets may be NACKed, reducing the
bandwidth.
Warning: TX_COMP must be cleared after TX_PKTRDY has been set.
USB Bus Data OUT ACK Data OUT2 Data OUT2 NAK Data OUT Data OUT2 ACK
PID Data OUT 1 PID PID PID PID PID
Packets
FIFO (DPR)
Data OUT 1 Data OUT 1 Data OUT 2
Content
Written by USB Device Microcontroller Read Written by USB Device
An interrupt is pending while the flag RX_DATA_BK0 is set. Memory transfer between the USB
device, the FIFO and microcontroller memory can not be done after RX_DATA_BK0 has been
cleared. Otherwise, the USB device would accept the next Data OUT transfer and overwrite the
current Data OUT packet in the FIFO.
Figure 39-10. Bank Swapping in Data OUT Transfers for Ping-pong Endpoints
Write Read
When using a ping-pong endpoint, the following procedures are required to perform Data OUT
transactions:
1. The host generates a Data OUT packet.
2. This packet is received by the USB device endpoint. It is written in the endpoint’s FIFO
Bank 0.
3. The USB device sends an ACK PID packet to the host. The host can immediately send
a second Data OUT packet. It is accepted by the device and copied to FIFO Bank 1.
4. The microcontroller is notified that the USB device has received a data payload, polling
RX_DATA_BK0 in the endpoint’s UDP_CSRx register. An interrupt is pending for this
endpoint while RX_DATA_BK0 is set.
5. The number of bytes available in the FIFO is made available by reading RXBYTECNT
in the endpoint’s UDP_CSRx register.
6. The microcontroller transfers out data received from the endpoint’s memory to the
microcontroller’s memory. Data received is made available by reading the endpoint’s
UDP_FDRx register.
7. The microcontroller notifies the USB peripheral device that it has finished the transfer
by clearing RX_DATA_BK0 in the endpoint’s UDP_CSRx register.
8. A third Data OUT packet can be accepted by the USB peripheral device and copied in
the FIFO Bank 0.
9. If a second Data OUT packet has been received, the microcontroller is notified by the
flag RX_DATA_BK1 set in the endpoint’s UDP_CSRx register. An interrupt is pending
for this endpoint while RX_DATA_BK1 is set.
USB Bus Data OUT ACK Data OUT ACK Data OUT
Packets PID Data OUT 1 PID PID Data OUT 2 PID PID Data OUT 3
A
P
FIFO (DPR)
Bank 0 Data OUT1 Data OUT 1 Data OUT 3
Write by USB Device Read By Microcontroller Write In Progress
FIFO (DPR)
Bank 1 Data OUT 2 Data OUT 2
Cleared by Firmware
FORCESTALL Set by Firmware
Interrupt Pending
Cleared by Firmware
STALLSENT
Set by
USB Device
Interrupt Pending
Attached
Hub Reset
Hub
or
Configured
Deconfigured
Bus Inactive
Powered Suspended
Bus Activity
Power
Interruption Reset
Bus Inactive
Suspended
Default
Bus Activity
Reset
Address
Assigned
Bus Inactive
Address Suspended
Bus Activity
Device Device
Deconfigured Configured
Bus Inactive
Configured
Suspended
Bus Activity
Movement from one state to another depends on the USB bus state or on standard requests
sent through control transactions via the default endpoint (endpoint 0).
After a period of bus inactivity, the USB device enters Suspend Mode. Accepting Sus-
pend/Resume requests from the USB host is mandatory. Constraints in Suspend Mode are very
strict for bus-powered applications; devices may not consume more than 500 µA on the USB
bus.
While in Suspend Mode, the host may wake up a device by sending a resume signal (bus activ-
ity) or a USB device may send a wake up request to the host, e.g., waking up a PC by moving a
USB mouse.
The wake up feature is not mandatory for all devices and must be negotiated with the host.
PIO
0: Force Wake UP (K State)
1: Normal Mode
1.5 K
DM
23 22 21 20 19 18 17 16
– – – – – – FRM_OK FRM_ERR
15 14 13 12 11 10 9 8
– – – – – FRM_NUM
7 6 5 4 3 2 1 0
FRM_NUM
• FRM_OK: Frame OK
This bit is set at SOF_EOP when the SOF packet is received without any error.
This bit is reset upon receipt of SOF_PID (Packet Identification).
In the Interrupt Status Register, the SOF interrupt is updated upon receiving SOF_PID. This bit is set without waiting for
EOP.
Note: In the 8-bit Register Interface, FRM_OK is bit 4 of FRM_NUM_H and FRM_ERR is bit 3 of FRM_NUM_L.
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – RSMINPR – CONFG FADDEN
This register is used to get and set the device state as specified in Chapter 9 of the USB Serial Bus Specification, Rev.2.0.
• CONFG: Configured
Read:
0 = Device is not in configured state.
1 = Device is in configured state.
Write:
0 = Sets device in a non configured state
1 = Sets device in configured state.
The device is set in configured state when it is in address state and receives a successful Set Configuration request. Refer
to Chapter 9 of the Universal Serial Bus Specification, Rev. 2.0 for more details.
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – FEN
7 6 5 4 3 2 1 0
– FADD
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – WAKEUP – SOFINT EXTRSM RXRSM RXSUSP
7 6 5 4 3 2 1 0
EP5INT EP4INT EP3INT EP2INT EP1INT EP0INT
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – WAKEUP – SOFINT EXTRSM RXRSM RXSUSP
7 6 5 4 3 2 1 0
EP5INT EP4INT EP3INT EP2INT EP1INT EP0INT
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – WAKEUP BIT12 SOFINT EXTRSM RXRSM RXSUSP
7 6 5 4 3 2 1 0
EP5INT EP4INT EP3INT EP2INT EP1INT EP0INT
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – WAKEUP ENDBUSRES SOFINT EXTRSM RXRSM RXSUSP
7 6 5 4 3 2 1 0
EP5INT EP4INT EP3INT EP2INT EP1INT EP0INT
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – WAKEUP ENDBUSRES SOFINT EXTRSM RXRSM RXSUSP
7 6 5 4 3 2 1 0
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
EP5 EP4 EP3 EP2 EP1 EP0
23 22 21 20 19 18 17 16
RXBYTECNT
15 14 13 12 11 10 9 8
EPEDS – – – DTGLE EPTYPE
7 6 5 4 3 2 1 0
RX_DATA_ FORCE STALLSENT RX_DATA_
DIR TXPKTRDY RXSETUP TXCOMP
BK1 STALL ISOERROR BK0
WARNING: Due to synchronization between MCK and UDPCK, the software application must wait for the end of the write
operation before executing another write by polling the bits which must be set/cleared.
//! Clear flags of UDP UDP_CSR register and waits for synchronization
#define Udp_ep_clr_flag(pInterface, endpoint, flags) { \
pInterface->UDP_CSR[endpoint] &= ~(flags); \
while ( (pInterface->UDP_CSR[endpoint] & (flags)) == (flags) ); \
}
//! Set flags of UDP UDP_CSR register and waits for synchronization
#define Udp_ep_set_flag(pInterface, endpoint, flags) { \
pInterface->UDP_CSR[endpoint] |= (flags); \
while ( (pInterface->UDP_CSR[endpoint] & (flags)) != (flags) ); \
}
Note: In a preemptive environment, set or clear the flag and wait for a time of 1 UDPCK clock cycle and 1peripheral clock cycle. How-
ever, RX_DATA_BLK0, TXPKTRDY, RX_DATA_BK1 require wait times of 3 UDPCK clock cycles and 3 peripheral clock cycles
before accessing DPR.
• RX_DATA_BK1: Receive Data Bank 1 (only used by endpoints with ping-pong attributes)
This flag generates an interrupt while it is set to one.
Write (Cleared by the firmware):
0 = Notifies USB device that data have been read in the FIFO’s Bank 1.
1 = To leave the read value unchanged.
Read (Set by the USB peripheral):
0 = No data packet has been received in the FIFO's Bank 1.
1 = A data packet has been received, it has been stored in FIFO's Bank 1.
When the device firmware has polled this bit or has been interrupted by this signal, it must transfer data from the FIFO to
microcontroller memory. The number of bytes received is available in RXBYTECNT field. Bank 1 FIFO values are read
through UDP_FDRx register. Once a transfer is done, the device firmware must release Bank 1 to the USB device by clear-
ing RX_DATA_BK1.
After setting or clearing this bit, a wait time of 3 UDPCK clock cycles and 3 peripheral clock cycles is required before
accessing DPR.
Read-write
000 Control
001 Isochronous OUT
101 Isochronous IN
010 Bulk OUT
110 Bulk IN
011 Interrupt OUT
111 Interrupt IN
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
FIFO_DATA
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – PUON TXVDIS
7 6 5 4 3 2 1 0
– – – – – – – –
WARNING: The UDP peripheral clock in the Power Management Controller (PMC) must be enabled before any read/write
operations to the UDP registers including the UDP_TXVC register.
• PUON: Pullup On
0: The 1.5KΩ integrated pullup on DP is disconnected.
1: The 1.5 KΩ integrated pullup on DP is connected.
NOTE: If the USB pullup is not connected on DP, the user should not write in any UDP register other than the UDP_TXVC
register. This is because if DP and DM are floating at 0, or pulled down, then SE0 is received by the device with the conse-
quence of a USB Reset.
40.1 Description
The USB Host Port (UHP) interfaces the USB with the host application. It handles Open HCI
protocol (Open Host Controller Interface) as well as USB v2.0 Full-speed and Low-speed
protocols.
The USB Host Port integrates a root hub and transceivers on downstream ports. It provides sev-
eral high-speed half-duplex serial communication ports at a baud rate of 12 Mbit/s. Up to 127
USB devices (printer, camera, mouse, keyboard, disk, etc.) and the USB hub can be connected
to the USB host in the USB “tiered star” topology.
The USB Host Port controller is fully compliant with the OpenHCI specification. The USB Host
Port User Interface (registers description) can be found in the Open HCI Rev 1.0 Specification
available on http://h18000.www1.hp.com/productinfo/development/openhci.html. The standard
OHCI USB stack driver can be easily ported to Atmel’s architecture in the same way all existing
class drivers run without hardware specialization.
This means that all standard class devices are automatically detected and available to the user
application. As an example, integrating an HID (Human Interface Device) class driver provides a
plug & play feature for all USB keyboards and mouses.
uhp_int
MCK
UHPCK
Access to the USB host operational registers is achieved through the AHB bus slave interface.
The OpenHCI host controller initializes master DMA transfers through the ASB bus master inter-
face as follows:
• Fetches endpoint descriptors and transfer descriptors
• Access to endpoint data from system memory
745
6254C–ATARM–22-Jan-10
• Access to the HC communication area
• Write status and retire transfer Descriptor
Memory access errors (abort, misalignment) lead to an “UnrecoverableError” indicated by the
corresponding flag in the host controller operational registers.
The USB root hub is integrated in the USB host. Several USB downstream ports are available.
The number of downstream ports can be determined by the software driver reading the root
hub’s operational registers. Device connection is automatically detected by the USB host port
logic.
USB physical transceivers are integrated in the product and driven by the root hub’s ports.
Over current protection on ports can be activated by the USB host controller. Atmel’s standard
product does not dedicate pads to external over current protection.
40.3.3 Interrupt
The USB host interface has an interrupt line connected to the Advanced Interrupt Controller
(AIC).
Handling USB host interrupts requires programming the AIC before configuring the UHP.
an Endpoint Descriptor to each endpoint in the system. A queue of Transfer Descriptors is linked
to the Endpoint Descriptor for the specific endpoint.
Open HCI
Status Interrupt 2
...
Event
Interrupt 31
Frame Int
...
Ratio
Control
Bulk
...
Done
Device Register
in Memory Space Shared RAM
HUB Driver
USB Driver
Hardware
Host Controller Hardware
747
6254C–ATARM–22-Jan-10
USB Handling is done through several layers as follows:
• Host controller hardware and serial engine: Transmits and receives USB data on the bus.
• Host controller driver: Drives the Host controller hardware and handles the USB protocol.
• USB Bus driver and hub driver: Handles USB commands and enumeration. Offers a
hardware independent interface.
• Mini driver: Handles device specific commands.
• Class driver: Handles standard devices. This acts as a generic driver for a class of devices,
for example the HID driver.
5V 0.20A
Type A Connector
10μF 100nF 10nF
HDMA REXT
or
HDMB
HDPA
or
HDPB REXT
A termination serial resistor must be connected to HDP and HDM. The resistor value is defined
in the electrical specification of the product (REXT).
41.1 Overview
The Image Sensor Interface (ISI) connects a CMOS-type image sensor to the processor and
provides image capture in various formats. It does data conversion, if necessary, before the stor-
age in memory through DMA.
The ISI supports color CMOS image sensor and grayscale image sensors with a reduced set of
functionalities.
In grayscale mode, the data stream is stored in memory without any processing and so is not
compatible with the LCD controller.
Internal FIFOs on the preview and codec paths are used to store the incoming data. The RGB
output on the preview path is compatible with the LCD controller. This module outputs the data
in RGB format (LCD compatible) and has scaling capabilities to make it compliant to the LCD
display resolution (See Table 41-3 on page 752).
Several input formats such as preprocessed RGB or YCbCr are supported through the data bus
interface.
It supports two modes of synchronization:
1. The hardware with ISI_VSYNC and ISI_HSYNC signals
2. The International Telecommunication Union Recommendation ITU-R BT.656-4 Start-of-
Active-Video (SAV) and End-of-Active-Video (EAV) synchronization sequence.
Using EAV/SAV for synchronization reduces the pin count (ISI_VSYNC, ISI_HSYNC not used).
The polarity of the synchronization pulse is programmable to comply with the sensor signals.
data[11..0] ISI_DATA[11..0]
CLK ISI_MCK
PCLK ISI_PCK
VSYNC ISI_VSYNC
HSYNC ISI_HSYNC
749
6254C–ATARM–22-Jan-10
41.2 Block Diagram
APB bus
Hsync/Len Timing Signals
Vsync/Fen Interface APB
Config
Camera Interface
Registers
Interrupt
Controller Camera
Interrupt Request Line
APB
CCIR-656
From Clock Domain
Embedded Timing
Decoder(SAV/EAV) Rx buffers
Pixel AHB
CMOS Clock Domain Clock Domain
sensor Frame Rate
Pixel input Clipping + Color Rx Direct
up to 12 bit 2-D Image Pixel Camera
Conversion Display
AHB bus
Scaler Formatter AHB
YCbCr 4:2:2 YCC to RGB FIFO
Pixel Sampling Core Master
8:8:8 Module Video Interface
RGB 5:6:5 Arbiter Scatter
Clipping + Color Packed Rx Direct Mode
Conversion Formatter Capture Support
RGB to YCC FIFO
CMOS
sensor
pixel clock codec_on
input
Frame
ISI_VSYNC
1 line
ISI_HSYNC
ISI_PCK
DATA[7..0] Y Cb Y Cr Y Cb Y Cr Y Cb Y Cr
ISII_PCK
DATA[7..0] FF 00 00 80 Y Cb Y Cr Y Cb Y Cr Y Y Cr Y Cb FF 00 00 9D
SAV Active Video EAV
751
6254C–ATARM–22-Jan-10
41.3.2 Data Ordering
The RGB color space format is required for viewing images on a display screen preview, and the
YCbCr color space format is required for encoding.
All the sensors do not output the YCbCr or RGB components in the same order. The ISI allows
the user to program the same component order as the sensor, reducing software treatments to
restore the right format.
Table 41-5. RGB Format in Default Mode, RGB_CFG = 00, Swap Activated
Mode Byte D7 D6 D5 D4 D3 D2 D1 D0
Byte 0 R0(i) R1(i) R2(i) R3(i) R4(i) R5(i) R6(i) R7(i)
Byte 1 G0(i) G1(i) G2(i) G3(i) G4(i) G5(i) G6(i) G7(i)
RGB 8:8:8
Byte 2 B0(i) B1(i) B2(i) B3(i) B4(i) B5(i) B6(i) B7(i)
Byte 3 R0(i+1) R1(i+1) R2(i+1) R3(i+1) R4(i+1) R5(i+1) R6(i+1) R7(i+1)
Byte 0 G3(i) G4(i) G5(i) R0(i) R1(i) R2(i) R3(i) R4(i)
Byte 1 B0(i) B1(i) B2(i) B3(i) B4(i) G0(i) G1(i) G2(i)
RGB 5:6:5
Byte 2 G3(i+1) G4(i+1) G5(i+1) R0(i+1) R1(i+1) R2(i+1) R3(i+1) R4(i+1)
Byte 3 B0(i+1) B1(i+1) B2(i+1) B3(i+1) B4(i+1) G0(i+1) G1(i+1) G2(i+1)
The RGB 5:6:5 input format is processed to be displayed as RGB 5:5:5 format, compliant with
the 16-bit mode of the LCD controller.
41.3.3 Clocks
The sensor master clock (ISI_MCK) can be generated either by the Advanced Power Manage-
ment Controller (APMC) through a Programmable Clock output or by an external oscillator
connected to the sensor.
None of the sensors embeds a power management controller, so providing the clock by the
APMC is a simple and efficient way to control power consumption of the system.
Care must be taken when programming the system clock. The ISI has two clock domains, the
system bus clock and the pixel clock provided by sensor. The two clock domains are not syn-
chronized, but the system clock must be faster than pixel clock.
753
6254C–ATARM–22-Jan-10
41.3.4 Preview Path
Example:
Input 1280*1024 Output=640*480
Hratio = 1280/640 =2
Vratio = 1024/480 =2.1333
The decimation factor is 2 so 32/16.
640
1024 480
352
1024 288
R C0 0 C1 Y – Y off
G = C 0 – C 2 – C 3
× C b – C boff
B C0 C4 0 C r – C roff
⎧ R = Y + 1,596 ⋅ V
⎪
⎨ G = Y – 0,394 ⋅ U – 0,436 ⋅ V
⎪ B = Y + 2,032 ⋅ U
⎩
755
6254C–ATARM–22-Jan-10
41.3.4.3 Memory Interface
Preview datapath contains a data formatter that converts 8:8:8 pixel to RGB 5:5:5 format compli-
ant with 16-bit format of the LCD controller. In general, when converting from a color channel
with more bits to one with fewer bits, formatter module discards the lower-order bits. Example:
Converting from RGB 8:8:8 to RGB 5:6:5, it discards the three LSBs from the red and blue chan-
nels, and two LSBs from the green channel. When grayscale mode is enabled, two memory
format are supported. One mode supports 2 pixels per word, and the other mode supports 1
pixel per word.
41.3.4.5 Example
The first FBD, stored at address 0x30000, defines the location of the first frame buffer.
Destination Address: frame buffer ID0 0x02A000
Next FBD address: 0x30010
Second FBD, stored at address 0x30010, defines the location of the second frame buffer.
Destination Address: frame buffer ID1 0x3A000
Transfer width: 32 bit
Next FBD address: 0x30000, wrapping to first FBD.
Using this technique, several frame buffers can be configured through the linked list. Figure 41-6
illustrates a typical three frame buffer application. Frame n is mapped to frame buffer 0, frame
n+1 is mapped to frame buffer 1, frame n+2 is mapped to Frame buffer 2, further frames wrap. A
codec request occurs, and the full-size 4:2:2 encoded frame is stored in a dedicated memory
space.
frame n-1 frame n frame n+1 frame n+2 frame n+3 frame n+4
Memory Space
Frame Buffer 3
Frame Buffer 0
LCD
Frame Buffer 1
4:2:2 Image
Full ROI
Y C0 C1 C2 R Y off
Cr = C 3 – C 4 – C 5 × G + Cr off
Cb –C6 –C7 C8 B Cb off
757
6254C–ATARM–22-Jan-10
41.3.5.2 Memory Interface
Dedicated FIFO are used to support packed memory mapping. YCrCb pixel components are
sent in a single 32-bit word in a contiguous space (packed). Data is stored in the order of natural
scan lines. Planar mode is not supported.
759
6254C–ATARM–22-Jan-10
41.4.1 ISI Control 1 Register
Name: ISI_CR1
Address: 0xFFFC0000
Acess: Read-write
Reset: 0x00000002
31 30 29 28 27 26 25 24
SFD
23 22 21 20 19 18 17 16
SLD
15 14 13 12 11 10 9 8
CODEC_ON THMASK FULL - FRATE
7 6 5 4 3 2 1 0
CRC_SYNC EMB_SYNC - PIXCLK_POL VSYNC_POL HSYNC_POL ISI_DIS ISI_RST
1: CRC correction is performed. if the correction is not possible, the current frame is discarded and the CRC_ERR is set in
the status register.
761
6254C–ATARM–22-Jan-10
41.4.2 ISI Control 2 Register
Name: ISI_CR2
Address: 0xFFFC0004
Acess: Read-write
Reset: 0x0
31 30 29 28 27 26 25 24
RGB_CFG YCC_SWAP - IM_HSIZE
23 22 21 20 19 18 17 16
IM_HSIZE
15 14 13 12 11 10 9 8
COL_SPACE RGB_SWAP GRAYSCALE RGB_MODE GS_MODE IM_VSIZE
7 6 5 4 3 2 1 0
IM_VSIZE
• GS_MODE
0: 2 pixels per word
1: 1 pixel per word
• GRAYSCALE
0: Grayscale mode is disabled
1: Input image is assumed to be grayscale coded
• RGB_SWAP
0: D7 -> R7
1: D0 -> R7
The RGB_SWAP has no effect when the grayscale mode is enabled.
If RGB_MODE is set to RGB 8:8:8, then RGB_CFG = 0 implies RGB color sequence, else it implies BGR color sequence.
763
6254C–ATARM–22-Jan-10
41.4.3 ISI Status Register
Name: ISI_SR
Address: 0xFFFC0008
Acess: Read
Reset: 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
– – – – – – FR_OVR FO_C_EMP
7 6 5 4 3 2 1 0
FO_P_EMP FO_P_OVF FO_C_OVF CRC_ERR CDC_PND SOFTRST DIS SOF
• FO_P_EMP
0:The DMA has not finished transferring all the contents of the preview FIFO.
1:The DMA has finished transferring all the contents of the preview FIFO.
• FO_C_EMP
0: The DMA has not finished transferring all the contents of the codec FIFO.
1: The DMA has finished transferring all the contents of the codec FIFO.
765
6254C–ATARM–22-Jan-10
41.4.4 Interrupt Enable Register
Name: ISI_IER
Address: 0xFFFC000C
Acess: Read-write
Reset: 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
– – – – – – FR_OVR FO_C_EMP
7 6 5 4 3 2 1 0
FO_P_EMP FO_P_OVF FO_C_OVF CRC_ERR – SOFTRST DIS SOF
• FO_P_EMP
1: Enables the preview FIFO empty interrupt.
• FO_C_EMP
1: Enables the codec FIFO empty interrupt.
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – FR_OVR FO_C_EMP
7 6 5 4 3 2 1 0
FO_P_EMP FO_P_OVF FO_C_OVF CRC_ERR – SOFTRST DIS SOF
• SOFTRST
1: Disables the soft reset completion interrupt.
• FO_P_EMP
1: Disables the preview FIFO empty interrupt.
• FO_C_EMP
1: Disables the codec FIFO empty interrupt.
• FR_OVR
1: Disables frame overrun interrupt.
767
6254C–ATARM–22-Jan-10
41.4.6 ISI Interrupt Mask Register
Name: ISI_IMR
Address: 0xFFFC0014
Acess: Read-write
Reset: 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
– – – – – – FR_OVR FO_C_EMP
7 6 5 4 3 2 1 0
FO_P_EMP FO_P_OVF FO_C_OVF CRC_ERR – SOFTRST DIS SOF
• SOFTRST
0: The soft reset completion interrupt is enabled.
1: The soft reset completion interrupt is disabled.
• FO_P_EMP
0: The preview FIFO empty interrupt is disabled.
1: The preview FIFO empty interrupt is enabled.
• FO_C_EMP
0: The codec FIFO empty interrupt is disabled.
1: The codec FIFO empty interrupt is enabled.
• FR_OVR: Frame Rate Overrun
0: The frame overrun interrupt is disabled.
1: The frame overrun interrupt is enabled.
769
6254C–ATARM–22-Jan-10
41.4.7 ISI Preview Register
Name: ISI_PSIZE
Address: 0xFFFC0020
Acess: Read-write
Reset: 0x0
31 30 29 28 27 26 25 24
– – – – – – PREV_HSIZE
23 22 21 20 19 18 17 16
PREV_HSIZE
15 14 13 12 11 10 9 8
– – – – – – PREV_VSIZE
7 6 5 4 3 2 1 0
PREV_VSIZE
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
DEC_FACTOR
771
6254C–ATARM–22-Jan-10
41.4.9 ISI Preview Primary FBD Register
Name: ISI_PPFBD
Address: 0xFFFC0028
Acess: Read-write
Reset: 0x0
31 30 29 28 27 26 25 24
PREV_FBD_ADDR
23 22 21 20 19 18 17 16
PREV_FBD_ADDR
15 14 13 12 11 10 9 8
PREV_FBD_ADDR
7 6 5 4 3 2 1 0
PREV_FBD_ADDR
31 30 29 28 27 26 25 24
CODEC_DMA_ADDR
23 22 21 20 19 18 17 16
CODEC_DMA_ADDR
15 14 13 12 11 10 9 8
CODEC_DMA_ADDR
7 6 5 4 3 2 1 0
CODEC_DMA_ADDR
773
6254C–ATARM–22-Jan-10
41.4.11 ISI Color Space Conversion YCrCb to RGB Set 0 Register
Name: ISI_Y2R_SET0
Address: 0xFFFC0030
Acess: Read-write
Reset: 0x6832cc95
31 30 29 28 27 26 25 24
C3
23 22 21 20 19 18 17 16
C2
15 14 13 12 11 10 9 8
C1
7 6 5 4 3 2 1 0
C0
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– Cboff Croff Yoff – – – C4
C4
775
6254C–ATARM–22-Jan-10
41.4.13 ISI Color Space Conversion RGB to YCrCb Set 0 Register
Name: ISI_R2Y_SET0
Address: 0xFFFC0038
Acess: Read-write
Reset: 0x01324145
31 30 29 28 27 26 25 24
– – – – – – – Roff
23 22 21 20 19 18 17 16
C2
15 14 13 12 11 10 9 8
C1
7 6 5 4 3 2 1 0
C0
31 30 29 28 27 26 25 24
– – – – – – – Goff
23 22 21 20 19 18 17 16
C5
15 14 13 12 11 10 9 8
C4
7 6 5 4 3 2 1 0
C3
777
6254C–ATARM–22-Jan-10
41.4.15 ISI Color Space Conversion RGB to YCrCb Set 2 Register
Name: ISI_R2Y_SET2
Address: 0xFFFC0040
Acess: Read-write
Reset: 0x01384a4b
31 30 29 28 27 26 25 24
– – – – – – – Boff
23 22 21 20 19 18 17 16
C8
15 14 13 12 11 10 9 8
C7
7 6 5 4 3 2 1 0
C6
42.1 Description
The ADC is based on a Successive Approximation Register (SAR) 10-bit Analog-to-Digital Con-
verter (ADC). It also integrates an 4-to-1 analog multiplexer, making possible the analog-to-
digital conversions of 4 analog lines. The conversions extend from 0V to ADVREF.
The ADC supports an 8-bit or 10-bit resolution mode, and conversion results are reported in a
common register for all channels, as well as in a channel-dedicated register. Software trigger,
external trigger on rising edge of the ADTRG pin or internal triggers from Timer Counter out-
put(s) are configurable.
The ADC also integrates a Sleep Mode and a conversion sequencer and connects with a PDC
channel. These features reduce both power consumption and processor intervention.
Finally, the user can configure ADC timings, such as Startup Time and Sample & Hold Time.
MCK
ADC Controller
Trigger
ADTRG Selection ADC Interrupt
Control AIC
Logic
ADVREF
ASB
AD- PDC
Dedicated
AD-
Analog
Inputs User
Interface Peripheral Bridge
AD- Successive
Approximation
Register
Analog-to-Digital
AD-
Analog Inputs PIO Converter
APB
Multiplexed AD-
with I/O lines
AD-
GND
779
6254C–ATARM–22-Jan-10
42.3 Signal Description
Table 42-1. ADC Pin Description
Pin Name Description
VDDANA Analog power supply
ADVREF Reference voltage
AD0 - AD3 Analog input channels
ADTRG External trigger
781
6254C–ATARM–22-Jan-10
42.5.4 Conversion Results
When a conversion is completed, the resulting 10-bit digital value is stored in the Channel Data
Register (ADC_CDR) of the current channel and in the ADC Last Converted Data Register
(ADC_LCDR).
The channel EOC bit in the Status Register (ADC_SR) is set and the DRDY is set. In the case of
a connected PDC channel, DRDY rising triggers a data transfer request. In any case, either
EOC and DRDY can trigger an interrupt.
Reading one of the ADC_CDR registers clears the corresponding EOC bit. Reading ADC_LCDR
clears the DRDY bit and the EOC bit corresponding to the last converted channel.
CHx
(ADC_CHSR)
EOCx
(ADC_SR)
DRDY
(ADC_SR)
If the ADC_CDR is not read before further incoming data is converted, the corresponding Over-
run Error (OVRE) flag is set in the Status Register (ADC_SR).
In the same way, new data converted when DRDY is high sets the bit GOVRE (General Overrun
Error) in ADC_SR.
The OVRE and GOVRE flags are automatically cleared when ADC_SR is read.
Read ADC_SR
ADTRG
CH0
(ADC_CHSR)
CH1
(ADC_CHSR)
EOC0 Conversion
(ADC_SR) Conversion Read ADC_CDR0
GOVRE
(ADC_SR)
DRDY
(ADC_SR)
OVRE0
(ADC_SR)
783
6254C–ATARM–22-Jan-10
42.5.5 Conversion Triggers
Conversions of the active analog channels are started with a software or a hardware trigger. The
software trigger is provided by writing the Control Register (ADC_CR) with the bit START at 1.
The hardware trigger can be one of the TIOA outputs of the Timer Counter channels, or the
external trigger input of the ADC (ADTRG). The hardware trigger is selected with the field TRG-
SEL in the Mode Register (ADC_MR). The selected hardware trigger is enabled with the bit
TRGEN in the Mode Register (ADC_MR).
If a hardware trigger is selected, the start of a conversion is detected at each rising edge of the
selected signal. If one of the TIOA outputs is selected, the corresponding Timer Counter channel
must be programmed in Waveform Mode.
Only one start command is necessary to initiate a conversion sequence on all the channels. The
ADC hardware logic automatically performs the conversions on the active channels, then waits
for a new request. The Channel Enable (ADC_CHER) and Channel Disable (ADC_CHDR) Reg-
isters enable the analog channels to be enabled or disabled independently.
If the ADC is used with a PDC, only the transfers of converted data from enabled channels are
performed and the resulting data buffers should be interpreted accordingly.
Warning: Enabling hardware triggers does not disable the software trigger functionality. Thus, if
a hardware trigger is selected, the start of a conversion can be initiated either by the hardware or
the software trigger.
785
6254C–ATARM–22-Jan-10
42.6 Analog-to-Digital Converter (ADC) User Interface
Table 42-2. Register Mapping
Offset Register Name Access Reset
0x00 Control Register ADC_CR Write-only –
0x04 Mode Register ADC_MR Read-write 0x00000000
0x08 Reserved – – –
0x0C Reserved – – –
0x10 Channel Enable Register ADC_CHER Write-only –
0x14 Channel Disable Register ADC_CHDR Write-only –
0x18 Channel Status Register ADC_CHSR Read-only 0x00000000
0x1C Status Register ADC_SR Read-only 0x000C0000
0x20 Last Converted Data Register ADC_LCDR Read-only 0x00000000
0x24 Interrupt Enable Register ADC_IER Write-only –
0x28 Interrupt Disable Register ADC_IDR Write-only –
0x2C Interrupt Mask Register ADC_IMR Read-only 0x00000000
0x30 Channel Data Register 0 ADC_CDR0 Read-only 0x00000000
0x34 Channel Data Register 1 ADC_CDR1 Read-only 0x00000000
... ... ... ... ...
0x40 Channel Data Register 3 ADC_CDR3 Read-only 0x00000000
0x44 - 0xFC Reserved – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – START SWRST
787
6254C–ATARM–22-Jan-10
42.6.2 ADC Mode Register
Register Name: ADC_MR
Address: 0xFFFE0004
Access Type: Read/Write
31 30 29 28 27 26 25 24
– – – – SHTIM
23 22 21 20 19 18 17 16
– STARTUP
15 14 13 12 11 10 9 8
PRESCAL
7 6 5 4 3 2 1 0
– – SLEEP LOWRES TRGSEL TRGEN
• LOWRES: Resolution
789
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – CH3 CH2 CH1 CH0
790
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – CH3 CH2 CH1 CH0
791
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – CH3 CH2 CH1 CH0
792
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – RXBUFF ENDRX GOVRE DRDY
15 14 13 12 11 10 9 8
– – – – OVRE3 OVRE2 OVRE1 OVRE0
7 6 5 4 3 2 1 0
– – – – EOC3 EOC2 EOC1 EOC0
793
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – LDATA
7 6 5 4 3 2 1 0
LDATA
794
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – RXBUFF ENDRX GOVRE DRDY
15 14 13 12 11 10 9 8
– – – – OVRE3 OVRE2 OVRE1 OVRE0
7 6 5 4 3 2 1 0
– – – – EOC3 EOC2 EOC1 EOC0
795
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – RXBUFF ENDRX GOVRE DRDY
15 14 13 12 11 10 9 8
– – – – OVRE3 OVRE2 OVRE1 OVRE0
7 6 5 4 3 2 1 0
– – – – EOC3 EOC2 EOC1 EOC0
796
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – RXBUFF ENDRX GOVRE DRDY
15 14 13 12 11 10 9 8
– – – – OVRE3 OVRE2 OVRE1 OVRE0
7 6 5 4 3 2 1 0
– – – – EOC3 EOC2 EOC1 EOC0
797
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – DATA
7 6 5 4 3 2 1 0
DATA
798
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
799
6254C–ATARM–22-Jan-10
43.2 DC Characteristics
The following characteristics are applicable to the operating temperature range: TA = -40°C to 85°C, unless otherwise
specified.
801
6254C–ATARM–22-Jan-10
43.3 Power Consumption
• Typical power consumption of PLLs, Slow Clock and Main Oscillator.
• Power consumption of power supply in four different modes: Active, Idle, Ultra Low-power
and Backup.
• Power consumption by peripheral: calculated as the difference in current measurement after
having enabled then disabled the corresponding clock.
VDDBU
AMP1
VDDCORE
AMP2
These figures represent the power consumption estimated on the power supplies.
803
6254C–ATARM–22-Jan-10
43.4 Clock Characteristics
Note: 1. These characteristics apply only when the Main Oscillator is in bypass mode (i.e. when MOSCEN = 0 and OSCBYPASS = 1)
in the CKGR_MOR register. See “PMC Clock Generator Main Oscillator Register” in the PMC section.
43.4.4 I/Os
Criteria used to define the maximum frequency of the I/Os:
• output duty cycle (40%-60%)
• minimum output swing: 100 mV to VDDIO - 100 mV
• Addition of rising and falling time inferior to 75% of the period
Notes: 1. 3.3V domain: VVDDIOP from 3.0V to 3.6V, maximum external capacitor = 40 pF
2. 2.5V domain: VVDDIOP from 2.3V to 2.7V, maximum external capacitor = 30 pF
3. 1.8V domain: VVDDIOP from 1.65V to 1.95V, maximum external capacitor = 20 pF
805
6254C–ATARM–22-Jan-10
43.5 Crystal Oscillator Characteristics
The following characteristics are applicable to the operating temperature range: TA = -40°C to 85°C and worst case of
power supply, unless otherwise specified.
AT91SAM9XE
CCRYSTAL32
CLEXT32 CLEXT32
The startup counter delay for the slow clock oscillator depends on the OSCSEL signal. The
32,768 Hz startup delay is 1200 ms whereas it is 200 µs for the internal RC oscillator. The pin
OSCSEL must be tied either to GNDBU or VDDBU for correct operation of the device.
807
6254C–ATARM–22-Jan-10
43.5.4 Main Oscillator Characteristics
AT91SAM9XE
XIN XOUT
GNDPLL
1K
CCRYSTAL
CLEXT CLEXT
Note: 1. Startup time depends on PLL RC filter. A calculation tool is provided by Atmel.
Note: 1. The embedded filter is optimized for a 2 MHz input frequency. DIVB must be selected to meet this requirement.
809
6254C–ATARM–22-Jan-10
43.6 ADC
Table 43-19. Channel Conversion Time and ADC Clock
Parameter Conditions Min Typ Max Units
ADC Clock Frequency 10-bit resolution mode 5 MHz
Startup Time Return from Idle Mode 15 µs
(1)
Track and Hold Acquisition Time ADC Clock = 5 MHz 1.2 µs
Conversion Time ADC Clock = 5 MHz 2 µs
Throughput Rate ADC Clock = 5 MHz 312 kSPS
Note: 1. In worst case, the Track-and-Hold Acquisition Time is given by:
In case of very high input impedance, this value must be respected in order to guarantee the correct converted value. An
internal input current buffer supplies the current required for the low input impedance (1 mA max).
To achieve optimal performance of the ADC, the analog power supply VDDANA and the ADVREF input voltage must be
decoupled with a 4.7µF capacitor in parallel with a 100 nF capacitor.
811
6254C–ATARM–22-Jan-10
43.8 Core Power Supply POR Characteristics
The board design must comply with the power-up guidelines below to guarantee reliable opera-
tion of the device. Any deviation from these sequences may prevent the device from booting.
VDDCORE and VDDBU are controlled by internal POR (Power-On-Reset) to guarantee that
these power sources reach their target values prior to the release of POR.
To ensure a working system, VDDIOP0, VDDIOP1, and VDDIOM should be established to
power external memories and I/Os before the first acces. This can be achieved if VDDIOP0,
VDDIOP1, and VDDIOM are powered before VDDCORE.
Table 43-25. Maximum MCK Frequency vs. Embedded Flash Wait States
FWS T = 85°C VDDCORE = 1.8V (MHz) T = 85°C VDDCORE = 1.65V (MHz)
0 19 17
1 40 36
2 60 48
3 76 62
4 90 80
813
6254C–ATARM–22-Jan-10
43.12 SMC Timings
815
6254C–ATARM–22-Jan-10
Table 43-30. SMC Write Signals - NWE Controlled (Write_Mode = 1) (Continued)
Min Max
Symbol Parameter 1.8V Supply 3.3V Supply 1.8V Supply 3.3V Supply Units
HOLD SETTINGS (nwe hold …0)
NWE High to Data OUT, NBS0/A0
nwe hold * nwe hold *
SMC19 NBS1, NBS2/A1, NBS3, A2 - A25 ns
tCPMCK -2.8 tCPMCK -5.6
change
(nwe hold - ncs (nwe hold - ncs
SMC20 NWE High to NCS Inactive (1) wr hold)* tCPMCK wr hold)* ns
-1.4 tCPMCK -1.4
NO HOLD SETTINGS (nwe hold = 0)
NWE High to Data OUT, NBS0/A0
SMC21 NBS1, NBS2/A1, NBS3, A2 - A25, 3.3 3.2 ns
NCS change(1)
Note: 1. hold length = total cycle duration - setup duration - pulse duration. “hold length” is for “ncs wr hold length” or “NWE hold
length”.
A0/A1/NBS[3:0]/A2-A25
SMC13 SMC13
NRD
D0 - D15
SMC25 SMC27
NWE
Figure 43-3. SMC Timings - NRD Controlled Read and NWE Controlled Write
A0/A1/NBS[3:0]/A2-A25
NCS
SMC7 SMC7
NRD
D0 - D31
NRD Controlled READ NWE Controlled WRITE NRD Controlled READ NWE Controlled WRITE
with NO HOLD with NO HOLD with HOLD with HOLD
817
6254C–ATARM–22-Jan-10
43.13 SDRAMC
Notes: 1. Control is the set of following signals: SDCKE, SDCS, RAS, CAS, SDA10, BAx, DQMx, and
SDWE
2. Address is the set of A0-A9, A11-A13
3. 133MHz with CL = 3, 100 MHz with C L= 2
819
6254C–ATARM–22-Jan-10
43.14 EMAC Timings
EMDC
EMAC1 EMAC2 EMAC3
EMDIO
EMAC4 EMAC5
ECOL
EMAC6 EMAC7
ECRS
ETXCK
EMAC8
ETXER
EMAC9
ETXEN
EMAC10
ETX[3:0]
ERXCK
EMAC11 EMAC12
ERX[3:0]
EMAC13 EMAC14
ERXER
EMAC15 EMAC16
ERXDV
821
6254C–ATARM–22-Jan-10
43.14.2 RMII Mode
EREFCK
EMAC21
ETXEN
EMAC22
ETX[1:0]
EMAC23 EMAC24
ERX[1:0]
EMAC25 EMAC26
ERXER
EMAC27 EMAC28
ECRSDV
43.15.1 SPI
SPCK
SPI0 SPI1
MISO
SPI2
MOSI
SPCK
SPI3 SPI4
MISO
SPI5
MOSI
SPCK
SPI6
MISO
SPI7 SPI8
MOSI
823
6254C–ATARM–22-Jan-10
Figure 43-9. SPI Slave Mode 1 and 2
SPCK
SPI9
MISO
SPI10 SPI11
MOSI
43.15.2 ISI
VSYNC
7
HSYNC
2
5 6
PIXCLK
3 4
825
6254C–ATARM–22-Jan-10
Table 43-43. ISI Timings with Peripheral Supply 1.8V
Symbol Parameter Min Max Units
ISI1 VSYNC to HSYNC 1.67 ns
ISI2 HSYNC to PIXCLK -2.26 ns
ISI3 DATA setup time -1.33 ns
ISI4 DATA hold time 4.56 ns
ISI5 PIXCLK high time -0.01 ns
ISI6 PIXCLK low time 0.15 ns
ISI7 PIXCLK frequency 64.4 MHz
43.15.3 SSC
TK (CKI =0)
TK (CKI =1)
SSC0
TF/TD
TK (CKI =0)
TK (CKI =1)
SSC1
TF/TD
TK (CKI=1)
SSC2 SSC3
TF
SSC4
TD
TK (CKI=0)
SSC5 SSC6
TF
SSC7
TD
827
6254C–ATARM–22-Jan-10
Figure 43-15. SSC Receiver RK and RF as Input
RK (CKI=0)
RK (CKI=1)
SSC8 SSC9
RF/RD
RK (CKI=0)
SSC8 SSC9
RD
SSC10
RF
RK (CKI=0)
SSC11 SSC12
RD
SSC13
RF
RK (CKI=1)
SSC11 SSC12
RF/RD
TK (CKI =1)
TK (CKI =0)
SSC0min
SSC0max
TF/TD
829
6254C–ATARM–22-Jan-10
43.15.4 MCI
The PDC interface block controls all data routing between the external data bus, internal
MMC/SD module data bus, and internal system FIFO access through a dedicated state machine
that monitors the status of FIFO content (empty or full), FIFO address, and byte/block counters
for the MMC/SD module (inner system) and the application (user programming).
These timings are given for a 25 pF load, corresponding to 1 MMC/SD Card.
3a 1 2
3b 4b
Bus Clock 4a
5a 5b
6a 6b
43.15.5 UDP
VCRS 90%
10% 10%
Differential tR tF
Data Lines
(a)
REXT=27 ohms
Fosc = 6 MHz/750 kHz
Cload
Buffer
(b)
831
6254C–ATARM–22-Jan-10
44. AT91SAM9XE128/256/512 Mechanical Characteristics
833
6254C–ATARM–22-Jan-10
Figure 44-2. 208-lead PQFP Package Drawing
835
6254C–ATARM–22-Jan-10
45. AT91SAM9XE128/256/512 Ordering Information
46.1 Marking
All devices are marked with the Atmel logo and the ordering code.
Additional marking may be in one of the following formats:
YYWW V
XXXXXXXXX ARM
where
• “YY”: manufactory year
• “WW”: manufactory week
• “V”: revision
• “XXXXXXXXX”: lot number
837
6254C–ATARM–22-Jan-10
46.2 AT91SAM9XE128/256/512 Errata - Revision A parts
Refer to Section 46.1 “Marking” on page 837.
46.2.3.2 MCI: SDIO Interrupt does not work with slots other than A
If there is 1-bit data bus width on slots other than slot A, the SDIO interrupt can not be captured.
The sample is made on the wrong data line.
Problem Fix/Workaround
None
Enable the interrupts related to ENDRX, ENDTX, RXBUFF and TXBUFE only after enabling the
PDC channel by writing PDC_TXTEN or PDC_RXTEN.
839
6254C–ATARM–22-Jan-10
46.2.6 Serial Peripheral Interface (SPI)
46.2.6.1 SPI: Bad Serial Clock Generation on second chip_select when SCBR = 1, CPOL = 1 and NCPHA = 0
If the SPI is used in the following configuration:
• master mode
• CPOL = 1 and NCPHA = 0
• multiple chip selects used with one transfer with Baud rate (SCBR) equal to 1 (i.e., when
serial clock frequency equals the system clock frequency) and the other transfers set with
SCBR not equal to 1
• transmit with the slowest chip select and then with the fastest one,
then an additional pulse will be generated on output SPCK during the second transfer.
Problem Fix/Workaround
Do not use a multiple Chip Select configuration where at least one SCRx register is configured
with SCBR = 1 and the others differ from 1 if CPHA = 0 and CPOL = 1.
If all chip selects are configured with Baudrate = 1, the issue does not appear.
Unexpected delay from 2 to 3 system clock cycles is added to TD output. TD should be synchro-
nized on serial clock edge but is actually output a few cycles of SSC clock later.
Problem Fix/Workaround
None.
46.2.7.4 SSC: Last RK Clock Cycle when RK outputs a clock during data transfer
When the SSC receiver is used with the following conditions:
• the internal clock divider is used (CKS = 0 and DIV different from 0)
• RK pin set as output and provides the clock during data transfer (CKO = 2)
• data sampled on RK falling edge (CKI = 0)
At the end of the data, the RK pin is set in high impedance which might be seen as an unex-
pected clock cycle.
Problem Fix/Workaround
Enable the pull-up on RK pin.
46.2.7.5 SSC: First RK Clock Cycle when RK outputs a clock during data transfer
When the SSC receiver is used with the following conditions:
• RX clock is divided clock (CKS =0 and DIV different from 0)
• RK pin set as output and provides the clock during data transfer (CKO = 2)
• data sampled on RK falling edge (CKI =0)
The first clock cycle time generated by the RK pin is equal to MCK /(2 x (value +1)).
Problem Fix/Workaround
None.
841
6254C–ATARM–22-Jan-10
46.2.8 Two-wire Interface (TWI)
Consequence: After the failure condition, the Host controller stops sending the SOF. This
causes the connected device to go into suspend state.
Problem Fix/Workaround
This problem can be avoided if the system can guarantee that no buffer underrun occurs during
the transfer.
843
6254C–ATARM–22-Jan-10
844 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Revision History
In the tables that follow the most recent version of the document appears first.
Doc Change
Rev. Request
6254C Comments Ref.
Overview:
Table 3-1, “Signal Description List”, PCKx, DBGU, AIC, PIOC, USART, SSC, TC, SPI, TWI voltage references 6401
removed. Cross reference referring to PIO Multiplexing added to these signals.
Table 10-3, “Multiplexing on PIO Controller B”, PB16 to PB21, Peripheral A column updated.
Table 10-4, “Multiplexing on PIO Controller C”, PC0 to PC3, Power Supply column updated.
Figure 8-1 “AT91SAM9XE128/256/512 Memory Mapping”, GPBR addresses changed. 6767
Section 6.1 “ERASE Pin”, ERASE pin is powered by VDDIOP0 rail.
6927
Section 7.2.2 “Matrix Slaves” and Section 7.2.3 “Masters to Slaves Access”
Slave order changed in Table 7-2 and Table 7-3
Section 8.1.4 “ROM Topology” and Figure 8-2 “ROM Boot Memory Map”, added PA3.
Section 8.1.4.1 “Fast Flash Programming Interface”, added PA3. Table 8-1, added PGMEN3 and PA3.
Table 3-1, “Signal Description List”, PGMEN[3:0] replaces PGMEN[2:0].
Section 9.2 “Reset Controller”, added: “At reset the NRST pin is an output”.
Section 8.2.5 “I/O Drive Selection”, added to datasheet. 6768
GLobal: KB rewritten as -Kbyte or Kbytes, MB as Mbytes or -Mbyte (conform to style guide; lit° 3363B) techpubs/rfo
EFC:
Section 20.3.3.2 “Write Commands”, added consraint on partial programming mode below Figure 20-7 6826
“Example of Partial Page Programming”.
EMAC:
Section 38. “Ethernet MAC 10/100 (EMAC)” WOL bit description and other related text removed from section. 6789
FFPI:
Figure 14-1 “Parallel Programming Interface” and Figure 14-4 “Serial Programming”, removed VDDFLASH, 6863
TST is connected to VDDBU, added PGMEN3.
Table 14-1, “Signal Description List” and Table 14-17, “Signal Description List”, removed VDDFLASH, added
Backup Power supply, TST is connected to by VDDBU, added PGMEN3.
Section 14.2.3 “Entering Programming Mode” and Section 14.3.2 “Entering Serial Programming Mode”,
removed VDDFLASH from algorithm.
MATRIX:
Section 21.6.1 “EBI Chip Select Assignment Register”, bitfield [17:16] changed to EBI_DRIVE, replaces 6768
VDDIOMSEL.
SHDWC:
Section 19.6.3 “Shutdown Status Register”, bitfield 16 contains RTTWK. 6583
SMC:
Table 23-8, “Register Mapping”, SMC_CYCLE reset is 0x00030003. 6742
Section 23.8.6 “Reset Values of Timing Parameters”, replaced redundant Table 23-5 with ref. to Table 23-8.
845
6254C–ATARM–22-Jan-10
Doc Change
Rev. Request
6254C Comments (Continued) Ref.
Electrical Characteristics:
Table 43-2, “DC Characteristics”, Min pull up resistance values updated. 6602
IO output current for PA0-PA31 PB0-PB31 PC0-PC3 is 8 mA. rfo
Table 43-5, “Power Consumption for Different Modes”, Active mode updated: “all peripheral clocks 6343
deactivated”. Footnote (1) removed from title.
Section 43.8 “Core Power Supply POR Characteristics”, updated this section. 6883
Table 43-25, “Maximum MCK Frequency vs. Embedded Flash Wait States”, updated. 6386
Table 43-18, “PLLB Characteristics”, startup time added.
Table 43-24, “Power-On-Reset Characteristics”, irrelevant rows removed. 6957
Section 43.9 “Power-up Sequence”, instructions updated. schematic removed. 6957/6963
Section 43.10 “Power-down Sequence”, instructions updated.
Section 43.12.1 “Timing Conditions”, updated: SMC timings are given in worst case conditions. rfo
Table 43-27, updated: Corner removed from capacitance load table.
Section 43.13.1 “Timing Conditions”, updated: SDRAMC timings are given in worst case conditions.
Table 43-32 and Table 43-32 updated: Corner removed from capacitance load tables.
Section 43.15.3.1 “Timing Conditions”, updated: SSC timings are given in worst case conditions.
Table 43-44 updated: Corner removed from capacitance load table.
“SPI”, Figure 43-6, Figure 43-7, Figure 43-8, Figure 43-9, confusing titles to SPI timing diagrams simplified. 6872/6766
Errata:
Section 46.2.2 “Error Corrected Code Controller (ECC)”, “ECC: Computation with a 1 clock cycle long
NRD/NWE pulse”, added to errata. 6465/6889
Section 46.2.3 “MultiMedia Card Interface (MCI)” 6889
“MCI: Data Timeout Error Flag”, removed from errata.
“MCI: Small Block Reading”, added to errata.
“MCI: old SDCard Compatibility”, added to errata.
“RSTC: Reset During SDRAM Accesses”, removed from errata. 6889
Section 46.2.6 “Serial Peripheral Interface (SPI)” 6889
“SPI: Baudrate Set to 1”, removed from errata.
“SPI: Inaccurate RHR.PCS in Variable Mode”, added to errata.
Section 46.2.7 “Serial Synchronous Controller (SSC)”
“SSC: Periodic Transmission Limitations in Master Mode”, removed from errata. 6889
“SSC: Clock is Transmitted before the SSC is Enabled, removed from errata. 6889
“SSC: Delay on TD (transmit data signal)”, added to errata. 6889
“SSC: Data sent without any frame synchro”, added to errata. 6465/6889
Section 46.2.8 “Two-wire Interface (TWI)” 6889
“TWI: Software Reset”, added to errata.
“TWI: Overrun in Master Read Mode”, added to errata.
Section 46.2.10 “Universal Synchronous Asycnchronous Receiver Transmitter (USART)”
“USART: Slave Synchronous Mode”, added to errata. 6889
“USART: Number of Errors Register (US_NER) ISO7816 error number”, added to errata. 6465/6889
Overview:
“Features”, “Ethernet MAC 10/100 Base-T”, 128-byte FIFOs (typo corrected). 5800
Debug Unit (DBGU), added “mode for general purpose two-sire UART serial communication“ 5846
Section 10.4.9 “Ethernet 10/100 MAC”, 128-byte FIFOs (typo corrected). 5800
Section 9.13 “Chip Identification”, SAM9XE512 chip ID is 0x329AA3A0.
Removed former Section 5.2 “Power Consumption”.
Table 3-1, “Signal Description List”, comment column updated in certain instances and “PIO Controller - rfo
PIOA - PIOB - PIOC”, has a foot note added to its comments column. SHDWN is active Low.
Section 6. “I/O Line Considerations”, unneeded paragraphs removed. rfo
“Features”, “Additional Embedded Memories” Fast Read Time: 45 ns.
“Features” “Four Universal Synchronous/Asynchronous Receiver Transmitters (USART)”, added Manchester 5930
Encoding/Decoding,
Section 1. “AT91SAM9XE128/256/512 Description”, 2nd and 3rd paragraphs improved. rfo
Section 6.3 “Shutdown Logic Pins”, updated with external pull-up requirement. rfo
847
6254C–ATARM–22-Jan-10
Doc. Comments (Continued) Change
Rev Request
6254B Ref.
SMC:
Section 23.8.5 “Coding Timing Parameters”, “Effective Value” column under “Permitted Range” updated in 5604
Table 23-4 on page 209.
Section 23.9.3.1 “User Procedure”, instructions regarding configuration parameters of SMC Chip Select 5621
added.
TWI:
Section 33.5.1 “I/O Lines”, TWD and TWCK open drain status and condition updated. 5343
Programmer interdiction added to TWD and TWCK. rfo
Section 33.10.6 “TWI Status Register”, GACC bit description updated. 5773
USART:
Manchester Encoding/Decoding is available in this implementation of the USART (not visible in 6254A). 5930
Electrical Characteristics:
Table 43-11, “32 kHz Oscillator Characteristics” 5335
Table 43-15, “Main Oscillator Characteristics”, updated Typ values for CLEXT, 5345
updated Startup Time parameter, VDDPLL = 1.65V to 1.95V. 5789
Section 43.6 “ADC”, section added to datasheet 5562
Table 43-2, “DC Characteristics”, VVDDIOM Condition column cleared. 5800
Section 43.8 “Core Power Supply POR Characteristics”, added to datasheet. 5298 &
5923/6189
Table 43-25, “Maximum MCK Frequency vs. Embedded Flash Wait States” FWS rows 5, 6 removed, Read 5924
Operations column removed, values assigned to Max MCK Frequency columns
Table 43-17, “PLLA Characteristics(1)” FOUT Min &M ax updated
Table 43-9, “XIN Clock Electrical Characteristics”, line added for VIN. 6049
Section 43.4 “Clock Characteristics”, Section 43.12 “SMC Timings”, Section 43.13 “SDRAMC”, 6167
Section 43.14 “EMAC Timings”, Section 43.15 “Peripheral Timings”, added to datasheet. rfo
Table 43-21, “Analog Inputs”, ADC input capacitance is 12 pF TYP, 14 pF MAX. 6242
Mechanical Characteristics:
Table 44-1, “Soldering Information (Substrate Level),” on page 833, updated title. 5288
Errata:
Section 46.2 “AT91SAM9XE128/256/512 Errata - Revision A parts” 5922
Former Errata - Revision B parts replaced and become Errata - Revision A parts. Former Errata - Revision A
parts removed from Errata
Section 46.2.3.2 “MCI: SDIO Interrupt does not work with slots other than A”, syntax updated. 6169
Section 46.2.6.1 “SSC: Clock is Transmitted before the SSC is Enabled”, added to SSC errata. 5439
Section 46.2.6.1 “SPI: Bad Serial Clock Generation on second chip_select when SCBR = 1, CPOL = 1 and rfo
NCPHA = 0”, added to SPI errata.
Section 46.2.6.2 “SPI: Software Reset must be Written Twice”, added to SPI errata. 5958
Section 46.2.4 “Reset Controller (RSTC)”, added to errata. 5925
Section 46.2.5 “Static Memory Controller (SMC)”, added to errata. 6085
Section 46.2.5 “Static Memory Controller (SMC)” added to errata. 5642
849
6254C–ATARM–22-Jan-10
850 AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
Table of Contents
Features ..................................................................................................... 1
8 Memories ................................................................................................ 20
8.1 Embedded Memories .........................................................................................21
8.2 External Memories .............................................................................................26
i
6254C–ATARM–22-Jan-10
9.8 Watchdog Timer .................................................................................................31
9.9 Real-time Timer ..................................................................................................31
9.10 General-purpose Back-up Registers ..................................................................32
9.11 Advanced Interrupt Controller ............................................................................32
9.12 Debug Unit .........................................................................................................32
9.13 Chip Identification ...............................................................................................33
10 Peripherals ............................................................................................. 34
10.1 User Interface .....................................................................................................34
10.2 Peripheral Identifier ............................................................................................34
10.3 Peripheral Signals Multiplexing on I/O Lines ......................................................35
10.4 Embedded Peripherals .......................................................................................39
ii AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
iii
6254C–ATARM–22-Jan-10
21 AT91SAM9XE Bus Matrix .................................................................... 159
21.1 Description .......................................................................................................159
21.2 Memory Mapping .............................................................................................159
21.3 Special Bus Granting Techniques ....................................................................159
21.4 Arbitration .........................................................................................................160
21.5 Bus Matrix (MATRIX) User Interface ................................................................163
21.6 Chip Configuration User Interface ....................................................................167
iv AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
v
6254C–ATARM–22-Jan-10
29 Advanced Interrupt Controller (AIC) .................................................. 349
29.1 Description .......................................................................................................349
29.2 Block Diagram ..................................................................................................350
29.3 Application Block Diagram ...............................................................................350
29.4 AIC Detailed Block Diagram .............................................................................350
29.5 I/O Line Description ..........................................................................................351
29.6 Product Dependencies .....................................................................................351
29.7 Functional Description ......................................................................................352
29.8 Advanced Interrupt Controller (AIC) User Interface .........................................362
vi AT91SAM9XE128/256/512 Preliminary
6254C–ATARM–22-Jan-10
AT91SAM9XE128/256/512 Preliminary
vii
6254C–ATARM–22-Jan-10
37.3 Application Block Diagram ...............................................................................625
37.4 Pin Name List ..................................................................................................625
37.5 Product Dependencies .....................................................................................625
37.6 Bus Topology ...................................................................................................626
37.7 MultiMedia Card Operations ............................................................................629
37.8 SD/SDIO Card Operations ...............................................................................637
37.9 MultiMedia Card Interface (MCI) User Interface ..............................................638
Table of Contents....................................................................................... i
ix
6254C–ATARM–22-Jan-10
Headquarters International
Product Contact
Literature Requests
www.atmel.com/literature
Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any
intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN ATMEL’S TERMS AND CONDI-
TIONS OF SALE LOCATED ON ATMEL’S WEB SITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY
WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDEN-
TAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF
THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no
representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications
and product descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically provided
otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel’s products are not intended, authorized, or warranted for use
as components in applications intended to support or sustain life.
© 2010 Atmel Corporation. All rights reserved. Atmel ®, Atmel logo and combinations thereof, DataFlash®, SAM-BA ® and others are registered
trademarks or trademarks of Atmel Corporation or its subsidiaries. ARM ®, the ARMPowered ® logo, Thumb ® and others are registered trademarks
or trademarks of ARM Ltd. Windows ® and others are registered trademarks or trademarks of Microsoft Corporation in the US and/or in other
countries. Other terms and product names may be the trademarks of others.
6254C–ATARM–22-Jan-10