Professional Documents
Culture Documents
SAMA5D43 / SAMA5D44
Atmel | SMART ARM-based Embedded MPU
DATASHEET
Description
The Atmel | SMART SAMA5D4 Series is a high-performance, power-efficient
ARM Cortex-A5 processor MPU capable of running up to 528 MHz. It integrates
the ARM NEON SIMD engine for accelerated signal processing, multimedia
and graphics as well as a 128 KB L2-Cache for high system performance. The
device features the ARM TrustZone enabling a strong security perimeter for
critical software, as well as several hardware security features. The device also
features advanced user interface and connectivity peripherals.
The SAMA5D4 features an internal multi-layer bus architecture associated with 32
DMA channels to sustain the high bandwidth required by the processor and the
high-speed peripherals. The device supports DDR2/LPDDR/LPDDR2 and
SLC/MLC NAND Flash memory with 24-bit ECC.
The comprehensive peripheral set includes a 720p hardware video decoder, an
LCD controller with overlays for hardware-accelerated image composition, a
resistive touch screen function, and a CMOS sensor interface. Connectivity
peripherals include a dual 10/100 Ethernet MAC with IEEE1588, three HS USB
ports, UARTs, SPIs and I2Cs.
Security features includes an on-the-fly encryption-decryption process from the
external DDR memory, tamper detection pins, secure storage of critical data, an
integrity check monitor (ICM) to detect modification of the memory contents and a
secure boot. The product also includes a dedicated coprocessor for public key
cryptography such as RSA and elliptic curves algorithms (ECC), as well as AES,
3DES, hashing function and TRNG. These features permit to protect the system
against counterfeiting, to safeguard sensitive data, authenticate safe program or
secure external data transfers.
The SAMA5D4 series is optimized for control panel/HMI applications needing
video playback and applications that require high levels of connectivity in the
industrial and consumer market. Its security features makes the SAMA5D4 well
suited for secure gateways or for the IoT.
Atmel-11238A-ATARM-SAMA5D4-Datasheet_30-Sep-14
1.
Features
Memory Architecture
Memory Management Unit
32 Kbyte Data Cache, 32 Kbyte Instruction Cache
128 Kbyte L2 Cache
One 128 Kbyte scrambled internal ROM single-cycle access at system speed, embedding Atmel boot
loader/Atmel Secure boot loader
One 128 Kbyte scrambled internal SRAM, single-cycle access at system speed
High-bandwidth scramblable 16-bit or 32-bit Double Data Rate Multi-port Dynamic RAM Controller supporting
512 Mbyte 8-bank DDR2/LPDDR/LPDDR2, including partial areas on-the-fly AES encryption/decryption
EBI (External Bus interface) supporting:
16-bit NAND flash controller, including 24-bit error correction code (PMECC) for 8-bit NAND Flash
Independent Static Memory Controller (SMC) with datapath scrambling
Peripherals
Video Decoder (VDEC) supporting formats MPEG-4, H.264, H.263, VP8 and JPEG, and image postprocessing
LCD TFT Controller with 4 overlays up to 2048x2048 or up to 720p in video format, with rotation and alpha
blending
ITU-R BT. 601/656 Image Sensor Interface (ISI)
One USB Device High-Speed, Three USB Host High-Speed with On-chip Transceiver
Two 10/100 Mbps Ethernet MAC Controllers with IEEE 1588 v2 support
SoftModem Interface (SMD)
Two high-speed memory card hosts (eMMC 4.3 and SD 2.0)
Three Master/Slave Serial Peripheral Interfaces (SPI)
Five USARTs, two UARTs, one DBGU
Two Synchronous Serial Controllers (SSC)
Four Two-wire Interfaces up to 400 Kbits/s supporting I2C protocol and SMBUS (TWI)
Three 3-channel 32-bit Timer/Counters (TC)
One 4-channel 16-bit PWM Controller
One 5-channel 10-bit Analog-to-Digital Converter with Resistive Touchscreen function
Safety
Internal and external memory integrity monitoring (Integrity Check Monitor based on SHA256)
Power-on Reset Cells
Main Crystal Clock Failure Detector
Independent Watchdog
Register Write Protection
Memory Management Unit
Security
512 bits of scrambled and erasable registers
8 Kbytes of internal scrambled RAM with non-imprinting support, 6 Kbytes are erasable
8 PIOBU tamper pins for static or dynamic intrusion detections (1)
Atmel secure boot (2)
Cryptography
True Random Number Generator (TRNG)
SHA: Supports Secure Hash Algorithm (SHA1, SHA224, SHA256, SHA384, SHA512) compliant with FIPS
publications 180-2
AES: 256-bit, 192-bit, 128-bit Key Algorithm, compliant with FIPS PUB 197 specifications
TDES: Two-key or Three-key Algorithms, compliant with FIPS PUB 46-3 specifications
Public Key Coprocessor (CPKCC) and associated Classical Public Key Cryptography Library (CPKCL) for RSA,
DSA, ECC GF(2n), ECC GF(p) (3)
Up to 152 I/Os
Five Parallel Input/Output Controllers with slew rate control on high-speed I/Os
Input Change Interrupt capability on each I/O Line, selectable Schmitt Trigger input
Individually Programmable Open-drain, Pull-up and Pull-down Resistor, Synchronous Output, Filtering
Packages
361-ball stubless BGA, 16x16 mm body, pitch 0.8 mm
289-ball stubless BGA, 14x14 mm body, pitch 0.8 mm
Table 1-1.
Package
Video Decoder
DDR Datapath
SAMA5D44
BGA361
32 bits
SAMA5D43
BGA289
16 bits
SAMA5D42
BGA361
32 bits
SAMA5D41
BGA289
16 bits
1.
Intrusion detection is described in the document Secure Box Module (SBM), Atmel literature No. 11254. This document is available under Non-Disclosure
Agreement (NDA). Contact an Atmel Sales Representative for further details.
2.
For secure boot strategies, refer to the application note SAMA5D4x Secure Boot Strategy, Atmel literature No. 11295. This document is available under NonDisclosure Agreement (NDA). Contact an Atmel Sales Representative for further details.
3.
CPKCC and CPKCL are described in the application note "Using CPKCL Version 02.05.01.xx on SAMA5D4", Atmel literature No. 11214. This document is
available under Non-Disclosure Agreement (NDA). Contact an Atmel Sales Representative for further details.
PIOBU[7..0]
WKUP
SHDN
VDDBU
XIN32
XOUT32
NRST
VDDCORE
DTXD
DRXD
IRQ
FIQ
PCK0PCK2
XIN
XOUT
SECURAM
8 KB
+
512 bits
SHDC
32K OSC
POR
RSTC
POR
DBGU
RTC
64K RC
Fuse Box
AIC
SAIC
PIT
PMC
OSC12M
WDT
PLLUTMI
PLL12M
PLLA
PIO
SMD
4-CH
PWM
TC0,TC1
TC2,TC3
TC4,TC5
TC6,
TC7, TC8
ROM
128 KB
I/D
TWI0
TWI1
TWI2
TWI3
SRAM
128 KB
PB
PA
DMA
HS USB
Device
DMA
DMA
USART0
USART1
USART2
USART3
USART4
TRNG
PIO
UART0
UART1
PIO
CPKCC
SPI0
SPI1
SPI2
SHA
SPI0_,
SPI1_,
SPI2_
AES
TDES
SSC0
SSC1
ICM
(SHA)
LCD
MCI0/MCI1
SD/SDIO
eMMC
Peripheral
Bridge 1
DMA
PIO
Peripheral
Bridge 0
Video
Decoder
GMAC0
GMAC1
10/100
DMA
HS EHCI
USB HOST
PC
HS
Trans
HS
Trans
HS
Trans
H
H
S
HH DP
SD C
HH MC
H HS D P
S B
VB DM
G B
16-CH
DMA0
32 KB
DCache
NEON
FPU
128 KB L2 Cache
MMU
Cortex-A5
In-Circuit Emulator
32 KB
ICache
Trust
Zone
PIO
N
T
RS
TD T
I
TD
O
TM
TC S/SW
K/S D
W IO
JTA CLK
GS
EL
JTAG / SWD
16-CH
DMA1
DMA
ISI
LC
D
LC DA
D T[
LC _VS 0:23
D Y ]
LC _PC NC
D_ K , L
DE , LC CD
N, D_ _H
S
L
D
IS
C
D_ ISP YNC
I_
PW
IS D[0
I_ :1
M
IS VSY 1]
I_P N
C C,
K
, IS ISI_
I_M HS
CK YNC
Cyphering
PIO
5-CH
10-bit ADC
Touchscreen
Scrambling
TST
PIO
Scrambling
DH
S
DH DP
SD /HH
S
M
/H DP
HS A
Gx
DM
_
Gx TXC
A
_
K
Gx TXE G
_
N x_R
G C
R
G X
x
_ S x_ CK
Gx RXD Gx TX
_
V _C ER
Gx RX[ , Gx OL
_ 0:
_
G TX 3] RX
[
x
ER
0
Gx_MD :3]
_M C
DI
O
DI
B
PW DI P
B
PWMH N
[3
PW ML :0]
M [3:0
FI ]
[
T 1:0
I
O
]
TI A[5
O :0
TC B[5 ]
LK :0]
[5
TW :0]
TW D[
CK 3:0
[3 ]
:
CT 0]
S
RT [4:0
]
SCS[4
:0
RX K[4 ]
D :0]
TX [4:
D[ 0]
UR 4:0
]
X
UT D[1
:
X
D 0]
NP [1:0
]
C
S[
3
SP :0]
C
M K
O
M SI
IS
O
Atmel-11238A-ATARM-SAMA5D4-Datasheet_30-Sep-14
T
K
TF[1:0
TD[1: ]
0
RD[1:0]
[ ]
RF 1:0
[ ]
RK 1:0
[1 ]
:0
M
]
CI
x
M M _C
C C D
M I0_ Ix_ A
CI D C
0_ A[ K
D 7.
M MC B[3 .0]
CI I0 ..
1 _ 0
_
DA CD ]
[3 B
..0
]
P
CA
L
Legend
A0/NBS0
A1A20
A23A25
NWR1/NBS1
NCS0, NCS1, NCS2
NWAIT
D0D15
A21/NANDALE
A22/NANDCLE
NRD/NANDOE
NWE/NWR0/NANDWE
NCS3/NANDCS
NANDRDY
DDR_DQSN[3..0]
DDR_CS
DDR_CLK, DDR_CLKN
DDR_CKE
DDR_RAS, DDR_CAS
DDR_WE
DDR_BA[2..0]
DDR_DQM[3..0]
DDR_DQS[3..0]
DDR_A0DDR_A13
DDR_D0DDR_D31
Always Secured
xxx
xxx
PIO
xxx
Reduced
Static
Memory
Controller
NAND Flash
Controller
MCL/SLC
ECC
(4KB SRAM)
Secured EBI
DDR2
LPDDR
LPDDR2
512 MB
DD
R
LN
CA
4
R_
Figure 2-1.
DD
2.
Block Diagram
3.
Signal Description
Table 3-1 gives details on signal names classified by peripheral.
Table 3-1.
Function
Type
Active Level
Input
XOUT
XIN32
XOUT32
Output
VBG
Analog
PCK0PCK2
Output
Output
Input
Shutdown Control
WKUP
Wake-up Input
Output
Input
Input
TDI
Test Data In
Input
TDO
TMS/SWDIO
JTAGSEL
JTAG Selection
Output
I/O
Input
Reset/Test
NRST
Microcontroller Reset
Input
TST
Input
NTRST
Input
Low
Input
DTXD
Output
Input
Input
Parallel IO Controller A
I/O
PB0PBxx
Parallel IO Controller B
I/O
PC0PCxx
Parallel IO Controller C
I/O
PD8PDxx
Parallel IO Controller D
I/O
PE0PExx
Parallel IO Controller E
I/O
Table 3-1.
Function
Type
Active Level
Data Bus
A0A25
Address Bus
NWAIT
I/O
Output
Input
Low
Output
Low
NWR0NWR1
Write Signal
Output
Low
NRD
Read Signal
Output
Low
NWE
Write Enable
Output
Low
NBS0NBS1
Output
Low
NANDOE
Output
Low
NANDWE
Output
Low
DDR2/LPDDR2 Controller
DDR_CK,DDR_CKN
Output
DDR_CKE
Output
High
DDR_CS
Output
Low
DDR_BA[2..0]
Bank Select
Output
Low
DDR_WE
Output
Low
DDR_RAS - DDR_CAS
Output
Low
DDR_A[13..0]
Output
DDR_D[31..0]
I/O/-PD
DDR_DQS[3..0], DDR_DQSN[3..0]
I/O-PD
DDR_DQM[3..0]
Output
DDR_CALP, DDR_CALN
DDR2/LPDDR2 Calibration
Input
DDR_VREF
DDR2/LPDDR2 Reference
Input
I/O
I/O
MCI0_DA[7..0]
I/O
MCI0_DB[3..0]
I/O
MCI1_DA[3..0]
I/O
SCKx
TXDx
Output
RXDx
Input
RTSx
CTSx
I/O
Output
Input
Table 3-1.
Function
Type
Active Level
Output
URXDx
Input
Output
RDx
Input
TKx
I/O
RKx
I/O
TFx
I/O
RFx
I/O
Input
TIOAx
I/O
TIOBx
I/O
I/O
SPIx_MOSI
I/O
SPIx_SPCK
I/O
SPIx_NPCS0
I/O
Low
SPIx_NPCS[3..1]
Output
Low
I/O
TWCKx
I/O
Output
PWML03
Output
PWMFI01
Input
Analog
HHSDMA
Analog
HHSDPB
Analog
HHSDMB
Analog
HHSDPC
Analog
HHSDMC
Analog
Analog
DHSDM
Analog
Table 3-1.
Function
Type
Input
GxRXCK
Receive Clock
Input
GxTXEN
Transmit Enable
Output
GxTX03
Transmit Data
Output
GxTXER
Output
GxRXDV
Input
GxRX03
Receive Data
Input
GxRXER
Receive Error
Input
GxCRS
Input
GxCOL
Collision Detect
Input
GxMDC
GxMDIO
Output
I/O
Output
LCDVSYNC
Output
LCDHSYNC
Output
LCDPCK
Output
LCDDEN
Output
LCDPWM
Output
LCDDISP
Output
4 Analog Inputs
ADTRG
ADC Trigger
ADVREF
ADC Reference
Analog
Input
Analog
Secured I/Os
I/O
Input
ISI_HSYNC
Input
ISI_VSYNC
Input
ISI_PCK
Input
DIBN
I/O
DIBP
I/O
Active Level
4.
361-ball BGA
289-ball BGA
The pinouts are provided in the following Section 4.1 361-ball BGA Package Pinout and Section 4.2 289-ball
BGA Package Pinout.
The package mechanical characterisitics are described in Section 57. Mechanical Characteristics.
4.1
Table 4-1.
Alternate
I/O Type
Signal
Dir
Signal
PIO Peripheral A
Dir
Signal
Dir
PIO Peripheral B
Signal
Dir
PIO Peripheral C
Reset State
Signal
Dir
TMS
TMS, PU
A7
VDDIOP
GPIO
PA0
I/O
LCDDAT0
F6
VDDIOP
GPIO
PA1
I/O
LCDDAT1
E6
VDDIOP
GPIO_CLK
PA2
I/O
LCDDAT2
G1_TXCK
PIO, I, PU, ST
C6
VDDIOP
GPIO_CLK
PA3
I/O
LCDDAT3
G1_RXCK
PIO, I, PU, ST
D6
VDDIOP
GPIO
PA4
I/O
LCDDAT4
G1_TXEN
PIO, I, PU, ST
B6
VDDIOP
GPIO
PA5
I/O
LCDDAT5
G1_TXER
PIO, I, PU, ST
A6
VDDIOP
GPIO
PA6
I/O
LCDDAT6
G1_CRS
PIO, I, PU, ST
E5
VDDIOP
GPIO
PA7
I/O
LCDDAT7
A5
VDDIOP
GPIO
PA8
I/O
LCDDAT8
F4
VDDIOP
GPIO
PA9
I/O
LCDDAT9
G1_COL
PIO, I, PU, ST
F5
VDDIOP
GPIO
PA10
I/O
LCDDAT10
G1_RXDV
PIO, I, PU, ST
D5
VDDIOP
GPIO
PA11
I/O
LCDDAT11
G1_RXER
PIO, I, PU, ST
G5
VDDIOP
GPIO
PA12
I/O
LCDDAT12
G1_RX0
PIO, I, PU, ST
C5
VDDIOP
GPIO
PA13
I/O
LCDDAT13
G1_RX1
PIO, I, PU, ST
E4
VDDIOP
GPIO
PA14
I/O
LCDDAT14
G1_TX0
PIO, I, PU, ST
B5
VDDIOP
GPIO
PA15
I/O
LCDDAT15
G1_TX1
PIO, I, PU, ST
H6
VDDIOP
GPIO
PA16
I/O
LCDDAT16
D4
VDDIOP
GPIO
PA17
I/O
LCDDAT17
G4
VDDIOP
GPIO
PA18
I/O
LCDDAT18
G1_RX2
PIO, O, LOW
C4
VDDIOP
GPIO
PA19
I/O
LCDDAT19
G1_RX3
PIO, O, LOW
A3
VDDIOP
GPIO
PA20
I/O
LCDDAT20
G1_TX2
PIO, I, PU, ST
B4
VDDIOP
GPIO
PA21
I/O
LCDDAT21
G1_TX3
PIO, I, PU, ST
B3
VDDIOP
GPIO
PA22
I/O
LCDDAT22
G1_MDC
PIO, I, PU, ST
A4
VDDIOP
GPIO
PA23
I/O
LCDDAT23
G1_MDIO
I/O
PIO, I, PU, ST
H5
VDDIOP
GPIO_CLK
PA24
I/O
LCDPWM
PCK0
PIO, I, PU, ST
F3
VDDIOP
GPIO
PA25
I/O
LCDDISP
TD0
PIO, I, PU, ST
E3
VDDIOP
GPIO
PA26
I/O
LCDVSYNC
PWMH0
SPI1_NPCS1
O PIO, I, PU, ST
H4
VDDIOP
GPIO
PA27
I/O
LCDHSYNC
PWML0
SPI1_NPCS2
O PIO, I, PU, ST
G3
VDDIOP
GPIO_CLK2
PA28
I/O
LCDPCK
PWMH1
SPI1_NPCS3
O PIO, I, PU, ST
J5
VDDIOP
GPIO
PA29
I/O
LCDDEN
PWML1
D3
VDDIOP
GPIO
PA30
I/O
TWD0
I/O
PIO, I, PU, ST
J4
VDDIOP
GPIO
PA31
I/O
TWCK0
PIO, I, PU, ST
C3
VDDIOP
GPIO_CLK
PB0
I/O
G0_TXCK
PIO, I, PU, ST
A2
VDDIOP
GPIO_CLK
PB1
I/O
G0_RXCK
B2
VDDIOP
GPIO
PB2
I/O
G0_TXEN
C2
VDDIOP
GPIO
PB3
I/O
G0_TXER
10
PIO, I, PU, ST
PIO, I, PU, ST
TCK
NTRST
TCK, PU
NTRST, PU
PIO, O, LOW
SCK2
I/O
PIO, I, PU, ST
ISI_PCK
PIO, I, PU, ST
PIO, I, PU, ST
CTS2
ISI_VSYNC
PIO, I, PU, ST
Table 4-1.
Alternate
I/O Type
Signal
Dir
Signal
PIO Peripheral A
Dir
PIO Peripheral B
PIO Peripheral C
Reset State
Signal
Dir
Signal
Dir
Signal
Dir
PIO, I, PU, ST
J3
VDDIOP
GPIO
PB4
I/O
G0_CRS
RXD2
ISI_HSYNC
H2
VDDIOP
GPIO
PB5
I/O
G0_COL
TXD2
PCK2
G2
VDDIOP
GPIO
PB6
I/O
G0_RXDV
PIO, I, PU, ST
H3
VDDIOP
GPIO
PB7
I/O
G0_RXER
PIO, I, PU, ST
F2
VDDIOP
GPIO
PB8
I/O
G0_RX0
PIO, I, PU, ST
J2
VDDIOP
GPIO
PB9
I/O
G0_RX1
PIO, I, PU, ST
F1
VDDIOP
GPIO_CLK
PB10
I/O
G0_RX2
PCK2
PWML1
O PIO, I, PU, ST
K4
VDDIOP
GPIO
PB11
I/O
G0_RX3
RTS2
PWMH1
O PIO, I, PU, ST
D2
VDDIOP
GPIO
PB12
I/O
G0_TX0
PIO, I, PU, ST
K3
VDDIOP
GPIO
PB13
I/O
G0_TX1
PIO, I, PU, ST
A1
VDDIOP
GPIO
PB14
I/O
G0_TX2
SPI2_NPCS1
PWMH0
O PIO, I, PU, ST
E2
VDDIOP
GPIO
PB15
I/O
G0_TX3
SPI2_NPCS2
PWML0
O PIO, I, PU, ST
B1
VDDIOP
GPIO
PB16
I/O
G0_MDC
PIO, I, PU, ST
K5
VDDIOP
GPIO
PB17
I/O
G0_MDIO
I/O
PIO, I, PU, ST
K2
VDDIOP
GPIO
PB18
I/O
SPI1_MISO
I/O
D8
I/O
PIO, I, PU, ST
C1
VDDIOP
GPIO
PB19
I/O
SPI1_MOSI
I/O
D9
I/O
PIO, I, PU, ST
D1
VDDIOP
GPIO_CLK
PB20
I/O
SPI1_SPCK
I/O
D10
I/O
PIO, I, PU, ST
L3
VDDIOP
GPIO
PB21
I/O
SPI1_NPCS0 I/O
D11
I/O
PIO, I, PU, ST
G1
VDDIOP
GPIO
PB22
I/O
SPI1_NPCS1
D12
I/O
PIO, I, PU, ST
H1
VDDIOP
GPIO
PB23
I/O
SPI1_NPCS2
D13
I/O
PIO, I, PU, ST
E1
VDDIOP
GPIO
PB24
I/O
DRXD
D14
I/O
TDI
TDI, PU
J1
VDDIOP
GPIO
PB25
I/O
DTXD
D15
I/O
TDO
TDO
M5
VDDIOP
GPIO_CLK
PB26
I/O
PCK0
RK0
I/O
PWMH0
O PIO, I, PU, ST
L2
VDDIOP
GPIO
PB27
I/O
SPI1_NPCS3
TK0
I/O
PWML0
O PIO, I, PU, ST
K1
VDDIOP
GPIO
PB28
I/O
SPI2_NPCS3
TD0
PWMH1
O PIO, I, PU, ST
M3
VDDIOP
GPIO
PB29
I/O
TWD2
I/O
RD0
PWML1
M4
VDDIOP
GPIO
PB30
I/O
TWCK2
RF0
I/O
PIO, O, LOW
L1
VDDIOP
GPIO
PB31
I/O
TF0
I/O
PIO, I, PU, ST
V4
VDDIOM
GPIO
PC0
I/O
SPI0_MISO
I/O
PWMH2
ISI_D8
PIO, I, PU, ST
P8
VDDIOM
GPIO
PC1
I/O
SPI0_MOSI
I/O
PWML2
ISI_D9
PIO, I, PU, ST
V5
VDDIOM
GPIO_CLK
PC2
I/O
SPI0_SPCK
I/O
PWMH3
ISI_D10
PIO, I, PU, ST
R8
VDDIOM
GPIO
PC3
I/O
SPI0_NPCS0 I/O
PWML3
ISI_D11
PIO, I, PU, ST
W5
VDDIOM
MCI_CLK
PC4
I/O
SPI0_NPCS1
MCI0_CK
I/O
PCK1
T8
VDDIOM
GPIO
PC5
I/O
D0
I/O
MCI0_CDA
I/O
PIO, I, PU, ST
W6
VDDIOM
GPIO
PC6
I/O
D1
I/O
MCI0_DA0
I/O
PIO, I, PU, ST
R19
VDDIOM
GPIO
PC7
I/O
D2
I/O
MCI0_DA1
I/O
PIO, I, PU, ST
N15
VDDIOM
GPIO
PC8
I/O
D3
I/O
MCI0_DA2
I/O
PIO, I, PU, ST
U8
VDDIOM
GPIO
PC9
I/O
D4
I/O
MCI0_DA3
I/O
PIO, I, PU, ST
O PIO, I, PU, ST
PIO, O, LOW
O PIO, I, PU, ST
11
Table 4-1.
Alternate
I/O Type
Signal
Dir
Signal
PIO Peripheral A
Dir
PIO Peripheral B
Signal
Dir
Signal
Dir
PIO Peripheral C
Signal
Dir
Reset State
Signal, Dir, PU,
PD, HiZ, ST
V6
VDDIOM
GPIO
PC10
I/O
D5
I/O
MCI0_DA4
I/O
PIO, I, PU, ST
V7
VDDIOM
GPIO
PC11
I/O
D6
I/O
MCI0_DA5
I/O
PIO, I, PU, ST
W7
VDDIOM
GPIO
PC12
I/O
D7
I/O
MCI0_DA6
I/O
PIO, I, PU, ST
V8
VDDIOM
GPIO
PC13
I/O
NRD/NANDOE O
MCI0_DA7
I/O
PIO, I, PU, ST
U9
VDDIOM
GPIO
PC14
I/O
NWE/NANDWE O
W8
VDDIOM
GPIO
PC15
I/O
NCS3
PIO, I, PU, ST
V9
VDDIOM
GPIO
PC16
I/O
NANDRDY
PIO, I, PU, ST
W9
VDDIOM
GPIO
PC17
I/O
A21/NANDALE O
A21
V10
VDDIOM
GPIO
PC18
I/O
A22/NANDCLE O
A22
U14
VDDIOM
GPIO
PC19
I/O
ISI_D0
TK1
I/O
PIO, I, PU, ST
V11
VDDIOM
GPIO
PC20
I/O
ISI_D1
TF1
I/O
PIO, I, PU, ST
U15
VDDIOM
GPIO
PC21
I/O
ISI_D2
TD1
PIO, I, PU, ST
T15
VDDIOM
GPIO
PC22
I/O
ISI_D3
RF1
I/O
PIO, I, PU, ST
U16
VDDIOM
GPIO
PC23
I/O
ISI_D4
RD1
PIO, I, PU, ST
T16
VDDIOM
GPIO
PC24
I/O
ISI_D5
RK1
PCK1
V17
VDDIOM
GPIO
PC25
I/O
ISI_D6
TWD3
I/O
URXD1
R16
VDDIOM
GPIO
PC26
I/O
ISI_D7
TWCK3
UTXD1
O PIO, I, PU, ST
U12
VDDANA
GPIO_ANA
PC27
I/O
AD0
SPI0_NPCS1
PWML0
O PIO, I, PU, ST
T11
VDDANA
GPIO_ANA
PC28
I/O
AD1
SPI0_NPCS2
PWML1
O PIO, I, PU, ST
R13
VDDANA
GPIO_ANA
PC29
I/O
AD2
SPI0_NPCS3
PWMFI0
O PIO, I, PU, ST
T12
VDDANA
GPIO_ANA
PC30
I/O
AD3
PWMH0
O PIO, I, PU, ST
T13
VDDANA
GPIO_ANA
PC31
I/O
AD4
PWMH1
M1
VDDIOP
GPIO_CLK
PD8
I/O
PCK0
PIO, I, PU, ST
M2
VDDIOP
GPIO
PD9
I/O
FIQ
PIO, I, PU, ST
N2
VDDIOP
GPIO
PD10
I/O
CTS0
PIO, I, PU, ST
N3
VDDIOP
GPIO
PD11
I/O
RTS0
N1
VDDIOP
GPIO
PD12
I/O
RXD0
P3
VDDIOP
GPIO
PD13
I/O
TXD0
P2
VDDIOP
GPIO
PD14
I/O
CTS1
N4
VDDIOP
GPIO
PD15
I/O
RTS1
R2
VDDIOP
GPIO
PD16
I/O
RXD1
R3
VDDIOP
GPIO
PD17
I/O
TXD1
T9
VDDANA
ANAIN2
PD18
I/O
PIO, I, PU, ST
P11
VDDANA
ANAIN2
PD19
I/O
PIO, I, PU, ST
T10
VDDANA
ANAIN2
PD20
I/O
PIO, I, PU, ST
P10
VDDANA
ANAIN2
PD21
I/O
PIO, I, PU, ST
U11
VDDANA
ANAIN2
PD22
I/O
PIO, I, PU, ST
R10
VDDANA
ANAIN2
PD23
I/O
PIO, I, PU, ST
12
PIO, I, PU, ST
SPI2_MISO
I/O
O PIO, I, PU, ST
PIO, I, PU, ST
PIO, I, PU, ST
PIO, I, PU, ST
PIO, O, PD
SPI2_MOSI
I/O
PIO, I, PU, ST
PIO, I, PU, ST
SPI2_SPCK
I/O
PIO, I, PU, ST
PIO, O, PD
SPI2_NPCS0 I/O
PIO, I, PU, ST
Table 4-1.
Alternate
Signal
PIO Peripheral A
Dir
Signal
Dir
PIO Peripheral B
Signal
Dir
PIO Peripheral C
Signal
Dir
Reset State
Signal, Dir, PU,
PD, HiZ, ST
I/O Type
Signal
Dir
U10
VDDANA
ANAIN2
PD24
I/O
PIO, I, PU, ST
R11
VDDANA
ANAIN2
PD25
I/O
PIO, I, PU, ST
U13
VDDANA
ANAIN2
PD26
I/O
PIO, I, PU, ST
T14
VDDANA
ANAIN2
PD27
I/O
PIO, I, PU, ST
R1
VDDIOP
GPIO_CLK
PD28
I/O
SCK0
I/O
PIO, I, PU, ST
P1
VDDIOP
GPIO_CLK
PD29
I/O
SCK1
I/O
PIO, I, PU, ST
N5
VDDIOP
GPIO
PD30
I/O
P5
VDDIOP
GPIO_CLK
PD31
I/O
SPI0_NPCS2
PCK1
W19
VDDIOM
MCI_CLK
PE0
I/O
A0/NBS0
MCI0_CDB
I/O
U17
VDDIOM
EBI
PE1
I/O
A1
MCI0_DB0
I/O
A1, PD
T17
VDDIOM
EBI
PE2
I/O
A2
MCI0_DB1
I/O
A2, PD
P16
VDDIOM
EBI
PE3
I/O
A3
MCI0_DB2
I/O
A3, PD
U18
VDDIOM
EBI
PE4
I/O
A4
MCI0_DB3
I/O
A4, PD
R17
VDDIOM
EBI
PE5
I/O
A5
CTS3
A5, PD
V19
VDDIOM
EBI
PE6
I/O
A6
TIOA3
I/O
PIO, O, LOW
U19
VDDIOM
EBI
PE7
I/O
A7
TIOB3
I/O
PWMFI1
A7, PD
T19
VDDIOM
EBI
PE8
I/O
A8
TCLK3
PWML3
A8, PD
T18
VDDIOM
EBI
PE9
I/O
A9
TIOA2
I/O
A9, PD
N14
VDDIOM
EBI
PE10
I/O
A10
TIOB2
I/O
A10, PD
R18
VDDIOM
EBI
PE11
I/O
A11
TCLK2
A11, PD
P17
VDDIOM
EBI
PE12
I/O
A12
TIOA1
I/O
PWMH2
A12, PD
P18
VDDIOM
EBI
PE13
I/O
A13
TIOB1
I/O
PWML2
A13, PD
N17
VDDIOM
EBI
PE14
I/O
A14
TCLK1
PWMH3
A14, PD
N18
VDDIOM
EBI
PE15
I/O
A15
SCK3
I/O
TIOA0
I/O
A15, PD
M15
VDDIOM
EBI
PE16
I/O
A16
RXD3
TIOB0
I/O
A16, PD
N19
VDDIOM
EBI
PE17
I/O
A17
TXD3
TCLK0
A17, PD
P19
VDDIOM
EBI
PE18
I/O
A18
TIOA5
I/O
MCI1_CK
I/O
A18, PD
N16
VDDIOM
EBI
PE19
I/O
A19
TIOB5
I/O
MCI1_CDA
I/O
A19, PD
M14
VDDIOM
EBI
PE20
I/O
A20
TCLK5
MCI1_DA0
I/O
A20, PD
M18
VDDIOM
EBI
PE21
I/O
A23
TIOA4
I/O
MCI1_DA1
I/O
A23, PD
M19
VDDIOM
EBI
PE22
I/O
A24
TIOB4
I/O
MCI1_DA2
I/O
A24, PD
L18
VDDIOM
EBI
PE23
I/O
A25
TCLK4
MCI1_DA3
I/O
A25, PD
L19
VDDIOM
EBI
PE24
I/O
NCS0
RTS3
M17
VDDIOM
EBI
PE25
I/O
NCS1
SCK4
I/O
IRQ
NCS1
L15
VDDIOM
EBI
PE26
I/O
NCS2
RXD4
A18
NCS2
M16
VDDIOM
EBI
PE27
I/O
NWR1/NBS1
TXD4
L17
VDDIOM
EBI
PE28
I/O
NWAIT
RTS4
A19
V1
VDDIOP
DIB
PE29
I/O
DIBP
URXD0
TWD1
PIO, I, PU, ST
PIO, I, PU, ST
CTS4
A0, PD
NCS0
PIO, I, PD
O
PIO, I, PD
13
Table 4-1.
Alternate
I/O Type
Signal
Dir
Signal
PIO Peripheral A
Dir
PIO Peripheral B
PIO Peripheral C
Reset State
Signal
Dir
Signal
Dir
Signal
Dir
UTXD0
TWCK1
PIO, O, LOW
U2
VDDIOP
DIB
PE30
I/O
DIBN
L4
VDDIOP
GPIO
PE31
I/O
ADTRG
H10
G10
K10
J10
K9
J9
H9
G9
E7
A8
D7
B7
C7
E9
A10
B9
D8
A9
Not connected
P4
VDDBU
SYSC
TST
I, PD, ST
W12
VDDIOP
CLOCK
XIN
V12
VDDIOP
CLOCK
XOUT
W2
VDDBU
CLOCK
XIN32
W3
VDDBU
CLOCK
XOUT32
T2
VDDBU
SYSC
SHDN
O, PU
V3
VDDBU
SYSC
WKUP
I, ST
U3
VDDBU
PIOBU
PIOBU0
I, PU
T3
VDDBU
PIOBU
PIOBU1
I, PU
T4
VDDBU
PIOBU
PIOBU2
I, PU
U4
VDDBU
PIOBU
PIOBU3
I, PU
P6
VDDBU
PIOBU
PIOBU4
I, PU
T5
VDDBU
PIOBU
PIOBU5
I, PU
R4
VDDBU
PIOBU
PIOBU6
I, PU
U5
VDDBU
PIOBU
PIOBU7
I, PU
R5
U6
R6
T6
R7
U7
P7
T7
Not connected
T1
VDDBU
RST
NRST
V2
VDDBU
SYSC
JTAGSEL
I, PD
F15 VDDIODDR
DDR_IO
DDR_A0
O, LOW
F16 VDDIODDR
DDR_IO
DDR_A1
O, LOW
14
PIO, O, LOW
Table 4-1.
Alternate
Signal
PIO Peripheral A
Dir
Signal
Dir
PIO Peripheral B
Signal
Dir
PIO Peripheral C
Signal
Dir
Reset State
Signal, Dir, PU,
PD, HiZ, ST
I/O Type
Signal
Dir
E17 VDDIODDR
DDR_IO
DDR_A2
O, LOW
G15 VDDIODDR
DDR_IO
DDR_A3
O, LOW
B18 VDDIODDR
DDR_IO
DDR_A4
O, LOW
C16 VDDIODDR
DDR_IO
DDR_A5
O, LOW
E15 VDDIODDR
DDR_IO
DDR_A6
O, LOW
F17 VDDIODDR
DDR_IO
DDR_A7
O, LOW
F18 VDDIODDR
DDR_IO
DDR_A8
O, LOW
D19 VDDIODDR
DDR_IO
DDR_A9
O, LOW
E18 VDDIODDR
DDR_IO
DDR_A10
O, LOW
D18 VDDIODDR
DDR_IO
DDR_A11
O, LOW
C18 VDDIODDR
DDR_IO
DDR_A12
O, LOW
D16 VDDIODDR
DDR_IO
DDR_A13
O, LOW
L14 VDDIODDR
DDR_IO
DDR_D0
I/O
I, HiZ
K16 VDDIODDR
DDR_IO
DDR_D1
I/O
I, HiZ
K15 VDDIODDR
DDR_IO
DDR_D2
I/O
I, HiZ
K14 VDDIODDR
DDR_IO
DDR_D3
I/O
I, HiZ
J18 VDDIODDR
DDR_IO
DDR_D4
I/O
I, HiZ
J17 VDDIODDR
DDR_IO
DDR_D5
I/O
I, HiZ
J15 VDDIODDR
DDR_IO
DDR_D6
I/O
I, HiZ
H19 VDDIODDR
DDR_IO
DDR_D7
I/O
I, HiZ
H18 VDDIODDR
DDR_IO
DDR_D8
I/O
I, HiZ
J14 VDDIODDR
DDR_IO
DDR_D9
I/O
I, HiZ
G18 VDDIODDR
DDR_IO
DDR_D10
I/O
I, HiZ
H17 VDDIODDR
DDR_IO
DDR_D11
I/O
I, HiZ
H15 VDDIODDR
DDR_IO
DDR_D12
I/O
I, HiZ
H14 VDDIODDR
DDR_IO
DDR_D13
I/O
I, HiZ
G16 VDDIODDR
DDR_IO
DDR_D14
I/O
I, HiZ
E19 VDDIODDR
DDR_IO
DDR_D15
I/O
I, HiZ
E14 VDDIODDR
DDR_IO
DDR_D16
I/O
I, HiZ
E13 VDDIODDR
DDR_IO
DDR_D17
I/O
I, HiZ
H13 VDDIODDR
DDR_IO
DDR_D18
I/O
I, HiZ
F13 VDDIODDR
DDR_IO
DDR_D19
I/O
I, HiZ
B15 VDDIODDR
DDR_IO
DDR_D20
I/O
I, HiZ
A14 VDDIODDR
DDR_IO
DDR_D21
I/O
I, HiZ
D12 VDDIODDR
DDR_IO
DDR_D22
I/O
I, HiZ
B14 VDDIODDR
DDR_IO
DDR_D23
I/O
I, HiZ
B13 VDDIODDR
DDR_IO
DDR_D24
I/O
I, HiZ
G12 VDDIODDR
DDR_IO
DDR_D25
I/O
I, HiZ
15
Table 4-1.
Alternate
Signal
PIO Peripheral A
Dir
Signal
Dir
PIO Peripheral B
Signal
Dir
PIO Peripheral C
Signal
Dir
Reset State
Signal, Dir, PU,
PD, HiZ, ST
I/O Type
Signal
Dir
B12 VDDIODDR
DDR_IO
DDR_D26
I/O
I, HiZ
C12 VDDIODDR
DDR_IO
DDR_D27
I/O
I, HiZ
F11 VDDIODDR
DDR_IO
DDR_D28
I/O
I, HiZ
C11 VDDIODDR
DDR_IO
DDR_D29
I/O
I, HiZ
D11 VDDIODDR
DDR_IO
DDR_D30
I/O
I, HiZ
B11 VDDIODDR
DDR_IO
DDR_D31
I/O
I, HiZ
L16 VDDIODDR
DDR_IO
DDR_DQM0
O, LOW
J16 VDDIODDR
DDR_IO
DDR_DQM1
O, LOW
D13 VDDIODDR
DDR_IO
DDR_DQM2
O, LOW
F12 VDDIODDR
DDR_IO
DDR_DQM3
O, LOW
J19 VDDIODDR
DDR_IO
DDR_DQS0
I/O
O, LOW
F19 VDDIODDR
DDR_IO
DDR_DQS1
I/O
O, LOW
A15 VDDIODDR
DDR_IO
DDR_DQS2
I/O
O, LOW
A12 VDDIODDR
DDR_IO
DDR_DQS3
I/O
O, LOW
K19 VDDIODDR
DDR_IO
DDR_DQSN0 I/O
O, HIGH
G19 VDDIODDR
DDR_IO
DDR_DQSN1 I/O
O, HIGH
A16 VDDIODDR
DDR_IO
DDR_DQSN2 I/O
O, HIGH
A13 VDDIODDR
DDR_IO
DDR_DQSN3 I/O
O, HIGH
B16 VDDIODDR
DDR_IO
DDR_CS
O, LOW
A18 VDDIODDR
DDR_IO
DDR_CLK
A19 VDDIODDR
DDR_IO
DDR_CLKN
D15 VDDIODDR
DDR_IO
DDR_CKE
O, LOW
B17 VDDIODDR
DDR_IO
DDR_RAS
O, LOW
A17 VDDIODDR
DDR_IO
DDR_CAS
O, LOW
E16 VDDIODDR
DDR_IO
DDR_WE
O, LOW
C15 VDDIODDR
DDR_IO
DDR_BA0
O, LOW
D14 VDDIODDR
DDR_IO
DDR_BA1
O, LOW
G13 VDDIODDR
DDR_IO
DDR_BA2
O, LOW
C19 VDDIODDR
Reference
DDR_CALN
B19 GNDIODDR
Reference
DDR_CALP
K12 VDDIODDR/2
Reference
DDR_VREF
W11
VBG
VBG
VBG
R12
VDDANA
Reference
ADCVREF
W16 VDDUTMII
USBHS
HHSDPC
I/O
O, PD
V16 VDDUTMII
USBHS
HHSDMC
I/O
O, PD
W15 VDDUTMII
USBHS
HHSDPB
I/O
O, PD
V15 VDDUTMII
USBHS
HHSDMB
I/O
O, PD
W14 VDDUTMII
USBHS
HHSDPA
I/O
16
DHSDP
I/O
O, PD
Table 4-1.
Alternate
PIO Peripheral A
I/O Type
Signal
Dir
Signal
Dir
V14 VDDUTMII
USBHS
HHSDMA
I/O
DHSDM
I/O
Signal
Dir
PIO Peripheral B
Signal
Dir
PIO Peripheral C
Signal
Dir
Reset State
Signal, Dir, PU,
PD, HiZ, ST
O, PD
W4
VDDBU
Power supply
VDDBU
W1
GNDBU
Ground
GNDBU
VDDCORE
GNDCORE
J7
J11
K7
K8 VCCCORE Power supply
L9
L11
N10
VCCCORE
C14
D17
E10
E12
F14
VDDIODDR Power supply
H12
H16
K13
K17
M13
VDDIODDR
C13
C17
E11
F10
G11
GNDIODDR
G14
G17
J13
K18
L13
Ground
GNDIODDR
Power supply
VDDIOM
G8
N9
B10
D9
D10
F9
H8
J8
J12
K11
GNDCORE
L8
L10
L12
M9
M10
M11
V18
W18
M8
N7
P15
R9
VDDIOM
Ground
17
Table 4-1.
Alternate
Dir
Signal
Dir
Signal
Dir
Reset State
Signal, Dir, PU,
PD, HiZ, ST
Signal
Dir
M7
M12
N8
P9
GNDIOM
Ground
GNDIOM
B8
C8
E8
F8
GNDIOP
Ground
GNDIOP
H7
K6
L5
M6
VDDIOP
Power supply
VDDIOP
F7
G6
G7
J6
L6
N6
GNDIOP
Ground
GNDIOP
VDDUTMIC
W13
VDDUTMII
W17
Power supply
VDDUTMII
Ground
GNDUTMI
Power supply
VDDPLLA
W10 VDDPLLA
Signal
PIO Peripheral C
I/O Type
GNDUTMI
Dir
PIO Peripheral B
P13
Signal
PIO Peripheral A
L7
GNDPLL
Ground
GNDPLL
P14
VDDOSC
Power supply
VDDOSC
N13
GNDOSC
Ground
GNDOSC
A11
GNDIOP
Ground
GNDIOP
C9
N11
P12
VDDANA
Power supply
VDDANA
C10
H11
N12
GNDANA
Ground
GNDANA
R14 VDDFUSE
Power supply
VDDFUSE
R15 GNDFUSE
Ground
GNDFUSE
U1
18
Not connected
4.2
Table 4-2.
Alternate
I/O Type
Signal
Dir
Signal
PIO Peripheral A
Dir
Signal
Dir
PIO Peripheral B
Signal
Dir
PIO Peripheral C
Reset State
Signal
Dir
TMS
TMS, PU
C5
VDDIOP
GPIO
PA0
I/O
LCDDAT0
F6
VDDIOP
GPIO
PA1
I/O
LCDDAT1
F5
VDDIOP
GPIO_CLK
PA2
I/O
LCDDAT2
G1_TXCK
PIO, I, PU, ST
B5
VDDIOP
GPIO_CLK
PA3
I/O
LCDDAT3
G1_RXCK
PIO, I, PU, ST
E5
VDDIOP
GPIO
PA4
I/O
LCDDAT4
G1_TXEN
PIO, I, PU, ST
A5
VDDIOP
GPIO
PA5
I/O
LCDDAT5
G1_TXER
PIO, I, PU, ST
A4
VDDIOP
GPIO
PA6
I/O
LCDDAT6
G1_CRS
PIO, I, PU, ST
E4
VDDIOP
GPIO
PA7
I/O
LCDDAT7
B4
VDDIOP
GPIO
PA8
I/O
LCDDAT8
D4
VDDIOP
GPIO
PA9
I/O
LCDDAT9
G1_COL
PIO, I, PU, ST
C4
VDDIOP
GPIO
PA10
I/O
LCDDAT10
G1_RXDV
PIO, I, PU, ST
A3
VDDIOP
GPIO
PA11
I/O
LCDDAT11
G1_RXER
PIO, I, PU, ST
F4
VDDIOP
GPIO
PA12
I/O
LCDDAT12
G1_RX0
PIO, I, PU, ST
F3
VDDIOP
GPIO
PA13
I/O
LCDDAT13
G1_RX1
PIO, I, PU, ST
D3
VDDIOP
GPIO
PA14
I/O
LCDDAT14
G1_TX0
PIO, I, PU, ST
B3
VDDIOP
GPIO
PA15
I/O
LCDDAT15
G1_TX1
PIO, I, PU, ST
G3
VDDIOP
GPIO
PA16
I/O
LCDDAT16
E3
VDDIOP
GPIO
PA17
I/O
LCDDAT17
C3
VDDIOP
GPIO
PA18
I/O
LCDDAT18
G1_RX2
PIO, O, LOW
A2
VDDIOP
GPIO
PA19
I/O
LCDDAT19
G1_RX3
PIO, O, LOW
G5
VDDIOP
GPIO
PA20
I/O
LCDDAT20
G1_TX2
PIO, I, PU, ST
A1
VDDIOP
GPIO
PA21
I/O
LCDDAT21
G1_TX3
PIO, I, PU, ST
D2
VDDIOP
GPIO
PA22
I/O
LCDDAT22
G1_MDC
PIO, I, PU, ST
E2
VDDIOP
GPIO
PA23
I/O
LCDDAT23
G1_MDIO
I/O
PIO, I, PU, ST
G4
VDDIOP
GPIO_CLK
PA24
I/O
LCDPWM
PCK0
PIO, I, PU, ST
C2
VDDIOP
GPIO
PA25
I/O
LCDDISP
TD0
PIO, I, PU, ST
B2
VDDIOP
GPIO
PA26
I/O
LCDVSYNC
PWMH0
SPI1_NPCS1
PIO, I, PU, ST
H3
VDDIOP
GPIO
PA27
I/O
LCDHSYNC
PWML0
SPI1_NPCS2
PIO, I, PU, ST
F2
VDDIOP
GPIO_CLK2
PA28
I/O
LCDPCK
PWMH1
SPI1_NPCS3
PIO, I, PU, ST
B1
VDDIOP
GPIO
PA29
I/O
LCDDEN
PWML1
C1
VDDIOP
GPIO
PA30
I/O
TWD0
I/O
PIO, I, PU, ST
H5
VDDIOP
GPIO
PA31
I/O
TWCK0
PIO, I, PU, ST
D1
VDDIOP
GPIO_CLK
PB0
I/O
G0_TXCK
PIO, I, PU, ST
H4
VDDIOP
GPIO_CLK
PB1
I/O
G0_RXCK
G2
VDDIOP
GPIO
PB2
I/O
G0_TXEN
PIO, I, PU, ST
PIO, I, PU, ST
TCK
NTRST
TCK, PU
NTRST, PU
PIO, O, LOW
SCK2
I/O
PIO, I, PU, ST
ISI_PCK
PIO, I, PU, ST
PIO, I, PU, ST
19
Table 4-2.
Alternate
I/O Type
Signal
Dir
Signal
PIO Peripheral A
Dir
PIO Peripheral B
PIO Peripheral C
Reset State
Signal
Dir
Signal
Dir
Signal
Dir
E1
VDDIOP
GPIO
PB3
I/O
G0_TXER
CTS2
ISI_VSYNC
PIO, I, PU, ST
F1
VDDIOP
GPIO
PB4
I/O
G0_CRS
RXD2
ISI_HSYNC
PIO, I, PU, ST
J3
VDDIOP
GPIO
PB5
I/O
G0_COL
TXD2
PCK2
PIO, I, PU, ST
H2
VDDIOP
GPIO
PB6
I/O
G0_RXDV
PIO, I, PU, ST
J5
VDDIOP
GPIO
PB7
I/O
G0_RXER
PIO, I, PU, ST
J2
VDDIOP
GPIO
PB8
I/O
G0_RX0
PIO, I, PU, ST
G1
VDDIOP
GPIO
PB9
I/O
G0_RX1
PIO, I, PU, ST
H1
VDDIOP
GPIO_CLK
PB10
I/O
G0_RX2
PCK2
PWML1
PIO, I, PU, ST
J4
VDDIOP
GPIO
PB11
I/O
G0_RX3
RTS2
PWMH1
PIO, I, PU, ST
J1
VDDIOP
GPIO
PB12
I/O
G0_TX0
PIO, I, PU, ST
K6
VDDIOP
GPIO
PB13
I/O
G0_TX1
PIO, I, PU, ST
K1
VDDIOP
GPIO
PB14
I/O
G0_TX2
SPI2_NPCS1
PWMH0
PIO, I, PU, ST
K2
VDDIOP
GPIO
PB15
I/O
G0_TX3
SPI2_NPCS2
PWML0
PIO, I, PU, ST
L1
VDDIOP
GPIO
PB16
I/O
G0_MDC
PIO, I, PU, ST
K3
VDDIOP
GPIO
PB17
I/O
G0_MDIO
I/O
PIO, I, PU, ST
L2
VDDIOP
GPIO
PB18
I/O
SPI1_MISO
I/O
D8
I/O
PIO, I, PU, ST
M1
VDDIOP
GPIO
PB19
I/O
SPI1_MOSI
I/O
D9
I/O
PIO, I, PU, ST
N1
VDDIOP
GPIO_CLK
PB20
I/O
SPI1_SPCK
I/O
D10
I/O
PIO, I, PU, ST
K4
VDDIOP
GPIO
PB21
I/O
SPI1_NPCS0 I/O
D11
I/O
PIO, I, PU, ST
P1
VDDIOP
GPIO
PB22
I/O
SPI1_NPCS1
D12
I/O
PIO, I, PU, ST
M2
VDDIOP
GPIO
PB23
I/O
SPI1_NPCS2
D13
I/O
PIO, I, PU, ST
R1
VDDIOP
GPIO
PB24
I/O
DRXD
D14
I/O
TDI
TDI, PU
T1
VDDIOP
GPIO
PB25
I/O
DTXD
D15
I/O
TDO
TDO
K5
VDDIOP
GPIO_CLK
PB26
I/O
PCK0
RK0
I/O
PWMH0
PIO, I, PU, ST
U1
VDDIOP
GPIO
PB27
I/O
SPI1_NPCS3
TK0
I/O
PWML0
PIO, I, PU, ST
K7
VDDIOP
GPIO
PB28
I/O
SPI2_NPCS3
TD0
PWMH1
PIO, I, PU, ST
L3
VDDIOP
GPIO
PB29
I/O
TWD2
I/O
RD0
PWML1
PIO, O, LOW
L4
VDDIOP
GPIO
PB30
I/O
TWCK2
RF0
I/O
PIO, O, LOW
U2
VDDIOP
GPIO
PB31
I/O
TF0
I/O
PIO, I, PU, ST
U7
VDDIOM
GPIO
PC0
I/O
SPI0_MISO
I/O
PWMH2
ISI_D8
PIO, I, PU, ST
U9
VDDIOM
GPIO
PC1
I/O
SPI0_MOSI
I/O
PWML2
ISI_D9
PIO, I, PU, ST
U8
VDDIOM
GPIO_CLK
PC2
I/O
SPI0_SPCK
I/O
PWMH3
ISI_D10
PIO, I, PU, ST
M8
VDDIOM
GPIO
PC3
I/O
SPI0_NPCS0 I/O
PWML3
ISI_D11
PIO, I, PU, ST
U10
VDDIOM
MCI_CLK
PC4
I/O
SPI0_NPCS1
MCI0_CK
I/O
PCK1
PIO, I, PU, ST
N7
VDDIOM
GPIO
PC5
I/O
D0
I/O
MCI0_CDA
I/O
PIO, I, PU, ST
T7
VDDIOM
GPIO
PC6
I/O
D1
I/O
MCI0_DA0
I/O
PIO, I, PU, ST
G17
VDDIOM
GPIO
PC7
I/O
D2
I/O
MCI0_DA1
I/O
PIO, I, PU, ST
J13
VDDIOM
GPIO
PC8
I/O
D3
I/O
MCI0_DA2
I/O
PIO, I, PU, ST
20
Table 4-2.
Alternate
I/O Type
Signal
Dir
Signal
PIO Peripheral A
Dir
PIO Peripheral B
Signal
Dir
Signal
Dir
PIO Peripheral C
Signal
Dir
Reset State
Signal, Dir, PU,
PD, HiZ, ST
P7
VDDIOM
GPIO
PC9
I/O
D4
I/O
MCI0_DA3
I/O
PIO, I, PU, ST
R7
VDDIOM
GPIO
PC10
I/O
D5
I/O
MCI0_DA4
I/O
PIO, I, PU, ST
U11
VDDIOM
GPIO
PC11
I/O
D6
I/O
MCI0_DA5
I/O
PIO, I, PU, ST
T8
VDDIOM
GPIO
PC12
I/O
D7
I/O
MCI0_DA6
I/O
PIO, I, PU, ST
U12
VDDIOM
GPIO
PC13
I/O
NRD/NANDOE O
MCI0_DA7
I/O
PIO, I, PU, ST
R8
VDDIOM
GPIO
PC14
I/O
NWE/NANDWE O
U13
VDDIOM
GPIO
PC15
I/O
NCS3
PIO, I, PU, ST
P8
VDDIOM
GPIO
PC16
I/O
NANDRDY
PIO, I, PU, ST
T9
VDDIOM
GPIO
PC17
I/O
A21/NANDALE O
A21
T11
VDDIOM
GPIO
PC18
I/O
A22/NANDCLE O
A22
T10
VDDIOM
GPIO
PC19
I/O
ISI_D0
TK1
I/O
PIO, I, PU, ST
N8
VDDIOM
GPIO
PC20
I/O
ISI_D1
TF1
I/O
PIO, I, PU, ST
P15
VDDIOM
GPIO
PC21
I/O
ISI_D2
TD1
PIO, I, PU, ST
N16
VDDIOM
GPIO
PC22
I/O
ISI_D3
RF1
I/O
PIO, I, PU, ST
P16
VDDIOM
GPIO
PC23
I/O
ISI_D4
RD1
PIO, I, PU, ST
N17
VDDIOM
GPIO
PC24
I/O
ISI_D5
RK1
PCK1
PIO, I, PU, ST
P17
VDDIOM
GPIO
PC25
I/O
ISI_D6
TWD3
I/O
URXD1
PIO, I, PU, ST
M17
VDDIOM
GPIO
PC26
I/O
ISI_D7
TWCK3
UTXD1
PIO, I, PU, ST
T12
VDDANA
GPIO_ANA
PC27
I/O
AD0
SPI0_NPCS1
PWML0
PIO, I, PU, ST
R13
VDDANA
GPIO_ANA
PC28
I/O
AD1
SPI0_NPCS2
PWML1
PIO, I, PU, ST
T13
VDDANA
GPIO_ANA
PC29
I/O
AD2
SPI0_NPCS3
PWMFI0
PIO, I, PU, ST
R14
VDDANA
GPIO_ANA
PC30
I/O
AD3
PWMH0
PIO, I, PU, ST
R15
VDDANA
GPIO_ANA
PC31
I/O
AD4
PWMH1
PIO, I, PU, ST
L7
VDDIOP
GPIO_CLK
PD8
I/O
PCK0
PIO, I, PU, ST
P2
VDDIOP
GPIO
PD9
I/O
FIQ
PIO, I, PU, ST
T2
VDDIOP
GPIO
PD10
I/O
CTS0
PIO, I, PU, ST
M3
VDDIOP
GPIO
PD11
I/O
RTS0
N2
VDDIOP
GPIO
PD12
I/O
RXD0
M4
VDDIOP
GPIO
PD13
I/O
TXD0
K8
VDDIOP
GPIO
PD14
I/O
CTS1
N3
VDDIOP
GPIO
PD15
I/O
RTS1
L8
VDDIOP
GPIO
PD16
I/O
RXD1
P3
VDDIOP
GPIO
PD17
I/O
TXD1
P9
VDDANA
ANAIN2
PD18
I/O
PIO, I, PU, ST
M10
VDDANA
ANAIN2
PD19
I/O
PIO, I, PU, ST
R9
VDDANA
ANAIN2
PD20
I/O
PIO, I, PU, ST
R10
VDDANA
ANAIN2
PD21
I/O
PIO, I, PU, ST
P10
VDDANA
ANAIN2
PD22
I/O
PIO, I, PU, ST
PIO, I, PU, ST
SPI2_MISO
I/O
PIO, I, PU, ST
PIO, I, PU, ST
SPI2_MOSI
I/O
PIO, I, PU, ST
PIO, I, PU, ST
SPI2_SPCK
I/O
PIO, I, PU, ST
PIO, I, PU, ST
SPI2_NPCS0 I/O
PIO, I, PU, ST
21
Table 4-2.
Alternate
Dir
Signal
Dir
Signal
Dir
Reset State
Signal, Dir, PU,
PD, HiZ, ST
Signal
Dir
L11
VDDANA
ANAIN2
PD23
I/O
PIO, I, PU, ST
R11
VDDANA
ANAIN2
PD24
I/O
PIO, I, PU, ST
M11
VDDANA
ANAIN2
PD25
I/O
PIO, I, PU, ST
P11
VDDANA
ANAIN2
PD26
I/O
PIO, I, PU, ST
L12
VDDANA
ANAIN2
PD27
I/O
PIO, I, PU, ST
L9
VDDIOP
GPIO_CLK
PD28
I/O
SCK0
I/O
PIO, I, PU, ST
R2
VDDIOP
GPIO_CLK
PD29
I/O
SCK1
I/O
PIO, I, PU, ST
L5
VDDIOP
GPIO
PD30
I/O
L6
VDDIOP
GPIO_CLK
PD31
I/O
SPI0_NPCS2
PCK1
N14
VDDIOM
MCI_CLK
PE0
I/O
A0/NBS0
MCI0_CDB
I/O
N13
VDDIOM
EBI
PE1
I/O
A1
MCI0_DB0
I/O
A1, PD
M16
VDDIOM
EBI
PE2
I/O
A2
MCI0_DB1
I/O
A2, PD
M15
VDDIOM
EBI
PE3
I/O
A3
MCI0_DB2
I/O
A3, PD
J16
VDDIOM
EBI
PE4
I/O
A4
MCI0_DB3
I/O
A4, PD
L17
VDDIOM
EBI
PE5
I/O
A5
CTS3
A5, PD
J17
VDDIOM
EBI
PE6
I/O
A6
TIOA3
I/O
PIO, O, LOW
K17
VDDIOM
EBI
PE7
I/O
A7
TIOB3
I/O
PWMFI1
A7, PD
H16
VDDIOM
EBI
PE8
I/O
A8
TCLK3
PWML3
A8, PD
L16
VDDIOM
EBI
PE9
I/O
A9
TIOA2
I/O
A9, PD
L14
VDDIOM
EBI
PE10
I/O
A10
TIOB2
I/O
A10, PD
H17
VDDIOM
EBI
PE11
I/O
A11
TCLK2
A11, PD
L15
VDDIOM
EBI
PE12
I/O
A12
TIOA1
I/O
PWMH2
A12, PD
G16
VDDIOM
EBI
PE13
I/O
A13
TIOB1
I/O
PWML2
A13, PD
K12
VDDIOM
EBI
PE14
I/O
A14
TCLK1
PWMH3
A14, PD
F16
VDDIOM
EBI
PE15
I/O
A15
SCK3
I/O
TIOA0
I/O
A15, PD
K16
VDDIOM
EBI
PE16
I/O
A16
RXD3
TIOB0
I/O
A16, PD
F17
VDDIOM
EBI
PE17
I/O
A17
TXD3
TCLK0
A17, PD
E16
VDDIOM
EBI
PE18
I/O
A18
TIOA5
I/O
MCI1_CK
I/O
A18, PD
D16
VDDIOM
EBI
PE19
I/O
A19
TIOB5
I/O
MCI1_CDA
I/O
A19, PD
E17
VDDIOM
EBI
PE20
I/O
A20
TCLK5
MCI1_DA0
I/O
A20, PD
D17
VDDIOM
EBI
PE21
I/O
A23
TIOA4
I/O
MCI1_DA1
I/O
A23, PD
C16
VDDIOM
EBI
PE22
I/O
A24
TIOB4
I/O
MCI1_DA2
I/O
A24, PD
C17
VDDIOM
EBI
PE23
I/O
A25
TCLK4
MCI1_DA3
I/O
A25, PD
K13
VDDIOM
EBI
PE24
I/O
NCS0
RTS3
B17
VDDIOM
EBI
PE25
I/O
NCS1
SCK4
I/O
IRQ
NCS1
K14
VDDIOM
EBI
PE26
I/O
NCS2
RXD4
A18
NCS2
K15
VDDIOM
EBI
PE27
I/O
NWR1/NBS1
TXD4
J10
VDDIOM
EBI
PE28
I/O
NWAIT
RTS4
Atmel-11238A-ATARM-SAMA5D4-Datasheet_30-Sep-14
Signal
PIO Peripheral C
I/O Type
Dir
PIO Peripheral B
22
Signal
PIO Peripheral A
PIO, I, PU, ST
PIO, I, PU, ST
CTS4
A0, PD
NCS0
PIO, I, PU, ST
A19
PIO, I, PU, ST
Table 4-2.
Alternate
I/O Type
Signal
Dir
Signal
PIO Peripheral A
Dir
PIO Peripheral B
PIO Peripheral C
Reset State
Signal
Dir
Signal
Dir
Signal
Dir
P6
VDDIOP
DIB
PE29
I/O
DIBP
URXD0
TWD1
I/O
PIO, O, LOW
N6
VDDIOP
DIB
PE30
I/O
DIBN
UTXD0
TWCK1
PIO, O, LOW
K9
VDDIOP
GPIO
PE31
I/O
ADTRG
R3
VDDBU
SYSC
TST
I, PD, ST
T15
VDDIOP
CLOCK
XIN
U15
VDDIOP
CLOCK
XOUT
U5
VDDBU
CLOCK
XIN32
T5
VDDBU
CLOCK
XOUT32
U4
VDDBU
SYSC
SHDN
O, PU
T4
VDDBU
SYSC
WKUP
I, ST
M5
VDDBU
PIOBU
PIOBU0
I, PU
R4
VDDBU
PIOBU
PIOBU1
I, PU
P4
VDDBU
PIOBU
PIOBU2
I, PU
R5
VDDBU
PIOBU
PIOBU3
I, PU
N5
VDDBU
PIOBU
PIOBU4
I, PU
P5
VDDBU
PIOBU
PIOBU5
I, PU
N4
VDDBU
PIOBU
PIOBU6
I, PU
R6
VDDBU
PIOBU
PIOBU7
I, PU
U3
VDDBU
PIOBU
NRST
T3
VDDBU
SYSC
JTAGSEL
I, PD
B12 VDDIODDR
DDR_IO
DDR_A0
O, LOW
A12 VDDIODDR
DDR_IO
DDR_A1
O, LOW
E15 VDDIODDR
DDR_IO
DDR_A2
O, LOW
G11 VDDIODDR
DDR_IO
DDR_A3
O, LOW
C13 VDDIODDR
DDR_IO
DDR_A4
O, LOW
D12 VDDIODDR
DDR_IO
DDR_A5
O, LOW
C11 VDDIODDR
DDR_IO
DDR_A6
O, LOW
A14 VDDIODDR
DDR_IO
DDR_A7
O, LOW
F12 VDDIODDR
DDR_IO
DDR_A8
O, LOW
C14 VDDIODDR
DDR_IO
DDR_A9
O, LOW
G12 VDDIODDR
DDR_IO
DDR_A10
O, LOW
A13 VDDIODDR
DDR_IO
DDR_A11
O, LOW
B13 VDDIODDR
DDR_IO
DDR_A12
O, LOW
C10 VDDIODDR
DDR_IO
DDR_A13
O, LOW
J14 VDDIODDR
DDR_IO
DDR_D0
I/O
I, HiZ
B16 VDDIODDR
DDR_IO
DDR_D1
I/O
I, HiZ
J9 VDDIODDR
DDR_IO
DDR_D2
I/O
I, HiZ
J12 VDDIODDR
DDR_IO
DDR_D3
I/O
I, HiZ
PIO, O, LOW
23
Table 4-2.
Alternate
Signal
PIO Peripheral A
Dir
Signal
Dir
PIO Peripheral B
Signal
Dir
PIO Peripheral C
Signal
Dir
Reset State
Signal, Dir, PU,
PD, HiZ, ST
I/O Type
Signal
Dir
A16 VDDIODDR
DDR_IO
DDR_D4
I/O
I, HiZ
A15 VDDIODDR
DDR_IO
DDR_D5
I/O
I, HiZ
H10 VDDIODDR
DDR_IO
DDR_D6
I/O
I, HiZ
B15 VDDIODDR
DDR_IO
DDR_D7
I/O
I, HiZ
G15 VDDIODDR
DDR_IO
DDR_D8
I/O
I, HiZ
H13 VDDIODDR
DDR_IO
DDR_D9
I/O
I, HiZ
C15 VDDIODDR
DDR_IO
DDR_D10
I/O
I, HiZ
D15 VDDIODDR
DDR_IO
DDR_D11
I/O
I, HiZ
H12 VDDIODDR
DDR_IO
DDR_D12
I/O
I, HiZ
H11 VDDIODDR
DDR_IO
DDR_D13
I/O
I, HiZ
B14 VDDIODDR
DDR_IO
DDR_D14
I/O
I, HiZ
H9 VDDIODDR
DDR_IO
DDR_D15
I/O
I, HiZ
A17 VDDIODDR
DDR_IO
DDR_DQM0
O, LOW
H14 VDDIODDR
DDR_IO
DDR_DQM1
O, LOW
H15 VDDIODDR
DDR_IO
DDR_DQS0
I/O
O, LOW
F15 VDDIODDR
DDR_IO
DDR_DQS1
I/O
O, LOW
J15 VDDIODDR
DDR_IO
DDR_DQSN0 I/O
O, HIGH
F14 VDDIODDR
DDR_IO
DDR_DQSN1 I/O
O, HIGH
C9 VDDIODDR
DDR_IO
DDR_CS
O, LOW
B10 VDDIODDR
DDR_IO
DDR_CLK
B11 VDDIODDR
DDR_IO
DDR_CLKN
D9 VDDIODDR
DDR_IO
DDR_CKE
O, LOW
A10 VDDIODDR
DDR_IO
DDR_RAS
O, LOW
A11 VDDIODDR
DDR_IO
DDR_CAS
O, LOW
C12 VDDIODDR
DDR_IO
DDR_WE
O, LOW
D11 VDDIODDR
DDR_IO
DDR_BA0
O, LOW
D10 VDDIODDR
DDR_IO
DDR_BA1
O, LOW
E10 VDDIODDR
DDR_IO
DDR_BA2
O, LOW
G10 VDDIODDR
Reference
DDR_CALN
E14 GNDIODDR
Reference
DDR_CALP
DDR_VREF
P14
VBG
VBG
VBG
R12
VDDANA
Reference
ADCVREF
R16 VDDUTMII
USBHS
HHSDPC
I/O
O, PD
R17 VDDUTMII
USBHS
HHSDMC
I/O
O, PD
U17 VDDUTMII
USBHS
HHSDPB
I/O
O, PD
T17 VDDUTMII
USBHS
HHSDMB
I/O
O, PD
U16 VDDUTMII
USBHS
HHSDPA
I/O
24
DHSDP
O, PD
Table 4-2.
Alternate
I/O Type
Signal
Dir
Signal
T16 VDDUTMII
USBHS
HHSDMA
I/O
DHSDM
PIO Peripheral A
Dir
Signal
Dir
PIO Peripheral B
Signal
Dir
PIO Peripheral C
Signal
Dir
Reset State
Signal, Dir, PU,
PD, HiZ, ST
O, PD
T6
VDDBU
Power Supply
VDDBU
U6
GNDBU
Ground
GNDBU
VDDCORE
GNDCORE
VCCCORE
D13
E11
VDDIODDR Power Supply VDDIODDR
F11
G13
D14
E12
GNDIODDR
E13
F13
J6
E9
F9
F10 GNDCORE
J7
K11
Ground
H6
H7
VCCCORE Power Supply
J11
N9
Ground
GNDIODDR
M6
M7
VDDIOM
Power Supply
VDDIOM
M9
N11
GNDIOM
Ground
GNDIOM
B9
D6
D7
E6
E8
GNDIOP
Ground
GNDIOP
G8
H8
J8
VDDIOP
Power Supply
VDDIOP
A6
A7
A8
A9
B6
B7
B8
C6
C7
C8
D5
D8
E7
F7
F8
G6
G7
GNDIOP
Ground
GNDIOP
25
Table 4-2.
Signal
Dir
Signal
Dir
N12 GNDUTMI
GNDUTMI
VDDPLLA
T14
GNDPLL
Ground
GNDPLL
P12
VDDOSC
Power Supply
VDDOSC
M12
GNDOSC
Ground
GNDOSC
G9
L10
VDDANA
Power Supply
VDDANA
N10
GNDANA
Ground
GNDANA
VDDFUSE
M14 GNDFUSE
GNDFUSE
Atmel-11238A-ATARM-SAMA5D4-Datasheet_30-Sep-14
Dir
Reset State
VDDUTMII
Signal
PIO Peripheral C
L13
VDDUTMII Power Supply
M13
Ground
Dir
PIO Peripheral B
Dir
Ground
Signal
PIO Peripheral A
Signal
26
I/O Type
Alternate
4.3
Input/Output Description
Table 4-3.
I/O Type
GPIO
GPIO_CLK
Pull-down
Schmitt
Trigger (2)
Voltage Range
Analog
Type (2)
Typ Value ()
Type (2)
Typ Value ()
3.03.6V
Switchable
(1)
Switchable
(1)
Switchable
Switchable
(1)
Switchable
(1)
Switchable
Switchable
(1)
Switchable
(1)
Switchable
3.03.6V
GPIO_CLK2
3.03.6V
Switchable
(1)
GPIO_ANA
3.03.6V
Switchable
(1)
Switchable
(1)
Switchable
(1)
Switchable
(1)
EBI
1.651.95V, 3.03.6V
ANAIN2
3.03.6V
Switchable
(1)
RST
3.03.6V
Reset State
100K
Reset State
100K
Reset State
SYSC
1.653.6V
Reset State
100K
Reset State
15K
Reset State
USBHS
3.03.6V
I/O
CLOCK
1.653.6V
I/O
PIOBU
1.882.12V
Switchable
150K
Switchable
150K
Switchable
3.03.6V
I/O
(1)
(1)
DIB
Notes:
Table 4-4.
I/O Type
Load (pF)
Fan-out
Drive Control
Signal Name
GPIO
High/Medium/Low
MCI_CLK
High/Medium/Low
MCI0CK, MCI1CK
GPIO_CLK
High/Medium/Low
GPIO_CLK2
High/Medium/Low
LCDPCK
GPIO_ANA
Fixed to Medium
ANAIN2
EBI
High/Medium/Low
1.8V/3.3V
DDR_IO
High/Medium/Low
RST
Fixed to Low
JTAG
Fixed to Medium
SYSC
No
VBG
No
VBG
USBHS
480
20
No
CLOCK
50
50
No
PIOBU
No
PIOBUx
ADx
PD18PD27
27
5.
Power Considerations
5.1
Power Supplies
Table 5-1 defines the different power supplies rails and the estimated power consumption at typical voltage.
3V3 is to be established prior to VDDCORE and must always be present. There are specific power sequences to
ensure reliable operation of the device and avoid unwanted security events.
Table 5-1.
Name
Associated
Ground
VDDCORE
1.621.98V, 1.8V
GNDCORE
Powers
Regulator that generates core power supply on VCCCORE
10 F decoupling capacitor is to be connected to VCCCORE
MUST BE ESTABLISHED AFTER VDDIOP OR AT THE SAME TIME
VCCCORE
VDDIODDR
1.11.32V, 1.2V
1.701.90V, 1.8V
1.141.30V, 1.2V
1.651.95V, 1.8V
VDDIOM
3.03.6V, 3.3V
GNDCORE
GNDIODDR
GNDIOM
VDDIOP (1)
3.03.6V, 3.3V
GNDIOP
VDDBU
1.88V2.12V, 2V
GNDBU
Core
DDR2 Interface I/O lines
LP-DDR2 Interface I/O lines
NAND and HSMC Interface I/O lines
Peripherals I/O lines
MUST BE ESTABLISHED PRIOR TO VDDCORE
Slow Clock oscillator, the internal 64 kHz RC and a part of the System
Controller
MUST BE ESTABLISHED FIRST
VDDUTMIC
1.11.32V, 1.2V
GNDUTMI
VDDUTMII
3.03.6V, 3.3V
GNDUTMI
VDDPLLA
1.11.32V, 1.2V
GNDPLL
VDDOSC
3.0V3.6V
GNDOSC
VDDANA (1)
3.03.6V, 3.3V
GNDANA
VDDFUSE
2.252.75V, 2.5V
GNDFUSE
USB device and host UTMI+ core and the UTMI PLL
MUST be connected to VCCCORE
USB device and host UTMI+ interface
PLLA cell
MUST be connected to VCCCORE
Main Oscillator cell
Analog parts
MUST be connected to VDDIOP with filtering
Fuse box for programming
VDDFUSE must be 2.5V or 0V and must not be left floating
Notes:
5.2
Power-up Consideration
VDDBU must be set first and for a permanent duration.
The user must first maintain NRST to L prior to establish the power supplies. Then VDDIOP and VDDANA are to
be established, followed by VDDCORE and VDDPLL. At the end, other power supplies can be established. After a
delay of five SLCK periods, the user can assert NRST to H and make the system start.
28
5.3
Shut-down Consideration
When SHDN pin is asserted, NRST must be maintained to L prior to remove the power supplies. After a delay of
five SLCK periods, VDDPLL, then VDDCORE, then VDDIOP and VDDANA can be removed. At last other power
supplies can be removed.
VDDBU must never been removed when other supplies are present.
5.4
Wake-up Consideration
When SHDN is rising, NRST is to be maintained to L prior to establish the power supplies. Then VDDIOP and
VDDANA are to be established, followed by VDDCORE and VDDPLL. At the end, other power supplies can be
established. After a delay of five SLCK periods, the user can assert NRST to H and make the system wake up.
5.5
Power-down Consideration
The user must first maintain NRST to L prior to remove the power supplies. After a delay of five SLCK periods, the
user can remove VDDPLL, then VDDCORE, then VDDIOP and VDDANA. At last other power supplies can be
removed.
VDDBU must never been removed when other supplies are present.
5.6
Power-on Reset
The SAMA5D4 embeds several Power-On Resets (POR) to ensure that the power supply is established when the
reset is released. These PORs are dedicated to VDDBU, VDDIOP and VDDCORE respectively.
5.7
5.7.1
The DDR2/LPDDR/LPDDR2 I/Os embedds an automatic impedance matching control to avoid overshoots and to
reach the best performances according to the bus load and external memories.
Two specific analog inputs, DDR_CALP and DDR_CALN are used to calibrate all the DDR I/Os.
5.7.2
5.7.3
Static Memories
The EBI I/Os accept three drive level (LOW, MEDIUM, HIGH) allowing to avoid overshoots and give the best
performances according to the bus load and external memories voltage.
The slew rates are determined by programming SFR_EBICFG bit in the SFR registers.
29
At reset the selected drive is low. The user must make sure to program the correct drive according to the device
load.
5.8
30
6.
Memories
Figure 6-1.
0x0000 0000
ROM
0x0000 0000
Internal Memories
NFC SRAM
256 Mbytes
Peripheral Mapping
0xF000 0000
512 Mbytes
ISI
0x00A0 0000
0x3FFF FFFF
0x4000 0000
Undefined
(Abort)
0x00B0 0000
0xF800 0000
0x0FFF FFFF
HSMCI0
16 Kbytes
UART0
16 Kbytes
SSC0
16 Kbytes
PWMC
16 Kbytes
0xF000 C000
0xF800 4000
512 Mbytes
0xF800 8000
0x5FFF FFFF
0x6000 0000
256 Mbytes
1 Mbyte
SMD
1 Mbyte
L2CC
1 Mbyte
Undefined
(Abort)
1 Mbyte
SPI0
16 Kbytes
TWI0
16 Kbytes
TWI1
16 Kbytes
0xF801 4000
16 Kbytes
GMAC0
16 Kbytes
DMAC0
16 Kbytes
PMC
16 Kbytes
MATRIX64
16 Kbytes
AESB
16 Kbytes
SFR
16 Kbytes
0xF802 8000
0xF802 C000
TWI2
16 Kbytes
USART0
16 Kbytes
USART1
16 Kbytes
0xF803 0000
0xF802 8000
Undefined
(Abort)
16 Kbytes
0xF002 4000
0xF802 4000
128 Mbytes
16 Kbytes
0xF002 0000
0xF802 0000
0x8800 0000
CPKCC
MPDDRC
0xF001 C000
0xF801 C000
256 Mbytes
0xF001 8000
0xF801 8000
0x6FFF FFFF
0x7000 0000
NFC
Command Registers
1 Mbyte
DAP
0xF001 4000
0xF801 0000
0x8FFF FFFF
0x9000 0000
1 Mbyte
AXI Matrix
0xF001 0000
0xF800 C000
EBI
Chip Select 3
1 Mbyte
UHP EHCI
0x0090 0000
0xF001 8000
EBI
Chip Select 2
UHP OHCI
0x0080 0000
0xF000 8000
0xF000 C000
EBI
Chip Select 1
1 Mbyte
0x0070 0000
DMAC1
DDR CS/AES
1 Mbyte
0x0060 0000
0xF000 4000
DDR CS
VDEC
UDPHS RAM
0x0050 0000
LCDC
0xF803 4000
0xFC00 0000
HSMCI1
16 Kbytes
UART1
16 Kbytes
USART2
16 Kbytes
0xFC00 4000
256 Mbytes
Reserved
0xFC00 8000
0x9FFF FFFF
CATB
0xFC00 C000
0xFC03 9000
USART3
16 Kbytes
USART4
16 Kbytes
SSC1
16 Kbytes
0xFC01 0000
Reserved
0xFC01 4000
0xFC01 8000
SPI1
Undefined
(Abort)
16 Kbytes
0xFC04 0000
SPI2
TC3, TC4, TC5
16 Kbytes
16 Kbytes
16 Kbytes
GMAC1
16 Kbytes
0xFC04 C000
16 Kbytes
0xFC05 C000
TRNG
16 Kbytes
0xFC06 0000
16 Kbytes
SECURAM
16 Kbytes
SMC
16 Kbytes
SFC
16 Kbytes
0xFC06 4000
0xFC03 8000
16 Kbytes
16 Kbytes
MATRIX32
0xFC05 8000
UDPHS
TWI3
16 Kbytes
SHA
0xFC05 4000
0xFC03 4000
Reserved
0xFC06 8000
0xFC03 9000
0xEFFF FFFF
0xF000 0000
TDES
0xFC05 0000
0xFC03 0000
16 Kbytes
16 Kbytes
Reserved
0xFC02 C000
ADC
16 Kbytes
0xFC04 8000
0xFC02 4000
0xFC02 8000
ICM
AES
0xFC04 4000
0xFC01 C000
0xFC02 0000
PIOD
512 bytes
SBM
512 bytes
0xFC06 8200
0xFC06 9000
Internal Peripheral
256 Mbytes
DBGU
4 Kbytes
0xFC06 8400
PIOA
4 Kbytes
0xFC06 8600
PIOB
4 Kbytes
PIOC
4 Kbytes
0xFC06 A000
0xFC06 B000
0xFFFF FFFF
Legend
0xFC06 C000
PIOE
Always Secured
0xFC06 E000
Programmable Secured (PS)
AIC
0xFC06 F000
Undefined
(Abort)
0xFC06 8610
0xFC06 8630
0xFC06 8640
0xFC06 D000
xxx
128 Kbytes
0x0040 0000
256 Mbytes
0x1FFF FFFF
0x2000 0000
xxx
SRAM
0x0030 0000
EBI
Chip Select 0
xxx
4 Kbytes
0x0020 0000
0x0FFF FFFF
0x1000 0000
0x7FFF FFFF
0x8000 0000
128 Kbytes
0x0010 0000
4 Kbytes
4 Kbytes
0xFC06 8650
0xFC06 86B0
0xFC06 88B0
SAIC
512 bytes
RSTC
16 bytes
SHDC
16 bytes
PIT
16 bytes
WDT
16 bytes
SCKCR
16 bytes
RTC
512 bytes
Undefined
(Abort)
31
6.1
Embedded Memory
6.1.1
6.1.2
6.1.3
SDCARD
EMMC
TWI EEPROM
The boot sequence can be selected using the boot order facility (Boot Select Control Register). The internal ROM
embeds Galois field tables that are used to compute NAND Flash ECC. Refer to Figure 13-9 Galois Field Table
Mapping in Section 13. Standard Boot Strategies of this datasheet.
6.1.4
Boot Strategies
For standard boot strategies, refer to Section 13. Standard Boot Strategies of this datasheet.
For secure boot strategies, refer to the application note SAMA5D4x Secure Boot Strategy, Atmel literature No.
11295 (NDA required).
32
6.2
External Memory
The SAMA5D4 offers connexion to a wide range of external memories or to parallel peripherals.
6.2.1
6.2.2
Multi-port
Dynamic scrambling
The port 0 of this interface has an embedded automatic AES encryption and decryption mechanism (see
Section 53. Advanced Encryption Standard Bridge (AESB)). Writing to or reading from the address
0x40000000 may trigger the encryption or decryption mechanism depending on the AESB on External
Memories configuration.
TrustZone: The multi-port feature of this interface implies TrustZone configuration constraints. See Section
16.12 TrustZone Extension to AHB and APB for more details.
The Static Memory Controller is able to drive up to four chip selects. NCS3 is dedicated to the NAND Flash control.
The HSMC embeds the NAND Flash Controller (NFC). The NFC can handle automatic transfers, sending the
commands and address cycles to the NAND Flash and transferring the content of the page (for read and write) to
the NFC SRAM. It minimizes the CPU overhead.
In order to improve overall system performance, the DATA phase of the transfer can be DMA assisted. The static
memory embeds the NAND Flash Error Correcting Code Controller with the following features:
Supports also SLC 1-bit (BCH 2-bit), SLC 4-bit (BCH 4-bit)
2-bit, 4-bit, 8-bit and 16-bit errors for 512 bytes/sector (4 Kbyte page)
24-bit error for 1024 bytes/sector (8 Kbyte page)
Supports 8-Kbyte page size using 1024 bytes/sector and 4-Kbyte page size using 512 bytes/sector
Dynamic scrambling
33
7.
7.1
Embedded Characteristics
Table 7-1.
Timers, PWM, IO peripherals generate event triggers which are directly routed to event managers such as
ADC, for example, to start measurement/conversion without processor intervention.
UART, USART, SPI, TWI, PWM, HSMCI, AES, ADC, PIO, TIMER (capture mode) also generate event
triggers directly connected to DMA Controller (XDMAC0 or XDMAC1) for data transfer without processor
intervention.
PWM safety events (faults) are in combinational form and directly routed from event generators (ADC, PMC,
TIMER) to PWM module.
PMC safety event (clock failure detection) can be programmed to switch the MCK on reliable main RC
internal clock without processor intervention.
Event Manager
Function
PMC
Safety / Puts the PWM Outputs in Safe Mode (Main Crystal Clock Failure
Detection)
Analog-to-Digital-Controller (ADC)
PWM
Timer Counter Block 0 (TC0,1,2)
Safety / Puts the PWM Outputs in Safe Mode (General Purpose Fault
Inputs)
ADTRG
34
8.
System Controller
The System Controller is a set of peripherals handling key elements of the system, such as power, resets, clocks,
time, interrupts, watchdog, etc.
The System Controllers peripherals are all mapped between addresses 0xFC06 0000 and 0xFC06 F000.
Figure 8-1 shows the System Controller block diagram.
35
Figure 8-1.
VDDCORE Powered
Secured
Advanced
Interrupt
Controller
fiq
secured_periph_irq[]
irq[23]
pmc_irq
nfiq
fiq_vect
ptc_wakeup
irq
nirq
irq_vect
Advanced
Interrupt
Controller
nonsecured_periph_irq[]
pit_irq
wdt_irq
dbgu_irq
por_ntrst
Cortex A5
ntrst
proc_nreset
PCK
MCK
periph_nreset
Debug
Unit
dbgu_irq
dbgu_txd
dbgu_rxd
MCK
Debug
periph_nreset
SLCK
Debug
Idle
proc_nreset
debug
Periodic
Interval
Timer
pit_irq
Watchdog
Timer
wdt_irq
jtag_nreset
Boundary Scan
TAP Controller
MCK
periph_nreset
Bus Matrix
wdt_fault
WDRPROC
NRST
por_ntrst
jtag_nreset
VDDCORE
POR
Reset
Controller
periph_nreset
proc_nreset
backup_nreset
UPLLCK
VDDBU
VDDBU
POR
VDDBU Powered
UHP48M
UHP12M
SLCK
SLCK
backup_nreset
Real-Time
Clock
rtc_irq
periph_nreset
rtc_alarm
periph_irq[50]
ntrst
irq[20]
UPLLCK
irq[23]
wkup
PIOBU[7..0]
periph_nreset
MCK
periph_irq[49]
Erase
Automaton
12M PLL
32K RC
SECURAM
8 KB
+
512 bits
SLCK
SHDN
WKUP
backup_nreset
rtc_alarm
Shutdown
Controller
32K RC
OSC
XIN32
XOUT32
SLOW
CLOCK
OSC
SCKCR
12 MHz RC
OSC
XIN
XOUT
SLCK
int
MAINCK
12 MHz
MAIN OSC
PLLA
UPLL
PLLACK
Power
Management
Controller
UPLLCK
periph_clk[2..59]
pck[0-2]
UHP48M
UHP12M
PCK
MCK
DDR sysclk
LCD Pixel clock
pmc_irq
Idle
periph_clk[2..59]
periph_nreset
periph_nreset
periph_nreset
periph_clk[29..26]
dbgu_rxd
PA0-PA31
PB0-PB31
PIO
Controllers
PC0-PC31
PD8-PD31
periph_irq[29..26]
irq
fiq
dbgu_txd
periph_irq[2..59]
Embedded
Peripherals
In
Out
Enable
PE0-PE31
Fuse Box
Legend
Trustzone Access Right Management
36
xxx
Always Secured
xxx
xxx
8.1
Chip Identification
37
9.
Peripherals
9.1
Peripheral Mapping
As shown in Figure 6-1 SAMA5D4 Series Memory Mapping, the peripherals are mapped in the upper 256 Mbytes
of the address space between the addresses 0xF000 0000 and 0xFFFF FFFF.
Each user peripheral is allocated 16 Kbytes of the address space.
9.2
Peripheral identifiers
Table 9-1.
Peripheral identifiers
Instance
ID
Instance
Name
Clock Type
Security
Type
SAIC
FIQ Interrupt ID
SYS_CLK90
AS
H32
APB1
SYS
SYS_CLK90
AS
H32
APB1
ARM
PROC_CLOCK
AS
H64
APB
PIT
SYS_CLK90
AS
H32
APB1
WDT
SYS_CLK90
AS
H32
APB1
PIOD
PCLOCK90
AS
H32
APB1
USART0
USART 0
PCLOCK90
AS
H32
APB0
USART1
USART 1
PCLOCK90
AS
H32
APB0
XDMAC0
DMA Controller 0
HCLOCK180 +
PCLOCK180
AS
H64
APB
ICM
HCLOCK90
AS
H32
APB1
10
CPKCC
PCLOCK180
AS
H64
APB
12
AES
PCLOCK90
AS
H32
APB1
13
AESB
AES bridge
PCLOCK180
AS
H64
APB
14
TDES
PCLOCK90
AS
H32
APB1
15
SHA
SHA Signature
PCLOCK90
AS
H32
APB1
16
MPDDRC
MPDDR controller
HCLOCK180
AS
H64
APB1
17
MATRIX1
HCLOCK90
AS
H32
APB1
18
MATRIX0
HCLOCK180
AS
H64
APB
19
VDEC
Video Decoder
HCLOCK180
PS
H64
APB1
20
SBM
SYS_CLK90
AS
H32
APB1
22
HSMC
HCLOCK90
PS
H32
APB1
23
PIOA
PCLOCK90
PS
H32
APB1
24
PIOB
PCLOCK90
PS
H32
APB1
25
PIOC
PCLOCK90
PS
H32
APB1
26
PIOE
PCLOCK90
PS
H32
APB1
27
UART0
UART 0
PCLOCK90
PS
H32
APB1
38
Instance Description
External
Interrupt
Wired-OR
interrupt
FIQ
PMC, RSTC,
RTC
In
On
Matrix APB
Table 9-1.
Instance
ID
Instance
Name
Clock Type
Security
Type
28
UART1
UART 1
PCLOCK90
PS
H32
APB1
29
USART2
USART 2
PCLOCK90
PS
H32
APB1
30
USART3
USART 3
PCLOCK90
PS
H32
APB1
31
USART4
USART 4
PCLOCK90
PS
H32
APB0
32
TWI0
Two-wire Interface 0
PCLOCK90
PS
H32
APB1
33
TWI1
Two-wire Interface 1
PCLOCK90
PS
H32
APB1
34
TWI2
Two-wire Interface 2
PCLOCK90
PS
H32
APB1
35
HSMCI0
PCLOCK90
PS
H32
APB1
36
HSMCI1
PCLOCK90
PS
H32
APB0
37
SPI0
PCLOCK90
PS
H32
APB0
38
SPI1
PCLOCK90
PS
H32
APB0
39
SPI2
PCLOCK90
PS
H32
APB0
40
TC0
PCLOCK90
PS
H32
APB1
41
TC1
PCLOCK90
PS
H32
APB0
42
TC2
PCLOCK90
PS
H32
APB1
43
PWM
PCLOCK90
PS
H32
APB1
44
ADC
PCLOCK90
PS
H32
APB0
45
DBGU
PCLOCK90
PS
H32
APB0
46
UHPHS
HCLOCK90
PS
H32
APB0
47
UDPHS
HCLOCK90 +
PCLOCK90
PS
H32
APB0
48
SSC0
PCLOCK90
PS
H32
APB1
49
SSC1
PCLOCK90
PS
H32
APB1
50
XDMAC1
HCLOCK180 +
PCLOCK180
NonSecured
H64
APB
51
LCDC
LCD Controller
HCLOCK180
PS
H64
APB1
52
ISI
Camera Interface
HCLOCK180
PS
H64
APB0
53
TRNG
PCLOCK90
PS
H32
APB1
54
GMAC0
Ethernet MAC 0
HCLOCK90 +
PCLOCK90
PS
H32
APB0
55
GMAC1
Ethernet MAC 1
HCLOCK90 +
PCLOCK90
PS
H32
APB1
56
AIC
IRQ Interrupt ID
SYS_CLK90
NonSecured
H32
APB1
57
SFC
Fuse Controller
PCLOCK90
AS
H32
APB1
Instance Description
External
Interrupt
DMA Controller 1
IRQ
Wired-OR
interrupt
In
On
Matrix APB
39
Table 9-1.
Instance
ID
Instance
Name
58
59
SECURAM
61
SMD
62
TWI3
Two-Wire Interface 3
63
64
SFR
65
AIC
66
SAIC
Instance Description
External
Interrupt
Wired-OR
interrupt
Clock Type
Security
Type
In
On
Matrix APB
Reserved
Secured RAM
PCLOCK90
AS
H32
APB1
SMDCK
PS
H32
APB1
PCLOCK90
PS
H32
APB1
Reserved
67
Notes:
L2CC
L2 Cache Controller (1)
1. For security purposes, there is no matching clock but a peripheral ID only.
9.3
AS
H32
APB1
NonSecured
H32
APB1
AS
H32
APB1
PS
H64
APB1
The SAMA5D4 product features five PIO controllers: PIOA, PIOB, PIOC,PIOD and PIOE, that multiplex the I/O
lines of the peripheral set.
Each line can be assigned to one of three peripheral functions: A, B, or C. The multiplexing tables in the pin
description paragraphs define how the I/O lines of the peripherals A, B and C are multiplexed on the PIO
Controllers.
Note that some peripheral functions which are output only, might be duplicated within the both tables.
The column Reset State indicates whether the PIO Line resets in I/O mode or in peripheral mode. If I/O is
mentioned, the PIO line resets in input with the pull-up enabled, so that the device is maintained in a static state as
soon as the reset is released. As a result, the bit corresponding to the PIO line in PIO_PSR (Peripheral Status
Register) resets low.
If a signal name is mentionned in the Reset State column, the PIO line is assigned to this function and the
corresponding bit in PIO_PSR resets high. This is the case of pins controlling memories, in particular the address
lines, which require the pin to be driven as soon as the reset is released. Note that the pull-up resistor is also
enabled in this case.
9.4
HCLOCK: AHB Clock, managed with the PMC_SCER, PMC_SCDR and PMC_SCSR registers of PMC
System Clock
PCLOCK: APB Clock, managed with the PMC_PCER, PMC_PCDR, PMC_PCSR and PMC_PCR registers
of Peripheral Clock
HCLOCK + PCLOCK: Both clock types coexist. The clock is managed with the PMC_PCER, PMC_PCDR,
PMC_PCSR and PMC_PCR registers of Peripheral Clock
PROC_CLOCK: The clock related to Processor Clock (PCK) and managed with the PMC_SCDR and
PMC_SCSR registers of PMC System Clock
Please refer to Table 9-1 Peripheral identifiers on page 38 for details. In the table, clock type suffixes 180 and 90
refer to MATRIX0 and MATRIX1, respectively.
40
10.
ARM Cortex-A5
10.1
Description
The ARM Cortex-A5 processor is a high-performance, low-power, ARM macrocell with an L1 cache subsystem
that provides full virtual memory capabilities. The Cortex-A5 processor implements the ARMv7 architecture and
runs 32-bit ARM instructions, 16-bit and 32-bit Thumb instructions, and 8-bit Java byte codes in Jazelle state.
The Cortex-A5 NEON Media Processing Engine (MPE) extends the Cortex-A5 functionality to provide support for
the ARM v7 Advanced SIMD v2 and Vector Floating-Point v4 (VFPv4) instruction sets. The Cortex-A5 NEON MPE
provides flexible and powerful acceleration for signal processing algorithms including multimedia such as image
processing, video decode/encode, 2D/3D graphics, and audio. See the Cortex-A5 NEON Media Processing
Engine Technical Reference Manual.
The Cortex-A5 processor includes TrustZone technology to enhance security by partitioning the SoCs hardware
and software resources in a Secure world for the security subsystem and a Normal world for the rest, enabling a
strong security perimeter to be built between the two. See Security Extensions overview in the Cortex-A5
Technical Reference Manual. See the ARM Architecture Reference Manual for details on how TrustZone works in
the architecture.
Note:
All ARM publications referenced in this datasheet can be found at www.arm.com.
Run Mode
Standby Mode
Run mode is the normal mode of operation where all of the processor functionality is available. Everything,
including core logic and embedded RAM arrays, is clocked and powered up.
10.1.1.2 Standby Mode
Standby mode disables most of the clocks of the processor, while keeping it powered up. This reduces the power
drawn to the static leakage current, plus a small clock power overhead required to enable the processor to wake
up from Standby mode. The transition from Standby mode to Run mode is caused by one of the following:
10.2
the arrival of an event, if standby mode was initiated by a Wait for Event (WFE) instruction
a reset.
Embedded Characteristics
41
10.3
Block Diagram
Figure 10-1.
#$%&
%
' $!
!
"
"
<&
"
%;"
10.4
Programmer Model
User mode (USR) is the usual ARM program execution state. It is used for executing most application
programs.
Fast Interrupt (FIQ) mode is used for handling fast interrupts. It is suitable for high-speed data transfer or
channel process.
System mode (SYS) is a privileged user mode for the operating system.
Monitor mode (MON) is secure mode that enables change between Secure and Non-secure states, and can
also be used to handle any of FIQs, IRQs and external aborts. Entered on execution of a Secure Monitor
Call (SMC) instruction.
Mode changes may be made under software control, or may be brought about by external interrupts or exception
processing. Most application programs execute in User Mode. The non-user modes, known as privileged modes,
are entered in order to service interrupts or exceptions or to access protected resources.
42
ARM state:
The processor executes 32-bit, word-aligned ARM instructions.
Thumb state:
The processor executes 16-bit and 32-bit, halfword-aligned Thumb instructions.
ThumbEE state:
The processor executes a variant of the Thumb instruction set designed as a target for dynamically
generated code. This is code compiled on the device either shortly before or during execution from a
portable bytecode or other intermediate or native representation.
Jazelle state:
The processor executes variable length, byte-aligned Java bytecodes.
The J bit and the T bit determine the instruction set used by the processor. Table 10-1 shows the encoding of
these bits.
Table 10-1.
ARM
Thumb
Jazelle
ThumbEE
Changing between ARM and Thumb states does not affect the processor mode or the register contents. See the
ARM Architecture Reference Manual, ARMv7-A and ARMv7-R edition for information on entering and exiting
ThumbEE state.
10.4.2.1 Switching State
ARM state and Thumb state using the BX and BLX instructions.
Thumb state and ThumbEE state using the ENTERX and LEAVEX instructions.
See the ARM Architecture Reference Manual for more information about changing instruction set state.
10.4.3 Cortex-A5 Registers
This view provides 16 ARM core registers, R0 to R15, that include the Stack Pointer (SP), Link Register (LR), and
Program Counter (PC). These registers are selected from a total set of either 31 or 33 registers, depending on
whether or not the Security Extensions are implemented. The current execution mode determines the selected set
of registers, as shown in Table 10-2. This shows that the arrangement of the registers provides duplicate copies of
43
some registers, with the current register selected by the execution mode. This arrangement is described as
banking of the registers, and the duplicated copies of registers are referred to as banked registers.
Table 10-2.
User and
System
Monitor
Supervisor
Abort
Undefined
Interrupt
Fast Interrupt
R0
R0
R0
R0
R0
R0
R0
R1
R1
R1
R1
R1
R1
R1
R2
R2
R2
R2
R2
R2
R2
R3
R3
R3
R3
R3
R3
R3
R4
R4
R4
R4
R4
R4
R4
R5
R5
R5
R5
R5
R5
R5
R6
R6
R6
R6
R6
R6
R6
R7
R7
R7
R7
R7
R7
R7
R8
R8
R8
R8
R8
R8
R8_FIQ
R9
R9
R9
R9
R9
R9
R9_FIQ
R10
R10
R10
R10
R10
R10
R10_FIQ
R11
R11
R11
R11
R11
R11
R11_FIQ
R12
R12
R12
R12
R12
R12
R12_FIQ
R13
R13_MON
R13_SVC
R13_ABT
R13_UND
R13_IRQ
R13_FIQ
R14
R14_MON
R14_SVC
R14_ABT
R14_UND
R14_IRQ
R14_FIQ
PC
PC
PC
PC
PC
PC
PC
CPSR
CPSR
CPSR
CPSR
CPSR
CPSR
CPSR
SPSR_MON
SPSR_SVC
SPSR_ABT
SPSR_UND
SPSR_IRQ
SPSR_FIQ
The core contains one CPSR, and six SPSRs for exception handlers to use. The program status registers:
Figure 10-2.
N Z C V Q
44
24 23
2019
IT
J Reserved
[1:0]
16 15
GE[3:0]
10 9 8 7 6 5 4
IT[7:2]
E A I F T
N: Negative, Z: Zero, C: Carry, and V: Overflow are the four ALU flags
IT: If-Then execution state bits for the Thumb IT (If-Then) instruction
Mode
E: Endianness execution state bit. Controls the load and store endianness for data accesses. This bit is
ignored by instruction fetches.
T: Thumb execution state bit. This bit and the J execution state bit, bit [24], determine the instruction set state
of the processor, ARM, Thumb, Jazelle, or ThumbEE.
Mode: five bits to encode the current processor mode. The effect of setting M[4:0] to a reserved value is
UNPREDICTABLE.
Table 10-3.
M[4:0]
USR
10000
FIQ
10001
IRQ
10010
SVC
10011
MON
10110
ABT
10111
UND
11011
SYS
11111
Reserved
Other
Coprocessor 15, or System Control Coprocessor CP15, is used to configure and control all the items in the list
below:
Cortex A5
MMU
Security
To control these features, CP15 provides 16 additional registers. See Table 10-4.
Table 10-4.
Register
CP15 Registers
Name
Read/Write
(1)
ID Code
Cache type(1)
Read/Unpredictable
Control(1)
Read/Write
(1)
Read/Unpredictable
Security
Read/Write
Read/Write
Reserved
None
Read/Write
45
Table 10-4.
Register
Name
Read/Write
Read/Write
Read/Write
Fault Address
46
Read/Write
TLB operations
(1)
Read/Write
Unpredictable/Write
(1)
Cache lockdown
Read/Write
10
TLB lockdown
Read/Write
11
Reserved
None
12
Interrupts management
Read/Write
12
Monitor vectors
Read-only
13
Note:
FCSE PID
(1)
Read/Write
(1)
Read/Write
13
Context ID
14
Reserved
None
15
Test configuration
Read/Write
1. This register provides access to more than one register. The register accessed depends on the value of the CRm
field or Opcode_2 field.
30
29
28
27
1
26
1
22
opcode_1
21
20
L
19
18
14
13
12
11
1
10
1
4
1
cond
23
15
Rd
7
6
opcode_2
25
1
24
0
17
16
9
1
8
1
CRn
CRm
47
If the protection check carried out by the MMU on the VA does not abort and the PA tag is in the instruction
cache, the instruction data is returned to the processor.
4.
If there is a cache miss, the MMU passes the PA to the AXI bus interface to perform an external access. The
external access is always Non-secure when the core is in the Non-secure state. In the Secure state, the
external access is Secure or Non-secure according to the NS attribute value in the selected translation table
entry. In Secure state, both L1 and L2 translation table walk accesses are marked as Secure, even if the first
level descriptor is marked as NS.
CAUTION: The Security Extensions enable the construction of an isolated software environment for more secure
execution, depending on a suitable system design around the processor. The technology does not protect the
processor from hardware attacks, and care must be taken to be sure that the hardware containing the reset
handling code is appropriately secure.
The processor always boots in the privileged Supervisor mode in the Secure state, with the NS bit set to 0. This
means that code that does not attempt to use the Security Extensions always runs in the Secure state. If the
software uses both Secure and Non-secure states, the less trusted software, such as a complex operating system
and application code running under that operating system, executes in Non-secure state, and the most trusted
software executes in the Secure state.
The following sequence is expected to be typical use of the Security Extensions:
1. Exit from reset in Secure state.
2. Configure the security state of memory and peripherals. Some memory and peripherals are accessible only
to the software running in Secure state.
3.
48
Initialize the secure operating system. The required operations depend on the operating system, and include
initialization of caches, MMU, exception vectors, and stacks.
4.
Initialize Secure Monitor software to handle exceptions that switch execution between the Secure and Nonsecure operating systems.
5.
Optionally lock aspects of the secure state environment against further configuration.
6.
Pass control through the Secure Monitor software to the non-secure OS with an SMC instruction.
7.
Enable the Non-secure operating system to initialize. The required operations depend on the operating
system, and typically include initialization of caches, MMU, exception vectors, and stacks.
The overall security of the secure software depends on the system design, and on the secure software itself.
10.4.7 TrustZone
10.4.7.1 Hardware
TrustZone enables a single physical processor core to execute code safely and efficiently from both the Normal
world and the Secure world. This removes the need for a dedicated security processor core, saving silicon area
and power, and allowing high performance security software to run alongside the Normal world operating
environment.
The two virtual processors context switch via a new processor mode called monitor mode when changing the
currently running virtual processor.
Figure 10-3.
10.4.7.2 Software
The mechanisms by which the physical processor can enter monitor mode from the Normal world are tightly
controlled, and are all viewed as exceptions to the monitor mode software. Software executing a dedicated
instruction can trigger entry to monitor, the Secure Monitor Call (SMC) instruction, or by a subset of the hardware
exception mechanisms. Configuration of the IRQ, FIQ, external Data Abort, and external Prefetch Abort
exceptions can cause the processor to switch into monitor mode.
The software that executes within monitor mode is implementation defined, but it generally saves the state of the
current world and restores the state of the world at the location to which it switches. It then performs a return-fromexception to restart processing in the restored world.
49
Figure 10-4.
10.4.7.3 Debug
TrustZone hardware architecture is a security-aware debug infrastructure that can enable control over access to
secure world debug, without impairing debug visibility of the Normal world. This is controlled with bits in the Secure
Fuse Controller.
Note:
10.5
Secure debug modes are described in the document Secure Box Module (SBM). This document is available under
Non-Disclosure Agreement (NDA). Contact an Atmel Sales Representative for further details.
50
16 Mbyte supersections. The processor supports supersections that consist of 16 Mbyte blocks of
memory.
1 Mbyte sections
16 access domains
Global and application-specific identifiers to remove the requirement for context switch TLB flushes.
TLB maintenance and configuration operations are controlled through a dedicated coprocessor, CP15, integrated
with the core. This coprocessor provides a standard mechanism for configuring the L1 memory system.
See the ARM Architecture Reference Manual, ARMv7-A and ARMv7-R edition for a full architectural description of
the ARMv7 VMSA.
10.5.2 Memory Management System
The Cortex-A5 processor supports the ARM v7 VMSA including the TrustZone security extension. The translation
of a Virtual Address (VA) used by the instruction set architecture to a Physical Address (PA) used in the memory
system and the management of the associated attributes and permissions is carried out using a two-level MMU.
The first level MMU uses a Harvard design with separate micro TLB structures in the PFU for instruction fetches
(IuTLB) and in the DPU for data read and write requests (DuTLB).
A miss in the micro TLB results in a request to the main unified TLB shared between the data and instruction sides
of the memory system. The TLB consists of a 128-entry two-way set-associative RAM based structure. The TLB
page-walk mechanism supports page descriptors held in the L1 data cache. The caching of page descriptors is
configured globally for each translation table base register, TTBRx, in the system coprocessor, CP15.
The TLB contains a hitmap cache of the page types which have already been stored in the TLB.
10.5.2.1 Memory types
Although various different memory types can be specified in the page tables, the Cortex-A5 processor does not
implement all possible combinations:
Write-through caches are not supported. Any memory marked as write-through is treated as Non-cacheable.
The outer shareable attribute is not supported. Anything marked as outer shareable is treated in the same
way as inner shareable.
Table 10-5 shows the treatment of each different memory type in the Cortex-A5 processor in addition to the
architectural requirements.
51
Table 10-5.
Shareability
Other Attributes
Notes
Non-shareable
Shareable
Non-cacheable
Write-through cacheable
Treated as non-cacheable
Write-back cacheable,
write allocate
Write-back cacheable,
no write allocate
Non-cacheable
Write-through cacheable
Write-back cacheable,
write allocate
Strongly Ordered
Device
Non-shareable
Inner
shareable
Normal
Write-back cacheable,
no write allocate
Non-cacheable
Write-through cacheable
Outer
shareable
Write-back cacheable,
write allocate
Write-back cacheable,
no write allocate
Micro TLB
Main TLB
The first level of caching for the page table information is a micro TLB of 10 entries that is implemented on each of
the instruction and data sides. These blocks provide a lookup of the virtual addresses in a single cycle.
The micro TLB returns the physical address to the cache for the address comparison, and also checks the access
permissions to signal either a Prefetch Abort or a Data Abort.
All main TLB related maintenance operations affect both the instruction and data micro TLBs, causing them to be
flushed. In the same way, any change of the following registers causes the micro TLBs to be flushed:
52
Misses from the instruction and data micro TLBs are handled by a unified main TLB. Accesses to the main TLB
take a variable number of cycles, according to competing requests from each of the micro TLBs and other
implementation-dependent factors.
The main TLB is 128-entry two-way set-associative.
TLB match process
Each TLB entry contains a virtual address, a page size, a physical address, and a set of memory properties. Each
is marked as being associated with a particular application space (ASID), or as global for all application spaces.
The CONTEXTIDR determines the currently selected application space.
A TLB entry matches when these conditions are true:
Its Non-secure TLB ID (NSTID) matches the Secure or Non-secure state of the MMU request.
The operating system must ensure that, at most, one TLB entry matches at any time. The TLB can store entries
based on the following block sizes:
Supersections
Sections
Large pages
Small pages
Supersections, sections and large pages are supported to permit mapping of a large region of memory while using
only a single entry in the TLB. If no mapping for an address is found within the TLB, then the translation table is
automatically read by hardware and a mapping is placed in the TLB.
10.5.4 Memory Access Sequence
When the processor generates a memory access, the MMU:
1. Performs a lookup for the requested virtual address and current ASID and security state in the relevant instruction
or data micro TLB.
2. If there is a miss in the micro TLB, performs a lookup for the requested virtual address and current ASID and
security state in the main TLB.
3.
The MMU can be configured to perform hardware translation table walks in cacheable regions by setting the IRGN
bits in Translation Table Base Register 0 and Translation Table Base Register 1. If the encoding of the IRGN bits
is write-back, an L1 data cache lookup is performed and data is read from the data cache. If the encoding of the
IRGN bits is write-through or non-cacheable, an access to external memory is performed. For more information
refer to: Cortex-A5 Technical Reference Manual.
The MMU might not find a global mapping, or a mapping for the currently selected ASID, with a matching Nonsecure TLB ID (NSTID) for the virtual address in the TLB. In this case, the hardware does a translation table walk
if the translation table walk is enabled by the PD0 or PD1 bit in the Translation Table Base Control Register. If
translation table walks are disabled, the processor returns a Section Translation fault. For more information refer
to: Cortex-A5 Technical Reference Manual.
If the TLB finds a matching entry, it uses the information in the entry as follows:
1. The access permission bits and the domain determine if the access is enabled. If the matching entry does not
pass the permission checks, the MMU signals a memory abort. See the ARM Architecture Reference Manual,
53
ARMv7-A and ARMv7-R edition for a description of access permission bits, abort types and priorities, and for a
description of the Instruction Fault Status Register (IFSR) and Data Fault Status Register (DFSR).
2.
The memory region attributes specified in both the TLB entry and the CP15 c10 remap registers determine if
the access is
Secure or Non-secure
Shared or not
For more information refer to: Cortex-A5 Technical Reference Manual, Memory region remap.
3.
The TLB translates the virtual address to a physical address for the memory access.
Externally generated errors during a data write can be asynchronous. This means that the r14_abt on entry into
the abort handler on such an abort might not hold the address of the instruction that caused the exception.
The DFAR is Unpredictable when an asynchronous abort occurs.
Externally generated errors during data read are always synchronous. The address captured in the DFAR matches
the address which generated the external abort.
10.5.6.2 Synchronous and Asynchronous Aborts
Chapter 4, System Control in the Cortex-A5 Technical Reference Manual describes synchronous and
asynchronous aborts, their priorities, and the IFSR and DFSR. To determine a fault type, read the DFSR for a data
abort or the IFSR for an instruction abort.
The processor supports an Auxiliary Fault Status Register for software compatibility reasons only. The processor
does not modify this register because of any generated abort.
10.5.7 MMU Software Accessible Registers
The system control coprocessor registers, CP15, in conjunction with page table descriptors stored in memory,
control the MMU.
Access all the registers with instructions of the form:
MRC p15, 0, <Rd>, <CRn>, <CRm>, <Opcode_2>
MCR p15, 0, <Rd>, <CRn>, <CRm>, <Opcode_2>
CRn is the system control coprocessor register. Unless specified otherwise, CRm and Opcode_2 Should Be Zero.
54
11.
11.1
Description
The device 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 downloading
code and single-stepping through programs.
A 2-pin debug port Serial Wire Debug (SWD). SWD replaces the 5-pin JTAG port and provides an easy and risk
free alternative to JTAG as the two signals SWDIO and SWCLK are overlaid on the TMS and TCK pins, allowing
for bi-modal devices that provide the other JTAG signals. These extra JTAG pins can be switched to other uses
when in SWD mode.
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
Communication Channel.
A set of dedicated debug and test input/output pins gives direct access to these capabilities from a PC-based test
environment.
11.2
Embedded Characteristics
Two Independent Registers: Debug Control Register and Debug Status Register
Debug Unit
Two-pin UART
Chip ID Register
55
11.3
Block Diagram
Figure 11-1.
NTRST
SWD/ICE/JTAG
SELECT
Boundary
Port
JTAGSEL
TDO
SWD
DEBUG PORT
ICE/JTAG
DEBUG PORT
POR
Reset
and
Test
TST
Cortex-A5
DBGU
PIO
DTXD
DMA
DRXD
56
11.4
Application Examples
Host Debugger PC
ICE/JTAG
Interface
ICE/JTAG
Connector
SAM device
RS232
Connector
Terminal
57
Test Adaptor
JTAG
Interface
ICE/JTAG
Chip n
SAM device
Chip 2
Chip 1
58
Tester
11.5
Type
Active Level
Reset/Test
NRST
Microcontroller Reset
Input
Low
TST
Input
High
Low
Input
TCK
Test Clock
Input
TDI
Test Data In
Input
TDO
TMS
Input
JTAGSEL
JTAG Selection
Input
Output
SWD
SWCLK
SWDIO
Serial Debug IO
Input
Input/Output
Debug Unit
DRXD
Input
DTXD
Output
59
11.6
Functional Description
60
If the secure ROM code finds a bootable program, it automatically disables ROM access and enables the JTAG
connection just before launching the program.
The procedure to enable JTAG access is as follows:
Connect your computer to the board with JTAG and USB (J20 USB-A)
Open a terminal console (TeraTerm or HyperTerminal, etc.) on your computer and connect to the USB CDC
Serial COM port related to the J20 connector on the board
Send the '#' character. You will see then the prompt '>' character sent by the device (indicating that the
Standard SAM-BA Monitor is running)
Use the Standard SAM-BA Monitor to connect to the chip with JTAG
Note that you don't need to follow this sequence in order to connect the Standard SAM-BA Monitor with USB.
11.6.5 Debug Unit
The Debug Unit provides a two-pin (DXRD and TXRD) USART that can be used for several debug and trace
purposes and offers an ideal means for in-situ programming solutions and debug monitor communication.
Moreover, the association with two peripheral data controller channels permits packet handling of these tasks with
processor time reduced to a minimum.
The Debug Unit also manages the interrupt handling of the COMMTX and COMMRX signals that come from the
ICE and that trace the activity of the Debug Communication Channel.The Debug Unit allows blockage of access to
the system through the ICE interface.
A specific register, the Debug Unit Chip ID Register, gives information about the product version and its internal
configuration.
For further details on the Debug Unit, see the Debug Unit section.
11.6.6 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 performed after
JTAGSEL is changed.
A Boundary-scan Descriptor Language (BSDL) file is provided to set up test.
61
11.7
Access:
Read-only
31
30
29
28
27
VERSION
23
22
26
25
24
PART NUMBER
21
20
19
18
17
16
10
PART NUMBER
15
14
13
12
11
PART NUMBER
7
MANUFACTURER IDENTITY
MANUFACTURER IDENTITY
MANUFACTURER IDENTITY[11:1]
Set to 0x01F.
Bit[0] required by IEEE Std. 1149.1.
Set to 0x1.
JTAG ID Code value is 0x05B3903F.
62
11.8
Read-only
31
30
29
28
27
VERSION
23
22
26
25
24
PART NUMBER
21
20
19
18
17
16
10
PART NUMBER
15
14
13
12
11
PART NUMBER
7
DESIGNER
DESIGNER
63
Read-only
31
30
29
28
27
VERSION
23
22
26
25
24
PART NUMBER
21
20
19
18
17
16
10
PART NUMBER
15
14
13
12
11
PART NUMBER
7
DESIGNER
DESIGNER
64
12.
12.1
Description
The System Controller embeds a Boot Sequence Controller (BSC). The boot sequence is programmable through
the Boot Sequence Configuration Register (BSC_CR) to save timeout delays on boot.
The BSC_CR is powered by VDDBU. Any modification of the register value is stored and applied after the next
reset. The register defaults to the factory value in case of battery removal.
The BSC_CR is programmable with user programs or SAM-BA and is key-protected.
12.2
Embedded Characteristics
12.3
Product Dependencies
Product-dependent order
65
12.4
Table 12-1.
Offset
0x0
66
Register Mapping
Register
Name
BSC_CR
Access
Reset
Read/Write
BSC_CR
Access:
Read/Write
30
29
28
27
26
25
24
19
18
17
16
11
10
WPKEY
23
22
21
20
WPKEY
15
14
13
12
4
BOOT
Name
0x6683
PASSWD
Description
Writing any other value in this field aborts the write operation of the BOOT field.
Always reads as 0.
67
13.
13.1
Description
The system always boots from the ROM memory at address 0x0.
The ROM code is a boot program contained in the embedded ROM. It is also called First level bootloader.
This microcontroller can be configured to run a Standard Boot mode or a Secure Boot mode. More information on
how the Secure Boot mode can be enabled, and how the chip operates in this mode, is provided in the application
note SAMA5D4x Secure Boot Strategy, Atmel literature No. 11295. To obtain this application note and additional
information about the secure boot and related tools, contact an Atmel Sales Representative for further details.
By default, the chip starts in Standard Boot Mode.
Note:
JTAG access is disabled during the execution of ROM Code Sequence. It is re-enabled when jumping into SRAM
when a valid code has been found on an external NVM, in the same time the ROM memory is hidden. If no valid boot
has been found on an external NVM, the ROM Code enables the USB connection and the DBGU serial port, and then
waits for a special command to set the chip in Secure mode. If any other character is received on any of the two
connection link above, the ROM code starts the standard SAM-BA monitor, locks access to the ROM memory and reenables the JTAG connection.
68
Crystal or external clock frequency detection to get the clock accuracy required for USB connection
Execution of a monitor called SAM-BA Monitor, in case no valid application has been found on any NVM
13.2
Flow Diagram
The ROM Code implements the algorithm shown in Figure 13-1.
Figure 13-1.
Yes
No
SAM-BA Monitor
13.3
Chip Setup
At boot start-up, the processor clock (PCK) and the master clock (MCK) source is the 12 MHz fast RC oscillator.
Initialization follows the steps described below:
1. Stack Setup for ARM supervisor mode
2. Main Clock Selection: The Master Clock source is switched from the Slow Clock to the Main Oscillator
without prescaler. The PMC Status Register is polled to wait for MCK Ready. PCK and MCK are now the
Main Clock.
3.
C Variable Initialization: Non zero-initialized data is initialized in the RAM (copy from ROM to RAM). Zeroinitialized data is set to 0 in the RAM.
4.
PLLA Initialization: PLLA is configured to get a PCK at 96 MHz and an MCK at 48 MHz.
69
13.4
NVM Boot
BOOT Value
SPI0 NPCS0
SD Card/eMMC
(MCI0)
SD Card/eMMC
(MCI1)
8-bit NAND
Flash
SPI0 NPCS1
SAM-BA
Monitor
70
Figure 13-2.
Yes
Copy from
SPI Flash to SRAM
Run
Yes
Copy from
SD Card to SRAM
Run
SD Card Bootloader
Yes
Copy from
NAND Flash to SRAM
Run
Yes
Copy from
SPI Flash to SRAM
Run
No
SD Card Boot
No
No
No
SAM-BA
Monitor
71
Initialize NVM
Initialization OK?
No
Yes
Valid code detection in NVM
No
Yes
Copy the valid code
from external NVM to internal SRAM.
End
72
The NVM bootloader program first initializes the PIOs related to the NVM device. Then it configures the right
peripheral depending on the NVM and tries to access this memory. If the initialization fails, it restores the reset
values for the PIO and the peripheral, and then tries to fulfill the same operations on the next NVM of the
sequence.
If the initialization is successful, the NVM bootloader program reads the beginning of the NVM and determines if
the NVM contains a valid code.
If the NVM does not contain a valid code, the NVM bootloader program restores the reset value for the peripherals
and then tries to fulfill the same operations on the next NVM of the sequence.
If a valid code is found, this code is loaded from the NVM into the internal SRAM and executed by branching at
address 0x0000_0000 after remap. This code may be the application code or a second-level bootloader. All the
calls to functions are PC relative and do not use absolute addresses.
Figure 13-4.
0x0000_0000
Internal
ROM
Internal
SRAM
REMAP
0x0020_0000
0x0020_0000
Internal
SRAM
Internal
SRAM
The NVM bootloader program reads and analyzes the first 28 bytes corresponding to the first seven ARM
exception vectors. Except for the sixth vector, these bytes must implement the ARM instructions for either branch
or load PC with PC relative addressing.
Figure 13-5.
LDR Opcode
31
1
Figure 13-6.
28 27
1
24 23
1
20 19
1
16 15
Rn
12 11
Rd
0
Offset
B Opcode
31
1
28 27
1
24 23
0
0
Offset (24 bits)
73
Rn = Rd = PC = 0xF
P==1 (pre-indexed)
W==1
The sixth vector, at the offset 0x14, contains the size of the image to download. The user must replace this vector
with the users own vector. This procedure is described below.
Figure 13-7.
31
0
Size of the code to download in bytes
ea000006
eafffffe
ea00002f
eafffffe
eafffffe
00001234
eafffffe
B
B
B
B
B
B
B
0x20
0x04
_main
0x0c
0x10
0x14 Code size = 4660 bytes
0x18
This method is the one used on FAT formatted SD Card and eMMC. The boot program must be a file named
boot.bin written in the root directory of the file system. Its size must not exceed the maximum size allowed:
64 Kbytes (0x10000).
13.4.4 Detailed Memory Boot Procedures
13.4.4.1 NAND Flash Boot: NAND Flash Detection
After the NAND Flash interface configuration, a reset command is sent to the memory.
Hardware ECC detection and correction are provided by the PMECC peripheral. Refer to the PMECC Controller
Functional Description section of this datasheet for more details.
The Boot Program is able to retrieve NAND Flash parameters and ECC requirements using two methods as
follows:
The detection of a specific header written at the beginning of the first page of the NAND Flash,
or
However, it is highly recommended to use the NAND Flash Header method (first bullet above) since it indicates
exactly how the PMECC has been configured to write the bootable program in the NAND Flash, and not to rely
only on the NAND Flash capabilities.
Note:
74
Booting on 16-bit NAND Flash is not possible; only 8-bit NAND Flash memories are supported.
Figure 13-8.
No
First page contains valid header
Yes
No
Yes
End
75
30
29
28
23
22
27
26
key
21
20
19
25
18
17
eccOffset
15
14
13
12
11
10
nbSectorPerPage
Booting on 16-bit NAND Flash is not possible; only 8-bit NAND Flash memories are supported.
76
spareSize
spareSize
Note:
16
sectorSize
eccBitReq
7
24
eccOffset
usePmecc
ECC sector size: by default, set to 512 bytes; or to 1024 bytes if the ECC bit capability above is 0xFF
By default, the ONFI NAND Flash detection will turn ON the usePmecc parameter, and the ECC correction
algorithm is automatically activated.
Once the Boot Program retrieves the parameter, using one of the two methods described above, it reads the first
page again, with or without ECC, depending on the usePmecc parameter. Then it looks for a valid code
programmed just after the header offset 0xD0. If the code is valid, the program is copied at the beginning of the
internal SRAM.
Note:
Booting on 16-bit NAND Flash is not possible; only 8-bit NAND Flash memories are supported.
NAND Flash boot procedure uses PMECC to detect and correct errors during NAND Flash read operations in two
cases:
When the NAND Flash has been detected using ONFI parameters.
The ROM memory embeds the Galois field tables. The user does not need to embed them in his own software.
The Galois field tables are mapped in the ROM just after the ROM code, as described in Figure 13-9.
Figure 13-9.
ROM Code
Code
ROM
0x0000_8000
0x0000_8000
0x0001_0000
0x0001_0000
Galois field
field
Galois
tables for
for
tables
512-byte
512-byte
sectors
sectors
correction
correction
Galois field
field
Galois
tables for
for
tables
1024-byte
1024-byte
sectors
sectors
correction
correction
For a full description and an example of how to use the PMECC detection and correction feature, refer to the
software package dedicated to this device on Atmels web site.
77
The SD Card / eMMC bootloader looks for a boot.bin file in the root directory of a FAT12/16/32 file system.
Supported SD Card Devices
SD Card Boot supports all SD Card memories compliant with the SD Memory Card Specification V2.0. This
includes SDHC cards.
13.4.4.4 SPI Flash Boot
Two types of SPI Flash are supported: SPI Serial Flash and SPI DataFlash.
The SPI Flash bootloader tries to boot on SPI0, first looking for SPI Serial Flash, and then for SPI DataFlash.
It uses only one valid code detection: analysis of ARM exception vectors.
The SPI Flash read is done by means of a Continuous Read command from the address 0x0. This command is
0xE8 for DataFlash and 0x0B for Serial Flash devices.
Supported DataFlash Devices
The SPI Flash Boot program supports all Atmel DataFlash devices.
Table 13-2.
DataFlash Device
Device
Density
Number of Pages
AT45DB011
1 Mbit
264
512
AT45DB021
2 Mbits
264
1024
AT45DB041
4 Mbits
264
2048
AT45DB081
8 Mbits
264
4096
AT45DB161
16 Mbits
528
4096
AT45DB321
32 Mbits
528
8192
AT45DB642
64 Mbits
1056
8192
78
Table 13-3.
NVM Bootloader
NAND
SD Card / eMMC
SPI Flash
SAM-BA Monitor
Peripheral
Pin
PIO Line
NANDOE
PIOC13
NANDWE
PIOC14
NANDCS
PIOC15
NAND ALE
PIOC17
NAND CLE
PIOC18
Cmd/Addr/Data
MCI0
MCI0_CK
PIOC4
MCI0
MCI0_CDA
PIOC5
MCI0
MCI0_D0
PIOC6
MCI0
MCI0_D1
PIOC7
MCI0
MCI0_D2
PIOC8
MCI0
MCI0_D3
PIOC9
MCI1
MCI1_CK
PIOE18
MCI1
MCI1_CDA
PIOE19
MCI1
MCI1_D0
PIOE20
MCI1
MCI1_D1
PIOE21
MCI1
MCI1_D2
PIOE22
MCI1
MCI1_D3
PIOE23
SPI0
MOSI
PIOC1
SPI0
MISO
PIOC0
SPI0
SPCK
PIOC2
SPI0
NPCS0
PIOC3
SPI0
NPCS1
PIOC4
DBGU
DRXD
PIOE16
DBGU
DTXD
PIOE17
PIOC5PIOC12
79
13.5
SAM-BA Monitor
If no valid code is found in the NVM during the NVM bootloader sequence.
The Main Clock is switched to the 32 kHz RC oscillator to allow external clock frequency to be measured.
The Main Oscillator is enabled and set in the bypass mode. If the MOSCSELS bit rises, an external clock is
connected. If not, the bypass mode is cleared to attempt external quartz detection. This detection is successful
when the MOSCXTS and MOSCSELS bits rise, else the internal 12 MHz fast RC oscillator is used as the Main
Clock.
If an external clock or crystal frequency running at 12 MHz is found, then the PLLA is configured to allow
communication on the USB link for the SAM-BA Monitor else the Main Clock is switched to the internal 12 MHz
fast RC oscillator, but USB will not be activated.
The SAM-BA Monitor steps are:
Once the communication interface is identified, the application runs in an infinite loop waiting for different
commands as listed in Table 13-4.
Figure 13-10. SAM-BA Monitor Diagram
No valid code in NVM
External clock
detection
USB Enumeration
Successful?
Yes
Run monitor
Wait for command
on the USB link
80
No
Character(s) received
on DBGU?
Yes
Run monitor
Wait for command
on the DBGU link
Command
Action
Argument(s)
Example
No argument
N#
No argument
T#
Write a byte
Address, Value#
O200001,CA#
Read a byte
Address,#
o200001,#
Address, Value#
H200002,CAFE#
Address,#
h200002,#
Write a word
Address, Value#
W200000,CAFEDECA#
Read a word
Address,#
w200000,#
Send a file
Address,#
S200000,#
Receive a file
Address, NbOfBytes#
R200000,1234#
Go
Address#
G200200#
Display version
No argument
V#
Mode commands:
Normal mode configures SAM-BA Monitor to send / receive data in binary format,
Write commands: Write a byte (O), a halfword (H) or a word (W) to the target
Output: >
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
Read commands: Read a byte (o), a halfword (h) or a word (w) from the target
Note:
Terminal mode configures SAM-BA Monitor to send / receive data in ASCII format.
Output: >
Output: > once returned from the program execution. If the executed program does not handle the
link register at its entry and does not return, the prompt will not be displayed
81
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 in order to work.
The Xmodem protocol supported is the 128-byte length block. This protocol uses a two-character CRC16 to
guarantee detection of maximum bit errors.
Xmodem protocol with CRC is supported by successful transmission reports provided both by a sender and by
a receiver. Each transfer block is as follows:
<SOH><blk #><255-blk #><--128 data bytes--><checksum> in which:
<SOH> = 01 hex
<blk #> = binary number, starts at 01, increments by 1, and wraps 0FFH to 00H (not to 01)
Device
C
SOH 01 FE Data[128] CRC CRC
ACK
SOH 02 FD Data[128] CRC CRC
ACK
SOH 03 FC Data[100] CRC CRC
ACK
EOT
ACK
The SAM-BA Monitor only supports a frequency of 12 MHz to allow USB communication for both external crystal
and external clock.
13.5.3.2 USB Class
The device uses the USB Communication Device Class (CDC) drivers to take advantage of the installed PC Serial
Communication software to talk over the USB. The CDC is implemented in all releases of Windows , from
82
Windows 98SE to Windows 7. The CDC document, available at www.usb.org, describes how to implement
devices such as ISDN modems and virtual COM ports.
The Vendor ID is the Atmels 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, INF files contain the correspondence between
vendor ID and product ID.
13.5.3.3 Enumeration Process
The USB protocol is a master/slave protocol. The host starts the enumeration, sending requests to the device
through the control endpoint. The device handles standard requests as defined in the USB Specification.
Table 13-5.
Request
Definition
GET_DESCRIPTOR
SET_ADDRESS
SET_CONFIGURATION
GET_CONFIGURATION
GET_STATUS
SET_FEATURE
CLEAR_FEATURE
The device also handles some class requests defined in the CDC class.
Table 13-6.
Request
Definition
SET_LINE_CODING
Configures DTE rate, stop bits, parity and number of character bits
GET_LINE_CODING
Requests current DTE rate, stop bits, parity and number of character bits
SET_CONTROL_LINE_STATE
RS-232 signal used to indicate to the DCE device that the DTE device is now present
13.6
MSK field (write-once) allows user to mask registers SR0SR8 (bits from 0 to 287)
All OTP bits are read as 1 when VDDFUSE is floating, all security features are set
83
13.6.3 Description
The access in read/write to the fuse bits requires that the internal 12 MHz RC oscillator is enabled.
bit 511 is JTAG control.
JTAGDIS = 0: JTAG is enabled, 1: JTAG is disabled
bit 510 is Secure Debug Control.
SECDBG = 0: Full Debug, 1: Non-Secure Debug Only
Table 13-7.
[511:480]
OTP Mapping
JTAGDIS
SECDBG
[479:448]
[447:416]
[415:384]
[383:352]
[351:320]
[319:288]
[287:256]
[255:224]
[223:192]
[191:160]
[159:128]
[127:96]
[95:64]
[63:32]
[31:0]
84
USER_CONFIG[479:0]
USER_CONFIG[509:480]
14.
14.1
Description
The L2 Cache Controller (L2CC) is based on the L2CC-PL310 ARM multi-way cache macrocell, version r3p2. The
addition of an on-chip secondary cache, also referred to as a Level 2 or L2 cache, is a method of improving the
system performance when significant memory traffic is generated by the processor.
14.2
14.3
Embedded Characteristics
Product Dependencies
14.4
Functional Description
The addition of an on-chip secondary cache, also referred to as a Level 2 or L2 cache, is a recognized method of
improving the performance of ARM-based systems when significant memory traffic is generated by the processor.
By definition a secondary cache assumes the presence of a Level 1 or primary cache, closely coupled or internal
to the processor. Memory access is fastest to L1 cache, followed closely by L2 cache. Memory access is typically
significantly slower with L3 main memory.
The cache controller is a unified, physically addressed, physically tagged cache with up to 8 ways. User can lock
the replacement algorithm on a way basis, enabling the associativity to be reduced from 8-way down to 1-way
(directly mapped).
The cache controller does not have snooping hardware to maintain coherency between caches, so the user has to
maintain coherency by software.
85
The user can control this feature using the DLEN, DLFWRDIS and DLEN bits of L2CC Prefetch Control Register
. The IDLEN and DLFWRDIS bits are only used if you set the DLEN bit HIGH. Table 14-1 shows the behavior of
the L2CC master ports, depending on the configuration chosen by the user.
Table 14-1.
Bit 30
DLEN
Bit 23
IDLEN
Original
Read Address
from L1
Read
Address
to L3
AXI Burst
Type
AXI Burst
Length
Targeted
Cache
Lines
0 or 1
0 or 1
0x00
0x00
WRAP
0x3, 4x64-bit
0x00
0 or 1
0 or 1
0x20
0x20
WRAP
0x3, 4x64-bit
0x20
0 or 1
0x00
0x00
WRAP
0x7, 8x64-bit
0x08
WRAP
0x3, 4x64-bit
0x00
0x00
WRAP
0x7, 8x64-bit
0 or 1
0x20
WRAP
0x7, 8x64-bit
0x28
WRAP
0x3, 4x64-bit
0x20
0x20
WRAP
0x7, 8x64-bit
0 or 1
0x00
INCR or WRAP
0x7, 8x64-bit
0x08
WRAP
0x3, 4x64-bit
0x00
0x00
INCR or WRAP
0x7, 8x64-bit
0 or 1
0x20
INCR
0x7, 8x64-bit
0x28
WRAP
0x3, 4x64-bit
0x20
0x20
INCR
0x7, 8x64-bit
Notes:
86
1.
2.
3.
0x08 or 0x10
or 0x18
0x20
0x28 or 0x30
or 0x38
0x28 or 0x30
or 0x38
0x00
0x08 or 0x10
or 0x18
0x08 or 0x10
or 0x18
0x20
0x28 or 0x30
or 0x38
0x28 or 0x30
or 0x38
Double linefills are not issued for prefetch reads if you enable exclusive cache configuration.
Double linefills are not launched when crossing a 4 Kbyte boundary.
Double linefills only occur if a WRAP4 or an INCR4 64-bit transaction is received on the slave ports. This
transaction is most commonly seen as a result of a cache linefill in a master, but can be produced by a master
when accessing memory marked as inner non-cacheable.
14.5
Table 14-2.
Register Mapping
Offset
Register
Name
0x000
Cache ID Register
0x004
0x100
Control Register
Access
Reset
L2CC_IDR
Read-only
0x4100_00C8
L2CC_TYPR
Read-only
L2CC_CR
0x0010_0100
Read-write, Read-only
(1)
0x0000_0000
(1)
0x0202_0000
0x104
L2CC_ACR
Read-write, Read-only
0x108
L2CC_TRCR
Read-write, Read-only(1)
0x0000_0000
L2CC_DRCR
(1)
0x0000_0000
0x10C
0x110-0x1FC
Reserved
0x200
0x204
L2CC_ECR
Read-write
0x0000_0000
L2CC_ECFGR1
Read-write
0x0202_0000
0x208
L2CC_ECFGR0
Read-write
0x0000_0000
0x20C
L2CC_EVR1
Read-write
0x0000_0000
0x210
L2CC_EVR0
Read-write
0x0000_0000
0x214
L2CC_IMR
Programmable(2)
0x0000_0000
0x218
L2CC_MISR
Read-only
0x0000_0000
0x21C
L2CC_RISR
Read-only
0x220
0x224-0x72C
Reserved
0x730
0x734-0x76C
Reserved
0x770
0x774-778
Reserved
0x77C
0x780-7AF
Reserved
0x7B0
0x7B4
Reserved
0x7B8
0x7BC
0x7C0-7EC
Reserved
0x7F0
0x7F4
Reserved
0x7F8
0x7FC
0x800-8FC
Reserved
0x900
0x904
Read-write, Read-only
L2CC_ICR
Programmable
0x0000_0000
(2)
0x0000_0000
Read-write
0x0000_0000
Read-write
0x0000_0000
Read-write
0x0000_0000
Read-write
0x0000_0000
L2CC_CIR
Read-write
0x0000_0000
L2CC_CWR
Read-write
0x0000_0000
Read-write
0x0000_0000
L2CC_CIIR
Read-write
0x0000_0000
L2CC_CIWR
Read-write
0x0000_0000
L2CC_CSR
L2CC_IPALR
L2CC_IWR
L2CC_CPALR
L2CC_CIPALR
L2CC_DLKR
L2CC_ILKR
Programmable(2)
0x0000_0000
(2)
0x0000_0000
Programmable
87
Table 14-2.
Offset
Register
0x908-F3C
Reserved
0xF40
0xF44-F5C
Reserved
0xF60
0xF64-F7C
Reserved
Name
Access
L2CC_DCR
L2CC_PCR
0xF80
Power Control Register
L2CC_POWCR
Notes: 1. Read-write in Secure Mode, Read-only in Non-Secure Mode.
2. Programmable in Auxiliary Control Register.
88
Reset
Read-write, Read-only
(1)
Read-write, Read-only
(1)
Read-write, Read-only
0x0000_0000
0x0000_0000
(1)
0x0000_0000
L2CC_IDR
Address:
0x00A00000
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ID
23
22
21
20
ID
15
14
13
12
ID
4
ID
89
L2CC_TYPR
Address:
0x00A00004
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
DL2WSIZE
20
19
18
DL2ASS
17
16
15
14
13
12
11
10
9
IL2WSIZE
6
IL2ASS
90
L2CC_CR
Address:
0x00A00100
Access:
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
0
L2CEN
91
L2CC_ACR
Address:
0x00A00104
Access:
31
30
29
IPEN
28
DPEN
27
NSIAC
26
NSLEN
25
CRPOL
24
FWA
23
FWA
22
SAOEN
21
PEN
20
EMBEN
19
18
WAYSIZE
17
16
ASS
15
14
13
SAIE
12
EXCC
11
SBDLE
10
HPSO
92
Name
Description
0x0
RESERVED
Reserved
0x1
16KB_WAY
0x2
RESERVED
Reserved
0x3
RESERVED
Reserved
0x4
RESERVED
Reserved
0x5
RESERVED
Reserved
0x6
RESERVED
Reserved
0x7
RESERVED
Reserved
93
94
L2CC_TRCR
Address:
0x00A00108
Access:
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
TWRLAT
5
TRDLAT
1
TSETLAT
95
L2CC_DRCR
Address:
0x00A0010C
Access:
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
DWRLAT
5
DRDLAT
1
DSETLAT
96
L2CC_ECR
Address:
0x00A00200
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
2
EVC1RST
1
EVC0RST
0
EVCEN
97
L2CC_ECFGR1
Address:
0x00A00204
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
ESRC
Name
Description
0x0
INT_DIS
Disables (default)
0x1
INT_EN_INCR
0x2
INT_EN_OVER
0x3
INT_GEN_DIS
98
Name
Description
0x0
CNT_DIS
Counter Disabled
0x1
SRC_CO
Source is CO
0x2
SRC_DRHIT
Source is DRHIT
0x3
SRC_DRREQ
Source is DRREQ
0x4
SRC_DWHIT
Source is DWHIT
0x5
SRC_DWREQ
Source is DWREQ
0x6
SRC_DWTREQ
Source is DWTREQ
0x7
SRC_IRHIT
Source is IRHIT
0x8
SRC_IRREQ
Source is IRREQ
0x9
SRC_WA
Source is WA
0xa
SRC_IPFALLOC
Source is IPFALLOC
0xb
SRC_EPFHIT
Source is EPFHIT
0xc
SRC_EPFALLOC
Source is EPFALLOC
0xd
SRC_SRRCVD
Source is SRRCVD
0xe
SRC_SRCONF
Source is SRCONF
0xf
SRC_EPFRCVD
Source is EPFRCVD
0
EIGEN
L2CC_ECFGR0
Address:
0x00A00208
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
ESRC
0
EIGEN
Name
Description
0x0
INT_DIS
Disables (default)
0x1
INT_EN_INCR
0x2
INT_EN_OVER
0x3
INT_GEN_DIS
Name
Description
0x0
CNT_DIS
Counter Disabled
0x1
SRC_CO
Source is CO
0x2
SRC_DRHIT
Source is DRHIT
0x3
SRC_DRREQ
Source is DRREQ
0x4
SRC_DWHIT
Source is DWHIT
0x5
SRC_DWREQ
Source is DWREQ
0x6
SRC_DWTREQ
Source is DWTREQ
0x7
SRC_IRHIT
Source is IRHIT
0x8
SRC_IRREQ
Source is IRREQ
0x9
SRC_WA
Source is WA
0xa
SRC_IPFALLOC
Source is IPFALLOC
0xb
SRC_EPFHIT
Source is EPFHIT
0xc
SRC_EPFALLOC
Source is EPFALLOC
0xd
SRC_SRRCVD
Source is SRRCVD
0xe
SRC_SRCONF
Source is SRCONF
0xf
SRC_EPFRCVD
Source is EPFRCVD
99
L2CC_EVR1
Address:
0x00A0020C
Access:
Read-write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
VALUE
23
22
21
20
VALUE
15
14
13
12
VALUE
4
VALUE
100
L2CC_EVR0
Address:
0x00A00210
Access:
Read-write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
VALUE
23
22
21
20
VALUE
15
14
13
12
VALUE
4
VALUE
101
L2CC_IMR
Address:
0x00A00214
Access:
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
8
DECERR
7
SLVERR
6
ERRRD
5
ERRRT
4
ERRWD
3
ERRWT
2
PARRD
1
PARRT
0
ECNTR
102
L2CC_MISR
Address:
0x00A00218
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
8
DECERR
7
SLVERR
6
ERRRD
5
ERRRT
4
ERRWD
3
ERRWT
2
PARRD
1
PARRT
0
ECNTR
103
L2CC_RISR
Address:
0x00A0021C
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
8
DECERR
7
SLVERR
6
ERRRD
5
ERRRT
4
ERRWD
3
ERRWT
2
PARRD
1
PARRT
0
ECNTR
104
L2CC_ICR
Address:
0x00A00220
Access:
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
8
DECERR
7
SLVERR
6
ERRRD
5
ERRRT
4
ERRWD
3
ERRWT
2
PARRD
1
PARRT
0
ECNTR
105
L2CC_CSR
Address:
0x00A00730
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
0
C
106
L2CC_IPALR
Address:
0x00A00770
Access:
Read-write
31
30
29
28
27
26
25
24
19
18
17
16
10
0
C
TAG
23
22
21
20
TAG
15
14
13
12
11
TAG
7
IDX
6
IDX
107
L2CC_IWR
Address:
0x00A0077C
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
7
WAY7
6
WAY6
5
WAY5
4
WAY4
3
WAY3
2
WAY2
1
WAY1
0
WAY0
108
L2CC_CPALR
Address:
0x00A007B0
Access:
Read-write
31
30
29
28
27
26
25
24
19
18
17
16
10
0
C
TAG
23
22
21
20
TAG
15
14
13
12
11
TAG
7
IDX
6
IDX
109
L2CC_CIR
Address:
0x00A007B8
Access:
Read-write
31
30
29
WAY
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
6
IDX
0
C
IDX
4
110
L2CC_CWR
Address:
0x00A007BC
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
7
WAY7
6
WAY6
5
WAY5
4
WAY4
3
WAY3
2
WAY2
1
WAY1
0
WAY0
111
L2CC_CIPALR
Address:
0x00A007F0
Access:
Read-write
31
30
29
28
27
26
25
24
19
18
17
16
10
0
C
TAG
23
22
21
20
TAG
15
14
13
12
11
TAG
7
IDX
6
IDX
112
L2CC_CIIR
Address:
0x00A007F8
Access:
Read-write
31
30
29
WAY
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
6
IDX
0
C
IDX
4
113
L2CC_CIWR
Address:
0x00A007FC
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
7
WAY7
6
WAY6
5
WAY5
4
WAY4
3
WAY3
2
WAY2
1
WAY1
0
WAY0
114
L2CC_DLKR
Address:
0x00A00900
Access:
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
7
DLK7
6
DLK6
5
DLK5
4
DLK4
3
DLK3
2
DLK2
1
DLK1
0
DLK0
115
L2CC_ILKR
Address:
0x00A00904
Access:
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
7
ILK7
6
ILK6
5
ILK5
4
ILK4
3
ILK3
2
ILK2
1
ILK1
0
ILK0
116
L2CC_DCR
Address:
0x00A00F40
Access:
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
2
SPNIDEN
1
DWB
0
DCL
117
L2CC_PCR
Address:
0x00A00F60
Access:
31
30
DLEN
29
INSPEN
28
DATPEN
27
DLFWRDIS
26
25
24
PDEN
23
IDLEN
22
21
NSIDEN
20
19
18
17
16
15
14
13
12
11
10
2
OFFSET
118
119
L2CC_POWCR
Address:
0x00A00F80
Access:
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
1
DCKGATEN
0
STBYEN
120
15.
15.1
Description
The AXI Matrix comprises the embedded Advanced Extensible Interface (AXI) bus protocol which supports
separate address/control and data phases, unaligned data transfers using byte strobes, burst-based transactions
with only start address issued, separate read and write data channels to enable low-cost DMA, ability to issue
multiple outstanding addresses, out-of-order transaction completion, and easy addition of register stages to
provide timing closure.
15.2
Embedded Characteristics
2 Masters:
15.3
Core
4 Slaves:
ROM
PKCC RAM
PKCC ROM
Single-cycle arbitration
1 remap state
Operation
15.3.1 Remap
Remap states are managed in the AXI Matrix Remap Register (AXIMX_REMAP): AXIMX_REMAP.REMAP0
(register bit 0) is used to remap RAM @ addr 0x00000000.
Refer to Section 15.4 AXI Matrix (AXIMX) User Interface.
The number of remap states can be defined using eight bits of the AXIMX_REMAP register, and a bit in
AXIMX_REMAP controls each remap state.
Each remap state can be used to control the address decoding for one or more slave interfaces. If a slave interface
is affected by two remap states that are both asserted, the remap state with the lowest remap bit number takes
precedence.
Each slave interface can be configured independently so that a remap state can perform different functions for
different masters.
A remap state can:
Because of the nature of the distributed register subsystem, the masters receive the updated remap bit states in
sequence, and not simultaneously.
121
A slave interface does not update to the latest remap bit setting until:
At powerup, ROM is seen at address 0. After powerup, the internal SRAM can be moved down to address 0 by
means of the remap bits.
122
15.4
Table 15-1.
Register Mapping
Offset
Register
Name
0x00
AXIMX_REMAP
0x040x43108
Reserved
Access
Reset
Write-only
0x00000000
0x00000000
123
AXIMX_REMAP
Address:
0x00700000
Access:
Read/Write
Reset:
0x00000000
31
30
29
28
27
26
25
24
19
18
17
16
11
10
0
REMAP0
23
22
21
20
15
14
13
12
124
16.
Matrix (H64MX/H32MX)
16.1
Description
In order to reduce power consumption without loss in performance, the system embeds three matrixes: one based
on AXI protocol (AXIMX) and two based on AHB protocol (H64MX and H32MX). The description of the 64-bit AHB
Matrix (H64MX) and the 32-bit AHB Matrix (H32MX) implementation follows.
Please refer to the product AXIMX description for the complete information of the AXI Matrix.
Each AHB Matrix implements a multi-layer AHB, based on the AHB-Lite protocol, which enables parallel access
paths between multiple AHB masters and slaves in a system, thus increasing the overall bandwidth. 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 the ARM Advanced
Peripheral Bus (APB).
Note:
16.2
When a master and a slave are on different bus matrixes (AXIMX, H64MX, or H32MX), both matrixes (H64MX and
H32MX) and the bridge between the bus matrixes must be configured accordingly.
Embedded Characteristics
Support for long bursts of 32, 64, 128 and up to the 256-beat word burst AHB limit
Round-robin
Fixed priority
No default master
Zero or one cycle arbitration latency for the first access of a burst
125
16.3
MATRIX0 (H64MX)
Master No.
0
Name
Bridge from AXI matrix (Core)
1, 2
DMA Controller 0
3, 4
DMA Controller 1
5, 6
LCDC DMA
ISI DMA
Description
TZ Access Management
Always Secured
Video Decoder
Programmable Secure(1)
Scalable Secure
DDR2 Port1
Scalable Secure
DDR2 Port2
Scalable Secure
DDR2 Port3
Scalable Secure
DDR2 Port4
Scalable Secure
DDR2 Port5
Scalable Secure
DDR2 Port6
Scalable Secure
10
DDR2 Port7
Scalable Secure
11
Internal Secure
12
Notes:
126
1.
Slave
Bridge
from
AXIMX
(Core)
XDMAC0
IF0
IF1
VDEC
DDR2 port1
DDR2 port2
DDR2 port3
DDR2 port4
DDR2 port5
DDR2 port6
10
DDR2 port7
11
Internal SRAM
12
VDEC
DMA
ISI
DMA
Bridge
from
H32MX
XDMAC1
IF0
IF1
LCDC DMA
X
X
X
X
X
X
X
127
16.4
MATRIX1 (H32MX)
Master No.
Name
UDPHS DMA
GMAC0 DMA
GMAC1 DMA
TZ Access Management
External Secure
Programmable Secure(1)
NFC SRAM
Programmable Secure(1)
Programmable Secure(1)
Programmable Secure(1)
These AHB slaves are programmed like APB slaves in the MATRIX_SPSELRx.
128
Table 16-6.
Slave
Core
IF0
IF1
ICM
UHPHS
EHCI
DMA
UHPHS
OHCI
DMA
UDPHS
DMA
GMAC
0 DMA
GMAC
1 DMA
XDMAC1
IF0
IF1
EBI CS0..CS3
NFC Command
Register
NFC SRAM
UDPHS RAM
SMD
129
16.5
Memory Mapping
The Bus Matrix provides one decoder for every AHB master interface. The decoder offers each AHB master
several memory mappings. Each memory area may be assigned to several slaves. Booting at the same address
while using different AHB slaves (i.e., external RAM, internal ROM or internal Flash, etc.) becomes possible.
16.6
No default master
To change from one type of default master to another, the Bus Matrix user interface provides Slave Configuration
Registers, one for every slave, which set a default master for each slave. The Slave Configuration Register
contains two fields to manage master selection: DEFMSTR_TYPE and FIXED_DEFMSTR. The 2-bit
DEFMSTR_TYPE field selects the default master type (no default, last access master, fixed default master),
whereas the 4-bit FIXED_DEFMSTR field selects a fixed default master provided that DEFMSTR_TYPE is set to
fixed default master. Please refer to Section 16.13.2 Bus Matrix Slave Configuration Registers.
16.7
No Default Master
After the end of the current access, if no other request is pending, the slave is disconnected from all masters.
This configuration incurs one latency clock cycle for the first access of a burst after bus Idle. Arbitration without
default master may be used for masters that perform significant bursts or several transfers with no Idle in between,
or if the slave bus bandwidth is widely used by one or more masters.
This configuration provides no benefit on access latency or bandwidth when reaching maximum slave bus
throughput regardless of the number of requesting masters.
16.8
16.9
130
This allows the Bus Matrix arbiters to remove the one latency clock cycle for the fixed default master of the slave.
All requests attempted by the fixed default master do not cause any arbitration latency, whereas other nonprivileged masters will get one latency cycle. This technique is used for a master that mainly performs single
accesses or short bursts with Idle cycles in between.
This configuration provides no benefit on access latency or bandwidth when reaching maximum slave bus
throughput, regardless of the number of requesting masters.
16.10 Arbitration
The Bus Matrix provides an arbitration mechanism that reduces latency when conflicts occur, i.e., when two or
more masters try to access the same slave at the same time. One arbiter per AHB slave is provided, thus
arbitrating each slave specifically.
The Bus Matrix provides the user with the possibility of choosing between two arbitration types or mixing them for
each slave:
The resulting algorithm may be complemented by selecting a default master configuration for each slave.
When re-arbitration must be done, specific conditions apply. See Section 16.10.1 Arbitration Scheduling.
16.10.1 Arbitration Scheduling
Each arbiter has the ability to arbitrate between two or more master requests. In order to avoid burst breaking and
also to provide the maximum throughput for slave interfaces, arbitration may only take place during the following
cycles:
Idle Cycles: when a slave is not connected to any master or is connected to a master which is not currently
accessing it.
End of Burst Cycles: when the current cycle is the last cycle of a burst transfer. For defined burst length,
predicted end of burst matches the size of the transfer but is managed differently for undefined burst length.
See Section 16.10.1.1 Undefined Length Burst Arbitration.
Slot Cycle Limit: when the slot cycle counter has reached the limit value indicating that the current master
access is too long and must be broken. See Section 16.10.1.2 Slot Cycle Limit Arbitration.
In order to prevent long AHB burst lengths that can lock the access to the slave for an excessive period of time, the
user can trigger the re-arbitration before the end of the incremental bursts. The re-arbitration period can be
selected from the following Undefined Length Burst Type (ULBT) possibilities:
Unlimited: no predetermined end of burst is generated. This value enables 1 Kbyte burst lengths.
1-beat bursts: predetermined end of burst is generated at each single transfer during the INCR transfer.
4-beat bursts: predetermined end of burst is generated at the end of each 4-beat boundary during INCR
transfer.
8-beat bursts: predetermined end of burst is generated at the end of each 8-beat boundary during INCR
transfer.
16-beat bursts: predetermined end of burst is generated at the end of each 16-beat boundary during INCR
transfer.
32-beat bursts: predetermined end of burst is generated at the end of each 32-beat boundary during INCR
transfer.
64-beat bursts: predetermined end of burst is generated at the end of each 64-beat boundary during INCR
transfer.
131
128-beat bursts: predetermined end of burst is generated at the end of each 128-beat boundary during INCR
transfer.
The use of undefined length 8-beat bursts, or less, is discouraged since this may decrease the overall bus
bandwidth due to arbitration and slave latencies at each first access of a burst.
However, if the usual length of undefined length bursts is known for a master it is recommended to configure the
ULBT accordingly.
This selection can be done through the ULBT field of the Master Configuration Registers (MATRIX_MCFG).
16.10.1.2Slot Cycle Limit Arbitration
The Bus Matrix contains specific logic to break long accesses, such as very long bursts on a very slow slave (e.g.,
an external low speed memory). At each arbitration time, a counter is loaded with the value previously written in
the SLOT_CYCLE field of the related Slave Configuration Register (MATRIX_SCFG) and decreased at each clock
cycle. When the counter elapses, the arbiter has the ability to re-arbitrate at the end of the current AHB access
cycle.
Unless a master has a very tight access latency constraint, which could lead to data overflow or underflow due to a
badly undersized internal FIFO with respect to its throughput, the Slot Cycle Limit should be disabled
(SLOT_CYCLE = 0) or set to its default maximum value in order not to inefficiently break long bursts performed by
some Atmel masters.
In most cases, this feature is not needed and should be disabled for power saving.
Warning: This feature cannot prevent any slave from locking its access indefinitely.
16.10.2 Arbitration Priority Scheme
The bus Matrix arbitration scheme is organized in priority pools, each corresponding to an access criticality class
as shown in the Latency Quality of Service column in Table 16-7 Arbitration Priority Pools.
Table 16-7.
Priority pool
Latency Critical
Latency Sensitive
Bandwidth Sensitive
Background Transfers
Round-robin priority is used in the highest and lowest priority pools 3 and 0, whereas fixed level priority is used
between priority pools and in the intermediate priority pools 2 and 1. See Section 16.10.2.2 Round-robin
Arbitration.
For each slave, each master is assigned to one of the slave priority pools through the priority registers for slaves
(MxPR fields of MATRIX_PRAS and MATRIX_PRBS). When evaluating master requests, this priority pool level
always takes precedence.
After reset, most of the masters belong to the lowest priority pool (MxPR = 0, Background Transfer) and are
therefore granted bus access in a true round-robin order.
The highest priority pool must be specifically reserved for masters requiring very low access latency. If more than
one master belongs to this pool, they will be granted bus access in a biased round-robin manner which allows tight
and deterministic maximum access latency from AHB requests. In the worst case, any currently occurring highpriority master request will be granted after the current bus master access has ended and other high priority pool
master requests, if any, have been granted once each.
The lowest priority pool shares the remaining bus bandwidth between AHB masters.
Intermediate priority pools allow fine priority tuning. Typically, a latency-sensitive master or a bandwidth-sensitive
master will use such a priority level. The higher the priority level (MxPR value), the higher the master priority.
132
For good CPU performance, it is recommended configure CPU priority with the default reset value 2 (Latency
Sensitive).
All combinations of MxPR values are allowed for all masters and slaves. For example, some masters might be
assigned the highest priority pool (round-robin), and remaining masters the lowest priority pool (round-robin), with
no master for intermediate fix priority levels.
16.10.2.1Fixed Priority Arbitration
Fixed priority arbitration algorithm is the first and only arbitration algorithm applied between masters from distinct
priority pools. It is also used in priority pools other than the highest and lowest priority pools (intermediate priority
pools).
Fixed priority arbitration allows the Bus Matrix arbiters to dispatch the requests from different masters to the same
slave by using the fixed priority defined by the user in the MxPR field for each master in the Priority Registers,
MATRIX_PRAS and MATRIX_PRBS. If two or more master requests are active at the same time, the master with
the highest priority MxPR number is serviced first.
In intermediate priority pools, if two or more master requests with the same priority are active at the same time, the
master with the highest number is serviced first.
16.10.2.2Round-robin Arbitration
This algorithm is only used in the highest and lowest priority pools. It allows the Bus Matrix arbiters to properly
dispatch requests from different masters to the same slave. If two or more master requests are active at the same
time in the priority pool, they are serviced in a round-robin increasing master number order.
133
With the TrustZone extension, the Bus Masters emit requests with the Secure or Non-Secure Security
option.
The AHB Matrix, according to its configuration and the request, grants or denies the access.
The slave address space is divided into one or more slave regions. The slave regions are generally contiguous
parts of the slave address space. The slave region is potentially split into an access denied area (upper part) and a
security region which can be split (lower part), unless the slave security region occupies the whole slave region.
The security region itself may or may not be split into one Securable area and one Non-secured area. The
Securable area may be independently secured for read access and for write access.
For one slave region, the following characteristics are configured by hardware or software:
Max Size of the slave region: the maximum size for the regions physical content
Top Size of the slave security region: the actually programmed or fixed size for the regions physical content
Split Size of the slave security region: the size of the lower security area of the region.
Figure 16-1 shows how the terms defined here are implemented in an AHB slave address space.
134
Figure 16-1.
Region n Max
(Hardwired)
Region n Top
Slave Region n
Max Size
Region n Split
Lower Security Area
configured as
the Not Secured
or
the Securizable Area
A set of Bus Matrix security registers allows to specify, for each AHB slave, slave security region or slave security
area, the security mode required for accessing this slave, slave security region or slave security area.
Additional Bus Matrix security registers allow to specify, for each APB slave, the security mode required for
accessing this slave (see Section 16.13.15 Security Peripheral Select x Registers on page 164).
See Section 16.13.12 Security Slave Registers on page 161.
The Bus Matrix registers can only be accessed in Secure Mode.
The Bus Matrix propagates the AHB security bit down to the AHB slaves to let them perform additional security
checks, and the Bus Matrix itself allows, or not, the access to the slaves by means of its TrustZone embedded
controller.
135
Access violations may be reported either by an AHB slave through the bus error response (example from the
AHB/APB Bridge), or by the Bus Matrix embedded TrustZone controller. In both cases, a bus error response is
sent to the offending master and the error is flagged in the Master Error Status Register. An interrupt can be sent
to the Secure world, if it has been enabled for that master by writing into the Master Error Interrupt Enable
Register. Thus, the offending master is identified. The offending address is registered in the Master Error Address
Registers, so that the slave and the targeted security region are also known.
Depending on the hardware parameters and software configuration, the address space of each AHB slave security
region may or may not be split into two parts, one belonging to the Secure world and the other one to the Normal
world.
Five different security types of AHB slaves are supported. The number of security regions is fixed by design for
each slave, independently, from 1 to 8, totalling from 1 up to 16 security areas for security configurable slaves.
16.12.1 Security Types of AHB Slaves
16.12.1.1Principles
The Bus Matrix supports five different security types of AHB slaves: two fixed types and three configurable types.
The security type of an AHB slave is set at hardware design among the following:
Always Non-secured
Always Secured
Internal Securable
External Securable
Scalable Securable
The security type is fixed at hardware design on a per-master and a per-slave basis. Always Non-secured and
Always Secured security types are not software configurable.
The different security types have the following characteristics:
136
Always Non-secured slaves have no security mode access restriction. Their address space is precisely
fixed by design. Any out-of-address range access is denied and reported.
Always Secured slaves can only be accessed by a secure master request. Their address space is precisely
fixed by design. Any non-secure or out-of-address range access is denied and reported.
Internal Securable is intended for internal memories such as RAM, ROM or embedded Flash. The Internal
Securable slave has one slave region which has a hardware fixed base address and Security Region Top.
This slave region may be split through software configuration into one Non-secured area plus one Securable
area. Inside the slave security region, the split boundary is programmable in powers of 2 from 4 Kbytes up to
the full slave security region address space. The security area located below the split boundary may be
configured as the Non-secured or the Securable one. The Securable area may be independently configured
as Read Secured and/or Write Secured. Any access with security or address range violation is denied and
reported.
External Securable is intended for external memories on the EBI, such as DDR, SDRAM, external ROM or
NAND Flash. The External Securable slave has identical features as the Internal Securable slave, plus the
ability to configure each of its slave security region address space sizes according to the external memory
parts used. This avoids mirroring Secured areas into Non-secured areas, and further restricts the overall
accessible address range. Any access with security or configured address range violation is denied and
reported.
Scalable Securable is intended for external memories with a dedicated slave, such as DDR. The Scalable
Securable slave is divided into a fixed number of scalable, equally sized, and contiguous security regions.
Each of them can be split in the same way as for Internal or External Securable slaves. The security region
size must be configured by software, so that the equally-sized regions fill the actual available memory. This
avoids mirroring Secured areas into Non-secured areas, and further restricts the overall accessible address
range. Any access with security or configured address range violation is denied and reported.
As the security type is fixed at hardware design on a per-master and per-slave basis, it is possible to set some
slave access security as configurable from one or some particular masters, and to fix the access as Always
Secured from all the other masters.
As the security type is fixed by design at the slave region level, different security region types can be mixed inside
a single slave.
Likewise, the mapping base address and the accessible address range of each AHB slave or slave region may
have been hardware-restricted on a per-master basis from no access to full slave address space.
16.12.1.2Examples
Slave
Master0
Slave0
Internal Memory
Always Non-secured
Slave1
External Securable
EBI
2 Regions
Master1
Master2
Internal Securable
Internal Securable
1 Region
1 Region
Always Secured
External Securable
2 Regions
The Access from Master1 and Master2 to Slave0 is Internal Securable with one region and with the
same Software Configuration (Choice of SPLIT0 and the Security Configuration bits LANSECH,
RDNSECH, WRNSECH).
Figure 16-2 on page 138 shows an Internal Securable slave example. This example is constructed with the
following hypothesis:
The slave is an Internal Memory containing one region. The Slave region Max Size is 4 Mbytes.
The slave region 0 base address equals 0x10000000. Its Top Size is 512 Kbytes (hardware configuration).
137
Figure 16-2.
Partitioning example of an Internal Securable slave featuring 1 security region of 512 KB split into 1 or 2 security
areas of 4 KB to 512 KB
512 Kbyte space
Internal Securable Slave
0x10400000
Slave Region 0
0x10080000
256 Kbyte
Non-secured Area
Region 0 Top
Region 0 Split
256 Kbyte
Read/Write Secured Area
0x10000000
Note: The slave security areas split inside the security region are configured by writing into the Security Areas Split Slave Registers.
138
Figure 16-3 shows an External Securable slave example. This example is constructed with the following
hypothesis:
The slave is an interface with the external bus (EBI) containing two regions. The slave size is 2 256
Mbytes. Each slave region Max Size is 256 Mbytes.
The slave region 0 base address equals 0x10000000. It is connected to a 32 Mbyte memory, for example an
external DDR. The slave region 0 Top Size must be set to 32 Mbytes.
The slave region 1 base address equals 0x20000000. It is connected to a 2 Mbyte memory, for example an
external NAND Flash. The slave region 1 Top Size must be set to 2 Mbytes.
139
Figure 16-3.
Partitioning example of an External Securable slave featuring 2 security regions of 4 KB to 128 MB each and up
to 4 security areas of 4 KB to 128 MB
2*256 Mbyte space
External Securable Slave
partitioning
with a 32 Mbyte memory part
and a 2 Mbyte memory part
0x30000000
254 Mbyte
Access Denied Area
Slave Region 1
Region 1 Top
1 Mbyte
Non-secured Area
0x20100000
Region 1 Split
1 Mbyte
Write Secured Area
0x20000000
224 Mbyte
Access Denied Area
Slave Region 0
0x12000000
Region 0 Top
28 Mbyte
Read/Write Secured Area
0x10000000
Region 0 Split
0x10400000
0x10000000
Note: The slave region sizes are configured by writing into the Security Region Top Slave Registers.
The slave security area split inside each region is configured by writing into the Security Areas Split Slave Registers.
140
Figure 16-4 shows a Scalable Securable slave example. This example is constructed with the following
hypothesis:
The slave is an external memory with dedicated slave containing four regions, for example an external DDR.
The slave base address equals 0x40000000. It is connected to a 256 Mbyte external memory.
As the connected memory size is 256 Mbytes and there are four regions, the size of each region is 64
Mbytes. This gives the value of the slave region Max Size and Top Size. The slave region 0 Top Size must
be configured to 64 Mbytes.
SPLIT1 is set to 64 Mbytes, so its low area occupies the whole region 1
RDNSECH1 is dont care since the low area occupies the whole region 1
WRNSECH1 is dont care since the low area occupies the whole region 1
141
Figure 16-4.
Partitioning example of a Scalable Securable slave featuring 4 equally sized security regions of 1 MB to 128 MB
each and up to 8 security areas of 4 KB to 128 MB
512 MB space
Scalable Securable Slave
partitioning
with 256 MB memory
0x60000000
256 MB
Access Denied Area
0x50000000
32 MB
Non-secured Area
Security Region 3
0x4C000000
Read/Write
Secured Area
95.996 MB
Region 3 Split
Read/Write
Secured Area
Security Region 2
Region 2 Split
Region 1 Split
0x48000000
Security Region 1
4 KB Non-secured Area
Non-secured Area
0x44000000
128 MB
0x48001000
0x48000000
Non-secured Area
Security Region 0
0x40000000
Region 0 Split
Non-secured Area
0x40001000
0x40000000
Note: The slaves generic security regions sizes are configured by writing into field SRTOP0 of the Security Region Top Slave Registers
and the custom slave security areas splits inside each region is configured by writing into the Security Areas Split Slave Registers.
142
Example for PIOC, Peripheral ID 25, which is connected to the H32MX Matrix
Example for LCDC, Peripheral ID 51, which is connected to the H64MX Matrix
Example for XDMAC1, Peripheral ID 50, which is connected to the H64MX Matrix
Table 16-9.
H32MX MATRIX_SPSELR1[0] = 0 (read-only); sets the peripheral as Secure by hardware, also called
Always Secure
Peripheral Identifiers
ID
Peripheral
Security Type
Matrix
MATRIX_SPSELRx Bit
SAIC
Always Secure
H32
MATRIX_SPSELR1[0]
SYS
Always Secure
H32
MATRIX_SPSELR1[1]
ARM
Always Secure
H64
MATRIX_SPSELR1[2]
PIT
Always Secure
H32
MATRIX_SPSELR1[3]
WDT
Always Secure
H32
MATRIX_SPSELR1[4]
PIOD
Always Secure
H32
MATRIX_SPSELR1[5]
USART0
Always Secure
H32
MATRIX_SPSELR1[6]
USART1
Always Secure
H32
MATRIX_SPSELR1[7]
XDMAC0
Always Secure
H64
MATRIX_SPSELR1[8]
ICM
Always Secure
H32
MATRIX_SPSELR1[9]
10
PKCC
Always Secure
H64
MATRIX_SPSELR1[10]
11
SCI
Always Secure
H32
MATRIX_SPSELR1[11]
12
AES
Always Secure
H32
MATRIX_SPSELR1[12]
13
AESB
Always Secure
H64
MATRIX_SPSELR1[13]
143
Table 16-9.
ID
Peripheral
Security Type
Matrix
MATRIX_SPSELRx Bit
14
TDES
Always Secure
H32
MATRIX_SPSELR1[14]
15
SHA
Always Secure
H32
MATRIX_SPSELR1[15]
16
MPDDRC
Always Secure
H64
MATRIX_SPSELR1[16]
17
MATRIX1
Always Secure
H32
MATRIX_SPSELR1[17]
18
MATRIX0
Always Secure
H64
MATRIX_SPSELR1[18]
19
VDEC
Programmable Secure
H64
MATRIX_SPSELR1[19]
UD
20
SECUMOD
Always Secure
H32
MATRIX_SPSELR1[20]
21
MSADCC
Always Secure
H32
MATRIX_SPSELR1[21]
22
HSMC
Always Secure
H32
MATRIX_SPSELR1[22]
23
PIOA
Programmable Secure
H32
MATRIX_SPSELR1[23]
UD
24
PIOB
Programmable Secure
H32
MATRIX_SPSELR1[24]
UD
25
PIOC
Programmable Secure
H32
MATRIX_SPSELR1[25]
UD
26
PIOE
Programmable Secure
H32
MATRIX_SPSELR1[26]
UD
27
UART0
Programmable Secure
H32
MATRIX_SPSELR1[27]
UD
28
UART1
Programmable Secure
H32
MATRIX_SPSELR1[28]
UD
29
USART2
Programmable Secure
H32
MATRIX_SPSELR1[29]
UD
30
USART3
Programmable Secure
H32
MATRIX_SPSELR1[30]
UD
31
USART4
Programmable Secure
H32
MATRIX_SPSELR1[31]
UD
32
TWI0
Programmable Secure
H32
MATRIX_SPSELR2[0]
UD
33
TWI1
Programmable Secure
H32
MATRIX_SPSELR2[1]
UD
34
TWI2
Programmable Secure
H32
MATRIX_SPSELR2[2]
UD
35
HSMCI0
Programmable Secure
H32
MATRIX_SPSELR2[3]
UD
36
HSMCI1
Programmable Secure
H32
MATRIX_SPSELR2[4]
UD
37
SPI0
Programmable Secure
H32
MATRIX_SPSELR2[5]
UD
38
SPI1
Programmable Secure
H32
MATRIX_SPSELR2[6]
UD
39
SPI2
Programmable Secure
H32
MATRIX_SPSELR2[7]
UD
40
TC0
Programmable Secure
H32
MATRIX_SPSELR2[8]
UD
41
TC1
Programmable Secure
H32
MATRIX_SPSELR2[9]
UD
42
TC2
Programmable Secure
H32
MATRIX_SPSELR2[10]
UD
43
PWM
Programmable Secure
H32
MATRIX_SPSELR2[11]
UD
44
ADC
Programmable Secure
H32
MATRIX_SPSELR2[12]
UD
45
DBGU
Programmable Secure
H32
MATRIX_SPSELR2[13]
UD
46
UHPHS
Programmable Secure
H32
MATRIX_SPSELR2[14]
UD
47
UDPHS
Programmable Secure
H32
MATRIX_SPSELR2[15]
UD
48
SSC0
Programmable Secure
H32
MATRIX_SPSELR2[16]
UD
49
SSC1
Programmable Secure
H32
MATRIX_SPSELR2[17]
UD
50
XDMAC1
Non-Secure
H64
MATRIX_SPSELR2[18]
144
Table 16-9.
ID
Peripheral
Security Type
Matrix
MATRIX_SPSELRx Bit
51
LCDC
Programmable Secure
H64
MATRIX_SPSELR2[19]
UD
52
ISI
Programmable Secure
H64
MATRIX_SPSELR2[20]
UD
53
TRNG
Programmable Secure
H32
MATRIX_SPSELR2[21]
UD
54
GMAC0
Programmable Secure
H32
MATRIX_SPSELR2[22]
UD
55
GMAC1
Programmable Secure
H32
MATRIX_SPSELR2[23]
UD
56
AIC
Non-Secure
H32
MATRIX_SPSELR2[24]
57
SFC
Always Secure
H32
MATRIX_SPSELR2[25]
58
Reserved
59
SECURAM
Always Secure
H32
MATRIX_SPSELR2[27]
60
CTB
Always Secure
H32
MATRIX_SPSELR2[28]
61
SMD
PS
H32
MATRIX_SPSELR2[29]
UD
62
TWI3
PS
H32
MATRIX_SPSELR2[30]
UD
63
CATB
Always Secure
H32
MATRIX_SPSELR2[31]
64
SFR
Always Secure
H32
MATRIX_SPSELR3[0]
65
AIC
Non-Secure
H32
MATRIX_SPSELR3[1]
66
SAIC
Always Secure
H32
MATRIX_SPSELR3[2]
67
L2CC
Always Secure
H64
MATRIX_SPSELR3[3]
68
PMC
Always Secure
H64
MATRIX_SPSELR3[4]
The AHB/APB Bridge compares the incoming master request security bit with the required security mode for the
selected peripheral, and accepts or denies access. In the last case, its bus error response is internally flagged in
the Bus Matrix Master Error Status Register; the offending address is registered in the Master Error Address
Registers so that the slave and the targeted protected region are also known.
145
Register Mapping
Offset
Register
Name
Access
Reset
0x0000
MATRIX_MCFG0
Read/Write
0x00000004
0x0004
MATRIX_MCFG1
Read/Write
0x00000004
0x0008
MATRIX_MCFG2
Read/Write
0x00000004
0x000C
MATRIX_MCFG3
Read/Write
0x00000004
0x0010
MATRIX_MCFG4
Read/Write
0x00000004
0x0014
MATRIX_MCFG5
Read/Write
0x00000004
0x0018
MATRIX_MCFG6
Read/Write
0x00000004
0x001C
MATRIX_MCFG7
Read/Write
0x00000004
0x0020
MATRIX_MCFG8
Read/Write
0x00000004
0x0024
MATRIX_MCFG9
Read/Write
0x00000004
Reserved
0x0040
MATRIX_SCFG0
Read/Write
0x000001FF
0x0044
MATRIX_SCFG1
Read/Write
0x000001FF
0x0048
MATRIX_SCFG2
Read/Write
0x000001FF
0x004C
MATRIX_SCFG3
Read/Write
0x000001FF
0x0050
MATRIX_SCFG4
Read/Write
0x000001FF
0x0054
MATRIX_SCFG5
Read/Write
0x000001FF
0x0058
MATRIX_SCFG6
Read/Write
0x000001FF
0x005C
MATRIX_SCFG7
Read/Write
0x000001FF
0x0060
MATRIX_SCFG8
Read/Write
0x000001FF
0x0064
MATRIX_SCFG9
Read/Write
0x000001FF
0x0068
MATRIX_SCFG10
Read/Write
0x000001FF
0x006C
MATRIX_SCFG11
Read/Write
0x000001FF
0x0070
MATRIX_SCFG12
Read/Write
0x000001FF
Reserved
0x0080
MATRIX_PRAS0
Read/Write
0x00000000
0x0084
MATRIX_PRBS0
Read/Write
0x00000000
0x0088
MATRIX_PRAS1
Read/Write
0x00000000
0x008C
MATRIX_PRBS1
Read/Write
0x00000000
0x0090
MATRIX_PRAS2
Read/Write
0x00000000
0x0094
MATRIX_PRBS2
Read/Write
0x00000000
0x0098
MATRIX_PRAS3
Read/Write
0x00000000
0x009C
MATRIX_PRBS3
Read/Write
0x00000000
0x00A0
MATRIX_PRAS4
Read/Write
0x00000000
0x00A4
MATRIX_PRBS4
Read/Write
0x00000000
0x00280x003C
0x00740x007C
146
Table 16-10.
Offset
Register
Name
Access
Reset
0x00A8
MATRIX_PRAS5
Read/Write
0x00000000
0x00AC
MATRIX_PRBS5
Read/Write
0x00000000
0x00B0
MATRIX_PRAS6
Read/Write
0x00000000
0x00B4
MATRIX_PRBS6
Read/Write
0x00000000
0x00B8
MATRIX_PRAS7
Read/Write
0x00000000
0x00BC
MATRIX_PRBS7
Read/Write
0x00000000
0x00C0
MATRIX_PRAS8
Read/Write
0x00000000
0x00C4
MATRIX_PRBS8
Read/Write
0x00000000
0x00C8
MATRIX_PRAS9
Read/Write
0x00000000
0x00CC
MATRIX_PRBS9
Read/Write
0x00000000
0x00D0
MATRIX_PRAS10
Read/Write
0x00000000
0x00D4
MATRIX_PRBS10
Read/Write
0x00000000
0x00D8
MATRIX_PRAS11
Read/Write
0x00000000
0x00DC
MATRIX_PRBS11
Read/Write
0x00000000
0x00E0
MATRIX_PRAS12
Read/Write
0x00000000
0x00E4
MATRIX_PRBS12
Read/Write
0x00000000
Reserved
0x0150
MATRIX_MEIER
Write-only
0x0154
MATRIX_MEIDR
Write-only
0x0158
MATRIX_MEIMR
Read-only
0x00000000
0x015C
MATRIX_MESR
Read-only
0x00000000
0x0160
MATRIX_MEAR0
Read-only
0x00000000
0x0164
MATRIX_MEAR1
Read-only
0x00000000
0x0168
MATRIX_MEAR2
Read-only
0x00000000
0x016C
MATRIX_MEAR3
Read-only
0x00000000
0x0170
MATRIX_MEAR4
Read-only
0x00000000
0x0174
MATRIX_MEAR5
Read-only
0x00000000
0x0178
MATRIX_MEAR6
Read-only
0x00000000
0x017C
MATRIX_MEAR7
Read-only
0x00000000
0x0180
MATRIX_MEAR8
Read-only
0x00000000
0x0184
MATRIX_MEAR9
Read-only
0x00000000
Reserved
0x01E4
MATRIX_WPMR
Read/Write
0x00000000
0x01E8
MATRIX_WPSR
Read-only
0x00000000
Reserved
0x0200
MATRIX_SSR0
Read/Write
0x00000000
0x0204
MATRIX_SSR1
Read/Write
0x00000000
0x00E80x014C
0x01880x01E0
0x01EC0x01FC
147
Table 16-10.
Offset
Register
Name
Access
Reset
0x0208
MATRIX_SSR2
Read/Write
0x00000000
0x020C
MATRIX_SSR3
Read/Write
0x00000000
0x0210
MATRIX_SSR4
Read/Write
0x00000000
0x0214
MATRIX_SSR5
Read/Write
0x00000000
0x0218
MATRIX_SSR6
Read/Write
0x00000000
0x021C
MATRIX_SSR7
Read/Write
0x00000000
0x0220
MATRIX_SSR8
Read/Write
0x00000000
0x0224
MATRIX_SSR9
Read/Write
0x00000000
0x0228
MATRIX_SSR10
Read/Write
0x00000000
0x022C
MATRIX_SSR11
Read/Write
0x00000000
0x0230
MATRIX_SSR12
Read/Write
0x00000000
Reserved
0x0240
MATRIX_SASSR0
Read/Write
0x00000000
0x0244
MATRIX_SASSR1
Read/Write
0x00000000
0x0248
MATRIX_SASSR2
Read/Write
0x00000000
0x024C
MATRIX_SASSR3
Read/Write
0x00000000
0x0250
MATRIX_SASSR4
Read/Write
0x00000000
0x0254
MATRIX_SASSR5
Read/Write
0x00000000
0x0258
MATRIX_SASSR6
Read/Write
0x00000000
0x025C
MATRIX_SASSR7
Read/Write
0x00000000
0x0260
MATRIX_SASSR8
Read/Write
0x00000000
0x0264
MATRIX_SASSR9
Read/Write
0x00000000
0x0268
MATRIX_SASSR10
Read/Write
0x00000000
0x026C
MATRIX_SASSR11
Read/Write
0x00000000
0x0270
MATRIX_SASSR12
Read/Write
0x00000000
Reserved
0x0284
MATRIX_SRTSR1
Read/Write
0x00000000
0x0288
MATRIX_SRTSR2
Read/Write
0x00000000
0x028C
MATRIX_SRTSR3
Read/Write
0x00000000
0x0290
MATRIX_SRTSR4
Read/Write
0x00000000
0x0294
MATRIX_SRTSR5
Read/Write
0x00000000
0x0298
MATRIX_SRTSR6
Read/Write
0x00000000
0x029C
MATRIX_SRTSR7
Read/Write
0x00000000
0x02A0
MATRIX_SRTSR8
Read/Write
0x00000000
0x02A4
MATRIX_SRTSR9
Read/Write
0x00000000
0x02A8
MATRIX_SRTSR10
Read/Write
0x00000000
0x02AC
MATRIX_SRTSR11
Read/Write
0x00000000
0x02340x023C
0x02740x0280
148
Table 16-10.
Offset
Register
Name
0x02B0
MATRIX_SRTSR12
Reserved
0x02C0
0x02C4
0x02C8
0x02B40x02BC
Notes:
Access
Reset
Read/Write
0x00000000
MATRIX_SPSELR1
Read/Write
0x00000000(1)
MATRIX_SPSELR2
Read/Write
0x00000000(2)
MATRIX_SPSELR3
Read/Write
0x00000000(3)
149
MATRIX_MCFGx [x=0..9]
Address:
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
ULBT
This register can only be written if the WPEN bit is cleared in the Write Protection Mode Register.
ULBT: Undefined Length Burst Type
Value
Name
UNLIMITED
Description
Unlimited Length BurstNo predicted end of burst is generated, therefore INCR bursts coming from this
master can only be broken if the Slave Slot Cycle Limit is reached. If the Slot Cycle Limit is not reached, the
burst is normally completed by the master, at the latest, on the next AHB 1 Kbyte address boundary,
allowing up to 256-beat word bursts or 128-beat double-word bursts.
This value should not be used in the very particular case of a master capable of performing back-to-back
undefined length bursts on a single slave, since this could indefinitely freeze the slave arbitration and thus
prevent another master from accessing this slave.
SINGLE
Single AccessThe undefined length burst is treated as a succession of single accesses, allowing rearbitration at each beat of the INCR burst or bursts sequence.
4_BEAT
4-beat BurstThe undefined length burst or bursts sequence is split into 4-beat bursts or less, allowing rearbitration every 4 beats.
8_BEAT
8-beat BurstThe undefined length burst or bursts sequence is split into 8-beat bursts or less, allowing rearbitration every 8 beats.
16_BEAT
16-beat BurstThe undefined length burst or bursts sequence is split into 16-beat bursts or less, allowing
re-arbitration every 16 beats.
32_BEAT
32-beat BurstThe undefined length burst or bursts sequence is split into 32-beat bursts or less, allowing
re-arbitration every 32 beats.
64_BEAT
64-beat BurstThe undefined length burst or bursts sequence is split into 64-beat bursts or less, allowing
re-arbitration every 64 beats.
128_BEAT
128-beat BurstThe undefined length burst or bursts sequence is split into 128-beat bursts or less,
allowing re-arbitration every 128 beats.
Unless duly needed, the ULBT should be left at its default 0 value for power saving.
150
MATRIX_SCFGx [x=0..12]
Address:
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
SLOT_CYCLE
FIXED_DEFMSTR
DEFMSTR_TYPE
SLOT_CYCLE
This register can only be written if the WPEN bit is cleared in the Write Protection Mode Register.
SLOT_CYCLE: Maximum Bus Grant Duration for Masters
When SLOT_CYCLE AHB clock cycles have elapsed since the last arbitration, a new arbitration takes place to let another
master access this slave. If another master is requesting the slave bus, then the current master burst is broken.
If SLOT_CYCLE = 0, the Slot Cycle Limit feature is disabled and bursts always complete unless broken according to the
ULBT.
This limit has been placed in order to enforce arbitration so as to meet potential latency constraints of masters waiting for
slave access.
This limit must not be too small. Unreasonably small values break every burst and the Bus Matrix arbitrates without performing any data transfer. The default maximum value is usually an optimal conservative choice.
In most cases, this feature is not needed and should be disabled for power saving.
See Section 16.10.1.2 Slot Cycle Limit Arbitration on page 132 for details.
DEFMSTR_TYPE: Default Master Type
Value
Name
Description
NONE
No Default MasterAt the end of the current slave access, if no other master request is pending, the slave
is disconnected from all masters.
This results in a one clock cycle latency for the first access of a burst transfer or for a single access.
LAST
Last Default MasterAt the end of the current slave access, if no other master request is pending, the
slave stays connected to the last master having accessed it.
This results in not having one clock cycle latency when the last master tries to access the slave again.
FIXED
Fixed Default MasterAt the end of the current slave access, if no other master request is pending, the
slave connects to the fixed master the number that has been written in the FIXED_DEFMSTR field.
This results in not having one clock cycle latency when the fixed master tries to access the slave again.
151
MATRIX_PRASx [x=0..12]
Address:
0xF001C080 (0)[0], 0xF001C088 (0)[1], 0xF001C090 (0)[2], 0xF001C098 (0)[3], 0xF001C0A0 (0)[4],
0xF001C0A8 (0)[5], 0xF001C0B0 (0)[6], 0xF001C0B8 (0)[7], 0xF001C0C0 (0)[8], 0xF001C0C8 (0)[9], 0xF001C0D0
(0)[10], 0xF001C0D8 (0)[11], 0xF001C0E0 (0)[12], 0xFC054080 (1)[0], 0xFC054088 (1)[1], 0xFC054090 (1)[2],
0xFC054098 (1)[3], 0xFC0540A0 (1)[4], 0xFC0540A8 (1)[5], 0xFC0540B0 (1)[6], 0xFC0540B8 (1)[7], 0xFC0540C0 (1)[8],
0xFC0540C8 (1)[9], 0xFC0540D0 (1)[10], 0xFC0540D8 (1)[11], 0xFC0540E0 (1)[12]
Access:
Read/Write
31
30
23
22
15
14
29
28
M7PR
21
20
M5PR
13
12
M3PR
5
M1PR
27
26
19
18
11
10
25
24
M6PR
17
16
M4PR
9
M2PR
1
M0PR
This register can only be written if the WPEN bit is cleared in the Write Protection Mode Register.
MxPR: Master x Priority
Fixed priority of Master x for accessing the selected slave. The higher the number, the higher the priority.
All the masters programmed with the same MxPR value for the slave make up a priority pool.
Round-robin arbitration is used in the lowest (MxPR = 0) and highest (MxPR = 3) priority pools.
Fixed priority is used in intermediate priority pools (MxPR = 1) and (MxPR = 2).
See Section 16.10.2 Arbitration Priority Scheme on page 132 for details.
152
MATRIX_PRBSx [x=0..12]
Address:
0xF001C084 (0)[0], 0xF001C08C (0)[1], 0xF001C094 (0)[2], 0xF001C09C (0)[3], 0xF001C0A4 (0)[4],
0xF001C0AC (0)[5], 0xF001C0B4 (0)[6], 0xF001C0BC (0)[7], 0xF001C0C4 (0)[8], 0xF001C0CC (0)[9], 0xF001C0D4
(0)[10], 0xF001C0DC (0)[11], 0xF001C0E4 (0)[12], 0xFC054084 (1)[0], 0xFC05408C (1)[1], 0xFC054094 (1)[2],
0xFC05409C (1)[3], 0xFC0540A4 (1)[4], 0xFC0540AC (1)[5], 0xFC0540B4 (1)[6], 0xFC0540BC (1)[7], 0xFC0540C4 (1)[8],
0xFC0540CC (1)[9], 0xFC0540D4 (1)[10], 0xFC0540DC (1)[11], 0xFC0540E4 (1)[12]
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
M9PR
M8PR
This register can only be written if the WPEN bit is cleared in the Write Protection Mode Register.
MxPR: Master x Priority
Fixed priority of Master x for accessing the selected slave. The higher the number, the higher the priority.
All the masters programmed with the same MxPR value for the slave make up a priority pool.
Round-robin arbitration is used in the lowest (MxPR = 0) and highest (MxPR = 3) priority pools.
Fixed priority is used in intermediate priority pools (MxPR = 1) and (MxPR = 2).
See Section 16.10.2 Arbitration Priority Scheme on page 132 for details.
153
MATRIX_MEIER
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
MERR9
MERR8
MERR7
MERR6
MERR5
MERR4
MERR3
MERR2
MERR1
MERR0
This register can only be written if the WPEN bit is cleared in the Write Protection Mode Register.
MERRx: Master x Access Error
0: No effect
1: Enables Master x Access Error interrupt source
154
MATRIX_MEIDR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
MERR9
MERR8
MERR7
MERR6
MERR5
MERR4
MERR3
MERR2
MERR1
MERR0
This register can only be written if the WPEN bit is cleared in the Write Protection Mode Register.
MERRx: Master x Access Error
0: No effect
1: Disables Master x Access Error interrupt source
155
MATRIX_MEIMR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
MERR9
MERR8
MERR7
MERR6
MERR5
MERR4
MERR3
MERR2
MERR1
MERR0
156
MATRIX_MESR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
MERR9
MERR8
MERR7
MERR6
MERR5
MERR4
MERR3
MERR2
MERR1
MERR0
157
MATRIX_MEARx [x=0..9]
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ERRADD
23
22
21
20
ERRADD
15
14
13
12
ERRADD
7
ERRADD
158
MATRIX_WPMR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
WPKEY
23
22
21
20
WPKEY
15
14
13
12
WPKEY
7
WPEN
Name
0x4D4154
PASSWD
Description
Writing any other value in this field aborts the write operation of the WPEN bit.
Always reads as 0.
159
MATRIX_WPSR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
11
10
WPVSRC
15
14
13
12
WPVSRC
7
WPVS
160
MATRIX_SSRx [x=0..12]
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
WRNSECH7
WRNSECH6
WRNSECH5
WRNSECH4
WRNSECH3
WRNSECH2
WRNSECH1
WRNSECH0
15
14
13
12
11
10
RDNSECH7
RDNSECH6
RDNSECH5
RDNSECH4
RDNSECH3
RDNSECH2
RDNSECH1
RDNSECH0
LANSECH7
LANSECH6
LANSECH5
LANSECH4
LANSECH3
LANSECH2
LANSECH1
LANSECH0
This register can only be written if the WPEN bit is cleared in the Write Protection Mode Register.
LANSECHx: Low Area Non-secured in HSELx Security Region
0: The security of the HSELx AHB slave area laying below the corresponding MATRIX_SASSR / SASPLITx boundary is
configured according to RDNSECHx and WRNSECHx. The whole remaining HSELx upper address space is configured as
Non-secured access.
1: The HSELx AHB slave address area laying below the corresponding MATRIX_SASSR / SASPLITx boundary is configured as Non-secured access, and the whole remaining upper address space according to RDNSECHx and WRNSECHx.
RDNSECHx: Read Non-secured for HSELx Security Region
0: The HSELx AHB slave security region is split into one Read Secured and one Read Non-secured area, according to
LANSECHx and MATRIX_SASSR / SASPLITx. That is, the so defined Securable high or low area is Secured for Read
access.
1: The HSELx AHB slave security region is Non-secured for Read access.
WRNSECHx: Write Non-secured for HSELx Security Region
0: The HSELx AHB slave security region is split into one Write Secured and one Write Non-secured area, according to
LANSECHx and MATRIX_SASSR / SASPLITx. That is, the so defined Securable high or low area is Secured for Write
access.
1: The HSELx AHB slave security region is Non-secured for Write access.
Securable Area access rights:
WRNSECHx / RDNSECHx
Non-secure Access
Secure Access
00
Denied
Write - Read
01
Read
Write - Read
10
Write
Write - Read
11
Write - Read
Write - Read
161
MATRIX_SASSRx [x=0..12]
Address:
Access:
Read/Write
31
30
29
28
27
26
SASPLIT7
23
22
21
14
20
19
18
13
17
16
SASPLIT4
12
11
10
SASPLIT3
7
24
SASPLIT6
SASPLIT5
15
25
SASPLIT2
5
SASPLIT1
SASPLIT0
This register can only be written if the WPEN bit is cleared in the Write Protection Mode Register.
SASPLITx: Security Areas Split for HSELx Security Region
This field defines the boundary address offset where the HSELx AHB slave security region splits into two Security Areas
whose access is controlled according to the corresponding MATRIX_SSR. So it also defines the Security Low Area size
inside the HSELx region.
If this Low Area size is set at or above the HSELx Region Size, then there is no more Security High Area and the
MATRIX_SSR settings for the Low area apply to the whole HSELx Security Region.
SASPLITx
Split Offset
0000
0x00001000
4 Kbytes
0001
0x00002000
8 Kbytes
0010
0x00004000
16 Kbytes
0011
0x00008000
32 Kbytes
0100
0x00010000
64 Kbytes
0101
0x00020000
128 Kbytes
0110
0x00040000
256 Kbytes
0111
0x00080000
512 Kbytes
1000
0x00100000
1 Mbyte
1001
0x00200000
2 Mbytes
1010
0x00400000
4 Mbytes
1011
0x00800000
8 Mbytes
1100
0x01000000
16 Mbytes
1101
0x02000000
32 Mbytes
1110
0x04000000
64 Mbytes
1111
0x08000000
128 Mbytes
162
MATRIX_SRTSRx [x=0..12]
Address:
Access:
Read/Write
31
30
29
28
27
26
SRTOP7
23
22
21
14
20
19
18
13
17
16
SRTOP4
12
11
10
SRTOP3
7
24
SRTOP6
SRTOP5
15
25
SRTOP2
5
SRTOP1
SRTOP0
This register can only be written if the WPEN bit is cleared in the Write Protection Mode Register.
SRTOPx: HSELx Security Region Top
This field defines the size of the HSELx security region address space. Invalid sizes for the slave region must never be programmed. Valid sizes and number of security regions are product, slave and slave configuration dependent.
Note: The slaves featuring multiple scalable contiguous security regions have a single SRTOP0 field for all the security regions.
If this HSELx security region size is set at or below the HSELx low area size, then there is no more security high area and
the MATRIX_SSR settings for the low area apply to the whole HSELx security region.
SRTOPx
Top Offset
0000
0x00001000
4 Kbytes
0001
0x00002000
8 Kbytes
0010
0x00004000
16 Kbytes
0011
0x00008000
32 Kbytes
0100
0x00010000
64 Kbytes
0101
0x00020000
128 Kbytes
0110
0x00040000
256 Kbytes
0111
0x00080000
512 Kbytes
1000
0x00100000
1 Mbyte
1001
0x00200000
2 Mbytes
1010
0x00400000
4 Mbytes
1011
0x00800000
8 Mbytes
1100
0x01000000
16 Mbytes
1101
0x02000000
32 Mbytes
1110
0x04000000
64 Mbytes
1111
0x08000000
128 Mbytes
163
MATRIX_SPSELRx [x=1..3]
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
NSECP31
NSECP30
NSECP29
NSECP28
NSECP27
NSECP26
NSECP25
NSECP24
23
22
21
20
19
18
17
16
NSECP23
NSECP22
NSECP21
NSECP20
NSECP19
NSECP18
NSECP17
NSECP16
15
14
13
12
11
10
NSECP15
NSECP14
NSECP13
NSECP12
NSECP11
NSECP10
NSECP9
NSECP8
NSECP7
NSECP6
NSECP5
NSECP4
NSECP3
NSECP2
NSECP1
NSECP0
This register can only be written if the WPEN bit is cleared in the Write Protection Mode Register.
Each MATRIX_SPSELR can configure the access security type for up to 32 peripherals:
MATRIX_SPSELR1 configures the access security type for peripheral identifiers 031 (bits NSECP0NSECP31).
MATRIX_SPSELR2 configures the access security type for peripheral identifiers 3263 (bits NSECP0NSECP31).
MATRIX_SPSELR3 configures the access security type for peripheral identifiers 6495 (bits NSECP0NSECP31).
Note: The actual number of peripherals implemented is device-specific; refer to the Peripheral Identifiers section of the product
datasheet for details.
164
17.
17.1
Description
Special Function Registers (SFR) manage specific aspects of the integrated memory, bridge implementations,
processor and other functionality not controlled elsewhere.
17.2
Embedded Characteristics
165
17.3
Table 17-1.
Register Mapping
Offset
0x04
0x080x0C
Name
SFR_DDRCFG
Reserved
Access
Reset
Read/Write
0x01
0x10
SFR_OHCIICR
Read/Write
0x0
0x14
SFR_OHCIISR
Read-only
0x18
Reserved
0x28
Read/Write
0x0
Read/Write
0x2C0x3C
SFR_SECURE
Reserved
0x40
0x48
Reserved
0x4C
SFR_SN0
Read-only
0x50
SFR_SN1
Read-only
0x54
SFR_AICREDIR
Read/Write
0x580x3FFC
166
Register
Reserved
SFR_EBICFG
SFR_DDRCFG
Address:
0xF8028004
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
FDQSIEN
FDQIEN
15
14
13
12
11
10
167
SFR_OHCIICR
Address:
0xF8028010
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
UDPPUDIS
15
14
13
12
11
10
APPSTART
ARIE
RES2
RES1
RES0
168
SFR_OHCIISR
Address:
0xF8028014
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
RIS2
RIS1
RIS0
169
SFR_SECURE
Address:
0xF8028028
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
FUSE
ROM
170
SFR_EBICFG
Address:
0xF8028040
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
SCH1
SCH0
PULL1
3
DRIVE1
2
PULL0
DRIVE0
This register controls EBI pins which are not multiplexed with PIO controller lines.
DRIVE0, PULL0, SCH0 control EBI Data pins when applicable.
DRIVE1, PULL1, SCH1 control other EBI pins when applicable.
DRIVEx: EBI Pins Drive Level
Drive level should be programmed depending on target frequency and board characteristics. Refer to pad characteristics
to set correct drive level.
Value
Name
Description
LOW
RESERVED
MEDIUM
HIGH
Name
Description
UP
Pull-up
NONE
No Pull
RESERVED
DOWN
Pull-down
171
SFR_SN0
Address:
0xF802804C
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
SN0
23
22
21
20
SN0
15
14
13
12
SN0
7
SN0
This register allows to read the first 32 bits of the 64-bit Serial Number (unique ID).
SN0: Serial Number 0
172
SFR_SN1
Address:
0xF8028050
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
SN1
23
22
21
20
SN1
15
14
13
12
SN1
SN1
This register allow to read the last 32 bits of the 64-bit Serial Number (unique ID).
SN1: Serial Number 1
173
SFR_AICREDIR
Address:
0xF8028054
Access:
Read/Write
31
30
29
28
27
26
25
24
18
17
16
10
AICREDIRKEY
23
22
21
20
19
AICREDIRKEY
15
14
13
12
11
AICREDIRKEY
7
AICREDIRKEY
NSAIC
174
18.
18.1
Description
The Advanced Interrupt Controller (AIC) is an 8-level priority, individually maskable, vectored interrupt controller,
providing handling of up to hundred and twenty-eight interrupt sources. It is designed to substantially 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 interrupts 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.
175
18.2
Embedded Characteristics
Source 2 to Source 127, Control up to 126 Embedded Peripheral Interrupts or External Interrupts
Higher Priority Interrupts Can Be Served During Service of Lower Priority Interrupt
Vectoring
Protect Mode
Easy Debugging by Preventing Automatic Operations when Protect Models are Enabled
176
18.3
Block Diagram
Figure 18-1.
Block Diagram
FIQ
Secure AIC
ARM
Processor
Up to
128
Sources
Secure
Secure
Secure
Peripheral
Embedded
Peripheral
nFIQ
nFIQ
nIRQ
nIRQ
APB
Non-Secure AIC
IRQ0-IRQn
nFIQ
Up to
128
Sources
Embedded
PeripheralEE
Embedded
nIRQ
Peripheral
Embedded
Peripheral
18.4
OS Drivers
RTOS Drivers
Hard Real Time Tasks
External Peripherals
(External Interrupts)
177
18.5
Non-Secured
Peripheral
Secured
Peripheral
nIRQ
FIQ
Secured
AIC
Cortex-A5
nFIQ
Secured MATRIX
Master / Slave
Always
Secured
Secured
AIC
178
Always NonSecured
Programmable
by Software
Security
18.6
18.7
Pin Name
Pin Description
Type
FIQ
Fast Interrupt
Input
IRQ0IRQn
Interrupt 0Interrupt n
Input
Product Dependencies
I/O Lines
Instance
Signal
I/O Line
Peripheral
AIC
FIQ
PD9
AIC
IRQ
PE25
179
18.8
Functional Description
The Advanced Interrupt Controller independently programs each interrupt source. The SRCTYPE field of the
AIC_SMR (Source Mode Register) selects the interrupt condition of the interrupt source selected by the INTSEL
field of the AIC Source Select Register .
Note:
Configuration registers such as AIC_SMR, AIC_SSR, return the values corresponding to the interrupt source selected
by INTSEL.
The internal interrupt sources wired on the interrupt outputs of the embedded peripherals can be programmed
either in level-sensitive mode or in edge-triggered mode. The active level of the internal interrupts is not important
for the user.
The external interrupt sources can be programmed either in high level-sensitive or low level-sensitive modes, or in
positive edge-triggered or negative edge-triggered modes.
18.8.1.2 Interrupt Source Enabling
Each interrupt source, including the FIQ in source 0, can be enabled or disabled by using the command registers;
AIC Interrupt Enable Command Register on page 204 and AIC Interrupt Disable Command Register on page
205. The interrupt mask of the selected interrupt source can be read in the AIC_IMR. A disabled interrupt does not
affect servicing of other interrupts.
18.8.1.3 Interrupt Clearing and Setting
All interrupt sources programmed to be edge-triggered (including the FIQ in source 0) can be individually set or
cleared by writing respectively the AIC_ISCR and AIC_ICCR registers. Clearing or setting interrupt sources
programmed in level-sensitive mode has no effect.
The clear operation is perfunctory, as the software must perform an action to reinitialize the memorization
circuitry activated when the source is programmed in edge-triggered mode. However, the set operation is available
for auto-test or software debug purposes. It can also be used to execute an AIC-implementation of a software
interrupt.
The AIC features an automatic clear of the current interrupt when the AIC_IVR (Interrupt Vector Register) is read.
Only the interrupt source being detected by the AIC as the current interrupt is affected by this operation. (See
Priority Controller on page 183.) The automatic clear reduces the operations required by the interrupt service
routine entry code to reading the AIC_IVR.
The automatic clear of the interrupt source 0 is performed when AIC_FVR is read.
18.8.1.4 Interrupt Status
AIC_IPR registers represent the state of the interrupt lines, whether they are masked or not. The AIC_IMR permits
to define the mask of the interrupt lines.
The AIC_ISR reads the number of the current interrupt (see Priority Controller on page 183) and the AIC_CISR
gives an image of the signals nIRQ and nFIQ driven on the processor.
Each status referred to above can be used to optimize the interrupt handling of the systems.
180
Source i
AIC_IPR
AIC_IMR
Edge
Detector
AIC_IECR
Set Clear
FF
AIC_ISCR
AIC_ICCR
AIC_IDCR
AIC_SMRi
SRCTYPE
Level/
Edge
AIC_IPR
AIC_IMR
Source i
Pos./Neg.
Edge
Detector
Set
AIC_ISCR
FF
Clear
AIC_IDCR
AIC_ICCR
181
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 processor. 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.
18.8.2.1 External Interrupt Edge Triggered Source
Figure 18-6.
nIRQ
Maximum IRQ Latency = 4 Cycles
nFIQ
Maximum FIQ Latency = 4 Cycles
182
Maximum FIQ
Latency = 3 Cycles
Maximum FIQ
Latency = 3 Cycles
nIRQ
An 8-level priority controller drives the nIRQ line of the processor, depending on the interrupt conditions occurring
on the interrupt sources 1 to 127.
Each interrupt source has a programmable priority level of 7 to 0, which is user-definable by writing the PRIOR
field of the AIC_SMR (Source Mode Register). Level 7 is the highest priority and level 0 the lowest.
As soon as an interrupt condition occurs, as defined by the SRCTYPE field of the AIC_SMR (Source Mode
Register), the nIRQ line is asserted. As a new interrupt condition might have happened on other interrupt sources
since the nIRQ has been asserted, the priority controller determines the current interrupt at the time the AIC_IVR
(Interrupt Vector Register) is read. The read of AIC_IVR is the entry point of the interrupt handling which allows the
AIC to consider that the interrupt has been taken into account by the software.
The current priority level is defined as the priority level of the current interrupt.
If several interrupt sources of equal priority are pending and enabled when the AIC_IVR is read, the interrupt with
the lowest interrupt source number is serviced first.
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
183
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.
18.8.3.2 Interrupt Nesting
The priority controller utilizes interrupt nesting in order for the high priority interrupt to be handled during the
service of lower priority interrupts. This requires the interrupt service routines of the lower interrupts to re-enable
the interrupt at the processor level.
When an interrupt of a higher priority happens during an already occurring interrupt service routine, the nIRQ line
is re-asserted. If the interrupt is enabled at the core level, the current execution is interrupted and the new interrupt
service routine should read the AIC_IVR. At this time, the current interrupt number and its priority level are pushed
into an embedded hardware stack, so that they are saved and restored when the higher priority interrupt servicing
is finished and the AIC_EOICR is written.
The AIC is equipped with an 8-level wide hardware stack in order to support up to eight interrupt nestings pursuant
to having eight priority levels.
18.8.3.3 Interrupt Vectoring
The interrupt handler address corresponding to the interrupt source selected by the INTSEL field can be stored in
the registers AIC_SVR (Source Vector Register). When the processor reads AIC_IVR (Interrupt Vector Register),
the value written into AIC_SVR corresponding to the current interrupt is returned.
This feature offers a way to branch in one single instruction to the handler corresponding to the current interrupt,
as AIC_IVR is mapped at the absolute address 0xFFFF F100 and thus accessible from the ARM interrupt vector at
address 0x0000 0018 through the following instruction:
LDR
PC,[PC,# -&F20]
When the processor executes this instruction, it loads the read value in AIC_IVR in its program counter, thus
branching the execution on the correct interrupt handler.
18.8.3.4 Interrupt Handlers
This section gives an overview of the fast interrupt handling sequence when using the AIC. It is assumed that the
programmer understands the architecture of the ARM processor, and especially the processor interrupt modes
and the associated status bits.
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, decrementing it by four.
2. The ARM core enters Interrupt mode, if it has not already done so.
3.
184
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.
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 interrupt 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 during 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 indicate 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 interrupt
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 executed before, and of loading the CPSR with the stored SPSR, masking
or unmasking the interrupts depending on the state saved in SPSR_irq.
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 interrupt source 0 is the only source which can raise a fast interrupt request to the processor. The interrupt
source 0 is generally connected to a FIQ pin of the product, either directly or through a PIO Controller.
18.8.4.2 Fast Interrupt Control
The fast interrupt logic of the AIC has no priority controller. The mode of interrupt source 0 is programmed with the
AIC_SMR and INTSEL = 0, the field PRIOR of this register is not used even if it reads what has been written. The
field SRCTYPE of AIC_SMR enables programming the fast interrupt source to be positive-edge triggered or
negative-edge triggered or high-level sensitive or low-level sensitive
Writing 0x1 in the AIC_IECR (Interrupt Enable Command Register) and AIC_IDCR (Interrupt Disable Command
Register) respectively enables and disables the fast interrupt when INTSEL = 0. The bit 0 of AIC_IMR (Interrupt
Mask Register) indicates whether the fast interrupt is enabled or disabled.
18.8.4.3 Fast Interrupt Vectoring
The fast interrupt handler address can be stored through the AIC_SVR (Source Vector Register). The value written
into this register when INTSEL = 0 is returned when the processor reads AIC_FVR (FIQ Vector Register). This
offers a way to branch in one single instruction to the interrupt handler, as AIC_FVR is mapped at the absolute
address 0xFFFF F104 and thus accessible from the ARM fast interrupt vector at address 0x0000 001C through the
following instruction:
LDR
PC,[PC,# -&F20]
185
When the processor executes this instruction it loads the value read in AIC_FVR in its program counter, thus
branching the execution on the fast interrupt handler. It also automatically performs the clear of the fast interrupt
source if it is programmed in edge-triggered mode.
18.8.4.4 Fast Interrupt Handlers
This section gives an overview of the fast interrupt handling sequence when using the AIC. It is assumed that the
programmer understands the architecture of the ARM processor, and especially the processor interrupt modes
and associated status bits.
Assuming that:
1. The Advanced Interrupt Controller has been programmed, AIC_SVR is loaded with the fast interrupt service routine address, and the interrupt source 0 is enabled.
2. The Instruction at address 0x1C (FIQ exception vector address) is required to vector the fast interrupt:
LDR PC, [PC, # -&F20]
3. The user does not need nested fast interrupts.
When nFIQ is asserted, if the bit F of CPSR is 0, the sequence is:
1. The CPSR is stored in SPSR_fiq, the current value of the program counter is loaded in the FIQ link register
(R14_FIQ) and the program counter (R15) is loaded with 0x1C. In the following cycle, during fetch at address
0x20, the ARM core adjusts R14_fiq, decrementing it by four.
2. The ARM core enters FIQ mode.
3.
Routine must read AIC1_CISR register to know if the interrupt is the FIQ or a Secure Internal interrupt.
ldr
r1, =REG_SAIC_CISR
ldr
r1, [r1]
cmp
r1, #AIC_CISR_NFIQ
beq
get_fiqvec_addr
If FIQ is active, it is processed in priority, even if another interrupt is active.
get_irqvec_addr
ldr
b
get_fiqvec_addr
ldr
read_vec
ldr
r14, =REG_SAIC_IVR
read_vec
r14, =REG_SAIC_FVR
r0, [r14]
Now r0 contains the correct vector address, IVR for a Secure Internal interrupt or FVR for FIQ.
System can branch to the routine pointed by r0.
FIQ_Handler_Branch
mov
r14, pc
bx
r0
186
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 registers 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.
18.8.5 Protect Mode
The Protect Mode permits reading the Interrupt Vector Register without performing the associated automatic
operations. This is necessary when working with a debug system. When a debugger, working either with a Debug
Monitor or the ARM processor's ICE, stops the applications and updates the opened windows, it might read the
AIC User Interface and thus the IVR. This has undesirable consequences:
If an enabled interrupt with a higher priority than the current one is pending, it is stacked.
In either case, an End of Interrupt command is necessary to acknowledge and to restore the context of the AIC.
This operation is generally not performed by the debug system as the debug system would become strongly
intrusive and cause the application to enter an undesired state.
This is avoided by using the Protect Mode. Writing PROT in AIC_DCR (Debug Control Register) at 0x1 enables
the Protect Mode.
When the Protect Mode is enabled, the AIC performs interrupt stacking only when a write access is performed on
the AIC_IVR. Therefore, the Interrupt Service Routines must write (arbitrary data) to the AIC_IVR just after reading
it. The new context of the AIC, including the value of the Interrupt Status Register (AIC_ISR), is updated with the
current interrupt only when 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 operations within the AIC:
1. Calculates active interrupt (higher than current or spurious).
2. Determines and returns the vector of the active interrupt.
3.
4.
5.
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.
18.8.6 Spurious Interrupt
The Advanced Interrupt Controller features protection against spurious interrupts. A spurious interrupt is defined
as being the assertion of an interrupt source long enough for the AIC to assert the nIRQ, but no longer present
when AIC_IVR is read. This is most prone to occur when:
An external interrupt source is programmed in level-sensitive mode and an active level occurs for only a
short time.
An internal interrupt source is programmed in level sensitive and the output signal of the corresponding
embedded peripheral is activated for a short time. (As in the case for the Watchdog.)
187
An interrupt occurs just a few cycles before the software begins to mask it, thus resulting in a pulse on the
interrupt source.
The AIC detects a spurious interrupt at the time the AIC_IVR is read while no enabled interrupt source is pending.
When this happens, the AIC returns the value stored by the programmer in the Spurious Vector Register
(AIC_SPU). The programmer must store the address of a spurious interrupt handler in AIC_SPU as part of the
application, to enable an as fast as possible return to the normal execution flow. This handler writes in AIC_EOICR
and performs a return from interrupt.
18.8.7 General Interrupt Mask
The AIC features a General Interrupt Mask bit (GMSK in AIC_DCR) to prevent interrupts from reaching the
processor. Both the nIRQ and the nFIQ lines are driven to their inactive state if the GMSK is set. However, this
mask does not prevent waking up the processor if it has entered Idle Mode. This function facilitates synchronizing
the processor on a next event and, as soon as the event occurs, performs subsequent operations without having
to handle an interrupt. It is strongly recommended to use this mask with caution.
18.8.8 Register Write Protection
To prevent any single software error from corrupting AIC behavior, certain registers in the address space can be
write-protected by setting the WPEN bit in the AIC Write Protection Mode Register (AIC_WPMR).
If a write access to a write-protected register is detected, the WPVS flag in the AIC Write Protection Status
Register (AIC_WPSR) is set and the field WPVSRC indicates the register in which the write access has been
attempted.
The WPVS bit is automatically cleared after reading the AIC_WPSR.
The following registers can be write-protected:
188
18.9
Table 18-3.
Register Mapping
Offset
Register
Name
Access
Reset
0x00
0x04
AIC_SSR
Read/Write
0x0
AIC_SMR
Read/Write
0x0
0x08
AIC_SVR
Read/Write
0x0
0x0C
Reserved
0x10
AIC_IVR
Read-only
0x0
0x14
AIC_FVR
Read-only
0x0
0x18
AIC_ISR
Read-only
0x0
0x1C
Reserved
(2)
AIC_IPR0
Read-only
0x0(1)
0x24
(2)
AIC_IPR1
Read-only
0x0(1)
0x28
AIC_IPR2
Read-only
0x0(1)
0x2C
AIC_IPR3
Read-only
0x0(1)
0x20
0x30
AIC_IMR
Read-only
0x0
0x34
AIC_CISR
Read-only
0x0
0x38
AIC_EOICR
Write-only
0x3C
AIC_SPU
Read/Write
0x0
0x40
AIC_IECR
Write-only
0x44
AIC_IDCR
Write-only
0x48
AIC_ICCR
Write-only
0x4C
AIC_ISCR
Write-only
0x500x5C
Reserved
0x600x68
Reserved
0x6C
AIC_DCR
Read/Write
0x0
0xE4
AIC_WPMR
Read/Write
0x0
0xE8
AIC_WPSR
Read-only
0x0
0xEC0xFC
Reserved
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...PID127 bit fields refer to the identifiers as defined in the Peripheral Identifiers Section of the product datasheet.
189
AIC_SSR
Address:
Access:
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
3
INTSEL
190
AIC_SMR
Address:
Access:
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
1
PRIOR
SRCTYPE
This register can only be written if the WPEN bit is cleared in the AIC Write Protection Mode Register.
PRIOR: Priority Level
Programs the priority level of the source selected by INTSEL in except FIQ source (source 0).
The priority level can be between 0 (lowest) and 7 (highest).
The priority level is not used for the FIQ.
SRCTYPE: Interrupt Source Type
The active level or edge is not programmable for the internal interrupt source selected by INTSEL.
Value
Name
INT_LEVEL_SENSITIVE
INT_EDGE_TRIGGERED
EXT_HIGH_LEVEL
EXT_POSITIVE_EDGE
Description
High level Sensitive for internal source
Low level Sensitive for external source
Positive edge triggered for internal source
Negative edge triggered for external source
High level Sensitive for internal source
High level Sensitive for external source
Positive edge triggered for internal source
Positive edge triggered for external source
191
AIC_SVR
Address:
Access:
Read/Write
Reset:
0x0
31
30
29
28
27
26
25
24
19
18
17
16
11
10
VECTOR
23
22
21
20
VECTOR
15
14
13
12
VECTOR
4
VECTOR
This register can only be written if the WPEN bit is cleared in the AIC Write Protection Mode Register.
VECTOR: Source Vector
The user may store in this register the address of the corresponding handler for the interrupt source selected by INTSEL.
192
AIC_IVR
Address:
Access:
Read-only
Reset:
0x0
31
30
29
28
27
26
25
24
19
18
17
16
11
10
IRQV
23
22
21
20
IRQV
15
14
13
12
IRQV
4
IRQV
193
AIC_FVR
Address:
Access:
Read-only
Reset:
0x0
31
30
29
28
27
26
25
24
19
18
17
16
11
10
FIQV
23
22
21
20
FIQV
15
14
13
12
FIQV
4
FIQV
194
AIC_ISR
Address:
Access:
Read-only
Reset:
0x0
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
3
IRQID
195
AIC_IPR0
Address:
Access:
Read-only
Reset:
0x0
31
PID31
30
PID30
29
PID29
28
PID28
27
PID27
26
PID26
25
PID25
24
PID24
23
PID23
22
PID22
21
PID21
20
PID20
19
PID19
18
PID18
17
PID17
16
PID16
15
PID15
14
PID14
13
PID13
12
PID12
11
PID11
10
PID10
9
PID9
8
PID8
7
PID7
6
PID6
5
PID5
4
PID4
3
PID3
2
PID2
1
SYS
0
FIQ
196
AIC_IPR1
Address:
Access:
Read-only
Reset:
0x0
31
PID63
30
PID62
29
PID61
28
PID60
27
PID59
26
PID58
25
PID57
24
PID56
23
PID55
22
PID54
21
PID53
20
PID52
19
PID51
18
PID50
17
PID49
16
PID48
15
PID47
14
PID46
13
PID45
12
PID44
11
PID43
10
PID42
9
PID41
8
PID40
7
PID39
6
PID38
5
PID37
4
PID36
3
PID35
2
PID34
1
PID33
0
PID32
197
AIC_IPR2
Address:
Access:
Read-only
Reset:
0x0
31
PID95
30
PID94
29
PID93
28
PID92
27
PID91
26
PID90
25
PID89
24
PID88
23
PID87
22
PID86
21
PID85
20
PID84
19
PID83
18
PID82
17
PID81
16
PID80
15
PID79
14
PID78
13
PID77
12
PID76
11
PID75
10
PID74
9
PID73
8
PID72
7
PID71
6
PID70
5
PID69
4
PID68
3
PID67
2
PID66
1
PID65
0
PID64
198
AIC_IPR3
Address:
Access:
Read-only
Reset:
0x0
31
PID127
30
PID126
29
PID125
28
PID124
27
PID123
26
PID122
25
PID121
24
PID120
23
PID119
22
PID118
21
PID117
20
PID116
19
PID115
18
PID114
17
PID113
16
PID112
15
PID111
14
PID110
13
PID109
12
PID108
11
PID107
10
PID106
9
PID105
8
PID104
7
PID103
6
PID102
5
PID101
4
PID100
3
PID99
2
PID98
1
PID97
0
PID96
199
AIC_IMR
Address:
Access:
Read-only
Reset:
0x0
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
0
INTM
200
AIC_CISR
Address:
Access:
Read-only
Reset:
0x0
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
1
NIRQ
0
NFIQ
201
AIC_EOICR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
0
ENDIT
202
AIC_SPU
Address:
Access:
Read/Write
Reset:
0x0
31
30
29
28
27
26
25
24
19
18
17
16
11
10
SIVR
23
22
21
20
SIVR
15
14
13
12
SIVR
4
SIVR
This register can only be written if the WPEN bit is cleared in the AIC Write Protection Mode Register.
SIVR: Spurious Interrupt Vector Register
The user may store the address of a spurious interrupt handler in this register. The written value is returned in AIC_IVR in
case of a spurious interrupt and in AIC_FVR in case of a spurious fast interrupt.
203
AIC_IECR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
0
INTEN
204
AIC_IDCR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
0
INTD
205
AIC_ICCR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
0
INTCLR
206
AIC_ISCR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
0
INTSET
207
AIC_DCR
Address:
Access:
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
1
GMSK
0
PROT
This register can only be written if the WPEN bit is cleared in the AIC Write Protection Mode Register.
PROT: Protection Mode
0: The Protection Mode is disabled.
1: The Protection Mode is enabled.
GMSK: General Interrupt Mask
0: The nIRQ and nFIQ lines are normally controlled by the AIC.
1: The nIRQ and nFIQ lines are tied to their inactive state.
208
AIC_WPMR
Address:
Access:
Read/Write
Reset:
31
30
29
28
27
26
25
24
19
18
17
16
11
10
0
WPEN
WPKEY
23
22
21
20
WPKEY
15
14
13
12
WPKEY
Name
PASSWD
Description
Writing any other value in this field aborts the write operation of the WPEN bit.
Always reads as 0.
209
AIC_WPSR
Address:
Access:
Read-only
Reset:
31
30
29
28
23
22
21
20
27
26
25
24
19
18
17
16
11
10
0
WPVS
WPVSRC
15
14
13
12
WPVSRC
210
19.
19.1
Description
The Watchdog Timer (WDT) is 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 around 32 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.
19.2
19.3
Embedded Characteristics
Counter May Be Stopped while the Processor is in Debug State or in Idle Mode
Block Diagram
Figure 19-1.
WDT_CR
WDRSTT
reload
1
12-bit Down
Counter
WDT_MR
WDD
reload
Current
Value
1/128
SLCK
<= WDD
WDT_MR
WDRSTEN
= 0
wdt_fault
(to Reset Controller)
set
set
read WDT_SR
or
reset
WDERR
reset
WDUNF
reset
wdt_int
WDFIEN
WDT_MR
211
19.4
Functional Description
The Watchdog Timer is 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.
If the watchdog is restarted by writing into the Control register (WDT_CR), WDT_MR must not be programmed
during a period of time of three slow clock periods following the WDT_CR write access. In any case, programming
a new value in WDT_MR automatically initiates a restart instruction.
WDT_MR can be written only once . Only a processor reset resets it. Writing WDT_MR reloads the timer with the
newly programmed mode parameters.
In normal operation, the user reloads the watchdog at regular intervals before the timer underflow occurs, by
writing 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. WDT_CR 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 WDT_MR. Moreover, the bit WDUNF is set
in the 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 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 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 interrupt, provided the bit
WDFIEN is set in WDT_MR. 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 documentation. In this 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 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 WDT_MR.
212
Figure 19-2.
Watchdog Behavior
Watchdog Error
Watchdog Underflow
if WDRSTEN is 1
FFF
if WDRSTEN is 0
Normal behavior
WDV
Forbidden
Window
WDD
Permitted
Window
0
WDT_CR.WDRSTT=1
Watchdog
Fault
213
19.5
Table 19-1.
Register Mapping
Offset
Register
Name
Access
Reset
0x00
Control Register
WDT_CR
Write-only
0x04
Mode Register
WDT_MR
Read/Write Once
0x3FFF_2FFF
0x08
Status Register
WDT_SR
Read-only
0x0000_0000
214
WDT_CR
Address:
0xFC068640
Access:
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
0
WDRSTT
Name
Description
PASSWD
Writing any other value in this field aborts the write operation.
215
WDT_MR
Address:
0xFC068644
Access:
Read/Write Once
31
30
29
WDIDLEHLT
28
WDDBGHLT
27
23
22
21
20
19
11
26
25
24
18
17
16
10
WDD
WDD
15
WDDIS
14
13
12
WDRSTEN
WDFIEN
WDV
3
WDV
Note: The first write access prevents any further modification of the value of this register. Read accesses remain possible.
Note: The WDD and WDV values must not be modified within three slow clock periods following a restart of the watchdog performed by
a write access in WDT_CR. Any modification will cause the watchdog to trigger an end of period earlier than expected.
216
217
WDT_SR
Address:
0xFC068648
Access
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
1
WDERR
0
WDUNF
218
20.
20.1
Description
The Reset Controller (RSTC), based on power-on reset cells, handles all the resets of the system without any
external components. It reports which reset occurred last.
20.2
Embedded Characteristics
20.3
Processor Reset
Either General Reset, Wake-up Reset, Software Reset, User Reset, Watchdog Reset
Block Diagram
Figure 20-1.
Reset Controller
Main Supply
POR
Backup Supply
POR
NRST
Reset
State
Manager
Startup
Counter
NRST
Manager
rstc_irq
proc_nreset
user_reset
periph_nreset
backup_neset
WDRPROC
wd_fault
SLCK
219
20.4
Functional Description
These reset signals are asserted by the Reset Controller, either on external events or on software action. The
Reset State Manager controls the generation of reset signals.
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 Oscillator Characteristics in the Electrical
Characteristics section of the product datasheet.
The Reset Controller Mode Register (RSTC_MR), used to configure the reset controller, is powered with VDDBU,
so that its configuration is saved as long as VDDBU is on.
20.4.2 NRST Manager
The NRST Manager samples the NRST input pin and drives this pin low when required by the Reset State
Manager. Figure 20-2 shows the block diagram of the NRST Manager.
Figure 20-2.
NRST Manager
RSTC_MR
URSTIEN
RSTC_SR
URSTS
NRSTL
RSTC_MR
URSTEN
NRST
rstc_irq
Other
Interrupt
Sources
user_reset
The NRST Manager samples the NRST pin at Slow Clock speed. When the line is detected low, a User Reset is
reported to the Reset State Manager.
However, the NRST Manager can be programmed to not trigger a reset when an assertion of NRST occurs.
Writing a zero to the URSTEN bit in the RSTC_MR disables the User Reset trigger.
The level of the pin NRST can be read at any time in the bit NRSTL (NRST level) in the Reset Controller Status
Register (RSTC_SR). As soon as the pin NRST is asserted, the bit URSTS in the RSTC_SR is set. This bit clears
only when RSTC_SR is read.
The reset controller can also be programmed to generate an interrupt instead of generating a reset. To do so, the
bit URSTIEN in the RSTC_MR must be set.
20.4.3 Reset States
The Reset State Manager handles the different reset sources and generates the internal reset signals. It reports
the reset status in the field RSTTYP of the RSTC_SR. The update of the field RSTTYP is performed when the
processor reset is released.
220
A general reset occurs when VDDBU and VDDCORE are powered on. The backup supply POR cell output rises
and is filtered with a Startup Counter, which operates at Slow Clock. The purpose of this counter is to make sure
the Slow Clock oscillator is stable before starting up the device. The length of startup time is hardcoded to comply
with the Slow Clock Oscillator startup time.
After this time, the processor clock is released at Slow Clock and all the other signals remain valid for 2 cycles for
proper processor and logic reset. Then, all the reset signals are released and the field RSTTYP in the RSTC_SR
reports a General Reset.
When VDDBU is detected low by the backup supply POR cell, all resets signals are immediately 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 20-3 shows how the General Reset affects the reset signals.
Figure 20-3.
SLCK
Any
Freq.
MCK
Backup Supply
POR output
Startup Time
Main Supply
POR output
backup_nreset
Processor Startup
proc_nreset
RSTTYP
XXX
XXX
periph_nreset
2 cycles
The wake-up reset occurs when the main supply is down. When the main supply POR output is active, all the reset
signals are asserted except backup_nreset. When the main supply powers up, the POR output is resynchronized
on Slow Clock. The processor clock is then re-enabled during 2 Slow Clock cycles, depending on the requirements
of the ARM processor.
At the end of this delay, the processor and other reset signals rise. The field RSTTYP in the RSTC_SR is updated
to report a wake-up reset.
When the main supply is detected falling, the reset signals are immediately asserted. This transition is
synchronous with the output of the main supply POR.
221
Figure 20-4.
Wake-up Reset
SLCK
Any
Freq.
MCK
Main Supply
POR output
backup_nreset
Resynch.
2 cycles
Processor Startup
proc_nreset
RSTTYP
XXX
XXX
periph_nreset
4 cycles
The User Reset is entered when a low level is detected on the NRST pin and the bit URSTEN in RSTC_MR is at 1.
The NRST input signal is resynchronized with SLCK to ensure proper behavior of the system.
The Processor Reset and the Peripheral Reset are asserted.
The User Reset is left when NRST rises, after a two-cycle resynchronization time and a 2-cycle processor startup.
The processor clock is re-enabled as soon as NRST is confirmed high.
When the processor reset signal is released, the RSTTYP field of the RSTC_SR is loaded with the value 0x4,
indicating a User Reset.
222
Figure 20-5.
SLCK
MCK
Any
Freq.
NRST
Resynch.
2 cycles
Resync.
2 cycles
Processor Startup
proc_nreset
RSTTYP
Any
XXX
periph_nreset
The Reset Controller offers several commands used to assert the different reset signals. These commands are
performed by writing the Control Register (RSTC_CR) with the following bits at 1:
PROCRST: Writing PROCRST at 1 resets the processor and the watchdog timer.
PERRST: Writing PERRST at 1 resets all the embedded peripherals, including the memory system, and, in
particular, the Remap Command. The Peripheral Reset is generally used for debug purposes.
PERRST must always be used in conjunction with PROCRST (PERRST and PROCRST set both at 1
simultaneously.)
The software reset is entered if at least one of these bits is set by the software. All these commands can be
performed independently or simultaneously. The software reset lasts 2 Slow Clock cycles.
The internal reset signals are asserted as soon as the register write is performed. This is detected on the Master
Clock (MCK). They are released when the software reset is left, i.e., synchronously to SLCK.
If and only if the PROCRST bit is set, the reset controller reports the software status in the field RSTTYP of the
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 Progress) is set in the
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.
223
Figure 20-6.
Software Reset
SLCK
Any
Freq.
MCK
Write RSTC_CR
Resync. Processor Startup
1 to 2 cycles
proc_nreset
if PROCRST=1
RSTTYP
XXX
Any
periph_nreset
if PERRST=1
SRCMP in RSTC_SR
The Watchdog Reset is entered when a watchdog fault occurs. This state lasts 2 Slow Clock cycles.
When in Watchdog Reset, assertion of the reset signals depends on the value of the WDRPROC bit in WDT_MR:
WDRPROC = 0: The Processor Reset and the Peripheral Reset are asserted.
The Watchdog Timer is reset by the proc_nreset signal. As the watchdog fault always causes a processor reset if
WDRSTEN is set, the Watchdog Timer is always reset after a Watchdog Reset and the Watchdog is enabled by
default and with a period set to a maximum.
When the WDRSTEN in WDT_MR bit is reset, the watchdog fault has no impact on the reset controller.
Figure 20-7.
Watchdog Reset
SLCK
MCK
Any
Freq.
wd_fault
Processor Startup
= 2 cycles
proc_nreset
RSTTYP
periph_nreset
(only if WDRPROC = 0)
224
Any
XXX
Backup Reset
Wake-up Reset
Watchdog Reset
Software Reset
User Reset
A watchdog event is impossible because the Watchdog Timer is being reset by the proc_nreset signal.
RSTTYP field: This field gives the type of the last reset, as explained in previous sections.
SRCMP bit: This bit 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: This bit 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. This transition is also detected on
the Master Clock (MCK) rising edge (see Figure 20-8). If the User Reset is disabled (URSTEN = 0 in
RSTC_MR) and if the interruption is enabled by the URSTIEN bit in the RSTC_MR, the URSTS bit triggers
an interrupt. Reading the RSTC_SR resets the URSTS bit and clears the interrupt.
225
Figure 20-8.
Peripheral Access
2 cycle
resynchronization
NRST
NRSTL
URSTS
rstc_irq
if (URSTEN = 0) and
(URSTIEN = 1)
226
2 cycle
resynchronization
20.5
Table 20-1.
Register Mapping
Offset
Register
Name
0x00
Control Register
RSTC_CR
Access
Reset
Write-only
0x04
Status Register
RSTC_SR
Read-only
0x08
Mode Register
RSTC_MR
Read/Write
Notes:
0x0000_0100
Back-up Reset
(1)
0x0000_0000 (2)
0x0000_0000
227
RSTC_CR
Address:
0xFC068600
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
2
PERRST
0
PROCRST
228
Value
Name
0xA5
PASSWD
Description
Writing any other value in this field aborts the write operation.
Always reads as 0.
RSTC_SR
Address:
0xFC068604
Access Type:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
SRCMP
16
NRSTL
15
14
13
12
11
10
9
RSTTYP
0
URSTS
Name
Description
GENERAL_RST
WKUP_RST
VDDCORE rising
WDT_RST
SOFT_RST
USER_RST
229
RSTC_MR
Address:
0xFC068608
Access Type:
Read/Write
31
30
29
28
27
26
25
24
KEY
23
22
21
20
19
18
17
16
15
14
13
12
11
10
4
URSTIEN
0
URSTEN
230
Value
Name
0xA5
PASSWD
Description
Writing any other value in this field aborts the write operation.
Always reads as 0.
21.
21.1
Description
The Shutdown Controller (SHDWC) controls the power supplies VDDIO and VDDCORE and the wake-up
detection on debounced input lines.
21.2
Embedded Characteristics
21.3
Block Diagram
Figure 21-1.
SHDW_MR
CPTWK1
Security
Event
WKMODE1
read SHDW_SR
reset
WAKEUP1 SHDW_SR
set
WKUP1(1)
SHDW_MR
CPTWK0
WKMODE0
read SHDW_SR
reset
WAKEUP0 SHDW_SR
set
WKUP0
read SHDW_SR
or
Wake-up
reset
RTCWKEN SHDW_MR
RTC Alarm
RTCWK
Shutdown
Output
Controller
SHDW_SR
set
SHDN
SHDW_CR
SHDW
Shutdown
231
21.4
21.5
Name
Description
Type
WKUP0
Wake-up 0 input
Input
SHDN
Shutdown output
Output
Product Dependencies
21.6
Functional Description
The Shutdown Controller manages the main power supply. To do so, it is supplied with VDDBU and manages
wake-up input pins and one output pin, SHDN.
A typical application connects the pin SHDN to the shutdown input of the DC/DC Converter providing the main
power supplies of the system, and especially VDDCORE and/or VDDIO. The wake-up inputs (WKUP0, WKUP1)
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 two 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 or WKUP1 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 and WKUP1. The detection can also be disabled. Programming is performed by defining
WKMODE0 and WKMODE1.
Moreover, a debouncing circuit can be programmed for WKUP0 or WKUP1. The debouncing circuit filters pulses
on WKUP0 or WKUP1 shorter than the programmed number of 16 SLCK cycles in CPTWK0 or CPTWK1 of the
SHDW_MR. 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 or CPTWK1, the SHDN pin is released. If a new input
change is detected before the counter reaches the corresponding value, the counter is stopped and cleared.
WAKEUP0 and/or WAKEUP1 of the Status Register (SHDW_SR) reports the detection of the programmed events
on WKUP0 or WKUP1, with a reset after the read of SHDW_SR.
The Shutdown Controller can be programmed so as to activate the wake-up using the RTC alarm (the detection of
the rising edge of the RTC alarm is synchronized with SLCK). This is done by writing the SHDW_MR using the
RTCWKEN field. When enabled, the detection of RTC alarm is reported in the RTCWK bit of the SHDW_SR. They
are reset after the read of SHDW_SR. When using the RTC alarm to wake up the system, the user must ensure
that RTC alarm status flag is cleared before shutting down the system. Otherwise, no rising edge of the status
flags may be detected and the wake-up will fail.
232
21.7
Table 21-2.
Register Mapping
Offset
Register
Name
Access
Reset
0x00
SHDW_CR
Write-only
0x04
SHDW_MR
Read/Write
0x0000_0303
0x08
SHDW_SR
Read-only
0x0000_0000
233
SHDW_CR
Address:
0xFC068610
Access:
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
0
SHDW
Name
Description
0xA5
PASSWD
Writing any other value in this field aborts the write operation.
234
SHDW_MR
Address:
0xFC068614
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
RTCWKEN
16
15
14
13
12
11
10
CPTWK1
7
CPTWK0
WKMODE1
0
WKMODE0
Name
Description
NO_DETECTION
RISING_EDGE
FALLING_EDGE
ANY_EDGE
Name
Description
NO_DETECTION
RISING_EDGE
FALLING_EDGE
ANY_EDGE
235
SHDW_SR
Address:
0xFC068618
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
RTCWK
16
15
14
13
12
11
10
1
WAKEUP1
0
WAKEUP0
236
22.
22.1
Description
The Periodic Interval Timer (PIT) provides the operating systems scheduler interrupt. It is designed to offer
maximum accuracy and efficient management, even for systems with long response time.
22.2
22.3
Embedded Characteristics
Reset-on-read Feature
Block Diagram
Figure 22-1.
PIV
PIT_MR
PITIEN
set
PIT_SR
PITS
pit_irq
reset
MCK
Prescaler
22.4
12-bit
Adder
read PIT_PIVR
20-bit
Counter
MCK/16
CPIV
PIT_PIVR
CPIV
PIT_PIIR
PICNT
PICNT
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 Register (PIT_SR) rises and triggers an interrupt,
provided the interrupt is enabled (PITIEN in PIT_MR).
237
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 bit 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 example, 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 22-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.
Figure 22-2.
APB cycle
MCK
15
restarts MCK Prescaler
MCK Prescaler 0
PITEN
CPIV
PICNT
PIV - 1
0
PIV
1
PITS (PIT_SR)
APB Interface
read PIT_PIVR
238
0
0
22.5
Table 22-1.
Register Mapping
Offset
Register
Name
Access
Reset
0x00
Mode Register
PIT_MR
Read/Write
0x000F_FFFF
0x04
Status Register
PIT_SR
Read-only
0x0000_0000
0x08
PIT_PIVR
Read-only
0x0000_0000
0x0C
PIT_PIIR
Read-only
0x0000_0000
239
PIT_MR
Address:
0xFC068630
Access:
Read/Write
31
30
29
28
27
26
25
PITIEN
24
PITEN
23
22
21
20
19
18
17
16
15
14
13
12
PIV
11
10
PIV
7
4
PIV
240
PIT_SR
Address:
0xFC068634
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
0
PITS
241
PIT_PIVR
Address:
0xFC068638
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
PICNT
23
22
21
20
PICNT
15
14
CPIV
13
12
11
10
CPIV
7
4
CPIV
242
PIT_PIIR
Address:
0xFC06863C
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
PICNT
23
22
21
20
PICNT
15
14
CPIV
13
12
11
10
CPIV
7
4
CPIV
243
23.
23.1
Description
The Real-time Clock (RTC) peripheral is designed for very low power consumption. For optimal functionality, the
RTC requires an accurate external 32.768 kHz clock, which can be provided by a crystal oscillator.
It combines a complete time-of-day clock with alarm and a two-hundred-year Gregorian or Persian calendar,
complemented by a programmable periodic interrupt. The alarm and calendar registers are accessed by a 32-bit
data bus.
The time and calendar values are coded in binary-coded decimal (BCD) format. The time format can be 24-hour
mode or 12-hour mode with an AM/PM indicator. Updating time and calendar fields and configuring the alarm
fields are performed by a parallel capture on the 32-bit data bus. An entry control is performed to avoid loading
registers with incompatible BCD format data or with an incompatible date according to the current
month/year/century.
A clock divider calibration circuitry can be used to compensate for crystal oscillator frequency inaccuracy.
TimeStamping capability reports the first and last occurence of tamper events.
23.2
244
Embedded Characteristics
Safety/security features:
23.3
Block Diagram
Figure 23-1.
32768 Divider
Time
Date
Clock Calibration
APB
23.4
User Interface
Entry
Control
Alarm
Interrupt
Control
RTC Interrupt
Product Dependencies
23.5
Peripheral IDs
Instance
ID
RTC
Functional Description
The RTC provides a full binary-coded decimal (BCD) clock that includes century (19/20), year (with leap years),
month, date, day, hours, minutes and seconds reported in RTC Time Register (RTC_TIMR) and RTC Calendar
Register (RTC_CALR).
The valid year range is 1900 to 2099 in Gregorian mode, a two-hundred-year calendar (or 1300 to 1499 in Persian
mode).
The RTC can operate in 24-hour mode or in 12-hour mode with an AM/PM indicator.
Corrections for leap years are included (all years divisible by 4 being leap years except 1900). This is correct up to
the year 2099.
245
During low power modes of the processor, the oscillator runs and power consumption is critical. The crystal
selection has to take into account the current consumption for power saving and the frequency drift due to
temperature effect on the circuit for time accuracy.
23.5.2 Timing
The RTC is updated in real time at one-second intervals in normal mode for the counters of seconds, at oneminute intervals for the counter of minutes and so on.
Due to the asynchronous operation of the RTC with respect to the rest of the chip, to be certain that the value read
in the RTC registers (century, year, month, date, day, hours, minutes, seconds) are valid and stable, it is
necessary to read these registers twice. If the data is the same both times, then it is valid. Therefore, a minimum of
two and a maximum of three accesses are required.
23.5.3 Alarm
The RTC has five programmable fields: month, date, hours, minutes and seconds.
Each of these fields can be enabled or disabled to match the alarm condition:
If all the fields are enabled, an alarm flag is generated (the corresponding flag is asserted and an interrupt
generated if enabled) at a given month, date, hour/minute/second.
If only the seconds field is enabled, then an alarm is generated every minute.
Depending on the combination of fields enabled, a large number of possibilities are available to the user ranging
from minutes to 365/366 days.
Hour, minute and second matching alarm (SECEN, MINEN, HOUREN) can be enabled independently of SEC,
MIN, HOUR fields.
Note:
To change one of the SEC, MIN, HOUR, DATE, MONTH fields, it is recommended to disable the field before changing
the value and then re-enable it after the change has been made. This requires up to three accesses to the
RTC_TIMALR or RTC_CALALR. The first access clears the enable corresponding to the field to change (SECEN,
MINEN, HOUREn, DATEEN, MTHEN). If the field is already cleared, this access is not required. The second access
performs the change of the value (SEC, MIN, HOUR, DATE, MONTH). The third access is required to re-enable the
field by writing 1 in SECEN, MINEN, HOUREn, DATEEN, MTHEN fields.
246
2.
3.
4.
5.
6.
Hour (BCD checks: in 24-hour mode, check range 0023 and check that AM/PM flag is not set if RTC is set
in 24-hour mode; in 12-hour mode check range 0112)
7.
8.
Note:
If the 12-hour mode is selected by means of the RTC_MR, a 12-hour value can be programmed and the returned
value on RTC_TIMR will be the corresponding 24-hour value. The entry control checks the value of the AM/PM
indicator (bit 22 of RTC_TIMR) to determine the range to be checked.
247
Figure 23-2.
Update Sequence
Begin
Read RTC_SR
Polling or
IRQ (if enabled)
ACKUPD
=1?
No
Yes
End
248
Below 1 ppm, for an initial crystal drift between 1.5 ppm up to 90 ppm
Below 2 ppm, for an initial crystal drift between 90 ppm up to 130 ppm
Below 5 ppm, for an initial crystal drift between 130 ppm up to 200 ppm
The calibration circuitry acts by slightly modifying the 1 Hz clock period from time to time. When the period is
modified, depending on the sign of the correction, the 1 Hz clock period increases or reduces by around 4 ms.
According to the CORRECTION, NEGPPM and HIGHPPM values configured in the RTC Mode Register
(RTC_MR), the period interval between two correction events differs.
The inaccuracy of a crystal oscillator at typical room temperature (20 ppm at 2025 C) can be compensated if a
reference clock/signal is used to measure such inaccuracy. This kind of calibration operation can be set up during
the final product manufacturing by means of measurement equipment embedding such a reference clock. The
correction of value must be programmed into the (RTC_MR), and this value is kept as long as the circuitry is
powered (backup area). Removing the backup power supply cancels this calibration. This room temperature
calibration can be further processed by means of the networking capability of the target application.
In any event, this adjustment does not take into account the temperature variation.
The frequency drift (up to -200 ppm) due to temperature variation can be compensated using a reference time if
the application can access such a reference. If a reference time cannot be used, a temperature sensor can be
placed close to the crystal oscillator in order to get the operating temperature of the crystal oscillator. Once
obtained, the temperature may be converted using a lookup table (describing the accuracy/temperature curve of
the crystal oscillator used) and RTC_MR configured accordingly. The calibration can be performed on-the-fly. This
adjustment method is not based on a measurement of the crystal frequency/drift and therefore can be improved by
means of the networking capability of the target application.
If no crystal frequency adjustment has been done during manufacturing, it is still possible to do it. In the case
where a reference time of the day can be obtained through LAN/WAN network, it is possible to calculate the drift of
the application crystal oscillator by comparing the values read on RTC Time Register (RTC_TIMR) and
programming the HIGHPPM and CORRECTION fields on RTC_MR according to the difference measured
between the reference time and those of RTC_TIMR.
23.5.8 Tamper Timestamping
As soon as a tamper is detected, the tamper counter is incremented and the RTC stores the time of the day, the
date and the source of the tamper event in registers located in the backup area. Up to two tamper events can be
stored.
The tamper counter saturates at 15. Once this limit is reached, the exact number of tamper occurrence since the
last read of stamping registers cannot be known.
The first set of timestamping registers (RTC_TSTR0, RTC_TSDR0, RTC_TSSR0) cannot be overwritten, so once
they have been written all data are stored until the registers are reset.Therefore these registers are storing the first
tamper occurrence after a read.
249
The second set of timestamping registers (RTC_TSTR1, RTC_TSDR1, RTC_TSSR1) are overwritten each time a
tamper event is detected. This implies that the date and the time data of the first and the second stamping
registers may be equal. This occurs when the tamper counter value carried on field TEVCNT in RTC_TSTR0
equals to 1. Thus this second set of registers allows to store the last occurrence of tamper before a read.
Reading a set of timestamping register requires three accesses, one for the time of the day, one for the date and
one for the tamper source.
Reading the third part (RTC_TSSR0/1) of a timestamping registers set clears the whole content of the registers
(time, date and tamper source) and makes it available to store a new event.
250
23.6
Table 23-2.
Offset
Register Mapping
Register
Name
Access
Reset
0x00
Control Register
RTC_CR
Read/Write
0x0
0x04
Mode Register
RTC_MR
Read/Write
0x0
0x08
Time Register
RTC_TIMR
Read/Write
0x0
0x0C
Calendar Register
RTC_CALR
Read/Write
0x01E111220
0x10
RTC_TIMALR
Read/Write
0x0
0x14
RTC_CALALR
Read/Write
0x01010000
0x18
Status Register
RTC_SR
Read-only
0x0
0x1C
RTC_SCCR
Write-only
0x20
RTC_IER
Write-only
0x24
RTC_IDR
Write-only
0x28
RTC_IMR
Read-only
0x0
0x2C
RTC_VER
Read-only
0x0
0xB0
RTC_TSTR0
Read-only
0x0
0xB4
RTC_TSDR0
Read-only
0x0
0xB8
RTC_TSSR0
Read-only
0x0
0xBC
RTC_TSTR1
Read-only
0x0
0xC0
RTC_TSDR1
Read-only
0x0
0xC4
RTC_TSSR1
Read-only
0x0
0xC8
Reserved
0xD0
Reserved
0xD40xF8
Reserved
0xFC
Reserved
251
RTC_CR
Address:
0xFC0686B0
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
15
14
13
12
11
10
16
CALEVSEL
9
TIMEVSEL
UPDCAL
UPDTIM
This register can only be written if the WPEN bit is cleared in the System Controller Write Protection Mode Register
(SYSC_WPMR).
UPDTIM: Update Request Time Register
0: No effect.
1: Stops the RTC time counting.
Time counting consists of second, minute and hour counters. Time counters can be programmed once this bit is set and
acknowledged by the bit ACKUPD of the RTC_SR.
UPDCAL: Update Request Calendar Register
0: No effect.
1: Stops the RTC calendar counting.
Calendar counting consists of day, date, month, year and century counters. Calendar counters can be programmed once
this bit is set and acknowledged by the bit ACKUPD of the RTC_SR.
TIMEVSEL: Time Event Selection
The event that generates the flag TIMEV in RTC_SR depends on the value of TIMEVSEL.
Value
Name
Description
MINUTE
Minute change
HOUR
Hour change
MIDNIGHT
NOON
Name
Description
WEEK
MONTH
YEAR
252
RTC_MR
Address:
0xFC0686B4
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
HIGHPPM
CORRECTION
NEGPPM
PERSIAN
HRMOD
This register can only be written if the WPEN bit is cleared in the System Controller Write Protection Mode Register
(SYSC_WPMR).
HRMOD: 12-/24-hour Mode
0: 24-hour mode is selected.
1: 12-hour mode is selected.
PERSIAN: PERSIAN Calendar
0: Gregorian calendar.
1: Persian calendar.
NEGPPM: NEGative PPM Correction
0: Positive correction (the divider will be slightly higher than 32768).
1: Negative correction (the divider will be slightly lower than 32768).
Refer to CORRECTION and HIGHPPM field descriptions.
Note: NEGPPM must be cleared to correct a crystal slower than 32.768 kHz.
253
254
RTC_TIMR
Address:
0xFC0686B8
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
AMPM
15
14
10
HOUR
13
12
11
MIN
6
SEC
255
RTC_CALR
Address:
0xFC0686BC
Access:
Read/Write
31
30
23
22
29
28
27
21
20
19
DAY
15
14
26
25
24
18
17
16
DATE
MONTH
13
12
11
10
YEAR
7
CENT
256
RTC_TIMALR
Address:
0xFC0686C0
Access:
Read/Write
31
30
29
28
27
26
25
24
21
20
19
18
17
16
10
23
22
HOUREN
AMPM
15
14
HOUR
13
12
MINEN
7
11
MIN
6
SECEN
SEC
This register can only be written if the WPEN bit is cleared in the System Controller Write Protection Mode Register
(SYSC_WPMR).
Note: To change one of the SEC, MIN, HOUR fields, it is recommended to disable the field before changing the value and then reenable it after the change has been made. This requires up to three accesses to the RTC_TIMALR. The first access clears the
enable corresponding to the field to change (SECEN, MINEN, HOUREN). If the field is already cleared, this access is not
required. The second access performs the change of the value (SEC, MIN, HOUR). The third access is required to re-enable the
field by writing 1 in SECEN, MINEN, HOUREN fields.
257
RTC_CALALR
Address:
0xFC0686C4
Access:
Read/Write
31
30
DATEEN
29
28
27
26
25
24
18
17
16
DATE
23
22
21
MTHEN
20
19
15
14
13
12
11
10
MONTH
This register can only be written if the WPEN bit is cleared in the System Controller Write Protection Mode Register
(SYSC_WPMR).
Note: To change one of the DATE, MONTH fields, it is recommended to disable the field before changing the value and then re-enable
it after the change has been made. This requires up to three accesses to the RTC_CALALR. The first access clears the enable
corresponding to the field to change (DATEEN, MTHEN). If the field is already cleared, this access is not required. The second
access performs the change of the value (DATE, MONTH). The third access is required to re-enable the field by writing 1 in
DATEEN, MTHEN fields.
258
RTC_SR
Address:
0xFC0686C8
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TDERR
CALEV
TIMEV
SEC
ALARM
ACKUPD
Name
Description
FREERUN
UPDATE
Name
Description
NO_ALARMEVENT
ALARMEVENT
Name
Description
NO_SECEVENT
SECEVENT
At least one second event has occurred since the last clear.
Name
Description
NO_TIMEVENT
TIMEVENT
At least one time event has occurred since the last clear.
Note: The time event is selected in the TIMEVSEL field in the Control Register (RTC_CR) and can be any one of the following events:
minute change, hour change, noon, midnight (day change).
Name
Description
NO_CALEVENT
CALEVENT
At least one calendar event has occurred since the last clear.
Note: The calendar event is selected in the CALEVSEL field in the Control Register (RTC_CR) and can be any one of the following
events: week change, month change and year change.
259
260
Name
Description
CORRECT
The internal free running counters are carrying valid values since the last read of the Status
Register (RTC_SR).
ERR_TIMEDATE
The internal free running counters have been corrupted (invalid date or time, non-BCD
values) since the last read and/or they are still invalid.
RTC_SCCR
Address:
0xFC0686CC
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TDERRCLR
CALCLR
TIMCLR
SECCLR
ALRCLR
ACKCLR
261
RTC_IER
Address:
0xFC0686D0
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TDERREN
CALEN
TIMEN
SECEN
ALREN
ACKEN
262
RTC_IDR
Address:
0xFC0686D4
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TDERRDIS
CALDIS
TIMDIS
SECDIS
ALRDIS
ACKDIS
263
RTC_IMR
Address:
0xFC0686D8
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
CAL
TIM
SEC
ALR
ACK
264
RTC_VER
Address:
0xFC0686DC
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
NVCALALR
NVTIMALR
NVCAL
NVTIM
265
RTC_TSTR0
Address:
0xFC068760
Access:
Read-only
31
30
29
28
BACKUP
23
22
21
20
AMPM
15
14
26
25
24
18
17
16
10
TEVCNT
19
HOUR
13
12
27
11
MIN
6
SEC
266
RTC_TSTR1
Address:
0xFC06876C
Access:
Read-only
31
30
29
28
27
26
25
24
BACKUP
23
22
21
20
19
18
17
16
AMPM
15
14
10
HOUR
13
12
11
MIN
6
SEC
267
RTC_TSDRx
Address:
Access:
Read-only
31
30
23
22
29
28
27
21
20
19
DAY
15
14
26
25
24
18
17
16
DATE
MONTH
13
12
11
10
YEAR
7
CENT
268
RTC_TSSRx
Access:
Read-only
31
30
29
28
27
26
25
24
DET15
DET14
DET13
DET12
DET11
DET10
DET9
DET8
23
22
21
20
19
18
17
16
DET7
DET6
DET5
DET4
DET3
DET2
DET1
DET0
15
14
13
12
11
10
VDDIOH
VDDIOL
VDDCOREH
VDDCOREL
VDDBUH
VDDBUL
VDDRH
VDDRL
TPMH
TPML
MCKM
REGUL
JTAG
TST
DBLFM
SHLDM
The following configuration values are valid for all listed bit names of this register:
0: No alarm generated since the last clear.
1: An alarm has been generated by the corresponding monitor since the last clear.
SHLDM: Shield Monitor
DBLFM: Double Frequency Monitor
TST: Test Pin Monitor
JTAG: JTAG Pins Monitor
REGUL: Core Regulator Disconnection Monitor
MCKM: Master Clock Monitor
TPML: Low Temperature Monitor
TPMH: High Temperature Monitor
VDDBUL: Low VDDBU Voltage Monitor
VDDBUH: High VDDBU Voltage Monitor
VDDCOREL: Low VDDCORE Voltage Monitor
VDDCOREH: High VDDCORE Voltage Monitor
VDDIOL: Low VDDIO Voltage Monitor
VDDIOH: High VDDIO Voltage Monitor
VDDRL: Low VDDDDR Voltage Monitor
VDDRH: High VDDDDR Voltage Monitor
DETx: PIOBU Intrusion Detector
269
24.
24.1
Description
The System Controller embeds a Slow Clock Controller.
The slow clock can be generated either by an external 32768 Hz crystal oscillator or by the on-chip 32 kHz RC
oscillator. The internal 32 kHz RC oscillator and the 32768 Hz oscillator are always enabled as soon as VDDBU is
established. The OSCSEL command selects the slow clock source.
24.2
270
Embedded Characteristics
VDDBU Powered
24.3
Block Diagram
Figure 24-1.
Block Diagram
On Chip
RC OSC
Slow Clock
SLCK
XIN32
Slow Clock
Oscillator
XOUT32
OSCSEL
OSCSEL bit is located in the Slow Clock Controller Configuration Register (SCKC_CR) located at the address
0xFC068650 in the backed-up part of the System Controller and, thus, it is preserved while VDDBU is present.
After the VDDBU power-on reset, the default configuration is OSCSEL = 0, allowing the system to start on the
internal 64 kHz RC oscillator.
The programmer controls the slow clock switching by software and so must take precautions during the switching
phase.
24.3.1 Switch from Internal 32 kHz RC Oscillator to 32768 Hz Crystal Oscillator
To switch from the internal 32 kHz RC oscillator to the 32768 Hz crystal oscillator, the programmer must execute
the following sequence:
Switch the master clock to a source different from slow clock (PLL or Main Oscillator) through the Power
Management Controller.
Switch from internal 32 kHz RC oscillator to 32768 Hz oscillator by writing a 1 to the OSCSEL bit.
Switch the master clock to a source different from slow clock (PLL or Main Oscillator).
271
24.4
Table 24-1.
Offset
0x0
272
Register Mapping
Register
Name
SCKC_CR
Access
Reset
Read/Write
0x0000_0001
SCKC_CR
Address:
0xFC068650
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
3
OSCSEL
273
25.
25.1
Description
The Secure Fuse Controller (SFC) interfaces the system with electrical fuses in a secure way.
The default value of a fuse is logic 0 (not programmed). A programmed fuse is logic 1.
Electrical fuse is a type of non-volatile memory which can be programmed only one time.
For this reason, they are also named OTP bits (One Time Programmable). They are typically used to store
calibration bits for analog cells such as oscillators, configuration settings, chip identifiers or cryptographic keys.
Up to 256 fuse bits are programmed by Atmel during the production tests through the test interface. The remaining
512 fuse bits are programmed by the user and by software through the user interface.
The SFC automatically reads the fuse values on start-up and stores them in 32-bit registers in order to make them
accessible by the software. Only fuses set to level 1 are programmed.
Several security mechanisms make irregular data recovery more complex to achieve.
25.2
274
Embedded Characteristics
Up to 768 fuse bits partitioned into 2 areas, 256-bit reserved for Atmel and 512-bit for user area
Detection of irregular alteration of the fuse states in Atmel during start-up and report
25.3
Block Diagram
Figure 25-1.
AHB
Fuse States
Fuse States
User
Interface
Bridge
APB
Fuse Cell(s)
SFC
(Secure Fuse Controller)
Controls
Fuse cells
protocol
security_
error
sfc_int
Security
Controller
AIC
Interrupt Controller
CHIP Boundary
25.4
Functional Description
275
The fuse states are automatically latched at core start-up and are available for reading in the Data Registers
(SFC_DRx).
The fuse states of bits 0 to 31 will be available in the Data Register 0 (SFC_DR0), the fuse states of bits 32 to 63
will be available in the Data Register 1 (SFC_DR1) and so on.
When fuse programming is performed, the fuse states are automatically updated in the Data Registers
(SFC_DRx).
25.4.4.2 Fuse Programming
All the fuses can be written by software. However a fuse can be programmed only if the corresponding area is not
locked yet.
The sequence of instructions to program fuses is the following:
1. Write the key code 0xFB in the Key Register (SFC_KR).
2. Write the word to program in the corresponding Data Register (SFC_DRx).
For example, if the fuses 0 to 31 must be programmed, the Data Register 0 (SFC_DR0) must be written. If
the fuses 32 to 61 must be programmed, the Data Register 1 (SFC_DR1) must be written. Only the data bits
set to level 1 will be programmed.
3.
Wait for the flag PGMC to rise in the Status Register (SFC_SR) by polling or interrupt.
It is possible to mask a fuse array. Once the fuse masking is enabled, the data registers from SFC_DR to
SFC_DR7 will be read at a value of 0, regardless of the fuse state (the registers that are masked depend on the
SFC hardware customization).
To activate fuse masking, the MSK bit of the SFC Mode Register (SFC_MR) must be written to level 1. The MSK
bit is set-only. Only a hardware reset can disable fuse masking.
25.4.5 Specific Fuse Function
Some fuses have a specific function in the user area.
The JTAG access can be disabled if the fuse index 511 is programmed with 1.
The SECURE DEBUG can be disabled if the fuse index 510 is programmed with 1.
If standard boot is used, fuse bits 0509 can be used as general purpose bits. If secure boot is used, please refer
to the application note included in the Secure Package.
276
25.5
Table 25-1.
Register Mapping
Offset
Register
Name
Access
Reset
0x00
SFC_KR
Write-only
0X04
SFC_MR
Read/Write
0x0
0X080x0C
Reserved
0x10
SFC_IER
Read/Write
0x0
0x14
SFC_IDR
Read/Write
0x0
0x18
SFC_IMR
Read-only
0x0
0x1C
SFC_SR
Read-only
0x0
0x20
SFC_DR0
Read/Write
0x0
0x24
SFC_DR1
Read/Write
0x0
0x28
SFC_DR2
Read/Write
0x0
0x2C
SFC_DR3
Read/Write
0x0
0x30
SFC_DR4
Read/Write
0x0
0x34
SFC_DR5
Read/Write
0x0
0x38
SFC_DR6
Read/Write
0x0
0x3C
SFC_DR7
Read/Write
0x0
0x40
SFC_DR8
Read/Write
0x0
0x44
SFC_DR9
Read/Write
0x0
0x48
SFC_DR10
Read/Write
0x0
0x4C
SFC_DR11
Read/Write
0x0
0x50
SFC_DR12
Read/Write
0x0
0x54
SFC_DR13
Read/Write
0x0
0x58
SFC_DR14
Read/Write
0x0
0x5C
SFC_DR15
Read/Write
0x0
0x60
SFC_DR16
Read/Write
0x0
0x64
SFC_DR17
Read/Write
0x0
0x68
SFC_DR18
Read/Write
0x0
0x6C
SFC_DR19
Read/Write
0x0
0x70
SFC_DR20
Read/Write
0x0
0x74
SFC_DR21
Read/Write
0x0
0x78
SFC_DR22
Read/Write
0x0
0x7C
SFC_DR23
Read/Write
0x0
0x800xFC
Reserved
277
SFC_KR
Address:
0xFC060000
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
KEY
278
SFC_MR
Address:
0xFC060004
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
0
MSK
279
SFC_IER
Address:
0xFC060010
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
ACE
16
APLE
15
14
13
12
11
10
0
PGMC
The following configuration values are valid for all listed bit names of this register:
0: No effect
1: Enables the corresponding interrupt
PGMC: Programming Sequence Completed Interrupt Enable
APLE: Atmel Programming Lock Error Interrupt Enable
ACE: Atmel Check Error Interrupt Enable
280
SFC_IDR
Address:
0xFC060014
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
ACE
16
APLE
15
14
13
12
11
10
0
PGMC
The following configuration values are valid for all listed bit names of this register:
0: No effect
1: Disables the corresponding interrupt
PGMC: Programming Sequence Completed Interrupt Disable
APLE: Atmel Programming Lock Error Interrupt Disable
ACE: Atmel Check Error Interrupt Disable
281
SFC_IMR
Address:
0xFC060018
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
ACE
16
APLE
15
14
13
12
11
10
0
PGMC
The following configuration values are valid for all listed bit names of this register:
0: Corresponding interrupt is not enabled.
1: Corresponding interrupt is enabled.
PGMC: Programming Sequence Completed Interrupt Mask
APLE: Atmel Programming Lock Error Interrupt Mask
ACE: Atmel Check Error Interrupt Mask
282
SFC_SR
Address:
0xFC06001C
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
ACE
16
APLE
15
14
13
12
11
10
0
PGMC
283
SFC_DRx
Address:
0xFC060020
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
DATA
23
22
21
20
DATA
15
14
13
12
DATA
4
DATA
284
26.
Clock Generator
26.1
Description
The Clock Generator User Interface is embedded within the Power Management Controller and is described in
Section 27.17 Power Management Controller (PMC) User Interface. However, the Clock Generator registers are
named CKGR_.
26.2
Embedded Characteristics
The Clock Generator is made up of:
480 MHz UTMI PLL providing a clock for the USB High Speed Device Controller
600 to 1200 MHz programmable PLL (input from 8 to 50 MHz), capable of providing the clock MCK to the
processor and to the peripherals (HCLOCK and PCLOCK)
SLCK, the Slow Clock, which is the only permanent clock within the system
MAINCK is the output of the Main Clock Oscillator selection: either 12 MHz Crystal Oscillator or 12 MHzFast
RC Oscillator
PLLACK is the output of the Divider and 600 to 1200 programmable PLL (PLLA)
The Power Management Controller also provides the following operations on clocks:
Frequency counter on main clock and an on-the-fly adjustable main RC oscillator frequency
285
26.3
Block Diagram
Figure 26-1.
Slow Clock
SLCK
Slow Clock
Oscillator
OSCSEL
XOUT32
MOSCSEL
On-chip
12 MHz RC Osc
XIN
Main Clock
MAINCK
12 MHz
Main
Oscillator
XOUT
UPLLCK
UPLL
PLLA and
Divider
PLLA Clock
PLLACK
PLLADIV2
Status
Control
Power
Management
Controller
The internal 32 kHz RC oscillator and the 12 MHz RC oscillator are always enabled when VDDBU is present.
26.4
On-chip
12 MHz
RC Oscillator
Main Clock
XIN
XOUT
Main Clock
Oscillator
MOSCSEL
SMDCK
MOSCXTEN
MOSCXTBY
286
MOSCXTEN, MOSCSEL and MOSCXTBY bits are located in the PMC Clock Generator Main Oscillator Register
(CKGR_MOR).
After a VDDBU power on reset, the default configuration is MOSCXTEN = 0 and MOSCSEL = 0, the 12 MHz RC
is started as Main clock.
26.4.1
26.4.2
Switch from internal 12 MHz RC to the 12 MHz oscillator by writing a 1 to bit MOSCSEL.
26.4.3
Switch from the 12 MHz Crystal Oscillator to internal 12 MHz Fast RC Oscillator
The same procedure must be followed to switch from a 12 MHz crystal oscillator to the internal 12 MHz Fast RC
Oscillator.
Switch from 12 MHz oscillator to the internal 12 MHz Fast RC Oscillator by writing a 0 to bit MOSCSEL.
287
26.5
Main Clock
Figure 26-3.
On-chip
12 MHz RC
Oscillator
MOSCSEL
MOSCSELS
1
MAINCK
MOSCXTEN
Main Clock
0
XIN
XOUT
12 MHz
Crystal
Oscillator
MOSCXTCNT
SLCK
Slow Clock
12 MHz
Crystal Oscillator
Counter
MOSCXTS
MOSCXTEN
MOSCSEL
Main Clock
MAINF
Frequency
Counter
MAINRDY
26.5.1
288
26.5.2
26.5.3
Switching Main Clock between the Main RC Oscillator and Fast Crystal Oscillator
Both sources must be enabled during the switch operation. Only after completion can the unused oscillator be
disabled. If switching to Fast Crystal Oscillator, the clock presence must first be checked according to what is
described in Section 26.5.4 Software Sequence to Detect the Presence of Fast Crystal because the source may
not be reliable (crystal failure or bypass on a non-existent clock).
26.5.4
3.
The fast crystal must be enabled by programming 1 in the MOSCXTEN field in the CKGR_MOR, with the
MOSCXTST field being programmed to the appropriate value (see the electrical characteristics section).
4.
Wait for the MOSCXTS flag to be 1 in the PMC_SR to allow the start-up period of the fast crystal oscillator to
end.
5.
MOSCSEL must be programmed to 1 in the CKGR_MOR to select the fast main crystal oscillator for the
main clock.
6.
7.
MOSCSELS = 1: There is a valid crystal connected and its frequency can be determined by initiating a
frequency measure by programming RCMEAS in the CKGR_MCFR.
MOSCSELS = 0:
There is no fast crystal clock (either no crystal connected or a crystal clock out of specification). A
frequency measure can reinforce this status by initiating a frequency measure by programming
RCMEAS in the CKGR_MCFR.
The selection of the main clock must be programmed back to the main RC oscillator by writing
MOSCSEL to 0 prior to disabling the fast crystal oscillator.
The crystal oscillator can be disabled (MOSCXTEN = 0 in CKGR_MOR).
289
26.5.5
When the 12 MHz Fast RC Oscillator clock is selected as the source of Main Clock and when this oscillator
becomes stable (i.e., when the MOSCRCS bit is set)
When the Crystal Oscillator is selected as the source of Main Clock and when this oscillator becomes stable
(i.e., when the MOSCXTS bit is set)
Then, at the 16th falling edge of Slow Clock, the MAINFRDY bit in the CKGR_MCFR 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 12 MHz Fast RC Oscillator or the Crystal Oscillator
can be determined.
26.6
MAINCK
OUTA
PLLA
PLLADIV2
Divider
by 2
PLLACK
PLLACOUNT
SLCK
PLLA
Counter
LOCKA
Whenever the PLLA is re-enabled or one of its parameters is changed, the LOCKA bit in PMC_SR is automatically
cleared. The values written in the PLLACOUNT field in CKGR_PLLAR are loaded in the PLLA counter. The PLLA
counter then decrements at the speed of the Slow Clock until it reaches 0. At this time, the LOCK bit is set in
PMC_SR and can trigger an interrupt to the processor. The user has to load the number of Slow Clock cycles
required to cover the PLLA transient time into the PLLACOUNT field.
The PLLA clock can be divided by 2 by writing the PLLADIV2 bit in the PMC_MCKR.
26.7
290
Figure 26-5.
MAINCK
UTMI PLL
UPLLCK
UPLLCOUNT
SLCK
UTMI PLL
Counter
LOCKU
Whenever the UTMI PLL is enabled by writing UPLLEN in CKGR_UCKR, the LOCKU bit in PMC_SR is
automatically cleared. The values written in the PLLCOUNT field in CKGR_UCKR are loaded in the UTMI PLL
counter. The UTMI PLL counter then decrements at the speed of the Slow Clock divided by 8 until it reaches 0. At
this time, the LOCKU bit is set in PMC_SR and can trigger an interrupt to the processor. The user has to load the
number of Slow Clock cycles required to cover the UTMI PLL transient time into the PLLCOUNT field.
291
27.
27.1
Description
The Power Management Controller (PMC) optimizes power consumption by controlling all system and user
peripheral clocks. The PMC enables/disables the clock inputs to many of the peripherals and the Core.
27.2
Embedded Characteristics
The Power Management Controller provides the following clocks:
292
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.
Processor Clock (PCK), must be switched off when entering the processor in Sleep Mode.
Peripheral Clocks, typically MCK, provided to the embedded peripherals (USART, SSC, SPI, TWI, TC,
HSMCI, 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.
Programmable Clock Outputs can be selected from the clocks provided by the clock generator and driven on
the PCKx pins.
27.3
Block Diagram
Figure 27-1.
/2
PLLADIV2
USBS
UHP48M
USBDIV+1
UHP12M
/4
USB
OHCI
USB
EHCI
Processor
Clock
Controller
PCK
Any Peripheral Interrupt
UPLLCK
MAINCK
SLCK
Peripherals
Clock Controller
ON/OFF
Prescaler
/1, /2, /4,...,/64
Divider
/1, /2, /3, /4
PRES
MDIV
Periph_clk[..]
PCLOCK
Periph_clk[..]
HCLOCK
EN
CSS
0
MCK2 (AHB 32-bit MATRIX system)
/2
PMC_PCR
H32MXDIV
Peripherals
Clock Controller
ON/OFF
ON/OFF
Prescaler
/1, /2, /4,... /64
UPLLCK
MCK
CSS
PRES
Periph_clk[..]
PCLOCK
pck[..]
Periph_clk[..]
HCLOCK
EN
293
27.4
PMC_MCKR
CSS
PRES
SLCK
MAINCK
Master Clock
Prescaler
PLLACK
MCK
UPLLCK
To the Processor
Clock Controller (PCK)
27.5
27.6
294
Divider
by 2
H32MXCLK
27.7
27.8
Divider
by 2
LCDCLK
27.9
DDR2/LPDDR/LPDDR2 Clock
The Power Management Controller controls the clocks of the DDR memory.
The DDR clock can be enabled and disabled with the DDRCK bit respectively in the PMC_SCER and
PMC_SDER. At reset, the DDR clock is disabled to save power consumption.
In case MDIV = 00, (PCK = MCK), DDRCK clock is not available.
To save PLLA power consumption, the user can choose UPLLCK as an Input clock for the system. In this case the
DDR Controller can drive LPDDR or LPDDR2 at up to 120 MHz.
295
In order to save power consumption, the division factor can be 1, 2, 4 or 8. The PMC_PCR is a register that
features a command and acts like a mailbox. To write the division factor on a particular peripheral, user needs to
write a WRITE command, the peripheral ID and the chosen division factor. To read the current division factor on a
particular peripheral, user just needs to write the READ command and the peripheral ID.
Code Example to select divider 8 for peripheral 2 and enable its clock:
write_register(PMC_PCR,0x01030102)
Code Example to read the divider of peripheral 4:
write_register(PMC_PCR,0x00000004)
When a peripheral clock is disabled, the clock is immediately stopped. The peripheral clocks are automatically
disabled after a reset.
In order to stop a peripheral, it is recommended that the system software wait until the peripheral has executed its
last programmed operation before disabling the clock. This is to avoid data corruption or erroneous behavior of the
system.
The bit number within the Peripheral Control registers is the Peripheral Identifier defined at the product level.
Generally, the bit number corresponds to the interrupt source number assigned to the peripheral.
If the main RC frequency needs to be changed while the slow clock frequency monitor is operating, the monitoring
must be stopped prior to change the main RC frequency. Then it can be reenabled as soon as MOSCRCS is set in
PMC_SR.
The error flag can be defined as an interrupt source of the PMC by setting the XT32KERR bit of PMC_IER.
3.
Switch the MAINCK to the Main Crystal Oscillator by setting MOSCSEL in CKGR_MOR.
4.
Wait for the MOSCSELS to be set in PMC_SR to ensure the switchover is complete.
5.
6.
Setting PLLA and divider (if not required, proceed to Step 7.)
All parameters needed to configure PLLA and the divider are located in the CKGR_PLLAR.
The MULA field is the PLLA multiplier factor. This parameter can be programmed between 0 and 127. If
MULA is set to 0, PLLA is turned off, otherwise the PLLA output frequency is PLLA input frequency
multiplied by (MULA + 1).
The PLLACOUNT field specifies the number of slow clock cycles before LOCKA bit is set in the PMC_SR
after the CKGR_PLLAR has been written.
Once the CKGR_PLLAR has been written, the user must wait for the LOCKA bit to be set in the PMC_SR.
This can be done either by polling LOCKA in the PMC_SR or by waiting for the interrupt line to be raised if
the associated interrupt source (LOCKA) has been enabled in the PMC_IER. All parameters in
CKGR_PLLAR can be programmed in a single write operation. If at some stage parameter MULA is
modified, LOCKA bit goes low to indicate that PLLA is not yet ready. When PLLA is locked, LOCKA is set
again.
If PLLA and divider are enabled, the PLLA input clock is the main clock. PLLA output clock is PLLA input
clock multiplied by 5. Once CKGR_PLLAR has been written, LOCKA bit will be set after eight slow clock
cycles.
The user must wait for the LOCKA bit to be set before using the PLLA output clock.
7.
297
Once this register has been correctly configured, the user must wait for LOCKU field in the PMC_SR to be
set. This can be done either by polling LOCKU in the PMC_SR or by waiting for the interrupt line to be raised
if the associated interrupt source (LOCKU) has been enabled in the PMC_IER.
8.
If a new value for CSS field corresponds to Main Clock or Slow Clock,
If at some stage parameter CSS or PRES is modified, the MCKRDY bit goes low to indicate that the Master
Clock and the Processor Clock are not yet ready. The user must wait for the 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, the
MCKRDY flag will go low while PLL is unlocked. Once PLL is locked again, LOCKA goes high and MCKRDY is set.
While PLL is unlocked, the Master Clock selection is automatically changed to Slow Clock. For further information, see
Section 27.15.2 Clock Switching Waveforms.
Code Example:
write_register(PMC_MCKR,0x00000001)
wait (MCKRDY=1)
write_register(PMC_MCKR,0x00000011)
wait (MCKRDY=1)
298
9.
Table 27-1.
Notes:
To
Main Clock
SLCK
Main Clock
4 x SLCK +
2.5 x Main Clock
SLCK
3 x PLL Clock +
5 x SLCK
PLL Clock
1.
2.
PLL Clock
3 x PLL Clock +
4 x SLCK +
1 x Main Clock
299
Table 27-2.
PLLA Clock
UPLL Clock
PLLA Clock
3 x PLLA Clock +
4 x SLCK +
1.5 x PLLA Clock
UPLL Clock
3 x UPLL Clock +
4 x SLCK +
1.5 x UPLL Clock
Slow Clock
PLL Clock
LOCK
MCKRDY
Master Clock
Write PMC_MCKR
300
Figure 27-6.
Slow Clock
Main Clock
MCKRDY
Master Clock
Write PMC_MCKR
Figure 27-7.
Slow Clock
PLLA Clock
LOCKA
MCKRDY
Master Clock
Slow Clock
Write CKGR_PLLAR
301
Figure 27-8.
PLL Clock
PCKRDY
PCKx Output
Write PMC_PCKx
Write PMC_SCER
Write PMC_SCDR
302
PCKx is enabled
PCKx is disabled
303
Register Mapping
Offset
Register
Name
Access
Reset
0x0000
PMC_SCER
Write-only
0x0004
PMC_SCDR
Write-only
0x0008
PMC_SCSR
Read-only
0x0000_0005
0x000C
Reserved
0x0010
PMC_PCER0
Write-only
0x0014
PMC_PCDR0
Write-only
0x0018
PMC_PCSR0
Read-only
0x0000_0000
0x001C
CKGR_UCKR
Read/Write
0x1020_0000
0x0020
CKGR_MOR
Read/Write
0x0000_0000
0x0024
CKGR_MCFR
Read/Write
0x0000_0000
0x0028
PLLA Register
CKGR_PLLAR
Read/Write
0x0000_3F00
0x002C
Reserved
0x0030
Read/Write
0x0000_0001
0x0034
Reserved
0x0038
PMC_USB
Read/Write
0x0000_0000
0x003C
PMC_SMD
Read/Write
0x0000_0000
0x0040
PMC_PCK0
Read/Write
0x0000_0000
0x0044
PMC_PCK1
Read/Write
0x0000_0000
0x0048
PMC_PCK2
Read/Write
0x0000_0000
0x004C0x005C
PMC_MCKR
Reserved
0x0060
PMC_IER
Write-only
0x0064
PMC_IDR
Write-only
0x0068
Status Register
PMC_SR
Read-only
0x0001_0008
0x006C
PMC_IMR
Read-only
0x0000_0000
Write-only
Read/Write
0x0000 0101
0x00700x0074
Reserved
0x0078
0x007C
Reserved
0x0080
0x00840x00E0
Reserved
PMC_FOCR
PMC_PLLICPR
0x00E4
PMC_WPMR
Read/Write
0x0000_0000
0x00E8
PMC_WPSR
Read-only
0x0000_0000
Write-only
0x00EC0x00FC
0x0100
304
Reserved
Peripheral Clock Enable Register 1
PMC_PCER1
Table 27-3.
Offset
Register
Name
Access
Reset
0x0104
PMC_PCDR1
Write-only
0x0108
PMC_PCSR1
Read-only
0x0000_0000
0x010C
PMC_PCR
Read/Write
0x0000_0000
305
PMC_SCER
Address:
0xF0018000
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
PCK2
9
PCK1
8
PCK0
7
UDP
6
UHP
4
SMDCK
3
LCDCK
2
DDRCK
306
PMC_SCDR
Address:
0xF0018004
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
PCK2
9
PCK1
8
PCK0
7
UDP
6
UHP
4
SMDCK
3
LCDCK
2
DDRCK
0
PCK
307
PMC_SCSR
Address:
0xF0018008
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
PCK2
9
PCK1
8
PCK0
7
UDP
6
UHP
4
SMDCK
3
LCDCK
2
DDRCK
0
PCK
308
PMC_PCER0
Address:
0xF0018010
Access:
Write-only
31
PID31
30
PID30
29
PID29
28
PID28
27
PID27
26
PID26
25
PID25
24
PID24
23
PID23
22
PID22
21
PID21
20
PID20
19
PID19
18
PID18
17
PID17
16
PID16
15
PID15
14
PID14
13
PID13
12
PID12
11
PID11
10
PID10
9
PID9
8
PID8
7
PID7
6
PID6
5
PID5
4
PID4
3
PID3
2
PID2
This register can only be written if the WPEN bit is cleared in the PMC Write Protection Mode Register.
PIDx: Peripheral Clock x Enable
0: No effect.
1: Enables the corresponding peripheral clock.
Note: PID2 to PID31 refer to identifiers as defined in the section Peripheral Identifiers in the product datasheet. Other peripherals can
be enabled in PMC_PCER1.
Note: Programming the control bits of the Peripheral ID that are not implemented has no effect on the behavior of the PMC.
309
PMC_PCDR0
Address:
0xF0018014
Access:
Write-only
31
PID31
30
PID30
29
PID29
28
PID28
27
PID27
26
PID26
25
PID25
24
PID24
23
PID23
22
PID22
21
PID21
20
PID20
19
PID19
18
PID18
17
PID17
16
PID16
15
PID15
14
PID14
13
PID13
12
PID12
11
PID11
10
PID10
9
PID9
8
PID8
7
PID7
6
PID6
5
PID5
4
PID4
3
PID3
2
PID2
1
-
0
-
This register can only be written if the WPEN bit is cleared in the PMC Write Protection Mode Register.
PIDx: Peripheral Clock x Disable
0: No effect.
1: Disables the corresponding peripheral clock.
Note: PID2 to PID31 refer to identifiers as defined in the section Peripheral Identifiers in the product datasheet. Other peripherals can
be disabled in PMC_PCDR1.
310
PMC_PCSR0
Address:
0xF0018018
Access:
Read-only
31
PID31
30
PID30
29
PID29
28
PID28
27
PID27
26
PID26
25
PID25
24
PID24
23
PID23
22
PID22
21
PID21
20
PID20
19
PID19
18
PID18
17
PID17
16
PID16
15
PID15
14
PID14
13
PID13
12
PID12
11
PID11
10
PID10
9
PID9
8
PID8
7
PID7
6
PID6
5
PID5
4
PID4
3
PID3
2
PID2
311
CKGR_UCKR
Address:
0xF001801C
Access:
Read/Write
31
30
29
28
27
26
25
24
BIASEN
21
20
19
18
17
16
UPLLEN
BIASCOUNT
23
22
UPLLCOUNT
15
14
13
12
11
10
312
CKGR_MOR
Address:
0xF0018020
Access:
Read/Write
31
30
29
28
27
26
XT32KFME
25
CFDEN
24
MOSCSEL
23
22
21
20
19
18
17
16
11
10
1
MOSCXTBY
0
MOSCXTEN
KEY
15
14
13
12
MOSCXTST
5
0
WARNING: Bits 4, 5, and 6 must always be set to 0 when programming the CKGR_MOR.
MOSCXTEN: Main Crystal Oscillator Enable
A crystal must be connected between XIN and XOUT.
0: The Main Crystal Oscillator is disabled.
1: The Main Crystal Oscillator is enabled. MOSCXTBY must be set to 0.
When MOSCXTEN is set, the MOSCXTS flag is set once the Main Crystal Oscillator startup time is achieved.
MOSCXTBY: Main Crystal Oscillator Bypass
0: No effect.
1: The Main Crystal Oscillator is bypassed. MOSCXTEN must be set to 0. An external clock must be connected on XIN.
When MOSCXTBY is set, the MOSCXTS flag in PMC_SR is automatically set.
Clearing MOSCXTEN and MOSCXTBY bits allows resetting the MOSCXTS flag.
MOSCXTST: Main Crystal Oscillator Startup Time
Specifies the number of Slow Clock cycles multiplied by 8 for the Main Crystal Oscillator start-up time.
KEY: Password
Value
Name
0x37
PASSWD
Description
Writing any other value in this field aborts the write operation.
313
314
CKGR_MCFR
Address:
0xF0018024
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
RCMEAS
19
18
17
16
MAINFRDY
15
14
13
12
11
10
MAINF
7
4
MAINF
315
CKGR_PLLAR
Address:
0xF0018028
Access:
Read/Write
31
30
29
ONE
28
27
26
25
24
MULA
23
22
21
20
19
18
17
16
MULA
15
14
13
OUTA
12
11
OUTA
7
10
0
DIVA
PLLACOUNT
6
Possible limitations on PLL 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.
DIVA: Divider A
0: Divider output is 0
1: Divider is bypassed and the PLL input entry is Main Clock.
PLLACOUNT: PLLA Counter
Specifies the number of slow clock cycles before the LOCKA bit is set in PMC_SR after CKGR_PLLAR is written.
OUTA: PLLA Clock Frequency Range
To be programmed to 0.
MULA: PLLA Multiplier
0: The PLLA is deactivated.
1127: The PLLA Clock frequency is the PLLA input frequency multiplied by MULA + 1.
ONE: Must Be Set to 1
Bit 29 must always be set to 1 when programming the CKGR_PLLAR.
316
PMC_MCKR
Address:
0xF0018030
Access:
Read/Write
31
30
29
28
27
26
25
24
H32MXDIV
23
22
21
20
19
18
17
16
15
14
13
12
PLLADIV2
11
10
5
PRES
8
MDIV
0
CSS
Name
Description
SLOW_CLK
MAIN_CLK
PLLA_CLK
PLLACK is selected
UPLL_CLK
Name
Description
CLOCK
Selected clock
CLOCK_DIV2
CLOCK_DIV4
CLOCK_DIV8
CLOCK_DIV16
CLOCK_DIV32
CLOCK_DIV64
Reserved
Reserved
Name
Description
EQ_PCK
PCK_DIV2
PCK_DIV4
PCK_DIV3
317
Name
Description
H32MXDIV1
The AHB 32-bit Matrix frequency is equal to the AHB 64-bit Matrix frequency. It is possible only if the
AHB 64-bit Matrix frequency does not exceed 90 MHz.
H32MXDIV2
The AHB 32-bit Matrix frequency is equal to the AHB 64-bit Matrix frequency divided by 2.
318
PMC_USB
Address:
0xF0018038
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
0
USBS
USBDIV
2
319
PMC_SMD
Address:
0xF001803C
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
SMDDIV
0
SMDS
320
PMC_PCKx[x = 0..2]
Address:
0xF0018040
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
5
PRES
1
CSS
Name
Description
SLOW_CLK
MAIN_CLK
PLLA_CLK
PLLACK is selected
UPLL_CLK
MCK_CLK
Name
Description
CLOCK
Selected clock
CLOCK_DIV2
CLOCK_DIV4
CLOCK_DIV8
CLOCK_DIV16
CLOCK_DIV32
CLOCK_DIV64
Reserved
Reserved
321
PMC_IER
Address:
0xF0018060
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
XT32KERR
20
19
18
CFDEV
17
MOSCRCS
16
MOSCSELS
15
14
13
12
11
10
PCKRDY2
9
PCKRDY1
8
PCKRDY0
6
LOCKU
3
MCKRDY
1
LOCKA
0
MOSCXTS
The following configuration values are valid for all listed bit names of this register:
0: No effect
1: Enables the corresponding interrupt
MOSCXTS: Main Crystal Oscillator Status Interrupt Enable
LOCKA: PLLA Lock Interrupt Enable
MCKRDY: Master Clock Ready Interrupt Enable
LOCKU: UTMI PLL Lock Interrupt Enable
PCKRDYx: Programmable Clock Ready x Interrupt Enable
MOSCSELS: Main Oscillator Selection Status Interrupt Enable
MOSCRCS: Main On-Chip RC Status Interrupt Enable
CFDEV: Clock Failure Detector Event Interrupt Enable
XT32KERR: Slow Crystal Oscillator Error Interrupt Enable
322
PMC_IDR
Address:
0xF0018064
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
XT32KERR
20
19
18
CFDEV
17
MOSCRCS
16
MOSCSELS
15
14
13
12
11
10
PCKRDY2
9
PCKRDY1
8
PCKRDY0
6
LOCKU
3
MCKRDY
1
LOCKA
0
MOSCXTS
The following configuration values are valid for all listed bit names of this register:
0: No effect
1: Disables the corresponding interrupt
MOSCXTS: Main Crystal Oscillator Status Interrupt Disable
LOCKA: PLLA Lock Interrupt Disable
MCKRDY: Master Clock Ready Interrupt Disable
LOCKU: UTMI PLL Lock Interrupt Enable
PCKRDYx: Programmable Clock Ready x Interrupt Disable
MOSCSELS: Main Oscillator Selection Status Interrupt Disable
MOSCRCS: Main On-Chip RC Status Interrupt Disable
CFDEV: Clock Failure Detector Event Interrupt Disable
XT32KERR: Slow Crystal Oscillator Error Interrupt Disable
323
PMC_SR
Address:
0xF0018068
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
XT32KERR
20
FOS
19
CFDS
18
CFDEV
17
MOSCRCS
16
MOSCSELS
15
14
13
12
11
10
PCKRDY2
9
PCKRDY1
8
PCKRDY0
6
LOCKU
3
MCKRDY
1
LOCKA
0
MOSCXTS
324
325
PMC_IMR
Address:
0xF001806C
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
XT32KERR
20
19
18
CFDEV
17
MOSCRCS
16
MOSCSELS
15
14
13
12
11
10
PCKRDY2
9
PCKRDY1
8
PCKRDY0
3
MCKRDY
1
LOCKA
0
MOSCXTS
The following configuration values are valid for all listed bit names of this register:
0: Corresponding interrupt is not enabled.
1: Corresponding interrupt is enabled.
MOSCXTS: Main Crystal Oscillator Status Interrupt Mask
LOCKA: PLLA Lock Interrupt Mask
MCKRDY: Master Clock Ready Interrupt Mask
PCKRDYx: Programmable Clock Ready x Interrupt Mask
MOSCSELS: Main Oscillator Selection Status Interrupt Mask
MOSCRCS: Main On-Chip RC Status Interrupt Mask
CFDEV: Clock Failure Detector Event Interrupt Mask
XT32KERR: Slow Crystal Oscillator Error Interrupt Mask
326
PMC_FOCR
Address:
0xF0018078
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
0
FOCLR
327
PMC_PLLICPR
Address:
0xF0018080
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
15
14
13
12
11
10
9
IPLL_PLLA
IVCO_PLLU
16
ICP_PLLU
ICP_PLLA
328
PMC_WPMR
Address:
0xF00180E4
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
0
WPEN
WPKEY
23
22
21
20
WPKEY
15
14
13
12
WPKEY
Name
0x504D43
PASSWD
Description
Writing any other value in this field aborts the write operation of the WPEN bit.
Always reads as 0.
329
PMC_WPSR
Address:
0xF00180E8
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
11
10
0
WPVS
WPVSRC
15
14
13
12
WPVSRC
330
PMC_PCER1
Address:
0xF0018100
Access:
Write-only
31
PID63
30
PID62
29
PID61
28
PID60
27
PID59
26
PID58
25
PID57
24
PID56
23
PID55
22
PID54
21
PID53
20
PID52
19
PID51
18
PID50
17
PID49
16
PID48
15
PID47
14
PID46
13
PID45
12
PID44
11
PID43
10
PID42
9
PID41
8
PID40
7
PID39
6
PID38
5
PID37
4
PID36
3
PID35
2
PID34
1
PID33
0
PID32
This register can only be written if the WPEN bit is cleared in the PMC Write Protection Mode Register.
PIDx: Peripheral Clock x Enable
0: No effect.
1: Enables the corresponding peripheral clock.
Notes:
1. PID32 to PID63 refer to identifiers as defined in the section Peripheral Identifiers in the product datasheet.
2. Programming the control bits of the Peripheral ID that are not implemented has no effect on the behavior of the PMC.
331
PMC_PCDR1
Address:
0xF0018104
Access:
Write-only
31
PID63
30
PID62
29
PID61
28
PID60
27
PID59
26
PID58
25
PID57
24
PID56
23
PID55
22
PID54
21
PID53
20
PID52
19
PID51
18
PID50
17
PID49
16
PID48
15
PID47
14
PID46
13
PID45
12
PID44
11
PID43
10
PID42
9
PID41
8
PID40
7
PID39
6
PID38
5
PID37
4
PID36
3
PID35
2
PID34
1
PID33
0
PID32
This register can only be written if the WPEN bit is cleared in the PMC Write Protection Mode Register.
PIDx: Peripheral Clock x Disable
0: No effect.
1: Disables the corresponding peripheral clock.
Note: PID32 to PID63 refer to identifiers as defined in the section Peripheral Identifiers in the product datasheet.
332
PMC_PCSR1
Address:
0xF0018108
Access:
Read-only
31
PID63
30
PID62
29
PID61
28
PID60
27
PID59
26
PID58
25
PID57
24
PID56
23
PID55
22
PID54
21
PID53
20
PID52
19
PID51
18
PID50
17
PID49
16
PID48
15
PID47
14
PID46
13
PID45
12
PID44
11
PID43
10
PID42
9
PID41
8
PID40
7
PID39
6
PID38
5
PID37
4
PID36
3
PID35
2
PID34
1
PID33
0
PID32
333
PMC_PCR
Address:
0xF001810C
Access:
Read/Write
31
30
29
28
EN
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
CMD
11
10
PID
PID: Peripheral ID
Peripheral ID selection from PID2 to the maximum PID number. This refers to identifiers as defined in the section Peripheral Identifiers in the product datasheet.
CMD: Command
0: Read mode
1: Write mode
EN: Enable
0: Selected Peripheral clock is disabled
1: Selected Peripheral clock is enabled
334
28.
28.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 the 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.
Additional Interrupt modes enabling rising edge, falling edge, low-level or high-level detection on any I/O
line.
A glitch filter providing rejection of glitches lower than one-half of peripheral clock cycle.
A debouncing filter providing rejection of unwanted pulses from key or push button operations.
The PIO Controller also features a synchronous output providing up to 32 bits of data output in a single write
operation.
28.2
Embedded Characteristics
For each I/O Line (Whether Assigned to a Peripheral or Used as General Purpose I/O)
Pin Data Status Register, Supplies Visibility of the Level on the Pin at Any Time
Additional Interrupt Modes on a Programmable Event: Rising Edge, Falling Edge, Low-Level or HighLevel
Synchronous Output, Provides Set and Clear of Several I/O Lines in a Single Write
335
28.3
Block Diagram
Figure 28-1.
Block Diagram
PIO Controller
Secure
Interrupt Controller
Non-Secure
Interrupt Controller
PMC
Secure
PIO Interrupt
Non-Secure
PIO Interrupt
Peripheral Clock
Data, Enable
Up to 32
Peripheral IOs
Embedded
Peripheral
PIN 0
Data, Enable
PIN 1
Up to 32 pins
Embedded
Peripheral
Up to 32
Peripheral IOs
PIN 31
APB
28.4
Product Dependencies
336
337
28.5
Functional Description
The PIO Controller features up to 32 fully-programmable I/O lines. Most of the control logic associated to each I/O
is represented in Figure 28-2. In this description each signal shown represents one of up to 32 possible indexes.
Figure 28-2.
PIO_PUER[0]
PIO_ODR[0]
PIO_PUDR[0]
00
01
10
11
Integrated
Pull-Up
Resistor
PIO_PUSR[0]
0
0
PIO_PER[0]
PIO_ABCDSR1[0]
PIO_PSR[0]
PIO_ABCDSR2[0]
PIO_PDR[0]
Peripheral A Output
00
01
10
11
Peripheral B Output
Peripheral C Output
Peripheral D Output
PIO_MDER[0]
PIO_MDSR[0]
PIO_MDDR[0]
PIO_SODR[0]
1
PIO_ODSR[0]
Pad
PIO_CODR[0]
Integrated
Pull-Down
Resistor
PIO_PPDER[0]
PIO_PSR[0] == 0
PIO_PPDSR[0]
PIO_ABCDSR1[0] == 0
PIO_PPDDR[0]
GND
PIO_ABCDSR2[0] == 0
1
Peripheral A Input
PERIPH_A_DEF_VAL[0](1)
PIO_PSR[0] == 0
PIO_ABCDSR1[0] == 1
PIO_ABCDSR2[0] == 0
1
Peripheral B Input
PERIPH_B_DEF_VAL[0](1)
PIO_PSR[0] == 0
PIO_ABCDSR1[0] == 0
PIO_ABCDSR2[0] == 1
1
Peripheral C Input
PERIPH_C_DEF_VAL[0](1)
PIO_PSR[0] == 0
PIO_ABCDSR1[0] == 1
PIO_ABCDSR2[0] == 1
1
Peripheral D Input
(1)
PERIPH_D_DEF_VAL[0]
PIO_PDSR[0]
PIO_ISR[0]
0
D
Peripheral Clock
Slow Clock
PIO_SCDR
Clock
Divider
div_slck
Programmable
Glitch
or
Debouncing
Filter
Q
DFF
PIO_IFER[0]
PIO_IFSR[0]
PIO_IFSCSR[0]
PIO_IFSCDR[0]
PIO_IFDR[0]
Not Secure
PIO
Interrupt
EVENT
DETECTOR
Secure
Interrupt
Management
Peripheral Clock
Resynchronization
Stage
PIO_ISR[31]
PIO_IFSCER[0]
338
Q
DFF
Secure
PIO
Interrupt
Note:
The corresponding bit at level zero in PIO_ABCDSR1 and the corresponding bit at level zero in
PIO_ABCDSR2 means peripheral A is selected.
The corresponding bit at level one in PIO_ABCDSR1 and the corresponding bit at level zero in
PIO_ABCDSR2 means peripheral B is selected.
The corresponding bit at level zero in PIO_ABCDSR1 and the corresponding bit at level one in
PIO_ABCDSR2 means peripheral C is selected.
The corresponding bit at level one in PIO_ABCDSR1 and the corresponding bit at level zero in
PIO_ABCDSR2 means peripheral D is selected.
Note that multiplexing of peripheral lines A, B, C and D affects both input and output peripheral lines. When a
peripheral is not selected, its inputs are assigned with constant values (see Figure 28-2 on page 338).
339
Writing in PIO_ABCDSR1 and PIO_ABCDSR2 manages the multiplexing regardless of the configuration of the
pin. However, assignment of a pin to a peripheral function requires a write in PIO_ABCDSR1 and PIO_ABCDSR2
in addition to a write in PIO_PDR. The pin input is only routed to the input of the assigned peripheral. If the
peripheral is not assigned to the pin, then a constant value is applied to the peripheral input line.
After reset, PIO_ABCDSR1 and PIO_ABCDSR2 are zero, thus indicating that all the PIO lines are configured on
peripheral A. However, peripheral A generally does not drive the pin and PERIPH_x_DEF_VAL is applied to
peripheral input lines as the PIO Controller resets in I/O line mode.
If the software selects a peripheral A, B, C or D which does not exist for a pin, no alternate functions are enabled
for this pin and the selection is taken into account. The PIO Controller does not carry out checks to prevent
selection of a peripheral which does not exist.
28.5.4 Output Control
When the I/O line is assigned to a peripheral function, i.e., the corresponding bit in PIO_PSR is at zero, the drive of
the I/O line is controlled by the peripheral. Peripheral A or B or C or D depending on the value in PIO_ABCDSR1
and PIO_ABCDSR2 determines whether the pin is driven or not.
When the I/O line is controlled by the PIO Controller, the pin can be configured to be driven. This is done by writing
the Output Enable register (PIO_OER) and Output Disable register (PIO_ODR). The results of these write
operations are detected in the Output Status register (PIO_OSR). When a bit in this register is at zero, the
corresponding I/O line is used as an input only. When the bit is at one, 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 the Set Output Data register (PIO_SODR) and the
Clear Output Data register (PIO_CODR). These write operations, respectively, set and clear the Output Data
Status register (PIO_ODSR), 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 configuration of the I/O line prior to setting it to be managed by the PIO
Controller.
Similarly, writing in PIO_SODR and PIO_CODR affects PIO_ODSR. This is important as it defines the first level
driven on the I/O line.
28.5.5 Synchronous Data Output
Clearing one or more PIO line(s) and setting another one or more PIO line(s) synchronously cannot be done by
using PIO_SODR and PIO_CODR. It requires two successive write operations into two different registers. To
overcome this, the PIO Controller offers a direct control of PIO outputs by single write access to PIO_ODSR. Only
bits unmasked by the Output Write Status register (PIO_OWSR) are written. The mask bits in PIO_OWSR are set
by writing to the Output Write Enable register (PIO_OWER) and cleared by writing to the Output Write Disable
register (PIO_OWDR).
After reset, the synchronous data output is disabled on all the I/O lines as PIO_OWSR resets at 0x0.
28.5.6 Multi-Drive Control (Open Drain)
Each I/O can be independently programmed in open drain by using the multi-drive feature. This feature permits
several drivers to be connected on the I/O line which is driven low only by each device. An external pull-up resistor
(or enabling of the internal one) is generally required to guarantee a high level on the line.
The multi-drive feature is controlled by the Multi-driver Enable register (PIO_MDER) and the Multi-driver Disable
register (PIO_MDDR). The multi-drive can be selected whether the I/O line is controlled by the PIO Controller or
assigned to a peripheral function. The Multi-driver Status register (PIO_MDSR) indicates the pins that are
configured to support external drivers.
After reset, the multi-drive feature is disabled on all pins, i.e., PIO_MDSR resets at value 0x0.
340
Peripheral clock
Write PIO_SODR
Write PIO_ODSR at 1
APB Access
Write PIO_CODR
Write PIO_ODSR at 0
APB Access
PIO_ODSR
2 cycles
2 cycles
PIO_PDSR
28.5.8 Inputs
The level on each I/O line can be read through PIO_PDSR. This register 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.
28.5.9 Input Glitch and Debouncing Filters
Optional input glitch and debouncing filters are independently programmable on each I/O line.
The glitch filter can filter a glitch with a duration of less than 1/2 peripheral clock and the debouncing filter can filter
a pulse of less than 1/2 period of a programmable divided slow clock.
The selection between glitch filtering or debounce filtering is done by writing in the PIO Input Filter Slow Clock
Disable register (PIO_IFSCDR) and the PIO Input Filter Slow Clock Enable register (PIO_IFSCER). Writing
PIO_IFSCDR and PIO_IFSCER, respectively, sets and clears bits in the Input Filter Slow Clock Status register
(PIO_IFSCSR).
The current selection status can be checked by reading the PIO_IFSCSR.
If PIO_IFSCSR[i] = 0: The glitch filter can filter a glitch with a duration of less than 1/2 master clock period.
If PIO_IFSCSR[i] = 1: The debouncing filter can filter a pulse with a duration of less than 1/2 programmable
divided slow clock period.
For the debouncing filter, the period of the divided slow clock is defined by writing in the DIV field of the Slow Clock
Divider Debouncing register (PIO_SCDR):
tdiv_slck = ((DIV + 1) 2) tslck
When the glitch or debouncing filter is enabled, a glitch or pulse with a duration of less than 1/2 selected clock
cycle (selected clock represents peripheral clock or divided slow clock depending on PIO_IFSCDR and
PIO_IFSCER programming) is automatically rejected, while a pulse with a duration of one selected clock
(peripheral clock or divided slow clock) cycle or more is accepted. For pulse durations between 1/2 selected clock
341
cycle and one selected clock cycle, the pulse may or may not be taken into account, depending on the precise
timing of its occurrence. Thus for a pulse to be visible, it must exceed one selected clock cycle, whereas for a glitch
to be reliably filtered out, its duration must not exceed 1/2 selected clock cycle.
The filters also introduce some latencies, illustrated in Figure 28-4 and Figure 28-5.
The glitch filters are controlled by the Input Filter Enable register (PIO_IFER), the Input Filter Disable register
(PIO_IFDR) and the Input Filter Status register (PIO_IFSR). Writing PIO_IFER and PIO_IFDR respectively sets
and clears bits in PIO_IFSR. This last register enables the glitch filter on the I/O lines.
When the glitch and/or debouncing filter is enabled, it does not modify the behavior of the inputs on the
peripherals. It acts only on the value read in PIO_PDSR and on the input change interrupt detection. The glitch and
debouncing filters require that the peripheral clock is enabled.
Figure 28-4.
PIO_IFCSR = 0
Peripheral clcok
up to 1.5 cycles
Pin Level
1 cycle
1 cycle
1 cycle
1 cycle
PIO_PDSR
if PIO_IFSR = 0
2 cycles
up to 2.5 cycles
PIO_PDSR
if PIO_IFSR = 1
Figure 28-5.
1 cycle
up to 2 cycles
PIO_IFCSR = 1
Divided Slow Clock
(div_slck)
Pin Level
PIO_PDSR
if PIO_IFSR = 0
1 cycle tdiv_slck
PIO_PDSR
if PIO_IFSR = 1
1 cycle tdiv_slck
Some additional interrupt modes can be enabled/disabled by writing in the Additional Interrupt Modes Enable
register (PIO_AIMER) and Additional Interrupt Modes Disable register (PIO_AIMDR). The current state of this
selection can be read through the Additional Interrupt Modes Mask register (PIO_AIMMR).
These additional modes are:
Low-level detection
High-level detection
The type of event detection (edge or level) must be selected by writing in the Edge Select register
(PIO_ESR) and Level Select register (PIO_LSR) which select, respectively, the edge and level detection.
The current status of this selection is accessible through the Edge/Level Status register (PIO_ELSR).
The polarity of the event detection (rising/falling edge or high/low-level) must be selected by writing in the
Falling Edge/Low-Level Select register (PIO_FELLSR) and Rising Edge/High-Level Select register
(PIO_REHLSR) which allow to select falling or rising edge (if edge is selected in PIO_ELSR) edge or highor low-level detection (if level is selected in PIO_ELSR). The current status of this selection is accessible
through the Fall/Rise - Low/High Status register (PIO_FRLHSR).
When an input edge or level is detected on an I/O line, the corresponding bit in the Interrupt Status register
(PIO_ISR) is set. If the corresponding bit in PIO_IMR is set, the PIO Controller interrupt line is asserted. The
security level of the interrupt line depends on the corresponding bit value in the Interrupt Security Level register
(PIO_ISLR) and on the MATRIX_SPSELRx[PIO_ID] (Matrix Peripheral register) bit value. The secure interrupt
signals of the 32 lines are ORed-wired together to generate a single secure interrupt signal to the secure interrupt
controller. The non-secure interrupt signals of the 32 lines are ORed-wired together to generate a single nonsecure interrupt signal to the non-secure interrupt controller (see Section 28.5.11 on page 345).
When the software reads PIO_ISR, all the interrupts are automatically cleared. This signifies that all the interrupts
that are pending when PIO_ISR is read must be handled. When an Interrupt is enabled on a level, the interrupt is
generated as long as the interrupt source is not cleared, even if some read accesses in PIO_ISR are performed.
343
Figure 28-6.
Rising Edge
Detector
Falling Edge
Detector
0
0
PIO_REHLSR[0]
PIO_FRLHSR[0]
1
PIO_FELLSR[0]
Resynchronized input on line 0
High Level
Detector
Low Level
Detector
PIO_LSR[0]
PIO_ELSR[0]
PIO_ESR[0]
PIO_AIMER[0]
PIO_AIMMR[0]
PIO_AIMDR[0]
Edge
Detector
Configuration
Description
All the interrupt sources are enabled by writing 32hFFFF_FFFF in PIO_IER.
Interrupt Mode
Then the additional interrupt mode is enabled for lines 0 to 7 by writing 32h0000_00FF in
PIO_AIMER.
The other lines are configured in edge detection by default, if they have not been previously
configured. Otherwise, lines 0, 1, 2, 6 and 7 must be configured in edge detection by writing
32h0000_00C7 in PIO_ESR.
344
Figure 28-7.
Peripheral clock
Pin Level
PIO_ISR
Read PIO_ISR
APB Access
APB Access
If MATRIX_PSELRx[PIO_ID] = 0, the PIO Controller is in secure mode. The security level of each PIO
interrupt line is defined by PIO_ISLR. If the corresponding bit in PIO_ISLR is zero, the secure interrupt line
will be asserted. If it is one, the non-secure interrupt line will be asserted. The 32 secure interrupt lines are
ORed-wired together to generate the secure interrupt signal and the 32 non-secure interrupt lines are ORedwired together to generate the non-secure interrupt signal.
345
Figure 28-8.
PIO_ISR[0]
PIO_IER[0]
PIO_IMR[0]
PIO_IDR[0]
PIO_ISR[31]
PIO_IER[31]
PIO_IMR[31]
PIO_IDR[31]
PIO_ISLR[31]
PIO_ISR[0]
PIO_IER[0]
PIO_IMR[0]
PIO_IDR[0]
PIO_ISLR[0]
Secure
PIO Interrupt
PIO_ISR[31]
PIO_IER[31]
PIO_IMR[31]
PIO_IDR[31]
PIO_ISLR[31]
Note:
346
1.
If MATRIX_PSELRx[PIO_ID] = 1, the PIO Controller is in non-secure mode. The security level of each PIO
interrupt line is always non-secure (PIO_ISLR is not taken into account). The 32 non-secure interrupt lines
are ORed-wired together to generate the non-secure interrupt signal. The secure interrupt signal is tied to
zero.
Figure 28-9.
PIO_ISR[0]
PIO_IER[0]
PIO_IMR[0]
PIO_IDR[0]
Non-Secure
PIO Interrupt
PIO_ISR[31]
PIO_IER[31]
PIO_IMR[31]
PIO_IDR[31]
Secure
PIO Interrupt
GND
Note:
1.
347
4-bit output port on I/O lines 0 to 3 (should be written in a single write operation), open-drain, with pull-up
resistor
Four output signals on I/O lines 4 to 7 (to drive LEDs for example), driven high and low, no pull-up resistor,
no pull-down 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 24 to 27 assigned to peripheral C with input change interrupt, no pull-up resistor and no pull-down
resistor
Table 28-2.
348
Programming Example
Register
Value to be Written
PIO_PER
0x0000_FFFF
PIO_PDR
0xFFFF_0000
PIO_OER
0x0000_00FF
PIO_ODR
0xFFFF_FF00
PIO_IFER
0x0000_0F00
PIO_IFDR
0xFFFF_F0FF
PIO_SODR
0x0000_0000
PIO_CODR
0x0FFF_FFFF
PIO_IER
0x0F00_0F00
PIO_IDR
0xF0FF_F0FF
PIO_MDER
0x0000_000F
PIO_MDDR
0xFFFF_FFF0
PIO_PUDR
0xFFF0_00F0
PIO_PUER
0x000F_FF0F
PIO_PPDDR
0xFF0F_FFFF
PIO_PPDER
0x00F0_0000
PIO_ABCDSR1
0xF0F0_0000
PIO_ABCDSR2
0xFF00_0000
PIO_OWER
0x0000_000F
PIO_OWDR
0x0FFF_ FFF0
349
28.6
Table 28-3.
Register Mapping
Offset
Register
Name
Access
Reset
0x0000
PIO_PER
Write-only
0x0004
PIO_PDR
Write-only
0x0008
PIO_PSR
Read-only
(1)
0x000C
PIO_ISLR
Read/Write
0x00000000
0x0010
PIO_OER
Write-only
0x0014
PIO_ODR
Write-only
0x0018
PIO_OSR
Read-only
0x00000000
0x001C
Reserved
0x0020
PIO_IFER
Write-only
0x0024
PIO_IFDR
Write-only
0x0028
PIO_IFSR
Read-only
0x00000000
0x002C
Reserved
0x0030
PIO_SODR
Write-only
0x0034
PIO_CODR
Write-only
0x0038
PIO_ODSR
Read-only
or(2)
Read/Write
0x003C
PIO_PDSR
Read-only
(3)
0x0040
PIO_IER
Write-only
0x0044
PIO_IDR
Write-only
0x0048
PIO_IMR
Read-only
0x00000000
(4)
0x004C
PIO_ISR
Read-only
0x00000000
0x0050
PIO_MDER
Write-only
0x0054
PIO_MDDR
Write-only
0x0058
PIO_MDSR
Read-only
0x00000000
0x005C
Reserved
0x0060
PIO_PUDR
Write-only
0x0064
PIO_PUER
Write-only
0x0068
PIO_PUSR
Read-only
(1)
0x006C
Reserved
350
Table 28-3.
Offset
Register
Name
Access
Reset
0x0070
PIO_ABCDSR1
Read/Write
0x00000000
0x0074
PIO_ABCDSR2
Read/Write
0x00000000
0x00780x007C
Reserved
0x0080
PIO_IFSCDR
Write-only
0x0084
PIO_IFSCER
Write-only
0x0088
PIO_IFSCSR
Read-only
0x00000000
0x008C
PIO_SCDR
Read/Write
0x00000000
0x0090
PIO_PPDDR
Write-only
0x0094
PIO_PPDER
Write-only
Read-only
(1)
0x0098
PIO_PPDSR
0x009C
Reserved
0x00A0
PIO_OWER
Write-only
0x00A4
PIO_OWDR
Write-only
0x00A8
PIO_OWSR
Read-only
0x00000000
0x00AC
Reserved
0x00B0
PIO_AIMER
Write-only
0x00B4
PIO_AIMDR
Write-only
0x00B8
PIO_AIMMR
Read-only
0x00000000
0x00BC
Reserved
0x00C0
PIO_ESR
Write-only
0x00C4
PIO_LSR
Write-only
0x00C8
PIO_ELSR
Read-only
0x00000000
0x00CC
Reserved
0x00D0
PIO_FELLSR
Write-only
0x00D4
PIO_REHLSR
Write-only
0x00D8
PIO_FRLHSR
Read-only
0x00000000
0x00DC
Reserved
0x00E0
Reserved
0x00E4
PIO_WPMR
Read/Write
0x00000000
0x00E8
PIO_WPSR
Read-only
0x00000000
0x00EC0x00FC
Reserved
0x0100
PIO_SCHMITT
Read/Write
0x00000000
0x01040x010C
Reserved
0x0110
Reserved
0x0114
Reserved
0x0118
PIO_DRIVER1
Read/Write
0xAAAAAAAA
0x011C
PIO_DRIVER2
Read/Write
0xAAAAAAAA
351
Table 28-3.
Offset
Name
Access
Reset
0x01200x014C
Reserved
352
PIO_PER
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
This register can only be written if the WPEN bit is cleared in the PIO Write Protection Mode Register.
P0P31: PIO Enable
0: No effect.
1: Enables the PIO to control the corresponding pin (disables peripheral control of the pin).
353
PIO_PDR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
This register can only be written if the WPEN bit is cleared in the PIO Write Protection Mode Register.
P0P31: PIO Disable
0: No effect.
1: Disables the PIO from controlling the corresponding pin (enables peripheral control of the pin).
354
PIO_PSR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
355
PIO_ISLR
Address:
(PIOE)
Access:
Read/Write
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
This register can only be written if the WPEN bit is cleared in the PIO Write Protection Mode Register.
P0P31: PIO Interrupt Security Level
0: Interrupt line is defined as secure.
1: Interrupt line is defined as non-secure.
Note: If PIO is set in non-secure mode, then this register is not taken into account for PIO interrupt generation.
356
PIO_OER
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
This register can only be written if the WPEN bit is cleared in the PIO Write Protection Mode Register.
P0P31: Output Enable
0: No effect.
1: Enables the output on the I/O line.
357
PIO_ODR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
This register can only be written if the WPEN bit is cleared in the PIO Write Protection Mode Register.
P0P31: Output Disable
0: No effect.
1: Disables the output on the I/O line.
358
PIO_OSR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
359
PIO_IFER
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
This register can only be written if the WPEN bit is cleared in the PIO Write Protection Mode Register.
P0P31: Input Filter Enable
0: No effect.
1: Enables the input glitch filter on the I/O line.
360
PIO_IFDR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
This register can only be written if the WPEN bit is cleared in the PIO Write Protection Mode Register.
P0P31: Input Filter Disable
0: No effect.
1: Disables the input glitch filter on the I/O line.
361
PIO_IFSR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
362
PIO_SODR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
363
PIO_CODR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
364
PIO_ODSR
Address:
(PIOE)
Access:
Read-only or Read/Write
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
365
PIO_PDSR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
366
PIO_IER
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
367
PIO_IDR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
368
PIO_IMR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
369
PIO_ISR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
370
PIO_MDER
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
This register can only be written if the WPEN bit is cleared in the PIO Write Protection Mode Register.
P0-P31: Multi-drive Enable
0: No effect.
1: Enables multi-drive on the I/O line.
371
PIO_MDDR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
This register can only be written if the WPEN bit is cleared in the PIO Write Protection Mode Register.
P0P31: Multi-drive Disable
0: No effect.
1: Disables multi-drive on the I/O line.
372
PIO_MDSR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
373
PIO_PUDR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
This register can only be written if the WPEN bit is cleared in the PIO Write Protection Mode Register.
P0P31: Pull-Up Disable
0: No effect.
1: Disables the pull-up resistor on the I/O line.
374
PIO_PUER
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
This register can only be written if the WPEN bit is cleared in the PIO Write Protection Mode Register.
P0P31: Pull-Up Enable
0: No effect.
1: Enables the pull-up resistor on the I/O line.
375
PIO_PUSR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
376
PIO_ABCDSR1
Access:
Read/Write
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
This register can only be written if the WPEN bit is cleared in the PIO Write Protection Mode Register.
P0P31: Peripheral Select
If the same bit is set to 0 in PIO_ABCDSR2:
0: Assigns the I/O line to the Peripheral A function.
1: Assigns the I/O line to the Peripheral B function.
If the same bit is set to 1 in PIO_ABCDSR2:
0: Assigns the I/O line to the Peripheral C function.
1: Assigns the I/O line to the Peripheral D function.
377
PIO_ABCDSR2
Access:
Read/Write
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
This register can only be written if the WPEN bit is cleared in the PIO Write Protection Mode Register.
P0P31: Peripheral Select
If the same bit is set to 0 in PIO_ABCDSR1:
0: Assigns the I/O line to the Peripheral A function.
1: Assigns the I/O line to the Peripheral C function.
If the same bit is set to 1 in PIO_ABCDSR1:
0: Assigns the I/O line to the Peripheral B function.
1: Assigns the I/O line to the Peripheral D function.
378
PIO_IFSCDR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
379
PIO_IFSCER
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
380
PIO_IFSCSR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
381
PIO_SCDR
Address:
(PIOE)
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
DIV
5
DIV
382
PIO_PPDDR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
This register can only be written if the WPEN bit is cleared in the PIO Write Protection Mode Register.
P0P31: Pull-Down Disable
0: No effect.
1: Disables the pull-down resistor on the I/O line.
383
PIO_PPDER
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
This register can only be written if the WPEN bit is cleared in the PIO Write Protection Mode Register.
P0P31: Pull-Down Enable
0: No effect.
1: Enables the pull-down resistor on the I/O line.
384
PIO_PPDSR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
385
PIO_OWER
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
This register can only be written if the WPEN bit is cleared in the PIO Write Protection Mode Register.
P0P31: Output Write Enable
0: No effect.
1: Enables writing PIO_ODSR for the I/O line.
386
PIO_OWDR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
This register can only be written if the WPEN bit is cleared in the PIO Write Protection Mode Register.
P0P31: Output Write Disable
0: No effect.
1: Disables writing PIO_ODSR for the I/O line.
387
PIO_OWSR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
388
PIO_AIMER
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
389
PIO_AIMDR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
390
PIO_AIMMR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
391
PIO_ESR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
392
PIO_LSR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
393
PIO_ELSR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
394
PIO_FELLSR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
395
PIO_REHLSR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
396
PIO_FRLHSR
Address:
(PIOE)
Access:
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
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
397
PIO_WPMR
Address:
(PIOE)
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
WPKEY
23
22
21
20
WPKEY
15
14
13
12
WPKEY
7
WPEN
Name
0x50494F
PASSWD
398
Description
Writing any other value in this field aborts the write operation of the WPEN bit. Always reads as
0.
PIO_WPSR
Address:
(PIOE)
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
11
10
WPVSRC
15
14
13
12
WPVSRC
7
WPVS
399
PIO_SCHMITT
Address:
(PIOE)
Access:
Read/Write
31
30
29
28
27
26
25
24
SCHMITT31
SCHMITT30
SCHMITT29
SCHMITT28
SCHMITT27
SCHMITT26
SCHMITT25
SCHMITT24
23
22
21
20
19
18
17
16
SCHMITT23
SCHMITT22
SCHMITT21
SCHMITT20
SCHMITT19
SCHMITT18
SCHMITT17
SCHMITT16
15
14
13
12
11
10
SCHMITT15
SCHMITT14
SCHMITT13
SCHMITT12
SCHMITT11
SCHMITT10
SCHMITT9
SCHMITT8
SCHMITT7
SCHMITT6
SCHMITT5
SCHMITT4
SCHMITT3
SCHMITT2
SCHMITT1
SCHMITT0
400
PIO_DRIVER1
Address:
(PIOE)
Access:
Read/Write
31
30
29
LINE15
23
22
21
LINE11
15
27
20
13
LINE7
19
12
LINE3
18
11
17
LINE4
2
LINE1
16
LINE8
10
24
LINE12
LINE5
4
LINE2
25
LINE9
LINE6
6
26
LINE13
LINE10
14
28
LINE14
LINE0
Name
Description
LO_DRIVE
Low drive
LO_DRIVE
Low drive
ME_DRIVE
Medium drive
HI_DRIVE
High drive
401
PIO_DRIVER2
Address:
(PIOE)
Access:
Read/Write
31
30
29
LINE31
23
22
21
LINE27
15
27
14
20
13
19
12
18
11
Value
Name
Description
LO_DRIVE
Low drive
LO_DRIVE
Low drive
ME_DRIVE
Medium drive
HI_DRIVE
High drive
16
LINE20
2
LINE17
402
17
LINE24
10
24
LINE28
LINE21
4
LINE18
25
LINE25
LINE22
LINE19
26
LINE29
LINE26
LINE23
7
28
LINE30
LINE16
29.
29.1
Description
The Multi-port DDR-SDRAM Controller (MPDDRC) is a multi-port memory controller. It comprises eight slave AHB
interfaces. All simultaneous accesses (eight independent AHB ports) are interleaved to maximize memory
bandwidth and minimize transaction latency due to DDR-SDRAM protocol.
The MPDDRC extends the memory capabilities of a chip by providing the interface to the external 16-bit or 32-bit
DDR-SDRAM device. The page size support ranges from 2048 to 16384 and the number of columns from 512 to
4096. It supports dword (64-bit), word (32-bit), half-word (16-bit), and byte (8-bit) accesses.
The MPDDRC supports a read or write burst length of eight locations. This enables the command and address bus
to anticipate the next command, thus reducing latency imposed by the DDR-SDRAM protocol and improving the
DDR-SDRAM bandwidth. Moreover, MPDDRC keeps track of the active row in each bank, thus maximizing DDRSDRAM performance, e.g., the application may be placed in one bank and data in other banks. To optimize
performance, avoid accessing different rows in the same bank. The MPDDRC supports CAS latency of 2, 3, 4, 5 or
6 and optimizes the read access depending on the frequency.
Self-refresh, power-down and deep power-down modes minimize the consumption of the DDR-SDRAM device.
OCD (Off-chip Driver) and ODT (On-die Termination) modes are not supported.
29.2
Embedded Characteristics
Eight advanced high performance bus (AHB) interfaces, management of all accesses maximizes memory
bandwidth and minimizes transaction latency
Programming Facilities
Multibank ping-pong access (up to four or eight banks opened at the same time = reduced average
latency of transactions)
Automatic update of DS, TCR and PASR parameters (low-power DDR-SDRAM devices)
Energy-saving capabilities
OCD (Off-chip Driver) mode, ODT (On-die Termination) are not supported
403
29.3
Interconnect Matrix block that manages concurrent accesses on the AHB bus between four AHB masters
and integrates an arbiter
DDR controller that translates AHB requests (read/write) in the DDR-SDRAM protocol
Figure 29-1.
DDR Controller
AHB Slave Interface 0
Input
Stage
Power Management
clk/nclk
AHB Slave Interface 1
ras, cas,
we, cke
Input
Stage
Output
Stage
.
.
.
Input
Stage
Input
Stage
Interconnect Matrix
APB
Interface APB
Addr, DQM
DDR-Devices
DQS
Arbiter
Data
.
.
.
404
Memory Controller
Finite State Machine
SDRAM Signal Management
odt
Asynchronous Timing
Refresh Management
29.4
Program the features of the low-power DDR1-SDRAM device in the MPDDRC Configuration Register
(number of columns, rows, banks, CAS latency and output drive strength) and in the MPDDRC Timing
Parameter 0 Register/MPDDRC Timing Parameter 1 Register (asynchronous timing (TRC, TRAS, etc.)).
3.
Program Temperature Compensated Self-refresh (TCR), Partial Array Self-refresh (PASR) and Drive
Strength (DS) parameters in the MPDDRC Low-power Register.
4.
5.
A NOP command is issued to the low-power DDR1-SDRAM. Program the NOP command in the MPDDRC
Mode Register (MPDDRC_MR). The application must write a one to the MODE field in the MPDDRC_MR.
Perform a write access to any low-power DDR1-SDRAM address to acknowledge this command. The clocks
which drive the low-power DDR1-SDRAM device are now enabled.
6.
A NOP command is issued to the low-power DDR1-SDRAM. Program the NOP command in the
MPDDRC_MR. The application must write a one to the MODE field in the MPDDRC_MR. Perform a write
access to any low-power DDR1-SDRAM address to acknowledge this command. A calibration request is
now made to the I/O pad.
7.
An All Banks Precharge command is issued to the low-power DDR1-SDRAM. Program All Banks Precharge
command in the MPDDRC_MR. The application must write a two to the MODE field in the MPDDRC_MR.
Perform a write access to any low-power DDR1-SDRAM address to acknowledge this command.
8.
Two auto-refresh (CBR) cycles are provided. Program the Auto Refresh command (CBR) in the
MPDDRC_MR. The application must write a four to the MODE field in the MPDDRC_MR. Perform a write
access to any low-power DDR1-SDRAM location twice to acknowledge these commands.
9.
An Extended Mode Register set (EMRS) cycle is issued to program the low-power DDR1-SDRAM
parameters (TCSR, PASR, DS). The application must write a five to the MODE field in the MPDDRC_MR
and perform a write access to the SDRAM to acknowledge this command. The write address must be
chosen so that signal BA[1] is set to 1 and BA[0] is set to 0. For example, with a 16-bit 128 Mbits low-power
DDR1-SDRAM (12 rows, 9 columns, 4 banks), the SDRAM write access should be done at the address:
BASE_ADDRESS_DDR + 0x00800000. For example, with a 32-bit 1 Gbit low-power DDR1-SDRAM (14
rows, 10 columns, 4 banks), the SDRAM write access should be done at the address:
BASE_ADDRESS_DDR + 0x08000000.
Note:
This address is given as an example only. The real address depends on implementation in the product.
10. A Mode Register set (MRS) cycle is issued to program parameters of the low-power DDR1-SDRAM devices,
in particular CAS latency. The application must write a three to the MODE field in the MPDDRC_MR and
perform a write access to the low-power DDR1-SDRAM to acknowledge this command. The write address
must be chosen so that signals BA[1:0] are set to 0. For example, the SDRAM write access should be done
at the address: BASE_ADDRESS_DDR.
11. The application must enter Normal mode, write a zero to the MODE field in the MPDDRC_MR and perform a
write access at any location in the low-power DDR1-SDRAM to acknowledge this command.
12. Perform a write access to any low-power DDR1-SDRAM address.
13. Write the refresh rate into the COUNT field in the MPDDRC Refresh Timer Register (MPDDRC_RTR):
refresh rate = delay between refresh cycles. The low-power DDR1-SDRAM device requires a refresh every
405
15.625 s or 7.81 s. With a 100 MHz frequency, MPDDRC_RTR must be set with (15.625 100 MHz) =
1562 i.e., 0x061A or (7.81 100 MHz) = 781 i.e., 0x030D.
After initialization, the low-power DDR1-SDRAM device is fully functional.
29.4.2 DDR2-SDRAM Initialization
The initialization sequence is generated by software. The DDR2-SDRAM devices are initialized by the following
sequence:
1. Program the memory device type in the MPDDRC Memory Device Register.
2.
Program features of the DDR2-SDRAM device in the MPDDRC Configuration Register (number of columns,
rows, banks, CAS latency and output driver impedance control) and in the MPDDRC Timing Parameter 0
Register/MPDDRC Timing Parameter 1 Register (asynchronous timing (TRC, TRAS, etc.).
3.
A NOP command is issued to the DDR2-SDRAM. Program the NOP command in the MPDDRC Mode
Register (MPDDRC_MR). The application must write a one to the MODE field in the MPDDRC_MR. Perform
a write access to any DDR2-SDRAM address to acknowledge this command. The clocks which drive the
DDR2-SDRAM device are now enabled.
4.
5.
A NOP command is issued to the DDR2-SDRAM. Program the NOP command in the MPDDRC_MR. The
application must write a one to the MODE field in the MPDDRC_MR. Perform a write access to any DDR2SDRAM address to acknowledge this command. CKE is now driven high.
6.
An All Banks Precharge command is issued to the DDR2-SDRAM. Program All Banks Precharge command
in the MPDDRC_MR. The application must write a two to the MODE field in the MPDDRC_MR. Perform a
write access to any DDR2-SDRAM address to acknowledge this command.
7.
An Extended Mode Register set (EMRS2) cycle is issued to choose between commercial or high
temperature operations. The application must write a five to the MODE field in the MPDDRC_MR and
perform a write access to the DDR2-SDRAM to acknowledge this command. The write address must be
chosen so that signal BA[1] is set to 1 and signal BA[0] is set to 0. For example, with a 16-bit 128 Mbits
DDR2-SDRAM (12 rows, 9 columns, 4 banks), the DDR2-SDRAM write access should be done at the
address: BASE_ADDRESS_DDR + 0x00800000. For example, with a 32-bit 1 Gbit DDR2-SDRAM (14 rows,
10 columns, 8 banks), the SDRAM write access should be done at the address: BASE_ADDRESS_DDR +
0x08000000.
Note:
This address is given as an example only. The real address depends on implementation in the product.
8.
An Extended Mode Register set (EMRS3) cycle is issued to set the Extended Mode Register to 0. The
application must write a five to the MODE field in the MPDDRC_MR and perform a write access to the
DDR2-SDRAM to acknowledge this command. The write address must be chosen so that signal BA[1] is set
to 1 and signal BA[0] is set to 1. For example, with a 16-bit 128 Mbits DDR2-SDRAM (12 rows, 9 columns, 4
banks), the DDR2-SDRAM write access should be done at the address: BASE_ADDRESS_DDR +
0x00C00000. For example, with a 32-bit 1 Gbit DDR2-SDRAM (14 rows, 10 columns, 8 banks), the SDRAM
write access should be done at the address: BASE_ADDRESS_DDR + 0x0C000000.
9.
An Extended Mode Register set (EMRS1) cycle is issued to enable DLL and to program D.I.C. (Output
Driver Impedance Control). The application must write a five to the MODE field in the MPDDRC_MR and
perform a write access to the DDR2-SDRAM to acknowledge this command. The write address must be
chosen so that signal BA[1] is set to 0 and signal BA[0] is set to 1.For example, with a 16-bit 128 Mbits
DDR2-SDRAM (12 rows, 9 columns, 4 banks), the DDR2-SDRAM write access should be done at the
address: BASE_ADDRESS_DDR + 0x00400000. For example, with a 32-bit 1 Gbit DDR2-SDRAM (14 rows,
10 columns, 8 banks), the SDRAM write access should be done at the address: BASE_ADDRESS_DDR +
0x04000000.
10. An additional 200 cycles of clock are required for locking DLL
11. Write a one to the DLL bit (enable DLL reset) in the MPDDRC Configuration Register (MPDDRC_CR).
406
12. A Mode Register set (MRS) cycle is issued to reset DLL. The application must write a three to the MODE
field in the MPDDRC_MR and perform a write access to the DDR2-SDRAM to acknowledge this command.
The write address must be chosen so that signals BA[1:0] are set to 0. For example, the SDRAM write
access should be done at the address: BASE_ADDRESS_DDR.
13. An All Banks Precharge command is issued to the DDR2-SDRAM. Program the All Banks Precharge
command in the MPDDRC_MR. The application must write a two to the MODE field in the MPDDRC_MR.
Perform a write access to any DDR2-SDRAM address to acknowledge this command.
14. Two auto-refresh (CBR) cycles are provided. Program the Auto Refresh command (CBR) in the
MPDDRC_MR. The application must write a four to the MODE field in the MPDDRC_MR. Perform a write
access to any DDR2-SDRAM location twice to acknowledge these commands.
15. Write a zero to the DLL bit (disable DLL reset) in the MPDDRC_CR.
16. A Mode Register set (MRS) cycle is issued to program parameters of the DDR2-SDRAM device, in particular
CAS latency and to disable DLL reset. The application must write a three to the MODE field in the
MPDDRC_MR and perform a write access to the DDR2-SDRAM to acknowledge this command. The write
address must be chosen so that signals BA[1:0] are set to 0.For example, with a 16-bit 128 Mbits DDR2SDRAM (12 rows, 9 columns, 4 banks) bank address, the SDRAM write access should be done at the
address: BASE_ADDRESS_DDR. For example, with a 32-bit 1 Gbit DDR2-SDRAM (14 rows, 10 columns, 8
banks), the SDRAM write access should be done at the address: BASE_ADDRESS_DDR.
17. Write a seven to the OCD field (default OCD calibration) in the MPDDRC_CR.
18. An Extended Mode Register set (EMRS1) cycle is issued to the default OCD value. The application must
write a five to the MODE field in the MPDDRC_MR and perform a write access to the DDR2-SDRAM to
acknowledge this command. The write address must be chosen so that signal BA[1] is set to 0 and signal
BA[0] is set to 1. For example, with a 16-bit 128 Mbits DDR2-SDRAM (12 rows, 9 columns, 4 banks), the
DDR2-SDRAM write access should be done at the address: BASE_ADDRESS_DDR + 0x00400000. For
example, with a 32-bit 1 Gbit DDR2-SDRAM (14 rows, 10 columns, 8 banks), the SDRAM write access
should be done at the address: BASE_ADDRESS_DDR + 0x04000000.
19. Write a zero to the OCD field (exit OCD calibration mode) in the MPDDRC_CR.
20. An Extended Mode Register set (EMRS1) cycle is issued to enable OCD exit. The application must write a
five to the MODE field in the MPDDRC_MR and perform a write access to the DDR2-SDRAM to
acknowledge this command. The write address must be chosen so that signal BA[1] is set to 0 and signal
BA[0] is set to 1. For example, with a 16-bit 128 Mbits DDR2-SDRAM (12 rows, 9 columns, 4 banks) bank
address, the DDR2-SDRAM write access should be done at the address: BASE_ADDRESS_DDR +
0x00400000. For example, with a 32-bit 1 Gbit DDR2-SDRAM (14 rows, 10 columns, 8 banks), the SDRAM
write access should be done at the address: BASE_ADDRESS_DDR + 0x04000000.
21. A Normal mode command is provided. Program the normal mode in the MPDDRC_MR and perform a write
access to any DDR2-SDRAM address to acknowledge this command.
22. Perform a write access to any DDR2-SDRAM address.
23. Write the refresh rate into the COUNT field in the MPDDRC Refresh Timer Register (MPDDRC_RTR):
refresh rate = delay between refresh cycles. The DDR2-SDRAM device requires a refresh every 15.625 s
or 7.81 s. With a 133 MHz frequency, the COUNT field in the MPDDRC_RTR must be set with (15.625
133 MHz) = 2079 i.e., 0x081F or (7.81 133 MHz) = 1039 i.e., 0x040F.
After initialization, the DDR2-SDRAM devices are fully functional.
407
Program features of the low-power DDR2-SDRAM device into and in the MPDDRC Configuration Register
(number of columns, rows, banks, CAS latency and output drive strength) and in the MPDDRC Timing
Parameter 0 Register/MPDDRC Timing Parameter 0 Register (asynchronous timing, TRC, TRAS, etc.).
3.
A NOP command is issued to the low-power DDR2-SDRAM. Program the NOP command in the MPDDRC
Mode Register (MPDDRC_MR). The application must write a one to the MODE field in the MPDDRC_MR.
Perform a write access to any low-power DDR2-SDRAM address to acknowledge this command. The clocks
which drive the Low-power DDR2-SDRAM devices are now enabled.
4.
5.
A NOP command is issued to the low-power DDR2-SDRAM. Program the NOP command in the
MPDDRC_MR. The application must write a one to the MODE field in the MPDDRC_MR. Perform a write
access to any low-power DDR2-SDRAM address to acknowledge this command. CKE is now driven high.
6.
7.
A Reset command is issued to the low-power DDR2-SDRAM. In the MPDDRC_MR, configure the MODE
field to the LPDDR2_CMD value and configure the MRS field. The application must write a seven to the
MODE field and a 63 to the MRS field. Perform a write access to any low-power DDR2-SDRAM address to
acknowledge this command. The Reset command is now issued.
8.
9.
A Calibration command is issued to the low-power DDR2-SDRAM. Program the type of calibration in the
MPDDRC Configuration Register (MPDDRC_CR): set the ZQ field to the RESET value. In the
MPDDRC_MR, configure the MODE field to the LPDDR2_CMD value and configure the MRS field. The
application must write a seven to the MODE field and a 10 to the MRS field. Perform a write access to any
low-power DDR2-SDRAM address to acknowledge this command. The ZQ Calibration command is now
issued. Program the type of calibration in the MPDDRC_CR: set the ZQ field to the SHORT value.
10. A Mode Register Write command is issued to the low-power DDR2-SDRAM. In the MPDDRC_MR, configure
the MODE field to the LPDDR2_CMD value and configure the MRS field. The application must write a seven
to the MODE field and a one to the MRS field. Perform a write access to any low-power DDR2-SDRAM
address to acknowledge this command. The Mode Register Write command is now issued.
11. A Mode Register Write command is issued to the low-power DDR2-SDRAM. In the MPDDRC_MR, configure
the MODE field to the LPDDR2_CMD value and configure the MRS field. The application must write a seven
to the MODE field and a two to the MRS field. The Mode Register Write command cycle is issued to program
parameters of the low-power DDR2-SDRAM device, in particular CAS latency. Perform a write access to any
low-power DDR2-SDRAM address to acknowledge this command. The Mode Register Write command is
now issued.
12. A Mode Register Write command is issued to the low-power DDR2-SDRAM. In the MPDDRC_MR, configure
the MODE field to the LPDDR2_CMD value and configure the MRS field. The application must write a seven
to the MODE field and a three to the MRS field. The Mode Register Write command cycle is issued to
program parameters of the low-power DDR2-SDRAM device, in particular Drive Strength and Slew Rate.
Perform a write access to any low-power DDR2-SDRAM address to acknowledge this command. The Mode
Register Write command is now issued.
13. A Mode Register Write command is issued to the low-power DDR2-SDRAM. In the MPDDRC_MR configure
the MODE field to the LPDDR2_CMD value and configure the MRS field. The application must write a seven
to the MODE field and a 16 to the MRS field. Mode Register Write command cycle is issued to program
parameters of the low-power DDR2-SDRAM device, in particular Partial Array Self Refresh (PASR). Perform
408
a write access to any low-power DDR2-SDRAM address to acknowledge this command. The Mode Register
Write command is now issued.
14. A Normal mode command is provided. Program the normal mode in the MPDDRC_MR and perform a write
access to any low-power DDR2-SDRAM address to acknowledge this command.
15. Write the refresh rate into the COUNT field in the MPDDRC Refresh Timer Register (MPDDRC_RTR):
refresh rate = delay between refresh cycles. The low-power DDR2-SDRAM device requires a refresh every
7.81 s. With a 133 MHz frequency, the COUNT field in the MPDDRC_RTR must be set with (7.81 133
MHz) = 1039 i.e., 0x040F.
After initialization, the low-power DDR2-SDRAM devices are fully functional.
409
29.5
Functional Description
410
Figure 29-2.
DDRCK
Row a
A[12:0]
COMMAND
BA[1:0]
NOP
PRCHG
NOP
col a
ACT
NOP
WRITE
NOP
00
DQS[1:0]
DM[1:0]
D[15:0]
Da
tRP = 2
Figure 29-3.
Db
tRCD = 2
DDRCK
Row a
A[12:0]
COMMAND
BA[1:0]
NOP
PRCHG
NOP
ACT
col a
NOP
WRITE
NOP
00
DQS[1:0]
DM[1:0]
D[15:0]
Da
tRP = 2
Db
tRCD = 2
411
Figure 29-4.
DDRCK
A[12:0]
Row a
COMMAND
BA[1:0]
NOP
PRCHG
NOP
col a
ACT
NOP
WRITE
NOP
DQS[1:0]
DM[1:0]
D [15:0]
Da
tRP = 2
Figure 29-5.
Db
Dc
Dd
3
De
Df
Dg
Dh
tRCD = 2
DDRCK
A[12:0]
Row a
COMMAND
BA[1:0]
NOP
PRCHG
NOP
col a
ACT
NOP
WRITE
NOP
DQS[1:0]
DM[1:0]
D [15:0]
Da
tRP = 2
Db
Dc
Dd
3
De
Df
Dg
Dh
tRCD = 2
A write command can be followed by a read command. To avoid breaking the current write burst, tWTR/tWRD (bl/2 +
2 = 6 cycles) should be met. See Figure 29-6 on page 413.
412
Figure 29-6.
Write Command Followed by a Read Command without Burst Write Interrupt, DDR-SDRAM Devices
DDRCK
A[12:0]
col a
COMMAND
BA[1:0]
NOP
col a
WRITE
NOP
READ
BST
NOP
DQS[1:0]
DM[1:0]
D[15:0]
Da
3
Db Dc
Dd
De
Df
Dg
Dh
Da Db
tWR = 1
In case of a single write access, write operation should be interrupted by a read access but DM must be input one
cycle prior to the read command to avoid writing invalid data. See Figure 29-7 on page 413.
Figure 29-7.
DDRCK
A[12:0]
COMMAND
BA[1:0]
col a
Row a
NOP
PRCHG
NOP
ACT
NOP
WRITE
NOP
READ
BST
NOP
DQS[1:0]
DM[1:0]
D[15:0]
Da
Db
Da Db
Data masked
413
Figure 29-8.
DDRCK
A[12:0]
Row a
COMMAND
BA[1:0]
col a
ACT
NOP
WRITE
NOP
READ
NOP
DQS[1:0]
DM[1:0]
D[15:0]
Da
3
Da Db
Db
Data masked
tWTR
414
Read accesses to the DDR-SDRAM are burst oriented and the burst length is programmed to 8. The burst length
determines the maximum number of column locations that can be accessed for a given read command. When the
read command is issued, eight columns are selected. All accesses for that burst take place within these eight
columns, meaning that the burst wraps within these eight columns if the boundary is reached. These eight columns
are selected by addr[13:3]; addr[2:0] is used to select the starting location within the block.
In case of incrementing burst (INCR/INCR4/INCR8/INCR16), the addresses can cross the 16-byte boundary of the
DDR-SDRAM device. For example, when a transfer (INCR4) starts at address 0x0C, the next access is 0x10, but
since the burst length is programmed to 8, the next access is 0x00. Since the boundary is reached, the burst
wraps. The MPDDRC takes into account this feature of the SDRAM device. In case of the DDR-SDRAM device,
transfers start at address 0x04/0x08/0x0C. Two read commands are issued to avoid wrapping when the boundary
is reached. The last read command may generate additional reading (1 read cmd = 4 DDR words).
To avoid additional reading, it is possible to use the burst stop command to truncate the read burst and to
decrease power consumption. The DDR2-SDRAM devices do not support the burst stop command.
Figure 29-9.
DDRCK
A[12:0]
COMMAND
Row a
NOP
BA[1:0]
DM[3:0]
PRCHG
NOP
ACT
col a
NOP
READ
BST
D[31:0]
NOP
DaDb
tRP
tRCD
Latency = 2
Figure 29-10. Single Read Access, Row Closed, Latency = 3, DDR2-SDRAM Devices
DDRCK
A[12:0]
COMMAND
BA[1:0]
NOP
PRCHG
NOP
Row a
Col a
ACT
NOP
READ
DQS[1]
DQS[0]
DM[1:0]
D[15:0]
Da
tRP
tRCD
Db
Latency = 3
415
Col a
NOP
READ
NOP
DQS[1:0]
DM[1:0]
D[15:0]
Da
Db
Dc
Dd
De
Df
Dg
Dh
Latency = 2
Col a
NOP
READ
NOP
DQS[1:0]
DM[1:0]
D[15:0]
Da
Db
Dc
Dd
De
Df
Dg
Dh
Latency = 3
The All Banks Auto Refresh command performs a refresh operation on all banks. An auto refresh command is
used to refresh the MPDDRC. Refresh addresses are generated internally by the DDR-SDRAM device and
incremented after each auto-refresh automatically. The MPDDRC generates these auto-refresh commands
periodically. A timer is loaded in the MPDDRC_RTR with the value that indicates the number of clock cycles
between refresh cycles (see Section 29.7.2 MPDDRC Refresh Timer Register). When the MPDDRC initiates a
refresh of the DDR-SDRAM device, internal memory accesses are not delayed. However, if the CPU tries to
access the DDR-SDRAM device, the slave indicates that the device is busy. A refresh request does not interrupt a
burst transfer in progress. This feature is activated by setting Per-bank Refresh bit (REF_PB) to 0 in the
MPDDRC_RTR (see Section 29.7.2 MPDDRC Refresh Timer Register).
29.5.2.2 Per-bank Auto Refresh
The low-power DDR2-SDRAM embeds a new Per-bank Refresh command which performs a refresh operation on
the bank scheduled by the bank counter in the memory device. The Per-bank Refresh command is executed in a
fixed sequence order of round-robin type: 0-1-2-3-4-5-6-7-0-1-.... The bank counter is automatically cleared upon
issuing a RESET command or when exiting from self-refresh mode, in order to ensure the synchronism between
SDRAM memory device and the MPDDRC controller. The bank addressing for the Per-bank Refresh count is the
same as established in the Single-bank Precharge command. This feature is activated by setting the Per-bank
Refresh bit (REF_PB) to 1 in the MPDDRC_RTR (see Section 29.7.2 MPDDRC Refresh Timer Register). This
416
feature masks the latency due to the refresh procedure. The target bank is inaccessible during the Per-bank
Refresh cycle period (tRFCpb), however other banks within the device are accessible and may be addressed during
the Per-bank Refresh cycle. During the REFpb operation, any bank other than the one being refreshed can be
maintained in active state or accessed by a read or a write command. When the Per-bank Refresh cycle is
completed, the affected bank will be in idle state.
29.5.2.3 Adjust Auto Refresh Rate
The low-power DDR2-SDRAM embeds an internal register, Mode Register 19 (Refresh Mode). The content of this
register allows to adjust the interval of auto-refresh operations according to temperature variation. This feature is
activated by setting the Adjust Refresh bit [ADJ_REF] to 1 in the MPDDRC_RTR (see Section 29.7.2 MPDDRC
Refresh Timer Register). When this feature is enabled, a mode register read command (MRR) is performed every
16 tREFI (average time between REFRESH commands). Depending on the read value, the auto refresh interval
will be modified. In case of high temperature, the interval is reduced and in case of low temperature, the interval is
increased.
29.5.3 Power Management
29.5.3.1 Self-refresh Mode
This mode is activated by writing a one to the Low-power Command bit (LPCB) in the MPDDRC Low-power
Register (MPDDRC_LPR).
Self-refresh mode is used in power-down mode, i.e., when no access to the DDR-SDRAM device is possible. In
this case, power consumption is very low. In self-refresh mode, the DDR-SDRAM device retains data without
external clocking and provides its own internal clocking, thus performing its own auto refresh cycles. During selfrefresh period CKE is driven low. As soon as the DDR-SDRAM device is selected, the MPDDRC provides a
sequence of commands and exits self-refresh mode.
The MPDDRC re-enables self-refresh mode as soon as the DDR-SDRAM device is not selected. It is possible to
define when self-refresh mode is to be enabled by configuring the TIMEOUT field in the MPDDRC_LPR:
0: Self-refresh mode is enabled as soon as the DDR-SDRAM device is not selected.
1: Self-refresh mode is enabled 64 clock cycles after completion of the last access.
2: Self-refresh mode is enabled 128 clock cycles after completion of the last access.
This controller also interfaces the low-power DDR-SDRAM. To optimize power consumption, the Low Power DDR
SDRAM provides programmable self-refresh options comprised of Partial Array Self Refresh (full, half, quarter and
1/8 and 1/16 array).
Disabled banks are not refreshed in self-refresh mode. This feature permits to reduce the self-refresh current. In
case of low-power DDR1-SDRAM, the Extended Mode register controls this feature. It includes Temperature
Compensated Self-refresh (TSCR) and Partial Array Self-refresh (PASR) parameters and the drive strength (DS)
(see Section 29.7.7 MPDDRC Low-power Register). In case of low-power DDR2-SDRAM, the mode registers 16
and 17 control this feature, including PASR Bank Mask (BK_MASK) and PASR Segment Mask (SEG_MASK)
parameters and drives strength (DS) (see Section 29.7.9 MPDDRC Low-power DDR2 Low-power Register on
page 449). These parameters are set during the initialization phase. After initialization, as soon as the
PASR/DS/TCSR fields or BK_MASK/SEG_MASK/DS are modified, the memory device Extended Mode Register
or Mode Registers 3/16/17 are automatically accessed. Thus if MPDDRC does not share an external bus with
another controller, PASR/DS/TCSR and BK_MASK/SEG_MASK/DS bits are updated before entering self-refresh
mode or during a refresh command. If MPDDRC does share an external bus with another controller,
PASR/DS/TCSR and BK_MASK/SEG_MASK/DS bits are also updated during a pending read or write access.
This type of update is a function of the UPD_MR bit (see Section 29.7.7 MPDDRC Low-power Register).
The low-power DDR1-SDRAM must remain in self-refresh mode during the minimum of TRFC periods (see
Section 29.7.5 MPDDRC Timing Parameter 1 Register), and may remain in self-refresh mode for an indefinite
period.
SAMA5D4 Series [DATASHEET]
Atmel-11238A-ATARM-SAMA5D4-Datasheet_30-Sep-14
417
The DDR2-SDRAM must remain in self-refresh mode during the minimum of tCKE periods (see the memory device
datasheet), and may remain in self-refresh mode for an indefinite period.
The low-power DDR2-SDRAM must remain in self-refresh mode for the minimum of tCKESR periods (see the
memory device datasheet) and may remain in self-refresh mode for an indefinite period.
Figure 29-13. Self-refresh Mode Entry, Time-out = 0
DDRCK
A[12:0]
NOP READ
COMMAND
BST
NOP
PRCHG
NOP
ARFSH
NOP
CKE
BA[1:0]
DQS[0:1]
DM[1:0]
D[15:0]
Da
Db
tRP
Enter Self-refresh
Mode
DDRCK
A[12:0]
COMMAND
NOP READ
BST
NOP
PRCHG
NOP
ARFSH NOP
CKE
BA[1:0]
DQS[1:0]
DM[1:0]
D[15:0]
Da
Db
64 or 128
Wait states
418
tRP
Enter Self-refresh
Mode
DDRCK
A[12:0]
COMMAND
NOP
VALID
NOP
CKE
BA[1:0]
DQS[1:0]
DM[1:0]
D[15:0]
Exit Self-refresh Mode
Clock must be stable
before exiting self-refresh mode
tXNRD / tXSRD
tXSR
(DDR device)
(Low-power DDR device)
419
DDRCK
A[12:0]
COMMAND
READ
BST
NOP
READ
CKE
BA[1:0]
DQS[1:0]
DM[1:0]
D[15:0]
Da
Db
The deep power-down mode is a feature of low-power DDR-SDRAM. When this mode is activated, all internal
voltage generators inside the device are stopped and all data is lost.
Deep power-down mode is activated by writing a three to the Low-power Command bit (LPCB). When this mode is
enabled, the MPDDRC leaves normal mode (MPDDRC_MR.MODE = 0) and the controller is frozen.
Before enabling this mode, the user must assume there is no access in progress. To exit deep power-down mode,
the Low-power Command bit (LPCB) must be written to zero and the initialization sequence must be generated by
software. See Section 29.4.1 Low-power DDR1-SDRAM Initialization or Section 29.4.3 Low-power DDR2SDRAM Initialization.
Figure 29-17. Deep Power-down Mode Entry
DDRCK
A[12:0]
COMMAND
NOP READ
BST
NOP
PRCHG
NOP
DEEPOWER
NOP
CKE
BA[1:0]
DQS[1:0]
DM[1:0]
D[15:0]
Da
Db
tRP
Enter Deep
Power-down
Mode
29.5.3.4 Change Frequency During Power-down Mode with Low-power DDR2-SDRAM Devices
To change frequency, power-down mode must be activated by writing a two to the Low-power Command bit
(LPCB) and a one to the Change Frequency Command bit (CHG_FR) in the MPDDRC Low-power Register.
Once the low-power DDR2-SDRAM is in precharge power-down mode, the clock frequency may change. The
device input clock frequency changes only within minimum and maximum operating frequencies as specified by
low-power DDR2-SDRAM providers. Once the input clock frequency is changed, new stable clocks must be
provided to the device before exiting from the precharge power-down mode.
420
Depending on the new clock frequency, the user can change the CAS latency in the user interface. (See CAS:
CAS Latency on page 436.) It is recommended to check that no access is in progress. Once the controller detects
a change of latency during the change frequency procedure, a Load Mode Register command is performed.
During a change frequency procedure, the Change Frequency Command bit (CHG_FR) is set to 0 automatically.
29.5.3.5 Reset Mode
The reset mode is a feature of DDR2-SDRAM. This mode is activated by writing a three to the Low-power
Command bit (LPCB) and a one to the Clock Frozen Command bit (CLK_FR) in the MPDDRC Low-power
Register.
When this mode is enabled, the MPDDRC leaves normal mode (MPDDRC_MR.MODE = 0) and the controller is
frozen. Before enabling this mode, the user must assume there is no access in progress.
To exit reset mode, the Low-power Command bit (LPCB) must be written to zero, the Clock Frozen Command bit
(CLK_FR) must be written to zero and the initialization sequence must be generated by software. (See Section
29.4.2 DDR2-SDRAM Initialization).
29.5.4 Multi-port Functionality
The DDR-SDRAM protocol imposes a check of timings prior to performing a read or a write access, thus
decreasing system performance. An access to DDR-SDRAM is performed if banks and rows are open (or active).
To activate a row in a particular bank, the last open row must be deactivated and a new row must be open. Two
DDR-SDRAM commands must be performed to open a bank: Precharge command and Activate command with
respect to tRP timing. Before performing a read or write command, tRCD timing must be checked.
This operation generates a significant bandwidth loss (see Figure 29-18.).
Figure 29-18. tRP and tRCD Timings
DDRCK
A[12:0]
COMMAND
BA[1:0]
NOP
PRCHG
NOP
ACT
NOP
READ
BST
NOP
DQS[1:0]
DM1:0]
D[15:0]
Da
tRP
tRCD
Db
Latency = 2
421
The multi-port controller is designed to mask these timings and thus improve the bandwidth of the system.
The MPDDRC is a multi-port controller whereby eight masters can simultaneously reach the controller. This
feature improves the bandwidth of the system because it can detect eight requests on the AHB slave inputs and
thus anticipate the commands that follow, Precharge and Activate command in bank X during the current access in
bank Y. This masks tRP and tRCD timings (see Figure 29-19). In the best case, all accesses are done as if the banks
and rows were already open. The best condition is met when the eight masters work in different banks. In case of
eight simultaneous read accesses, when the four or eight banks and associated rows are open, the controller
reads with a continuous flow and masks the CAS latency for each access. To allow a continuous flow, the read
command must be set at 2 or 6 cycles (CAS latency) before the end of the current access. This requires that the
scheme of arbitration changes since arbitration cannot be respected. If the controller anticipates a read access,
and thus a master with a high priority arises before the end of the current access, then this master will not be
serviced.
Figure 29-19. Anticipate Precharge/Activate Command in Bank 2 during Read Access in Bank 1
DDRCK
A[12:0]
COMMAND
BA[1:0]
NOP
0
READ
PRECH
1
NOP
ACT
READ
NOP
DQS[1:0]
DM1:0]
D[15:0]
Da
Db
Dc
Dd
De
Df
Dg
Dh
Di
Dj
Dk
Dl
tRP
Anticipate command, Precharge/Active Bank 2
Read Access in Bank 1
MPDDRC is a multi-port controller that embeds three arbitration mechanisms based on round -robin arbitration
which allows to share the external device between different masters when two or more masters try to access the
DDR-SDRAM device at the same time.
The three arbitration types are round-robin arbitration and two weighted round-robin arbitrations. For weighted
round-robin arbitrations, the priority can be given either depending on the number of requests or words per port, or
depending on the required bandwidth per port. The type of arbitration can be chosen by setting the ARB field in the
MPDDRC Configuration Arbiter Register (MPDDRC_CONF_ARBITER) (see Section 29.7.16 MPDDRC
Configuration Arbiter Register).
29.5.4.1 Round-robin Arbitration
Round-robin arbitration is used when the ARB field is set to 0 (see Section 29.7.16 MPDDRC Configuration
Arbiter Register). This algorithm dispatches the requests from different masters to the DDR-SDRAM device in a
round-robin manner. If two or more master requests arise at the same time, the master with the lowest number is
serviced first, then the others are serviced in a round-robin manner.
To avoid burst breaking and to provide the maximum throughput for the DDR-SDRAM device, arbitration must only
take place during the following cycles:
1. Idle cycles: when no master is connected to the DDR-SDRAM device.
2.
3.
End of Burst cycles: when the current cycle is the last cycle of a burst transfer:
422
For bursts of defined length, predicted end of burst matches the size of the transfer.
4.
For bursts of undefined length, predicted end of burst is generated at the end of each four-beat
boundary inside the INCR transfer.
Anticipated Access: when an anticipated read access is done while the current access is not complete, the
arbitration scheme can be changed if the anticipated access is not the next access serviced by the
arbitration scheme.
In request-word weighted round-robin arbitration, the weight is the number of requests or the number of words per
port.
This arbitration scheme is enabled by writing a one the ARB field (see MPDDRC Configuration Arbiter Register
on page 458). This algorithm grants a port for X(1) consecutive first transfer (htrans = NON SEQUENTIAL) of a
burst or X single transfer, or for X word transfers. It is possible to chose between an arbitration scheme by request
or by word per port by setting the RQ_WD_Px field (see MPDDRC Configuration Arbiter Register on page 458).
Note:
1.
It is also possible for the user to provide the number of requests or words (by overwriting the information provided
by a master) on master basis by configuring the MA_PR_Px field. Depending on the application, it is possible to
reduce or increase the number of these requests or words by configuring the NRD_NWD_BDW_Px fields (see
MPDDRC Configuration Arbiter Register on page 458).
The TIMEOUT_Px field defines the delay between two accesses on the same port in number of cycles before to
arbitrate and to give the hand to another port. This field allows to avoid a time-out on the system because some
masters have the particularity to add idle cycles between two consecutive accesses (see MPDDRC Configuration
Arbiter Register on page 458).
This algorithm dispatches the requests from different masters to the DDR-SDRAM device in a round-robin manner.
If two or more master requests arise at the same time, the master with the lowest number is serviced first, then the
others are serviced in a round-robin manner when the number of requests or words is reached or when the timeout value is reached.
To avoid burst breaking and to provide the maximum throughput for the DDR-SDRAM device, arbitration must only
take place during the following cycles:
1. Time-out is reached: the delay between two accesses is equal to TIMEOUT_Px.
2.
Number of requests or words is reached: when the current cycle is the last cycle of a transfer.
423
The BDW_BURST field allows to arbitrate either when the current master reaches exactly the programmed
bandwidth, or when the current master reaches exactly the programmed bandwidth and the current access is
ended (see MPDDRC Configuration Arbiter Register on page 458).
To provide the maximum throughput for the DDR-SDRAM device, arbitration must only take place during the
following cycles:
1. Time-out is reached: the delay between two accesses is equal to TIMEOUT_Px.
424
2.
3.
Allocated Bandwidth is reach and the current cycle is the last cycle of a transfer
425
29.6
426
29.6.1 DDR-SDRAM Address Mapping for 16-bit Memory Data Bus Width
Table 29-1.
27
26
25
24
23
22
21
20
19
18
17
16
Bk[1:0]
14
13
12
11
10
Row[10:0]
Bk[1:0]
M0
Column[10:0]
Row[10:0]
0
M0
Column[9:0]
Row[10:0]
Bk[1:0]
Column[8:0]
Row[10:0]
Bk[1:0]
Table 29-2.
15
M0
Column[11:0]
M0
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
Row[10:0]
10
Bk[1:0]
Row[10:0]
M0
Column[10:0]
Bk[1:0]
0
M0
Column[9:0]
Bk[1:0]
Row[10:0]
Column[8:0]
Bk[1:0]
Row[10:0]
Table 29-3.
11
M0
Column[11:0]
M0
27
26
25
24
23
22
21
20
19
18
17
Bk[1:0]
15
14
13
12
11
10
Row[11:0]
Bk[1:0]
M0
Column[10:0]
Row[11:0]
0
M0
Column[9:0]
Row[11:0]
Bk[1:0]
Column[8:0]
Row[11:0]
Bk[1:0]
Table 29-4.
16
M0
Column[11:0]
M0
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
Row[11:0]
10
Bk[1:0]
Row[11:0]
M0
Column[10:0]
Bk[1:0]
0
M0
Column[9:0]
Bk[1:0]
Row[11:0]
Column[8:0]
Bk[1:0]
Row[11:0]
Table 29-5.
11
M0
Column[11:0]
M0
27
26
25
24
23
22
21
20
19
18
Bk[1:0]
Bk[1:0]
Bk[1:0]
Bk[1:0]
17
16
15
Row[12:0]
Row[12:0]
Row[12:0]
Row[12:0]
14
13
12
11
10
Column[8:0]
Column[9:0]
Column[10:0]
Column[11:0]
0
M0
M0
M0
M0
427
Table 29-6.
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
Row[12:0]
10
Bk[1:0]
Row[12:0]
M0
Column[10:0]
Bk[1:0]
0
M0
Column[9:0]
Bk[1:0]
Row[12:0]
Column[8:0]
Bk[1:0]
Row[12:0]
Table 29-7.
11
M0
Column[11:0]
M0
Sequential Mapping for DDR-SDRAM Configuration: 16K Rows, 512/1024/2048 Columns, 4 banks
CPU Address Line
27
26
25
24
23
22
21
20
19
18
Bk[1:0]
17
16
15
14
13
12
11
10
Row[13:0]
Bk[1:0]
Column[8:0]
Row[13:0]
Bk[1:0]
0
M0
Column[9:0]
Row[13:0]
Table 29-8.
M0
Column[10:0]
M0
Interleaved Mapping for DDR-SDRAM Configuration: 16K Rows, 512/1024/2048 Columns, 4 banks
CPU Address Line
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
Row[13:0]
10
Bk[1:0]
Row[13:0]
Column[8:0]
Bk[1:0]
Row[13:0]
Table 29-9.
11
M0
Column[9:0]
Bk[1:0]
M0
Column[10:0]
M0
27
26
25
24
23
22
21
20
19
Bk[2:0]
Table 29-10.
18
17
16
15
14
13
12
11
10
Row[12:0]
Column[9:0]
0
M0
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
Row[12:0]
Table 29-11.
12
11
10
Bk[2:0]
Column[9:0]
0
M0
27
26
25
24
23
22
21
20
19
Bk[2:0]
18
17
16
15
14
13
12
11
10
Row[13:0]
Table 29-12.
Column[9:0]
0
M0
27
26
25
24
23
22
21
20
19
18
Row[13:0]
428
17
16
15
14
13
12
Bk[2:0]
11
10
Column[9:0]
0
M0
29.6.2 DDR-SDRAM Address Mapping for 32-bit Memory Data Bus Width
Table 29-13.
28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Bk[1:0]
Row[10:0]
Bk[1:0]
Column[8:0]
Row[10:0]
Bk[1:0]
Table 29-14.
M[1:0]
Column[9:0]
Row[10:0]
M[1:0]
Column[10:0]
M[1:0]
28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Row[10:0]
Bk[1:0]
Row[10:0]
Column[8:0]
Bk[1:0]
Row[10:0]
Table 29-15.
M[1:0]
Column[9:0]
Bk[1:0]
M[1:0]
Column[10:0]
M[1:0]
28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Bk[1:0]
Row[11:0]
Bk[1:0]
Column[8:0]
Row[11:0]
Bk[1:0]
Table 29-16.
M[1:0]
Column[9:0]
Row[11:0]
M[1:0]
Column[10:0]
M[1:0]
28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Row[11:0]
Bk[1:0]
Row[11:0]
Column[8:0]
Bk[1:0]
Row[11:0]
Table 29-17.
M[1:0]
Column[9:0]
Bk[1:0]
M[1:0]
Column[10:0]
M[1:0]
28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Bk[1:0]
Table 29-18.
Row[12:0]
Bk[1:0]
Bk[1:0]
Column[8:0]
Row[12:0]
M[1:0]
Column[9:0]
Row[12:0]
M[1:0]
Column[10:0]
M[1:0]
28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Row[13:0]
Row[13:0]
Row[13:0]
Bk[1:0]
Bk[1:0]
Bk[1:0]
Column[8:0]
Column[9:0]
Column[10:0]
M[1:0]
M[1:0]
M[1:0]
429
Table 29-19.
28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Bk[2:0]
Table 29-20.
Row[12:0]
Column[9:0]
M[1:0]
28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Row[12:0]
Table 29-21.
Bk[2:0]
Column[9:0]
M[1:0]
Sequential Mapping DDR-SDRAM Configuration Mapping: 16K Rows /1024 Columns, 4 banks
CPU Address Line
28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Bk[1:0]
Table 29-22.
Row[13:0]
Column[9:0]
M[1:0]
Interleaved Mapping DDR-SDRAM Configuration Mapping: 16K Rows /1024 Columns, 4 banks
CPU Address Line
28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Row[13:0]
Table 29-23.
Bk[1:0]
Column[9:0]
M[1:0]
Sequential Mapping DDR-SDRAM Configuration Mapping: 16K Rows /1024 Columns, 8 banks
CPU Address Line
28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Bk[2:0]
Table 29-24.
Row[13:0]
Column[9:0]
M[1:0]
Interleaved Mapping DDR-SDRAM Configuration Mapping: 16K Rows /1024 Columns, 8 banks
CPU Address Line
28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Row[13:0]
Notes:
430
Bk[2:0]
Column[9:0]
M[1:0]
29.7
Register Mapping
Offset
Register
Name
Access
Reset
0x00
MPDDRC_MR
Read/Write
0x00000000
0x04
MPDDRC_RTR
Read/Write
0x03000000
0x08
MPDDRC_CR
Read/Write
0x00207024
0x0C
MPDDRC_TPR0
Read/Write
0x20227225
0x10
MPDDRC_TPR1
Read/Write
0x3C80808
0x14
MPDDRC_TPR2
Read/Write
0x00042062
0x18
Reserved
0x1C
MPDDRC_LPR
Read/Write
0x00010000
0x20
MPDDRC_MD
Read/Write
0x13
0x24
Reserved
0x28
MPDDRC_LPDDR2_LPR
Read/Write
0x00000000
0x2C
MPDDRC_LPDDR2_CAL_MR4
Read/Write
0x00000000
0x30
MPDDRC_LPDDR2_TIM_CAL
Read/Write
0x06
0x34
MPDDRC IO Calibration
MPDDRC_IO_CALIBR
Read/Write
0x00870000
0x38
MPDDRC_OCMS
Read/Write
0x00000000
0x3C
MPDDRC_OCMS_KEY1
Write-only
0x40
MPDDRC_OCMS_KEY2
Write-only
0x44
MPDDRC_CONF_ARBITER
Read/Write
0x00000000
0x48
MPDDRC_TIMEOUT
Read/Write
0x00000000
0x4C
MPDDRC_REQ_PORT_0123
Read/Write
0x00000000
0x50
MPDDRC_REQ_PORT_4567
Read/Write
0x00000000
0x54
MPDDRC_BDW_PORT_0123
Read-only
0x00000000
0x58
MPDDRC_BDW_PORT_4567
Read-only
0x00000000
0x5C
MPDDRC_RD_DATA_PATH
Read/Write
0x00000000
0x60
MPDDRC_SAW0
Read/Write
0x040310
0x64
MPDDRC_SAW1
Read/Write
0x040310
0x68
MPDDRC_SAW2
Read/Write
0x040310
0x6C
MPDDRC_SAW3
Read/Write
0x040310
0x600xE0
Reserved
0xE4
MPDDRC_WPMR
Read/Write
0x00000000
0xE8
MPDDRC_WPSR
Read-only
0x00000000
0xEC0xFC
Reserved
0x100
MPDDRC_DLL_OS
Read/Write
0x0
431
Table 29-25.
Offset
Register
Name
Access
Reset
0x104
MPDDRC_DLL_MO
Read/Write
0x0(1)
0x108
MPDDRC_DLL_SO0
Read/Write
0x0(1)
0x10C
MPDDRC_DLL_SO1
Read/Write
0x0(1)
0x110
MPDDRC_DLL_WRO
Read/Write
0x0(1)
0x114
MPDDRC_DLL_ADO
Read/Write
0x0(1)
0x118
MPDDRC_DLL_SM0
Read-only
0x0
0x11C
MPDDRC_DLL_SM1
Read-only
0x0
0x120
MPDDRC_DLL_SM2
Read-only
0x0
0x124
MPDDRC_DLL_SM3
Read-only
0x0
0x128
MPDDRC_DLL_SSL0
Read-only
0x0
0x12C
MPDDRC_DLL_SSL1
Read-only
0x0
0x130
MPDDRC_DLL_SSL2
Read-only
0x0
0x134
MPDDRC_DLL_SSL3
Read-only
0x0
0x138
MPDDRC_DLL_SSL4
Read-only
0x0
0x13C
MPDDRC_DLL_SSL5
Read-only
0x0
0x140
MPDDRC_DLL_SSL6
Read-only
0x0
0x144
MPDDRC_DLL_SSL7
Read-only
0x0
0x148
MPDDRC_DLL_SWR0
Read-only
0x0
0x14C
MPDDRC_DLL_SWR1
Read-only
0x0
0x150
MPDDRC_DLL_SWR2
Read-only
0x0
0x154
MPDDRC_DLL_SWR3
Read-only
0x0
0x158
MPDDRC_DLL_SAD
Read-only
0x0
0x15C0x1FC
Reserved
Note:
1. Values in the DLL Master Offset Register and in the DLL Slave Offset Register vary with the product implementation.
432
MPDDRC_MR
Address:
0xF0010000
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
1
MODE
MRS
7
This register can only be written if the WPEN bit is cleared in the MPDDRC Write Protection Mode Register.
MODE: MPDDRC Command Mode
This field defines the command issued by the MPDDRC when the SDRAM device is accessed. This register is used to initialize the SDRAM device and to activate deep power-down mode.
Value
Name
Description
NORMAL_CMD
Normal Mode. Any access to the MPDDRC is decoded normally. To activate this mode, the command must
be followed by a write to the DDR-SDRAM.
NOP_CMD
The MPDDRC issues a NOP command when the DDR-SDRAM device is accessed regardless of the cycle.
To activate this mode, the command must be followed by a write to the DDR-SDRAM.
PRCGALL_CMD
LMR_CMD
RFSH_CMD
The MPDDRC issues the All Banks Precharge command when the DDR-SDRAM device is accessed
regardless of the cycle. To activate this mode, the command must be followed by a write to the SDRAM.
The MPDDRC issues a Load Mode Register command when the DDR-SDRAM device is accessed
regardless of the cycle. To activate this mode, the command must be followed by a write to the DDRSDRAM.
The MPDDRC issues an Auto-Refresh command when the DDR-SDRAM device is accessed regardless of
the cycle. Previously, an All Banks Precharge command must be issued. To activate this mode, the
command must be followed by a write to the DDR-SDRAM.
The MPDDRC issues an Extended Load Mode Register command when the SDRAM device is accessed
EXT_LMR_CMD regardless of the cycle. To activate this mode, the command must be followed by a write to the DDRSDRAM. The write in the DDR-SDRAM must be done in the appropriate bank.
DEEP_CMD
LPDDR2_CMD
433
MPDDRC_RTR
Address:
0xF0010004
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
MR4_VALUE
20
19
18
17
REF_PB
16
ADJ_REF
15
14
13
12
11
10
COUNT
3
COUNT
This register can only be written if the WPEN bit is cleared in the MPDDRC Write Protection Mode Register.
COUNT: MPDDRC Refresh Timer Count
This 12-bit field is loaded into a timer which generates the refresh pulse. Each time the refresh pulse is generated, a
refresh sequence is initiated.
The SDRAM devices require a refresh of all rows every 64 ms. The value to be loaded depends on the MPDDRC clock frequency (MCK: Master Clock) and the number of rows in the device.
For example, for an SDRAM with 8192 rows and a 100 MHz Master clock, the value of the COUNT field is configured:
((64 x 10-3)/8192) x 100 x 106 = 781 or 0x030D.
The low-power DDR2-SDRAM devices support Per Bank Refresh operation. In this configuration, average time between
refresh command is 0.975 s. The value of the COUNT field is configured depending on this value. For example, the value
of a 100 MHz Master clock refresh timer is 98 or 0x0062.
ADJ_REF: Adjust Refresh Rate
Reset value is 0.
0: Adjust refresh rate is not enabled.
1: Adjust refresh rate is enabled.
This mode is unique to the low-power DDR2-SDRAM devices.
REF_PB: Refresh Per Bank
Reset value is 0.
0: Refresh all banks during auto-refresh operation.
1: Refresh the scheduled bank by the bank counter in the memory interface.
This mode is unique to the low-power DDR2-SDRAM devices.
434
435
MPDDRC_CR
Address:
0xF0010008
Access:
Read/Write
31
30
29
28
27
26
25
24
23
UNAL
22
DECOD
21
NDQS
20
NB
19
LC_LPDDR1
18
17
ENRDM
16
DQMS
15
14
13
OCD
12
11
10
9
DIS_DLL
8
DIC_DS
7
DLL
5
CAS
ZQ
3
NR
0
NC
This register can only be written if the WPEN bit is cleared in the MPDDRC Write Protection Mode Register.
NC: Number of Column Bits
Reset value is 0 (9 column bits).
Value
Name
Description
9_COL_BITS
10_COL_BITS
11_COL_BITS
12_COL_BITS
Name
Description
11_ROW_BITS
12_ROW_BITS
13_ROW_BITS
14_ROW_BITS
Name
DDR_CAS2
DDR_CAS3
DDR_CAS4
DDR_CAS5
DDR_CAS6
436
Description
Name
Description
RESET_DISABLED
RESET_ENABLED
Name
Description
DDR2_NORMALSTRENGTH
DDR2_WEAKSTRENGTH
Name
Description
INIT
LONG
Long calibration
SHORT
Short calibration
RESET
ZQ Reset
This parameter is used to calibrate DRAM On resistance (Ron) values over PVT.
This field is found only in the low-power DDR2-SDRAM devices.
437
Name
Description
DDR2_EXITCALIB
DDR2_DEFAULT_CALI
B
Name
Description
NOT_SHARED
SHARED
Name
Description
OFF
ON
Name
NOT_2_BANKS
Description
2_BANKS_LPDDR1
Any type of memory devices except of low cost, low density Low Power DDR1.
Low-cost and low-density low-power DDR1. These devices have a density of 32 Mbits and are
organized as two internal banks. To use this feature, the user has to define the type of memory
and the data bus width (see MPDDRC Memory Device Register on page 448).
The 16-bit memory device is organized as 2 banks, 9 columns and 11 rows.
Name
4_BANKS
8_BANKS
8 banks. Only possible when using the DDR2-SDRAM and low-power DDR2-SDRAM devices.
438
Description
Name
Description
ENABLED
DISABLED
Name
Description
SEQUENTIAL
Method for address mapping where banks alternate at each last DDR-SDRAM page of the current bank.
INTERLEAVED
Method for address mapping where banks alternate at each SDRAM end page of the current bank.
Name
UNSUPPORTED
SUPPORTED
Description
Unaligned access is not supported.
Unaligned access is supported.
439
MPDDRC_TPR0
Address:
0xF001000C
Access:
Read/Write
31
30
29
28
27
26
TMRD
23
22
21
20
19
18
TRRD
15
14
13
24
17
16
TRP
12
11
10
TRC
7
25
TWTR
TWR
5
TRCD
2
TRAS
This register can only be written if the WPEN bit is cleared in the MPDDRC Write Protection Mode Register.
TRAS: Active to Precharge Delay
Reset value is 5 DDRCK(1) clock cycles.
This field defines the delay between an Activate command and a Precharge command in number of DDRCK(1) clock
cycles. The number of cycles is between 0 and 15.
TRCD: Row to Column Delay
Reset value is 2 DDRCK(1) clock cycles.
This field defines the delay between an Activate command and a Read/Write command in number of DDRCK(1) clock
cycles. The number of cycles is between 0 and 15.
TWR: Write Recovery Delay
Reset value is 2 DDRCK(1) clock cycles.
This field defines the Write Recovery Time in number of DDRCK(1) clock cycles. The number of cycles is between 1 and
15.
TRC: Row Cycle Delay
Reset value is 7 DDRCK(1) clock cycles.
This field defines the delay between an Activate command and Refresh command in number of DDRCK(1) clock cycles.
The number of cycles is between 0 and 15
TRP: Row Precharge Delay
Reset value is 2 DDRCK(1) clock cycles.
This field defines the delay between a Precharge command and another command in number of DDRCK(1) clock cycles.
The number of cycles is between 0 and 15.
TRRD: Active BankA to Active BankB
Reset value is 2 DDRCK(1) clock cycles.
This field defines the delay between an Activate command in BankA and an Activate command in BankB in number of
DDRCK(1) clock cycles. The number of cycles is between 1 and 15.
440
441
MPDDRC_TPR1
Address:
0xF0010010
Access:
Read/Write
31
30
29
28
27
23
22
21
20
19
26
25
24
18
17
16
11
10
3
TRFC
TXP
TXSRD
15
14
13
12
TXSNR
This register can only be written if the WPEN bit is cleared in the MPDDRC Write Protection Mode Register.
TRFC: Row Cycle Delay
Reset value is 8 DDRCK(1) clock cycles.
This field defines the delay between a Refresh command or a Refresh and Activate command in number of DDRCK(1) clock
cycles. The number of cycles is between 0 and 127.
In case of low-power DDR2-SDRAM, this field is equivalent to tRFCab timing. If the user enables the function Refresh Per
Bank (see REF_PB: Refresh Per Bank on page 434), this field is equivalent to tRFCpb.
TXSNR: Exit Self-refresh Delay to Non Read Command
Reset value is 8 DDRCK(1) clock cycles.
This field defines the delay between CKE set high and a Non Read command in number of DDRCK(1) clock cycles. The
number of cycles is between 0 and 255. This field is used by the DDR-SDRAM devices. In case of low-power DDRSDRAM, this field is equivalent to tXSR timing.
TXSRD: Exit Self-refresh Delay to Read Command
Reset value is 200 DDRCK(1) clock cycles.
This field defines the delay between CKE set high and a Read command in number of DDRCK(1) clock cycles. The number
of cycles is between 0 and 255.
This field is found only in the DDR2-SDRAM devices .
TXP: Exit Power-down Delay to First Command
Reset value is 3 DDRCK(1) clock cycles.
This field defines the delay between CKE set high and a Valid command in number of DDRCK(1) clock cycles. The number
of cycles is between 0 and 15.
Note:
442
MPDDRC_TPR2
Address:
0xF0010014
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
TRTP
12
11
TFAW
10
TRPA
3
TXARDS
TXARD
TXARD: Exit Active Power Down Delay to Read Command in Mode Fast Exit
Reset value is 2 DDRCK(1) clock cycles.
This field defines the delay between CKE set high and a Read command in number of DDRCK(1) clock cycles. The number
of cycles is between 0 and 15.
This field is found only in the DDR2-SDRAM devices.
TXARDS: Exit Active Power Down Delay to Read Command in Mode Slow Exit
Reset value is 6 DDRCK(1) clock cycles.
This field defines the delay between CKE set high and a Read command in number of DDRCK(1) clock cycles. The number
of cycles is between 0 and 15.
This field is found only in the DDR2-SDRAM devices.
TRPA: Row Precharge All Delay
Reset value is 0 DDRCK(1) clock cycles.
This field defines the delay between a Precharge All Banks command and another command in number of DDRCK(1) clock
cycles. The number of cycles is between 0 and 15.
This field is found only in the DDR2-SDRAM devices.
TRTP: Read to Precharge
Reset value is 2 DDRCK(1) clock cycles.
This field defines the delay between Read command and a Precharge command in number of DDRCK(1) clock cycles.
The number of cycles is between 0 and 7.
TFAW: Four Active Windows
Reset value is 4 DDRCK(1) clock cycles.
DDR2 devices with eight banks (1 Gbit or larger) have an additional requirement concerning tFAW timing. This requires that
no more than four Activate commands may be issued in any given tFAW (MIN) period.
The number of cycles is between 0 and 15.
This field is found only in the DDR2-SDRAM and LPDDR2-SDRAM devices.
443
Note:
444
MPDDRC_LPR
Address:
0xF001001C
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
APDE
15
14
13
12
11
10
9
DS
3
LPDDR2_PW
OFF
UPD_MR
TIMEOUT
PASR
CLK_FR
LPCB
Name
Description
NOLOWPOWER
Low-power feature is inhibited. No power-down, self-refresh and deep-power modes are issued to
the DDR-SDRAM device.
SELFREFRESH
The MPDDRC issues a self-refresh command to the DDR-SDRAM device, the clock(s) is/are
deactivated and the CKE signal is set low. The DDR-SDRAM device leaves the self-refresh mode
when accessed and reenters it after the access.
POWERDOWN
The MPDDRC issues a Power-down command to the DDR-SDRAM device after each access, the
CKE signal is set low. The DDR-SDRAM device leaves the power-down mode when accessed and
reenters it after the access.
DEEPPOWERDOWN
The MPDDRC issues a Deep Power-down command to the low-power DDR-SDRAM device.
Name
Description
DISABLED
ENABLED
445
Name
Description
DISABLED
ENABLED
A power off sequence is applied to the LPDDR2 device. CKE is forced low.
Name
Description
NONE
SDRAM low-power mode is activated immediately after the end of the last transfer.
DELAY_64_CLK
SDRAM low-power mode is activated 64 clock cycles after the end of the last transfer.
DELAY_128_CLK
SDRAM low-power mode is activated 128 clock cycles after the end of the last transfer.
446
Name
Description
DDR2_FAST_EXIT
DDR2_SLOW_EXIT
After the initialization sequence, as soon as the APDE field is modified, the Extended Mode Register (located in the memory of the external device) is accessed automatically and APDE bits are updated. Depending on the UPD_MR bit, update
is done before entering self-refresh mode or during a refresh command and a pending read or write access
UPD_MR: Update Load Mode Register and Extended Mode Register
Reset value is 0.
This bit is used to enable or disable automatic update of the Load Mode Register and Extended Mode Register. This
update is function of the MPDDRC integration in a system. MPDDRC can either share or not, an external bus with another
controller.
Value
Name
Description
NO_UPDATE
UPDATE_SHAREDBUS
MPDDRC shares an external bus. Automatic update is done during a refresh command and a
pending read or write access in the SDRAM device.
UPDATE_NOSHAREDBUS
MPDDRC does not share an external bus. Automatic update is done before entering in selfrefresh mode.
447
MPDDRC_MD
Address:
0xF0010020
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
4
DBW
1
MD
This register can only be written if the WPEN bit is cleared in the MPDDRC Write Protection Mode Register.
MD: Memory Device
Indicates the type of memory used.
Reset value is that for the DDR-SDRAM device.
Value
Name
LPDDR_SDRAM
DDR2_SDRAM
LPDDR2_SDRAM
Description
Low-power DDR1-SDRAM
DDR2-SDRAM
Low-power DDR2-SDRAM
Name
DBW_32_BITS
DBW_16_BITS
448
Description
MPDDRC_LPDDR2_LPR
Address:
0xF0010028
Access:
Read/Write
31
30
29
28
27
26
25
24
DS
23
22
21
20
19
18
17
16
11
10
4
3
BK_MASK_PASR
SEG_MASK
15
14
13
12
SEG_MASK
449
450
MPDDRC_LPDDR2_CAL_MR4
Address:
0xF001002C
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
MR4_READ
23
22
21
20
MR4_READ
15
14
13
12
COUNT_CAL
4
COUNT_CAL
This register can only be written if the WPEN bit is cleared in the MPDDRC Write Protection Mode Register.
COUNT_CAL: LPDDR2 Calibration Timer Count
This 16-bit field is loaded into a timer which generates the calibration pulse. Each time the calibration pulse is generated, a
ZQCS calibration sequence is initiated.
The ZQCS Calibration command is used to calibrate DRAM Ron values over PVT.
One method for calculating the interval between ZQCS commands gives the temperature (Tdriftrate) and voltage (Vdriftrate)
drift rates that the SDRAM is subject to in the application. The interval could be defined by the following formula: ZQCorrection/((TSens x Tdriftrate) + (VSens x Vdriftrate))
Where TSens = max(dRONdTM) and VSens = max(dRONdVM) define the SDRAM temperature and voltage sensitivities.
For example, if TSens = 0.75%/C, VSens = 0.2%/mV, Tdriftrate = 1C/sec and Vdriftrate = 15 mV/s, then the interval between
ZQCS commands is calculated as:
1.5/((0.75 x 1) + (0.2 x 15)) = 0.4s
In this example, the LPDDR2-SDRAM devices require a calibration every 0.4s. The value to be loaded depends on average time between REFRESH commands, tREF.
For example, for an LPDDR2-SDRAM with the time between refresh of 7.8 s, the value of the Calibration Timer Count
field is programmed: (0.4/7.8 x 10-6) = 0xC852.
MR4_READ: Mode Register 4 Read Interval
MR4_READ defines the time period between MR4 reads (for LPDDR2-SDRAM). The formula is (MR4_READ+1) tREF.
The value to be loaded depends on the average time between REFRESH commands, tREF. For example, for an LPDDR2SDRAM with the time between refresh of 7.8 s, if the MR4_READ value is 2, the time period between MR4 reads is
23.4 s.
The LPDDR2-SDRAM devices feature a temperature sensor whose status can be read from MR4 register. This sensor can
be used to determine an appropriate refresh rate. Temperature sensor data may be read from MR4 register using the
Mode Register Read protocol. The Adjust Refresh Rate bit (ADJ_REF) in the Refresh Timer Register (MPDDRC_RTR)
must be written to a one to activate these reads.
451
MPDDRC_LPDDR2_TIM_CAL
Address:
0xF0010030
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
ZQCS
452
MPDDRC_IO_CALIBR
Address:
0xF0010034
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
CALCODEN
CALCODEP
15
14
13
12
11
10
9
TZQIO
4
EN_CALIB
1
RDIV
Name
RZQ_34
RZQ_40_RZQ_33_3
RZQ_48_RZQ_40
Description
LPDDR2 RZQ = 34.3 ohms, DDR2/LPDDR1: Not applicable
LPDDR2:RZQ = 40 ohms, DDR2/LPDDR1: RZQ = 33.3 ohms
LPDDR2:RZQ = 48 ohms, DDR2/LPDDR1: RZQ = 40 ohms
RZQ_60_RZQ_50
RZQ_80_RZQ_66_7
RZQ_120_RZQ_100
TZQIO: IO Calibration
This field defines the delay between an IO Calibration command and any valid commands in number of DDRCK(1) clock
cycles.
The number of cycles is between 0 and 7.
The TZQIO configuration code must be correctly set depending on the clock frequency using the following formula:
TZQIO = (DDRCK 20e-9) + 1
where DDRCK frequency is in Hz.
For example, for a frequency of 176 MHz, the value of the TZQIO field is configured (176 106) (20 10-9) + 1.
453
Name
Description
DISABLE_CALIBRATION
Calibration is disabled.
ENABLE_CALIBRATION
Calibration is enabled.
454
MPDDRC_OCMS
Address:
0xF0010038
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
0
SCR_EN
This register can only be written if the WPEN bit is cleared in the MPDDRC Write Protection Mode Register.
SCR_EN: Scrambling Enable
0: Disables Off-chip scrambling for SDRAM access.
1: Enables Off-chip scrambling for SDRAM access.
455
MPDDRC_OCMS_KEY1
Address:
0xF001003C
Access:
Write once
31
30
29
28
27
26
25
24
19
18
17
16
11
10
KEY1
23
22
21
20
KEY1
15
14
13
12
KEY1
4
KEY1
This register can only be written if the WPEN bit is cleared in the MPDDRC Write Protection Mode Register.
KEY1: Off-chip Memory Scrambling (OCMS) Key Part 1
When Off-chip Memory Scrambling is enabled, the data scrambling depends on KEY1 and KEY2 values.
456
MPDDRC_OCMS_KEY2
Address:
0xF0010040
Access:
Write once
31
30
29
28
27
26
25
24
19
18
17
16
11
10
KEY2
23
22
21
20
KEY2
15
14
13
12
KEY2
4
KEY2
This register can only be written if the WPEN bit is cleared in the MPDDRC Write Protection Mode Register.
KEY2: Off-chip Memory Scrambling (OCMS) Key Part 2
When Off-chip Memory Scrambling is enabled, the data scrambling depends on KEY1 and KEY2 values.
457
MPDDRC_CONF_ARBITER
Address:
0xF0010044
Access:
Read/Write
31
BDW_BURS
T_P7
30
BDW_BURS
T_P6
29
BDW_BURS
T_P5
28
BDW_BURS
T_P4
27
BDW_BURS
T_P3
26
BDW_BURS
T_P2
25
BDW_BURS
T_P1
24
BDW_BURS
T_P0
23
MA_PR_P7
22
MA_PR_P6
21
MA_PR_P5
20
MA_PR_P4
19
MA_PR_P3
18
MA_PR_P2
17
MA_PR_P1
16
MA_PR_P0
15
RQ_WD_P7
14
RQ_WD_P6
13
RQ_WD_P5
12
RQ_WD_P4
11
RQ_WD_P3
10
RQ_WD_P2
9
RQ_WD_P1
8
RQ_WD_P0
3
BDW_MAX_
CUR
ARB
Name
Description
ROUND
Round Robin
NB_REQUEST
BANDWIDTH
Request Policy
Bandwidth Policy
458
459
MPDDRC_TIMEOUT
Address:
0xF0010048
Access:
Read/Write
31
30
29
28
27
26
25
TIMEOUT_P6
24
21
20
19
18
17
TIMEOUT_P4
16
13
12
11
10
9
TIMEOUT_P2
TIMEOUT_P7
23
22
TIMEOUT_P5
15
14
TIMEOUT_P3
6
TIMEOUT_P1
1
TIMEOUT_P0
460
MPDDRC_REQ_PORT_0123
Address:
0xF001004C
Access:
Read/Write
31
30
29
28
27
NRQ_NWD_BDW_P3
26
25
24
23
22
21
20
19
NRQ_NWD_BDW_P2
18
17
16
15
14
13
12
11
NRQ_NWD_BDW_P1
10
4
3
NRQ_NWD_BDW_P0
NRQ_NWD_BDW_Px: Number of Requests, Number of Words or Bandwidth Allocation from Port 0-1-2-3
Reset value is 0.
The number of requests corresponds to the number of start transfers. For example, setting this field to 2 performs two burst
accesses regardless of the burst type (INCR4, INCR8,...). The number of words corresponds exactly to the number of
accesses; setting this field to 2 performs two accesses. In this example, burst accesses will be broken.
These values are function of scheme arbitration (see MPDDRC Configuration Arbiter Register on page 458).
In case of round-robin arbitration, this field is not used. In case of bandwidth arbitration, this field corresponds to percentage allocated for each port. In case of request arbitration, this field corresponds to number of start transfers or to number
of accesses allocated for each port.
461
MPDDRC_REQ_PORT_4567
Address:
0xF0010050
Access:
Read/Write
31
30
29
28
27
NRQ_NWD_BDW_P7
26
25
24
23
22
21
20
19
NRQ_NWD_BDW_P6
18
17
16
15
14
13
12
11
NRQ_NWD_BDW_P5
10
4
3
NRQ_NWD_BDW_P4
NRQ_NWD_BDW_Px: Number of Requests, Number of Words or Bandwidth allocation from port 4-5-6-7
Reset value is 0.
The number of requests corresponds to the number of start transfers. For example, setting this field to 2 performs two burst
accesses regardless of the burst type (INCR4, INCR8,...). The number of words corresponds exactly to the number of
accesses; setting this field to 2 performs two accesses. In this example, burst accesses will be broken.
These values are function of scheme arbitration (see MPDDRC Configuration Arbiter Register on page 458).
In case of round-robin arbitration, this field is not used. In case of bandwidth arbitration, this field corresponds to percentage allocated for each port. In case of request arbitration, this field corresponds to number of start transfers or to number
of accesses allocated for each port.
462
MPDDRC_BDW_PORT_0123
Address:
0xF0010054
Access:
Read-only
31
30
29
28
27
BDW_P3
26
25
24
23
22
21
20
19
BDW_P2
18
17
16
15
14
13
12
11
BDW_P1
10
3
BDW_P0
463
MPDDRC_BDW_PORT_4567
Address:
0xF0010058
Access:
Read-only
31
30
29
28
27
BDW_P7
26
25
24
23
22
21
20
19
BDW_P6
18
17
16
15
14
13
12
11
BDW_P5
10
3
BDW_P4
464
MPDDRC_RD_DATA_PATH
Address:
0xF001005C
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
1
0
SHIFT_SAMPLING
Name
Description
NO_SHIFT
SHIFT_ONE_CYCLE
SHIFT_TWO_CYCLES
SHIFT_THREE_CYCLES
465
MPDDRC_SAWx [x = 0..3]
Address:
0xF0010060
Access:
Read/Write
31
23
15
30
22
14
29
21
28
20
13
12
27
26
19
18
PFCH_THRESH
11
10
INCR_THRESH
3
2
FLUSH_MAX
Name
Description
1_WORD
1 word/dword max
2_WORDS
2 word/dword max
4_WORDS
4 word/dword max
8_WORDS
8 word/dword max
16
16_WORDS
16 word/dword max
32
32_WORDS
32 word/dword max
Name
2_WORDS
2 word/dword max
4_WORDS
4 word/dword max
8_WORDS
8 word/dword max
466
Description
25
17
24
16
MPDDRC_WPMR
Address:
0xF00100E4
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
0
WPEN
WPKEY
23
22
21
20
WPKEY
15
14
13
12
WPKEY
Name
0x444452
PASSWD
Description
Writing any other value in this field aborts the write operation of the WPEN bit.
Always reads as 0.
467
MPDDRC_WPSR
Address:
0xF00100E8
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
11
10
0
WPVS
WPVSRC
15
14
13
12
WPVSRC
468
MPDDRC_DLL_OS
Address:
0xF0010100
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
0
SELOFF
469
MPDDRC_DLL_MO
Address:
0xF0010104
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
M0OFF
470
MPDDRC_DLL_SO0
Address:
0xF0010108
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
S3OFF
23
22
21
20
S2OFF
15
14
13
12
S1OFF
4
S0OFF
Only the first 6 bits of the S0OFF, S1OFF, S2OFF, and S3OFF fields are significant.
SxOFF: SLAVEx Delay Line Offset
The value stored by this field is signed.
When this field is written, the programmable SLAVEx delay line offset is written.
When this field is read:
DQSDELAY_OSR.SELOFF = 0: The hardcoded SLAVEx delay line offset is read.
DQSDELAY_OSR.SELOFF = 1: The programmable SLAVEx delay line offset is read.
471
MPDDRC_DLL_SO1
Address:
0xF001010C
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
S7OFF
23
22
21
20
S6OFF
15
14
13
12
S5OFF
4
S4OFF
Only the first 6 bits of the S4OFF, S5OFF, S6OFF, and S7OFF fields are significant.
SxOFF: SLAVEx Delay Line Offset
The value stored by this field is signed.
When this field is written, the programmable SLAVEx delay line offset is written.
When this field is read:
DQSDELAY_OSR.SELOFF = 0: The hardcoded SLAVEx delay line offset is read.
DQSDELAY_OSR.SELOFF = 1: The programmable SLAVEx delay line offset is read.
472
MPDDRC_DLL_WRO
Address:
0xF0010110
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
WR3OFF
23
22
21
20
WR2OFF
15
14
13
12
WR1OFF
4
WR0OFF
Only the first 6 bits of the WR0OFF, WR1OFF, WR2OFF, and WR3OFF fields are significant.
WRxOFF: CLKWRx Delay Line Offset
The value stored by this field is signed.
When this field is written, the programmable CLKWRx delay line offset is written.
When this field is read:
DQSDELAY_OSR.SELOFF = 0: The hardcoded CLKWRx delay line offset is read.
DQSDELAY_OSR.SELOFF = 1: The programmable CLKWRx delay line offset is read.
473
MPDDRC_DLL_ADO
Address:
0xF0010114
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
ADOFF
474
MPDDRC_DLL_SMx
Address:
0xF0010118
Access:
Read-only
31
30
29
28
27
23
22
21
20
19
13
12
14
25
24
18
17
16
11
10
2
MDOVF
1
MDDEC
0
MDINC
MDCNT
MDCNT
15
26
MDLVAL
7
475
MPDDRC_DLL_SSLx
Address:
0xF0010128
Access:
Read-only
31
30
29
28
27
23
22
21
20
19
13
12
14
25
24
18
17
16
11
10
2
SDERF
1
SDCUDF
0
SDCOVF
SDCVAL
SDCVAL
15
26
SDCNT
7
476
MPDDRC_DLL_SWRx
Address:
0xF0010148
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
WRDCNT
477
MPDDRC_DLL_SAD
Address:
0xF0010158
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
ADDCNT
478
30.
30.1
Description
This Static Memory Controller (SMC) is capable of handling several types of external memory and peripheral
devices, such as SRAM, PSRAM, PROM, EPROM, EEPROM, LCD Module, NOR Flash and NAND Flash.
The SMC generates the signals that control the access to external memory devices or peripheral devices. It has 4
Chip Selects and a 26-bit address bus. The 16-bit data bus can be configured to interface with 8- or 16-bit external
devices. Separate read and write control signals allow for direct memory and peripheral interfacing. 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 embeds a NAND Flash Controller (NFC). The NFC can handle automatic transfers, sending the
commands and address cycles to the NAND Flash and transferring the contents of the page (for read and write) to
the NFC SRAM. It minimizes the CPU overhead.
The SMC includes programmable hardware error correcting code with one-bit error correction capability and
supports two-bit error detection. In order to improve the overall system performance, the DATA phase of the
transfer can be DMA-assisted.
The External Data Bus can be scrambled/unscrambled by means of user keys.
479
30.2
480
Embedded Characteristics
Programmable Setup, Pulse and Hold Time for Read Signals per Chip Select
Programmable Setup, Pulse and Hold Time for Write Signals per Chip Select
NAND Flash Controller Supporting NAND Flash with Multiplexed Data/Address Buses
Multibit Error Correcting Code (ECC) supporting NAND Flash devices with 8-bit only Data Path
ECC Algorithm Based on Binary Shortened Bose, Chaudhuri and Hocquenghem (BCH) Codes
Supports 8 Kbytes Page Size Using 1024 bytes/block and 4 Kbytes Page Size Using 512 bytes/block
Provides Hardware Acceleration for Determining Roots of Polynomials Defined over a Finite Field
Block Diagram
Figure 30-1.
Block Diagram
SMC
AHB
Interface
NAND Flash
Controller (NFC)
AHB
Arbiter
SMC
Scrambler
30.3
D[15:0]
A[0]/NBS0
A[20:1]
A21/NANDALE
A22/NANDCLE
A[25:23]
NCS[3:0]
SMC
Interface
SRAM
AHB
Interface
SRAM
Scrambler
ECC
NRD
NWR0/NWE
NWR1/NBS1
NANDOE
NANDWE
User Interface
NFC (8 Kbytes)
Internal SRAM
NANDRDY
NWAIT
APB Interface
30.4
Table 30-1.
Name
Description
Type
Active Level
NCS[3:0]
Output
Low
NRD
Read Signal
Output
Low
NWR0/NWE
Output
Low
A0/NBS0
Output
Low
NWR1/NBS1
Output
Low
A[25:1]
Address Bus
Output
D[15:0]
Data Bus
I/O
NWAIT
Input
Low
NANDRDY
Input
NANDWE
Output
Low
NANDOE
Output
Low
NANDALE
Output
NANDCLE
Output
481
30.5
Multiplexed Signals
Table 30-2.
Multiplexed Signals
Related Function
NWR0
NWE
Byte-write or Byte-select access, see Section 30.9.2.1 Byte Write Access and Section 30.9.2.2 Byte
Select Access
A0
NBS0
8-bit or 16-bit data bus, see Section 30.9.1 Data Bus Width
A22
NANDCLE
A21
NANDALE
NWR1
NBS1
Byte-write or Byte-select access, see Section 30.9.2.1 Byte Write Access and Section 30.9.2.2 Byte
Select Access
A1
30.6
30.6.1
Application Example
Hardware Interface
Figure 30-2.
A0/NBS0
NWR0/NWE
NWR1/NBS1
A1
D0 - D7
128K x 8
SRAM
D8-D15
D0 - D7
CS
NCS0
NCS1
NCS2
NCS3
NWR0/NWE
A2 - A23
Static Memory
Controller
482
OE
WE
D0-D7
CS
A0 - A16
NRD
128K x 8
SRAM
A2 - A18
A0 - A16
NRD
NWR1/NBS1
OE
WE
A2 - A18
30.7
30.7.1
Product Dependencies
I/O Lines
The pins used for interfacing the Static Memory Controller are multiplexed with the PIO lines. The programmer
must first program the PIO controller to assign the Static Memory Controller pins to their peripheral function. If I/O
lines of the SMC are not used by the application, they can be used for other purposes by the PIO controller.
30.7.2
Power Management
The SMC is clocked through the Power Management Controller (PMC), thus the programmer must first configure
the PMC to enable the SMC clock.
30.7.3
Interrupt
The SMC has an interrupt line connected to the interrupt controller. Handling the SMC interrupt requires
programming the interrupt controller before configuring the SMC.
Table 30-3.
30.8
Peripheral IDs
Instance
ID
HSMC
22
Figure 30-3.
NCS[0] - NCS[3]
NRD
SMC
NWE
NCS3
A[25:0]
NCS2
D[15:0]
NCS1
NCS0
Memory Enable
Memory Enable
Memory Enable
Memory Enable
Output Enable
Write Enable
A[25:0]
8 or 16
D[15:0] or D[7:0]
483
30.9
30.9.1
SMC
A1
A0
A0
NWE
Write Enable
NRD
Output Enable
Memory Enable
D[15:0]
A[19:2]
A[18:1]
A1
SMC
NBS0
A[0]
Low Byte Enable
NBS1
NWE
Write Enable
NRD
Output Enable
NCS[2]
30.9.2
A[18:2]
A1
NCS[2]
Figure 30-5.
D[7:0]
Memory Enable
Byte Write Access is used to connect 2 x 8-bit devices as a 16-bit memory, and supports one write signal per byte
of the data bus and a single read signal.
Note that the SMC does not allow boot in Byte Write Access mode.
For 16-bit devices, the SMC provides NWR0 and NWR1 write signals for respectively Byte0 (lower byte) and Byte1
(upper byte) of a 16-bit bus. One single read signal (NRD) is provided.
30.9.2.2 Byte Select Access
Byte Select Access is used to connect one 16-bit device. In this mode, read/write operations can be
enabled/disabled at Byte level. One Byte-select line per byte of the data bus is provided. One NRD and one NWE
signal control read and write.
484
For 16-bit devices, the SMC provides NBS0 and NBS1 selection signals for respectively Byte0 (lower byte) and
Byte1 (upper byte) of a 16-bit bus.
Figure 30-6.
D[7:0]
D[15:8]
A[24:2]
SMC
A[23:1]
A[0]
A1
NWR0
Write Enable
NWR1
Read Enable
NRD
Memory Enable
NCS[3]
D[15:8]
A[23:1]
A[0]
Write Enable
Read Enable
Memory Enable
Depending on the Byte Access Type (BAT), only the write signals or the byte select signals are used. To save IOs
at the external bus interface, control signals at the SMC interface are multiplexed. Table 30-4 shows signal
multiplexing depending on the data bus width and the Byte Access Type.
For 16-bit devices, bit A0 of address is unused. When Byte Select Option is selected, NWR1 is unused. When Byte
Write option is selected, NBS0 is unused.
Table 30-4.
Device Type
8-bit Bus
1 x 16-bit
2 x 8-bit
1 x 8-bit
Byte Select
Byte Write
NBS0_A0
NBS0
A0
NWE_NWR0
NWE
NWR0
NWE
NBS1_NWR1
NBS1
NWR1
A1
A1
A1
A1
485
A[25:2]
NBS0,NBS1,
A0, A1
NRD
NCS
D[15:0]
NRD_SETUP
NCS_RD_SETUP
NRD_PULSE
NCS_RD_PULSE
NRD_HOLD
NCS_RD_HOLD
NRD_CYCLE
The NRD signal is characterized by a setup timing, a pulse width and a hold timing:
1. NRD_SETUP: The NRD setup time is defined as the setup of address before the NRD falling edge.
2.
NRD_PULSE: The NRD pulse length is the time between NRD falling edge and NRD rising edge.
3.
NRD_HOLD: The NRD hold time is defined as the hold time of address after the NRD rising edge.
Similar to the NRD signal, the NCS signal can be divided into a setup time, pulse length and hold time:
486
NCS_RD_SETUP: The NCS setup time is defined as the setup time of address before the NCS falling edge.
NCS_RD_PULSE: The NCS pulse length is the time between NCS falling edge and NCS rising edge.
NCS_RD_HOLD: The NCS hold time is defined as the hold time of address after the NCS rising edge.
The NRD_CYCLE time is defined as the total duration of the read cycle, that is, from the time where address is set
on the address bus to the point where address may change. The total read cycle time is defined as:
NRD_CYCLE = NRD_SETUP + NRD_PULSE + NRD_HOLD,
as well as
NRD_CYCLE = NCS_RD_SETUP + NCS_RD_PULSE + NCS_RD_HOLD
All NRD and NCS timings are defined separately for each chip select as an integer number of Master Clock cycles.
The NRD_CYCLE field is common to both the NRD and NCS signals, thus the timing period is of the same
duration.
NRD_CYCLE, NRD_SETUP, and NRD_PULSE implicitly define the NRD_HOLD value as:
NRD_HOLD = NRD_CYCLE - NRD SETUP - NRD PULSE
NRD_CYCLE, NCS_RD_SETUP, and NCS_RD_PULSE implicitly define the NCS_RD_HOLD value as:
NCS_RD_HOLD = NRD_CYCLE - NCS_RD_SETUP - NCS_RD_PULSE
30.10.2 Read Mode
As NCS and NRD waveforms are defined independently of one another, the SMC needs to know when the read
data is available on the data bus. The SMC does not compare NCS and NRD timings to know which signal rises
first. The READ_MODE parameter in the HSMC_MODE register of the corresponding chip select indicates which
signal of NRD and NCS controls the read operation.
30.10.2.1 Read is Controlled by NRD (READ_MODE = 1)
Figure 30-8 shows the waveforms of a read operation of a typical asynchronous RAM. The read data is available
tPACC after the falling edge of NRD, and turns to Z after the rising edge of NRD. In this case, the READ_MODE
must be set to 1 (read is controlled by NRD), to indicate that data is available with the rising edge of NRD. The
SMC samples the read data internally on the rising edge of the Master Clock that generates the rising edge of
NRD, whatever the programmed waveform of NCS.
Figure 30-8.
A[25:2]
NBS0,NBS1,
A0, A1
NRD
NCS
tPACC
D[15:0]
Data Sampling
487
Figure 30-9 shows the typical read cycle. The read data is valid tPACC after the falling edge of the NCS signal and
remains valid until the rising edge of NCS. Data must be sampled when NCS is raised. In that case, the
READ_MODE must be configured to 0 (read is controlled by NCS): the SMC internally samples the data on the
rising edge of the Master Clock that generates the rising edge of NCS, whatever the programmed waveform of
NRD.
Figure 30-9.
A[25:2]
NBS0,NBS1,
A0, A1
NRD
NCS
tPACC
D[15:0]
Data Sampling
The NWE signal is characterized by a setup timing, a pulse width and a hold timing:
NWE_SETUP: The NWE setup time is defined as the setup of address and data before the NWE falling
edge.
NWE_PULSE: The NWE pulse length is the time between NWE falling edge and NWE rising edge.
NWE_HOLD: The NWE hold time is defined as the hold time of address and data after the NWE rising edge.
The NWE waveforms apply to all byte-write lines in Byte Write access mode: NWR0 to NWR3.
30.10.3.2 NCS Waveforms
The NCS signal waveforms in write operations are not the same as those applied in read operations, but are
separately defined:
488
NCS_WR_SETUP: The NCS setup time is defined as the setup time of address before the NCS falling edge.
NCS_WR_PULSE: The NCS pulse length is the time between NCS falling edge and NCS rising edge.
NCS_WR_HOLD: The NCS hold time is defined as the hold time of address after the NCS rising edge.
A[25:2]
NBS0, NBS1,
A0, A1
NWE
NCS
NWE_SETUP
NCS_WR_SETUP
NWE_PULSE
NCS_WR_PULSE
NWE_HOLD
NCS_WR_HOLD
NWE_CYCLE
The write cycle time is defined as the total duration of the write cycle, that is, from the time where address is set on
the address bus to the point where address may change. The total write cycle time is equal to:
NWE_CYCLE = NWE_SETUP + NWE_PULSE + NWE_HOLD,
as well as
NWE_CYCLE = NCS_WR_SETUP + NCS_WR_PULSE + NCS_WR_HOLD
All NWE and NCS (write) timings are defined separately for each chip select as an integer number of Master Clock
cycles. The NWE_CYCLE field is common to both the NWE and NCS signals, thus the timing period is of the same
duration.
NWE_CYCLE, NWE_SETUP, and NWE_PULSE implicitly define the NWE_HOLD value as:
NWE_HOLD = NWE_CYCLE - NWE_SETUP - NWE_PULSE
NWE_CYCLE, NCS_WR_SETUP, and NCS_WR_PULSE implicitly define the NCS_WR_HOLD value as:
NCS_WR_HOLD = NWE_CYCLE - NCS_WR_SETUP - NCS_WR_PULSE
30.10.4 Write Mode
The WRITE_MODE parameter in the HSMC_MODE register of the corresponding chip select indicates which
signal controls the write operation.
30.10.4.1 Write is Controlled by NWE (WRITE_MODE = 1)
Figure 30-11 shows the waveforms of a write operation with WRITE_MODE set to 1. The data is put on the bus
during the pulse and hold steps of the NWE signal. The internal data buffers are switched to output mode after the
NWE_SETUP time, and until the end of the write cycle, regardless of the programmed waveform on NCS.
489
A[25:2]
NBS0, NBS1,
A0, A1
NWE,
NWR0, NWR1
NCS
D[15:0]
Figure 30-12 shows the waveforms of a write operation with WRITE_MODE configured to 0. The data is put on the
bus during the pulse and hold steps of the NCS signal. The internal data buffers are switched to output mode after
the NCS_WR_SETUP time, and until the end of the write cycle, regardless of the programmed waveform on NWE.
Figure 30-12. WRITE_MODE = 0. The write operation is controlled by NCS
MCK
A[25:2]
NBS0, NBS1,
A0, A1
NWE,
NWR0, NWR1
NCS
D[15:0]
490
Table 30-5 shows how the timing parameters are coded and their permitted range.
Table 30-5.
Coded Value
Number of Bits
Effective Value
setup [5:0]
pulse [6:0]
cycle[8:0]
Coded Value
Effective Value
0 setup 31
0..31
32 setup 63
128..(128 + 31)
0 pulse 63
0..63
64 pulse 127
256..(256 + 63)
0 cycle 127
0..127
256..(256 + 127)
512..(512 + 127)
768..(768 + 127)
Register
Reset Value
Description
HSMC_SETUP
0x0101_0101
HSMC_PULSE
0x0101_0101
HSMC_CYCLE
0x0003_0003
WRITE_MODE
READ_MODE
Null but positive setup and hold of address and NRD and/or NCS cannot be guaranteed at the memory interface
because of the propagation delay of these signals through external logic and pads. When positive setup and hold
values must be verified, then it is strictly recommended to program non-null values so as to cover possible skews
between address, NCS and NRD signals.
30.10.7.2 For Write Operations
If a null hold value is programmed on NWE, the SMC can guarantee a positive hold of address, byte select lines,
and NCS signal after the rising edge of NWE. This is true for WRITE_MODE = 1 only. See Section 30.12.2 Early
Read Wait State on page 493.
491
A null value for pulse parameters is forbidden and may lead to an unpredictable behavior.
In read and write cycles, the setup and hold time parameters are defined in reference to the address bus. For
external devices that require setup and hold time between NCS and NRD signals (read), or between NCS and
NWE signals (write), these setup and hold times must be converted into setup and hold times in reference to the
address bus.
HSMC_OCMS.SMSE
HSMC_OCMS.SRSE
HSMC_TIMINGSx.OCMS
Off-chip Memories
When the NAND Flash memory content is scrambled, the on-chip NFC SRAM page buffer associated for the
transfer is also scrambled.
492
Figure 30-13. Chip Select Wait State between a Read Access on NCS0 and a Write Access on NCS2
MCK
A[25:2]
NBS0, NBS1,
A0,A1
NRD
NWE
NCS0
NCS2
NRD_CYCLE
NWE_CYCLE
D[15:0]
if the write controlling signal has no hold time and the read controlling signal has no setup time (Figure 3014).
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 configured to 0, regardless of the read mode (Figure 30-15). The write
operation must end with an 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 30-16.
493
Figure 30-14. Early Read Wait State: Write with No Hold Followed by Read with No Setup
MCK
A[25:2]
NBS0, NBS1,
A0, A1
NWE
NRD
No hold
No setup
D[15:0]
Write cycle
Early Read
wait state
Read cycle
Figure 30-15. Early Read Wait State: NCS Controlled Write with No Hold Followed by a Read with No NCS Setup
MCK
A[25:2]
NBS0, NBS1,
A0,A1
NCS
NRD
No hold
No setup
D[15:0]
Read cycle
Write cycle
Early Read
(WRITE_MODE = 0) wait state (READ_MODE = 0 or READ_MODE = 1)
494
Figure 30-16. 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,
A0, A1
Internal write controlling signal
External write controlling signal
(NWE)
No hold
Read setup = 1
NRD
D[15:0]
Write cycle
Early Read
Read cycle
(WRITE_MODE = 1) wait state (READ_MODE = 0 or READ_MODE = 1)
To insert a Reload Configuration Wait State, the SMC detects a write access to any HSMC_MODE register of the
user interface. If only the timing registers are modified (HSMC_SETUP, HSMC_PULSE, HSMC_CYCLE registers)
in the user interface, the user must validate the modification by writing the HSMC_MODE register, even if no
change was made on the mode parameters.
30.12.3.2 Slow Clock Mode Transition
A Reload Configuration Wait State is also inserted when the Slow Clock Mode is entered or exited, after the end of
the current transfer (see Section 30.15 Slow Clock Mode on page 506).
495
before starting a write access to the same device or to a different external one.
The Data Float Output Time (tDF) for each external memory device is programmed in the TDF_CYCLES field of the
HSMC_MODE register for the corresponding chip select. The value of TDF_CYCLES indicates the number of data
float wait cycles (between 0 and 15) before the external device releases the bus, and represents the time allowed
for the data output to go to high impedance after the memory is disabled.
Data float wait states do not delay internal memory accesses. Hence, a single access to an external memory with
long tDF will not slow down the execution of a program from internal memory.
The data float wait states management depends on the READ_MODE and the TDF_MODE bits of the
HSMC_MODE register for the corresponding chip select.
30.13.1 READ_MODE
Setting READ_MODE to 1 indicates to the SMC that the NRD signal is responsible for turning 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_CYCLES field in
HSMC_MODEx gives the number of MCK cycles during which the data bus remains busy after the rising edge of
NCS.
Figure 30-17 illustrates the Data Float Period in NRD-controlled mode (READ_MODE = 1), assuming a data float
period of two cycles (TDF_CYCLES = 2). Figure 30-18 shows the read operation when controlled by NCS
(READ_MODE = 0) and the TDF_CYCLES parameter equals 3.
496
A[25:2]
NBS0, NBS1,
A0, A1
NRD
NCS
tpacc
D[15:0]
TDF = 2 clock cycles
A[25:2]
NBS0, NBS1,
A0,A1
NRD
NCS
tpacc
D[15:0]
497
A[25:2]
NRD
NRD_HOLD= 4
NWE
NWE_SETUP= 3
NCS0
TDF_CYCLES = 6
D[15:0]
Read to Write
Wait State
498
Figure 30-20. TDF Optimization Disabled (TDF Mode = 0). TDF wait states between 2 read accesses on different chip selects
MCK
A[25:2]
NBS0, NBS1,
A0, A1
read1 controlling signal
(NRD)
read1 hold = 1
read2 setup = 1
TDF_CYCLES = 6
D[15:0]
read1 cycle
TDF_CYCLES = 6
Chip Select Wait State
Figure 30-21.
TDF Mode = 0: TDF wait states between a read and a write access on different chip selects
MCK
A[25:2]
NBS0, NBS1,
A0, A1
read1 controlling signal
(NRD)
read1 hold = 1
write2 setup = 1
TDF_CYCLES = 4
D[15:0]
read1 cycle
TDF_CYCLES = 4
write2 cycle
TDF_MODE = 0
(optimization disabled)
499
Figure 30-22. TDF Mode = 0: TDF wait states between read and write accesses on the same chip select
MCK
A[25:2]
NBS0, NBS1,
A0, A1
read1 controlling signal
(NRD)
write2 setup = 1
read1 hold = 1
TDF_CYCLES = 5
D[15:0]
Read to Write
Wait State
write2 cycle
TDF_MODE = 0
(optimization disabled)
500
Figure 30-23. Write Access with NWAIT Assertion in Frozen Mode (EXNW_MODE = 10)
MCK
A[25:2]
NBS0, NBS1,
A0,A1
FROZEN STATE
4
NWE
6
NCS
D[15:0]
NWAIT
Internally synchronized
NWAIT signal
Write cycle
EXNW_MODE = 10 (Frozen)
WRITE_MODE = 1 (NWE_controlled)
NWE_PULSE = 5
NCS_WR_PULSE = 7
501
Figure 30-24. Read Access with NWAIT Assertion in Frozen Mode (EXNW_MODE = 10)
MCK
A[25:2]
NBS0, NBS1,
A0,A1
FROZEN STATE
NCS
0
2
NRD
NWAIT
Internally synchronized
NWAIT signal
Read cycle
EXNW_MODE = 10 (Frozen)
READ_MODE = 0 (NCS_controlled)
NRD_PULSE = 2, NRD_HOLD = 6
NCS_RD_PULSE = 5, NCS_RD_HOLD = 3
Assertion is ignored
502
Figure 30-25. NWAIT Assertion in Write Access: Ready Mode (EXNW_MODE = 11)
MCK
A[25:2]
NBS0, NBS1,
A0,A1
Wait STATE
4
NWE
6
NCS
D[15:0]
NWAIT
Internally synchronized
NWAIT signal
Write cycle
EXNW_MODE = 11 (Ready mode)
WRITE_MODE = 1 (NWE_controlled)
NWE_PULSE = 5
NCS_WR_PULSE = 7
503
Figure 30-26. NWAIT Assertion in Read Access: Ready Mode (EXNW_MODE = 11)
MCK
A[25:2]
NBS0, NBS1,
A0,A1
Wait STATE
6
NCS
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
504
MCK
A[25:2]
NBS0, NBS1,
A0,A1
WAIT STATE
4
NRD
Minimal pulse length
NWAIT
Internally synchronized
NWAIT signal
NWAIT latency
2 Resynchronization cycles
Read cycle
EXNW_MODE = 10 or 11
READ_MODE = 1 (NRD_controlled)
NRD_PULSE = 5
505
MCK
A[25:2]
A[25:2]
NBS0, NBS1,
A0,A1
NBS0, NBS1,
A0,A1
NWE
NRD
1
NCS
NCS
NRD_CYCLE = 2
NWE_CYCLE = 3
SLOW CLOCK MODE WRITE
Table 30-8.
Read Parameters
Duration (cycles)
Write Parameters
Duration (cycles)
NRD_SETUP
NWE_SETUP
NRD_PULSE
NWE_PULSE
NCS_RD_SETUP
NCS_WR_SETUP
NCS_RD_PULSE
NCS_WR_PULSE
NRD_CYCLE
NWE_CYCLE
30.15.2 Switching from (to) Slow Clock Mode to (from) Normal Mode
When switching from slow clock mode to normal mode, the current slow clock mode transfer is completed at high
clock rate, with the set of slow clock mode parameters. See Figure 30-29. The external device may not be fast
enough to support such timings.
Figure 30-30 illustrates the recommended procedure to properly switch from one mode to the other.
506
Figure 30-29. Clock Rate Transition occurs while the SMC is performing a Write Operation
Slow Clock Mode
internal signal from PMC
MCK
A[25:2]
NBS0, NBS1,
A0, A1
NWE
NCS
NWE_CYCLE = 3
SLOW CLOCK MODE WRITE
NWE_CYCLE = 7
SLOW CLOCK
MODE WRITE
Slow clock
mode transition
is detected:
Reload
Configuration
Wait State
Figure 30-30. 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,
A0, A1
NWE
1
NCS
IDLE STATE
507
the data of the register (NFCDATA_ADDT) is the address to be sent to the NAND Flash
So, in one single access the command is sent and immediately executed by the NFC. Two commands can even
be programmed within a single access (CMD1, CMD2) depending on the VCMD2 value.
The NFC can send up to five address cycles.
Figure 30-31 shows a typical NAND Flash Page Read Command of a NAND Flash Memory and correspondence
with NFC Address Command Register.
508
Col. Add1
Col. Add2
30h
Row Address
Column Address
CMD1
ADD cycles (0 to 5)
CMD2
If VCMD2 = 1
For more details refer to Section 30.17.2.2 NFC Address Command on page 510.
Reading the NFC Command Register (to any address) will give the status of the NFC. This is especially useful to
know if the NFC is busy, for example.
30.17.2.1 Building NFC Address Command Example
509
Name:
NFCADDR_CMD
Access:
Read/Write
Reset:
0x00000000
31
23
30
29
28
27
26
NFCWR
25
DATAEN
22
21
20
ACYCLE
19
18
VCMD2
17
12
11
10
CSID
15
14
13
16
CMD2
CMD2
7
24
CSID
8
CMD1
CMD1
510
Name:
NFCDATA_ADDT
Access:
Write-only
Reset:
0x00000000
31
30
29
28
27
ADDR_CYCLE4
26
25
24
23
22
21
20
19
ADDR_CYCLE3
18
17
16
15
14
13
12
11
ADDR_CYCLE2
10
4
3
ADDR_CYCLE1
511
Name:
NFCDATA_STATUS
Access:
Read-only
Reset:
0x00000000
31
23
30
29
28
27
NFCBUSY
26
NFCWR
25
DATAEN
22
21
20
ACYCLE
19
18
VCMD2
17
12
11
10
CSID
15
14
13
16
CMD2
CMD2
7
24
CSID
8
CMD1
CMD1
512
Use NWE_SETUP, NWE_PULSE and NWE_CYCLE to define the write enable waveform according to the
external device datasheet.
Use TADL field in the HSMC_TIMINGS register to configure the timing between the last address latch cycle and
the first rising edge of WEN for data input.
Figure 30-32. Write Enable Timing Configuration
mck
wen
t WEN_SETUP
t WEN_PULSE
t WEN_HOLD
t WEN_CYCLES
Figure 30-33. Write Enable Timing for NAND Flash Device Data Input Mode
mck
ale
wen
t ADL
Use NRD_SETUP, NRD_PULSE and NRD_CYCLE to define the read enable waveform according to the external
device datasheet.
Use TAR field in the HSMC_TIMINGS register to configure the timings between the address latch enable falling
edge to read the enable falling edge.
Use TCLR field in the HSMC_TIMINGS register to configure the timings between the command latch enable falling
edge to read the enable falling edge.
513
Figure 30-34. Read Enable Timing Configuration Working with NAND Flash Device
mck
cen
ale
cle
ren
tCLR
tAR
tREN_SETUP
tREN_PULSE
tREH
tREN_CYCLE
Use TWB field in HSMC_TIMINGS register to configure the maximum elapsed time between the rising edge of the
wen signal and the falling edge of the rbn signal. Use TRR field in the HSMC_TIMINGS register to program the
number of clock cycles between the rising edge of the rbn signal and the falling edge of the ren signal.
Figure 30-35. Ready/Busy Timing Configuration
mck
rbn
ren
wen
tWB
514
busy
tRR
When the NFC Command register is written, the NFC issues a NAND Flash Command and optionally performs a
data transfer between the NFC SRAM and the NAND Flash device. The NFC Timing Engine guarantees valid
NAND Flash timings, depending on the set of parameters decoded from the address bus. These timings are
defined in the HSMC_TIMINGS register.
For information on the timing used depending on the command, see Figure 30-36.
Figure 30-36. NFC Timing Engine
Timing Check Engine
See the NFC Address Command register description and the HSMC Timings Register.
30.17.4 NFC SRAM
30.17.4.1 NFC SRAM Mapping
If the NFC is used to read and write data from and to the NAND Flash, the configuration depends on the page size
(PAGESIZE field in HSMC_CFG register). See Table 30-9 to Table 30-13 for detailed mapping.
The NFC SRAM size is 8 Kbytes. The NFC can handle the NAND Flash with a page size of 8 Kbytes or lower
(such as 2 Kbytes, for example). In case of a 4 Kbyte or lower page size, the NFC SRAM can be split into two
banks. The BANK bit in the HSMC_BANK register is used to select where NAND flash data are written or read. For
an 8 Kbyte page size this field is not relevant.
Note that a ping-pong mode (write or read to a bank while the NFC writes or reads to another bank) is accessible
with the NFC (using two different banks).
515
If the NFC is not used, the NFC SRAM can be used for a general purpose by the application.
Table 30-9.
Offset
Use
Access
0x000000000x000001FF
Read/Write
0x000002000x000003FF
Read/Write
0x000012000x000013FF
Read/Write
0x000014000x000015FF
Read/Write
Table 30-10.
Offset
Use
Access
0x000000000x000003FF
Read/Write
0x000004000x000005FF
Read/Write
0x000012000x000015FF
Read/Write
0x000016000x000017FF
Read/Write
Table 30-11.
Offset
Use
Access
0x000000000x000007FF
Read/Write
0x000008000x000009FF
Read/Write
0x000012000x000019FF
Read/Write
0x00001A000x00001BFF
Read/Write
Table 30-12.
Offset
Use
Access
0x000000000x00000FFF
Read/Write
0x000010000x000011FF
Read/Write
0x000012000x000021FF
Read/Write
0x000022000x000023FF
Read/Write
Table 30-13.
NFC SRAM Bank Mapping for 8 Kbytes, only one bank is available
Offset
Use
Access
0x000000000x00001FFF
Read/Write
0x000020000x000023FF
Read/Write
When the NFC is reading from or writing to an NFC SRAM bank, the other bank is available. If an NFC SRAM
access occurs when the NFC performs a read or write operation in the same bank, then the access is discarded.
The write operation is not performed. The read operation returns undefined data. If this situation is encountered,
the AWB status flag located in the NFC Status Register is raised and indicates that a shared resource access
violation has occurred.
516
Using NFC
Enable XFRDONE
interrupt (SMC_IER)
Check Error
Correcting Codes
Note that, instead of using the interrupt, one can poll the NFCBUSY flag.
For more information on the NFC Control Register, see Section 30.17.2.2 NFC Address Command.
517
Write ECC
Writing the ECC cannot be done using the NFC; it needs to be done manually.
Note that, instead of using the interrupt, one can poll the NFCBUSY flag.
For more information on the NFC Control Register, see Section 30.17.2.2 NFC Address Command.
518
3.
All decoding steps involve finite field computation. It means that a library of finite field arithmetic must be available
to perform addition, multiplication and inversion. These arithmetic operations can be performed through the use of
a memory mapped look-up table, or direct software implementation. The software implementation presented is
based on look-up tables. Two tables named gf_log and gf_antilog are used. If alpha is the primitive element of the
field, then a power of alpha is in the field. Assuming that beta = alpha ^ index, then beta belongs to the field, and
gf_log(beta) = gf_log(alpha ^ index) = index. The gf_antilog table provides exponent inverse of the element; if beta
= alpha ^ index, then gf_antilog(index) = beta.
The first step consists in the syndrome computation. The PMECC module computes the remainders and the
software must substitute the power of the primitive element. The procedure implementation is given in Section
30.19.1 Remainder Substitution Procedure on page 526.
The second step is the most software intensive. It is the Berlekamps iterative algorithm for finding the errorlocation polynomial. The procedure implementation is given in Section 30.19.2 Find the Error Location Polynomial
Sigma(x) on page 526.
The Last step is finding the root of the error location polynomial. This step can be very software intensive. Indeed
there is no straightforward method of finding the roots, except evaluating each element of the field in the error
location polynomial. However, a hardware accelerator can be used to find the roots of the polynomial. The
PMERRLOC module provides this kind of hardware acceleration.
519
NAND Flash
PROGRAM PAGE
Operation
Software
NAND Flash
READ PAGE
Operation
Hardware
Accelerator
Configure PMECC :
error correction capability
sector size/page size
NAND write field set to true
spare area desired layout
Software
Hardware
Accelerator
Configure PMECC :
error correction capability
sector size/page size
NAND write field set to false
spare area desired layout
PMECC computes
redundancy as the
data is written into
external memory
PMECC computes
polynomial remainders
as the data is read
from external memory
PMECC modules
indicate if at least one
error is detected.
520
BCH_ERR Field
PMECC0
PMECC0
PMECC0, PMECC1
PMECC0, PMECC1
Table 30-15.
Number of Relevant ECC Bytes per Sector, Copied from LSByte to MSByte
BCH_ERR Field
4 bytes
4 bytes
7 bytes
7 bytes
13 bytes
14 bytes
20 bytes
21 bytes
39 bytes
42 bytes
When the SPAREEN bit of the PMECCFG register is set, the spare area of the page is encoded with the stream of
data of the last sector of the page. This mode is entered by setting the DATA bit of the PMECCTRL register. When
the encoding process is over, the redundancy shall be written to the spare area in user mode. The USER bit of the
PMECCTRL register must be set.
521
Sector 1
Sector 2
sparesize
Sector 3
Spare
ecc_area
start_addr
end_addr
When the SPAREEN bit of PMECCFG is cleared, the spare area is not encoded with the stream of data. This
mode is entered by setting the DATA bit of the PMECCTRL register.
Figure 30-41. NAND Write Operation
Sector 1
522
Sector 2
Sector 3
BCH_ERR Field
PMECCREM0
PMECCREM0
PMECCREM0, PMECCREM1
PMECCREM0, PMECCREM1
PMECCREM0, PMECCREM1,
PMECCREM2, PMECCREM3,
PMECCREM0, PMECCREM1,
PMECCREM2, PMECCREM3
PMECCREM0, PMECCREM1,
PMECCREM2, PMECCREM3,
PMECCREM4, PMECCREM5,
PMECCREM6, PMECCREM7
PMECCREM0, PMECCREM1,
PMECCREM2, PMECCREM3,
PMECCREM4, PMECCREM5,
PMECCREM6, PMECCREM7
PMECCREM0, PMECCREM1,
PMECCREM2, PMECCREM3,
PMECCREM4, PMECCREM5,
PMECCREM6, PMECCREM7,
PMECCREM8, PMECCREM9,
PMECCREM10, PMECCREM11
PMECCREM0, PMECCREM1,
PMECCREM2, PMECCREM3,
PMECCREM4, PMECCREM5,
PMECCREM6, PMECCREM7,
PMECCREM8, PMECCREM9,
PMECCREM10, PMECCREM11
When the spare area is protected, it contains valid data. As the redundancy may be included in the middle of the
information stream, the user shall program the start address and the end address of the ECC area. The controller
will automatically skip the ECC area. This mode is entered writing a 1 in the DATA bit of the PMECCTRL register.
When the page has been fully retrieved from the NAND, the ECC area shall be read using the user mode, writing a
1 to the USER bit of the PMECCTRL register.
Figure 30-42. Read Operation with Spare Decoding
Read NAND operation with SPAREEN set to One and AUTO set to Zero
pagesize = n * sectorsize
Sector 0
Sector 1
Sector 2
sparesize
Sector 3
Spare
ecc_area
start_addr
end_addr
If the spare area is not protected with the error correcting code, the redundancy area is retrieved directly. This
mode is entered writing a 1 in the DATA bit of the PMECCTRL register. When AUTO field is set to one, the ECC is
retrieved automatically; otherwise, the ECC must be read using the user mode.
523
Read NAND operation with SPAREEN set to Zero and AUTO set to One
pagesize = n * sectorsize
Sector 1
Sector 2
Sector 3
Spare
ecc_area
end_addr
ECC_BLK2
ECC_BLK1
ECC_BLK0
start_addr
ECC_BLK3
Sector 0
sparesize
This mode allows a manual retrieve of the ECC. It is entered writing a 1 in the USER field of the PMECCTRL
register.
Figure 30-44. Read User Mode
ecc_area_size
ECC
ecc_area
addr = 0
end_addr
524
Transfer Type
PMECC
RSPARE
WSPARE
SPAREEN
AUTO
User Mode
Not used
Not used
Used
Not used
Used
525
/* mu
*/
int mu[NB_ERROR_MAX+2];
/* sigma ro
*/
int sro[2*NB_ERROR_MAX+1];
/* discrepancy */
int dmu[NB_ERROR_MAX+2];
/* delta order
*/
int delta[NB_ERROR_MAX+2];
/* index of largest delta */
int ro;
int largest;
int diff;
/*
*/
/*
First Row
*/
/*
*/
/* Mu */
mu[0] = -1; /* Actually -1/2 */
/* Sigma(x) set to 1 */
for (i = 0; i < (2*NB_ERROR_MAX+1); i++)
smu[0][i] = 0;
smu[0][0] = 1;
/* discrepancy set to 1 */
dmu[0] = 1;
/* polynom order set to 0 */
lmu[0] = 0;
/* delta set to -1 */
delta[0] = (mu[0] * 2 - lmu[0]) >> 1;
/*
*/
/*
Second Row
*/
/*
*/
/* Mu */
mu[1] = 0;
/* Sigma(x) set to 1 */
for (i = 0; i < (2*NB_ERROR_MAX+1); i++)
smu[1][i] = 0;
smu[1][0] = 1;
/* discrepancy set to Syndrome 1 */
dmu[1] = si[1];
/* polynom order set to 0 */
lmu[1] = 0;
/* delta set to 0 */
delta[1] = (mu[1] * 2 - lmu[1]) >> 1;
for (i=1; i <= NB_ERROR; i++)
{
mu[i+1] = i << 1;
/*************************************************/
/*
*/
/*
*/
/*
Compute Sigma (Mu+1)
*/
/*
And L(mu)
*/
/* check if discrepancy is set to 0 */
if (dmu[i] == 0)
{
/* copy polynom */
for (j=0; j<2*NB_ERROR_MAX+1; j++)
527
{
smu[i+1][j] = smu[i][j];
}
/* copy previous polynom order to the next */
lmu[i+1] = lmu[i];
}
else
{
ro
= 0;
largest = -1;
/* find largest delta with dmu != 0 */
for (j=0; j<i; j++)
{
if (dmu[j])
{
if (delta[j] > largest)
{
largest = delta[j];
ro
= j;
}
}
}
/* initialize signal ro */
for (k = 0; k < 2*NB_ERROR_MAX+1; k ++)
{
sro[k] = 0;
}
/* compute difference */
diff = (mu[i] - mu[ro]);
/* compute X ^ (2(mu-ro)) */
for (k = 0; k < (2*NB_ERROR_MAX+1); k ++)
{
sro[k+diff] = smu[ro][k];
}
/* multiply by dmu * dmu[ro]^-1 */
for (k = 0; k < 2*NB_ERROR_MAX+1; k ++)
{
/* dmu[ro] is not equal to zero by definition */
/* check that operand are different from 0
*/
if (sro[k] && dmu[i])
{
/* galois inverse */
sro[k] = gf_antilog[(gf_log[dmu[i]] + (NB_FIELD_ELEMENTSgf_log[dmu[ro]]) + gf_log[sro[k]]) % NB_FIELD_ELEMENTS];
}
}
/* multiply by dmu * dmu[ro]^-1 */
for (k = 0; k < 2*NB_ERROR_MAX+1; k++)
{
smu[i+1][k] = smu[i][k] ^ sro[k];
if (smu[i+1][k])
{
/* find the order of the polynom */
lmu[i+1] = k << 1;
}
528
}
}
/*
*/
/*
*/
/*
End Compute Sigma (Mu+1)
*/
/*
And L(mu)
*/
/*************************************************/
/* In either case compute delta */
delta[i+1] = (mu[i+1] * 2 - lmu[i+1]) >> 1;
/* In either case compute the discrepancy */
for (k = 0 ; k <= (lmu[i+1]>>1); k++)
{
if (k == 0)
dmu[i+1] = si[2*(i-1)+3];
/* check if one operand of the multiplier is null, its index is -1 */
else if (smu[i+1][k] && si[2*(i-1)+3-k])
dmu[i+1] = gf_antilog[(gf_log[smu[i+1][k]] + gf_log[si[2*(i-1)+3k]])%nn] ^ dmu[i+1];
}
}
return 0;
}
529
The PMECC Error Location controller provides hardware acceleration for determining roots of polynomials over
two finite fields: GF(2^13) and GF(2^14). It integrates 32 fully programmable coefficients. These coefficients
belong to GF(2^13) or GF(2^14). The coefficient programmed in the PMERRLOC{i} is the coefficient of X ^ i in the
polynomial.
The search operation is started as soon as a write access is detected in the ELEN register and can be disabled
writing to the ELDIS register. The ENINIT field of the ELEN register shall be initialized with the number of galois
field elements to test. The set of the roots can be limited to a valid range.
Table 30-18.
ENINIT Value
4122
4148
4200
12
4252
24
4408
Table 30-19.
ENINIT Value
8220
8248
8304
12
8360
24
8528
When the PMECC engine is searching for roots, the BUSY field of the ELSR register remains asserted. An
interrupt is asserted at the end of the computation, and the DONE bit of the PMECC Error Location Interrupt Status
Register (HSMC_ELSIR) is set. The ERR_CNT field of the HSMC_ELISR indicates the number of errors. The
error position can be read in the PMERRLOCX registers.
530
Register Mapping
Offset
Register
Name
Access
Reset
0x000
HSMC_CFG
Read/Write
0x0
0x004
HSMC_CTRL
Write-only
0x0
0x008
HSMC_SR
Read-only
0x0
0x00C
HSMC_IER
Write-only
0x010
HSMC_IDR
Write-only
0x014
HSMC_IMR
Read-only
0x0
0x018
HSMC_ADDR
Read/Write
0x0
0x01C
HSMC_BANK
Read/Write
0x0
0x0200x06C
Reserved
0x070
HSMC_PMECCFG
Read/Write
0x0
0x074
HSMC_PMECCSAREA
Read/Write
0x0
0x078
HSMC_PMECCSADDR
Read/Write
0x0
0x07C
HSMC_PMECCEADDR
Read/Write
0x0
0x080
Reserved
0x084
HSMC_PMECCTRL
Write-only
0x088
HSMC_PMECCSR
Read-only
0x0
0x08C
HSMC_PMECCIER
Write-only
0x090
HSMC_PMECCIDR
Write-only
0x094
HSMC_PMECCIMR
Read-only
0x0
0x098
HSMC_PMECCISR
Read-only
0x0
0x09C0x0AC
Reserved
0x0B0+sec_num*(0x40)+0x00
HSMC_PMECC0
Read-only
0x0
0x0B0+sec_num*(0x40)+0x04
HSMC_PMECC1
Read-only
0x0
0x0B0+sec_num*(0x40)+0x08
HSMC_PMECC2
Read-only
0x0
0x0B0+sec_num*(0x40)+0x0C
HSMC_PMECC3
Read-only
0x0
0x0B0+sec_num*(0x40)+0x10
HSMC_PMECC4
Read-only
0x0
0x0B0+sec_num*(0x40)+0x14
HSMC_PMECC5
Read-only
0x0
0x0B0+sec_num*(0x40)+0x18
HSMC_PMECC6
Read-only
0x0
0x0B0+sec_num*(0x40)+0x1C
HSMC_PMECC7
Read-only
0x0
0x0B0+sec_num*(0x40)+0x20
HSMC_PMECC8
Read-only
0x0
0x0B0+sec_num*(0x40)+0x24
HSMC_PMECC9
Read-only
0x0
0x0B0+sec_num*(0x40)+0x28
HSMC_PMECC10
Read-only
0x0
531
Table 30-20.
Offset
Register
Name
Access
Reset
0x2B0+sec_num*(0x40)+0x00
HSMC_REM0
Read-only
0x0
0x2B0+sec_num*(0x40)+0x04
HSMC_REM1
Read-only
0x0
0x2B0+sec_num*(0x40)+0x08
HSMC_REM2
Read-only
0x0
0x2B0+sec_num*(0x40)+0x0C
HSMC_REM3
Read-only
0x0
0x2B0+sec_num*(0x40)+0x10
HSMC_REM4
Read-only
0x0
0x2B0+sec_num*(0x40)+0x14
HSMC_REM5
Read-only
0x0
0x2B0+sec_num*(0x40)+0x18
HSMC_REM6
Read-only
0x0
0x2B0+sec_num*(0x40)+0x1C
HSMC_REM7
Read-only
0x0
0x2B0+sec_num*(0x40)+0x20
HSMC_REM8
Read-only
0x0
0x2B0+sec_num*(0x40)+0x24
HSMC_REM9
Read-only
0x0
0x2B0+sec_num*(0x40)+0x28
HSMC_REM10
Read-only
0x0
0x2B0+sec_num*(0x40)+0x2C
HSMC_REM11
Read-only
0x0
0x4A00x4FC
Reserved
0x500
HSMC_ELCFG
Read/Write
0x0
0x504
HSMC_ELPRIM
Read-only
0x401A
0x508
HSMC_ELEN
Write-only
0x50C
HSMC_ELDIS
Write-only
0x510
HSMC_ELSR
Read
0x0
0x514
HSMC_ELIER
Write-only
0x518
HSMC_ELIDR
Write-only
0x51C
HSMC_ELIMR
Read
0x0
0x520
HSMC_ELISR
Read
0x0
0x524
Reserved
0x528
HSMC_SIGMA0
Read/Write
0x1
0x52C
HSMC_SIGMA1
Read/Write
0x0
0x530
HSMC_SIGMA2
Read/Write
0x0
0x534
HSMC_SIGMA3
Read/Write
0x0
0x538
HSMC_SIGMA4
Read/Write
0x0
532
Table 30-20.
Offset
Register
Name
Access
Reset
0x53C
HSMC_SIGMA5
Read/Write
0x0
0x540
HSMC_SIGMA6
Read/Write
0x0
0x544
HSMC_SIGMA7
Read/Write
0x0
0x548
HSMC_SIGMA8
Read/Write
0x0
0x54C
HSMC_SIGMA9
Read/Write
0x0
0x550
HSMC_SIGMA10
Read/Write
0x0
0x554
HSMC_SIGMA11
Read/Write
0x0
0x558
HSMC_SIGMA12
Read/Write
0x0
0x55C
HSMC_SIGMA13
Read/Write
0x0
0x560
HSMC_SIGMA14
Read/Write
0x0
0x564
HSMC_SIGMA15
Read/Write
0x0
0x568
HSMC_SIGMA16
Read/Write
0x0
0x56C
HSMC_SIGMA17
Read/Write
0x0
0x570
HSMC_SIGMA18
Read/Write
0x0
0x574
HSMC_SIGMA19
Read/Write
0x0
0x578
HSMC_SIGMA20
Read/Write
0x0
0x57C
HSMC_SIGMA21
Read/Write
0x0
0x580
HSMC_SIGMA22
Read/Write
0x0
0x584
HSMC_SIGMA23
Read/Write
0x0
0x588
HSMC_SIGMA24
Read/Write
0x0
0x58C
HSMC_ERRLOC0
Read-only
0x0
...
...
...
...
...
0x5E8
HSMC_ERRLOC23
Read-only
0x0
0x5EC0x5FC
Reserved
533
Table 30-20.
Offset
Register
Name
Access
Reset
0x14*CS_number+0x600
HSMC_SETUP
Read/Write
0x0101_0101
0x14*CS_number+0x604
HSMC_PULSE
Read/Write
0x0101_0101
0x14*CS_number+0x608
HSMC_CYCLE
Read/Write
0x0003_0003
0x14*CS_number+0x60C
HSMC_TIMINGS
Read/Write
0x0000_0000
0x14*CS_number+0x610
HSMC_MODE
Read/Write
0x0000_1003
0x6A0
HSMC_OCMS
Read/Write
0x0
0x6A4
HSMC_KEY1
Write-once
0x0
0x6A8
HSMC_KEY2
Write-once
0x0
0x6AC0x6E0
Reserved
0x6E4
HSMC_WPMR
Read/Write
0x0
0x6E8
HSMC_WPSR
Read-only
0x0
0x6EC0x6FC
Reserved
534
HSMC_CFG
Address:
0xFC05C000
Access:
Read/Write
31
30
29
28
27
NFCSPARESIZE
26
25
24
23
22
21
DTOMUL
20
19
18
17
16
15
14
13
RBEDGE
12
EDGECTRL
11
10
9
RSPARE
8
WSPARE
1
PAGESIZE
DTOCYC
Name
Description
PS512
PS1024
PS2048
PS4096
PS8192
535
Name
Description
X1
DTOCYC
X16
DTOCYC x 16
X128
DTOCYC x 128
X256
DTOCYC x 256
X1024
DTOCYC x 1024
X4096
DTOCYC x 4096
X65536
DTOCYC x 65536
X1048576
DTOCYC x 1048576
If the data timeout set by DTOCYC and DTOMUL has been exceeded, the Data Timeout Error flag (DTOE) in the NFC Status Register (NFC_SR) raises.
NFCSPARESIZE: NAND Flash Spare Area Size Retrieved by the Host Controller
The spare size is set to (NFCSPARESIZE + 1) * 4 bytes. The spare area is only retrieved when RSPARE or WSPARE is
activated.
536
HSMC_CTRL
Address:
0xFC05C004
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
1
NFCDIS
0
NFCEN
537
HSMC_SR
Address:
0xFC05C008
Access:
Read-only
31
30
29
28
27
RB_EDGE3
26
25
24
23
NFCASE
22
AWB
21
UNDEF
20
DTOE
19
18
17
CMDDONE
16
XFRDONE
15
14
13
NFCSID
12
11
NFCWR
10
8
NFCBUSY
5
RB_FALL
4
RB_RISE
0
SMCSTS
539
HSMC_IER
Address:
0xFC05C00C
Access:
Write-only
31
30
29
28
27
RB_EDGE3
26
25
24
23
NFCASE
22
AWB
21
UNDEF
20
DTOE
19
18
17
CMDDONE
16
XFRDONE
15
14
13
12
11
10
5
RB_FALL
4
RB_RISE
540
541
HSMC_IDR
Address:
0xFC05C010
Access:
Write-only
31
30
29
28
27
RB_EDGE3
26
25
24
23
NFCASE
22
AWB
21
UNDEF
20
DTOE
19
18
17
CMDDONE
16
XFRDONE
15
14
13
12
11
10
5
RB_FALL
4
RB_RISE
542
543
HSMC_IMR
Address:
0xFC05C014
Access:
Read-only
31
30
29
28
27
RB_EDGE3
26
25
24
23
NFCASE
22
AWB
21
UNDEF
20
DTOE
19
18
17
CMDDONE
16
XFRDONE
15
14
13
12
11
10
5
RB_FALL
4
RB_RISE
544
545
HSMC_ADDR
Address:
0xFC05C018
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
4
3
ADDR_CYCLE0
546
HSMC_BANK
Address:
0xFC05C01C
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
0
BANK
547
HSMC_PMECCFG
Address:
0xFC05C070
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
AUTO
19
18
17
16
SPAREEN
15
14
13
12
NANDWR
11
10
4
SECTORSZ
1
BCH_ERR
Name
Description
BCH_ERR2
2 errors
BCH_ERR4
4 errors
BCH_ERR8
8 errors
BCH_ERR12
12 errors
BCH_ERR24
24 errors
Name
Description
PAGESIZE_1SEC
PAGESIZE_2SEC
PAGESIZE_4SEC
PAGESIZE_8SEC
548
8
PAGESIZE
0
549
HSMC_PMECCSAREA
Address:
0xFC05C074
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
8
SPARESIZE
SPARESIZE
550
HSMC_PMECCSADDR
Address:
0xFC05C078
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
8
STARTADDR
STARTADDR
551
HSMC_PMECCEADDR
Address:
0xFC05C07C
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
8
ENDADDR
ENDADDR
552
HSMC_PMECCTRL
Address:
0xFC05C084
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
5
DISABLE
4
ENABLE
2
USER
1
DATA
0
RST
553
HSMC_PMECCSR
Address:
0xFC05C088
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
4
ENABLE
0
BUSY
554
HSMC_PMECCIER
Address:
0xFC05C08C
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
0
ERRIE
555
HSMC_PMECCIDR
Address:
0xFC05C090
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
0
ERRID
556
HSMC_PMECCIMR
Address:
0xFC05C094
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
0
ERRIM
557
HSMC_PMECCISR
Address:
0xFC05C098
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
ERRIS
558
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ECC
23
22
21
20
ECC
15
14
13
12
ECC
4
ECC
559
Address:
Access:
Read-only
31
30
29
23
22
21
28
27
26
25
24
18
17
16
10
REM2NP3
20
19
REM2NP3
15
14
13
12
11
REM2NP1
3
REM2NP1
560
HSMC_ELCFG
Address:
0xFC05C500
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
ERRNUM
17
16
15
14
13
12
11
10
0
SECTORSZ
561
HSMC_ELPRIM
Address:
0xFC05C504
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
PRIMITIV
7
4
PRIMITIV
562
HSMC_ELEN
Address:
0xFC05C508
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
ENINIT
4
3
ENINIT
563
HSMC_ELDIS
Address:
0xFC05C50C
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
0
DIS
564
HSMC_ELSR
Address:
0xFC05C510
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
0
BUSY
565
HSMC_ELIER
Address:
0xFC05C514
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
0
DONE
566
HSMC_ELIDR
Address:
0xFC05C518
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
0
DONE
567
HSMC_ELIMR
Address:
0xFC05C51C
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
0
DONE
568
HSMC_ELISR
Address:
0xFC05C520
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
ERR_CNT
0
DONE
569
HSMC_SIGMAx [x=0..24]
Address:
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
SIGMAx
4
3
SIGMAx
570
HSMC_ERRLOCx [x=0..23]
Address:
0xFC05C58C
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
ERRLOCN
4
3
ERRLOCN
ERRLOCN: Error Position within the Set {sector area, spare area}
ERRLOCN points to 1 when the first bit of the main area is corrupted.
If the sector size is set to 512 bytes, the ERRLOCN points to 4096 when the last bit of the sector area is corrupted.
If the sector size is set to 1024 bytes, the ERRLOCN points to 8192 when the last bit of the sector area is corrupted.
If the sector size is set to 512 bytes, the ERRLOCN points to 4097 when the first bit of the spare area is corrupted.
If the sector size is set to 1024 bytes, the ERRLOCN points to 8193 when the first bit of the spare area is corrupted.
571
HSMC_SETUPx [x=0..3]
Address:
Access:
Write-only
31
30
29
28
27
26
NCS_RD_SETUP
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
NCS_WR_SETUP
NRD_SETUP
2
NWE_SETUP
This register can only be written if the WPEN bit is cleared in the HSMC Write Protection Mode Register.
NWE_SETUP: NWE Setup Length
The NWE signal setup length is defined as:
NWE setup length = (128 * NWE_SETUP[5] + NWE_SETUP[4:0]) clock cycles.
NCS_WR_SETUP: NCS Setup Length in Write Access
In write access, the NCS signal setup length is defined as:
NCS setup length = (128 * NCS_WR_SETUP[5] + NCS_WR_SETUP[4:0]) clock cycles.
NRD_SETUP: NRD Setup Length
The NRD signal setup length is defined as:
NRD setup length = (128 * NRD_SETUP[5] + NRD_SETUP[4:0]) clock cycles.
NCS_RD_SETUP: NCS Setup Length in Read Access
In Read access, the NCS signal setup length is defined as:
NCS setup length = (128 * NCS_RD_SETUP[5] + NCS_RD_SETUP[4:0]) clock cycles.
572
HSMC_PULSEx [x=0..3]
Address:
Access:
Write-only
31
30
29
28
27
NCS_RD_PULSE
26
25
24
23
22
21
20
19
NRD_PULSE
18
17
16
15
14
13
12
11
NCS_WR_PULSE
10
3
NWE_PULSE
This register can only be written if the WPEN bit is cleared in the HSMC Write Protection Mode Register.
NWE_PULSE: NWE Pulse Length
The NWE signal pulse length is defined as:
NWE pulse length = (256 * NWE_PULSE[6]+NWE_PULSE[5:0]) clock cycles.
The NWE pulse must be at least one clock cycle.
NCS_WR_PULSE: NCS Pulse Length in WRITE Access
In Write access, The NCS signal pulse length is defined as:
NCS pulse length = (256 * NCS_WR_PULSE[6] + NCS_WR_PULSE[5:0]) clock cycles.
The NCS pulse must be at least one clock cycle.
NRD_PULSE: NRD Pulse Length
The NRD signal pulse length is defined as:
NRD pulse length = (256 * NRD_PULSE[6] + NRD_PULSE[5:0]) clock cycles.
The NRD pulse width must be as least 1 clock cycle.
NCS_RD_PULSE: NCS Pulse Length in READ Access
In READ mode, The NCS signal pulse length is defined as:
NCS pulse length = (256 * NCS_RD_PULSE[6] + NCS_RD_PULSE[5:0]) clock cycles.
573
HSMC_CYCLEx [x=0..3]
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
NRD_CYCLE
23
22
21
20
19
18
17
16
11
10
8
NWE_CYCLE
NRD_CYCLE
15
14
13
12
4
NWE_CYCLE
This register can only be written if the WPEN bit is cleared in the HSMC Write Protection Mode Register.
NWE_CYCLE: Total Write Cycle Length
The total write cycle length is the total duration in clock cycles of the write cycle. It is equal to the sum of the setup, pulse
and hold steps of the NWE and NCS signals. It is defined as:
Write cycle length = (NWE_CYCLE[8:7] * 256) + NWE_CYCLE[6:0] clock cycles.
NRD_CYCLE: Total Read Cycle Length
The total read cycle length is the total duration in clock cycles of the read cycle. It is equal to the sum of the setup, pulse
and hold steps of the NRD and NCS signals. It is defined as:
Read cycle length = (NRD_CYCLE[8:7] * 256) + NRD_CYCLE[6:0] clock cycles.
574
HSMC_TIMINGSx [x=0..3]
Address:
Access:
Read/Write
31
NFSEL
30
29
RBNSEL
28
23
27
22
21
20
19
15
14
13
12
OCMS
11
26
25
24
17
16
TWB
18
TRR
10
TAR
2
TADL
TCLR
This register can only be written if the WPEN bit is cleared in the HSMC Write Protection Mode Register.
TCLR: CLE to REN Low Delay
Command Latch Enable falling edge to Read Enable falling edge timing.
Latch Enable Falling to Read Enable Falling = (TCLR[3] * 64) + TCLR[2:0] clock cycles.
TADL: ALE to Data Start
Last address latch cycle to the first rising edge of WEN for data input.
Last address latch to first rising edge of WEN = (TADL[3] * 64) + TADL[2:0] clock cycles.
TAR: ALE to REN Low Delay
Address Latch Enable falling edge to Read Enable falling edge timing.
Address Latch Enable to Read Enable = (TAR[3] * 64) + TAR[2:0] clock cycles.
OCMS: Off Chip Memory Scrambling Enable
When set to one, the memory scrambling is activated. (Value must be zero if external memory is NAND Flash and NFC is
used).
TRR: Ready to REN Low Delay
Ready/Busy signal to Read Enable falling edge timing.
Read to REN = (TRR[3] * 64) + TRR[2:0] clock cycles.
TWB: WEN High to REN to Busy
Write Enable rising edge to Ready/Busy falling edge timing.
Write Enable to Read/Busy = (TWB[3] * 64) + TWB[2:0] clock cycles.
RBNSEL: Ready/Busy Line Selection
This field indicates the selected Ready/Busy Line from the RBN bundle.
575
576
HSMC_MODEx [x=0..3]
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
TDF_MODE
19
18
17
TDF_CYCLES
16
15
14
13
12
DBW
11
10
EXNW_MODE
8
BAT
1
0
WRITE_MODE READ_MODE
This register can only be written if the WPEN bit is cleared in the HSMC Write Protection Mode Register.
READ_MODE: Selection of the Control Signal for Read Operation
Value
Name
Description
NCS_CTRL
NRD_CTRL
Name
Description
NCS_CTRL
NWE_CTRL
Name
Description
DISABLED
Reserved
FROZEN
Frozen ModeIf 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.
READY
Ready ModeThe 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.
577
Name
Description
Byte select access type:
BYTE_SELECT
BYTE_WRITE
Name
Description
BIT_8
8-bit bus
BIT_16
16-bit bus
578
HSMC_OCMS
Address:
0xFC05C6A0
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
1
SRSE
0
SMSE
579
HSMC_KEY1
Address:
0xFC05C6A4
Access:
Write-once
31
30
29
28
27
26
25
24
19
18
17
16
11
10
KEY1
23
22
21
20
KEY1
15
14
13
12
KEY1
4
KEY1
580
HSMC_KEY2
Address:
0xFC05C6A8
Access:
Write-once
31
30
29
28
27
26
25
24
19
18
17
16
11
10
KEY2
23
22
21
20
KEY2
15
14
13
12
KEY2
4
KEY2
581
HSMC_WPMR
Address:
0xFC05C6E4
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
0
WPEN
WPKEY
23
22
21
20
WPKEY
15
14
13
12
WPKEY
Name
Description
0x534D43
PASSWD
Writing any other value in this field aborts the write operation of bit WPEN.
Always reads as 0.
582
HSMC_WPSR
Address:
0xFC05C6E8
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
11
10
0
WPVS
WPVSRC
15
14
13
12
WPVSRC
583
31.
31.1
Description
The DMA Controller (XDMAC) is a AHB-protocol central direct memory access controller. It performs peripheral
data transfer and memory move operations over one or two bus ports through the unidirectional communication
channel. Each channel is fully programmable and provides both peripheral or memory to memory transfer. The
channel features are configurable at implementation time.
31.2
584
Embedded Characteristics
16 DMA Channels
48 Hardware Requests
Peripheral DMA Operation Runs on Bytes (8-bit), Half-Word (16-bit) and Word (32-bit)
Memory DMA Operation Runs on Bytes (8 bit), Half-Word (16-bit), Word (32-bit) and Double-Word (64-bit)
31.3
Block Diagram
Figure 31-1.
DMA
channel
Data
FIFO
Destination
FSM
APB Interface
Status
Registers
Source
FSM
Atmel
APB
Interface
Configuration
Registers
DMA
Read/Write
datapath
Control and Data
steering
request
arbiter
requests
pool
Hardware
Request
Interface
DMA
interrupt
Dual Master AHB interface
DMA
external
requests
DMA
Interrupt
DMA system
controller
585
31.4
Supports:
Linked List support with Status Write Back operation at End of Transfer
Peripheral to memory
Memory to peripheral
DMA Controller 0 manages the transfer between peripherals and memory and receives the triggers from the
peripherals listed in Table 31-1.
Table 31-1.
586
Instance Name
Channel Type
Interface Number
HSMCI0
Receive/Transmit
HSMCI1
Receive/Transmit
TWI0
Transmit
TWI0
Receive
TWI1
Transmit
TWI1
Receive
TWI2
Transmit
TWI2
Receive
TWI3
Transmit
TWI3
Receive
SPI0
Transmit
10
SPI0
Receive
11
SPI1
Transmit
12
SPI1
Receive
13
SPI2
Transmit
14
SPI2
Receive
15
USART2
Transmit
16
USART2
Receive
17
USART3
Transmit
18
USART3
Receive
19
USART4
Transmit
20
USART4
Receive
21
Table 31-1.
Instance Name
Channel Type
Interface Number
UART0
Transmit
22
UART0
Receive
23
UART1
Transmit
24
UART1
Receive
25
SSC0
Transmit
26
SSC0
Receive
27
SSC1
Transmit
28
SSC1
Receive
29
DBGU
Transmit
30
DBGU
Receive
31
ADC
Receive
32
SMD
Transmit
33
SMD
Receive
34
USART0
Transmit
36
USART0
Receive
37
USART1
Transmit
38
USART1
Receive
39
AES
Receive
40
AES
Transmit
41
TDES
Transmit
42
TDES
Receive
43
SHA
Transmit
44
Supports:
Linked List support with Status Write Back operation at End of Transfer
Peripheral to memory
Memory to peripheral
DMA Controller 1 manages the transfer between peripherals and memory and receives the triggers from the
peripherals listed in Table 31-2.
Table 31-2.
Instance Name
Channel Type
Interface Number
HSMCI0
Receive/Transmit
587
Table 31-2.
588
Instance Name
Channel Type
Interface Number
HSMCI1
Receive/Transmit
TWI0
Transmit
TWI0
Receive
TWI1
Transmit
TWI1
Receive
TWI2
Transmit
TWI2
Receive
TWI3
Transmit
TWI3
Receive
SPI0
Transmit
10
SPI0
Receive
11
SPI1
Transmit
12
SPI1
Receive
13
SPI2
Transmit
14
SPI2
Receive
15
USART2
Transmit
16
USART2
Receive
17
USART3
Transmit
18
USART3
Receive
19
USART4
Transmit
20
USART4
Receive
21
UART0
Transmit
22
UART0
Receive
23
UART1
Transmit
24
UART1
Receive
25
SSC0
Transmit
26
SSC0
Receive
27
SSC1
Transmit
28
SSC1
Receive
29
DBGU
Transmit
30
DBGU
Receive
31
ADC
Receive
32
SMD
Transmit
33
SMD
Receive
34
31.5
Functional Description
589
Figure 31-2.
Master Transfer
BLK0
BLK0
MB0
MB(p-1)
Figure 31-3.
BLK1
iMB
BLK1
BLK(M-1)
BLK(N-1)
Block Level
Master Transfer
BLK0
BLK0
CHK0
CHK(p-1)
BLK1
iCHK
BLK1
BLK(M-1)
BLK(N-1)
Block Level
Chunk Level
590
The Peripheral hardware request can be software controlled using the SWREQ field of the XDMAC Global
Channel Software Request Register (XDMAC_GSWR). The peripheral synchronized transfer is paced using a
processor write access in the XDMAC_GSWR. Each bit of that register triggers a transfer request. The XDMAC
Global Channel Software Request Status Register (XDMAC_GSWS) indicates the status of the request; when set,
the request is still pending.
31.5.4 XDMAC Transfer Software Operation
31.5.4.1 Single Block With Single Microblock Transfer
1. Read the XDMAC Global Channel Status Register (XDMAC_GS) to choose a free channel.
2.
Clear the pending Interrupt Status bit(s) by reading the chosen XDMAC Channel x Interrupt Status Register
(XDMAC_CISx).
3.
Write the XDMAC Channel x Source Address Register (XDMAC_CSAx) for channel x.
4.
Write the XDMAC Channel x Destination Address Register (XDMAC_CDAx) for channel x.
5.
Program field UBLEN in the XDMAC Channel x Microblock Control Register (XDMAC_CUBCx) with the
number of data.
6.
c.
Program XDMAC_CCx.CSIZE to configure the channel chunk size (only relevant for peripheral synchronized transfer).
Program XDMAC_CCx.PERID to select the active hardware request line (only relevant for a peripheral synchronized transfer).
j.
Set XDMAC_CCx.SWREQ to use software request (only relevant for a peripheral synchronized
transfer).
7.
8.
Enable the Microblock interrupt by writing a 1 to bit BIE in the XDMAC Channel x Interrupt Enable Register
(XDMAC_CIEx), enable the Channel x Interrupt Enable bit by writing a 1 to bit IEx in the XDMAC Global
Interrupt Enable Register (XDMAC_GIE).
9.
Enable channel x by writing a 1 to bit ENx in the XDMAC Global Channel Enable Register (XDMAC_GE).
XDMAC_GS.STx (XDMAC Channel x Status bit) is set by hardware.
10. Once completed, the DMA channel sets XDMAC_CISx.BIS (End of Block Interrupt Status bit) and generates
an interrupt. XDMAC_GS.STx is cleared by hardware. The software can either wait for an interrupt or poll
the channel status bit.
591
Clear the pending Interrupt Status bit by reading the chosen XDMAC_CISx register.
3.
4.
5.
6.
7.
8.
9.
Enable the Block interrupt by writing a 1 to XDMAC_CIEx.BIE, enable the Channel x Interrupt Enable bit by
writing a 1 to XDMAC_GIEx.IEx.
Clear the pending Interrupt Status bit by reading the chosen XDMAC_CISx register.
3.
Build a linked list of transfer descriptors in memory. The descriptor view is programmable on a per descriptor
basis. The linked list items structure must be word aligned. MBR_UBC.NDE must be configured to 0 in the
last descriptor to terminate the list.
4.
Program field NDA in the XDMAC Channel x Next Descriptor Address Register (XDMAC_CNDAx) with the
first descriptor address and bit XDMAC_CNDAx.NDAIF with the master interface identifier.
5.
Set XDMAC_CNDCx.NDSUP to update the source address at the descriptor fetch time, otherwise
clear this bit.
c.
Set XDMAC_CNDCx.NDDUP to update the destination address at the descriptor fetch time, otherwise clear this bit.
7.
8.
Once completed, the DMA channel sets XDMAC_CISx.BIS (End of Block Interrupt Status bit) and generates
an interrupt. XDMAC_GS.STx is cleared by hardware. The software can either wait for an interrupt or poll
the channel status bit.
Under normal operation, the software enables a channel by writing a 1 to XDMAC_GE.ENx (Global Channel x
Enable Register bit), then the hardware disables a channel on transfer completion by clearing bit
XDMAC_GS.STx. To disable a channel, write a 1 to bit XDMAC_GD.DIx and poll the XDMAC_GS register.
592
31.6
View 0 Structure
View 1 Structure
View 2 Structure
View 3 Structure
Offset
Structure member
Name
DSCR_ADDR+0x00
MBR_NDA
DSCR_ADDR+0x04
MBR_UBC
DSCR_ADDR+0x08
MBR_TA
DSCR_ADDR+0x00
MBR_NDA
DSCR_ADDR+0x04
MBR_UBC
DSCR_ADDR+0x08
MBR_SA
DSCR_ADDR+0x0C
MBR_DA
DSCR_ADDR+0x00
MBR_NDA
DSCR_ADDR+0x04
MBR_UBC
DSCR_ADDR+0x08
MBR_SA
DSCR_ADDR+0x0C
MBR_DA
DSCR_ADDR+0x10
Configuration Register
MBR_CFG
DSCR_ADDR+0x00
MBR_NDA
DSCR_ADDR+0x04
MBR_UBC
DSCR_ADDR+0x08
MBR_SA
DSCR_ADDR+0x0C
MBR_DA
DSCR_ADDR+0x10
Configuration Member
MBR_CFG
DSCR_ADDR+0x14
MBR_BC
DSCR_ADDR+0x18
MBR_DS
DSCR_ADDR+0x1C
MBR_SUS
DSCR_ADDR+0x20
MBR_DUS
593
Name:
MBR_UBC
Access:
Read-only
31
30
29
28
23
22
21
20
27
26
NDEN
25
NSEN
24
NDE
19
18
17
16
11
10
NVIEW
UBLEN
15
14
13
12
UBLEN
4
UBLEN
Name
Description
00
NDV0
01
NDV1
10
NDV2
11
NDV3
594
31.7
When a disable request occurs on a suspended channel, the XDMAC_GWS.WSx (Channel x Write
Suspend bit) is cleared. If the transfer is source peripheral synchronized, the pending bytes are drained to
memory. The bit XDMAC_CISx.DIS is set.
When a disable request follows a flush request, if the flush last transaction is not yet scheduled, the flush
request is discarded and the disable procedure is applied. The bit XDMAC_CISx.FIS is not set. Bit
XDMAC_CISx.DIS will be set when the disable request is completed. If the flush request transaction is
already scheduled, the XDMAC_CISx.FIS will be set. XDMAC_CISx.DIS will also be set when the disable
request is completed.
When a flush request occurs on a suspended channel, if there are pending bytes in the FIFO, they are
written out to memory, XDMAC_CISx.FIS is set. If the FIFO is empty, XDMAC_CISx.FIS is also set.
If the flush operation is performed after a disable request, the flush command is ignored. XDMAC_CISx.FIS
is not set.
If the suspend operation is performed after a disable request, the write suspend operation is ignored.
595
31.8
596
Write operations to channel registers are not be performed in an active channel after the channel is enabled.
If any channel parameters must be reprogrammed, this can only be done after disabling the XDMAC
channel.
XDMAC_CSAx and XDMAC_CDAx channel registers are to be programmed with a byte, half-word, word or
double-word aligned address depending on the Channel x Data Width field (DWIDTH) of the XDMAC
Channel x Configuration Register.
31.9
Table 31-4.
Register Mapping
Offset
Register
Name
Access
Reset
0x00
XDMAC_GTYPE
Read/Write
0x00000000
0x04
XDMAC_GCFG
Read-only
0x00000000
0x08
XDMAC_GWAC
Read/Write
0x00000000
0x0C
XDMAC_GIE
Write-only
0x10
XDMAC_GID
Write-only
0x14
XDMAC_GIM
Read-only
0x00000000
0x18
XDMAC_GIS
Read-only
0x00000000
0x1C
XDMAC_GE
Write-only
0x20
XDMAC_GD
Write-only
0x24
XDMAC_GS
Read-only
0x00000000
0x28
XDMAC_GRS
Read/Write
0x00000000
0x2C
XDMAC_GWS
Read/Write
0x00000000
0x30
XDMAC_GRWS
Write-only
0x34
XDMAC_GRWR
Write-only
0x38
XDMAC_GSWR
Write-only
0x3C
XDMAC_GSWS
Read-only
0x00000000
0x40
XDMAC_GSWF
Write-only
0x440x4C
Reserved
0x50+chid*0x40
XDMAC_CIE
Write-only
0x54+chid*0x40
XDMAC_CID
Write-only
0x58+chid*0x40
XDMAC_CIM
Write-only
0x5C+chid*0x40
XDMAC_CIS
Read-only
0x00000000
0x60+chid*0x40
XDMAC_CSA
Read/Write
0x00000000
0x64+chid*0x40
XDMAC_CDA
Read/Write
0x00000000
0x68+chid*0x40
XDMAC_CNDA
Read/Write
0x00000000
0x6C+chid*0x40
XDMAC_CNDC
Read/Write
0x00000000
0x70+chid*0x40
XDMAC_CUBC
Read/Write
0x00000000
0x74+chid*0x40
XDMAC_CBC
Read/Write
0x00000000
0x78+chid*0x40
XDMAC_CC
Read/Write
0x00000000
0x7C+chid*0x40
XDMAC_CDS_MSP
Read/Write
0x00000000
0x80+chid*0x40
XDMAC_CSUS
Read/Write
0x00000000
0x84+chid*0x40
XDMAC_CDUS
Read/Write
0x00000000
0x88+chid*0x40
Reserved
0x8C+chid*0x40
Reserved
0xFEC0xFFC
Reserved
597
XDMAC_GTYPE
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
NB_REQ
18
17
16
15
14
13
12
11
10
2
NB_CH
FIFO_SZ
7
6
FIFO_SZ
598
XDMAC_GCFG
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
8
BXKBEN
CGDISIF
CGDISFIFO
1
CGDISPIPE
CGDISREG
599
XDMAC_GWAC
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
PW3
7
PW2
5
PW1
2
PW0
600
XDMAC_GIE
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
IE15
14
IE14
13
IE13
12
IE12
11
IE11
10
IE10
9
IE9
8
IE8
7
IE7
6
IE6
5
IE5
4
IE4
3
IE3
2
IE2
1
IE1
0
IE0
601
XDMAC_GID
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
ID15
14
ID14
13
ID13
12
ID12
11
ID11
10
ID10
9
ID9
8
ID8
7
ID7
6
ID6
5
ID5
4
ID4
3
ID3
2
ID2
1
ID1
0
ID0
602
XDMAC_GIM
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
IM15
14
IM14
13
IM13
12
IM12
11
IM11
10
IM10
9
IM9
8
IM8
7
IM7
6
IM6
5
IM5
4
IM4
3
IM3
2
IM2
1
IM1
0
IM0
603
XDMAC_GIS
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
IS15
14
IS14
13
IS13
12
IS12
11
IS11
10
IS10
9
IS9
8
IS8
7
IS7
6
IS6
5
IS5
4
IS4
3
IS3
2
IS2
1
IS1
0
IS0
604
XDMAC_GE
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
EN15
14
EN14
13
EN13
12
EN12
11
EN11
10
EN10
9
EN9
8
EN8
7
EN7
6
EN6
5
EN5
4
EN4
3
EN3
2
EN2
1
EN1
0
EN0
605
XDMAC_GD
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
DI15
14
DI14
13
DI13
12
DI12
11
DI11
10
DI10
9
DI9
8
DI8
7
DI7
6
DI6
5
DI5
4
DI4
3
DI3
2
DI2
1
DI1
0
DI0
606
XDMAC_GS
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
ST15
14
ST14
13
ST13
12
ST12
11
ST11
10
ST10
9
ST9
8
ST8
7
ST7
6
ST6
5
ST5
4
ST4
3
ST3
2
ST2
1
ST1
0
ST0
607
XDMAC_GRS
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
RS15
14
RS14
13
RS13
12
RS12
11
RS11
10
RS10
9
RS9
8
RS8
7
RS7
6
RS6
5
RS5
4
RS4
3
RS3
2
RS2
1
RS1
0
RS0
608
XDMAC_GWS
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
WS15
14
WS14
13
WS13
12
WS12
11
WS11
10
WS10
9
WS9
8
WS8
7
WS7
6
WS6
5
WS5
4
WS4
3
WS3
2
WS2
1
WS1
0
WS0
609
XDMAC_GRWS
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
RWS15
14
RWS14
13
RWS13
12
RWS12
11
RWS11
10
RWS10
9
RWS9
8
RWS8
7
RWS7
6
RWS6
5
RWS5
4
RWS4
3
RWS3
2
RWS2
1
RWS1
0
RWS0
610
XDMAC_GRWR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
RWR15
14
RWR14
13
RWR13
12
RWR12
11
RWR11
10
RWR10
9
RWR9
8
RWR8
7
RWR7
6
RWR6
5
RWR5
4
RWR4
3
RWR3
2
RWR2
1
RWR1
0
RWR0
611
XDMAC_GSWR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
SWREQ15
14
SWREQ14
13
SWREQ13
12
SWREQ12
11
SWREQ11
10
SWREQ10
9
SWREQ9
8
SWREQ8
7
SWREQ7
6
SWREQ6
5
SWREQ5
4
SWREQ4
3
SWREQ3
2
SWREQ2
1
SWREQ1
0
SWREQ0
612
XDMAC_GSWS
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
-
21
20
19
18
17
16
15
SWRS15
14
SWRS14
13
SWRS13
12
SWRS12
11
SWRS11
10
SWRS10
9
SWRS9
8
SWRS8
7
SWRS7
6
SWRS6
5
SWRS5
4
SWRS4
3
SWRS3
2
SWRS2
1
SWRS1
0
SWRS0
613
XDMAC_GSWF
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
SWF15
14
SWF14
13
SWF13
12
SWF12
11
SWF11
10
SWF10
9
SWF9
8
SWF8
7
SWF7
6
SWF6
5
SWF5
4
SWF4
3
SWF3
2
SWF2
1
SWF1
0
SWF0
614
XDMAC_CIEx [x = 0..15]
Address:
0xF0004050 (1)[0], 0xF0004090 (1)[1], 0xF00040D0 (1)[2], 0xF0004110 (1)[3], 0xF0004150 (1)[4],
0xF0004190 (1)[5], 0xF00041D0 (1)[6], 0xF0004210 (1)[7], 0xF0004250 (1)[8], 0xF0004290 (1)[9], 0xF00042D0 (1)[10],
0xF0004310 (1)[11], 0xF0004350 (1)[12], 0xF0004390 (1)[13], 0xF00043D0 (1)[14], 0xF0004410 (1)[15], 0xF0014050
(0)[0], 0xF0014090 (0)[1], 0xF00140D0 (0)[2], 0xF0014110 (0)[3], 0xF0014150 (0)[4], 0xF0014190 (0)[5], 0xF00141D0
(0)[6], 0xF0014210 (0)[7], 0xF0014250 (0)[8], 0xF0014290 (0)[9], 0xF00142D0 (0)[10], 0xF0014310 (0)[11], 0xF0014350
(0)[12], 0xF0014390 (0)[13], 0xF00143D0 (0)[14], 0xF0014410 (0)[15]
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
6
ROIE
5
WBIE
4
RBIE
3
FIE
2
DIE
1
LIE
0
BIE
615
616
XDMAC_CIDx [x = 0..15]
Address:
0xF0004054 (1)[0], 0xF0004094 (1)[1], 0xF00040D4 (1)[2], 0xF0004114 (1)[3], 0xF0004154 (1)[4],
0xF0004194 (1)[5], 0xF00041D4 (1)[6], 0xF0004214 (1)[7], 0xF0004254 (1)[8], 0xF0004294 (1)[9], 0xF00042D4 (1)[10],
0xF0004314 (1)[11], 0xF0004354 (1)[12], 0xF0004394 (1)[13], 0xF00043D4 (1)[14], 0xF0004414 (1)[15], 0xF0014054
(0)[0], 0xF0014094 (0)[1], 0xF00140D4 (0)[2], 0xF0014114 (0)[3], 0xF0014154 (0)[4], 0xF0014194 (0)[5], 0xF00141D4
(0)[6], 0xF0014214 (0)[7], 0xF0014254 (0)[8], 0xF0014294 (0)[9], 0xF00142D4 (0)[10], 0xF0014314 (0)[11], 0xF0014354
(0)[12], 0xF0014394 (0)[13], 0xF00143D4 (0)[14], 0xF0014414 (0)[15]
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
6
ROID
5
WBEID
4
RBEID
3
FID
2
DID
1
LID
0
BID
617
618
XDMAC_CIMx [x = 0..15]
Address:
0xF0004058 (1)[0], 0xF0004098 (1)[1], 0xF00040D8 (1)[2], 0xF0004118 (1)[3], 0xF0004158 (1)[4],
0xF0004198 (1)[5], 0xF00041D8 (1)[6], 0xF0004218 (1)[7], 0xF0004258 (1)[8], 0xF0004298 (1)[9], 0xF00042D8 (1)[10],
0xF0004318 (1)[11], 0xF0004358 (1)[12], 0xF0004398 (1)[13], 0xF00043D8 (1)[14], 0xF0004418 (1)[15], 0xF0014058
(0)[0], 0xF0014098 (0)[1], 0xF00140D8 (0)[2], 0xF0014118 (0)[3], 0xF0014158 (0)[4], 0xF0014198 (0)[5], 0xF00141D8
(0)[6], 0xF0014218 (0)[7], 0xF0014258 (0)[8], 0xF0014298 (0)[9], 0xF00142D8 (0)[10], 0xF0014318 (0)[11], 0xF0014358
(0)[12], 0xF0014398 (0)[13], 0xF00143D8 (0)[14], 0xF0014418 (0)[15]
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
6
ROIM
5
WBEIM
4
RBEIM
3
FIM
2
DIM
1
LIM
0
BIM
619
620
XDMAC_CISx [x = 0..15]
Address:
0xF000405C (1)[0], 0xF000409C (1)[1], 0xF00040DC (1)[2], 0xF000411C (1)[3], 0xF000415C (1)[4],
0xF000419C (1)[5], 0xF00041DC (1)[6], 0xF000421C (1)[7], 0xF000425C (1)[8], 0xF000429C (1)[9], 0xF00042DC (1)[10],
0xF000431C (1)[11], 0xF000435C (1)[12], 0xF000439C (1)[13], 0xF00043DC (1)[14], 0xF000441C (1)[15], 0xF001405C
(0)[0], 0xF001409C (0)[1], 0xF00140DC (0)[2], 0xF001411C (0)[3], 0xF001415C (0)[4], 0xF001419C (0)[5], 0xF00141DC
(0)[6], 0xF001421C (0)[7], 0xF001425C (0)[8], 0xF001429C (0)[9], 0xF00142DC (0)[10], 0xF001431C (0)[11],
0xF001435C (0)[12], 0xF001439C (0)[13], 0xF00143DC (0)[14], 0xF001441C (0)[15]
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
6
ROIS
5
WBEIS
4
RBEIS
3
FIS
2
DIS
1
LIS
0
BIS
621
622
XDMAC_CSAx [x = 0..15]
Address:
0xF0004060 (1)[0], 0xF00040A0 (1)[1], 0xF00040E0 (1)[2], 0xF0004120 (1)[3], 0xF0004160 (1)[4],
0xF00041A0 (1)[5], 0xF00041E0 (1)[6], 0xF0004220 (1)[7], 0xF0004260 (1)[8], 0xF00042A0 (1)[9], 0xF00042E0 (1)[10],
0xF0004320 (1)[11], 0xF0004360 (1)[12], 0xF00043A0 (1)[13], 0xF00043E0 (1)[14], 0xF0004420 (1)[15], 0xF0014060
(0)[0], 0xF00140A0 (0)[1], 0xF00140E0 (0)[2], 0xF0014120 (0)[3], 0xF0014160 (0)[4], 0xF00141A0 (0)[5], 0xF00141E0
(0)[6], 0xF0014220 (0)[7], 0xF0014260 (0)[8], 0xF00142A0 (0)[9], 0xF00142E0 (0)[10], 0xF0014320 (0)[11], 0xF0014360
(0)[12], 0xF00143A0 (0)[13], 0xF00143E0 (0)[14], 0xF0014420 (0)[15]
Access:
31
Read/Write
30
29
28
27
26
25
24
19
18
17
16
11
10
SA
23
22
21
20
SA
15
14
13
12
SA
4
SA
623
XDMAC_CDAx [x = 0..15]
Address:
0xF0004064 (1)[0], 0xF00040A4 (1)[1], 0xF00040E4 (1)[2], 0xF0004124 (1)[3], 0xF0004164 (1)[4],
0xF00041A4 (1)[5], 0xF00041E4 (1)[6], 0xF0004224 (1)[7], 0xF0004264 (1)[8], 0xF00042A4 (1)[9], 0xF00042E4 (1)[10],
0xF0004324 (1)[11], 0xF0004364 (1)[12], 0xF00043A4 (1)[13], 0xF00043E4 (1)[14], 0xF0004424 (1)[15], 0xF0014064
(0)[0], 0xF00140A4 (0)[1], 0xF00140E4 (0)[2], 0xF0014124 (0)[3], 0xF0014164 (0)[4], 0xF00141A4 (0)[5], 0xF00141E4
(0)[6], 0xF0014224 (0)[7], 0xF0014264 (0)[8], 0xF00142A4 (0)[9], 0xF00142E4 (0)[10], 0xF0014324 (0)[11], 0xF0014364
(0)[12], 0xF00143A4 (0)[13], 0xF00143E4 (0)[14], 0xF0014424 (0)[15]
Access:
31
Read/Write
30
29
28
27
26
25
24
19
18
17
16
11
10
DA
23
22
21
20
DA
15
14
13
12
DA
4
DA
624
XDMAC_CNDAx [x = 0..15]
Address:
0xF0004068 (1)[0], 0xF00040A8 (1)[1], 0xF00040E8 (1)[2], 0xF0004128 (1)[3], 0xF0004168 (1)[4],
0xF00041A8 (1)[5], 0xF00041E8 (1)[6], 0xF0004228 (1)[7], 0xF0004268 (1)[8], 0xF00042A8 (1)[9], 0xF00042E8 (1)[10],
0xF0004328 (1)[11], 0xF0004368 (1)[12], 0xF00043A8 (1)[13], 0xF00043E8 (1)[14], 0xF0004428 (1)[15], 0xF0014068
(0)[0], 0xF00140A8 (0)[1], 0xF00140E8 (0)[2], 0xF0014128 (0)[3], 0xF0014168 (0)[4], 0xF00141A8 (0)[5], 0xF00141E8
(0)[6], 0xF0014228 (0)[7], 0xF0014268 (0)[8], 0xF00142A8 (0)[9], 0xF00142E8 (0)[10], 0xF0014328 (0)[11], 0xF0014368
(0)[12], 0xF00143A8 (0)[13], 0xF00143E8 (0)[14], 0xF0014428 (0)[15]
Access:
31
Read/Write
30
29
28
27
26
25
24
19
18
17
16
11
10
0
NDAIF
NDA
23
22
21
20
NDA
15
14
13
12
NDA
4
NDA
625
XDMAC_CNDCx [x = 0..15]
Address:
0xF000406C (1)[0], 0xF00040AC (1)[1], 0xF00040EC (1)[2], 0xF000412C (1)[3], 0xF000416C (1)[4],
0xF00041AC (1)[5], 0xF00041EC (1)[6], 0xF000422C (1)[7], 0xF000426C (1)[8], 0xF00042AC (1)[9], 0xF00042EC (1)[10],
0xF000432C (1)[11], 0xF000436C (1)[12], 0xF00043AC (1)[13], 0xF00043EC (1)[14], 0xF000442C (1)[15], 0xF001406C
(0)[0], 0xF00140AC (0)[1], 0xF00140EC (0)[2], 0xF001412C (0)[3], 0xF001416C (0)[4], 0xF00141AC (0)[5], 0xF00141EC
(0)[6], 0xF001422C (0)[7], 0xF001426C (0)[8], 0xF00142AC (0)[9], 0xF00142EC (0)[10], 0xF001432C (0)[11],
0xF001436C (0)[12], 0xF00143AC (0)[13], 0xF00143EC (0)[14], 0xF001442C (0)[15]
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
2
NDDUP
1
NDSUP
0
NDE
NDVIEW
Name
Description
00
NDV0
01
NDV1
10
NDV2
11
NDV3
626
XDMAC_CUBCx [x = 0..15]
Address:
0xF0004070 (1)[0], 0xF00040B0 (1)[1], 0xF00040F0 (1)[2], 0xF0004130 (1)[3], 0xF0004170 (1)[4],
0xF00041B0 (1)[5], 0xF00041F0 (1)[6], 0xF0004230 (1)[7], 0xF0004270 (1)[8], 0xF00042B0 (1)[9], 0xF00042F0 (1)[10],
0xF0004330 (1)[11], 0xF0004370 (1)[12], 0xF00043B0 (1)[13], 0xF00043F0 (1)[14], 0xF0004430 (1)[15], 0xF0014070
(0)[0], 0xF00140B0 (0)[1], 0xF00140F0 (0)[2], 0xF0014130 (0)[3], 0xF0014170 (0)[4], 0xF00141B0 (0)[5], 0xF00141F0
(0)[6], 0xF0014230 (0)[7], 0xF0014270 (0)[8], 0xF00142B0 (0)[9], 0xF00142F0 (0)[10], 0xF0014330 (0)[11], 0xF0014370
(0)[12], 0xF00143B0 (0)[13], 0xF00143F0 (0)[14], 0xF0014430 (0)[15]
Access:
Read/Write
31
30
29
28
23
22
21
20
27
26
25
24
19
18
17
16
11
10
UBLEN
15
14
13
12
UBLEN
4
UBLEN
627
XDMAC_CBCx [x = 0..15]
Address:
0xF0004074 (1)[0], 0xF00040B4 (1)[1], 0xF00040F4 (1)[2], 0xF0004134 (1)[3], 0xF0004174 (1)[4],
0xF00041B4 (1)[5], 0xF00041F4 (1)[6], 0xF0004234 (1)[7], 0xF0004274 (1)[8], 0xF00042B4 (1)[9], 0xF00042F4 (1)[10],
0xF0004334 (1)[11], 0xF0004374 (1)[12], 0xF00043B4 (1)[13], 0xF00043F4 (1)[14], 0xF0004434 (1)[15], 0xF0014074
(0)[0], 0xF00140B4 (0)[1], 0xF00140F4 (0)[2], 0xF0014134 (0)[3], 0xF0014174 (0)[4], 0xF00141B4 (0)[5], 0xF00141F4
(0)[6], 0xF0014234 (0)[7], 0xF0014274 (0)[8], 0xF00142B4 (0)[9], 0xF00142F4 (0)[10], 0xF0014334 (0)[11], 0xF0014374
(0)[12], 0xF00143B4 (0)[13], 0xF00143F4 (0)[14], 0xF0014434 (0)[15]
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
BLEN
3
BLEN
628
XDMAC_CCx[x = 0..15]
Address:
0xF0004078 (1)[0], 0xF00040B8 (1)[1], 0xF00040F8 (1)[2], 0xF0004138 (1)[3], 0xF0004178 (1)[4],
0xF00041B8 (1)[5], 0xF00041F8 (1)[6], 0xF0004238 (1)[7], 0xF0004278 (1)[8], 0xF00042B8 (1)[9], 0xF00042F8 (1)[10],
0xF0004338 (1)[11], 0xF0004378 (1)[12], 0xF00043B8 (1)[13], 0xF00043F8 (1)[14], 0xF0004438 (1)[15], 0xF0014078
(0)[0], 0xF00140B8 (0)[1], 0xF00140F8 (0)[2], 0xF0014138 (0)[3], 0xF0014178 (0)[4], 0xF00141B8 (0)[5], 0xF00141F8
(0)[6], 0xF0014238 (0)[7], 0xF0014278 (0)[8], 0xF00142B8 (0)[9], 0xF00142F8 (0)[10], 0xF0014338 (0)[11], 0xF0014378
(0)[12], 0xF00143B8 (0)[13], 0xF00143F8 (0)[14], 0xF0014438 (0)[15]
Access:
Read/Write
31
30
29
28
27
PERID
26
25
23
WRIP
22
RDIP
21
INITD
20
19
18
17
15
14
DIF
13
SIF
12
11
10
7
MEMSET
6
SWREQ
5
PROT
4
DSYNC
DAM
24
16
SAM
DWIDTH
9
CSIZE
0
TYPE
MBSIZE
Name
Description
00
SINGLE
01
FOUR
10
EIGHT
11
SIXTEEN
629
Name
Description
000
CHK_1
1 data transferred
001
CHK_2
2 data transferred
010
CHK_4
4 data transferred
011
CHK_8
8 data transferred
100
CHK_16
16 data transferred
Name
Description
00
BYTE
01
HALFWORD
10
WORD
11
DWORD
Name
Description
00
FIXED_AM
01
INCREMENTED_AM
The addressing mode is incremented (the increment size is set to the data size).
10
UBS_AM
11
UBS_DS_AM
The microblock stride is added at the microblock boundary, the data stride is added at the data
boundary.
Name
Description
00
FIXED_AM
01
INCREMENTED_AM
The addressing mode is incremented (the increment size is set to the data size).
10
UBS_AM
11
UBS_DS_AM
The microblock stride is added at the microblock boundary, the data stride is added at the data
boundary.
630
631
31.9.29 XDMAC Channel x [x = 0..15] Data Stride Memory Set Pattern Register
Name:
XDMAC_CDS_MSPx [x = 0..15]
Address:
0xF000407C (1)[0], 0xF00040BC (1)[1], 0xF00040FC (1)[2], 0xF000413C (1)[3], 0xF000417C (1)[4],
0xF00041BC (1)[5], 0xF00041FC (1)[6], 0xF000423C (1)[7], 0xF000427C (1)[8], 0xF00042BC (1)[9], 0xF00042FC (1)[10],
0xF000433C (1)[11], 0xF000437C (1)[12], 0xF00043BC (1)[13], 0xF00043FC (1)[14], 0xF000443C (1)[15], 0xF001407C
(0)[0], 0xF00140BC (0)[1], 0xF00140FC (0)[2], 0xF001413C (0)[3], 0xF001417C (0)[4], 0xF00141BC (0)[5], 0xF00141FC
(0)[6], 0xF001423C (0)[7], 0xF001427C (0)[8], 0xF00142BC (0)[9], 0xF00142FC (0)[10], 0xF001433C (0)[11],
0xF001437C (0)[12], 0xF00143BC (0)[13], 0xF00143FC (0)[14], 0xF001443C (0)[15]
Access:
31
Read/Write
30
29
28
27
26
25
24
19
18
17
16
11
10
DDS_MSP
23
22
21
20
DDS_MSP
15
14
13
12
SDS_MSP
4
SDS_MSP
632
XDMAC_CSUSx [x = 0..15]
Address:
0xF0004080 (1)[0], 0xF00040C0 (1)[1], 0xF0004100 (1)[2], 0xF0004140 (1)[3], 0xF0004180 (1)[4],
0xF00041C0 (1)[5], 0xF0004200 (1)[6], 0xF0004240 (1)[7], 0xF0004280 (1)[8], 0xF00042C0 (1)[9], 0xF0004300 (1)[10],
0xF0004340 (1)[11], 0xF0004380 (1)[12], 0xF00043C0 (1)[13], 0xF0004400 (1)[14], 0xF0004440 (1)[15], 0xF0014080
(0)[0], 0xF00140C0 (0)[1], 0xF0014100 (0)[2], 0xF0014140 (0)[3], 0xF0014180 (0)[4], 0xF00141C0 (0)[5], 0xF0014200
(0)[6], 0xF0014240 (0)[7], 0xF0014280 (0)[8], 0xF00142C0 (0)[9], 0xF0014300 (0)[10], 0xF0014340 (0)[11], 0xF0014380
(0)[12], 0xF00143C0 (0)[13], 0xF0014400 (0)[14], 0xF0014440 (0)[15]
Access:
Read/Write
31
30
29
28
23
22
21
20
27
26
25
24
19
18
17
16
11
10
SUBS
15
14
13
12
SUBS
4
SUBS
633
XDMAC_CDUSx [x = 0..15]
Address:
0xF0004084 (1)[0], 0xF00040C4 (1)[1], 0xF0004104 (1)[2], 0xF0004144 (1)[3], 0xF0004184 (1)[4],
0xF00041C4 (1)[5], 0xF0004204 (1)[6], 0xF0004244 (1)[7], 0xF0004284 (1)[8], 0xF00042C4 (1)[9], 0xF0004304 (1)[10],
0xF0004344 (1)[11], 0xF0004384 (1)[12], 0xF00043C4 (1)[13], 0xF0004404 (1)[14], 0xF0004444 (1)[15], 0xF0014084
(0)[0], 0xF00140C4 (0)[1], 0xF0014104 (0)[2], 0xF0014144 (0)[3], 0xF0014184 (0)[4], 0xF00141C4 (0)[5], 0xF0014204
(0)[6], 0xF0014244 (0)[7], 0xF0014284 (0)[8], 0xF00142C4 (0)[9], 0xF0014304 (0)[10], 0xF0014344 (0)[11], 0xF0014384
(0)[12], 0xF00143C4 (0)[13], 0xF0014404 (0)[14], 0xF0014444 (0)[15]
Access:
Read/Write
31
30
29
28
23
22
21
20
27
26
25
24
19
18
17
16
11
10
DUBS
15
14
13
12
DUBS
4
DUBS
634
32.
32.1
Description
The LCD Controller (LCDC) consists of logic for transferring LCD image data from an external display buffer to an
LCD module. The LCD has one display input buffer per overlay that fetches pixels through the dual AHB master
interface and a lookup table to allow palletized display configurations. The LCD controller is programmable on a
per overlay basis, and supports different LCD resolutions, window sizes, image formats and pixel depths.
The LCD is connected to the ARM Advanced High Performance Bus (AHB) as a master for reading pixel data. It
also integrates an APB interface to configure its registers.
32.2
Embedded Characteristics
Supports 12-, 16-, 18- and 24-bit Output Mode through the Spatial Dithering Unit
12, 16, 18, 19, 24, 25 and 32 bits per pixel (non-palletized)
Color Lookup Table with up to 256 entries and Predefined 8-bit Alpha
Programmable Negative and Positive Pixel Striding for all Overlay1, Overlay2 and HEO layers
High End Overlay supports 4:2:0 Planar Mode and Semiplanar Mode
High End Overlay supports 4:2:2 Planar Mode, Semiplanar Mode and Packed
Horizontal and Vertical Rescaling unit with Edge Interpolation and Independent Non-Integer Ratio, up to
1024x768
Overlay1, Overlay2 and High End Overlay Integrate Rotation Engine: 90, 180, 270, up to 1024x768
Blender Function Supports Arbitrary 8-bit Alpha Value and Chroma Keying
DMA User interface uses Linked List Structure and Add-to-queue Structure
635
32.3
Block Diagram
Figure 32-1.
Block Diagram
32-bit
APB Interface
Configuration
Registers
SYSCTRL
Unit
OVR2
Layer
ROT
CLUT
AHB
Bus
OVR1
Layer
ROT
CLUT
64-bit
Dual
AHB
Master
Interface
LCD_DAT[23:0]
DEAG
Unit
LCD_VSYNC
HEO
Layer
ROT
LCD_HSYNC
CSC
2DSC
CUE
CLUT
GAB
Unit
LTE
Unit
LCD_PCLK
LCD_DEN
LCD_PWM
Base
Layer
LCD_DISP
CLUT
636
32.4
Name
Description
LCD_PWM
32.5
32.5.1
Type
Output
LCD_HSYNC
Output
LCD_VSYNC
Output
LCD_DAT[23:0]
Output
LCD_DEN
Data Enable
Output
LCD_DISP
Output
LCD_PCLK
Pixel Clock
Output
Product Dependencies
I/O Lines
The pins used for interfacing the LCD Controller may be multiplexed with PIO lines. The programmer must first
program the PIO Controller to assign the pins to their peripheral function. If I/O lines of the LCD Controller are not
used by the application, they can be used for other purposes by the PIO Controller.
Table 32-2.
I/O Lines
Instance
Signal
I/O Line
Peripheral
LCDC
LCDDAT0
PA0
LCDC
LCDDAT1
PA1
LCDC
LCDDAT2
PA2
LCDC
LCDDAT3
PA3
LCDC
LCDDAT4
PA4
LCDC
LCDDAT5
PA5
LCDC
LCDDAT6
PA6
LCDC
LCDDAT7
PA7
LCDC
LCDDAT8
PA8
LCDC
LCDDAT9
PA9
LCDC
LCDDAT10
PA10
LCDC
LCDDAT11
PA11
LCDC
LCDDAT12
PA12
LCDC
LCDDAT13
PA13
LCDC
LCDDAT14
PA14
LCDC
LCDDAT15
PA15
LCDC
LCDDAT16
PA16
LCDC
LCDDAT17
PA17
LCDC
LCDDAT18
PA18
LCDC
LCDDAT19
PA19
637
Table 32-2.
32.5.2
LCDC
LCDDAT20
PA20
LCDC
LCDDAT21
PA21
LCDC
LCDDAT22
PA22
LCDC
LCDDAT23
PA23
LCDC
LCDDEN
PA29
LCDC
LCDDISP
PA25
LCDC
LCDHSYNC
PA27
LCDC
LCDPCK
PA28
LCDC
LCDPWM
PA24
LCDC
LCDVSYNC
PA26
Power Management
The LCD Controller is not continuously clocked. The user must first enable the LCD Controller clock in the Power
Management Controller before using it (PMC_PCER).
32.5.3
Interrupt Sources
The LCD Controller interrupt line is connected to one of the internal sources of the Advanced Interrupt Controller.
Using the LCD Controller interrupt requires prior programming of the AIC.
Table 32-3.
638
Peripheral IDs
Instance
ID
LCDC
51
32.6
Functional Description
The LCD module integrates the following digital blocks:
DMA Engine Address Generation (DEAG)This block performs data prefetch and requests access to the
AHB interface.
Color Lookup Table (CLUT)These 256 RAM-based lookup table entries are selected when the color depth
is set to 1, 2, 4 or 8 bpp.
Chroma Upsampling Engine (CUE)This block is selected when the input image sampling format is YUV
(YCbCr) 4:2:0 and converts it to higher quality 4:4:4 image.
Color Space Conversion (CSC)changes the color spare from YUV to RGB
The DMA controller reads the image through the AHB master interface. The LCD controller engine formats the
display data, then the GAB performs alpha blending if required, and writes the final pixel into the output FIFO. The
programmable timing engine drives a valid pixel onto the LCD_DAT[23:0] display bus.
32.6.1
The pixel clock (PCLK) generated by the timing engine is the source clock (SCLK) divided by the field CLKDIV in
the LCDC_LCDCFG0 register. The source clock can be selected between the system clock and the 2x system
clock with the field CLKSEL located in the LCDC_LCDCFG0 register.
Pixel Clock period formula:
SCLK
PCLK = -------------------------------CLKDIV + 2
The pixel clock polarity is also programmable.
32.6.1.2 Horizontal and Vertical Synchronization Configuration
LCDC_LCDCFG1.HSPW
LCDC_LCDCFG1.VSPW
LCDC_LCDCFG2.VFPW
LCDC_LCDCFG2.VBPW
LCDC_LCDCFG3.HFPW
LCDC_LCDCFG3.HBPW
LCDC_LCDCFG4.PPL
LCDC_LCDCFG4.RPF
639
4.
5.
6.
7.
The field LCDC_LCDCFG5.GUARDTIME is used to configure the number of frames before the assertion of the
DISP signal.
32.6.1.4 Timing Engine Power Down Software Operation
32.6.2
3.
Disable the HSYNC and VSYNC signals by writing a one to bit LCDC_LCDDIS.SYNCDIS.
4.
5.
Table 32-4.
DSCR + 0x0
ADDR
DSCR + 0x4
CTRL
DSCR + 0x8
NEXT
3.
If more than one descriptor is expected, the field DFETCH of DSCR.CHXCTRL is set to one to enable the
descriptor fetch operation.
4.
Write the DSCR.CHXNEXT register with the address location of the descriptor structure and set DFETCH
field of the DSCR.CHXCTRL register to one.
5.
Enable the relevant channel by writing one to the CHEN field of the CHXCHER register.
6.
An interrupt may be raised if unmasked when the descriptor has been loaded.
640
1.
Clearing the DFETCH bit in the DSCR.CHXCTRL field of the DSCR structure will disable the channel at the end of
the frame.
2.
Setting the DSCR.CHXNEXT field of the DSCR structure will disable the channel at the end of the frame.
3.
Writing one to the CHDIS field of the CHXCHDR register will disable the channel at the end of the frame.
4.
Writing one to the CHRST field of the CHXCHDR register will disable the channel immediately. This may
occur in the middle of the image.
5.
Polling CHSR field in the CHXCHSR register until the channel is successfully disabled.
3.
Add the new structure to the queue of descriptors by writing one to the A2QEN field of the CHXCHER
register.
4.
The new descriptor will be added to the queue on the next frame.
5.
An interrupt will be raised if unmasked, when the head descriptor structure has been loaded by the DMA
channel.
The DMA controller operation sets the following interrupt flags in the interrupt status register CHXISR:
DSCR field indicates that the descriptor structure is loaded in the DMA controller.
ADD field indicates that a descriptor has been added to the descriptor queue.
DONE field indicates that the channel transfer has terminated and the channel is automatically disabled.
When programming the DSCR.CHXADDR field of the DSCR structure the following requirement must be met.
Table 32-5.
CLUT Mode
1 bpp
8 bits
2 bpp
8 bits
4 bpp
8 bits
8 bpp
8 bits
Table 32-6.
RGB Mode
16 bits
16 bits
16 bits
16 bits
16 bits
32 bits
8 bits
32 bits
8 bits
32 bits
8 bits
32 bits
32 bits
32 bits
641
Table 32-7.
YUV Mode
32 bpp AYCrCb
32 bits
32 bits
Y 8 bits
CrCb 16 bits
Y 8 bits
Cr 8 bits
Cb 8 bits
Y 8 bits
CrCb 16 bits
Y 8 bits
Cr 8 bits
Cb 8 bits
32.6.3
LOCKDIS bit: When set to one the AHB lock signal is not asserted when the PSTRIDE value is different from
zero (rotation in progress).
ROTDIS bit: When set to one the Pixel Striding optimization is disabled.
DLBO bit: When set to one only defined burst lengths are performed when the DMA channel retrieves the
data from the memory.
BLEN field: defines the maximum burst length of the DMA channel
XPOS and YPOS fields define the position of the overlay window.
XSIZE and YSIZE fields define the size of the displayed window.
XMEMSIZE and YMEMSIZE fields define the size of the image frame buffer.
XSTRIDE and PSTRIDE fields define the line and pixel striding.
The position and size attributes are to be programmed to keep the window within the display area.
642
When the Color Lookup Table Mode is enabled the restrictions detailed in the following table apply on the
horizontal and vertical window size.
Table 32-8.
1 bpp
Multiple of 8 pixels
2 bpp
Multiple of 4 pixels
4 bpp
Multiple of 2 pixels
8 bpp
Free size
YUV Mode
AYUV
Free size
When two or more video layers are used, alpha blending is performed to define the final image displayed. Each
window has its own blending attributes.
ITER bit: when set, the iterated value is used in the iterated data path, otherwise the iterated value is set to
0.
GAEN bit: enables the global alpha value in the data path.
LAEN bit: enables the local alpha value from the pixel.
OVR bit: when set, the overlay is selected as an input of the blender.
REP bit: enables the bit replication to fill the 24-bit internal data path.
2.
3.
Poll UPDATESR field in the CHXCHSR, the update applies when that field is reset.
643
32.6.4
0x2
0x1
0x0
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 1 bpp
p31 p30 p29 p28 p27 p26 p25 p24 p23 p22 p21 p20 p19 p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 2 bpp
0x2
p15
p14
p13
p12
0x1
p11
p10
p9
p8
0x0
p7
p6
p5
p4
p3
p2
p1
0
p0
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 4 bpp
0x2
p7
p6
0x1
p5
p4
0x0
p3
p2
p1
p0
Mem addr
0x3
0x2
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 8 bpp
0x1
p3
0x0
p2
p1
p0
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 12 bpp
0x2
R1[3:0]
0x1
G1[3:0]
B1[3:0]
0x0
R0[3:0]
G0[3:0]
B0[3:0]
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 16 bpp
644
0x2
A1[3:0]
R1[3:0]
0x1
G1[3:0]
B1[3:0]
0x0
A0[3:0]
R0[3:0]
G0[3:0]
B0[3:0]
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 16 bpp
0x2
R1[3:0]
G13:0]
0x1
B1[3:0]
A1[3:0]
0x0
R0[3:0]
G0[3:0]
B0[3:0]
A0[3:0]
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 16bpp
0x2
R1[4:0]
0x1
G1[5:0]
B1[4:0]
0x0
9
R0[4:0]
G0[5:0]
B0[4:0]
Mem addr
0x3
0x2
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 4 bpp
A1
R1[4:0]
0x1
G1[4:0]
B1[4:0]
A0
0x0
9
R0[4:0]
G0[4:0]
2
B0[4:0]
32.6.4.10 18 bpp Unpacked Memory Mapping with Transparency Bit, RGB 6:6:6
Table 32-19.
Mem addr
0x3
0x2
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 18 bpp
0x1
0x0
R0[5:0]
G0[5:0]
B0[5:0]
32.6.4.11 18 bpp Packed Memory Mapping with Transparency Bit, RGB 6:6:6
Table 32-20.
18 bpp Packed Memory Mapping, Little Endian Organization at Address 0x0, 0x1, 0x2, 0x3
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 18 bpp
G1[1:0]
Table 32-21.
0x2
0x1
B1[5:0]
0x0
R0[5:0]
G0[5:0]
B0[5:0]
18 bpp Packed Memory Mapping, Little Endian Organization at Address 0x4, 0x5, 0x6, 0x7
Mem addr
0x7
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 18 bpp
Table 32-22.
0x6
R2[3:0]
0x5
G2[5:0]
B2[5:0]
0x4
9
R1[5:2]
G1[5:2]
18 bpp Packed Memory Mapping, Little Endian Organization at Address 0x8, 0x9, 0xA, 0xB
Mem addr
0xB
0xA
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 18 bpp
G4[1:0]
B4[5:0]
0x9
R3[5:0]
0x8
G3[5:0]
B3[3:0]
R2[5:4]
645
32.6.4.12 19 bpp Unpacked Memory Mapping with Transparency Bit, RGB 1:6:6:6
Table 32-23.
Mem addr
0x3
0x2
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 19 bpp
0x1
A0
0x0
R0[5:0]
G0[5:0]
B0[5:0]
32.6.4.13 19 bpp Packed Memory Mapping with Transparency Bit, ARGB 1:6:6:6
Table 32-24.
19 bpp Packed Memory Mapping, Little Endian Organization at Address 0x0, 0x1, 0x2, 0x3
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 19 bpp
G1[1:0]
Table 32-25.
0x2
0x1
B1[5:0]
A0
0x0
R0[5:0]
B0[5:0]
19 bpp Packed Memory Mapping, Little Endian Organization at Address 0x4, 0x5, 0x6, 0x7
0x7
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Table 32-26.
G0[5:0]
Mem addr
Pixel 19 bpp
0x6
R2[3:0]
0x5
G2[5:0]
B2[5:0]
0x4
A1
R1[5:2]
G1[5:2]
18 bpp Packed Memory Mapping, Little Endian Organization at Address 0x8, 0x9, 0xA, 0xB
Mem addr
0xB
0xA
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 19 bpp
G4[1:0]
B4[5:0]
0x9
A3
R3[5:0]
0x8
9
G3[5:0]
B3[3:0]
R2[5:4]
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 24 bpp
0x2
0x1
R0[7:0]
0x0
9
G0[7:0]
B0[7:0]
24 bpp Packed Memory Mapping, Little Endian Organization at Address 0x0, 0x1, 0x2, 0x3
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 24 bpp
Table 32-29.
0x2
B1[7:0]
0x1
R0[7:0]
0x0
7
B0[7:0]
24 bpp Packed Memory Mapping, Little Endian Organization at Address 0x4, 0x5, 0x6, 0x7
0x7
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
646
G0[7:0]
Mem addr
Pixel 24 bpp
0x6
G2[7:0]
0x5
B2[7:0]
0x4
R1[7:0]
G1[7:0]
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 25 bpp
0x2
A0
0x1
R0[7:0]
0x0
9
G0[7:0]
B0[7:0]
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 32 bpp
0x2
A0[7:0]
0x1
R0[7:0]
0x0
9
G0[7:0]
B0[7:0]
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 32 bpp
32.6.5
0x2
R0[7:0]
0x1
G0[7:0]
0x0
9
B0[7:0]
A0[7:0]
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 16 bpp
0x2
A0[7:0]
0x1
Y0[7:0]
0x0
9
Cb0[7:0]
Cr0[7:0]
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 16 bpp
Table 32-35.
0x2
Cr0[7:0]
0x1
Y1[7:0]
0x0
7
Y0[7:0]
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 16 bpp
0x2
Y1[7:0]
0x1
Cr0[7:0]
0x0
9
Y0[7:0]
Cb0[7:0]
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 16 bpp
Cb0[7:0]
Mem addr
Table 32-36.
0x2
Cb0[7:0]
0x1
Y1[7:0]
0x0
Cr0[7:0]
Y0[7:0]
647
Table 32-37.
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 16 bpp
0x2
Y1[7:0]
0x1
Cb0[7:0]
0x0
9
Y0[7:0]
Cr0[7:0]
4:2:2 Semiplanar Luminance Memory Mapping, Little Endian Organization for Byte 0x0, 0x1, 0x2, 0x3
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 16 bpp
Table 32-39.
0x2
Y3[7:0]
0x1
Y2[7:0]
0x0
9
Y1[7:0]
Y0[7:0]
4:2:2 Semiplanar Chrominance Memory Mapping, Little Endian Organization for Byte 0x0, 0x1, 0x2, 0x3
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 16 bpp
0x2
Cb2[7:0]
0x1
Cr2[7:0]
0x0
9
Cb0[7:0]
Cr0[7:0]
4:2:2 Planar Mode Luminance Memory Mapping, Little Endian Organization for Byte 0x0, 0x1, 0x2, 0x3
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 16 bpp
Table 32-41.
0x2
Y3[7:0]
0x1
Y2[7:0]
0x0
9
Y1[7:0]
Y0[7:0]
4:2:2 Planar Mode Chrominance Memory Mapping, Little Endian Organization for Byte 0x0, 0x1, 0x2, 0x3
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 16 bpp
0x2
C3[7:0]
0x1
C2[7:0]
0x0
9
C1[7:0]
C0[7:0]
In Planar Mode, the three video components Y, Cr and Cb are split into three memory areas and stored in a rasterscan order. These three memory planes are contiguous and always aligned on a 32-bit boundary.
Table 32-42.
4:2:0 Planar Mode Luminance Memory Mapping, Little Endian Organization for Byte 0x0, 0x1, 0x2, 0x3
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 12 bpp
Table 32-43.
0x2
Y3[7:0]
0x1
Y2[7:0]
0x0
7
Y0[7:0]
4:2:0 Planar Mode Luminance Memory Mapping, Little Endian Organization for Byte 0x4, 0x5, 0x6, 0x7
0x7
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
648
Y1[7:0]
Mem addr
Pixel 12 bpp
0x6
Y7[7:0]
0x5
Y6[7:0]
0x4
Y5[7:0]
Y4[7:0]
Table 32-44.
4:2:0 Planar Mode Chrominance Memory Mapping, Little Endian Organization for Byte 0x0, 0x1, 0x2, 0x3
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 12 bpp
Table 32-45.
0x2
C3[7:0]
0x1
C2[7:0]
0x0
9
C1[7:0]
C0[7:0]
4:2:0 Planar Mode Chrominance Memory Mapping, Little Endian Organization for Byte 0x4, 0x5, 0x6, 0x7
Mem addr
0x7
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 12 bpp
0x6
C7[7:0]
0x5
C6:[7:0]
0x4
9
C5[7:0]
C4[7:0]
Mem addr
0x7
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 12 bpp
Table 32-47.
0x6
Y3[7:0]
0x5
Y2[7:0]
0x4
8
Y1[7:0]
Y0[7:0]
Mem addr
0x3
Bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
Pixel 12 bpp
0x2
Cb1[7:0]
0x1
Cr1[7:0]
0x0
Cb0[7:0]
Cr0[7:0]
649
32.6.6
C[0,0]
C[x/2,0]
C[x,0]
C[0,y/2]
C[x/2,y/2]
C[x,y/2]
C[0,y]
C[x/2,y]
C[x,y]
Y sample
Cr Cb calculated at encoding time
Cr Cb interpolated from 2 Chroma Component
650
Figure 32-3.
C[0,0]
C[x/2,0]
C[x,0]
C[0,y/2]
C[x/2,y/2]
C[x,y/2]
C[0,y]
C[x/2,y]
C[x,y]
Y sample
Cr Cb calculated at encoding time
Cr Cb from the previous line (interpolated)
651
Figure 32-4.
C[0,0]
C[x/2,0]
C[0,y/2]
C[x/2,y/2]
C[x,y/2]
C[0,y]
C[x/2,y]
C[x,y]
Y sample
Cr Cb calculated at encoding time
Cr Cb interpolated
652
C[x,0]
Figure 32-5.
C[0,0]
C[x/2,0]
C[x,0]
C[0,y/2]
C[x/2,y/2]
C[x,y/2]
C[0,y]
C[x/2,y]
C[x,y]
Y sample
Cr Cb calculated at encoding time
Cr Cb interpolated from 2 Chroma Component
Cr Cb interpolated from 4 Chroma Component
x
Cr [ 0, 0 ] + Cr [ 0, x ]
Chroma ---, 0 = ----------------------------------------------2
2
y
Cr [ 0, 0 ] + C [ 0, y ]
Chroma 0, --- = --------------------------------------------2
2
x y
Cr [ 0, 0 ] + Cr [ x, 0 ] + Cr [ y, 0 ] + Cr [ x, y ]
Chroma ---, --- = ----------------------------------------------------------------------------------------------------2 2
4
y
Cr [ x, 0 ] + Cr [ x, y ]
Chroma x, --- = ----------------------------------------------2
2
x
Cr [ 0, y ] + Cr [ x, y ]
Chroma ---, y = ----------------------------------------------2
2
653
32.6.7
1.
Read line n from chrominance cache and interpolate [x/2,0] chrominance component filling the 1 x 2 kernel with
line n. If the chrominance cache is empty, then fetch the first line from external memory and interpolate from the
external memory. Duplicate the last chrominance at the end of line.
2.
Fetch line n+1 from external memory, write line n + 1 to chrominance cache, read line n from the
chrominance cache. interpolate [0,y/2], [x/2,y/2] and [x, y/2] filling the 2x2 kernel with line n and n+1.
Duplicate the last chrominance line to generate the last interpolated line.
3.
When the end of line has been reached, the DMA address counter points to the next pixel address. The channel
DMA address register is added to the XSTRIDE field, and then updated. If XSTRIDE is set to zero, the DMA
address register remains unchanged. The XSTRIDE field of the channel configuration register is aligned to the
pixel size boundary. The XSTRIDE field is a twos complement number. The following formula applies at the line
boundary and indicates how the DMA controller computes the next pixel address. The function Sizeof() returns the
number of bytes required to store a pixel.
NextPixelAddress = CurrentPixelAddress + Sizeof ( pixel ) + XSTRIDE
The DMA channel engine may optionally fetch non contiguous pixels. The channel DMA address register is added
to the PSTRIDE field and then updated. If PSTRIDE is set to zero, the DMA address register remains unchanged
and pixels are contiguous. The PSTRIDE field of the channel configuration register is aligned to the pixel size
boundary. The PSTRIDE is a twos complement number. The following formula applies at the pixel boundary and
indicates how the DMA controller computes the next pixel address. The function Sizeof() returns the number of
bytes required to store a pixel.
NextPixelAddress = CurrentPixelAddress + Sizeof ( pixel ) + PSTRIDE
32.6.8
R
CSCRY CSCRU CSCRV
Y Yoff
=
G
CSCGY CSCGU CSCGV
Cb Cboff
B
CSCBY CSCBU CSCBV
Cr Croff
Color space conversion coefficients are defined with the following equation:
8
9
1
CSC ij = ----- 2 c 9 +
7
2
654
cn 2
n=0
Color space conversion coefficients are defined with one sign bit, 2 integer bits and 7 fractional bits. The range of
the CSCij coefficients is defined below with a step of 1/128.
4 CSC ij
3.9921875
The scaling operation is based on a vertical and horizontal resampling algorithm. The sampling rate of the original
image is increased when the video is upscaled, and decreased when the video is downscaled. A Vertical
resampler is used to perform a vertical interpolation by a factor of vI, and a decimation by a factor of vD. A
Horizontal resampler is used to perform a vertical interpolation by a factor of hI, and a decimation by a factor of hD.
Both horizontal and vertical low pass filters are designed to minimize the aliasing effect. The frequency response
of the low pass filter has the following characteristics:
I
H() =
-)
when 0 min (
---,--ID
0 otherwise
Taking into account the linear phase condition and anticipating the filter length M, the desired frequency response
is modified.
M j --- Ie 2
H() =
Figure 32-6.
-)
when 0 min (
---,--ID
0 otherwise
Vertical Resampler
Vertical
upsampler
vI
Low Pass
Filter
Vertical
downsampler
vD
output
video
stream
Horizontal Resampler
Horizontal
upsampler
hI
Low Pass
Filter
Horizontal
downsampler
hD
I ------ when n = 0
h(n) =
sin ( c n )
I -----c- --------------------- otherwise
c n
655
M
h(n) =
sin c n -----
c
2
I ----- --------------------------------------- otherwise
c n -----
This ideal filter is non-causal and cannot be realized. The unit sample response h(n) is infinite in duration and must
be truncated depending on the expected length M of the filter. This truncation is equivalent to the multiplication of
the impulse response by a window function w(n).
Table 32-48.
Barlett
Blackman
Hamming
Hanning
The horizontal resampler includes an 8-phase 5-tap filter equivalent to a 40-tap FIR described in Figure 32-7.
The vertical resampler includes an 8-phase 3-tap filter equivalent to a 24-tap FIR described in Figure 32-8.
Figure 32-7.
Coefficient
storage
coeff4
coeff3
coeff2
coeff1
coeff0
y(m)
656
Figure 32-8.
Coefficient
storage
-1
-1
coeff2
coeff1
coeff0
y(m)
The XMEMSIZE field of the LCDC_HEOCFG4 register indicates the horizontal size minus one of the image in the
system memory. The XSIZE field of the LCDC_HEOCFG3 register contains the horizontal size minus one of the
window. The SCALEN bit of the LCDC_HEOCFG13 register is set to one. The scaling factor is programmed in the
XFACTOR field of the LCDC_HEOCFG13 register. Use the following algorithm to find the XFACTOR value:
8 256 XMEMSIZE 256 XPHIDEF
XFACTOR 1st = floor ---------------------------------------------------------------------------------------------------------
XSIZE
XFACTOR 1st = XFACTOR 1st + 1
XFACTOR 1st XSIZE + 256 XPHIDEF
XMEMSIZE max = floor -----------------------------------------------------------------------------------------------------------
2048
The YMEMSIZE field of the LCDC_HEOCFG4 register indicates the vertical size minus one of the image in the
system memory. The YSIZE field of the LCDC_HEOCFG3 register contains the vertical size minus one of the
window. The SCALEN bit of the LCDC_HEOCFG13 register is set to one. The scaling factor is programmed in the
YFACTOR field of the LCDC_HEOCFG13 register.
8 256 YMEMSIZE 256 YPHIDEF
YFACTOR 1st = floor --------------------------------------------------------------------------------------------------------
YSIZE
YFACTOR 1st = YFACTOR 1st + 1
YFACTOR 1st YSIZE + 256 YPHIDEF
YMEMSIZE max = floor ----------------------------------------------------------------------------------------------------------
2048
657
The LCD module provides hardware support for multiple overlay plane that can be used to display windows on
top of the image without destroying the image located below. The overlay image can use any color depth. Using
the overlay alleviates the need to re-render the occluded portion of the image. When pixels are combined together
through the alpha blending unit, a new color is created. This new pixel is called an iterated pixel and is passed to
the next blending stage. Then, this pixel may be combined again with another pixel. The VIDPRI bit located in the
LCDC_HEOCFG12 register configures the video priority algorithm used to display the layers. When the VIDPRI bit
is cleared, the OVR1 layer is located above the HEO layer. When the VIDPRI bit is set, OVR1 is located below the
HEO layer.
658
Figure 32-9.
HEO width
OVR1 width
Base width
Base
height
o0(x,y)
HEO
o1(x,y)
HEO
height
Overlay1
OVR1
OVR1
height
HCC
Base Image
Video Prioritization Algorithm 1 : HCC > OVR1 > HEO > BASE
Base Image
HEO
HCC
Overlay1
OVR1
Video Prioritization Algorithm 2 : HCC > HEO > OVR1 > BASE
659
When the base layer is combined with at least one active overlay, the whole base layer frame is retrieved from the
memory though it is not visible. A set of registers is used to disable the Base DMA when this condition is met.
These registers are the following:
LCDC_BASECFG5:
660
LCDC_BASECFG6:
Base Image
DISCXSIZE
Base width
Base
height
{DISCXPOS,
DISCYPOS}
Overlay1
DISCYSIZE
Discarded Area
Base Image
HEO width
Base width
Base
height
HEO Video
HEO
height
Base Image
661
The blending function requires two pixels (one iterated from the previous blending stage and one from the current
overlay color) and a set of blending configuration parameters. These parameters define the color operation.
Figure 32-11. Alpha Blender Function
iter[n-1]
GA
OVR
From
LAEN
Shadow
REVALPHA
Registers ITER
ITER2BL
CRKEY
INV
DMA
GAEN
RGBKEY
RGBMASK
OVRDEF
la
ovr
Blending
Function
iter[n]
ovr
iter[n-1]
OVR
ITER
OVRDEF
GA
"0"
"0"
GAEN
DMA
LAEN
"0"
0
REVALPHA
ovr
RGBKEY
RGBMASK
CRKEY
ovr iter[n-1]
0
MATCH
LOGIC
0
Inverted
INV
iter[n]
662
ovr1la ovr1
iter[n-1]
la
ovr2la ovr2
heola heo
hcrla hcr
ovr
blending
function
iter[n]
iter[n-1]
la
ovr
blending
function
iter[n]
iter[n-1]
la
ovr
blending
function
iter[n]
iter[n-1]
la
ovr
blending
function
iter[n]
663
OVR1 25 %
HEO 75 %
Color keying involves a method of bit-block image transfer (Blit). This entails blitting one image onto another where
not all the pixels are copied. Blitting usually involves two bitmaps, a source bitmap and a destination bitmap. A
raster operation (ROP) is performed to define whether the iterated color or the overlay color is to be visible or not.
Source Color Keying
If the masked overlay color matches the color key then the iterated color is selected, Source Color Keying is
activated using the following configuration sequence:
1. Select the Overlay to Blit
2. Clear DSTKEY bit
3.
4.
5.
When the field RMASK, GMASK, or BMASK is set to zero, the comparison is disabled and the raster operation is
activated.
Destination Color Keying
If the iterated masked color matches the color key then the overlay color is selected, Destination Color Keying is
activated using the following configuration sequence:
1. Select the Overlay to Blit
2. Set DSTKEY bit
3.
664
4.
5.
When the field RMASK, GMASK, or BMASK is set to zero, the comparison is disabled and the raster operation is
activated.
32.6.11 LCDC PWM Controller
This block generates the LCD contrast control signal (LCD_PWM) to make possible the control of the display's
contrast by software. This is an 8-bit PWM (Pulse Width Modulation) signal that can be converted to an analog
voltage with a simple passive filter.
The PWM module has a free-running counter whose value is compared against a compare register (PWMCVAL
field of the LCDC_LCDCFG6 register). If the value in the counter is less than that in the register, the output brings
the value of the signal polarity (PWMPOL) bit in the PWM control register: LCDC_LCDCFG6. Otherwise, the
opposite value is output. Thus, a periodic waveform with a pulse width proportional to the value in the compare
register is generated.
Due to the comparison mechanism, the output pulse has a width between zero and 255 PWM counter cycles.
Thus by adding a simple passive filter outside the chip, an analog voltage between 0 and (255/256) VDD can be
obtained (for the positive polarity case, or between (1/256) VDD and VDD for the negative polarity case). Other
voltage values can be obtained by adding active external circuitry.
For PWM mode, the counter frequency can be adjusted to four different values using the PWMPS field of the
LCDC_LCDCFG6 register.
The PWM module can be fed with the slow clock or the system clock, depending on the CLKPWMSEL bit of the
LCDC_CFG0 register.
32.6.12 LCD Overall Performance
32.6.12.1 Color Lookup Table (CLUT)
Table 32-49.
CLUT Mode
Pixels/Cycle
Rotation
Scaling
1 bpp
64
Not supported
Supported
2 bpp
32
Not supported
Supported
3 bpp
16
Not supported
Supported
4 bpp
Not supported
Supported
665
RGB Mode
Pixels/Cycle
Memory
Burst Mode
Normal Mode
12 bpp
0.2
Supported
16 bpp
0.2
Supported
18 bpp
0.2
Supported
2.666
Not supported
0.2
Supported
19 bpp
0.2
Supported
19 bpp PACKED
2.666
Not Supported
0.2
Supported
24 bpp
0.2
Supported
24 bpp PACKED
2.666
Not Supported
0.2
Supported
25 bpp
0.2
Supported
32 bpp
0.2
Supported
Note:
666
YUV Mode
Pixels/Cycle
Memory
Burst Mode
Normal Mode
32 bpp AYUV
0.2
Supported
16 bpp 422
Not Supported
Not Supported
Supported
Note:
Table 32-52.
YUV Mode
Comp/Cycle
Rotation Peak Random Memory Access (pixels/cycle)
Memory Burst
Mode
Rotation Optimization
Normal Mode
8 Y, 4 UV
1 Y, 1 UV (2 streams)
Supported
8 Y, 8 U, 8 V
1 Y, 1 U, 1 V (3 streams)
1 Y, 1 UV (2 streams)
1 Y, 1 U, 1 V (3 streams)
8 Y, 8 U, 8 V
Supported
Note: In order to provide more bandwidth, when multiple streams are used to transfer Y, UV, U or V components, two AHB interfaces are
recommended or multiple AXI ID are required.
Table 32-53.
YUV Planar Overall Performance 1 AHB Interface for 0 Wait State Memory
YUV Mode
Pix/Cycle
Rotation Peak Random Memory Access (pixels/cycle)
Memory Burst
Mode
Rotation Optimization
Normal Mode
0.66
0.132
Supported
0.5
0.1
Supported
0.8
0.16
Supported
0.66
0.132
Supported
5.32
Note: In order to provide more bandwidth, when multiple streams are used to transfer Y, UV, U or V components, two AHB interfaces are
recommended or multiple AXI ID are required.
667
LCD_PCLK
LCD_VSYNC
LCD_HSYNC
LCD_BIAS_DEN
LCD_DAT[23:0]
HSW
VBP
VSW
HBP
LCD_PCLK
LCD_VSYNC
LCD_HSYNC
LCD_BIAS_DEN
LCD_DAT[23:0]
HSW
HBP
HFP
PPL
LCD_PCLK
LCD_VSYNC
LCD_HSYNC
LCD_BIAS_DEN
LCD_DAT[23:0]
PPL
668
HFP
HSW
VFP
HSW
HBP
VSPDLYE = 0
VSPSU = 0
VSPHO = 0
VSPSU = 0
VSPHO = 0
LCD_PCLK
LCD_VSYNC
LCD_HSYNC
HSW
VSPDLYS = 1
VSPDLYE = 0
VSW
VBP
HBP
VBP
HBP
VBP
HBP
VBP
HBP
VBP
HBP
LCD_PCLK
LCD_VSYNC
LCD_HSYNC
HSW
VSPDLYS = 0
VSPDLYE = 1
VSW
VSPSU = 0
VSPHO = 0
LCD_PCLK
LCD_VSYNC
LCD_HSYNC
HSW
VSPDLYS = 1
VSPDLYE = 1
VSW
VSPSU = 0
VSPHO = 0
LCD_PCLK
LCD_VSYNC
LCD_HSYNC
HSW
VSPDLYS = 1
VSPDLYE = 0
VSW
VSPSU = 1
VSPHO = 0
LCD_PCLK
LCD_VSYNC
LCD_HSYNC
HSW
VSW
669
VSPDLYE = 0
VSPSU = 0
VSPHO = 1
VSPSU = 1
VSPHO = 1
LCD_PCLK
LCD_VSYNC
LCD_HSYNC
HSW
VSPDLYS = 1
VSPDLYE = 0
VSW
VBP
HBP
VBP
HBP
LCD_PCLK
LCD_VSYNC
LCD_HSYNC
HSW
670
VSW
LCD_VSYNC
LCD_HSYNC
lcd display off
LCD_DISP
lcd display on
LCD_VSYNC
LCD_HSYNC
LCD_DISP
lcd display on
LCD_PCLK
LCD_VSYNC
LCD_HSYNC
LCD_DISP
lcd display on
LCD_VSYNC
LCD_HSYNC
LCD_DISP
lcd display on
671
672
Pin ID
TFT 24 bits
TFT 18 bits
TFT 16 bits
TFT 12 bits
LCD_DAT[23]
R[7]
R[5]
R[4]
R[3]
LCD_DAT[22]
R[6]
R[4]
R[3]
R[2]
LCD_DAT[21]
R[5]
R[3]
R[2]
R[1]
LCD_DAT[20]
R[4]
R[2]
R[1]
R[0]
LCD_DAT[19]
R[3]
R[1]
R[0]
LCD_DAT[18]
R[2]
R[0]
LCD_DAT[17]
R[1]
LCD_DAT[16]
R[0]
LCD_DAT[15]
G[7]
G[5]
G[5]
G[3]
LCD_DAT[14]
G[6]
G[4]
G[4]
G[2]
LCD_DAT[13]
G[5]
G[3]
G[3]
G[1]
LCD_DAT[12]
G[4]
G[2]
G[2]
G[0]
LCD_DAT[11]
G[3]
G[1]
G[1]
LCD_DAT[10]
G[2]
G[0]
G[0]
LCD_DAT[9]
G[1]
LCD_DAT[8]
G[0]
LCD_DAT[7]
B[7]
B[5]
B[4]
B[3]
LCD_DAT[6]
B[6]
B[4]
B[3]
B[2]
LCD_DAT[5]
B[5]
B[3]
B[2]
B[1]
LCD_DAT[4]
B[4]
B[2]
B[1]
B[0]
LCD_DAT[3]
B[3]
B[1]
B[0]
LCD_DAT[2]
B[2]
B[0]
LCD_DAT[1]
B[1]
LCD_DAT[0]
B[0]
32.7
Table 32-55.
Register Mapping
Offset
Register
Name
Access
Reset
0x00000000
LCDC_LCDCFG0
Read/Write
0x00000000
0x00000004
LCDC_LCDCFG1
Read/Write
0x00000000
0x00000008
LCDC_LCDCFG2
Read/Write
0x00000000
0x0000000C
LCDC_LCDCFG3
Read/Write
0x00000000
0x00000010
LCDC_LCDCFG4
Read/Write
0x00000000
0x00000014
LCDC_LCDCFG5
Read/Write
0x00000000
0x00000018
LCDC_LCDCFG6
Read/Write
0x00000000
0x0000001C
Reserved
0x00000020
LCDC_LCDEN
Write-only
0x00000024
LCDC_LCDDIS
Write-only
0x00000028
LCDC_LCDSR
Read-only
0x00000000
0x0000002C
LCDC_LCDIER
Write-only
0x00000030
LCDC_LCDIDR
Write-only
0x00000034
LCDC_LCDIMR
Read-only
0x00000000
0x00000038
LCDC_LCDISR
Read-only
0x00000000
0x0000003C
LCDC_ATTR
Write-only
0x00000040
LCDC_BASECHER
Write-only
0x00000044
LCDC_BASECHDR
Write-only
0x00000048
LCDC_BASECHSR
Read-only
0x00000000
0x0000004C
LCDC_BASEIER
Write-only
0x00000050
LCDC_BASEIDR
Write-only
0x00000054
LCDC_BASEIMR
Read-only
0x00000000
0x00000058
LCDC_BASEISR
Read-only
0x00000000
0x0000005C
LCDC_BASEHEAD
Read/Write
0x00000000
0x00000060
LCDC_BASEADDR
Read/Write
0x00000000
0x00000064
LCDC_BASECTRL
Read/Write
0x00000000
0x00000068
LCDC_BASENEXT
Read/Write
0x00000000
0x0000006C
LCDC_BASECFG0
Read/Write
0x00000000
0x00000070
LCDC_BASECFG1
Read/Write
0x00000000
0x00000074
LCDC_BASECFG2
Read/Write
0x00000000
0x00000078
LCDC_BASECFG3
Read/Write
0x00000000
0x0000007C
LCDC_BASECFG4
Read/Write
0x00000000
0x00000080
LCDC_BASECFG5
Read/Write
0x00000000
0x00000084
LCDC_BASECFG6
Read/Write
0x00000000
Reserved
0x000000880x0000013C
673
Table 32-55.
Offset
Register
Name
Access
Reset
0x00000140
LCDC_OVR1CHER
Write-only
0x00000144
LCDC_OVR1CHDR
Write-only
0x00000148
LCDC_OVR1CHSR
Read-only
0x00000000
0x0000014C
LCDC_OVR1IER
Write-only
0x00000150
LCDC_OVR1IDR
Write-only
0x00000154
LCDC_OVR1IMR
Read-only
0x00000000
0x00000158
LCDC_OVR1ISR
Read-only
0x00000000
0x0000015C
LCDC_OVR1HEAD
Read/Write
0x00000000
0x00000160
LCDC_OVR1ADDR
Read/Write
0x00000000
0x00000164
LCDC_OVR1CTRL
Read/Write
0x00000000
0x00000168
LCDC_OVR1NEXT
Read/Write
0x00000000
0x0000016C
LCDC_OVR1CFG0
Read/Write
0x00000000
0x00000170
LCDC_OVR1CFG1
Read/Write
0x00000000
0x00000174
LCDC_OVR1CFG2
Read/Write
0x00000000
0x00000178
LCDC_OVR1CFG3
Read/Write
0x00000000
0x0000017C
LCDC_OVR1CFG4
Read/Write
0x00000000
0x00000180
LCDC_OVR1CFG5
Read/Write
0x00000000
0x00000184
LCDC_OVR1CFG6
Read/Write
0x00000000
0x00000188
LCDC_OVR1CFG7
Read/Write
0x00000000
0x0000018C
LCDC_OVR1CFG8
Read/Write
0x00000000
0x00000190
LCDC_OVR1CFG9
Read/Write
0x00000000
Reserved
0x00000240
LCDC_OVR2CHER
Write-only
0x00000244
LCDC_OVR2CHDR
Write-only
0x00000248
LCDC_OVR2CHSR
Read-only
0x00000000
0x0000024C
LCDC_OVR2IER
Write-only
0x00000250
LCDC_OVR2IDR
Write-only
0x00000254
LCDC_OVR2IMR
Read-only
0x00000000
0x00000258
LCDC_OVR2ISR
Read-only
0x00000000
0x0000025C
LCDC_OVR2HEAD
Read/Write
0x00000000
0x00000260
LCDC_OVR2ADDR
Read/Write
0x00000000
0x00000264
LCDC_OVR2CTRL
Read/Write
0x00000000
0x00000268
LCDC_OVR2NEXT
Read/Write
0x00000000
0x0000026C
LCDC_OVR2CFG0
Read/Write
0x00000000
0x00000270
LCDC_OVR2CFG1
Read/Write
0x00000000
0x00000274
LCDC_OVR2CFG2
Read/Write
0x00000000
0x00000278
LCDC_OVR2CFG3
Read/Write
0x00000000
0x000001940x0000023C
674
Table 32-55.
Offset
Register
Name
Access
Reset
0x0000027C
LCDC_OVR2CFG4
Read/Write
0x00000000
0x00000280
LCDC_OVR2CFG5
Read/Write
0x00000000
0x00000284
LCDC_OVR2CFG6
Read/Write
0x00000000
0x00000288
LCDC_OVR2CFG7
Read/Write
0x00000000
0x0000028C
LCDC_OVR2CFG8
Read/Write
0x00000000
0x00000290
LCDC_OVR2CFG9
Read/Write
0x00000000
Reserved
0x00000340
LCDC_HEOCHER
Write-only
0x00000344
LCDC_HEOCHDR
Write-only
0x00000348
LCDC_HEOCHSR
Read-only
0x00000000
0x0000034C
LCDC_HEOIER
Write-only
0x00000350
LCDC_HEOIDR
Write-only
0x00000354
LCDC_HEOIMR
Read-only
0x00000000
0x00000358
LCDC_HEOISR
Read-only
0x00000000
0x0000035C
LCDC_HEOHEAD
Read/Write
0x00000000
0x00000360
LCDC_HEOADDR
Read/Write
0x00000000
0x00000364
LCDC_HEOCTRL
Read/Write
0x00000000
0x00000368
LCDC_HEONEXT
Read/Write
0x00000000
0x0000036C
LCDC_HEOUHEAD
Read/Write
0x00000000
0x00000370
LCDC_HEOUADDR
Read/Write
0x00000000
0x00000374
LCDC_HEOUCTRL
Read/Write
0x00000000
0x00000378
LCDC_HEOUNEXT
Read/Write
0x00000000
0x0000037C
LCDC_HEOVHEAD
Read/Write
0x00000000
0x00000380
LCDC_HEOVADDR
Read/Write
0x00000000
0x00000384
LCDC_HEOVCTRL
Read/Write
0x00000000
0x00000388
LCDC_HEOVNEXT
Read/Write
0x00000000
0x0000038C
LCDC_HEOCFG0
Read/Write
0x00000000
0x00000390
LCDC_HEOCFG1
Read/Write
0x00000000
0x00000394
LCDC_HEOCFG2
Read/Write
0x00000000
0x00000398
LCDC_HEOCFG3
Read/Write
0x00000000
0x0000039C
LCDC_HEOCFG4
Read/Write
0x00000000
0x000003A0
LCDC_HEOCFG5
Read/Write
0x00000000
0x000003A4
LCDC_HEOCFG6
Read/Write
0x00000000
0x000003A8
LCDC_HEOCFG7
Read/Write
0x00000000
0x000003AC
LCDC_HEOCFG8
Read/Write
0x00000000
0x000003B0
LCDC_HEOCFG9
Read/Write
0x00000000
0x000003B4
LCDC_HEOCFG10
Read/Write
0x00000000
0x000002940x0000033C
675
Table 32-55.
Offset
Register
Name
Access
Reset
0x000003B8
LCDC_HEOCFG11
Read/Write
0x00000000
0x000003BC
LCDC_HEOCFG12
Read/Write
0x00000000
0x000003C0
LCDC_HEOCFG13
Read/Write
0x00000000
0x000003C4
LCDC_HEOCFG14
Read/Write
0x00000000
0x000003C8
LCDC_HEOCFG15
Read/Write
0x00000000
0x000003CC
LCDC_HEOCFG16
Read/Write
0x00000000
0x000003D0
LCDC_HEOCFG17
Read/Write
0x00000000
0x000003D4
LCDC_HEOCFG18
Read/Write
0x00000000
0x000003D8
LCDC_HEOCFG19
Read/Write
0x00000000
0x000003DC
LCDC_HEOCFG20
Read/Write
0x00000000
0x000003E0
LCDC_HEOCFG21
Read/Write
0x00000000
0x000003E4
LCDC_HEOCFG22
Read/Write
0x00000000
0x000003E8
LCDC_HEOCFG23
Read/Write
0x00000000
0x000003EC
LCDC_HEOCFG24
Read/Write
0x00000000
0x000003F0
LCDC_HEOCFG25
Read/Write
0x00000000
0x000003F4
LCDC_HEOCFG26
Read/Write
0x00000000
0x000003F8
LCDC_HEOCFG27
Read/Write
0x00000000
0x000003FC
LCDC_HEOCFG28
Read/Write
0x00000000
0x00000400
LCDC_HEOCFG29
Read/Write
0x00000000
0x00000404
LCDC_HEOCFG30
Read/Write
0x00000000
0x00000408
LCDC_HEOCFG31
Read/Write
0x00000000
0x0000040C
LCDC_HEOCFG32
Read/Write
0x00000000
0x00000410
LCDC_HEOCFG33
Read/Write
0x00000000
0x00000414
LCDC_HEOCFG34
Read/Write
0x00000000
0x00000418
LCDC_HEOCFG35
Read/Write
0x00000000
0x0000041C
LCDC_HEOCFG36
Read/Write
0x00000000
0x00000420
LCDC_HEOCFG37
Read/Write
0x00000000
0x00000424
LCDC_HEOCFG38
Read/Write
0x00000000
0x00000428
LCDC_HEOCFG39
Read/Write
0x00000000
0x0000042C
LCDC_HEOCFG40
Read/Write
0x00000000
0x00000430
LCDC_HEOCFG41
Read/Write
0x00000000
0x000004340x0000053C
Reserved
0x000005840x000005FC
Reserved
LCDC_BASECLUT0
Read/Write
0x00000000
...
...
...
...
0x000008FC
LCDC_BASECLUT255
Read/Write
0x00000000
0x00000A00
LCDC_OVR1CLUT0
Read/Write
0x00000000
0x00000600
...
676
Table 32-55.
Offset
Register
Name
Access
Reset
...
...
...
...
0x00000DFC
LCDC_OVR1CLUT255
Read/Write
0x00000000
0x00000E00
LCDC_OVR2CLUT0
Read/Write
0x00000000
...
...
...
...
0x000011FC
LCDC_OVR2CLUT255
Read/Write
0x00000000
0x00001200
LCDC_HEOCLUT0
Read/Write
0x00000000
...
...
...
...
LCDC_HEOCLUT255
Read/Write
0x00000000
...
...
...
0x000015FC
0x000016000x00001FFC Reserved
Note:
1. The CLUT registers are located in the RAM.
677
32.7.1
Name:
LCDC_LCDCFG0
Address:
0xF0000000
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
18
25
17
24
16
11
CGDISHEO
3
CLKPWMSEL
10
CGDISOVR2
2
CLKSEL
9
CGDISOVR1
1
8
CGDISBASE
0
CLKPOL
CLKDIV
15
14
13
12
678
679
32.7.2
Name:
LCDC_LCDCFG1
Address:
0xF0000004
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
18
25
17
24
16
11
10
VSPW
15
14
13
12
4
HSPW
680
32.7.3
Name:
LCDC_LCDCFG2
Address:
0xF0000008
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
18
25
17
24
16
11
10
VBPW
15
14
13
12
4
VFPW
681
32.7.4
Name:
LCDC_LCDCFG3
Address:
0xF000000C
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
18
25
11
10
24
HBPW
17
16
HBPW
15
14
13
12
8
HFPW
HFPW
682
32.7.5
Name:
LCDC_LCDCFG4
Address:
0xF0000010
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
11
10
18
25
RPF
17
24
9
PPL
1
16
RPF
15
14
13
12
PPL
683
32.7.6
Name:
LCDC_LCDCFG5
Address:
0xF0000014
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
18
25
17
11
3
VSPDLYE
10
2
VSPDLYS
24
16
GUARDTIME
15
7
DISPDLY
14
6
DITHER
13
VSPHO
5
12
VSPSU
4
DISPPOL
8
MODE
1
VSPOL
0
HSPOL
684
Name
Description
OUTPUT_12BPP
OUTPUT_16BPP
OUTPUT_18BPP
OUTPUT_24BPP
685
32.7.7
Name:
LCDC_LCDCFG6
Address:
0xF0000018
Access:
Read/Write
31
23
15
30
22
14
29
21
13
28
20
12
27
19
11
26
18
10
25
17
24
16
PWMCVAL
4
3
PWMPOL
1
PWMPS
Name
Description
000
DIV_1
001
DIV_2
010
DIV_4
011
DIV_8
100
DIV_16
101
DIV_32
110
DIV_64
686
32.7.8
Name:
LCDC_LCDEN
Address:
0xF0000020
Access:
Write-only
31
23
15
30
22
14
29
21
13
28
20
12
27
19
11
3
PWMEN
26
18
10
2
DISPEN
25
17
1
SYNCEN
24
16
0
CLKEN
687
32.7.9
Name:
LCDC_LCDDIS
Address:
0xF0000024
Access:
Write-only
31
23
15
30
22
14
29
21
13
28
20
12
27
19
11
PWMRST
3
PWMDIS
26
18
10
DISPRST
2
DISPDIS
688
25
17
9
SYNCRST
1
SYNCDIS
24
16
8
CLKRST
0
CLKDIS
LCDC_LCDSR
Address:
0xF0000028
Access:
Read-only
31
23
15
30
22
14
29
21
13
28
20
12
4
SIPSTS
27
19
11
3
PWMSTS
26
18
10
2
DISPSTS
25
17
1
LCDSTS
24
16
0
CLKSTS
689
LCDC_LCDIER
Address:
0xF000002C
Access:
Write-only
31
23
15
30
22
14
29
21
13
28
20
12
4
FIFOERRIE
27
19
11
HEOIE
3
26
18
10
OVR2IE
2
DISPIE
690
25
17
9
OVR1IE
1
DISIE
24
16
8
BASEIE
0
SOFIE
LCDC_LCDIDR
Address:
0xF0000030
Access:
Write-only
31
23
15
30
22
14
29
21
13
28
20
12
4
FIFOERRID
27
19
11
HEOID
3
26
18
10
OVR2ID
2
DISPID
25
17
9
OVR1ID
1
DISID
24
16
8
BASEID
0
SOFID
691
LCDC_LCDIMR
Address:
0xF0000034
Access:
Read-only
31
23
15
30
22
14
29
21
13
28
20
12
4
FIFOERRIM
27
19
11
HEOIM
3
692
26
18
10
OVR2IM
2
DISPIM
25
17
9
OVR1IM
1
DISIM
24
16
8
BASEIM
0
SOFIM
LCDC_LCDISR
Address:
0xF0000038
Access:
Read-only
31
23
15
30
22
14
29
21
13
28
20
12
4
FIFOERR
27
19
11
HEO
3
26
18
10
OVR2
2
DISP
25
17
9
OVR1
1
DIS
24
16
8
BASE
0
SOF
693
LCDC_ATTR
Address:
0xF000003C
Access:
Write-only
31
23
15
30
22
14
29
21
13
28
20
12
27
19
11
HEOA2Q
3
HEO
26
18
10
OVR2A2Q
2
OVR2
694
25
17
9
OVR1A2Q
1
OVR1
24
16
8
BASEA2Q
0
BASE
LCDC_BASECHER
Address:
0xF0000040
Access:
Write-only
31
23
15
30
22
14
29
21
13
28
20
12
27
19
11
26
18
10
2
A2QEN
25
17
1
UPDATEEN
24
16
0
CHEN
695
LCDC_BASECHDR
Address:
0xF0000044
Access:
Write-only
31
23
15
30
22
14
29
21
13
28
20
12
27
19
11
696
26
18
10
25
17
24
16
8
CHRST
0
CHDIS
LCDC_BASECHSR
Address:
0xF0000048
Access:
Read-only
31
23
15
30
22
14
29
21
13
28
20
12
27
19
11
26
18
10
2
A2QSR
25
17
1
UPDATESR
24
16
0
CHSR
697
LCDC_BASEIER
Address:
0xF000004C
Access:
Write-only
31
23
15
30
22
14
6
OVR
29
21
13
5
DONE
28
20
12
4
ADD
698
27
19
11
3
DSCR
26
18
10
2
DMA
25
17
24
16
LCDC_BASEIDR
Address:
0xF0000050
Access:
Write-only
31
23
15
30
22
14
6
OVR
29
21
13
5
DONE
28
20
12
4
ADD
27
19
11
3
DSCR
26
18
10
2
DMA
25
17
24
16
699
LCDC_BASEIMR
Address:
0xF0000054
Access:
Read-only
31
23
15
30
22
14
6
OVR
29
21
13
5
DONE
28
20
12
4
ADD
700
27
19
11
3
DSCR
26
18
10
2
DMA
25
17
24
16
LCDC_BASEISR
Address:
0xF0000058
Access:
Read-only
31
23
15
30
22
14
6
OVR
29
21
13
5
DONE
28
20
12
4
ADD
27
19
11
3
DSCR
26
18
10
2
DMA
25
17
24
16
701
LCDC_BASEHEAD
Address:
0xF000005C
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
HEAD
23
22
21
20
HEAD
15
14
13
12
HEAD
4
HEAD
702
LCDC_BASEADDR
Address:
0xF0000060
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ADDR
23
22
21
20
ADDR
15
14
13
12
ADDR
4
ADDR
703
LCDC_BASECTRL
Address:
0xF0000064
Access:
Read/Write
31
23
15
30
22
14
29
21
13
5
DONEIEN
28
20
12
4
ADDIEN
704
27
19
11
3
DSCRIEN
26
18
10
2
DMAIEN
25
17
1
LFETCH
24
16
0
DFETCH
LCDC_BASENEXT
Address:
0xF0000068
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
NEXT
23
22
21
20
NEXT
15
14
13
12
NEXT
4
NEXT
705
LCDC_BASECFG0
Address:
0xF000006C
Access:
Read/Write
31
23
15
30
22
14
29
21
13
28
20
12
4
BLEN
27
19
11
26
18
10
25
17
24
16
8
DLBO
0
SIF
Name
Description
AHB_SINGLE
AHB Access is started as soon as there is enough space in the FIFO to store one data. SINGLE,
INCR, INCR4, INCR8 and INCR16 bursts are used. INCR is used for a burst of 2 and 3 beats.
AHB_INCR4
AHB Access is started as soon as there is enough space in the FIFO to store a total amount of 4
data. An AHB INCR4 Burst is used. SINGLE, INCR and INCR4 bursts are used. INCR is used for a
burst of 2 and 3 beats.
AHB_INCR8
AHB Access is started as soon as there is enough space in the FIFO to store a total amount of 8
data. An AHB INCR8 Burst is used. SINGLE, INCR, INCR4 and INCR8 bursts are used. INCR is
used for a burst of 2 and 3 beats.
AHB_INCR16
AHB Access is started as soon as there is enough space in the FIFO to store a total amount of 16
data. An AHB INCR16 Burst is used. SINGLE, INCR, INCR4, INCR8 and INCR16 bursts are used.
INCR is used for a burst of 2 and 3 beats.
706
LCDC_BASECFG1
Address:
0xF0000070
Access:
Read/Write
31
23
15
30
22
14
29
21
13
28
20
12
RGBMODE
27
19
11
26
18
10
25
17
24
16
8
CLUTMODE
0
CLUTEN
Name
Description
12BPP_RGB_444
16BPP_ARGB_4444
16BPP_RGBA_4444
16BPP_RGB_565
16BPP_TRGB_1555
18BPP_RGB_666
18BPP_RGB_666PACKED
19BPP_TRGB_1666
19BPP_TRGB_PACKED
24BPP_RGB_888
10
24BPP_RGB_888_PACKED
11
25BPP_TRGB_1888
12
32BPP_ARGB_8888
13
32BPP_RGBA_8888
Name
Description
CLUT_1BPP
CLUT_2BPP
CLUT_4BPP
CLUT_8BPP
707
LCDC_BASECFG2
Address:
0xF0000074
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
XSTRIDE
23
22
21
20
XSTRIDE
15
14
13
12
XSTRIDE
4
XSTRIDE
708
LCDC_BASECFG3
Address:
0xF0000078
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
18
25
17
24
16
11
10
RDEF
15
14
13
12
GDEF
4
BDEF
709
LCDC_BASECFG4
Address:
0xF000007C
Access:
Read/Write
31
23
15
30
22
14
29
21
13
28
20
12
27
19
11
DISCEN
3
26
18
10
25
17
9
REP
1
24
16
8
DMA
0
710
LCDC_BASECFG5
Address:
0xF0000080
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
11
10
18
25
DISCYPOS
17
24
9
DISCXPOS
1
16
DISCYPOS
15
14
13
12
DISCXPOS
711
LCDC_BASECFG6
Address:
0xF0000084
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
11
10
18
25
DISCYSIZE
17
24
9
DISCXSIZE
1
16
DISCYSIZE
15
14
13
12
4
DISCXSIZE
712
LCDC_OVR1CHER
Address:
0xF0000140
Access:
Write-only
31
23
15
30
22
14
29
21
13
28
20
12
27
19
11
26
18
10
2
A2QEN
25
17
1
UPDATEEN
24
16
0
CHEN
713
LCDC_OVR1CHDR
Address:
0xF0000144
Access:
Write-only
31
23
15
30
22
14
29
21
13
28
20
12
27
19
11
714
26
18
10
25
17
24
16
8
CHRST
0
CHDIS
LCDC_OVR1CHSR
Address:
0xF0000148
Access:
Read-only
31
23
15
30
22
14
29
21
13
28
20
12
27
19
11
26
18
10
2
A2QSR
25
17
1
UPDATESR
24
16
0
CHSR
715
LCDC_OVR1IER
Address:
0xF000014C
Access:
Write-only
31
23
15
30
22
14
6
OVR
29
21
13
5
DONE
28
20
12
4
ADD
716
27
19
11
3
DSCR
26
18
10
2
DMA
25
17
24
16
LCDC_OVR1IDR
Address:
0xF0000150
Access:
Write-only
31
23
15
30
22
14
6
OVR
29
21
13
5
DONE
28
20
12
4
ADD
27
19
11
3
DSCR
26
18
10
2
DMA
25
17
24
16
717
LCDC_OVR1IMR
Address:
0xF0000154
Access:
Read-only
31
23
15
30
22
14
6
OVR
29
21
13
5
DONE
28
20
12
4
ADD
718
27
19
11
3
DSCR
26
18
10
2
DMA
25
17
24
16
LCDC_OVR1ISR
Address:
0xF0000158
Access:
Read-only
31
23
15
30
22
14
6
OVR
29
21
13
5
DONE
28
20
12
4
ADD
27
19
11
3
DSCR
26
18
10
2
DMA
25
17
24
16
719
LCDC_OVR1HEAD
Address:
0xF000015C
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
HEAD
23
22
21
20
HEAD
15
14
13
12
HEAD
4
HEAD
720
LCDC_OVR1ADDR
Address:
0xF0000160
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ADDR
23
22
21
20
ADDR
15
14
13
12
ADDR
4
ADDR
721
LCDC_OVR1CTRL
Address:
0xF0000164
Access:
Read/Write
31
23
15
30
22
14
29
21
13
5
DONEIEN
28
20
12
4
ADDIEN
722
27
19
11
3
DSCRIEN
26
18
10
2
DMAIEN
25
17
1
LFETCH
24
16
0
DFETCH
LCDC_OVR1NEXT
Address:
0xF0000168
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
NEXT
23
22
21
20
NEXT
15
14
13
12
NEXT
4
NEXT
723
LCDC_OVR1CFG0
Address:
0xF000016C
Access:
Read/Write
31
23
15
30
22
14
29
21
13
LOCKDIS
5
28
20
12
ROTDIS
4
BLEN
27
19
11
26
18
10
25
17
24
16
8
DLBO
0
SIF
Name
Description
AHB_BLEN_SINGLE
AHB Access is started as soon as there is enough space in the FIFO to store one data. SINGLE,
INCR, INCR4, INCR8 and INCR16 bursts are used. INCR is used for a burst of 2 and 3 beats.
AHB_BLEN_INCR4
AHB Access is started as soon as there is enough space in the FIFO to store a total amount of 4
data. An AHB INCR4 Burst is used. SINGLE, INCR and INCR4 bursts are used. INCR is used for a
burst of 2 and 3 beats.
AHB_BLEN_INCR8
AHB Access is started as soon as there is enough space in the FIFO to store a total amount of 8
data. An AHB INCR8 Burst is used. SINGLE, INCR, INCR4 and INCR8 bursts are used. INCR is
used for a burst of 2 and 3 beats.
AHB_BLEN_INCR16
AHB Access is started as soon as there is enough space in the FIFO to store a total amount of 16
data. An AHB INCR16 Burst is used. SINGLE, INCR, INCR4, INCR8 and INCR16 bursts are used.
INCR is used for a burst of 2 and 3 beats.
724
LCDC_OVR1CFG1
Address:
0xF0000170
Access:
Read/Write
31
23
15
30
22
14
29
21
13
28
20
12
RGBMODE
27
19
11
26
18
10
25
17
24
16
8
CLUTMODE
0
CLUTEN
Name
Description
12BPP_RGB_444
16BPP_ARGB_4444
16BPP_RGBA_4444
16BPP_RGB_565
16BPP_TRGB_1555
18BPP_RGB_666
18BPP_RGB_666PACKED
19BPP_TRGB_1666
19BPP_TRGB_PACKED
24BPP_RGB_888
10
24BPP_RGB_888_PACKED
11
25BPP_TRGB_1888
12
32BPP_ARGB_8888
13
32BPP_RGBA_8888
Name
Description
CLUT_1BPP
CLUT_2BPP
CLUT_4BPP
CLUT_8BPP
725
LCDC_OVR1CFG2
Address:
0xF0000174
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
11
10
18
25
YPOS
17
24
9
XPOS
1
16
YPOS
15
14
13
12
4
XPOS
726
LCDC_OVR1CFG3
Address:
0xF0000178
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
11
10
18
25
YSIZE
17
24
9
XSIZE
1
16
YSIZE
15
14
13
12
XSIZE
727
LCDC_OVR1CFG4
Address:
0xF000017C
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
XSTRIDE
23
22
21
20
XSTRIDE
15
14
13
12
XSTRIDE
4
XSTRIDE
728
LCDC_OVR1CFG5
Address:
0xF0000180
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
PSTRIDE
23
22
21
20
PSTRIDE
15
14
13
12
PSTRIDE
4
PSTRIDE
729
LCDC_OVR1CFG6
Address:
0xF0000184
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
18
25
17
24
16
11
10
RDEF
15
14
13
12
GDEF
4
BDEF
730
LCDC_OVR1CFG7
Address:
0xF0000188
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
18
25
17
24
16
11
10
RKEY
15
14
13
12
GKEY
4
BKEY
731
LCDC_OVR1CFG8
Address:
0xF000018C
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
18
25
17
24
16
11
10
RMASK
15
14
13
12
GMASK
4
BMASK
732
LCDC_OVR1CFG9
Address:
0xF0000190
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
18
25
17
24
16
11
3
ITER
10
DSTKEY
2
ITER2BL
9
REP
1
INV
8
DMA
0
CRKEY
GA
15
7
OVR
14
6
LAEN
13
5
GAEN
12
4
REVALPHA
733
734
LCDC_OVR2CHER
Address:
0xF0000240
Access:
Write-only
31
23
15
30
22
14
29
21
13
28
20
12
27
19
11
26
18
10
2
A2QEN
25
17
1
UPDATEEN
24
16
0
CHEN
735
LCDC_OVR2CHDR
Address:
0xF0000244
Access:
Write-only
31
23
15
30
22
14
29
21
13
28
20
12
27
19
11
736
26
18
10
25
17
24
16
8
CHRST
0
CHDIS
LCDC_OVR2CHSR
Address:
0xF0000248
Access:
Read-only
31
23
15
30
22
14
29
21
13
28
20
12
27
19
11
26
18
10
2
A2QSR
25
17
1
UPDATESR
24
16
0
CHSR
737
LCDC_OVR2IER
Address:
0xF000024C
Access:
Write-only
31
23
15
30
22
14
6
OVR
29
21
13
5
DONE
28
20
12
4
ADD
738
27
19
11
3
DSCR
26
18
10
2
DMA
25
17
24
16
LCDC_OVR2IDR
Address:
0xF0000250
Access:
Write-only
31
23
15
30
22
14
6
OVR
29
21
13
5
DONE
28
20
12
4
ADD
27
19
11
3
DSCR
26
18
10
2
DMA
25
17
24
16
739
LCDC_OVR2IMR
Address:
0xF0000254
Access:
Read-only
31
23
15
30
22
14
6
OVR
29
21
13
5
DONE
28
20
12
4
ADD
740
27
19
11
3
DSCR
26
18
10
2
DMA
25
17
24
16
LCDC_OVR2ISR
Address:
0xF0000258
Access:
Read-only
31
23
15
30
22
14
6
OVR
29
21
13
5
DONE
28
20
12
4
ADD
27
19
11
3
DSCR
26
18
10
2
DMA
25
17
24
16
741
LCDC_OVR2HEAD
Address:
0xF000025C
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
HEAD
23
22
21
20
HEAD
15
14
13
12
HEAD
4
HEAD
742
LCDC_OVR2ADDR
Address:
0xF0000260
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ADDR
23
22
21
20
ADDR
15
14
13
12
ADDR
4
ADDR
743
LCDC_OVR2CTRL
Address:
0xF0000264
Access:
Read/Write
31
23
15
30
22
14
29
21
13
5
DONEIEN
28
20
12
4
ADDIEN
744
27
19
11
3
DSCRIEN
26
18
10
2
DMAIEN
25
17
1
LFETCH
24
16
0
DFETCH
LCDC_OVR2NEXT
Address:
0xF0000268
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
NEXT
23
22
21
20
NEXT
15
14
13
12
NEXT
4
NEXT
745
LCDC_OVR2CFG0
Address:
0xF000026C
Access:
Read/Write
31
23
15
30
22
14
29
21
13
LOCKDIS
5
28
20
12
ROTDIS
4
BLEN
27
19
11
26
18
10
25
17
24
16
8
DLBO
0
Name
Description
AHB_SINGLE
AHB Access is started as soon as there is enough space in the FIFO to store one data. SINGLE,
INCR, INCR4, INCR8 and INCR16 bursts are used. INCR is used for a burst of 2 and 3 beats.
AHB_INCR4
AHB Access is started as soon as there is enough space in the FIFO to store a total amount of 4
data. An AHB INCR4 Burst is used. SINGLE, INCR and INCR4 bursts are used. INCR is used for a
burst of 2 and 3 beats.
AHB_INCR8
AHB Access is started as soon as there is enough space in the FIFO to store a total amount of 8
data. An AHB INCR8 Burst is used. SINGLE, INCR, INCR4 and INCR8 bursts are used. INCR is
used for a burst of 2 and 3 beats.
AHB_INCR16
AHB Access is started as soon as there is enough space in the FIFO to store a total amount of 16
data. An AHB INCR16 Burst is used. SINGLE, INCR, INCR4, INCR8 and INCR16 bursts are used.
INCR is used for a burst of 2 and 3 beats.
746
LCDC_OVR2CFG1
Address:
0xF0000270
Access:
Read/Write
31
23
15
30
22
14
29
21
13
28
20
12
RGBMODE
27
19
11
26
18
10
25
17
24
16
8
CLUTMODE
0
CLUTEN
Name
Description
12BPP_RGB_444
16BPP_ARGB_4444
16BPP_RGBA_4444
16BPP_RGB_565
16BPP_TRGB_1555
18BPP_RGB_666
18BPP_RGB_666PACKED
19BPP_TRGB_1666
19BPP_TRGB_PACKED
24BPP_RGB_888
10
24BPP_RGB_888_PACKED
11
25BPP_TRGB_1888
12
32BPP_ARGB_8888
13
32BPP_RGBA_8888
Name
Description
CLUT_1BPP
CLUT_2BPP
CLUT_4BPP
CLUT_8BPP
747
LCDC_OVR2CFG2
Address:
0xF0000274
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
11
10
18
25
YPOS
17
24
9
XPOS
1
16
YPOS
15
14
13
12
4
XPOS
748
LCDC_OVR2CFG3
Address:
0xF0000278
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
11
10
18
25
YSIZE
17
24
9
XSIZE
1
16
YSIZE
15
14
13
12
XSIZE
749
LCDC_OVR2CFG4
Address:
0xF000027C
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
XSTRIDE
23
22
21
20
XSTRIDE
15
14
13
12
XSTRIDE
4
XSTRIDE
750
LCDC_OVR2CFG5
Address:
0xF0000280
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
PSTRIDE
23
22
21
20
PSTRIDE
15
14
13
12
PSTRIDE
4
PSTRIDE
751
LCDC_OVR2CFG6
Address:
0xF0000284
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
18
25
17
24
16
11
10
RDEF
15
14
13
12
GDEF
4
BDEF
752
LCDC_OVR2CFG7
Address:
0xF0000288
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
18
25
17
24
16
11
10
RKEY
15
14
13
12
GKEY
4
BKEY
753
LCDC_OVR2CFG8
Address:
0xF000028C
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
18
25
17
24
16
11
10
RMASK
15
14
13
12
GMASK
4
BMASK
754
LCDC_OVR2CFG9
Address:
0xF0000290
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
18
25
17
24
16
11
3
ITER
10
DSTKEY
2
ITER2BL
9
REP
1
INV
8
DMA
0
CRKEY
GA
15
7
OVR
14
6
LAEN
13
5
GAEN
12
4
REVALPHA
755
756
LCDC_HEOCHER
Address:
0xF0000340
Access:
Write-only
31
23
15
30
22
14
29
21
13
28
20
12
27
19
11
26
18
10
2
A2QEN
25
17
1
UPDATEEN
24
16
0
CHEN
757
LCDC_HEOCHDR
Address:
0xF0000344
Access:
Write-only
31
23
15
30
22
14
29
21
13
28
20
12
27
19
11
758
26
18
10
25
17
24
16
8
CHRST
0
CHDIS
LCDC_HEOCHSR
Address:
0xF0000348
Access:
Read-only
31
23
15
30
22
14
29
21
13
28
20
12
27
19
11
26
18
10
2
A2QSR
25
17
1
UPDATESR
24
16
0
CHSR
759
LCDC_HEOIER
Address:
0xF000034C
Access:
Write-only
31
23
15
30
22
VOVR
14
UOVR
6
OVR
29
21
VDONE
13
UDONE
5
DONE
28
20
VADD
12
UADD
4
ADD
27
19
VDSCR
11
UDSCR
3
DSCR
26
18
VDMA
10
UDMA
2
DMA
760
25
17
24
16
761
LCDC_HEOIDR
Address:
0xF0000350
Access:
Write-only
31
23
15
30
22
VOVR
14
UOVR
6
OVR
29
21
VDONE
13
UDONE
5
DONE
28
20
VADD
12
UADD
4
ADD
27
19
VDSCR
11
UDSCR
3
DSCR
26
18
VDMA
10
UDMA
2
DMA
25
17
762
24
16
763
LCDC_HEOIMR
Address:
0xF0000354
Access:
Read-only
31
23
15
30
22
VOVR
14
UOVR
6
OVR
29
21
VDONE
13
UDONE
5
DONE
28
20
VADD
12
UADD
4
ADD
27
19
VDSCR
11
UDSCR
3
DSCR
26
18
VDMA
10
UDMA
2
DMA
25
17
764
24
16
765
LCDC_HEOISR
Address:
0xF0000358
Access:
Read-only
31
23
15
30
22
VOVR
14
UOVR
6
OVR
29
21
VDONE
13
UDONE
5
DONE
28
20
VADD
12
UADD
4
ADD
27
19
VDSCR
11
UDSCR
3
DSCR
26
18
VDMA
10
UDMA
2
DMA
25
17
24
16
767
LCDC_HEOHEAD
Address:
0xF000035C
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
HEAD
23
22
21
20
HEAD
15
14
13
12
HEAD
4
HEAD
768
LCDC_HEOADDR
Address:
0xF0000360
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ADDR
23
22
21
20
ADDR
15
14
13
12
ADDR
4
ADDR
769
LCDC_HEOCTRL
Address:
0xF0000364
Access:
Read/Write
31
23
15
30
22
14
29
21
13
5
DONEIEN
28
20
12
4
ADDIEN
770
27
19
11
3
DSCRIEN
26
18
10
2
DMAIEN
25
17
1
LFETCH
24
16
0
DFETCH
LCDC_HEONEXT
Address:
0xF0000368
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
NEXT
23
22
21
20
NEXT
15
14
13
12
NEXT
4
NEXT
771
LCDC_HEOUHEAD
Address:
0xF000036C
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
UHEAD
23
22
21
20
UHEAD
15
14
13
12
UHEAD
4
UHEAD
772
LCDC_HEOUADDR
Address:
0xF0000370
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
UADDR
23
22
21
20
UADDR
15
14
13
12
UADDR
4
UADDR
773
LCDC_HEOUCTRL
Address:
0xF0000374
Access:
Read/Write
31
23
15
30
22
14
29
21
13
5
UDONEIEN
28
20
12
4
UADDIEN
27
19
11
3
UDSCRIEN
774
26
18
10
2
UDMAIEN
25
17
24
16
0
UDFETCH
LCDC_HEOUNEXT
Address:
0xF0000378
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
UNEXT
23
22
21
20
UNEXT
15
14
13
12
UNEXT
4
UNEXT
775
LCDC_HEOVHEAD
Address:
0xF000037C
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
VHEAD
23
22
21
20
VHEAD
15
14
13
12
VHEAD
4
VHEAD
776
LCDC_HEOVADDR
Address:
0xF0000380
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
VADDR
23
22
21
20
VADDR
15
14
13
12
VADDR
4
VADDR
777
LCDC_HEOVCTRL
Address:
0xF0000384
Access:
Read/Write
31
23
15
30
22
14
29
21
13
5
VDONEIEN
28
20
12
4
VADDIEN
27
19
11
3
VDSCRIEN
778
26
18
10
2
VDMAIEN
25
17
24
16
0
VDFETCH
LCDC_HEOVNEXT
Address:
0xF0000388
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
VNEXT
23
22
21
20
VNEXT
15
14
13
12
VNEXT
4
VNEXT
779
LCDC_HEOCFG0
Address:
0xF000038C
Access:
Read/Write
31
23
15
30
22
14
29
21
13
LOCKDIS
5
BLENUV
28
20
12
ROTDIS
4
BLEN
27
19
11
26
18
10
25
17
24
16
8
DLBO
0
SIF
Name
Description
AHB_BLEN_SINGLE
AHB Access is started as soon as there is enough space in the FIFO to store one data. SINGLE,
INCR, INCR4, INCR8 and INCR16 bursts are used. INCR is used for a burst of 2 and 3 beats.
AHB_BLEN_INCR4
AHB Access is started as soon as there is enough space in the FIFO to store a total amount of 4
data. An AHB INCR4 Burst is used. SINGLE, INCR and INCR4 bursts are used. INCR is used for a
burst of 2 and 3 beats.
AHB_BLEN_INCR8
AHB Access is started as soon as there is enough space in the FIFO to store a total amount of 8
data. An AHB INCR8 Burst is used. SINGLE, INCR, INCR4 and INCR8 bursts are used. INCR is
used for a burst of 2 and 3 beats.
AHB_BLEN_INCR16
AHB Access is started as soon as there is enough space in the FIFO to store a total amount of 16
data. An AHB INCR16 Burst is used. SINGLE, INCR, INCR4, INCR8 and INCR16 bursts are used.
INCR is used for a burst of 2 and 3 beats.
Name
Description
AHB_SINGLE
AHB Access is started as soon as there is enough space in the FIFO to store one data. SINGLE,
INCR, INCR4, INCR8 and INCR16 bursts are used. INCR is used for a burst of 2 and 3 beats.
AHB_INCR4
AHB Access is started as soon as there is enough space in the FIFO to store a total amount of 4
data. An AHB INCR4 Burst is used. SINGLE, INCR and INCR4 bursts are used. INCR is used for a
burst of 2 and 3 beats.
AHB_INCR8
AHB Access is started as soon as there is enough space in the FIFO to store a total amount of 8
data. An AHB INCR8 Burst is used. SINGLE, INCR, INCR4 and INCR8 bursts are used. INCR is
used for a burst of 2 and 3 beats.
AHB_INCR16
AHB Access is started as soon as there is enough space in the FIFO to store a total amount of 16
data. An AHB INCR16 Burst is used. SINGLE, INCR, INCR4, INCR8 and INCR16 bursts are used.
INCR is used for a burst of 2 and 3 beats.
781
LCDC_HEOCFG1
Address:
0xF0000390
Access:
Read/Write
31
23
15
30
22
14
29
21
13
28
20
DSCALEOPT
12
YUVMODE
RGBMODE
27
19
11
Name
Description
12BPP_RGB_444
16BPP_ARGB_4444
16BPP_RGBA_4444
16BPP_RGB_565
16BPP_TRGB_1555
18BPP_RGB_666
18BPP_RGB_666PACKED
19BPP_TRGB_1666
19BPP_TRGB_PACKED
24BPP_RGB_888
10
24BPP_RGB_888_PACKED
11
25BPP_TRGB_1888
12
32BPP_ARGB_8888
13
32BPP_RGBA_8888
782
26
18
10
25
24
17
16
YUV422SWP
YUV422ROT
9
8
CLUTMODE
1
0
YUVEN
CLUTEN
Name
Description
CLUT_1BPP
CLUT_2BPP
CLUT_4BPP
CLUT_8BPP
Name
Description
32BPP_AYCBCR
16BPP_YCBCR_MODE0
16BPP_YCBCR_MODE1
16BPP_YCBCR_MODE2
16BPP_YCBCR_MODE3
16BPP_YCBCR_SEMIPLANAR
16BPP_YCBCR_PLANAR
12BPP_YCBCR_SEMIPLANAR
12BPP_YCBCR_PLANAR
783
LCDC_HEOCFG2
Address:
0xF0000394
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
11
10
18
25
YPOS
17
24
9
XPOS
1
16
YPOS
15
14
13
12
4
XPOS
784
LCDC_HEOCFG3
Address:
0xF0000398
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
11
10
18
25
YSIZE
17
24
9
XSIZE
1
16
YSIZE
15
14
13
12
XSIZE
785
LCDC_HEOCFG4
Address:
0xF000039C
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
11
10
18
25
YMEMSIZE
17
24
9
XMEMSIZE
1
16
YMEMSIZE
15
14
13
12
XMEMSIZE
786
LCDC_HEOCFG5
Address:
0xF00003A0
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
XSTRIDE
23
22
21
20
XSTRIDE
15
14
13
12
XSTRIDE
4
XSTRIDE
787
LCDC_HEOCFG6
Address:
0xF00003A4
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
PSTRIDE
23
22
21
20
PSTRIDE
15
14
13
12
PSTRIDE
4
PSTRIDE
788
LCDC_HEOCFG7
Address:
0xF00003A8
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
UVXSTRIDE
23
22
21
20
UVXSTRIDE
15
14
13
12
UVXSTRIDE
4
UVXSTRIDE
789
LCDC_HEOCFG8
Address:
0xF00003AC
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
UVPSTRIDE
23
22
21
20
UVPSTRIDE
15
14
13
12
UVPSTRIDE
4
UVPSTRIDE
790
LCDC_HEOCFG9
Address:
0xF00003B0
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
18
25
17
24
16
11
10
RDEF
15
14
13
12
GDEF
4
BDEF
791
LCDC_HEOCFG10
Address:
0xF00003B4
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
18
25
17
24
16
11
10
RKEY
15
14
13
12
GKEY
4
BKEY
792
LCDC_HEOCFG11
Address:
0xF00003B8
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
18
25
17
24
16
11
10
RMASK
15
14
13
12
GMASK
4
BMASK
793
LCDC_HEOCFG12
Address:
0xF00003BC
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
18
25
17
24
16
11
3
ITER
10
DSTKEY
2
ITER2BL
9
REP
1
INV
8
DMA
0
CRKEY
GA
15
7
OVR
14
6
LAEN
13
5
GAEN
12
VIDPRI
4
REVALPHA
794
795
LCDC_HEOCFG13
Address:
0xF00003C0
Access:
Read/Write
31
SCALEN
23
30
22
29
28
27
26
25
24
18
17
16
10
YFACTOR
21
20
19
YFACTOR
15
14
13
12
11
XFACTOR
3
XFACTOR
796
LCDC_HEOCFG14
Address:
0xF00003C4
Access:
Read/Write
31
23
15
30
CSCYOFF
22
CSCRV
14
29
28
27
26
25
24
17
16
CSCRV
21
20
19
18
CSCRU
13
12
11
10
CSCRU
7
8
CSCRY
CSCRY
CSCRY: Color Space Conversion Y coefficient for Red Component 1:2:7 format
Color Space Conversion coefficient format is 1 sign bit, 2 magnitude bits and 7 fractional bits.
CSCRU: Color Space Conversion U coefficient for Red Component 1:2:7 format
Color Space Conversion coefficient format is 1 sign bit, 2 magnitude bits and 7 fractional bits.
CSCRV: Color Space Conversion V coefficient for Red Component 1:2:7 format
Color Space Conversion coefficient format is 1 sign bit, 2 magnitude bits and 7 fractional bits.
CSCYOFF: Color Space Conversion Offset
0: Offset is set to 0
1: Offset is set to 16
797
LCDC_HEOCFG15
Address:
0xF00003C8
Access:
Read/Write
31
23
15
30
CSCUOFF
22
CSCGV
14
29
28
27
26
25
24
17
16
CSCGV
21
20
19
18
CSCGU
13
12
11
10
CSCGU
7
CSCGY
CSCGY: Color Space Conversion Y coefficient for Green Component 1:2:7 format
Color Space Conversion coefficient format is 1 sign bit, 2 magnitude bits and 7 fractional bits.
CSCGU: Color Space Conversion U coefficient for Green Component 1:2:7 format
Color Space Conversion coefficient format is 1 sign bit, 2 magnitude bits and 7 fractional bits.
CSCGV: Color Space Conversion V coefficient for Green Component 1:2:7 format
Color Space Conversion coefficient format is 1 sign bit, 2 magnitude bits and 7 fractional bits.
CSCUOFF: Color Space Conversion Offset
0: Offset is set to 0
1: Offset is set to 128
798
8
CSCGY
LCDC_HEOCFG16
Address:
0xF00003CC
Access:
Read/Write
31
23
15
30
CSCVOFF
22
CSCBV
14
29
28
27
26
25
24
17
16
CSCBV
21
20
19
18
CSCBU
13
12
11
10
CSCBU
7
8
CSCBY
CSCBY
CSCBY: Color Space Conversion Y coefficient for Blue Component 1:2:7 format
Color Space Conversion coefficient format is 1 sign bit, 2 magnitude bits and 7 fractional bits.
CSCBU: Color Space Conversion U coefficient for Blue Component 1:2:7 format
Color Space Conversion coefficient format is 1 sign bit, 2 magnitude bits and 7 fractional bits.
CSCBV: Color Space Conversion V coefficient for Blue Component 1:2:7 format
Color Space Conversion coefficient format is 1 sign bit, 2 magnitude bits and 7 fractional bits.
CSCVOFF: Color Space Conversion Offset
0: Offset is set to 0
1: Offset is set to 128
799
LCDC_HEOCFG17
Address:
0xF00003D0
Access:
Read/Write
31
30
29
23
22
21
15
14
13
28
27
XPHI0COEFF3
20
19
XPHI0COEFF2
12
11
XPHI0COEFF1
4
3
XPHI0COEFF0
800
26
25
24
18
17
16
10
LCDC_HEOCFG18
Address:
0xF00003D4
Access:
Read/Write
31
23
15
30
22
14
29
21
13
28
27
20
19
12
11
4
3
XPHI0COEFF4
26
18
10
25
17
24
16
801
LCDC_HEOCFG19
Address:
0xF00003D8
Access:
Read/Write
31
30
29
23
22
21
15
14
13
28
27
XPHI1COEFF3
20
19
XPHI1COEFF2
12
11
XPHI1COEFF1
4
3
XPHI1COEFF0
802
26
25
24
18
17
16
10
LCDC_HEOCFG20
Address:
0xF00003DC
Access:
Read/Write
31
23
15
30
22
14
29
21
13
28
27
20
19
12
11
4
3
XPHI1COEFF4
26
18
10
25
17
24
16
803
LCDC_HEOCFG21
Address:
0xF00003E0
Access:
Read/Write
31
30
29
23
22
21
15
14
13
28
27
XPHI2COEFF3
20
19
XPHI2COEFF2
12
11
XPHI2COEFF1
4
3
XPHI2COEFF0
804
26
25
24
18
17
16
10
LCDC_HEOCFG22
Address:
0xF00003E4
Access:
Read/Write
31
23
15
30
22
14
29
21
13
28
27
20
19
12
11
4
3
XPHI2COEFF4
26
18
10
25
17
24
16
805
LCDC_HEOCFG23
Address:
0xF00003E8
Access:
Read/Write
31
30
29
23
22
21
15
14
13
28
27
XPHI3COEFF3
20
19
XPHI3COEFF2
12
11
XPHI3COEFF1
4
3
XPHI3COEFF0
806
26
25
24
18
17
16
10
LCDC_HEOCFG24
Address:
0xF00003EC
Access:
Read/Write
31
23
15
30
22
14
29
21
13
28
27
20
19
12
11
4
3
XPHI3COEFF4
26
18
10
25
17
24
16
807
LCDC_HEOCFG25
Address:
0xF00003F0
Access:
Read/Write
31
30
29
23
22
21
15
14
13
28
27
XPHI4COEFF3
20
19
XPHI4COEFF2
12
11
XPHI4COEFF1
4
3
XPHI4COEFF0
808
26
25
24
18
17
16
10
LCDC_HEOCFG26
Address:
0xF00003F4
Access:
Read/Write
31
23
15
30
22
14
29
21
13
28
27
20
19
12
11
4
3
XPHI4COEFF4
26
18
10
25
17
24
16
809
LCDC_HEOCFG27
Address:
0xF00003F8
Access:
Read/Write
31
30
29
23
22
21
15
14
13
28
27
XPHI5COEFF3
20
19
XPHI5COEFF2
12
11
XPHI5COEFF1
4
3
XPHI5COEFF0
810
26
25
24
18
17
16
10
LCDC_HEOCFG28
Address:
0xF00003FC
Access:
Read/Write
31
23
15
30
22
14
29
21
13
28
27
20
19
12
11
4
3
XPHI5COEFF4
26
18
10
25
17
24
16
811
LCDC_HEOCFG29
Address:
0xF0000400
Access:
Read/Write
31
30
29
23
22
21
15
14
13
28
27
XPHI6COEFF3
20
19
XPHI6COEFF2
12
11
XPHI6COEFF1
4
3
XPHI6COEFF0
812
26
25
24
18
17
16
10
LCDC_HEOCFG30
Address:
0xF0000404
Access:
Read/Write
31
23
15
30
22
14
29
21
13
28
27
20
19
12
11
4
3
XPHI6COEFF4
26
18
10
25
17
24
16
813
LCDC_HEOCFG31
Address:
0xF0000408
Access:
Read/Write
31
30
29
23
22
21
15
14
13
28
27
XPHI7COEFF3
20
19
XPHI7COEFF2
12
11
XPHI7COEFF1
4
3
XPHI7COEFF0
814
26
25
24
18
17
16
10
LCDC_HEOCFG32
Address:
0xF000040C
Access:
Read/Write
31
23
15
30
22
14
29
21
13
28
27
20
19
12
11
4
3
XPHI7COEFF4
26
18
10
25
17
24
16
815
LCDC_HEOCFG33
Address:
0xF0000410
Access:
Read/Write
31
23
30
22
29
21
15
14
13
28
27
20
19
YPHI0COEFF2
12
11
YPHI0COEFF1
4
3
YPHI0COEFF0
816
26
18
25
17
24
16
10
LCDC_HEOCFG34
Address:
0xF0000414
Access:
Read/Write
31
23
30
22
29
21
15
14
13
28
27
20
19
YPHI1COEFF2
12
11
YPHI1COEFF1
4
3
YPHI1COEFF0
26
18
25
17
24
16
10
817
LCDC_HEOCFG35
Address:
0xF0000418
Access:
Read/Write
31
23
30
22
29
21
15
14
13
28
27
20
19
YPHI2COEFF2
12
11
YPHI2COEFF1
4
3
YPHI2COEFF0
818
26
18
25
17
24
16
10
LCDC_HEOCFG36
Address:
0xF000041C
Access:
Read/Write
31
23
30
22
29
21
15
14
13
28
27
20
19
YPHI3COEFF2
12
11
YPHI3COEFF1
4
3
YPHI3COEFF0
26
18
25
17
24
16
10
819
LCDC_HEOCFG37
Address:
0xF0000420
Access:
Read/Write
31
23
30
22
29
21
15
14
13
28
27
20
19
YPHI4COEFF2
12
11
YPHI4COEFF1
4
3
YPHI4COEFF0
820
26
18
25
17
24
16
10
LCDC_HEOCFG38
Address:
0xF0000424
Access:
Read/Write
31
23
30
22
29
21
15
14
13
28
27
20
19
YPHI5COEFF2
12
11
YPHI5COEFF1
4
3
YPHI5COEFF0
26
18
25
17
24
16
10
821
LCDC_HEOCFG39
Address:
0xF0000428
Access:
Read/Write
31
23
30
22
29
21
15
14
13
28
27
20
19
YPHI6COEFF2
12
11
YPHI6COEFF1
4
3
YPHI6COEFF0
822
26
18
25
17
24
16
10
LCDC_HEOCFG40
Address:
0xF000042C
Access:
Read/Write
31
23
30
22
29
21
15
14
13
28
27
20
19
YPHI7COEFF2
12
11
YPHI7COEFF1
4
3
YPHI7COEFF0
26
18
25
17
24
16
10
823
LCDC_HEOCFG41
Address:
0xF0000430
Access:
Read/Write
31
23
15
30
22
14
29
21
13
28
20
12
27
19
11
26
18
10
25
17
YPHIDEF
9
1
XPHIDEF
824
24
16
8
LCDC_BASECLUTx [x=0..255]
Address:
0xF0000600
Access:
Read/Write
31
23
30
22
29
21
28
20
27
19
26
18
25
17
24
16
11
10
RCLUT
15
14
13
12
GCLUT
4
BCLUT
825
LCDC_OVR1CLUTx [x=0..255]
Address:
0xF0000A00
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ACLUT
23
22
21
20
RCLUT
15
14
13
12
GCLUT
4
BCLUT
826
LCDC_OVR2CLUTx [x=0..255]
Address:
0xF0000E00
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ACLUT
23
22
21
20
RCLUT
15
14
13
12
GCLUT
4
BCLUT
827
LCDC_HEOCLUTx [x=0..255]
Address:
0xF0001200
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ACLUT
23
22
21
20
RCLUT
15
14
13
12
GCLUT
4
BCLUT
828
33.
33.1
Description
The multi-format Video Decoder (VDEC) enables compression or decompression of digital video signals for the
formats MPEG-4, H.264, H.263, VP8, and JPEG. A prior introduction to these format standards is recommended
and helpful in understanding the functionality of the decoder.
33.2
Embedded Characteristics
Supported standards:
829
33.3
Block Diagram
Figure 33-1.
Block Diagram
MPEG-4
Stream Header
Decode
H.263
Stream Header
Decode
H.264
Stream Header
Decode
VP8/WebP
Stream Header
Decode
JPEG
Stream Header
Decode
External Memory
Hardware Drivers
System Bus
Bus Interface
Alpha
Blending
Rotation
Inter/Intra
Prediction
MV
Decode
Entropy
Decode
Dithering
De-Interlace
De-blocking
Filter
Inverse
Transformation
RLC
Decode
Scaling
RGB
Conversion
830
AC/DC
Prediction
33.4
Decoding Features
H.264 Features
Feature
Decoder Support
Decoding scheme
48 x 48 to 1280 x 720
Step size 16 pixels(3)
Supported
Notes:
1. In semi-planar raster scan format the Cb and Cr components are interleaved pixel by pixel in a separate plane. This allows
more efficient bus usage compared to the planar YCbCr format due to longer bursts that can be used in chrominance data
transferring.
2. The semi-planar 8x4 tiled format is otherwise similar to the raster-scan format, but the data is organized in tiles. The tile size
is 8x4 pixels in both luminance and chrominance planes. The tiled mode allows more efficient bus usage compared to the
raster-scan format due to longer bursts that can be used in all picture data transferring. Tiled mode is not supported in JPEG
decoding.
3. Decoder performs cropping for video fields that can be multiple of eight pixels in vertical direction.
4. Actual maximum frame rate and bit rate will depend on the logic clock frequency and system bus performance.
MPEG-4/H.263 Features
Feature
Decoder Support
MPEG-4/H.263
Decoding scheme
Output data format
Supported
Notes:
1. Actual maximum frame rate and bit rate will depend on the logic clock frequency and system bus performance.
831
JPEG Features
Feature
Decoder Support
Thumbnail decoding
Error detection
Supported
Notes:
1. Programmable buffer size for optimizing performance and memory consumption. Interrupt will be issued when buffer runs
empty, and the control software will load more stream to external memory.
2. Programmable output slice size for optimizing performance and memory consumption. Interrupt will be issued when the
requested area decoded. The control software can be used to switch the decoder output picture base address each time.
3. Non-8x8 dividable resolutions will be filled to 8 pixel boundary.
4. Actual maximum data rate will depend on the logic clock frequency and JPEG compression rate. The given figure applies to
high-quality JPEG with logic running at 200 MHz.
VP8/WebP Features
Feature
Decoder Support
VP8 stream
Decoding scheme
Frame by frame
Supported
Notes:
832
1. Actual maximum frame rate and bit rate will depend on the logic clock frequency and system bus performance.
33.5
Post-Processing Features
Table 33-5.
Post-Processing Features
Feature
Post-Processor Support
Any format generated by the decoder in combined mode
In standalone mode:
- YCbCr 4:2:0 semi-planar raster-scan
Post-processing scheme
Input image source
48 x 48 to 1280 x 720
Step size 16 pixels
48 x 48 to 1280 x 720
Step size 16 pixels
16 x 16 to 1280 x 720
Image up-scaling
Maximum output width is 3x the input width (within the maximum output image size
limit)
Maximum output height is 3x the input height - 2 pixels (within the maximum output
image size limit)
Proprietary averaging filter
Image down-scaling
BT.709 compliant
User definable conversion coefficient
Dithering
Deinterlacing
2x2 ordered dithering for 4-, 5- and 6-bit RGB channel precision
(2)
Conditional spatial deinterlace filtering. Supports only YCbCr 4:2:0 input format.
833
Table 33-5.
Feature
Post-Processor Support
Constant eight bit value can be set to the alpha channel of the 24-bit RGB output data
to control the transparency of the output picture. The resulting 32-bit ARGB data can
be used as input data for later alpha blending.
Output image can be alpha blended with two rectangular areas.(1) YCbCr 4:2:0 PP
output format is not supported when performing alpha blending.
The supported overlay input formats are following:
Alpha blending
Segmented linear
Linear
Linear
User definable start position, height and width. Can be used with scaling to perform
digital zoom. Usable only for JPEG or standalone mode.
Picture in picture
Output image can be written to any location inside video memory (1)
Up to 1280 x 720
Output image writing can be prevented on two rectangular areas in the image (3). The
masking feature is exclusive with alpha blending however it is possible to have one
masking area and one blending area.
Image rotation(2)
Notes:
834
33.6
H.264/MVC Decoder
The decoder has two operating modes:
SecondarySoftware performs entropy decoding; used in H.264 ASO or Slice Group stream decoding
External Memory
H.264 NAL
Unit Stream
AHB Bus
Decoded
Picture Buffer
4
5
Multiformat HW
Decoder Core
835
33.6.2 Decoder Data Flow, Software Performs Entropy Decoding (RLC Mode)
Numbered references in the following text are illustrated in Figure 33-3 on page 837.
In this case, the decoder software starts decoding the first picture by parsing the stream headers (1), and by
performing entropy decoding. Software then writes the following items to external memory:
Last step for the software is to write the hardware control registers and to enable the hardware (6).
Hardware decodes the picture by buffering control data for several macroblocks at a time, and then reads
appropriate amount of RLC data, differential motion vectors and intra modes depending on each macroblock type
(7)(10). Hardware will also read the reference pictures (previously decoded pictures) as required (11). Hardware
writes decoded (in-loop filtered, if H.264) output picture to memory one macroblock at a time (12). When the
picture has been fully decoded, hardware can raise an interrupt and write the status bits in the status register.
If post-processing is enabled, one or two additional image transfer operations will take place. If the decoded
images are in display order (i.e., no picture re-ordering has been made when encoding the sequence), and rotation
is not used, PP will process the pictures in pipeline with the decoder. Otherwise, it will first have to read the
decoded image that is to be displayed next from the memory (13), and then write back the processed image (14).
836
Figure 33-3.
External Memory
ARM Processor Core
H.264 NAL
Unit Stream
2
7
RLC Data
3
Differential
Motion
Vectors
AHB Bus
8
4
Intra 4x4
Modes
5
Macroblock
Control
10
Multiformat HW
Decoder Core
11
Decoded
Picture Buffer
Post-Processed
Picture Buffer
12
(13)
14
837
33.7
MPEG-4/H.263 Decoder
The decoder has two operating modes:
SecondarySoftware performs entropy decoding; used in MPEG-4 data partitioned stream decoding
separate DC coefficients (in MPEG-4, if the stream is using data partitioning) (4)
Last step for the software is to write the hardware control registers and to enable the hardware (6).
Hardware decodes the picture by buffering control data for several macroblocks at a time, and reading then
appropriate amount of AC and DC RLC data and differential motion vectors depending on the macroblock type
(7)(10). Hardware will also read the reference pictures (previously decoded pictures) as required (11). Hardware
writes decoded (in-loop filtered, if H.264) output picture to memory one macroblock at a time (12). When the
picture has been fully decoded, hardware can raise an interrupt and write the status bits in the status register.
If post-processing is enabled, one or two additional image transfer operations will take place. If the decoded
images are in display order (i.e., no picture re-ordering has been made when encoding the sequence), and rotation
is not used, PP will process the pictures in pipeline with the decoder. Otherwise, it will first have to read the
decoded image that is to be displayed next from the memory (13), and then write back the processed image (14).
33.8
VLC tables
Quantization tables
Last step for the software is to write the hardware control registers and to enable the hardware. After starting
hardware, software waits interrupt from hardware.
Hardware decodes the picture by reading stream, VLC and QP tables. Hardware writes the decoded output picture
to memory one macroblock at a time. When the picture has been fully decoded, or the hardware has run out of
stream data, it gives an interrupt with a proper status flag and provides stream end address for software to
continue and returns to initial state.
838
The JPEG decoder supports slice mode decoding. In slice mode, software passes information to hardware of how
many macro block rows should be decoded in one slice. After slice decoding, hardware will raise a slice ready
interrupt. The software manages of output buffer updates.
JPEG can also be decoded by buffering the input stream. When the stream in a buffer is processed, hardware will
raise an interrupt. The user needs to load the input buffer and call software again.
33.9
839
34.
34.1
Description
The Image Sensor Interface (ISI) connects a CMOS-type image sensor to the processor and provides image
capture in various formats.The ISI performs data conversion, if necessary, before the storage 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 34-3 on page 844).
Several input formats such as preprocessed RGB or YCbCr are supported through the data bus interface.
The ISI supports two modes of synchronization:
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.
Table 34-1.
I/O Description
Signal
Direction
Description
ISI_VSYNC
In
Vertical Synchronization
ISI_HSYNC
In
Horizontal Synchronization
ISI_DATA[11..0]
In
ISI_MCK
Out
ISI_PCK
In
Figure 34-1.
data[11..0]
840
ISI_DATA[11..0]
CLK
ISI_MCK
PCLK
ISI_PCK
VSYNC
ISI_VSYNC
HSYNC
ISI_HSYNC
Preview Path
Custom Formats with Horizontal and Vertical Preview Size as Multiples of 16 Also Supported for LCD
Preview
Block Diagram
Figure 34-2.
Hsync/Line enable
Vsync/Frame enable
Timing Signals
Interface
CCIR-656
Embedded Timing
Decoder(SAV/EAV)
CMOS
sensor
Pixel input
up to 12-bit
YCbCr 4:2:2
8:8:8
RGB 5:6:5
CMOS
sensor
pixel clock
input
Camera
Interrupt Request Line
From
Rx buffers
Pixel
Clock Domain
Preview path
Frame Rate
Pixel Sampling
Module
Configuration
Registers
Camera
Interrupt
Controller
Clipping + Color
Conversion
YCC to RGB
Clipping + Color
Conversion
RGB to YCC
codec_on
2-D Image
Scaler
APB
Interface
APB bus
34.3
Embedded Characteristics
APB
Clock Domain
AHB
Clock Domain
Pixel
Formatter
Rx Direct
Display
FIFO
Packed
Formatter
Rx Direct
Capture
FIFO
Core
Video
Arbiter
Camera
AHB
Master
Interface
Scatter
Mode
Support
AHB bus
34.2
Codec path
841
34.4
Functional Description
The Image Sensor Interface (ISI) supports direct connection to the ITU-R BT. 601/656 8-bit mode compliant
sensors and up to 12-bit grayscale sensors. It receives the image data stream from the image sensor on the 12-bit
data bus.
This module receives up to 12 bits for data, the horizontal and vertical synchronizations and the pixel clock. The
reduced pin count alternative for synchronization is supported for sensors that embed SAV (start of active video)
and EAV (end of active video) delimiters in the data stream.
The Image Sensor Interface interrupt line is connected to the Advanced Interrupt Controller and can trigger an
interrupt at the beginning of each frame and at the end of a DMA frame transfer. If the SAV/EAV synchronization is
used, an interrupt can be triggered on each delimiter event.
For 8-bit color sensors, the data stream received can be in several possible formats: YCbCr 4:2:2, RGB 8:8:8,
RGB 5:6:5 and may be processed before the storage in memory. When the preview DMA channel is configured
and enabled, the preview path is activated and an RGB frame is moved to memory. The preview path frame rate
is configured with the FRATE field of the ISI_CFG1 register. When the codec DMA channel is configured and
enabled, the codec path is activated and a YCbCr 4:2:2 frame is captured as soon as the ISI_CDC bit of the ISI
Control Register (ISI_CR) is set.
When the FULL bit of the ISI_CFG1 register is set, both preview DMA channel and codec DMA channel can
operate simultaneously. When a zero is written to the FULL bit of the ISI_CFG1 register, a hardware scheduler
checks the FRATE field. If its value is zero, a preview frame is skipped and a codec frame is moved to memory
instead. If its value is other than zero, at least one free frame slot is available. The scheduler postpones the codec
frame to that free available frame slot.
The data stream may be sent on both preview path and codec path if the value of bit ISI_CDC in the ISI_CR is one.
To optimize the bandwidth, the codec path should be enabled only when a capture is required.
In grayscale mode, the input data stream is stored in memory without any processing. The 12-bit data, which
represent the grayscale level for the pixel, is stored in memory one or two pixels per word, depending on the
GS_MODE bit in the ISI_CFG2 register. The codec datapath is not available when grayscale image is selected.
A frame rate counter allows users to capture all frames or 1 out of every 2 to 8 frames.
842
In the VSYNC/HSYNC synchronization, the valid data is captured with the active edge of the pixel clock (ISI_PCK),
after SFD lines of vertical blanking and SLD pixel clock periods delay programmed in the ISI_CR.
The data timing using horizontal and vertical synchronization are shown in Figure 34-4.
Figure 34-3.
ISI_VSYNC
1 line
ISI_HSYNC
ISI_PCK
DATA[7..0]
Cb
Cr
Cb
Cr
Cb
Cr
The ITU-RBT.656-4 standard defines the functional timing for an 8-bit wide interface.
There are two timing reference signals, one at the beginning of each video data block SAV (0xFF000080) and one
at the end of each video data block EAV (0xFF00009D). Only data sent between EAV and SAV is captured.
Horizontal blanking and vertical blanking are ignored. Use of the SAV and EAV synchronization eliminates the
ISI_VSYNC and ISI_HSYNC signals from the interface, thereby reducing the pin count. In order to retrieve both
frame and line synchronization properly, at least one line of vertical blanking is mandatory.
The data timing using EAV/SAV sequence synchronization are shown in Figure 34-4.
Figure 34-4.
FF
00 00
SAV
80
Cb
Cr
Cb Y
Cr
Active Video
Cr
Cb
FF
00 00
EAV
9D
843
Mode
Byte 0
Byte 1
Byte 2
Byte 3
Default
Cb(i)
Y(i)
Cr(i)
Y(i+1)
Mode 1
Cr(i)
Y(i)
Cb(i)
Y(i+1)
Mode 2
Y(i)
Cb(i)
Y(i+1)
Cr(i)
Mode 3
Y(i)
Cr(i)
Y(i+1)
Cb(i)
Table 34-3.
Mode
RGB 8:8:8
RGB 5:6:5
Table 34-4.
Mode
RGB 5:6:5
Table 34-5.
Mode
RGB 8:8:8
RGB 5:6:5
844
D7
D6
D5
D4
D3
D2
D1
D0
Byte 0
R7(i)
R6(i)
R5(i)
R4(i)
R3(i)
R2(i)
R1(i)
R0(i)
Byte 1
G7(i)
G6(i)
G5(i)
G4(i)
G3(i)
G2(i)
G1(i)
G0(i)
Byte 2
B7(i)
B6(i)
B5(i)
B4(i)
B3(i)
B2(i)
B1(i)
B0(i)
Byte 3
R7(i+1)
R6(i+1)
R5(i+1)
R4(i+1)
R3(i+1)
R2(i+1)
R1(i+1)
R0(i+1)
Byte 0
R4(i)
R3(i)
R2(i)
R1(i)
R0(i)
G5(i)
G4(i)
G3(i)
Byte 1
G2(i)
G1(i)
G0(i)
B4(i)
B3(i)
B2(i)
B1(i)
B0(i)
Byte 2
R4(i+1)
R3(i+1)
R2(i+1)
R1(i+1)
R0(i+1)
G5(i+1)
G4(i+1)
G3(i+1)
Byte 3
G2(i+1)
G1(i+1)
G0(i+1)
B4(i+1)
B3(i+1)
B2(i+1)
B1(i+1)
B0(i+1)
D7
D6
D5
D4
D3
D2
D1
D0
Byte 0
G2(i)
G1(i)
G0(i)
R4(i)
R3(i)
R2(i)
R1(i)
R0(i)
Byte 1
B4(i)
B3(i)
B2(i)
B1(i)
B0(i)
G5(i)
G4(i)
G3(i)
Byte 2
G2(i+1)
G1(i+1)
G0(i+1)
R4(i+1)
R3(i+1)
R2(i+1)
R1(i+1)
R0(i+1)
Byte 3
B4(i+1)
B3(i+1)
B2(i+1)
B1(i+1)
B0(i+1)
G5(i+1)
G4(i+1)
G3(i+1)
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)
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)
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:6:5 format, compliant with the 16-bit mode of
the LCD controller.
34.4.3 Clocks
The sensor master clock (ISI_MCK) can be generated either by the Advanced Power Management Controller
(APMC) through a Programmable Clock output or by an external oscillator connected to the sensor.
None of the sensors embed 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 sensor master clock
and the pixel clock provided by sensor. The two clock domains are not synchronized, but the sensor master clock
must be faster than the pixel clock.
34.4.4 Preview Path
34.4.4.1 Scaling, Decimation (Subsampling)
This module resizes captured 8-bit color sensor images to fit the LCD display format. The resize module performs
only downscaling. The same ratio is applied for both horizontal and vertical resize, then a fractional decimation
algorithm is applied.
The decimation factor is a multiple of 1/16; values 0 to 15 are forbidden.
Table 34-6.
Decimation Factor
Decimation Value
015
16
17
18
19
...
124
125
126
127
Decimation Factor
1.063
1.125
1.188
...
7.750
7.813
7.875
7.938
Table 34-7.
OUTPUT
VGA
640 480
QVGA
320 240
CIF
352 288
QCIF
176 144
INPUT
352 288
640 480
800 600
1280 1024
1600 1200
2048 1536
16
20
32
40
51
16
32
40
64
80
102
16
26
33
56
66
85
32
53
66
113
133
170
Example:
Input 1280 1024 Output = 640 480
Hratio = 1280/640 = 2
Vratio = 1024/480 = 2.1333
The decimation factor is 2 so 32/16.
845
Figure 34-5.
Resize Examples
1280
32/16 decimation
640
1024
480
1280
56/16 decimation
352
1024
288
This module converts YCrCb or YUV pixels to RGB color space. Clipping is performed to ensure that the samples
value do not exceed the allowable range. The conversion matrix is defined below and is fully programmable:
C0 0 C1
Y Y off
R
=
C0 C2 C3
C b C boff
G
B
C0 C4 0
C r C roff
G = Y 0.394 U 0.436 V
B = Y + 2.032 U
846
RGB Mode
The preview datapath contains a data formatter that converts 8:8:8 pixel to RGB 5:6:5 format compliant with the
16-bit format of the LCD controller. In general, when converting from a color channel with more bits to one with
fewer bits, the formatter module discards the lower-order bits.
For example, converting from RGB 8:8:8 to RGB 5:6:5, the formatter module discards the three LSBs from the red
and blue channels, and two LSBs from the green channel.
Grayscale Mode
When grayscale mode is enabled, two memory formats are supported:
ISI_CFG2.GS_MODE = 0: two pixels per word
ISI_CFG2.GS_MODE = 1: one pixel per word
The following tables illustrate the memory mapping for the two formats.
Table 34-8.
31
Grayscale Memory Mapping Configuration for 12-bit Data (ISI_CFG2.GS_MODE = 0: two pixels per word)
30
29
28
27
26
25
24
19
18
17
16
11
10
Pixel 0 [11:4]
23
22
21
20
13
12
Pixel 0 [3:0]
15
14
Pixel 1 [11:4]
7
Pixel 1 [3:0]
Table 34-9.
31
Grayscale Memory Mapping Configuration for 12-bit Data (ISI_CFG2.GS_MODE = 1: one pixel per word)
30
29
28
27
26
25
24
Pixel 0 [11:4]
23
22
21
20
19
18
17
16
Pixel 0 [3:0]
15
14
13
12
11
10
847
Both preview and codec datapaths contain FIFOs. These asynchronous buffers are used to safely transfer
formatted pixels from the pixel clock domain to the AHB clock domain. A video arbiter is used to manage FIFO
thresholds and triggers a relevant DMA request through the AHB master interface. Thus, depending on the FIFO
state, a specified length burst is asserted. Regarding AHB master interface, it supports Scatter DMA mode through
linked list operation. This mode of operation improves flexibility of image buffer location and allows the user to
allocate two or more frame buffers. The destination frame buffers are defined by a series of Frame Buffer
Descriptors (FBD). Each FBD controls the transfer of one entire frame and then optionally loads a further FBD to
switch the DMA operation at another frame buffer address. The FBD is defined by a series of three words. The first
one defines the current frame buffer address (named DMA_X_ADDR register), the second defines control
information (named DMA_X_CTRL register) and the third defines the next descriptor address (named
DMA_X_DSCR). DMA transfer mode with linked list support is available for both codec and preview datapath. The
data to be transferred described by an FBD requires several burst accesses. In the following example, the use of
two ping-pong frame buffers is described.
Example:
The first FBD, stored at address 0x00030000, defines the location of the first frame buffer. This address is
programmed in the ISI user interface DMA_P_DSCR. To enable the descriptor fetch operation, the value
0x00000001 must be written to the DMA_P_CTRL register. LLI_0 and LLI_1 are the two descriptors of the
linked list.
Destination address: frame buffer ID0 0x02A000 (LLI_0.DMA_P_ADDR)
Transfer 0 Control Information, fetch and writeback: 0x00000003 (LLI_0.DMA_P_CTRL)
Next FBD address: 0x00030010 (LLI_0.DMA_P_DSCR)
Second FBD, stored at address 0x00030010, defines the location of the second frame buffer.
Destination address: frame buffer ID1 0x0003A000 (LLI_1.DMA_P_ADDR)
Transfer 1 Control information fetch and writeback: 0x00000003 (LLI_1.DMA_P_CTRL)
Next FBD address: 0x00030000, wrapping to first FBD (LLI_1.DMA_P_DSCR)
Using this technique, several frame buffers can be configured through the linked list. Figure 34-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.
848
Figure 34-6.
Codec Request
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
Depending on user selection, this module can be bypassed so that input YCrCb stream is directly connected to the
format converter module. If the RGB input stream is selected, this module converts RGB to YCrCb color space
with the formulas given below:
Y
Cr =
C0 C1 C2
Cb
C6 C7 C8
C3 C4 C5
Y off
R
G + Cr off
B
Cb off
Dedicated FIFOs are used to support packed memory mapping. YCrCb pixel components are sent in a single 32bit word in a contiguous space (packed). Data is stored in the order of natural scan lines. Planar mode is not
supported.
34.4.5.3 DMA Features
Like preview datapath, codec datapath DMA mode uses linked list operation.
SAMA5D4 Series [DATASHEET]
Atmel-11238A-ATARM-SAMA5D4-Datasheet_30-Sep-14
849
34.5
Table 34-10.
Register Mapping
Offset
Register
Name
Access
Reset Value
0x00
ISI_CFG1
Read/Write
0x00000000
0x04
ISI_CFG2
Read/Write
0x00000000
0x08
ISI_PSIZE
Read/Write
0x00000000
0x0C
ISI_PDECF
Read/Write
0x00000010
0x10
ISI_Y2R_SET0
Read/Write
0x6832CC95
0x14
ISI_Y2R_SET1
Read/Write
0x00007102
0x18
ISI_R2Y_SET0
Read/Write
0x01324145
0x1C
ISI_R2Y_SET1
Read/Write
0x01245E38
0x20
ISI_R2Y_SET2
Read/Write
0x01384A4B
0x24
ISI_CR
Write-only
0x28
ISI_SR
Read-only
0x00000000
0x2C
ISI_IER
Write-only
0x30
ISI_IDR
Write-only
0x34
ISI_IMR
Read-only
0x00000000
0x38
ISI_DMA_CHER
Write-only
0x3C
ISI_DMA_CHDR
Write-only
0x40
ISI_DMA_CHSR
Read-only
0x00000000
0x44
ISI_DMA_P_ADDR
Read/Write
0x00000000
0x48
ISI_DMA_P_CTRL
Read/Write
0x00000000
0x4C
ISI_DMA_P_DSCR
Read/Write
0x00000000
0x50
ISI_DMA_C_ADDR
Read/Write
0x00000000
0x54
ISI_DMA_C_CTRL
Read/Write
0x00000000
0x58
ISI_DMA_C_DSCR
Read/Write
0x00000000
0x5C0xE0
Reserved
0xE4
ISI_WPMR
Read/Write
0x00000000
0xE8
ISI_WPSR
Read-only
0x00000000
0xEC0xF8
Reserved
0xFC
Reserved
Note: Several parts of the ISI controller use the pixel clock provided by the image sensor (ISI_PCK). Thus the user must first program
the image sensor to provide this clock (ISI_PCK) before programming the Image Sensor Controller.
850
ISI_CFG1
Address:
0xF0008000
Access:
Read/Write
Reset:
0x00000000
31
30
29
28
27
26
25
24
19
18
17
16
SFD
23
22
21
20
SLD
15
14
7
CRC_SYNC
6
EMB_SYNC
13
12
FULL
11
DISCR
10
9
FRATE
4
PIXCLK_POL
3
VSYNC_POL
2
HSYNC_POL
THMASK
851
Name
Description
BEATS_4
BEATS_8
BEATS_16
852
ISI_CFG2
Address:
0xF0008004
Access:
Read/Write
Reset:
0x00000000
31
30
29
RGB_CFG
23
28
YCC_SWAP
22
21
20
27
26
25
IM_HSIZE
24
19
18
17
16
IM_HSIZE
15
COL_SPACE
14
RGB_SWAP
13
GRAYSCALE
12
RGB_MODE
11
GS_MODE
10
9
IM_VSIZE
IM_VSIZE
853
Name
Description
Byte 0 Cb(i)
DEFAULT
Byte 1 Y(i)
Byte 2 Cr(i)
Byte 3 Y(i+1)
Byte 0 Cr(i)
MODE1
Byte 1 Y(i)
Byte 2 Cb(i)
Byte 3 Y(i+1)
Byte 0 Y(i)
MODE2
Byte 1 Cb(i)
Byte 2 Y(i+1)
Byte 3 Cr(i)
Byte 0 Y(i)
MODE3
Byte 1 Cr(i)
Byte 2 Y(i+1)
Byte 3 Cb(i)
Name
Description
Byte 0 R/G(MSB)
DEFAULT
Byte 1 G(LSB)/B
Byte 2 R/G(MSB)
Byte 3 G(LSB)/B
Byte 0 B/G(MSB)
MODE1
Byte 1 G(LSB)/R
Byte 2 B/G(MSB)
Byte 3 G(LSB)/R
Byte 0 G(LSB)/R
MODE2
Byte 1 B/G(MSB)
Byte 2 G(LSB)/R
Byte 3 B/G(MSB)
Byte 0 G(LSB)/B
MODE3
Byte 1 R/G(MSB)
Byte 2 G(LSB)/B
Byte 3 R/G(MSB)
If RGB_MODE is set to RGB 8:8:8, then RGB_CFG = 0 implies RGB color sequence, else it implies BGR color sequence.
854
ISI_PSIZE
Address:
0xF0008008
Access:
Read/Write
Reset:
0x00000000
31
30
29
28
23
22
21
20
27
26
25
24
19
18
17
16
11
10
PREV_HSIZE
PREV_HSIZE
15
14
13
12
PREV_VSIZE
0
PREV_VSIZE
855
ISI_PDECF
Address:
0xF000800C
Access:
Read/Write
Reset:
0x00000010
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
DEC_FACTOR
856
ISI_Y2R_SET0
Address:
0xF0008010
Access:
Read/Write
Reset:
0x6832CC95
31
30
29
28
27
26
25
24
19
18
17
16
11
10
C3
23
22
21
20
C2
15
14
13
12
C1
4
C0
857
ISI_Y2R_SET1
Address:
0xF0008014
Access:
Read/Write
Reset:
0x00007102
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
Cboff
13
Croff
12
Yoff
11
10
8
C4
C4
858
ISI_R2Y_SET0
Address:
0xF0008018
Access:
Read/Write
Reset:
0x01324145
31
30
29
28
27
26
25
24
Roff
23
22
21
20
19
C2
18
17
16
15
14
13
12
11
C1
10
3
C0
859
ISI_R2Y_SET1
Address:
0xF000801C
Access:
Read/Write
Reset:
0x01245E38
31
30
29
28
27
26
25
24
Goff
23
22
21
20
19
C5
18
17
16
15
14
13
12
11
C4
10
3
C3
860
ISI_R2Y_SET2
Address:
0xF0008020
Access:
Read/Write
Reset:
0x01384A4B
31
30
29
28
27
26
25
24
Boff
23
22
21
20
19
C8
18
17
16
15
14
13
12
11
C7
10
3
C6
861
ISI_CR
Address:
0xF0008024
Access:
Write-only
Reset:
0x00000000
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
8
ISI_CDC
2
ISI_SRST
1
ISI_DIS
0
ISI_EN
862
ISI_SR
Address:
0xF0008028
Access:
Read-only
Reset:
0x00000000
31
30
29
28
27
FR_OVR
26
CRC_ERR
25
C_OVR
24
P_OVR
23
22
21
20
19
SIP
18
17
CXFR_DONE
16
PXFR_DONE
15
14
13
12
11
10
VSYNC
8
CDC_PND
2
SRST
1
DIS_DONE
0
ENABLE
863
864
ISI_IER
Address:
0xF000802C
Access:
Read/Write
Reset:
0x00000000
31
30
29
28
27
FR_OVR
26
CRC_ERR
25
C_OVR
24
P_OVR
23
22
21
20
19
18
17
CXFR_DONE
16
PXFR_DONE
15
14
13
12
11
10
VSYNC
2
SRST
1
DIS_DONE
865
866
ISI_IDR
Address:
0xF0008030
Access:
Read/Write
Reset:
0x00000000
31
30
29
28
27
FR_OVR
26
CRC_ERR
25
C_OVR
24
P_OVR
23
22
21
20
19
18
17
CXFR_DONE
16
PXFR_DONE
15
14
13
12
11
10
VSYNC
2
SRST
1
DIS_DONE
867
868
ISI_IMR
Address:
0xF0008034
Access:
Read/Write
Reset:
0x00000000
31
30
29
28
27
FR_OVR
26
CRC_ERR
25
C_OVR
24
P_OVR
23
22
21
20
19
18
17
CXFR_DONE
16
PXFR_DONE
15
14
13
12
11
10
VSYNC
2
SRST
1
DIS_DONE
869
870
ISI_DMA_CHER
Address:
0xF0008038
Access:
Write-only
Reset:
0x00000000
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
1
C_CH_EN
0
P_CH_EN
871
ISI_DMA_CHDR
Address:
0xF000803C
Access:
Read/Write
Reset:
0x00000000
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
1
C_CH_DIS
0
P_CH_DIS
872
ISI_DMA_CHSR
Address:
0xF0008040
Access:
Read-only
Reset:
0x00000000
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
1
C_CH_S
0
P_CH_S
873
ISI_DMA_P_ADDR
Address:
0xF0008044
Access:
Read/Write
Reset:
0x00000000
31
30
29
28
27
26
25
24
19
18
17
16
11
10
P_ADDR
23
22
21
20
P_ADDR
15
14
13
12
P_ADDR
4
P_ADDR
874
ISI_DMA_P_CTRL
Address:
0xF0008048
Access:
Read/Write
Reset:
0x00000000
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
3
P_DONE
2
P_IEN
1
P_WB
0
P_FETCH
875
ISI_DMA_P_DSCR
Address:
0xF000804C
Access:
Read/Write
Reset:
0x00000000
31
30
29
28
27
26
25
24
19
18
17
16
11
10
P_DSCR
23
22
21
20
P_DSCR
15
14
13
12
P_DSCR
4
P_DSCR
876
ISI_DMA_C_ADDR
Address:
0xF0008050
Access:
Read/Write
Reset:
0x00000000
31
30
29
28
27
26
25
24
19
18
17
16
11
10
C_ADDR
23
22
21
20
C_ADDR
15
14
13
12
C_ADDR
4
C_ADDR
877
ISI_DMA_C_CTRL
Address:
0xF0008054
Access:
Read/Write
Reset:
0x00000000
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
3
C_DONE
2
C_IEN
1
C_WB
0
C_FETCH
878
ISI_DMA_C_DSCR
Address:
0xF0008058
Access:
Read/Write
Reset:
0x00000000
31
30
29
28
27
26
25
24
19
18
17
16
11
10
C_DSCR
23
22
21
20
C_DSCR
15
14
13
12
C_DSCR
4
C_DSCR
879
ISI_WPMR
Address:
0xF00080E4
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
0
WPEN
WPKEY
23
22
21
20
WPKEY
15
14
13
12
WPKEY
Name
0x495349
PASSWD
880
Description
Writing any other value in this field aborts the write operation of the WPEN bit.
Always reads as 0.
ISI_WPSR
Address:
0xF00080E8
Access:
Read/Write
31
30
29
28
23
22
21
20
27
26
25
24
19
18
17
16
11
10
0
WPVS
WPVSRC
15
14
13
12
WPVSRC
Description
A write protection violation has occurred since the last read of the ISI_WPSR. If this violation is an
unauthorized attempt to write a protected register, the associated violation is reported into field WPVSRC.
Description
No Write Protection Violation occurred since the last read of this register (ISI_WPSR).
Write access in ISI_CFG1 while Write Protection was enabled (since the last read).
Write access in ISI_CFG2 while Write Protection was enabled (since the last read).
Write access in ISI_PSIZE while Write Protection was enabled (since the last read).
Write access in ISI_PDECF while Write Protection was enabled (since the last read).
Write access in ISI_Y2R_SET0 while Write Protection was enabled (since the last read).
Write access in ISI_Y2R_SET1 while Write Protection was enabled (since the last read).
Write access in ISI_R2Y_SET0 while Write Protection was enabled (since the last read).
Write access in ISI_R2Y_SET1 while Write Protection was enabled (since the last read).
Write access in ISI_R2Y_SET2 while Write Protection was enabled (since the last read).
881
35.
35.1
Description
The USB High Speed Device Port (UDPHS) is compliant with the Universal Serial Bus (USB), rev 2.0 High Speed
device specification.
Each endpoint can be configured in one of several USB transfer types. It can be associated with one, two or three
banks of a Dual-port RAM used to store the current data payload. If two or three 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.
35.2
882
Embedded Characteristics
8 Kbytes of DPRAM
35.3
Block Diagram
Figure 35-1.
Block Diagram
APB
Interface
APB bus
ctrl
status
DHSDP
DHSDM
AHB1
AHB bus
Rd/Wr/Ready
DMA
AHB0
AHB bus
UTMI
USB2.0
CORE
DFSDP
DP
DFSDM
DM
AHB
Switch
Local
AHB
Slave
interface
EPT
Alloc
32 bits
DPRAM
System Clock
Domain
16/8 bits
USB Clock
Domain
PMC
883
35.4
Typical Connection
Figure 35-2.
Board Schematic
15k
(1)
"B" Receptacle
1 = VBUS
2 = D3 = D+
4 = GND
1
DHSDM/DFSDM
Shell = Shield
(1)
22k
CRPB
CRPB:1F to 10F
DHSDP/DFSDP
5K62 1%
VBG
10 pF
GNDUTMI
Note:
35.5
The values shown on the 22 k and 15 k resistors are only valid with 3V3 supplied PIOs.
Product Dependencies
884
Peripheral IDs
Instance
ID
UDPHS
47
35.6
Functional Description
USB Selection
Other
Transceivers
HS
Transceiver
EN_UDPHS
0
Others Ports
PA
HS USB Host
HS EHCI
FS OHCI
DMA
HS
USB
Device
DMA
Control Transfers: Used to configure a device at attach time and can be used for other device-specific
purposes, including control of other pipes on the device.
Bulk Data Transfers: Generated or consumed in relatively large burst quantities and have wide dynamic
latitude in transmission constraints.
Interrupt Data Transfers: Used for timely but reliable delivery of data, for example, characters or coordinates
with human-perceptible echo or feedback response characteristics.
Isochronous Data Transfers: Occupy a prenegotiated amount of USB bandwidth with a prenegotiated
delivery latency. (Also called streaming real time transfers.)
As indicated below, transfers are sequential events carried out on the USB bus.
Endpoints must be configured according to the transfer type they handle.
Table 35-2.
Transfer
Bandwidth
Endpoint Size
Error Detection
Retrying
Bidirectional
Not guaranteed
8, 16, 32, 64
Yes
Automatic
Isochronous
Unidirectional
Guaranteed
81024
Yes
No
Interrupt
Unidirectional
Not guaranteed
81024
Yes
Yes
Bulk
Unidirectional
Not guaranteed
8512
Yes
Yes
Control
885
Direction
Type
Transaction
Setup transaction Data IN transactions Status OUT transaction
CONTROL (bidirectional)
Control Transfer
(1)
Bulk IN Transfer
IN (device toward host)
Interrupt IN Transfer
Isochronous IN Transfer
(2)
Notes:
(2)
1. Control transfer must use endpoints with one bank and can be aborted using a stall handshake.
2. Isochronous transfers must use endpoints configured with two or three banks.
An endpoint handles all transactions related to the type of transfer for which it has been configured.
Table 35-4.
Nb Bank
DMA
High Band
Width
Endpoint Type
EPT_0
64
Control
EPT_1
1024
Ctrl/Bulk/Iso(1)/Interrupt
EPT_2
1024
Ctrl/Bulk/Iso(1)/Interrupt
EPT_3
1024
Ctrl/Bulk/Iso(1)/Interrupt
EPT_4
1024
Ctrl/Bulk/Iso(1)/Interrupt
EPT_5
1024
Ctrl/Bulk/Iso(1)/Interrupt
EPT_6
1024
Ctrl/Bulk/Iso(1)/Interrupt
EPT_7
1024
Ctrl/Bulk/Iso(1)/Interrupt
EPT_8
1024
Ctrl/Bulk/Iso(1)/Interrupt
EPT_9
1024
Ctrl/Bulk/Iso(1)/Interrupt
10
EPT_10
1024
Ctrl/Bulk/Iso(1)/Interrupt
11
EPT_11
1024
Ctrl/Bulk/Iso(1)/Interrupt
12
EPT_12
1024
Ctrl/Bulk/Iso(1)/Interrupt
13
EPT_13
1024
Ctrl/Bulk/Isov/Interrupt
14
EPT_14
1024
Ctrl/Bulk/Iso(1)/Interrupt
15
EPT_15
1024
Ctrl/Bulk/Iso(1)/Interrupt
Endpoint #
Note:
1. In Isochronous Mode (Iso), it is preferable that High Band Width capability is available.
886
Suspend and resume are automatically detected by the UDPHS device, which notifies the processor by raising an
interrupt.
35.6.5 USB V2.0 High Speed BUS Transactions
Each transfer results in one or more transactions over the USB bus.
There are five kinds of transactions flowing across the bus in packets:
1. Setup Transaction
2. Data IN Transaction
3.
4.
Status IN Transaction
5.
Figure 35-4.
Setup Stage
Control Write
Setup TX
Data Stage
Data OUT TX
No Data
Control
Setup TX
Data OUT TX
Data Stage
Setup Stage
Control Read
Status Stage
Data IN TX
Setup Stage
Status Stage
Setup TX
Status IN TX
Status IN TX
Status Stage
Data IN TX
Status OUT TX
Fill the configuration register (UDPHS_EPTCFG) with the endpoint size, direction (IN or OUT), type (CTRL,
Bulk, IT, ISO) and the number of banks.
Verify that the EPT_MAPD flag is set. This flag is set if the endpoint size and the number of banks are
correct compared to the FIFO maximum capacity and the maximum number of allowed banks.
Configure control flags of the endpoint and enable it in UDPHS_EPTCTLENBx according to UDPHS
Endpoint Control Disable Register (Isochronous Endpoint) on page 928.
887
All endpoints (except endpoint 0) can be configured either as Bulk, Interrupt or Isochronous. See Table 35-4.
UDPHS Endpoint Description.
The maximum packet size they can accept corresponds to the maximum endpoint size.
Note: The endpoint size of 1024 is reserved for isochronous endpoints.
The size of the DPRAM is 8 KB. The DPR is shared by all active endpoints. The memory size required by the
active endpoints must not exceed the size of the DPRAM.
SIZE_DPRAM = SIZE _EPT0
+ NB_BANK_EPT1 x SIZE_EPT1
+ NB_BANK_EPT2 x SIZE_EPT2
+ NB_BANK_EPT3 x SIZE_EPT3
+ NB_BANK_EPT4 x SIZE_EPT4
+ NB_BANK_EPT5 x SIZE_EPT5
+ NB_BANK_EPT6 x SIZE_EPT6
+... (refer to 35.7.8 UDPHS Endpoint Configuration Register)
If a user tries to configure endpoints with a size the sum of which is greater than the DPRAM, then the EPT_MAPD
is not set.
The application has access to the physical block of DPR reserved for the endpoint through a 64 KB logical address
space.
The physical block of DPR allocated for the endpoint is remapped all along the 64 KB logical address space. The
application can write a 64 KB buffer linearly.
Figure 35-5.
8 to 64 B
1 bank
8 to 64 B
64 KB
EP0
8 to 1024 B
64 KB 8 to 1024 B
8 to 1024 B
EP1
...
64 KB
EP2
64 KB
EP3
...
888
8 to 1024 B
8 to1024 B
x banks
y banks
z banks
8 to 1024 B
With DMA
AUTO_VALID: Automatically validate the packet and switch to the next bank.
Without DMA:
With DMA
AUTO_VALID: Automatically validate the packet and switch to the next bank.
Without DMA
RXRDY_TXKL: An interrupt is sent after a new packet has been stored in the endpoint FIFO.
To free its memory, the user shall write a zero to the UDPHS_EPTCFGx.BK_NUMBER field. The x+1 endpoint
memory window then slides down and its data is lost. Note that the following endpoint memory windows (from
x+2) do not slide.
Figure 35-6 illustrates the allocation and reorganization of the DPRAM in a typical example.
889
Figure 35-6.
Free Memory
Free Memory
EPT5
EPT5
EPT5
Free Memory
EPT5
EPT4
EPT4
EPT4
EPT3
EPT3
(always allocated)
EPT4
EPT2
EPT2
EPT2
EPT2
EPT1
EPT1
EPT1
EPT1
EPT0
EPT0
EPT0
EPT0
Device:
Device:
Endpoint 3
Disabled
(Step 2)
Device:
Device:
Endpoints 0..5
Enabled
(Step 1)
Conflict
Endpoint 3
Memory Freed
(Step 3)
UDPHS_EPTCTLENB3.EPT_ENABL = 1
UDPHS_EPTCFG3.BK_NUMBER <> 0
Endpoint 3
Enabled
(Step 4)
In order to free its memory, its UDPHS_EPTCFGx.BK_NUMBER field is written to zero. The endpoint 4
memory window slides down, but the endpoint 5 does not move.
4.
If the user chooses to reconfigure the endpoint 3 with a larger size, the controller allocates a memory area
after the endpoint 2 memory area and automatically slides up the endpoint 4 memory window. The endpoint
5 does not move and a memory conflict appears as the memory windows of the endpoints 4 and 5 overlap.
The data of these endpoints is potentially lost.
Notes:
1.
2.
3.
890
There is no way the data of the endpoint 0 can be lost (except if it is de-allocated) as the memory allocation and
de-allocation may affect only higher endpoints.
Deactivating then reactivating the same endpoint with the same configuration only modifies temporarily the
controller DPRAM pointer and size for this endpoint. Nothing changes in the DPRAM, higher endpoints seem not
to have been moved and their data is preserved as far as nothing has been written or received into them while
changing the allocation state of the first endpoint.
When the user writes a value different from zero to the UDPHS_EPTCFGx.BK_NUMBER field, the Endpoint
Mapped bit (UDPHS_EPTCFGx.EPT_MAPD) is set only if the configured size and number of banks are correct
as compared to the endpoint maximal allowed values and to the maximal FIFO size (i.e., the DPRAM size). The
UDPHS_EPTCFGx.EPT_MAPD value does not consider memory allocation conflicts.
In case of debug, be careful to address the DMA to an SRAM address even if a remap is done.
Example of DMA Chained List
Transfer Descriptor
UDPHS Registers
(Current Transfer Descriptor)
Transfer Descriptor
Transfer Descriptor
Data Buff 2
Data Buff 3
891
The setup packet is valid in the DPR while RX_SETUP is set. Once RX_SETUP is cleared by the application, the
UDPHS accepts the next packets sent over the device endpoint.
When a valid setup packet is accepted by the UDPHS:
The UDPHS device automatically acknowledges the setup packet (sends an ACK response)
An endpoint interrupt is generated while RX_SETUP in the UDPHS_EPTSTAx register is not cleared. This
interrupt is carried out to the microcontroller if interrupts are enabled for this endpoint.
Thus, firmware must detect RX_SETUP polling UDPHS_EPTSTAx or catching an interrupt, read the setup packet
in the FIFO, then clear the RX_SETUP bit in the UDPHS_EPTCLRSTA register to acknowledge the setup stage.
If STALL_SNT was set to 1, then this bit is automatically reset when a setup token is detected by the device. Then,
the device still accepts the setup stage. (See Section 35.6.10.5 STALL on page 902).
892
35.6.10.2 NYET
NYET is a High Speed only handshake. It is returned by a High Speed endpoint as part of the PING protocol.
High Speed devices must support an improved NAK mechanism for Bulk OUT and control endpoints (except setup
stage). This mechanism allows the device to tell the host whether it has sufficient endpoint space for the next OUT
transfer (see USB 2.0 spec 8.5.1 NAK Limiting via Ping Flow Control).
The NYET/ACK response to a High Speed Bulk OUT transfer and the PING response are automatically handled
by hardware in the UDPHS_EPTCTLx register (except when the user wants to force a NAK response by using the
NYET_DIS bit).
If the endpoint responds instead to the OUT/DATA transaction with an NYET handshake, this means that the
endpoint accepted the data but does not have room for another data payload. The host controller must return to
using a PING token until the endpoint indicates it has space available.
Figure 35-8.
data 0 ACK
t=0
data 1 NYET
t = 125 s
Bank 1 E
Bank 0 F
PING
t = 250 s
ACK
data 0 NYET
t = 375 s
Bank 1 F Bank 1 F
Bank 0 E' Bank 0 E
Bank 1 F
Bank 0 E
PING
NACK
t = 500 s
Bank 1 F
Bank 0 F
PING
ACK
t = 625 s
Bank 1 E'
Bank 0 F
E: empty
E': begin to empty
F: full
Bank 1 E
Bank 0 F
35.6.10.3 Data IN
Bulk IN or Interrupt IN
Data IN packets are sent by the device during the data or the status stage of a control transfer or during an
(interrupt/bulk/isochronous) IN transfer. Data buffers are sent packet by packet under the control of the application
or under the control of the DMA channel.
There are three ways for an application to transfer a buffer in several packets over the USB:
64 KB (see below)
Bulk IN or Interrupt IN: Sending a Packet Under Application Control (Device to Host)
The application can write one or several banks.
A simple algorithm can be used by the application to send packets regardless of the number of banks associated
to the endpoint.
Algorithm Description for Each Packet:
The application waits for TXRDY flag to be cleared in the UDPHS_EPTSTAx register before it can perform a
write access to the DPR.
The application writes one USB packet of data in the DPR through the 64 KB endpoint logical memory
window.
The application is notified that it is possible to write a new packet to the DPR by the TXRDY interrupt. This interrupt
can be enabled or masked by setting the TXRDY bit in the UDPHS_EPTCTLENB/UDPHS_EPTCTLDIS register.
893
The application checks the BUSY_BANK_STA field in the UDPHS_EPTSTAx register. The application must
wait that at least one bank is free.
The application writes a number of bytes inferior to the number of free DPR banks for the endpoint. Each
time the application writes the last byte of a bank, the TXRDY signal is automatically set by the UDPHS.
If the last packet is incomplete (i.e., the last byte of the bank has not been written) the application must set
the TXRDY bit in the UDPHS_EPTSETSTAx register.
The application is notified that all banks are free, so that it is possible to write another burst of packets by the
BUSY_BANK interrupt. This interrupt can be enabled or masked by setting the BUSY_BANK flag in the
UDPHS_EPTCTLENB and UDPHS_EPTCTLDIS registers.
This algorithm must not be used for isochronous transfer. In this case, the ping-pong mechanism does not operate.
A Zero Length Packet can be sent by setting just the TXRDY flag in the UDPHS_EPTSETSTAx register.
Bulk IN or Interrupt IN: Sending a Buffer Using DMA (Device to Host)
The UDPHS integrates a DMA host controller. This DMA controller can be used to transfer a buffer from the
memory to the DPR or from the DPR to the processor memory under the UDPHS control. The DMA can be used
for all transfer types except control transfer.
Example DMA configuration:
1. Program UDPHS_DMAADDRESS x with the address of the buffer that should be transferred.
2. Enable the interrupt of the DMA in UDPHS_IEN
3.
END_B_EN: The endpoint can validate the packet (according to the values programmed in the
AUTO_VALID and SHRT_PCKT fields of UDPHS_EPTCTLx.) (See UDPHS Endpoint Control Disable
Register (Isochronous Endpoint) on page 928 and Figure 35-13. Autovalid with DMA)
The auto-valid-bank mechanism allows the transfer of data (IN & OUT) without the intervention of the CPU. This
means that bank validation (set TXRDY or clear the RXRDY_TXKL bit) is done by hardware.
A transfer descriptor can be used. Instead of programming the register directly, a descriptor should be
programmed and the address of this descriptor is then given to UDPHS_DMANXTDSC to be processed after
setting the LDNXT_DSC field (Load Next Descriptor Now) in UDPHS_DMACONTROLx register.
The structure that defines this transfer descriptor must be aligned.
Each buffer to be transferred must be described by a DMA Transfer descriptor (see UDPHS DMA Channel
Transfer Descriptor on page 950). Transfer descriptors are chained. Before executing transfer of the buffer, the
UDPHS may fetch a new transfer descriptor from the memory address pointed by the UDPHS_DMANXTDSCx
register. Once the transfer is complete, the transfer status is updated in the UDPHS_DMASTATUSx register.
To chain a new transfer descriptor with the current DMA transfer, the DMA channel must be stopped. To do so,
INTDIS_DMA and TXRDY may be set in the UDPHS_EPTCTLENBx register. It is also possible for the application
to wait for the completion of all transfers. In this case the LDNXT_DSC bit in the last transfer descriptor
UDPHS_DMACONTROLx register must be set to 0 and the CHANN_ENB bit set to 1.
894
USB Bus
Packets
Token IN
Data IN 1
TXRDY
Flag
(UDPHS_EPTSTAx) Set by firmware
ACK
Token IN
NAK
Cleared by hardware
Token IN
Data IN 2
ACK
Cleared by hardware
Interrupt Pending
TX_COMPLT Flag
(UDPHS_EPTSTAx)
Payload in FIFO
Set by hardware
DPR access by firmware
FIFO
Content
Interrupt Pending
Data IN 1
Load in progress
Cleared by firmware
Cleared by firmware
895
Token IN
ACK
Data IN
Token IN
ACK
Data IN
Set by Firmware,
Cleared by Hardware
Data Payload Written switch to next bank
in FIFO Bank 0
Virtual TXRDY
bank 0
(UDPHS_EPTSTAx)
Cleared by Hardware
Data Payload Fully Transmitted
Virtual TXRDY
bank 1
(UDPHS_EPTSTAx)
Set by Firmware,
Data Payload Written in FIFO Bank 1
Interrupt Pending
TX_COMPLT
Flag
(UDPHS_EPTSTAx)
FIFO
(DPR)
Bank 0
Set by Hardware
Set by Hardware
Interrupt Cleared by Firmware
Written by
Microcontroller
Written by
Microcontroller
FIFO
(DPR)
Bank1
Written by
Microcontroller
Figure 35-11. Data IN Followed By Status OUT Transfer at the End of a Control Transfer
Device Sends the Last
Data Payload to Host
USB Bus
Packets
Token IN
Data IN
Device Sends a
Status OUT to Host
ACK
Token OUT
ACK
Token OUT
ACK
Interrupt
Pending
RXRDY
(UDPHS_EPTSTAx)
Set by Hardware
Cleared by Firmware
TX_COMPLT
(UDPHS_EPTSTAx)
Set by Hardware
Cleared by Firmware
Note: A NAK handshake is always generated at the first status stage token.
896
Token OUT
Data OUT
ACK
Token IN
Data IN
ACK
Interrupt Pending
RXRDY
(UDPHS_EPTSTAx)
Cleared by Firmware
Set by Hardware
TXRDY
(UDPHS_EPTSTAx)
Set by Firmware
Clear by Hardware
Note: Before proceeding to the status stage, the software should determine that there is no risk of extra data from the host (data stage).
If not certain (non-predictable data stage length), then the software should wait for a NAK-IN interrupt before proceeding to the
status stage. This precaution should be taken to avoid collision in the FIFO.
Figure 35-13. Autovalid with DMA
Bank (system)
Write
Bank 0
Bank 1
write bank 0
write bank 1
bank 0 is full
Bank 1
Bank 0
Bank 1
write bank 0
bank 1 is full
bank 0 is full
Bank 0
IN data 0
Bank (usb)
Bank 0
IN data 1
Bank 1
IN data 0
Bank 0
Bank 1
TXRDY
(Virtual 0 & Virtual 1)
Note: In the illustration above Autovalid validates a bank as full, although this might not be the case, in order to continue processing
data and to send to DMA.
897
Isochronous IN
Isochronous-IN is used to transmit a stream of data whose timing is implied by the delivery rate. Isochronous
transfer provides periodic, continuous communication between host and device.
It guarantees bandwidth and low latencies appropriate for telephony, audio, video, etc.
If the endpoint is not available (TXRDY_TRER = 0), then the device does not answer to the host. An ERR_FL_ISO
interrupt is generated in the UDPHS_EPTSTAx register and once enabled, then sent to the CPU.
The STALL_SNT command bit is not used for an ISO-IN endpoint.
High Bandwidth Isochronous Endpoint Handling: IN Example
For high bandwidth isochronous endpoints, the DMA can be programmed with the number of transactions
(BUFF_LENGTH field in UDPHS_DMACONTROLx) and the system should provide the required number of
packets per microframe, otherwise, the host will notice a sequencing problem.
A response should be made to the first token IN recognized inside a microframe under the following conditions:
If at least one bank has been validated, the correct DATAx corresponding to the programmed Number Of
Transactions per Microframe (NB_TRANS) should be answered. In case of a subsequent missed or
corrupted token IN inside the microframe, the USB 2.0 Core available data bank(s) that should normally
have been transmitted during that microframe shall be flushed at its end. If this flush occurs, an error
condition is flagged (ERR_FLUSH is set in UDPHS_EPTSTAx).
If no bank is validated yet, the default DATA0 ZLP is answered and underflow is flagged (ERR_FL_ISO is set
in UDPHS_EPTSTAx). Then, no data bank is flushed at microframe end.
If no data bank has been validated at the time when a response should be made for the second transaction
of NB_TRANS = 3 transactions microframe, a DATA1 ZLP is answered and underflow is flagged
(ERR_FL_ISO is set in UDPHS_EPTSTAx). If and only if remaining untransmitted banks for that microframe
are available at its end, they are flushed and an error condition is flagged (ERR_FLUSH is set in
UDPHS_EPTSTAx).
If no data bank has been validated at the time when a response should be made for the last programmed
transaction of a microframe, a DATA0 ZLP is answered and underflow is flagged (ERR_FL_ISO is set in
UDPHS_EPTSTAx). If and only if the remaining untransmitted data bank for that microframe is available at
its end, it is flushed and an error condition is flagged (ERR_FLUSH is set in UDPHS_EPTSTAx).
If at the end of a microframe no valid token IN has been recognized, no data bank is flushed and no error
condition is reported.
At the end of a microframe in which at least one data bank has been transmitted, if less than NB_TRANS banks
have been validated for that microframe, an error condition is flagged (ERR_TRANS is set in UDPHS_EPTSTAx).
Cases of Error (in UDPHS_EPTSTAx)
898
ERR_FL_ISO: There was no data to transmit inside a microframe, so a ZLP is answered by default.
ERR_FLUSH: At least one packet has been sent inside the microframe, but the number of token IN received
is lesser than the number of transactions actually validated (TXRDY_TRER) and likewise with the
NB_TRANS programmed.
ERR_TRANS: At least one packet has been sent inside the microframe, but the number of token IN received
is lesser than the number of programmed NB_TRANS transactions and the packets not requested were not
validated.
ERR_FL_ISO + ERR_FLUSH: At least one packet has been sent inside the microframe, but the data has not
been validated in time to answer one of the following token IN.
ERR_FL_ISO + ERR_TRANS: At least one packet has been sent inside the microframe, but the data has
not been validated in time to answer one of the following token IN and the data can be discarded at the
microframe end.
ERR_FLUSH + ERR_TRANS: The first token IN has been answered and it was the only one received, a
second bank has been validated but not the third, whereas NB_TRANS was waiting for three transactions.
ERR_FL_ISO + ERR_FLUSH + ERR_TRANS: The first token IN has been treated, the data for the second
Token IN was not available in time, but the second bank has been validated before the end of the
microframe. The third bank has not been validated, but three transactions have been set in NB_TRANS.
When an interrupt on RXRDY_TXKL is received, the application knows that UDPHS_EPTSTAx register
BYTE_COUNT bytes have been received.
Note:
If the application does not know the size of the transfer, it may not be a good option to use AUTO_VALID. Because if
a zero-length-packet is received, the RXRDY_TXKL is automatically cleared by the AUTO_VALID hardware and if the
endpoint interrupt is triggered, the software will not find its originating flag when reading the UDPHS_EPTSTAx
register.
When a BUSY_BANK interrupt is received, the application knows that all banks available for the endpoint
have been filled. Thus, the application can read all banks available.
If the application does not know the size of the receive buffer, instead of using the BUSY_BANK interrupt, the
application must use RXRDY_TXKL.
Bulk OUT or Interrupt OUT: Sending a Buffer Using DMA (Host To Device)
To use the DMA setting, the AUTO_VALID field is mandatory.
See Bulk IN or Interrupt IN: Sending a Buffer Using DMA (Device to Host) for more information.
DMA Configuration Example:
1. First program UDPHS_DMAADDRESSx with the address of the buffer that should be transferred.
2. Enable the interrupt of the DMA in UDPHS_IEN
3.
END_B_EN: Can be used for OUT packet truncation (discarding of unbuffered packet data) at the end
of DMA buffer.
END_TR_EN: End of transfer enable, the UDPHS device can put an end to the current DMA transfer,
in case of a short packet.
END_TR_IT: End of transfer interrupt enable, an interrupt is sent after the last USB packet has been
transferred by the DMA, if the USB transfer ended with a short packet. (Beneficial when the receive
size is unknown.)
899
For OUT transfer, the bank will be automatically cleared by hardware when the application has read all the bytes in
the bank (the bank is empty).
Notes:
1.
2.
Figure 35-14. Data OUT Transfer for Endpoint with One Bank
Host Sends Data Payload
USB Bus
Packets
Token OUT
Data OUT 1
ACK
Token OUT
Data OUT 2
NAK
Data OUT 2
Token OUT
ACK
Interrupt Pending
RXRDY
(UDPHS_EPTSTAx)
Set by Hardware
FIFO (DPR)
Content
Data OUT 1
Written by UDPHS Device
Cleared by Firmware,
Data Payload Written in FIFO
Data OUT 1
Data OUT 2
Microcontroller Read
Figure 35-15. Data OUT Transfer for an Endpoint with Two Banks
Microcontroller reads Data 1 in bank 0,
Host sends second data payload
USB Bus
Packets
Token OUT
Virtual RXRDY
Bank 0
Data OUT 1
ACK
Token OUT
Data OUT 2
Virtual RXRDY
Bank 1
Token OUT
Data OUT 3
Cleared by Firmware
Interrupt pending
Set by Hardware,
Data payload written
in FIFO endpoint bank 0
ACK
Set by Hardware
Data Payload written
in FIFO endpoint bank 1
Cleared by Firmware
Interrupt pending
Data OUT 1
Write by UDPHS Device
FIFO (DPR)
Bank 1
Data OUT 1
Data OUT 3
Read by Microcontroller
Write in progress
Data OUT 2
Write by Hardware
900
Data OUT 2
Read by Microcontroller
MData0
MData0/Data1
MData0/Data1/Data2
MData0
MData0/Data1
Data0
USB bus
Transactions
MDATA0
MDATA1
DATA2
t = 125 s
t = 52.5 s
(40% of 125 s)
t=0
RXRDY
Microcontroller FIFO
(DPR) Access
MDATA0
Read Bank 1
Read Bank 2
MDATA1
DATA2
USB line
RXRDY
Read Bank 3
Read Bank 1
901
If the host sends a Zero Length Packet, and the endpoint is free, no data is written in the endpoint, the
RXRDY_TXKL flag is set, and the BYTE_COUNT field in UDPHS_EPTSTAx register is null.
The FRCESTALL command bit is unused for an isochonous endpoint.
Otherwise, payload data is written in the endpoint, the RXRDY_TXKL interrupt is generated and the
BYTE_COUNT in UDPHS_EPTSTAx register is updated.
35.6.10.5 STALL
STALL is returned by a function in response to an IN token or after the data phase of an OUT or in response to a
PING transaction. STALL indicates that a function is unable to transmit or receive data, or that a control pipe
request is not supported.
OUT
To stall an endpoint, set the FRCESTALL bit in UDPHS_EPTSETSTAx register and after the STALL_SNT flag has
been set, set the TOGGLE_SEG bit in the UDPHS_EPTCLRSTAx register.
IN
Data OUT
Token OUT
Stall PID
FRCESTALL
Set by Firmware
Cleared by Firmware
Interrupt Pending
STALL_SNT
Set by Hardware
Cleared by Firmware
Token IN
Stall PID
FRCESTALL
Cleared by Firmware
Set by Firmware
Interrupt Pending
STALL_SNT
Set by Hardware
Cleared by Firmware
902
SHRT_PCKT
BUSY_BANK
NAK_OUT
NAKOUT Interrupt
NAK_IN/ERR_FLUSH
STALL_SNT/ERR_CRC_NTR
RX_SETUP/ERR_FL_ISO
TXRDY_TRER
TX_COMPLT
RXRDY_TXKL
ERR_OVFLW
MDATA_RX
MDATA Interrupt
DATAX_RX
DATAx Interrupt
903
Global IT mask
Global IT sources
DET_SUSPD
MICRO_SOF
USB Global
IT Sources
INT_SOF
ENDRESET
WAKE_UP
ENDOFRSM
UPSTR_RES
(UDPHS_EPTCTLENBx)
SHRT_PCKT
EP mask
BUSY_BANK
EP sources
NAK_OUT
(UDPHS_IEN)
EPT_0
husb2dev
interrupt
NAK_IN/ERR_FLUSH
STALL_SNT/ER_CRC_NTR
EPT0 IT
Sources
RX_SETUP/ERR_FL_ISO
TXRDY_TRER
TX_COMPLT
RXRDY_TXKL
ERR_OVFLW
MDATA_RX
DATAX_RX
(UDPHS_IEN)
EPT_x
EP mask
EP sources
(UDPHS_EPTCTLx)
INTDIS_DMA
EPT1-6 IT
Sources
disable DMA
channelx request
(UDPHS_DMACONTROLx)
mask
(UDPHS_IEN)
DMA_x
EN_BUFFIT
mask
DMA CH x
END_TR_IT
mask
DESC_LD_IT
904
A USB device has several possible states. Refer to Chapter 9 (USB Device Framework) of the Universal Serial
Bus Specification, Rev 2.0.
Figure 35-20. UDPHS Device State Diagram
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
Suspended
Address
Bus Activity
Device
Deconfigured
Device
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 Suspend/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 activity) 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.
905
Self powered devices can detect 5V VBUS using a PIO. When the device is not connected to a host, device power
consumption can be reduced by the DETACH bit in UDPHS_CTRL. Disabling the transceiver is automatically
done. HSDM, HSDP, FSDP and FSDP lines are tied to GND pull-downs integrated in the hub downstream ports.
35.6.14.3 Entering Attached State
When no device is connected, the USB FSDP and FSDM signals are tied to GND by 15 K pull-downs integrated
in the hub downstream ports. When a device is attached to an hub downstream port, the device connects a 1.5 K
pull-up on FSDP. The USB bus line goes into IDLE state, FSDP is pulled-up by the device 1.5 K resistor to 3.3V
and FSDM is pulled-down by the 15 K resistor to GND of the host.
After pull-up connection, the device enters the powered state. The transceiver remains disabled until bus activity is
detected.
In case of low power consumption need, the device can be stopped. When the device detects the VBUS, the
software must enable the USB transceiver by enabling the EN_UDPHS bit in UDPHS_CTRL register.
The software can detach the pull-up by setting DETACH bit in UDPHS_CTRL register.
35.6.14.4 From Powered State to Default State (Reset)
After its connection to a USB host, the USB device waits for an end-of-bus reset. The unmasked flag ENDRESET
is set in the UDPHS_IEN register and an interrupt is triggered.
Once the ENDRESET interrupt has been triggered, the device enters Default State. In this state, the UDPHS
software must:
Enable the default endpoint, setting the EPT_ENABL flag in the UDPHS_EPTCTLENB[0] register and,
optionally, enabling the interrupt for endpoint 0 by writing 1 in EPT_0 of the UDPHS_IEN register. The
enumeration then begins by a control transfer.
Configure the Interrupt Mask Register which has been reset by the USB reset detection
After a Set Address standard device request, the USB host peripheral enters the address state.
Warning: before the device enters address state, it must achieve the Status IN transaction of the control transfer,
i.e., the UDPHS device sets its new address once the TX_COMPLT flag in the UDPHS_EPTCTL[0] register has
been received and cleared.
To move to address state, the driver software sets the DEV_ADDR field and the FADDR_EN flag in the
UDPHS_CTRL register.
35.6.14.6 From Address State to Configured State (Device Configured)
Once a valid Set Configuration standard request has been received and acknowledged, the device enables
endpoints corresponding to the current configuration. This is done by setting the BK_NUMBER, EPT_TYPE,
EPT_DIR and EPT_SIZE fields in the UDPHS_EPTCFGx registers and enabling them by setting the EPT_ENABL
flag in the UDPHS_EPTCTLENBx registers, and, optionally, enabling corresponding interrupts in the UDPHS_IEN
register.
35.6.14.7 Entering Suspend State (Bus Activity)
When a Suspend (no bus activity on the USB bus) is detected, the DET_SUSPD signal in the UDPHS_STA
register is set. This triggers an interrupt if the corresponding bit is set in the UDPHS_IEN register. This flag is
cleared by writing to the UDPHS_CLRINT register. Then the device enters Suspend Mode.
906
In this state bus powered devices must drain less than 500 A from the 5V VBUS. As an example, the
microcontroller switches to slow clock, disables the PLL and main oscillator, and goes into Idle Mode. It may also
switch off other devices on the board.
The UDPHS device peripheral clocks can be switched off. Resume event is asynchronously detected.
35.6.14.8 Receiving a Host Resume
In Suspend mode, a resume event on the USB bus line is detected asynchronously, transceiver and clocks
disabled (however the pull-up should not be removed).
Once the resume is detected on the bus, the signal WAKE_UP in the UDPHS_INTSTA is set. It may generate an
interrupt if the corresponding bit in the UDPHS_IEN register is set. This interrupt may be used to wake-up the core,
enable PLL and main oscillators and configure clocks.
35.6.14.9 Sending an External Resume
Test_J
Test_K
Test_Packet
Test_SEO_NAK
(See Section 35.7.7 UDPHS Test Register on page 918 for definitions of each test mode.)
const char test_packet_buffer[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
//
0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,
//
0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,
//
0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, //
JJJJJJJKKKKKKK * 8
0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,
//
0xFC,0x7E,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0x7E
//
10}, JK
};
JKJKJKJK * 9
JJKKJJKK * 8
JJKKJJKK * 8
JJJJJJJK * 8
{JKKKKKKK *
907
35.7
Table 35-6.
Register Mapping
Offset
Register
Name
Access
Reset
0x00
UDPHS_CTRL
Read/Write
0x0000_0200
0x04
UDPHS_FNUM
Read-only
0x0000_0000
0x080x0C
Reserved
0x10
UDPHS_IEN
Read/Write
0x0000_0010
0x14
UDPHS_INTSTA
Read-only
0x0000_0000
0x18
UDPHS_CLRINT
Write-only
0x1C
UDPHS_EPTRST
Write-only
0x200xCC
Reserved
0xE0
UDPHS_TST
Read/Write
0x0000_0000
0xE40xFC
Reserved
Read/Write
0x0000_0000
UDPHS_EPTCTLENB
Write-only
UDPHS_EPTCTLDIS
Write-only
UDPHS_EPTCTL
Read-only
0x0000_0000(1)
UDPHS_EPTSETSTA
Write-only
UDPHS_EPTCLRSTA
Write-only
UDPHS_EPTSTA
Read-only
0x0000_0040
UDPHS_DMANXTDSC
Registers
0x1200x2FC
UDPHS Endpoint1 to 15
Read/Write
0x0000_0000
0x0000_0000
UDPHS_DMACONTRO
L
Read/Write
0x0000_0000
UDPHS_DMASTATUS
Read/Write
0x0000_0000
0x3100x36C
Notes:
908
DMA Channel1 to 6
(3)
Registers
UDPHS_CTRL
Address:
0xFC02C000
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
PULLD_DIS
10
REWAKEUP
9
DETACH
8
EN_UDPHS
7
FADDR_EN
3
DEV_ADDR
909
PULLD_DIS
DP
DM
Condition
Pull up
Pull down
Not recommended
Pull up
VBUS present
Pull down
Pull down
No VBUS
910
UDPHS_FNUM
Address:
0xFC02C004
Access:
Read-only
31
FNUM_ERR
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
FRAME_NUMBER
5
FRAME_NUMBER
1
MICRO_FRAME_NUM
911
UDPHS_IEN
Address:
0xFC02C010
Access:
Read/Write
31
30
DMA_6
29
DMA_5
28
DMA_4
27
DMA_3
26
DMA_2
25
DMA_1
24
23
EPT_15
22
EPT_14
21
EPT_13
20
EPT_12
19
EPT_11
18
EPT_10
17
EPT_9
16
EPT_8
15
EPT_7
14
EPT_6
13
EPT_5
12
EPT_4
11
EPT_3
10
EPT_2
9
EPT_1
8
EPT_0
7
UPSTR_RES
6
ENDOFRSM
5
WAKE_UP
4
ENDRESET
3
INT_SOF
2
MICRO_SOF
1
DET_SUSPD
912
913
UDPHS_INTSTA
Address:
0xFC02C014
Access:
Read-only
31
30
DMA_6
29
DMA_5
28
DMA_4
27
DMA_3
26
DMA_2
25
DMA_1
24
23
EPT_15
22
EPT_14
21
EPT_13
20
EPT_12
19
EPT_11
18
EPT_10
17
EPT_9
16
EPT_8
15
EPT_7
14
EPT_6
13
EPT_5
12
EPT_4
11
EPT_3
10
EPT_2
9
EPT_1
8
EPT_0
7
UPSTR_RES
6
ENDOFRSM
5
WAKE_UP
4
ENDRESET
3
INT_SOF
2
MICRO_SOF
1
DET_SUSPD
0
SPEED
914
915
UDPHS_CLRINT
Address:
0xFC02C018
Access:
Write only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
7
UPSTR_RES
6
ENDOFRSM
5
WAKE_UP
4
ENDRESET
3
INT_SOF
2
MICRO_SOF
1
DET_SUSPD
916
UDPHS_EPTRST
Address:
0xFC02C01C
Access:
Write only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
EPT_15
14
EPT_14
13
EPT_13
12
EPT_12
11
EPT_11
10
EPT_10
9
EPT_9
8
EPT_8
7
EPT_7
6
EPT_6
5
EPT_5
4
EPT_4
3
EPT_3
2
EPT_2
1
EPT_1
0
EPT_0
917
UDPHS_TST
Address:
0xFC02C0E0
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
5
OPMODE2
4
TST_PKT
3
TST_K
2
TST_J
0
SPEED_CFG
Name
Description
NORMAL
Normal Mode: The macro is in Full Speed mode, ready to make a High Speed identification, if the host
supports it and then to automatically switch to High Speed mode
Reserved
HIGH_SPEED
Force High Speed: Set this value to force the hardware to work in High Speed mode. Only for debug
or test purpose.
FULL_SPEED
Force Full Speed: Set this value to force the hardware to work only in Full Speed mode. In this
configuration, the macro will not respond to a High Speed reset handshake.
918
OPMODE2: OpMode2
0: No effect.
1: Set to force the OpMode signal (UTMI interface) to 10, to disable the bit-stuffing and the NRZI encoding.
Note: For the Test mode, Test_SE0_NAK (see Universal Serial Bus Specification, Revision 2.0: 7.1.20, Test Mode Support). Force the
device in High Speed mode, and configure a bulk-type endpoint. Do not fill this endpoint for sending NAK to the host.
Upon command, a ports transceiver must enter the High Speed receive mode and remain in that mode until the exit action is
taken. This enables the testing of output impedance, low level output voltage and loading characteristics. In addition, while in this
mode, upstream facing ports (and only upstream facing ports) must respond to any IN token packet with a NAK handshake (only
if the packet CRC is determined to be correct) within the normal allowed device response time. This enables testing of the device
squelch level circuitry and, additionally, provides a general purpose stimulus/response test for basic functional testing.
919
UDPHS_EPTCFGx [x=0..15]
Address:
0xFC02C100 [0], 0xFC02C120 [1], 0xFC02C140 [2], 0xFC02C160 [3], 0xFC02C180 [4], 0xFC02C1A0 [5],
0xFC02C1C0 [6], 0xFC02C1E0 [7], 0xFC02C200 [8], 0xFC02C220 [9], 0xFC02C240 [10], 0xFC02C260 [11],
0xFC02C280 [12], 0xFC02C2A0 [13], 0xFC02C2C0 [14], 0xFC02C2E0 [15]
Access:
Read/Write
31
EPT_MAPD
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
3
EPT_DIR
1
EPT_SIZE
BK_NUMBER
EPT_TYPE
Note:
Name
Description
8 bytes
16
16 bytes
32
32 bytes
64
64 bytes
128
128 bytes
256
256 bytes
512
512 bytes
1024
1024 bytes
920
8
NB_TRANS
0
Name
Description
CTRL8
Control endpoint
ISO
Isochronous endpoint
BULK
Bulk endpoint
INT
Interrupt endpoint
Name
Description
921
35.7.9 UDPHS Endpoint Control Enable Register (Control, Bulk, Interrupt Endpoints)
Name:
UDPHS_EPTCTLENBx [x=0..15]
Access:
Write-only
31
SHRT_PCKT
30
29
28
27
26
25
24
23
22
21
20
19
18
BUSY_BANK
17
16
15
NAK_OUT
14
NAK_IN
13
STALL_SNT
12
RX_SETUP
11
TXRDY
10
TX_COMPLT
9
RXRDY_TXKL
8
ERR_OVFLW
4
NYET_DIS
3
INTDIS_DMA
1
AUTO_VALID
0
EPT_ENABL
This register view is relevant only if EPT_TYPE = 0x0, 0x2 or 0x3 in UDPHS Endpoint Configuration Register on page
920.
For additional information, see UDPHS Endpoint Control Register (Control, Bulk, Interrupt Endpoints) on page 930.
EPT_ENABL: Endpoint Enable
0: No effect.
1: Enable endpoint according to the device configuration.
AUTO_VALID: Packet Auto-Valid Enable
0: No effect.
1: Enable this bit to automatically validate the current packet and switch to the next bank for both IN and OUT transfers.
INTDIS_DMA: Interrupts Disable DMA
0: No effect.
1: If set, when an enabled endpoint-originated interrupt is triggered, the DMA request is disabled.
NYET_DIS: NYET Disable (Only for High Speed Bulk OUT endpoints)
0: No effect.
1: Forces an ACK response to the next High Speed Bulk OUT transfer instead of a NYET response.
ERR_OVFLW: Overflow Error Interrupt Enable
0: No effect.
1: Enable Overflow Error Interrupt.
RXRDY_TXKL: Received OUT Data Interrupt Enable
0: No effect.
1: Enable Received OUT Data Interrupt.
TX_COMPLT: Transmitted IN Data Complete Interrupt Enable
0: No effect.
1: Enable Transmitted IN Data Complete Interrupt.
922
923
Address:
0xFC02C104 [0], 0xFC02C124 [1], 0xFC02C144 [2], 0xFC02C164 [3], 0xFC02C184 [4], 0xFC02C1A4 [5],
0xFC02C1C4 [6], 0xFC02C1E4 [7], 0xFC02C204 [8], 0xFC02C224 [9], 0xFC02C244 [10], 0xFC02C264 [11],
0xFC02C284 [12], 0xFC02C2A4 [13], 0xFC02C2C4 [14], 0xFC02C2E4 [15]
Access:
Write-only
31
SHRT_PCKT
30
29
28
27
26
25
24
23
22
21
20
19
18
BUSY_BANK
17
16
15
14
13
12
11
10
ERR_FLUSH
ERR_CRC_NT
R
ERR_FL_ISO
TXRDY_TRER
TX_COMPLT
RXRDY_TXKL
ERR_OVFLW
7
MDATA_RX
6
DATAX_RX
3
INTDIS_DMA
1
AUTO_VALID
0
EPT_ENABL
This register view is relevant only if EPT_TYPE = 0x1 in UDPHS Endpoint Configuration Register on page 920.
For additional information, see UDPHS Endpoint Control Register (Isochronous Endpoint) on page 933.
EPT_ENABL: Endpoint Enable
0: No effect.
1: Enable endpoint according to the device configuration.
AUTO_VALID: Packet Auto-Valid Enable
0: No effect.
1: Enable this bit to automatically validate the current packet and switch to the next bank for both IN and OUT transfers.
INTDIS_DMA: Interrupts Disable DMA
0: No effect.
1: If set, when an enabled endpoint-originated interrupt is triggered, the DMA request is disabled.
DATAX_RX: DATAx Interrupt Enable (Only for high bandwidth Isochronous OUT endpoints)
0: No effect.
1: Enable DATAx Interrupt.
MDATA_RX: MDATA Interrupt Enable (Only for high bandwidth Isochronous OUT endpoints)
0: No effect.
1: Enable MDATA Interrupt.
ERR_OVFLW: Overflow Error Interrupt Enable
0: No effect.
1: Enable Overflow Error Interrupt.
924
925
35.7.11 UDPHS Endpoint Control Disable Register (Control, Bulk, Interrupt Endpoints)
Name:
UDPHS_EPTCTLDISx [x=0..15]
Address:
0xFC02C108 [0], 0xFC02C128 [1], 0xFC02C148 [2], 0xFC02C168 [3], 0xFC02C188 [4], 0xFC02C1A8 [5],
0xFC02C1C8 [6], 0xFC02C1E8 [7], 0xFC02C208 [8], 0xFC02C228 [9], 0xFC02C248 [10], 0xFC02C268 [11],
0xFC02C288 [12], 0xFC02C2A8 [13], 0xFC02C2C8 [14], 0xFC02C2E8 [15]
Access:
Write-only
31
SHRT_PCKT
30
29
28
27
26
25
24
23
22
21
20
19
18
BUSY_BANK
17
16
15
NAK_OUT
14
NAK_IN
13
STALL_SNT
12
RX_SETUP
11
TXRDY
10
TX_COMPLT
9
RXRDY_TXKL
8
ERR_OVFLW
4
NYET_DIS
3
INTDIS_DMA
1
AUTO_VALID
0
EPT_DISABL
This register view is relevant only if EPT_TYPE = 0x0, 0x2 or 0x3 in UDPHS Endpoint Configuration Register on page
920.
For additional information, see UDPHS Endpoint Control Register (Control, Bulk, Interrupt Endpoints) on page 930.
EPT_DISABL: Endpoint Disable
0: No effect.
1: Disable endpoint.
AUTO_VALID: Packet Auto-Valid Disable
0: No effect.
1: Disable this bit to not automatically validate the current packet.
INTDIS_DMA: Interrupts Disable DMA
0: No effect.
1: Disable the Interrupts Disable DMA.
NYET_DIS: NYET Enable (Only for High Speed Bulk OUT endpoints)
0: No effect.
1: Let the hardware handle the handshake response for the High Speed Bulk OUT transfer.
ERR_OVFLW: Overflow Error Interrupt Disable
0: No effect.
1: Disable Overflow Error Interrupt.
RXRDY_TXKL: Received OUT Data Interrupt Disable
0: No effect.
1: Disable Received OUT Data Interrupt.
926
927
Address:
0xFC02C108 [0], 0xFC02C128 [1], 0xFC02C148 [2], 0xFC02C168 [3], 0xFC02C188 [4], 0xFC02C1A8 [5],
0xFC02C1C8 [6], 0xFC02C1E8 [7], 0xFC02C208 [8], 0xFC02C228 [9], 0xFC02C248 [10], 0xFC02C268 [11],
0xFC02C288 [12], 0xFC02C2A8 [13], 0xFC02C2C8 [14], 0xFC02C2E8 [15]
Access:
Write-only
31
SHRT_PCKT
30
29
28
27
26
25
24
23
22
21
20
19
18
BUSY_BANK
17
16
15
14
13
12
11
10
ERR_FLUSH
ERR_CRC_NT
R
ERR_FL_ISO
TXRDY_TRER
TX_COMPLT
RXRDY_TXKL
ERR_OVFLW
7
MDATA_RX
6
DATAX_RX
3
INTDIS_DMA
1
AUTO_VALID
0
EPT_DISABL
This register view is relevant only if EPT_TYPE = 0x1 in UDPHS Endpoint Configuration Register on page 920.
For additional information, see UDPHS Endpoint Control Register (Isochronous Endpoint) on page 933.
EPT_DISABL: Endpoint Disable
0: No effect.
1: Disable endpoint.
AUTO_VALID: Packet Auto-Valid Disable
0: No effect.
1: Disable this bit to not automatically validate the current packet.
INTDIS_DMA: Interrupts Disable DMA
0: No effect.
1: Disable the Interrupts Disable DMA.
DATAX_RX: DATAx Interrupt Disable (Only for High Bandwidth Isochronous OUT endpoints)
0: No effect.
1: Disable DATAx Interrupt.
MDATA_RX: MDATA Interrupt Disable (Only for High Bandwidth Isochronous OUT endpoints)
0: No effect.
1: Disable MDATA Interrupt.
ERR_OVFLW: Overflow Error Interrupt Disable
0: No effect.
1: Disable Overflow Error Interrupt.
928
929
UDPHS_EPTCTLx [x=0..15]
Access:
Read-only
31
SHRT_PCKT
30
29
28
27
26
25
24
23
22
21
20
19
18
BUSY_BANK
17
16
15
NAK_OUT
14
NAK_IN
13
STALL_SNT
12
RX_SETUP
11
TXRDY
10
TX_COMPLT
9
RXRDY_TXKL
8
ERR_OVFLW
4
NYET_DIS
3
INTDIS_DMA
1
AUTO_VALID
0
EPT_ENABL
This register view is relevant only if EPT_TYPE = 0x0, 0x2 or 0x3 in UDPHS Endpoint Configuration Register on page
920.
EPT_ENABL: Endpoint Enable
0: The endpoint is disabled according to the device configuration. Endpoint 0 should always be enabled after a hardware or
UDPHS bus reset and participate in the device configuration.
1: The endpoint is enabled according to the device configuration.
AUTO_VALID: Packet Auto-Valid Enabled (Not for CONTROL Endpoints)
Set this bit to automatically validate the current packet and switch to the next bank for both IN and OUT endpoints.
For IN Transfer:
If this bit is set, the UDPHS_EPTSTAx register TXRDY bit is set automatically when the current bank is full and at the
end of DMA buffer if the UDPHS_DMACONTROLx register END_B_EN bit is set.
The user may still set the UDPHS_EPTSTAx register TXRDY bit if the current bank is not full, unless the user wants to
send a Zero Length Packet by software.
For OUT Transfer:
If this bit is set, the UDPHS_EPTSTAx register RXRDY_TXKL bit is automatically reset for the current bank when the
last packet byte has been read from the bank FIFO or at the end of DMA buffer if the UDPHS_DMACONTROLx register
END_B_EN bit is set. For example, to truncate a padded data packet when the actual data transfer size is reached.
The user may still clear the UDPHS_EPTSTAx register RXRDY_TXKL bit, for example, after completing a DMA buffer
by software if UDPHS_DMACONTROLx register END_B_EN bit was disabled or in order to cancel the read of the
remaining data bank(s).
930
931
932
Address:
0xFC02C10C [0], 0xFC02C12C [1], 0xFC02C14C [2], 0xFC02C16C [3], 0xFC02C18C [4], 0xFC02C1AC [5],
0xFC02C1CC [6], 0xFC02C1EC [7], 0xFC02C20C [8], 0xFC02C22C [9], 0xFC02C24C [10], 0xFC02C26C [11],
0xFC02C28C [12], 0xFC02C2AC [13], 0xFC02C2CC [14], 0xFC02C2EC [15]
Access:
Read-only
31
SHRT_PCKT
30
29
28
27
26
25
24
23
22
21
20
19
18
BUSY_BANK
17
16
15
14
13
12
11
10
ERR_FLUSH
ERR_CRC_NT
R
ERR_FL_ISO
TXRDY_TRER
TX_COMPLT
RXRDY_TXKL
ERR_OVFLW
7
MDATA_RX
6
DATAX_RX
3
INTDIS_DMA
1
AUTO_VALID
0
EPT_ENABL
This register view is relevant only if EPT_TYPE = 0x1 in UDPHS Endpoint Configuration Register on page 920.
EPT_ENABL: Endpoint Enable
0: The endpoint is disabled according to the device configuration. Endpoint 0 should always be enabled after a hardware or
UDPHS bus reset and participate in the device configuration.
1: The endpoint is enabled according to the device configuration.
AUTO_VALID: Packet Auto-Valid Enabled
Set this bit to automatically validate the current packet and switch to the next bank for both IN and OUT endpoints.
For IN Transfer:
If this bit is set, the UDPHS_EPTSTAx register TXRDY_TRER bit is set automatically when the current bank is full and
at the end of DMA buffer if the UDPHS_DMACONTROLx register END_B_EN bit is set.
The user may still set the UDPHS_EPTSTAx register TXRDY_TRER bit if the current bank is not full, unless the user
wants to send a Zero Length Packet by software.
For OUT Transfer:
If this bit is set, the UDPHS_EPTSTAx register RXRDY_TXKL bit is automatically reset for the current bank when the
last packet byte has been read from the bank FIFO or at the end of DMA buffer if the UDPHS_DMACONTROLx register
END_B_EN bit is set. For example, to truncate a padded data packet when the actual data transfer size is reached.
The user may still clear the UDPHS_EPTSTAx register RXRDY_TXKL bit, for example, after completing a DMA buffer
by software if UDPHS_DMACONTROLx register END_B_EN bit was disabled or in order to cancel the read of the
remaining data bank(s).
933
934
935
35.7.15 UDPHS Endpoint Set Status Register (Control, Bulk, Interrupt Endpoints)
Name:
UDPHS_EPTSETSTAx [x=0..15]
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
TXRDY
10
9
RXRDY_TXKL
5
FRCESTALL
This register view is relevant only if EPT_TYPE = 0x0, 0x2 or 0x3 in UDPHS Endpoint Configuration Register on page
920.
For additional information, see UDPHS Endpoint Status Register (Control, Bulk, Interrupt Endpoints) on page 942.
FRCESTALL: Stall Handshake Request Set
0: No effect.
1: Set this bit to request a STALL answer to the host for the next handshake
Refer to chapters 8.4.5 (Handshake Packets) and 9.4.5 (Get Status) of the Universal Serial Bus Specification, Rev 2.0 for
more information on the STALL handshake.
RXRDY_TXKL: KILL Bank Set (for IN Endpoint)
0: No effect.
1: Kill the last written bank.
TXRDY: TX Packet Ready Set
0: No effect.
1: Set this bit after a packet has been written into the endpoint FIFO for IN data transfers
This flag is used to generate a Data IN transaction (device to host).
Device firmware checks that it can write a data payload in the FIFO, checking that TXRDY is cleared.
Transfer to the FIFO is done by writing in the Buffer Address register.
Once the data payload has been transferred to the FIFO, the firmware notifies the UDPHS device setting
TXRDY to one.
UDPHS bus transactions can start.
TXCOMP is set once the data payload has been received by the host.
Data should be written into the endpoint FIFO only after this bit has been cleared.
Set this bit without writing data to the endpoint FIFO to send a Zero Length Packet.
936
Address:
0xFC02C114 [0], 0xFC02C134 [1], 0xFC02C154 [2], 0xFC02C174 [3], 0xFC02C194 [4], 0xFC02C1B4 [5],
0xFC02C1D4 [6], 0xFC02C1F4 [7], 0xFC02C214 [8], 0xFC02C234 [9], 0xFC02C254 [10], 0xFC02C274 [11],
0xFC02C294 [12], 0xFC02C2B4 [13], 0xFC02C2D4 [14], 0xFC02C2F4 [15]
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
TXRDY_TRER
10
9
RXRDY_TXKL
This register view is relevant only if EPT_TYPE = 0x1 in UDPHS Endpoint Configuration Register on page 920.
For additional information, see UDPHS Endpoint Status Register (Isochronous Endpoint) on page 946.
RXRDY_TXKL: KILL Bank Set (for IN Endpoint)
0: No effect.
1: Kill the last written bank.
TXRDY_TRER: TX Packet Ready Set
0: No effect.
1: Set this bit after a packet has been written into the endpoint FIFO for IN data transfers
This flag is used to generate a Data IN transaction (device to host).
Device firmware checks that it can write a data payload in the FIFO, checking that TXRDY_TRER is cleared.
Transfer to the FIFO is done by writing in the Buffer Address register.
Once the data payload has been transferred to the FIFO, the firmware notifies the UDPHS device setting
TXRDY_TRER to one.
UDPHS bus transactions can start.
TXCOMP is set once the data payload has been sent.
Data should be written into the endpoint FIFO only after this bit has been cleared.
Set this bit without writing data to the endpoint FIFO to send a Zero Length Packet.
937
35.7.17 UDPHS Endpoint Clear Status Register (Control, Bulk, Interrupt Endpoints)
Name:
UDPHS_EPTCLRSTAx [x=0..15]
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
NAK_OUT
14
NAK_IN
13
STALL_SNT
12
RX_SETUP
11
10
TX_COMPLT
9
RXRDY_TXKL
6
TOGGLESQ
5
FRCESTALL
This register view is relevant only if EPT_TYPE = 0x0, 0x2 or 0x3 in UDPHS Endpoint Configuration Register on page
920.
For additional information, see UDPHS Endpoint Status Register (Control, Bulk, Interrupt Endpoints) on page 942.
FRCESTALL: Stall Handshake Request Clear
0: No effect.
1: Clear the STALL request. The next packets from host will not be STALLed.
TOGGLESQ: Data Toggle Clear
0: No effect.
1: Clear the PID data of the current bank
For OUT endpoints, the next received packet should be a DATA0.
For IN endpoints, the next packet will be sent with a DATA0 PID.
RXRDY_TXKL: Received OUT Data Clear
0: No effect.
1: Clear the RXRDY_TXKL flag of UDPHS_EPTSTAx.
TX_COMPLT: Transmitted IN Data Complete Clear
0: No effect.
1: Clear the TX_COMPLT flag of UDPHS_EPTSTAx.
RX_SETUP: Received SETUP Clear
0: No effect.
1: Clear the RX_SETUP flags of UDPHS_EPTSTAx.
STALL_SNT: Stall Sent Clear
0: No effect.
1: Clear the STALL_SNT flags of UDPHS_EPTSTAx.
938
939
Address:
0xFC02C118 [0], 0xFC02C138 [1], 0xFC02C158 [2], 0xFC02C178 [3], 0xFC02C198 [4], 0xFC02C1B8 [5],
0xFC02C1D8 [6], 0xFC02C1F8 [7], 0xFC02C218 [8], 0xFC02C238 [9], 0xFC02C258 [10], 0xFC02C278 [11],
0xFC02C298 [12], 0xFC02C2B8 [13], 0xFC02C2D8 [14], 0xFC02C2F8 [15]
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
ERR_FLUSH
ERR_CRC_NT
R
ERR_FL_ISO
TX_COMPLT
RXRDY_TXKL
6
TOGGLESQ
This register view is relevant only if EPT_TYPE = 0x1 in UDPHS Endpoint Configuration Register on page 920.
For additional information, see UDPHS Endpoint Status Register (Isochronous Endpoint) on page 946.
TOGGLESQ: Data Toggle Clear
0: No effect.
1: Clear the PID data of the current bank
For OUT endpoints, the next received packet should be a DATA0.
For IN endpoints, the next packet will be sent with a DATA0 PID.
RXRDY_TXKL: Received OUT Data Clear
0: No effect.
1: Clear the RXRDY_TXKL flag of UDPHS_EPTSTAx.
TX_COMPLT: Transmitted IN Data Complete Clear
0: No effect.
1: Clear the TX_COMPLT flag of UDPHS_EPTSTAx.
ERR_FL_ISO: Error Flow Clear
0: No effect.
1: Clear the ERR_FL_ISO flags of UDPHS_EPTSTAx.
ERR_CRC_NTR: Number of Transaction Error Clear
0: No effect.
1: Clear the ERR_CRC_NTR flags of UDPHS_EPTSTAx.
940
941
UDPHS_EPTSTAx [x=0..15]
Access:
Read-only
31
SHRT_PCKT
30
23
15
NAK_OUT
29
28
22
21
BYTE_COUNT
20
14
NAK_IN
7
6
TOGGLESQ_STA
27
BYTE_COUNT
26
19
18
BUSY_BANK_STA
25
24
17
16
CURBK_CTLDIR
13
STALL_SNT
12
RX_SETUP
11
TXRDY
10
TX_COMPLT
9
RXRDY_TXKL
8
ERR_OVFLW
5
FRCESTALL
This register view is relevant only if EPT_TYPE = 0x0, 0x2 or 0x3 in UDPHS Endpoint Configuration Register on page
920.
FRCESTALL: Stall Handshake Request
0: No effect.
1: If set a STALL answer will be done to the host for the next handshake.
This bit is reset by hardware upon received SETUP.
TOGGLESQ_STA: Toggle Sequencing
Toggle Sequencing:
IN endpoint: It indicates the PID Data Toggle that will be used for the next packet sent. This is not relative to
the current bank.
CONTROL and OUT endpoint:
These bits are set by hardware to indicate the PID data of the current bank:
Value
Name
Description
DATA0
DATA0
DATA1
DATA1
DATA2
MDATA
Notes:
942
1. In OUT transfer, the Toggle information is meaningful only when the current bank is busy (Received OUT Data = 1).
2. These bits are updated for OUT transfer:
- A new data has been written into the current bank.
- The user has just cleared the Received OUT Data bit to switch to the next bank.
3. This field is reset to DATA1 by the UDPHS_EPTCLRSTAx register TOGGLESQ bit, and by UDPHS_EPTCTLDISx (disable
endpoint).
943
Name
Description
BANK0
BANK1
Bank 1
BANK2
Bank 2
This bit is reset by UDPHS_EPTRST register EPT_x (reset endpoint) and by UDPHS_EPTCTLDISx (disable endpoint).
Control Direction (for Control endpoint only):
0: A Control Write is requested by the Host.
1: A Control Read is requested by the Host.
Notes:
1. This bit corresponds with the 7th bit of the bmRequestType (Byte 0 of the Setup Data).
2. This bit is updated after receiving new setup data.
944
Name
Description
1BUSYBANK
1 busy bank
2BUSYBANKS
2 busy banks
3BUSYBANKS
3 busy banks
945
Address:
0xFC02C11C [0], 0xFC02C13C [1], 0xFC02C15C [2], 0xFC02C17C [3], 0xFC02C19C [4], 0xFC02C1BC [5],
0xFC02C1DC [6], 0xFC02C1FC [7], 0xFC02C21C [8], 0xFC02C23C [9], 0xFC02C25C [10], 0xFC02C27C [11],
0xFC02C29C [12], 0xFC02C2BC [13], 0xFC02C2DC [14], 0xFC02C2FC [15]
Access:
Read-only
31
SHRT_PCKT
30
29
28
22
21
BYTE_COUNT
20
15
14
13
ERR_FLUSH
23
26
25
19
18
BUSY_BANK_STA
17
12
11
10
ERR_CRC_NT
R
ERR_FL_ISO
TXRDY_TRER
TX_COMPLT
RXRDY_TXKL
ERR_OVFLW
7
6
TOGGLESQ_STA
27
BYTE_COUNT
24
16
CURBK
This register view is relevant only if EPT_TYPE = 0x1 in UDPHS Endpoint Configuration Register on page 920.
TOGGLESQ_STA: Toggle Sequencing
Toggle Sequencing:
IN endpoint: It indicates the PID Data Toggle that will be used for the next packet sent. This is not relative to
the current bank.
OUT endpoint:
These bits are set by hardware to indicate the PID data of the current bank:
Value
Name
Description
DATA0
DATA0
DATA1
DATA1
DATA2
MDATA
Notes:
946
1. In OUT transfer, the Toggle information is meaningful only when the current bank is busy (Received OUT Data = 1).
2. These bits are updated for OUT transfer:
- A new data has been written into the current bank.
- The user has just cleared the Received OUT Data bit to switch to the next bank.
3. For High Bandwidth Isochronous Out endpoint, it is recommended to check the UDPHS_EPTSTAx/TXRDY_TRER bit to
know if the toggle sequencing is correct or not.
4. This field is reset to DATA1 by the UDPHS_EPTCLRSTAx register TOGGLESQ bit, and by UDPHS_EPTCTLDISx (disable
endpoint).
1. A transaction error occurs when the toggle sequencing does not respect the Universal Serial Bus Specification, Rev 2.0
(5.9.2 High Bandwidth Isochronous endpoints) (Bad PID, missing data....)
2. When a transaction error occurs, the user may empty all the bad transactions by clearing the Received OUT Data flag
(RXRDY_TXKL).
If this bit is reset, then the user should consider that a new n-transaction is coming.
947
This bit is reset by UDPHS_EPTRST register EPT_x (reset endpoint), and by UDPHS_EPTCTLDISx (disable endpoint).
ERR_FL_ISO: Error Flow
This bit is set by hardware when a transaction error occurs.
Isochronous IN transaction is missed, the micro has no time to fill the endpoint (underflow).
Isochronous OUT data is dropped because the bank is busy (overflow).
This bit is reset by UDPHS_EPTRST register EPT_x (reset endpoint) and by UDPHS_EPTCTLDISx (disable endpoint).
ERR_CRC_NTR: CRC ISO Error/Number of Transaction Error
CRC ISO Error (for Isochronous OUT endpoints) (Read-only):
This bit is set by hardware if the last received data is corrupted (CRC error on data).
This bit is updated by hardware when new data is received (Received OUT Data bit).
Number of Transaction Error (for High Bandwidth Isochronous IN endpoints):
This bit is set at the end of a microframe in which at least one data bank has been transmitted, if less than the number of
transactions per micro-frame banks (UDPHS_EPTCFGx register NB_TRANS) have been validated for transmission inside
this microframe.
This bit is reset by UDPHS_EPTRST register EPT_x (reset endpoint) and by UDPHS_EPTCTLDISx (disable endpoint).
ERR_FLUSH: Bank Flush Error
(for High Bandwidth Isochronous IN endpoints)
This bit is set when flushing unsent banks at the end of a microframe.
This bit is reset by UDPHS_EPTRST register EPT_x (reset endpoint) and by EPT_CTL_DISx (disable endpoint).
CURBK: Current Bank
Current Bank:
These bits are set by hardware to indicate the number of the current bank.
Value
Name
Description
BANK0
BANK1
Bank 1
BANK2
Bank 2
This bit is reset by UDPHS_EPTRST register EPT_x (reset endpoint) and by UDPHS_EPTCTLDISx (disable endpoint).
BUSY_BANK_STA: Busy Bank Number
These bits are set by hardware to indicate the number of busy banks.
IN endpoint: It indicates the number of busy banks filled by the user, ready for IN transfer.
OUT endpoint: It indicates the number of busy banks filled by OUT transaction from the Host.
Value
948
Name
Description
1BUSYBANK
1 busy bank
2BUSYBANKS
2 busy banks
3BUSYBANKS
3 busy banks
949
950
UDPHS_DMANXTDSCx [x = 0..6]
Address:
0xFC02C300 [0], 0xFC02C310 [1], 0xFC02C320 [2], 0xFC02C330 [3], 0xFC02C340 [4], 0xFC02C350 [5],
0xFC02C360 [6]
Access:
Read/Write
31
30
29
28
27
NXT_DSC_ADD
26
25
24
23
22
21
20
19
NXT_DSC_ADD
18
17
16
15
14
13
12
11
NXT_DSC_ADD
10
4
3
NXT_DSC_ADD
951
UDPHS_DMAADDRESSx [x = 0..6]
Address:
0xFC02C304 [0], 0xFC02C314 [1], 0xFC02C324 [2], 0xFC02C334 [3], 0xFC02C344 [4], 0xFC02C354 [5],
0xFC02C364 [6]
Access:
31
Read/Write
30
29
28
27
26
25
24
19
18
17
16
11
10
BUFF_ADD
23
22
21
20
BUFF_ADD
15
14
13
12
BUFF_ADD
4
BUFF_ADD
952
UDPHS_DMACONTROLx [x = 0..6]
Address:
0xFC02C308 [0], 0xFC02C318 [1], 0xFC02C328 [2], 0xFC02C338 [3], 0xFC02C348 [4], 0xFC02C358 [5],
0xFC02C368 [6]
Access:
Read/Write
31
30
29
28
27
BUFF_LENGTH
26
25
24
23
22
21
20
19
BUFF_LENGTH
18
17
16
15
14
13
12
11
10
7
BURST_LCK
6
DESC_LD_IT
5
END_BUFFIT
4
END_TR_IT
3
END_B_EN
2
END_TR_EN
1
LDNXT_DSC
0
CHANN_ENB
953
CHANN_ENB
Description
Stop now
954
1. Bits [31:2] are only writable when issuing a channel Control Command other than Stop Now.
2. For reliability it is highly recommended to wait for both UDPHS_DMASTATUSx register CHAN_ACT and CHAN_ENB flags
are at 0, thus ensuring the channel has been stopped before issuing a command other than Stop Now.
955
UDPHS_DMASTATUSx [x = 0..6]
Address:
0xFC02C30C [0], 0xFC02C31C [1], 0xFC02C32C [2], 0xFC02C33C [3], 0xFC02C34C [4], 0xFC02C35C [5],
0xFC02C36C [6]
Access:
Read/Write
31
30
29
28
27
BUFF_COUNT
26
25
24
23
22
21
20
19
BUFF_COUNT
18
17
16
15
14
13
12
11
10
6
DESC_LDST
5
END_BF_ST
4
END_TR_ST
1
CHANN_ACT
0
CHANN_ENB
957
36.
36.1
Description
The USB Host High Speed Port (UHPHS) interfaces the USB with the host application. It handles Open HCI
protocol (Open Host Controller Interface) as well as Enhanced HCI protocol (Enhanced Host Controller Interface).
36.2
Embedded Characteristics
958
3 Hosts (A, B, and C) High Speed (EHCI), Port A shared with UDPHS
36.3
Block Diagram
Figure 36-1.
Block Diagram
HCI
Slave Block
AHB
Slave
OHCI
Registers
Root
Hub Registers
List Processor
Block
Control
ED & TD
Registers
Embedded USB
v2.0 Transceiver
Root Hub
and
Host SIE
Master
AHB
HCI
Master Block
Data
HCI
Slave Block
Slave
EHCI
Registers
HFSDPC
HFSDMC
HHSDPC
HHSDMC
PORT S/M 1
USB High-speed
Transceiver
HFSDPB
HFSDMB
HHSDPB
HHSDMB
PORT S/M 0
USB High-speed
Transceiver
HFSDPA
HFSDMA
HHSDPA
HHSDMA
FIFO 64 x 8
SOF
generator
AHB
PORT S/M 2
USB High-speed
Transceiver
Packet
Buffer
FIFO
Control
List
Processor
Master
AHB
HCI
Master Block
Data
Access to the USB host operational registers is achieved through the AHB bus slave interface. The Open HCI host
controller and Enhanced HCI host controller initialize master DMA transfers through the AHB bus master interface
as follows:
Memory access errors (abort, misalignment) lead to an Unrecoverable Error 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 hubs 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 hubs ports.
Over current protection on ports can be activated by the USB host controller. Atmels standard product does not
dedicate pads to external over current protection.
959
36.4
Typical Connection
Figure 36-2.
"A" Receptacle
1 = VBUS
2 = D3 = D+
4 = GND
HHSDM/HFSDM
3 4
Shell = Shield
1 2
HHSDP/HFSDP
5K62 1%
VBG
10 pF
GNDUTMI
960
36.5
Product Dependencies
Select UPLLCK as Input clock of OHCI part (set USBS bit in PMC_USB register).
Program the OHCI clocks (UHP48M and UHP12M) with USBDIV field in PMC_USB register. USBDIV must
be 9 (division by 10) if UPLLCK is selected.
Select PLLACK as Input clock of OHCI part (clear USBS bit in PMC_USB register).
Program the OHCI clocks (UHP48M and UHP12M) with USBDIV field in PMC_USB register. USBDIV value
is to calculated regarding the PLLACK value and USB Full-speed accuracy.
961
Figure 36-3.
AHB
EHCI
Master
Interface
30 MHz
Port
Router
EHCI
User
Interface
30 MHz
30 MHz
UTMI transceiver
UTMI transceiver
UTMI transceiver
MCK
OHCI
Master
Interface
Root Hub
and
Host SIE
UHP48M
UHP12M
OHCI
User
Interface
OHCI clocks
36.5.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 UHPHS.
962
36.6
Functional Description
USB Selection
Other
Transceivers
HS
Transceiver
EN_UDPHS
0
Other Ports
HS USB Host
HS EHCI
FS OHCI
DMA
PA
HS
USB
Device
DMA
36.6.2 EHCI
The USB Host Port controller is fully compliant with the Enhanced HCI specification. The USB Host Port User
Interface (registers description) can be found in the Enhanced HCI Rev 1.0 Specification available on
www.usb.org. The standard EHCI USB stack driver can be easily ported to Atmels architecture in the same way
all existing class drivers run, without hardware specialization.
36.6.3 OHCI
The USB Host Port integrates a root hub and transceivers on downstream ports. It provides several Full-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 Open HCI specification. The USB Host Port User Interface
(registers description) can be found in the Open HCI Rev 1.0 Specification available on www.usb.org. The
standard OHCI USB stack driver can be easily ported to Atmels 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 users application. As
an example, integrating an HID (Human Interface Device) class driver provides a plug & play feature for all USB
keyboards and mouses.
963
37.
37.1
Description
The Ethernet MAC (GMAC) module implements a 10/100 Mbps Ethernet MAC compatible with the IEEE 802.3
standard. The GMAC can operate in either half or full duplex mode at all supported speeds. The Network
Configuration Register is used to select the speed, duplex mode and interface type (MII, RMII, ).
The GMAC comprises two constituent components:
37.2
964
Embedded Characteristics
Automatic pad and cyclic redundancy check (CRC) generation on transmitted frames
Receive and transmit IP, TCP and UDP checksum offload. Both IPv4 and IPv6 packet types supported
Address checking logic for four specific 48-bit addresses, four type IDs, promiscuous mode, hash matching
of unicast and multicast destination addresses and Wake-on-LAN
Full duplex flow control with recognition of incoming pause frames and hardware generation of transmitted
pause frames
Support for 802.1Q VLAN tagging with recognition of incoming VLAN and priority tagged frames
37.3
Block Diagram
Figure 37-1.
Block Diagram
Status &
Statistic
Registers
APB
Register
Interface
MDIO
Control
Registers
MAC Transmitter
AHB
AHB DMA
Interface
FIFO
Interface
Media Interface
MAC Receiver
Frame Filtering
37.4
Signal Interface
The GMAC includes the following signal interfaces
Signal Name
Function
MII
RMII
GTXCK
TXCK
REFCK
GTXEN
Transmit Enable
TXEN
TXEN
GTX[3..0]
Transmit Data
TXD[3:0]
TXD[1:0]
GTXER
TXER
Not Used
GRXCK
Receive Clock
RXCK
Not Used
GRXDV
RXDV
CRSDV
GRX[3..0]
Receive Data
RXD[3:0]
RXD[1:0]
GRXER
Receive Error
RXER
RXER
GCRS
CRS
Not Used
GCOL
Collision Detect
COL
Not Used
GMDC
MDC
MDC
GMDIO
MDIO
MDIO
965
37.5
Functional Description
Received frames, optionally including FCS, are written to receive AHB buffers stored in memory. The receive
buffer depth is programmable in the range of 64 bytes to 16 Kbytes through the DMA Configuration Register
(GMAC_DCFGR), with the default being 128 bytes.
The start location for each receive AHB buffer is stored in memory in a list of receive buffer descriptors at an
address location pointed to by the receive buffer queue pointer. The base address for the receive buffer queue
pointer is configured in software using the Receive Buffer Queue Base Address Register (GMAC_RBQB).
966
Each list entry consists of two words. The first is the address of the receive AHB buffer and the second the receive
status. If the length of a receive frame exceeds the AHB buffer length, the status word for the used buffer is written
with zeroes except for the start of frame bit, which is always set for the first buffer in a frame. Bit zero of the
address field is written to 1 to show the buffer has been used. The receive buffer manager then reads the location
of the next receive AHB buffer and fills that with the next part of the received frame data. AHB buffers are filled until
the frame is complete and the final buffer descriptor status word contains the complete frame status. Refer to
Table 37-2, Receive Buffer Descriptor Entry for details of the receive buffer descriptor list.
Each receive AHB buffer start location is a word address. The start of the first AHB buffer in a frame can be offset
by up to three bytes, depending on the value written to bits 14 and 15 of the Network Configuration Register
(GMAC_NCFGR). For 64-bit datapaths, the start of the frame can be offset by up to a further four bytes if bit 2 of
the AHB buffer start location in the buffer descriptor is set. If the start location of the AHB buffer is offset, the
available length of the first AHB buffer is reduced by the corresponding number of bytes.
Table 37-2.
Bit
31:2
Ownershipneeds to be zero for the GMAC to write data to the receive buffer. The GMAC sets this to one once it
has successfully written a frame to memory.
Software has to clear this bit before the buffer can be used again.
Word 1
31
30
29
28
27
Specific Address Register match found, bit 25 and bit 26 indicate which Specific Address Register causes the
match.
Specific Address Register match. Encoded as follows:
00: Specific Address Register 1 match
26:25
24
Type ID register match found, bit 22 and bit 23 indicate which type ID register causes the match.
With RX checksum offloading enabled: (bit 24 set in Network Configuration Register)
0: The frame was not SNAP encoded and/or had a VLAN tag with the Canonical Format Indicator (CFI) bit set.
1: The frame was SNAP encoded and had either no VLAN tag or a VLAN tag with the CFI bit not set.
967
Table 37-2.
Bit
23:22
21
VLAN tag detectedtype ID of 0x8100. For packets incorporating the stacked VLAN processing feature, this bit
will be set if the second VLAN tag has a type ID of 0x8100
20
Priority tag detectedtype ID of 0x8100 and null VLAN identifier. For packets incorporating the stacked VLAN
processing feature, this bit will be set if the second VLAN tag has a type ID of 0x8100 and a null VLAN identifier.
19:17
16
15
End of framewhen set the buffer contains the end of a frame. If end of frame is not set, then the only valid status
bit is start of frame (bit 14).
14
Start of framewhen set the buffer contains the start of a frame. If both bits 15 and 14 are set, the buffer contains
a whole frame.
This bit has a different meaning depending on whether jumbo frames and ignore FCS modes are enabled. If
neither mode is enabled this bit will be zero.
With jumbo frame mode enabled: (bit 3 set in Network Configuration Register) Additional bit for length of frame
(bit[13]), that is concatenated with bits[12:0]
13
With ignore FCS mode enabled and jumbo frames disabled: (bit 26 set in Network Configuration Register and
bit 3 clear in Network Configuration Register) This indicates per frame FCS status as follows:
0: Frame had good FCS
1: Frame had bad FCS, but was copied to memory as ignore FCS enabled.
These bits represent the length of the received frame which may or may not include FCS depending on whether
FCS discard mode is enabled.
With FCS discard mode disabled: (bit 17 clear in Network Configuration Register)
12:0
Least significant 12 bits for length of frame including FCS. If jumbo frames are enabled, these 12 bits are
concatenated with bit[13] of the descriptor above.
With FCS discard mode enabled: (bit 17 set in Network Configuration Register)
Least significant 12 bits for length of frame excluding FCS. If jumbo frames are enabled, these 12 bits are
concatenated with bit[13] of the descriptor above.
968
To receive frames, the AHB buffer descriptors must be initialized by writing an appropriate address to bits 31:2 in
the first word of each list entry. Bit 0 must be written with zero. Bit 1 is the wrap bit and indicates the last entry in
the buffer descriptor list.
The start location of the receive buffer descriptor list must be written with the receive buffer queue base address
before reception is enabled (receive enable in the Network Control Register). Once reception is enabled, any
writes to the Receive Buffer Queue Base Address Register are ignored. When read, it will return the current
pointer position in the descriptor list, though this is only valid and stable when receive is disabled.
If the filter block indicates that a 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 recovered.
An internal counter within the GMAC represents the receive buffer queue pointer and it is not visible through the
CPU interface. The receive buffer queue pointer increments by two words after each buffer has been used. It reinitializes to the receive buffer queue base address if any descriptor has its wrap bit set.
As receive AHB buffers are used, the receive AHB buffer manager sets bit zero of the first word of the descriptor to
logic one indicating the AHB buffer has been used.
Software should search through the used bits in the AHB buffer descriptors to find out how many frames have
been received, checking the start of frame and end of frame bits.
To function properly, a 10/100 Ethernet system should have no excessive length frames or frames greater than
128 bytes with CRC errors. Collision fragments will be less than 128 bytes long, therefore it will be a rare
occurrence to find a frame fragment in a receive AHB buffer, when using the default value of 128 bytes for the
receive buffers size.
If bit zero of the receive buffer descriptor is already set when the receive buffer manager reads the location of the
receive AHB buffer, then the buffer has been already used and cannot be used again until software has processed
the frame and cleared bit zero. In this case, the buffer not available bit in the receive status register is set and an
interrupt triggered. The receive resource error statistics register is also incremented.
37.5.3.2 Transmit AHB Buffers
Frames to transmit are stored in one or more transmit AHB buffers. Transmit frames can be between 1 and 16384
bytes long, so it is possible to transmit frames longer than the maximum length specified in the IEEE 802.3
standard. It should be noted that zero length AHB buffers are allowed and that the maximum number of buffers
permitted for each transmit frame is 128.
The start location for each transmit AHB buffer is stored in memory in a list of transmit buffer descriptors at a
location pointed to by the transmit buffer queue pointer. The base address for this queue pointer is set in software
using the Transmit Buffer Queue Base Address Register. Each list entry consists of two words. The first is the byte
address of the transmit buffer and the second containing the transmit control and status. For the FIFO-based DMA
configured with a 32-bit data path the address of the buffer is a byte address. For bus widths of 64 or 128-bits
however, the address of the buffer must be aligned to the correct 64-bit or 128-bit boundary, plus an offset of less
than 4 bytes. (Note this alignment restriction in FIFO-based DMA mode only should be sufficient for applications as
the main purpose is to allow alignment of the encapsulated IP packet. Given the 14 bytes of MAC encapsulation,
an offset of 2 will always align the IP header to a 128-bit boundary.)
Frames can be transmitted with or without automatic CRC generation. If CRC is automatically generated, pad will
also be automatically generated to take frames to a minimum length of 64 bytes. When CRC is not automatically
generated (as defined in word 1 of the transmit buffer descriptor or through the control bus of FIFO), the frame is
assumed to be at least 64 bytes long and pad is not generated.
An entry in the transmit buffer descriptor list is described in Table 37-3, Transmit Buffer Descriptor Entry.
To transmit frames, the buffer descriptors must be initialized by writing an appropriate byte address to bits [31:0] in
the first word of each descriptor list entry.
969
The second word of the transmit buffer descriptor is initialized with control information that indicates the length of
the frame, whether or not the MAC is to append CRC and whether the buffer is the last buffer in the frame.
After transmission the status bits are written back to the second word of the first buffer along with the used bit. Bit
31 is the used bit which must be zero when the control word is read if transmission is to take place. It is written to
one once the frame has been transmitted. Bits[29:20] 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 the queue pointer continues to
increment.
The Transmit Buffer Queue Base Address Register can only be updated while transmission is disabled or halted;
otherwise any attempted write will be ignored. When transmission is halted the transmit buffer queue pointer will
maintain its value. Therefore when transmission is restarted the next descriptor read from the queue will be from
immediately after the last successfully transmitted frame. while transmit is disabled (bit 3 of the network control set
low), the transmit buffer queue pointer resets to point to the address indicated by the Transmit Buffer Queue Base
Address Register. Note that disabling receive does not have the same effect on the receive buffer queue pointer.
Once the transmit queue is initialized, transmit is activated by writing to the transmit start bit (bit 9) of the Network
Control Register. Transmit is halted when a buffer descriptor with its used bit set is read, 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. This is implemented with TXGO variable which is readable in the Transmit Status
Register at bit location 3. The TXGO variable is reset when:
Transmit is disabled.
To set TXGO, write TSTART to the bit 9 of the Network Control Register. Transmit halt does not take effect until
any ongoing transmit finishes.
If the DMA is configured for internal FIFO mode, transmission will automatically restart from the first buffer of the
frame.
If a used bit is read mid way through transmission of a multi buffer frame this is treated as a transmit error.
Transmission stops, GTXER is asserted and the FCS will be bad.
If transmission stops due to a transmit error or a used bit being read, transmission will restart from the first buffer
descriptor of the frame being transmitted when the transmit start bit is rewritten.
Table 37-3.
Bit
Function
Word 0
31:0
970
31
Usedmust be zero for the GMAC to read data to the transmit buffer. The GMAC sets this to one for the first buffer
of a frame once it has been successfully transmitted. Software must clear this bit before the buffer can be used
again.
30
Wrapmarks last descriptor in transmit buffer descriptor list. This can be set for any buffer within the frame.
29
28
Transmit underrunoccurs when the start of packet data has been written into the FIFO and either HRESP is not
OK, or the transmit data could not be fetched in time, or when buffers are exhausted.
Table 37-3.
Bit
Function
27
Transmit frame corruption due to AHB errorset if an error occurs while midway through reading transmit frame
from the AHB, including HRESP errors and buffers exhausted mid frame (if the buffers run out during transmission
of a frame then transmission stops, FCS shall be bad and GTXER asserted).
26
25:23
Reserved
Transmit IP/TCP/UDP checksum generation offload errors:
000: No Error.
001: The Packet was identified as a VLAN type, but the header was not fully complete, or had an error in it.
010: The Packet was identified as a SNAP type, but the header was not fully complete, or had an error in it.
011: The Packet was not of an IP type, or the IP packet was invalidly short, or the IP was not of type IPv4/IPv6.
22:20
19:17
Reserved
No CRC to be appended by MAC. When set, this implies that the data in the buffers already contains a valid CRC,
hence no CRC or padding is to be appended to the current frame by the MAC.
16
This control bit must be set for the first buffer in a frame and will be ignored for the subsequent buffers of a frame.
Note that this bit must be clear when using the transmit IP/TCP/UDP checksum generation offload, otherwise
checksum generation and substitution will not occur.
15
Last buffer, when set this bit will indicate the last buffer in the current frame has been reached.
14
Reserved
13:0
Length of buffer
The DMA will always use SINGLE, or INCR type AHB accesses for buffer management operations. When
performing data transfers, the AHB burst length used can be programmed using bits [4:0] of the DMA
Configuration Register so that either SINGLE, INCR or fixed length incrementing bursts (INCR4, INCR8 or
INCR16) are used where possible.
When there is enough space and enough data to be transferred, the programmed fixed length bursts will be used.
If there is not enough data or space available, for example when at the beginning or the end of a buffer, SINGLE
type accesses are used. Also SINGLE type accesses are used at 1024 byte boundaries, so that the 1 Kbyte
boundaries are not burst over as per AHB requirements.
The DMA will not terminate a fixed length burst early, unless an error condition occurs on the AHB or if receive or
transmit are disabled in the Network Control Register.
37.5.4 MAC Transmit Block
The MAC transmitter can operate in either half duplex or full duplex mode and transmits frames in accordance with
the Ethernet IEEE 802.3 standard. In half duplex mode, the CSMA/CD protocol of the IEEE 802.3 specification is
followed.
971
A small input buffer receives data through FIFO which, depending on the DMA bus width control bits in the
Network Configuration Register, will extract data in 32-bit or 64-bit form. All subsequent processing prior to the
final output is performed in bytes.
Transmit data can be output using the MII interface.
Frame assembly starts by adding preamble and the start frame delimiter. Data is taken from FIFO a word at a time.
If necessary, padding is added to take the frame length to 60 bytes. CRC is calculated using an order 32-bit
polynomial. This is inverted and appended to the end of the frame taking the frame length to a minimum of 64
bytes. If the no CRC bit is set in the second word of the last buffer descriptor of a transmit frame, neither pad nor
CRC are appended. The no CRC bit can also be set through FIFO.
In full duplex mode (at all data rates), frames are transmitted immediately. Back to back frames are transmitted at
least 96 bit times apart to guarantee the interframe gap.
In half duplex mode, the transmitter checks carrier sense. If asserted, the transmitter waits for the signal to
become inactive, and then starts transmission after the interframe gap of 96 bit times. If the collision signal is
asserted during transmission, the transmitter will transmit a jam sequence of 32 bits taken from the data register
and then retry transmission after the back off time has elapsed. If the collision occurs during either the preamble or
Start Frame Delimiter (SFD), then these fields will be completed prior to generation of the jam sequence.
The back off time is based on an XOR of the 10 least significant bits of the data coming from FIFO and a 10-bit
pseudo random number generator. The number of bits used depends on the number of collisions seen. After the
first collision 1 bit is used, then the second 2 bits and so on up to the maximum of 10 bits. All 10 bits are used
above ten collisions. An error will be indicated and no further attempts will be made if 16 consecutive attempts
cause collision. This operation is compliant with the description in Clause 4.2.3.2.5 of the IEEE 802.3 standard
which refers to the truncated binary exponential back off algorithm.
In 10/100 mode, both collisions and late collisions are treated identically, and back off and retry will be performed
up to 16 times. This condition is reported in the transmit buffer descriptor word 1 (late collision, bit 26) and also in
the Transmit Status Register (late collision, bit 7). An interrupt can also be generated (if enabled) when this
exception occurs, and bit 5 in the Interrupt Status Register will be set.
In all modes of operation, if the transmit DMA underruns, a bad CRC is automatically appended using the same
mechanism as jam insertion and the GTXER signal is asserted. For a properly configured system this should never
happen.
By setting when bit 28 is set in the Network Configuration Register, the Inter Packet Gap (IPG) may be stretched
beyond 96 bits depending on the length of the previously transmitted frame and the value written to the IPG
Stretch Register (GMAC_IPGS). The least significant 8 bits of the IPG Stretch Register multiply the previous frame
length (including preamble). The next significant 8 bits (+1 so as not to get a divide by zero) divide the frame length
to generate the IPG. IPG stretch only works in full duplex mode and when bit 28 is set in the Network Configuration
Register. The IPG Stretch Register cannot be used to shrink the IPG below 96 bits.
If the back pressure bit is set in the Network Control Register, or if the HDFC configuration bit is set in the
GMAC_UR register (10M or 100M half duplex mode), the transmit block transmits 64 bits of data, which can
consist of 16 nibbles of 1011 or in bit rate mode 64 1s, whenever it sees an incoming frame to force a collision.
This provides a way of implementing flow control in half duplex mode.
37.5.5 MAC Receive Block
All processing within the MAC receive block is implemented using a 16-bit data path. The MAC receive block
checks for valid preamble, FCS, alignment and length, presents received frames to FIFO and stores the frame
destination address for use by the address checking block.
If, during the frame reception, the frame is found to be too long, a bad frame indication is sent to FIFO. The
receiver logic ceases to send data to memory as soon as this condition occurs.
972
At end of frame reception the receive block indicates to the DMA block whether the frame is good or bad. The DMA
block will recover the current receive buffer if the frame was bad.
Ethernet frames are normally stored in DMA memory or to FIFO complete with the FCS. Setting the FCS remove
bit in the network configuration (bit 17) causes frames to be stored without their corresponding FCS. The reported
frame length field is reduced by four bytes to reflect this operation.
The receive block signals to the register block to increment the alignment, CRC (FCS), short frame, long frame,
jabber or receive symbol errors when any of these exception conditions occur.
If bit 26 is set in the network configuration, CRC errors will be ignored and CRC errored frames will not be
discarded, though the Frame Check Sequence Errors statistic register will still be incremented. Additionally, if
configured to use the DMA and not enabled for jumbo frames mode, then bit[13] of the receiver descriptor word 1
will be updated to indicate the FCS validity for the particular frame. This is useful for applications such as
EtherCAT whereby individual frames with FCS errors must be identified.
Received frames can be checked for length field error by setting the length field error frame discard bit of the
Network Configuration Register (bit-16). When this bit is set, the receiver compares a frame's measured length
with the length field (bytes 13 and 14) extracted from the frame. The frame is discarded if the measured length is
shorter. This checking procedure is for received frames between 64 bytes and 1518 bytes in length.
Each discarded frame is counted in the 10 bit length field error statistics register. Frames where the length field is
greater than or equal to 0x0600 hex will not be checked.
37.5.6 Checksum Offload for IP, TCP and UDP
The GMAC can be programmed to perform IP, TCP and UDP checksum offloading in both receive and transmit
directions, which is enabled by setting bit 24 in the Network Configuration Register for receive.
IPv4 packets contain a 16-bit checksum field, which is the 16-bit 1s complement of the 1s complement sum of all
16-bit words in the header. TCP and UDP packets contain a 16-bit checksum field, which is the 16-bit 1s
complement of the 1s complement sum of all 16-bit words in the header, the data and a conceptual IP pseudo
header.
To calculate these checksums in software requires each byte of the packet to be processed. For TCP and UDP
this can use a large amount of processing power. Offloading the checksum calculation to hardware can result in
significant performance improvements.
For IP, TCP or UDP checksum offload to be useful, the operating system containing the protocol stack must be
aware that this offload is available so that it can make use of the fact that the hardware can either generate or
verify the checksum.
37.5.6.1 Receiver Checksum Offload
When receive checksum offloading is enabled in the GMAC, the IPv4 header checksum is checked as per RFC
791, where the packet meets the following criteria:
If present, the VLAN header must be four octets long and the CFI bit must not be set.
Encapsulation must be RFC 894 Ethernet Type Encoding or RFC 1042 SNAP Encoding.
IPv4 packet
The GMAC also checks the TCP checksum as per RFC 793, or the UDP checksum as per RFC 768, if the
following criteria are met:
No IP fragmentation
973
When an IP, TCP or UDP frame is received, the receive buffer descriptor gives an indication if the GMAC was able
to verify the checksums. There is also an indication if the frame had SNAP encapsulation. These indication bits will
replace the type ID match indication bits when the receive checksum offload is enabled. For details of these
indication bits refer to Table 37-2, Receive Buffer Descriptor Entry.
If any of the checksums are verified as incorrect by the GMAC, the packet is discarded and the appropriate
statistics counter incremented.
37.5.7 MAC Filtering Block
The filter block determines which frames should be written to FIFO and on to the optional DMA.
Whether a frame is passed depends on what is enabled in the Network Configuration Register, the state of the
external matching pins, the contents of the specific address, type and Hash Registers and the frame's destination
address and type field.
If bit 25 of the Network Configuration Register is not set, a frame will not be copied to memory if the GMAC is
transmitting in half duplex mode at the time a destination address is received.
Ethernet frames are transmitted a byte at a time, least significant bit first. The first six bytes (48 bits) of an Ethernet
frame make up the destination address. The first bit of the destination address, which is the LSB of the first byte of
the frame, is the group or individual bit. This is one for multicast addresses and zero for unicast. The all ones
address is the broadcast address and a special case of multicast.
The GMAC supports recognition of four specific addresses. Each specific address requires two registers, Specific
Address Register Bottom and Specific Address Register Top. Specific Address Register Bottom stores the first
four bytes of the destination address and Specific Address Register Top contains the last two bytes. The
addresses stored can be specific, group, local or universal.
The destination address of received frames is compared against the data stored in the Specific Address Registers
once they have been activated. The addresses are deactivated at reset or when their corresponding Specific
Address Register Bottom is written. They are activated when Specific Address Register Top is written. If a receive
frame address matches an active address, the frame is written to FIFO and on to DMA memory if used.
Frames may be filtered using the type ID field for matching. Four type ID registers exist in the register address
space and each can be enabled for matching by writing a one to the MSB (bit 31) of the respective register. When
a frame is received, the matching is implemented as an OR function of the various types of match.
The contents of each type ID register (when enabled) are compared against the length/type ID of the frame being
received (e.g., bytes 13 and 14 in non-VLAN and non-SNAP encapsulated frames) and copied to memory if a
match is found. The encoded type ID match bits (Word 0, Bit 22 and Bit 23) in the receive buffer descriptor status
are set indicating which type ID register generated the match, if the receive checksum offload is disabled.
The reset state of the type ID registers is zero, hence each is initially disabled.
974
The following example illustrates the use of the address and type ID match registers for a MAC address of
21:43:65:87:A9:CB:
Note:
1.
Preamble
55
SFD
D5
DA (Octet 0 - LSB)
21
DA (Octet 1)
43
DA (Octet 2)
65
DA (Octet 3)
87
DA (Octet 4)
A9
DA (Octet 5 - MSB)
CB
SA (LSB)
00(1)
SA
00(1)
SA
00(1)
SA
00(1)
SA
00(1)
SA (MSB)
00(1)
Type ID (MSB)
43
Type ID (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:
Specific Address 1 Bottom [31:0] Register (GMAC_SAB1) (Address 0x088) 0x87654321
Specific Address 1 Top [47:32] Register (GMAC_SAT1) (Address 0x08C)
0x0000CBA9
And for a successful match to the type ID, the following Type ID Match 1 Register must be set up:
Type ID Match 1 Register (GMAC_TIDM1) (Address 0x0A8)
0x80004321
975
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 will be matched according to whether
the frame is multicast or unicast.
A multicast match will be signalled if the multicast hash enable bit is set, da[0] is logic 1 and the hash index
points to a bit set in the Hash Register.
A unicast match will be signalled if the unicast hash enable bit is set, da[0] is logic 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.
37.5.10 Copy all Frames (Promiscuous Mode)
If the Copy All Frames bit is set in the Network Configuration Register then all frames (except those that are too
long, too short, have FCS errors or have GRXER asserted during reception) will be copied to memory. Frames
with FCS errors will be copied if bit 26 is set in the Network Configuration Register.
37.5.11 Disable Copy of Pause Frames
Pause frames can be prevented from being written to memory by setting the disable copying of pause frames
control bit 23 in the Network Configuration Register. When set, pause frames are not copied to memory regardless
of the Copy All Frames bit, whether a hash match is found, a type ID match is identified or if a destination address
match is found.
37.5.12 VLAN Support
An Ethernet encoded 802.1Q VLAN tag looks like this:
Table 37-4.
976
0x8100
The VLAN tag is inserted at the 13th byte of the frame adding an extra four bytes to the frame. To support these
extra four bytes, the GMAC can accept frame lengths up to 1536 bytes by setting bit 8 in the Network
Configuration Register.
If the VID (VLAN identifier) is null (0x000) this indicates a priority-tagged frame.
The following bits in the receive buffer descriptor status word give information about VLAN tagged frames:
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 will be
set also.)
The GMAC can be configured to reject all frames except VLAN tagged frames by setting the discard non-VLAN
frames bit in the Network Configuration Register.
37.5.13 Wake on LAN Support
The receive block supports Wake on LAN by detecting the following events on incoming receive frames:
Magic packet
These events can be individually enabled through bits [19:16] of the Wake on LAN Register. Also, for Wake on
LAN detection to occur, receive enable must be set in the Network Control Register, however a receive buffer does
not have to be available.
In case of an ARP request, specific address 1 or multicast filter events will occur even if the frame is errored. For
magic packet events, the frame must be correctly formed and error free.
A magic packet event is detected if all of the following are true:
Magic packet events are enabled through bit 16 of the Wake on LAN Register
There are 16 repetitions of the contents of Specific Address 1 Register immediately following the
synchronization
ARP request events are enabled through bit 17 of the Wake on LAN Register
The frame has an ARP operation field of 0x0001 (bytes 21 and 22)
The least significant 16 bits of the frame's ARP target protocol address (bytes 41 and 42) match the value
programmed in bits[15:0] of the Wake on LAN Register
The decoding of the ARP fields adjusts automatically if a VLAN tag is detected within the frame. The reserved
value of 0x0000 for the Wake on LAN target address value will not cause an ARP request event, even if matched
by the frame.
977
A specific address 1 filter match event will occur if all of the following are true:
Specific address 1 events are enabled through bit 18 of the Wake on LAN Register
The frame's destination address matches the value programmed in the Specific Address 1 Registers
A multicast filter match event will occur if all of the following are true:
Multicast hash events are enabled through bit 19 of the Wake on LAN Register
Multicast hash filtering is enabled through bit 6 of the Network Configuration Register
The frame destination address matches against the multicast hash filter
978
The GMAC recognizes four different encapsulations for PTP event messages:
1. 1588 version 1 (UDP/IPv4 multicast)
2.
3.
4.
Table 37-5.
Frame Segment
Value
Preamble/SFD
55555555555555D5
DA (Octets 05)
SA (Octets 611)
0800
11
IP DA (Octets 3032)
E00001
IP DA (Octet 33)
81 or 82 or 83 or 84
013F
01
00
Table 37-6.
Frame Segment
Value
Preamble/SFD
55555555555555D5
DA (Octets 05)
SA (Octets 611)
0800
11
IP DA (Octets 3032)
E00001
IP DA (Octet 33)
81 or 82 or 83 or 84
013F
979
Table 37-6.
Frame Segment
Value
01
01
For 1588 version 1 messages, sync and delay request frames are indicated by the GMAC if the frame type field
indicates TCP/IP, UDP protocol is indicated, the destination IP address is 224.0.1.129/130/131 or 132, the
destination UDP port is 319 and the control field is correct.
The control field is 0x00 for sync frames and 0x01 for delay request frames.
For 1588 version 2 messages, the type of frame is determined by looking at the message type field in the first byte
of the PTP frame. Whether a frame is version 1 or version 2 can be determined by looking at the version PTP field
in the second byte of both version 1 and version 2 PTP frames.
In version 2 messages sync frames have a message type value of 0x0, delay_req have 0x1, Pdelay_Req have 0x2
and Pdelay_Resp have 0x3.
Table 37-7.
Frame Segment
Value
Preamble/SFD
55555555555555D5
DA (Octets 05)
SA (Octets 611)
0800
11
IP DA (Octets 3033)
E0000181
013F
00
02
Table 37-8.
980
Frame Segment
Value
Preamble/SFD
55555555555555D5
DA (Octets 05)
SA (Octets 611)
0800
11
Table 37-8.
Frame Segment
Value
IP DA (Octets 3033)
E000006B
013F
02
02
Table 37-9.
Frame Segment
Value
Preamble/SFD
55555555555555D5
DA (Octets 05)
SA (Octets 611)
86dd
11
IP DA (Octets 3853)
FF0X00000000018
013F
00
02
Table 37-10.
Frame Segment
Value
Preamble/SFD
55555555555555D5
DA (Octets 05)
SA (Octets 611)
86dd
11
IP DA (Octets 3853)
FF0200000000006B
981
Table 37-10.
Frame Segment
Value
013F
03
02
For the multicast address 011B19000000 sync and delay request frames are recognized depending on the
message type field, 00 for sync and 01 for delay request.
Table 37-11.
Frame Segment
Value
Preamble/SFD
55555555555555D5
DA (Octets 05)
011B19000000
SA (Octets 611)
88F7
00
02
Pdelay request frames need a special multicast address so they can pass through ports blocked by the spanning
tree protocol. For the multicast address 0180C200000E sync, Pdelay_Req and Pdelay_Resp frames are
recognized depending on the message type field, 00 for sync, 02 for pdelay request and 03 for pdelay response.
Table 37-12.
Frame Segment
Value
Preamble/SFD
55555555555555D5
DA (Octets 05)
0180C200000E
SA (Octets 611)
88F7
00
02
982
The amount by which the timer increments each clock cycle is controlled by the timer increment register. Bits [7:0]
are the default increment value in nanoseconds. If the rest of the register is written with zero the timer increments
by the value in [7:0] each clock cycle.
Bits [15:8] of the increment register are the alternative increment value in nanoseconds and bits [23:16] are the
number of increments after which the alternative increment value is used. If [23:16] are zero then the alternative
increment value will never be used.
Taking the example of 10.2 MHz, there are 102 cycles every ten microseconds or 51 every five microseconds. So
a timer with a 10.2 MHz clock source is constructed by incrementing by 98 ns for fifty cycles and then incrementing
by 100 ns (98 50 + 100 = 5000). This is programmed by setting the 1588 Timer Increment Register to
0x00326462.
For a 49.8 MHz clock source it would be 20 ns for 248 cycles followed by an increment of 40 ns (20 248 + 40 =
5000) programmed as 0x00F82814.
Having eight bits for the number of increments field allows frequencies up to 50 MHz to be supported with 200
kHz resolution.
Without the alternative increment field the period of the clock would be limited to an integer number of
nanoseconds, resulting in supported clock frequencies of 8, 10, 20, 25, 40, 50, 100, 125, 200 and 250 MHz.
GMAC is configured to operate as PTP slave. The timer register increments as normal but the timer value is
copied to the sync strobe register.
There are six additional 62-bit registers that capture the time at which PTP event frames are transmitted and
received. An interrupt is issued when these registers are updated.
37.5.16 MAC 802.3 Pause Frame Support
Note:
See Clause 31, and Annex 31A and 31B of the IEEE standard 802.3 for a full description of MAC 802.3 pause
operation.
The following table shows the start of a MAC 802.3 pause frame.
Table 37-13.
Destination
Source
Type
(MAC Control Frame)
0x0180C2000001
6 bytes
0x8808
Pause
Opcode
Time
0x0001
2 bytes
The GMAC supports both hardware controlled pause of the transmitter, upon reception of a pause frame, and
hardware generated pause frame transmission.
37.5.16.1802.3 Pause Frame Reception
Bit 13 of the Network Configuration Register is the pause enable control for reception. If this bit is set, transmission
will pause if a non zero pause quantum frame is received.
If a valid pause frame is received then the Pause Time Register is updated with the new frame's pause time,
regardless of whether a previous pause frame is active or not. An interrupt (either bit 12 or bit 13 of the Interrupt
Status Register) is triggered when a pause frame is received, but only if the interrupt has been enabled (bit 12 and
bit 13 of the Interrupt Mask Register). Pause frames received with non zero quantum are indicated through the
interrupt bit 12 of the Interrupt Status Register. Pause frames received with zero quantum are indicated on bit 13 of
the Interrupt Status Register.
Once the Pause Time Register is loaded and the frame currently being transmitted has been sent, no new frames
are transmitted until the pause time reaches zero. The loading of a new pause time, and hence the pausing of
transmission, only occurs when the GMAC is configured for full duplex operation. If the GMAC is configured for
half duplex there will be no transmission pause, but the pause frame received interrupt will still be triggered. A valid
983
pause frame is defined as having a destination address that matches either the address stored in Specific Address
Register 1 or if it matches the reserved address of 0x0180C2000001. It must also have the MAC control frame
type ID of 0x8808 and have the pause opcode of 0x0001.
Pause frames that have frame check sequence (FCS) or other errors will be treated as invalid and will be
discarded. 802.3 Pause frames that are received after Priority-based Flow Control (PFC) has been negotiated will
also be discarded. Valid pause frames received will increment the pause frames received statistic register.
The pause time register decrements every 512 bit times once transmission has stopped. For test purposes, the
retry test bit can be set (bit 12 in the Network Configuration Register) which causes the Pause Time Register to
decrement every GTXCK cycle once transmission has stopped.
The interrupt (bit 13 in the Interrupt Status Register) is asserted whenever the Pause Time Register decrements to
zero (assuming it has been enabled by bit 13 in the Interrupt Mask Register). This interrupt is also set when a zero
quantum pause frame is received.
37.5.16.2802.3 Pause Frame Transmission
Automatic transmission of pause frames is supported through the transmit pause frame bits of the Network Control
Register. If either bit 11 or bit 12 of the Network Control Register is written with logic 1, an 802.3 pause frame will
be transmitted, providing full duplex is selected in the Network Configuration Register and the transmit block is
enabled in the Network Control Register.
Pause frame transmission will happen immediately if transmit is inactive or if transmit is active between the current
frame and the next frame due to be transmitted.
Transmitted pause frames comprise the following:
Valid FCS
The pause quantum used in the generated frame will depend on the trigger source for the frame as follows:
If bit 11 is written with a one, the pause quantum will be taken from the Transmit Pause Quantum Register.
The Transmit Pause Quantum Register resets to a value of 0xFFFF giving maximum pause quantum as
default.
After transmission, a pause frame transmitted interrupt will be generated (bit 14 of the Interrupt Status Register)
and the only statistics register that will be incremented will be the Pause Frames Transmitted Register.
Pause frames can also be transmitted by the MAC using normal frame transmission methods.
37.5.17 MAC PFC Priority-based Pause Frame Support
Note:
Refer to the 802.1Qbb standard for a full description of priority-based pause operation.
The following table shows the start of a Priority-based Flow Control (PFC) pause frame.
Table 37-14.
984
Destination
Source
Type
(Mac Control Frame)
0x0180C2000001
6 bytes
0x8808
Pause
Opcode
Priority
Enable
Vector
Pause
Time
0x1001
2 bytes
8 2 bytes
The GMAC supports PFC priority-based pause transmission and reception. Before PFC pause frames can be
received, bit 16 of the Network Control Register must be set.
37.5.17.1PFC Pause Frame Reception
The ability to receive and decode priority-based pause frames is enabled by setting bit 16 of the Network Control
Register. When this bit is set, the GMAC will match either classic 802.3 pause frames or PFC priority-based pause
frames. Once a priority-based pause frame has been received and matched, then from that moment on the GMAC
will only match on priority-based pause frames (this is an 802.1Qbb requirement, known as PFC negotiation).
Once priority-based pause has been negotiated, any received 802.3x format pause frames will not be acted upon.
If a valid priority-based pause frame is received then the GMAC will decode the frame and determine which, if any,
of the eight priorities require to be paused. Up to eight Pause Time Registers are then updated with the eight
pause times extracted from the frame regardless of whether a previous pause operation is active or not. An
interrupt (either bit 12 or bit 13 of the Interrupt Status Register) is triggered when a pause frame is received, but
only if the interrupt has been enabled (bit 12 and bit 13 of the Interrupt Mask Register). Pause frames received with
non zero quantum are indicated through the interrupt bit 12 of the Interrupt Status Register. Pause frames received
with zero quantum are indicated on bit 13 of the Interrupt Status Register. The loading of a new pause time only
occurs when the GMAC is configured for full duplex operation. If the GMAC is configured for half duplex, the pause
time counters will not be loaded, but the pause frame received interrupt will still be triggered. A valid pause frame
is defined as having a destination address that matches either the address stored in Specific Address Register 1 or
if it matches the reserved address of 0x0180C2000001. It must also have the MAC control frame type ID of 0x8808
and have the pause opcode of 0x0101.
Pause frames that have frame check sequence (FCS) or other errors will be treated as invalid and will be
discarded. Valid pause frames received will increment the Pause Frames Received Statistic Register.
The Pause Time Registers decrement every 512 bit times immediately following the PFC frame reception. For test
purposes, the retry test bit can be set (bit 12 in the Network Configuration Register) which causes the Pause Time
Register to decrement every GRXCK cycle once transmission has stopped.
The interrupt (bit 13 in the Interrupt Status Register) is asserted whenever the Pause Time Register decrements to
zero (assuming it has been enabled by bit 13 in the Interrupt Mask Register). This interrupt is also set when a zero
quantum pause frame is received.
37.5.17.2PFC Pause Frame Transmission
Automatic transmission of pause frames is supported through the transmit priority-based pause frame bit of the
Network Control Register. If bit 17 of the Network Control Register is written with logic 1, a PFC pause frame will
be transmitted providing full duplex is selected in the Network Configuration Register and the transmit block is
enabled in the Network Control Register. When bit 17 of the Network Control Register is set, the fields of the
priority-based pause frame will be built using the values stored in the Transmit PFC Pause Register.
Pause frame transmission will happen immediately if transmit is inactive or if transmit is active between the current
frame and the next frame due to be transmitted.
Transmitted pause frames comprise the following:
Valid FCS
985
The pause quantum registers used in the generated frame will depend on the trigger source for the frame as
follows:
If bit 17 of the Network Control Register is written with a one, then the priority enable vector of the prioritybased pause frame will be set equal to the value stored in the Transmit PFC Pause Register [7:0]. For each
entry equal to zero in the Transmit PFC Pause Register[15:8], the pause quantum field of the pause frame
associated with that entry will be taken from the transmit pause quantum register. For each entry equal to
one in the Transmit PFC Pause Register[15:8], the pause quantum associated with that entry will be zero.
The Transmit Pause Quantum Register resets to a value of 0xFFFF giving maximum pause quantum as
default.
After transmission, a pause frame transmitted interrupt will be generated (bit 14 of the Interrupt Status Register)
and the only statistics register that will be incremented will be the Pause Frames Transmitted Register.
PFC Pause frames can also be transmitted by the MAC using normal frame transmission methods.
37.5.18 PHY Interface
Different PHY interfaces are supported by the Ethernet MAC:
MII
RMII
The MII interface is provided for 10/100 operation and uses txd[3:0] and rxd[3:0]. The RMII interface is provided for
10/100 operation and uses txd[1:0] and rxd[1:0].
37.5.19 10/100 Operation
The 10/100 Mbps speed bit in the Network Configuration Register is used to select between 10 Mbps and 100
Mbps.
37.5.20 Jumbo Frames
The jumbo frames enable bit in the Network Configuration Register allows the GMAC, in its default configuration,
to receive jumbo frames up to 10240 bytes in size. This operation does not form part of the IEEE 802.3
specification and is normally disabled. When jumbo frames are enabled, frames received with a frame size greater
than 10240 bytes are discarded.
986
37.6
Programming Interface
37.6.1 Initialization
37.6.1.1 Configuration
Initialization of the GMAC 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.
3.
Note:
These writes to the Network Control Register cannot be combined in any way.
Receive data is written to areas of data (i.e., buffers) in system memory. These buffers are listed in another data
structure that also resides in main memory. This data structure (receive buffer queue) is a sequence of descriptor
entries as defined in Table 37-2, Receive Buffer Descriptor Entry.
The Receive Buffer Queue Pointer Register points to this data structure.
Figure 37-2.
Receive Buffer 0
Receive Buffer Queue Pointer
(MAC Register)
Receive Buffer 1
Receive Buffer N
Receive Buffer Descriptor List
(In memory)
(In memory)
Allocate an area 8N bytes for the receive buffer descriptor list in system memory and create N entries in this
list. Mark all entries in this list as owned by GMAC, i.e., bit 0 of word 0 set to 0.
3.
Mark the last descriptor in the queue with the wrap bit (bit 1 in word 0 set to 1).
4.
Write address of receive buffer descriptor list and control information to GMAC register receive buffer queue
pointer
5.
The receive circuits can then be enabled by writing to the address recognition registers and the Network
Control Register.
987
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 37-3, Transmit Buffer Descriptor Entry.
The Transmit Buffer Queue Pointer Register 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 8N bytes for the transmit buffer descriptor list in system memory and create N entries in this
list. Mark all entries in this list as owned by GMAC, i.e., bit 31 of word 1 set to 0.
3.
Mark the last descriptor in the queue with the wrap bit (bit 30 in word 1 set to 1).
4.
Write address of transmit buffer descriptor list and control information to GMAC register transmit buffer
queue pointer.
5.
The transmit circuits can then be enabled by writing to the Network Control Register.
The GMAC register pair hash address and the four Specific Address Register-pairs must be written with the
required values. Each register pair comprises of a bottom register and top register with the bottom register being
written first. The address matching is disabled for a particular register pair after the bottom register has been
written and re-enabled when the top register is written. Each register pair may be written at any time, regardless of
whether the receive circuits are enabled or disabled.
As an example, to set Specific Address Register 1 to recognize destination address 21:43:65:87:A9:CB, the
following values are written to Specific Address Register 1 bottom and Specific Address Register 1 top:
The PHY Maintenance Register is implemented as a shift register. Writing to the register starts a shift operation
which is signalled as complete when bit two is set in the Network Status Register (about 2000 MCK cycles later
when bits [18:16] are set to 010 in the Network Configuration Register). An interrupt is generated as this bit is set.
During this time, the MSB of the register is output on the MDIO pin and the LSB updated from the MDIO pin with
each Management Data Clock (MDC) cycle. This causes the transmission of a PHY management frame on MDIO.
See section 22.2.4.5 of the IEEE 802.3 standard.
Reading during the shift operation will return the current contents of the shift register. At the end of the
management operation the bits will have shifted back to their original locations. For a read operation the data bits
are updated with data read from the PHY. It is important to write the correct values to the register to ensure a valid
PHY management frame is produced.
The Management Data Clock (MDC) should not toggle faster than 2.5 MHz (minimum period of 400 ns), as defined
by the IEEE 802.3 standard. MDC is generated by dividing down MCK. Three bits in the Network Configuration
Register determine by how much MCK should be divided to produce MDC.
37.6.1.6 Interrupts
There are 18 interrupt conditions that are detected within the GMAC. 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 device interrupt
controller documentation to identify that it is the GMAC that is generating the interrupt. To ascertain which
interrupt, read the Interrupt Status Register. Note that in the default configuration this register will clear itself after
being read, though this may be configured to be write-one-to-clear if desired.
988
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 disabled, read Interrupt Mask Register. If the bit is set to 1, the
interrupt is disabled.
37.6.1.7 Transmitting Frames
Allocate an area of system memory for transmit data. This does not have to be contiguous, varying byte
lengths can be used if they conclude on byte borders.
3.
Set-up the transmit buffer list by writing buffer addresses to word zero of the transmit buffer descriptor
entries and control and length to word one.
4.
Write data for transmission into the buffers pointed to by the descriptors.
5.
Write the address of the first buffer descriptor to transmit buffer descriptor queue pointer.
6.
7.
Write to the transmit start bit (TSTART) in the Network Control Register.
When a frame is received and the receive circuits are enabled, the GMAC checks the address and, in the following
cases, the frame is written to system memory:
The register receive buffer queue pointer points to the next entry in the receive buffer descriptor list and the GMAC
uses this as the address in system memory to write the frame to.
Once the frame has been completely and successfully received and written to system memory, the GMAC then
updates the receive buffer descriptor entry (see Table 37-2, Receive Buffer Descriptor Entry) with the reason for
the address match and marks the area as being owned by software. Once this is complete, a receive complete
interrupt is set. Software is then responsible for copying the data to the application area and releasing the buffer
(by writing the ownership bit back to 0).
If the GMAC is unable to write the data at a rate to match the incoming frame, then a receive overrun interrupt is
set. If there is no receive buffer available, i.e., the next buffer is still owned by software, a receive buffer not
available interrupt is set. If the frame is not successfully received, a statistics register is incremented and the frame
is discarded without informing software.
989
These registers reset to zero on a read and stick at all ones when they count to their maximum value. They should
be read frequently enough to prevent loss of data.
The receive statistics registers are only incremented when the receive enable bit (RXEN) is set in the Network
Control Register.
Once a statistics register has been read, it is automatically cleared. When reading the Octets Transmitted and
Octets Received Registers, bits 31:0 should be read prior to bits 47:32 to ensure reliable operation.
990
37.7
Table 37-15.
Register Mapping
Offset
Register
Name
Access
Reset
0x000
GMAC_NCR
Read/Write
0x0000_0000
0x004
GMAC_NCFGR
Read/Write
0x0008_0000
0x008
GMAC_NSR
Read-only
0b01x0
0x00C
User Register
GMAC_UR
Read/Write
0x0000_0000
0x010
GMAC_DCFGR
Read/Write
0x0002_0004
0x014
GMAC_TSR
Read/Write
0x0000_0000
0x018
GMAC_RBQB
Read/Write
0x0000_0000
0x01C
GMAC_TBQB
Read/Write
0x0000_0000
0x020
GMAC_RSR
Read/Write
0x0000_0000
0x024
GMAC_ISR
Read-only
0x0000_0000
0x028
GMAC_IER
Write-only
0x02C
GMAC_IDR
Write-only
0x030
GMAC_IMR
Read/Write
0x07FF_FFFF
0x034
GMAC_MAN
Read/Write
0x0000_0000
0x038
GMAC_RPQ
Read-only
0x0000_0000
0x03C
GMAC_TPQ
Read/Write
0x0000_FFFF
0x0400x07C
Reserved
0x080
GMAC_HRB
Read/Write
0x0000_0000
0x084
GMAC_HRT
Read/Write
0x0000_0000
0x088
GMAC_SAB1
Read/Write
0x0000_0000
0x08C
GMAC_SAT1
Read/Write
0x0000_0000
0x090
GMAC_SAB2
Read/Write
0x0000_0000
0x094
GMAC_SAT2
Read/Write
0x0000_0000
0x098
GMAC_SAB3
Read/Write
0x0000_0000
0x09C
GMAC_SAT3
Read/Write
0x0000_0000
0x0A0
GMAC_SAB4
Read/Write
0x0000_0000
0x0A4
GMAC_SAT4
Read/Write
0x0000_0000
0x0A8
GMAC_TIDM1
Read/Write
0x0000_0000
0x0AC
GMAC_TIDM2
Read/Write
0x0000_0000
0x0B0
GMAC_TIDM3
Read/Write
0x0000_0000
0x0B4
GMAC_TIDM4
Read/Write
0x0000_0000
0x0B8
GMAC_WOL
Read/Write
0x0000_0000
0x0BC
GMAC_IPGS
Read/Write
0x0000_0000
0x0C0
GMAC_SVLAN
Read/Write
0x0000_0000
0x0C4
GMAC_TPFCP
Read/Write
0x0000_0000
991
Table 37-15.
Offset
Register
Name
Access
Reset
0x0C8
GMAC_SAMB1
Read/Write
0x0000_0000
0x0CC
GMAC_SAMT1
Read/Write
0x0000_0000
0x0D00x0D8
Reserved
0x0DC0x0E4 Reserved
0x0E80x0F8
Reserved
0x0FC
Reserved
0x100
GMAC_OTLO
Read-only
0x0000_0000
0x104
GMAC_OTHI
Read-only
0x0000_0000
0x108
GMAC_FT
Read-only
0x0000_0000
0x10C
GMAC_BCFT
Read-only
0x0000_0000
0x110
GMAC_MFT
Read-only
0x0000_0000
0x114
GMAC_PFT
Read-only
0x0000_0000
0x118
GMAC_BFT64
Read-only
0x0000_0000
0x11C
GMAC_TBFT127
Read-only
0x0000_0000
0x120
GMAC_TBFT255
Read-only
0x0000_0000
0x124
GMAC_TBFT511
Read-only
0x0000_0000
0x128
GMAC_TBFT1023
Read-only
0x0000_0000
0x12C
GMAC_TBFT1518
Read-only
0x0000_0000
0x130
GMAC_GTBFT1518
Read-only
0x0000_0000
0x134
GMAC_TUR
Read-only
0x0000_0000
0x138
GMAC_SCF
Read-only
0x0000_0000
0x13C
GMAC_MCF
Read-only
0x0000_0000
0x140
GMAC_EC
Read-only
0x0000_0000
0x144
GMAC_LC
Read-only
0x0000_0000
0x148
GMAC_DTF
Read-only
0x0000_0000
0x14C
GMAC_CSE
Read-only
0x0000_0000
0x150
GMAC_ORLO
Read-only
0x0000_0000
0x154
GMAC_ORHI
Read-only
0x0000_0000
0x158
GMAC_FR
Read-only
0x0000_0000
0x15C
GMAC_BCFR
Read-only
0x0000_0000
0x160
GMAC_MFR
Read-only
0x0000_0000
0x164
GMAC_PFR
Read-only
0x0000_0000
0x168
GMAC_BFR64
Read-only
0x0000_0000
0x16C
GMAC_TBFR127
Read-only
0x0000_0000
0x170
GMAC_TBFR255
Read-only
0x0000_0000
0x174
GMAC_TBFR511
Read-only
0x0000_0000
0x178
GMAC_TBFR1023
Read-only
0x0000_0000
992
Table 37-15.
Offset
Register
Name
Access
Reset
0x17C
GMAC_TBFR1518
Read-only
0x0000_0000
0x180
GMAC_TMXBFR
Read-only
0x0000_0000
0x184
GMAC_UFR
Read-only
0x0000_0000
0x188
GMAC_OFR
Read-only
0x0000_0000
0x18C
GMAC_JR
Read-only
0x0000_0000
0x190
GMAC_FCSE
Read-only
0x0000_0000
0x194
GMAC_LFFE
Read-only
0x0000_0000
0x198
GMAC_RSE
Read-only
0x0000_0000
0x19C
GMAC_AE
Read-only
0x0000_0000
0x1A0
GMAC_RRE
Read-only
0x0000_0000
0x1A4
GMAC_ROE
Read-only
0x0000_0000
0x1A8
GMAC_IHCE
Read-only
0x0000_0000
0x1AC
GMAC_TCE
Read-only
0x0000_0000
0x1B0
GMAC_UCE
Read-only
0x0000_0000
0x1B40x1B8
Reserved
0x1BC0x1C4 Reserved
0x1C8
GMAC_TSSSL
Read/Write
0x0000_0000
0x1CC
GMAC_TSSN
Read/Write
0x0000_0000
0x1D0
GMAC_TSL
Read/Write
0x0000_0000
0x1D4
GMAC_TN
Read/Write
0x0000_0000
0x1D8
GMAC_TA
Write-only
0x1DC
GMAC_TI
Read/Write
0x0000_0000
0x1E0
GMAC_EFTS
Read-only
0x0000_0000
0x1E4
GMAC_EFTN
Read-only
0x0000_0000
0x1E8
GMAC_EFRS
Read-only
0x0000_0000
0x1EC
GMAC_EFRN
Read-only
0x0000_0000
0x1F0
GMAC_PEFTS
Read-only
0x0000_0000
0x1F4
GMAC_PEFTN
Read-only
0x0000_0000
0x1F8
GMAC_PEFRS
Read-only
0x0000_0000
0x1FC
GMAC_PEFRN
Read-only
0x0000_0000
0x2000x23C
Reserved
0x2800x298
Reserved
993
GMAC_NCR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
FNP
17
TXPBPF
16
ENPBPR
15
SRTSM
14
13
12
TXZQPF
11
TXPF
10
THALT
9
TSTART
8
BP
7
WESTAT
6
INCSTAT
5
CLRSTAT
4
MPE
3
TXEN
2
RXEN
1
LBL
994
995
GMAC_NCFGR
Address:
Access:
Read/Write
31
30
IRXER
29
RXBP
28
IPGSEN
27
26
IRXFCS
25
EFRHD
24
RXCOEN
23
DCPF
22
21
20
19
CLK
18
17
RFCS
16
LFERD
14
13
PEN
12
RTY
11
10
8
MAXFS
6
MTI HEN
5
NBC
4
CAF
3
JFRAME
2
DNVLAN
1
FD
0
SPD
DBW
15
RXBUFO
7
UNIHEN
SPD: Speed
Set to logic one to indicate 100 Mbps operation, logic zero for 10 Mbps.
FD: Full Duplex
If set to logic one, the transmit block ignores the state of collision and carrier sense and allows receive while transmitting.
DNVLAN: Discard Non-VLAN FRAMES
When set only VLAN tagged frames will be passed to the address matching logic.
JFRAME: Jumbo Frame Size
Set to one to enable jumbo frames up to 10240 bytes to be accepted. The default length is 10240 bytes.
CAF: Copy All Frames
When set to logic one, all valid frames will be accepted.
NBC: No Broadcast
When set to logic one, frames addressed to the broadcast address of all ones will not be accepted.
MTIHEN: Multicast Hash Enable
When set, multicast frames will be accepted when the 6-bit hash function of the destination address points to a bit that is
set in the Hash Register.
UNIHEN: Unicast Hash Enable
When set, unicast frames will be accepted when the 6-bit hash function of the destination address points to a bit that is set
in the Hash Register.
MAXFS: 1536 Maximum Frame Size
Setting this bit means the GMAC will accept frames up to 1536 bytes in length. Normally the GMAC would reject any frame
above 1518 bytes.
996
Name
Description
MCK_8
MCK_16
MCK_32
MCK_48
MCK_64
MCK_96
Name
Description
DBW32
DBW64
997
998
GMAC_NSR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
2
IDLE
1
MDIO
999
GMAC_UR
Address:
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
0
RMII
1000
GMAC_DCFGR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
DRBS
15
14
13
12
11
10
7
ESPA
6
ESMA
2
FBLDO
Name
Description
Reserved
SINGLE
Reserved
INCR4
INCR8
16
INCR16
1001
1002
GMAC_TSR
Address:
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
8
HRESP
6
UND
5
TXCOMP
4
TFC
3
TXGO
2
RLE
1
COL
0
UBR
1003
1004
GMAC_RBQB
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ADDR
23
22
21
20
ADDR
15
14
13
12
ADDR
4
ADDR
This register holds the start address of the receive buffer queue (receive buffers descriptor list). The receive buffer queue
base address must be initialized before receive is enabled through bit 2 of the Network Control Register. Once reception is
enabled, any write to the Receive Buffer Queue Base Address Register is ignored. 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 constantly changes as new frames are
received. Software should instead work its way through the buffer descriptor queue checking the used bits.
In terms of AMBA AHB operation, the descriptors are read from memory using a single 32-bit AHB access. When the datapath is configured at 64 bits, the descriptors should be aligned at 64-bit boundaries and each pair of 32-bit descriptors is
written to by using a single AHB access. The descriptors should be aligned at 32-bit boundaries and the descriptors are
written to using two individual non sequential accesses for 32-bit datapaths.
ADDR: Receive Buffer Queue Base Address
Written with the address of the start of the receive queue.
1005
GMAC_TBQB
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ADDR
23
22
21
20
ADDR
15
14
13
12
ADDR
4
ADDR
This register holds the start address of the transmit buffer queue (transmit buffers descriptor list). The Transmit Buffer
Queue Base Address Register must be initialized before transmit is started through bit 9 of the Network Control Register.
Once transmission has started, any write to the Transmit Buffer Queue Base Address Register is illegal and therefore
ignored.
Note that due to clock boundary synchronization, it takes a maximum of four MCK cycles from the writing of the transmit
start bit before the transmitter is active. Writing to the Transmit Buffer Queue Base Address Register during this time may
produce unpredictable results.
Reading this register returns the location of the descriptor currently being accessed. Since the DMA handles two frames at
once, this may not necessarily be pointing to the current frame being transmitted.
In terms of AMBA AHB operation, the descriptors are written to memory using a single 32-bit AHB access. When the datapath is configured at 64 bits, the descriptors should be aligned at 64-bit boundaries and each pair of 32-bit descriptors is
read from memory using a single AHB access. The descriptors should be aligned at 32-bit boundaries and the descriptors
are read from memory using two individual non sequential accesses for 32-bit datapaths.
ADDR: Transmit Buffer Queue Base Address
Written with the address of the start of the transmit queue.
1006
GMAC_RSR
Address:
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
3
HNO
2
RXOVR
1
REC
0
BNA
This register, when read, provides receive status details. Once read, individual bits may be cleared by writing a one to
them. It is not possible to set a bit to 1 by writing to the register.
BNA: Buffer Not Available
An attempt was made to get a new buffer and the pointer indicated that it was owned by the processor. The DMA will reread the pointer each time an end of frame is received until a valid pointer is found. This bit is set following each descriptor
read attempt that fails, even if consecutive pointers are unsuccessful and software has in the mean time cleared the status
flag. Writing a one clears this bit.
REC: Frame Received
One or more frames have been received and placed in memory. Writing a one clears this bit.
RXOVR: Receive Overrun
This bit is set if RX FIFO is not able to store the receive frame due to a FIFO overflow, or if the receive status was not taken
at the end of the frame. For DMA operation, the buffer will be recovered if an overrun occurs. Writing a one clears this bit.
HNO: HRESP Not OK
Set when the DMA block sees HRESP not OK. Writing a one clears this bit.
1007
GMAC_ISR
Address:
Access:
Read-only
31
30
29
28
WOL
27
26
SRI
25
PDRSFT
24
PDRQFT
23
PDRSFR
22
PDRQFR
21
SFT
20
DRQFT
19
SFR
18
DRQFR
17
16
15
14
PFTR
13
PTZ
12
PFNZ
11
HRESP
10
ROVR
7
TCOMP
6
TFC
5
RLEX
4
TUR
3
TXUBR
2
RXUBR
1
RCOMP
0
MFS
This register indicates the source of the interrupt. In order that the bits of this register read 1, the corresponding interrupt
source must be enabled in the mask register. If any bit is set in this register, the GMAC interrupt signal will be asserted in
the system.
MFS: Management Frame Sent
The PHY Maintenance Register has completed its operation. Cleared on read.
RCOMP: Receive Complete
A frame has been stored in memory. Cleared on read.
RXUBR: RX Used Bit Read
Set when a receive buffer descriptor is read with its used bit set. Cleared on read.
TXUBR: TX Used Bit Read
Set when a transmit buffer descriptor is read with its used bit set. Cleared on read.
TUR: Transmit Underrun
This interrupt is set if the transmitter was forced to terminate a frame that it has already began transmitting due to further
data being unavailable.
This interrupt is set if a transmitter status write back has not completed when another status write back is attempted.
This interrupt is also set when the transmit DMA has written the SOP data into the FIFO and either the AHB bus was not
granted in time for further data, or because an AHB not OK response was returned, or because the used bit was read.
RLEX: Retry Limit Exceeded
Transmit error. Cleared on read.
TFC: Transmit Frame Corruption Due to AHB Error
Transmit frame corruption due to AHB error. Set if an error occurs while midway through reading transmit frame from the
AHB, including HRESP errors and buffers exhausted mid frame.
TCOMP: Transmit Complete
Set when a frame has been transmitted. Cleared on read.
1008
1009
GMAC_IER
Address:
Access:
Write-only
31
30
29
28
WOL
27
26
SRI
25
PDRSFT
24
PDRQFT
23
PDRSFR
22
PDRQFR
21
SFT
20
DRQFT
19
SFR
18
DRQFR
17
16
15
EXINT
14
PFTR
13
PTZ
12
PFNZ
11
HRESP
10
ROVR
7
TCOMP
6
TFC
5
RLEX
4
TUR
3
TXUBR
2
RXUBR
1
RCOMP
0
MFS
At reset all interrupts are disabled. Writing a one to the relevant bit location enables the required interrupt. This register is
write-only and when read will return zero.
MFS: Management Frame Sent
Enable management done interrupt.
RCOMP: Receive Complete
Enable receive complete interrupt.
RXUBR: RX Used Bit Read
Enable receive used bit read interrupt.
TXUBR: TX Used Bit Read
Enable transmit used bit read interrupt.
TUR: Transmit Underrun
Enable transmit buffer underrun interrupt.
RLEX: Retry Limit Exceeded or Late Collision
Enable retry limit exceeded or late collision interrupt.
TFC: Transmit Frame Corruption Due to AHB Error
Enable transmit frame corruption due to AHB error interrupt.
TCOMP: Transmit Complete
Enable transmit complete interrupt.
ROVR: Receive Overrun
Enable receive overrun interrupt.
HRESP: HRESP Not OK
Enable HRESP not OK interrupt.
1010
1011
GMAC_IDR
Address:
Access:
Write-only
31
30
29
28
WOL
27
26
SRI
25
PDRSFT
24
PDRQFT
23
PDRSFR
22
PDRQFR
21
SFT
20
DRQFT
19
SFR
18
DRQFR
17
16
15
EXINT
14
PFTR
13
PTZ
12
PFNZ
11
HRESP
10
ROVR
7
TCOMP
6
TFC
5
RLEX
4
TUR
3
TXUBR
2
RXUBR
1
RCOMP
0
MFS
Writing a one to the relevant bit location disables that particular interrupt. This register is write only and when read will
return zero.
MFS: Management Frame Sent
Disable management done interrupt.
RCOMP: Receive Complete
Disable receive complete interrupt.
RXUBR: RX Used Bit Read
Disable receive used bit read interrupt.
TXUBR: TX Used Bit Read
Disable transmit used bit read interrupt.
TUR: Transmit Underrun
Disable transmit buffer underrun interrupt.
RLEX: Retry Limit Exceeded or Late Collision
Disable retry limit exceeded or late collision interrupt.
TFC: Transmit Frame Corruption Due to AHB Error
Disable transmit frame corruption due to AHB error interrupt.
TCOMP: Transmit Complete
Disable transmit complete interrupt.
ROVR: Receive Overrun
Disable receive overrun interrupt.
HRESP: HRESP Not OK
Disable HRESP not OK interrupt.
1012
1013
GMAC_IMR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
PDRSFT
24
PDRQFT
23
PDRSFR
22
PDRQFR
21
SFT
20
DRQFT
19
SFR
18
DRQFR
17
16
15
EXINT
14
PFTR
13
PTZ
12
PFNZ
11
HRESP
10
ROVR
7
TCOMP
6
TFC
5
RLEX
4
TUR
3
TXUBR
2
RXUBR
1
RCOMP
0
MFS
The Interrupt Mask Register is a read-only register indicating which interrupts are masked. All bits are set at reset and can
be reset individually by writing to the Interrupt Enable Register or set individually by writing to the Interrupt Disable Register. Having separate address locations for enable and disable saves the need for performing a read modify write when
updating the Interrupt Mask Register.
For test purposes there is a write-only function to this register that allows the bits in the Interrupt Status Register to be set
or cleared, regardless of the state of the mask register. A write to this register directly affects the state of the corresponding
bit in the Interrupt Status Register, causing an interrupt to be generated if a 1 is written.
MFS: Management Frame Sent
A read of this register returns the value of the management done interrupt mask.
0: Interrupt is enabled.
1: Interrupt is disabled.
RCOMP: Receive Complete
A read of this register returns the value of the receive complete interrupt mask.
0: Interrupt is enabled.
1: Interrupt is disabled.
RXUBR: RX Used Bit Read
A read of this register returns the value of the receive used bit read interrupt mask.
0: Interrupt is enabled.
1: Interrupt is disabled.
TXUBR: TX Used Bit Read
A read of this register returns the value of the transmit used bit read interrupt mask.
0: Interrupt is enabled.
1: Interrupt is disabled.
1014
1015
GMAC_MAN
Address:
Access:
Read/Write
31
WZO
30
CLTTO
29
23
PHYA
22
21
15
14
28
27
26
OP
13
25
24
17
16
PHYA
20
REGA
19
18
WTN
12
11
10
DATA
7
4
DATA
The PHY Maintenance Register is implemented as a shift register. Writing to the register starts a shift operation which is
signalled as complete when bit 2 is set in the Network Status Register. It takes about 2000 MCK cycles to complete, when
MDC is set for MCK divide by 32 in the Network Configuration Register. An interrupt is generated upon completion.
During this time, the MSB of the register is output on the MDIO pin and the LSB updated from the MDIO pin with each MDC
cycle. This causes transmission of a PHY management frame on MDIO. See Section 22.2.4.5 of the IEEE 802.3 standard.
Reading during the shift operation returns the current contents of the shift register. At the end of management operation,
the bits will have shifted back to their original locations. For a read operation, the data bits are updated with data read from
the PHY. It is important to write the correct values to the register to ensure a valid PHY management frame is produced.
The MDIO interface can read IEEE 802.3 clause 45 PHYs as well as clause 22 PHYs. To read clause 45 PHYs, bit 30
should be written with a 0 rather than a 1.
For a description of MDC generation, see Section 37.7.2 Network Configuration Register.
DATA: PHY Data
For a write operation this field is written with the data to be written to the PHY. After a read operation this field contains the
data read from the PHY.
WTN: Write Ten
Must be written to 10.
REGA: Register Address
Specifies the register in the PHY to access.
PHYA: PHY Address
OP: Operation
01: Write
10: Read
CLTTO: Clause 22 Operation
Must be written to 1 for Clause 22 operation. To read clause 45 PHYs, bit 30 should be written with a 0 rather than a 1.
1017
1018
GMAC_RPQ
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
RPQ
7
4
RPQ
1019
GMAC_TPQ
Address:
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
TPQ
7
4
TPQ
1020
GMAC_HRB
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ADDR
23
22
21
20
ADDR
15
14
13
12
ADDR
4
ADDR
The unicast hash enable (UNIHEN) and the multicast hash enable (MITIHEN) bits in the Network Configuration Register
(Section 37.7.2 Network Configuration Register) enable the reception of hash matched frames. See Section 37.5.9 Hash
Addressing.
ADDR: Hash Address
The first 32 bits of the Hash Address Register.
1021
GMAC_HRT
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ADDR
23
22
21
20
ADDR
15
14
13
12
ADDR
4
ADDR
The unicast hash enable (UNIHEN) and the multicast hash enable (MITIHEN) bits in the Network Configuration Register
enable the reception of hash matched frames. See Section 37.5.9 Hash Addressing.
ADDR: Hash Address
Bits 63 to 32 of the Hash Address Register.
1022
GMAC_SAB1
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ADDR
23
22
21
20
ADDR
15
14
13
12
ADDR
4
ADDR
The addresses stored in the Specific Address Registers are deactivated at reset or when their corresponding Specific
Address Register Bottom is written. They are activated when Specific Address Register Top is written.
ADDR: Specific Address 1
Least significant 32 bits of the destination address, that is bits 31:0. Bit zero indicates whether the address is multicast or
unicast and corresponds to the least significant bit of the first byte received.
1023
GMAC_SAT1
Address:
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
ADDR
7
4
ADDR
The addresses stored in the Specific Address Registers are deactivated at reset or when their corresponding Specific
Address Register Bottom is written. They are activated when Specific Address Register Top is written.
ADDR: Specific Address 1
The most significant bits of the destination address, that is bits 47:32.
1024
GMAC_SAB2
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ADDR
23
22
21
20
ADDR
15
14
13
12
ADDR
4
ADDR
The addresses stored in the Specific Address Registers are deactivated at reset or when their corresponding Specific
Address Register Bottom is written. They are activated when Specific Address Register Top is written.
ADDR: Specific Address 2
Least significant 32 bits of the destination address, that is bits 31:0. Bit zero indicates whether the address is multicast or
unicast and corresponds to the least significant bit of the first byte received.
1025
GMAC_SAT2
Address:
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
ADDR
7
4
ADDR
The addresses stored in the Specific Address Registers are deactivated at reset or when their corresponding Specific
Address Register Bottom is written. They are activated when Specific Address Register Top is written.
ADDR: Specific Address 2
The most significant bits of the destination address, that is bits 47:32.
1026
GMAC_SAB3
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ADDR
23
22
21
20
ADDR
15
14
13
12
ADDR
4
ADDR
The addresses stored in the Specific Address Registers are deactivated at reset or when their corresponding Specific
Address Register Bottom is written. They are activated when Specific Address Register Top is written.
ADDR: Specific Address 3
Least significant 32 bits of the destination address, that is bits 31:0. Bit zero indicates whether the address is multicast or
unicast and corresponds to the least significant bit of the first byte received.
1027
GMAC_SAT3
Address:
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
ADDR
7
4
ADDR
The addresses stored in the Specific Address Registers are deactivated at reset or when their corresponding Specific
Address Register Bottom is written. They are activated when Specific Address Register Top is written.
ADDR: Specific Address 3
The most significant bits of the destination address, that is bits 47:32.
1028
GMAC_SAB4
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ADDR
23
22
21
20
ADDR
15
14
13
12
ADDR
4
ADDR
The addresses stored in the Specific Address Registers are deactivated at reset or when their corresponding Specific
Address Register Bottom is written. They are activated when Specific Address Register Top is written.
ADDR: Specific Address 4
Least significant 32 bits of the destination address, that is bits 31:0. Bit zero indicates whether the address is multicast or
unicast and corresponds to the least significant bit of the first byte received.
1029
GMAC_SAT4
Address:
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
ADDR
7
4
ADDR
The addresses stored in the Specific Address Registers are deactivated at reset or when their corresponding Specific
Address Register Bottom is written. They are activated when Specific Address Register Top is written.
ADDR: Specific Address 4
The most significant bits of the destination address, that is bits 47:32.
1030
GMAC_TIDM1
Address:
Access:
Read/Write
31
ENID1
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TID
7
4
TID
1031
GMAC_TIDM2
Address:
Access:
Read/Write
31
ENID2
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TID
7
4
TID
1032
GMAC_TIDM3
Address:
Access:
Read/Write
31
ENID3
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TID
7
4
TID
1033
GMAC_TIDM4
Address:
Access:
Read/Write
31
ENID4
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TID
7
4
TID
1034
GMAC_WOL
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
MTI
18
SA1
17
ARP
16
MAG
11
10
23
22
21
20
13
12
15
14
IP
7
4
IP
1035
GMAC_IPGS
Address:
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
FL
7
4
FL
1036
GMAC_SVLAN
Address:
Access:
Read/Write
31
ESVLAN
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
VLAN_TYPE
7
4
VLAN_TYPE
1037
GMAC_TPFCP
Address:
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
PQ
7
4
PEV
1038
GMAC_SAMB1
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ADDR
23
22
21
20
ADDR
15
14
13
12
ADDR
4
ADDR
1039
GMAC_SAMT1
Address:
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
ADDR
7
4
ADDR
1040
GMAC_OTLO
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
TXO
23
22
21
20
TXO
15
14
13
12
TXO
4
TXO
When reading the Octets Transmitted and Octets Received Registers, bits 31:0 should be read prior to bits 47:32 to ensure
reliable operation.
TXO: Transmitted Octets
Transmitted octets in frame without errors [31:0]. The number of octets transmitted in valid frames of any type. This counter
is 48-bits, and is read through two registers. This count does not include octets from automatically generated pause
frames.
1041
GMAC_OTHI
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TXO
7
4
TXO
When reading the Octets Transmitted and Octets Received Registers, bits 31:0 should be read prior to bits 47:32 to ensure
reliable operation.
TXO: Transmitted Octets
Transmitted octets in frame without errors [47:32]. The number of octets transmitted in valid frames of any type. This counter is 48-bits, and is read through two registers. This count does not include octets from automatically generated pause
frames.
1042
GMAC_FT
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
FTX
23
22
21
20
FTX
15
14
13
12
FTX
4
FTX
1043
GMAC_BCFT
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
BFTX
23
22
21
20
BFTX
15
14
13
12
BFTX
4
BFTX
1044
GMAC_MFT
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
MFTX
23
22
21
20
MFTX
15
14
13
12
MFTX
4
MFTX
1045
GMAC_PFT
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
15
22
14
21
13
20
12
19
11
18
10
17
16
PFTX
7
4
PFTX
1046
GMAC_BFT64
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
NFTX
23
22
21
20
NFTX
15
14
13
12
NFTX
4
NFTX
1047
GMAC_TBFT127
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
NFTX
23
22
21
20
NFTX
15
14
13
12
NFTX
4
NFTX
1048
GMAC_TBFT255
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
NFTX
23
22
21
20
NFTX
15
14
13
12
NFTX
4
NFTX
1049
GMAC_TBFT511
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
NFTX
23
22
21
20
NFTX
15
14
13
12
NFTX
4
NFTX
1050
GMAC_TBFT1023
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
NFTX
23
22
21
20
NFTX
15
14
13
12
NFTX
4
NFTX
1051
GMAC_TBFT1518
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
NFTX
23
22
21
20
NFTX
15
14
13
12
NFTX
4
NFTX
1052
GMAC_GTBFT1518
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
NFTX
23
22
21
20
NFTX
15
14
13
12
NFTX
4
NFTX
1053
GMAC_TUR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
8
TXUNR
0
TXUNR
1054
GMAC_SCF
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
SCOL
SCOL
7
4
SCOL
1055
GMAC_MCF
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
MCOL
MCOL
7
4
MCOL
1056
GMAC_EC
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
8
XCOL
0
XCOL
1057
GMAC_LC
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
8
LCOL
0
LCOL
1058
GMAC_DTF
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
DEFT
DEFT
7
4
DEFT
1059
GMAC_CSE
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
8
CSR
0
CSR
1060
GMAC_ORLO
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
RXO
23
22
21
20
RXO
15
14
13
12
RXO
4
RXO
When reading the Octets Transmitted and Octets Received Registers, bits [31:0] should be read prior to bits [47:32] to
ensure reliable operation.
RXO: Received Octets
Received octets in frame without errors [31:0]. The number of octets received in valid frames of any type. This counter is
48-bits and is read through two registers. This count does not include octets from pause frames, and is only incremented if
the frame is successfully filtered and copied to memory.
1061
GMAC_ORHI
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
RXO
7
4
RXO
When reading the Octets Transmitted and Octets Received Registers, bits 31:0 should be read prior to bits 47:32 to ensure
reliable operation.
RXO: Received Octets
Received octets in frame without errors [47:32]. The number of octets received in valid frames of any type. This counter is
48-bits and is read through two registers. This count does not include octets from pause frames, and is only incremented if
the frame is successfully filtered and copied to memory.
1062
GMAC_FR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
FRX
23
22
21
20
FRX
15
14
13
12
FRX
4
FRX
1063
GMAC_BCFR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
BFRX
23
22
21
20
BFRX
15
14
13
12
BFRX
4
BFRX
1064
GMAC_MFR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
MFRX
23
22
21
20
MFRX
15
14
13
12
MFRX
4
MFRX
1065
GMAC_PFR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
PFRX
7
4
PFRX
1066
GMAC_BFR64
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
NFRX
23
22
21
20
NFRX
15
14
13
12
NFRX
4
NFRX
1067
GMAC_TBFR127
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
NFRX
23
22
21
20
NFRX
15
14
13
12
NFRX
4
NFRX
1068
GMAC_TBFR255
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
NFRX
23
22
21
20
NFRX
15
14
13
12
NFRX
4
NFRX
1069
GMAC_TBFR511
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
NFRX
23
22
21
20
NFRX
15
14
13
12
NFRX
4
NFRX
1070
GMAC_TBFR1023
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
NFRX
23
22
21
20
NFRX
15
14
13
12
NFRX
4
NFRX
1071
GMAC_TBFR1518
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
NFRX
23
22
21
20
NFRX
15
14
13
12
NFRX
4
NFRX
1072
GMAC_TMXBFR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
NFRX
23
22
21
20
NFRX
15
14
13
12
NFRX
4
NFRX
1073
GMAC_UFR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
8
UFRX
0
UFRX
1074
GMAC_OFR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
8
OFRX
0
OFRX
1075
GMAC_JR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
8
JRX
0
JRX
1076
GMAC_FCSE
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
8
FCKR
0
FCKR
1077
GMAC_LFFE
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
8
LFER
0
LFER
1078
GMAC_RSE
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
8
RXSE
0
RXSE
1079
GMAC_AE
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
8
AER
0
AER
1080
GMAC_RRE
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
RXRER
RXRER
7
4
RXRER
1081
GMAC_ROE
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
8
RXOVR
0
RXOVR
1082
GMAC_IHCE
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
HCKER
1083
GMAC_TCE
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TCKER
1084
GMAC_UCE
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
UCKER
1085
GMAC_TSSSL
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
VTS
23
22
21
20
VTS
15
14
13
12
VTS
4
VTS
1086
GMAC_TSSN
Address:
Access:
Read/Write
31
30
29
23
22
21
28
27
26
25
24
19
18
17
16
11
10
VTN
20
VTN
15
14
13
12
VTN
4
VTN
1087
GMAC_TSL
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
TCS
23
22
21
20
TCS
15
14
13
12
TCS
4
TCS
1088
GMAC_TN
Address:
Access:
Read/Write
31
30
29
23
22
21
28
27
26
25
24
19
18
17
16
11
10
TNS
20
TNS
15
14
13
12
TNS
4
TNS
1089
GMAC_TA
Address:
Access:
Write-only
31
ADJ
30
29
23
22
21
28
27
26
25
24
19
18
17
16
11
10
ITDT
20
ITDT
15
14
13
12
ITDT
4
ITDT
ITDT: Increment/Decrement
The number of nanoseconds to increment or decrement the 1588 Timer Nanoseconds Register. If necessary, the 1588
Seconds Register will be incremented or decremented.
ADJ: Adjust 1588 Timer
Write as one to subtract from the 1588 timer. Write as zero to add to it.
1090
GMAC_TI
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
11
10
NIT
15
14
13
12
ACNS
4
CNS
1091
GMAC_EFTS
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
RUD
23
22
21
20
RUD
15
14
13
12
RUD
4
RUD
1092
GMAC_EFTN
Address:
Access:
Read-only
31
30
29
23
22
21
28
27
26
25
24
19
18
17
16
11
10
RUD
20
RUD
15
14
13
12
RUD
4
RUD
1093
GMAC_EFRS
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
RUD
23
22
21
20
RUD
15
14
13
12
RUD
4
RUD
1094
GMAC_EFRN
Address:
Access:
Read-only
31
30
29
23
22
21
28
27
26
25
24
19
18
17
16
11
10
RUD
20
RUD
15
14
13
12
RUD
4
RUD
1095
GMAC_PEFTS
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
RUD
23
22
21
20
RUD
15
14
13
12
RUD
4
RUD
1096
GMAC_PEFTN
Address:
Access:
Read-only
31
30
29
23
22
21
28
27
26
25
24
19
18
17
16
11
10
RUD
20
RUD
15
14
13
12
RUD
4
RUD
1097
GMAC_PEFRS
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
RUD
23
22
21
20
RUD
15
14
13
12
RUD
4
RUD
1098
GMAC_PEFRN
Address:
Access:
Read-only
31
30
29
23
22
21
28
27
26
25
24
19
18
17
16
11
10
RUD
20
RUD
15
14
13
12
RUD
4
RUD
1099
38.
38.1
Description
The High Speed Multimedia Card Interface (HSMCI) supports the MultiMedia Card (MMC) Specification V4.3, the
SD Memory Card Specification V2.0, the SDIO V2.0 specification and CE-ATA V1.1.
The HSMCI 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 HSMCI operates at a rate of up to Master Clock divided by 2 and supports the interfacing of 1 slot(s). Each
slot may be used to interface with a High Speed MultiMedia Card bus (up to 30 Cards) or with an 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 High Speed 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 High Speed MultiMedia Card operations. The main differences
between SD and High Speed MultiMedia Cards are the initialization process and the bus topology.
HSMCI fully supports CE-ATA Revision 1.1, built on the MMC System Specification v4.0. The module includes
dedicated hardware to issue the command completion signal and capture the host command completion signal
disable.
38.2
Embedded Characteristics
Embedded Power Management to Slow Down Clock Rate When Not Used
Each Slot for either a High Speed MultiMedia Card Bus (Up to 30 Cards) or an SD Memory Card
Support for Stream, Block and Multi-block Data Read and Write
1100
Built in FIFO (from 16 to 256 bytes) with Large Memory Aperture Supporting Incremental Access
38.3
Block Diagram
Figure 38-1.
Block Diagram
APB Bridge
DMAC
APB
MCCK(1)
MCCDA(1)
MCDA0(1)
PMC
MCK
MCDA1(1)
MCDA2(1)
MCDA3(1)
HSMCI Interface
PIO
MCCDB(1)
MCDB0(1)
MCDB1(1)
MCDB2(1)
MCDB3(1)
MCDB4(1)
MCDB5(1)
MCDB6(1)
Interrupt Control
MCDB7(1)
HSMCI Interrupt
Note:
1. When several HSMCI (x HSMCI) are embedded in a product, MCCK refers to HSMCIx_CK, MCCDA to HSMCIx_CDA,
MCCDB to HSMCIx_CDB, MCDAy to HSMCIx_DAy, MCDBy to HSMCIx_DBy.
1101
38.4
Physical Layer
HSMCI Interface
1 2 3 4 5 6 7
1 2 3 4 5 6 78
9
9 10 11
1213 8
SDCard
MMC
38.5
Table 38-1.
Pin Name
Pin Description
Type(2)
Comments
MCCDA/MCCDB
Command/response
I/O/PP/OD
MCCK
Clock
I/O
MCDA0 - MCDA7
I/O/PP
MCDB0 - MCDB7
I/O/PP
Notes:
1102
DAT[0..7] of an MMC
DAT[0..3] of an SD Card/SDIO
DAT[0..7] of an MMC
DAT[0..3] of an SD Card/SDIO
1. When several HSMCI (x HSMCI) are embedded in a product, MCCK refers to HSMCIx_CK, MCCDA to HSMCIx_CDA,
MCCDB to HSMCIx_CDB, MCCDC to HSMCIx_CDC, MCCDD to HSMCIx_CDD, MCDAy to HSMCIx_DAy, MCDBy to
HSMCIx_DBy, MCDCy to HSMCIx_DCy, MCDDy to HSMCIx_DDy.
2. I: Input, O: Output, PP: Push/Pull, OD: Open Drain.
Table 38-2.
Pin Name
Pin Description
Type(2)
Comments
MCCDA/MCCDB
Command/response
I/O/PP/OD
MCCK
Clock
I/O
MCDA0 - MCDA3
I/O/PP
DAT[0..3] of an MMC
DAT[0..3] of an SD Card/SDIO
Notes:
1. When several HSMCI (x HSMCI) are embedded in a product, MCCK refers to HSMCIx_CK, MCCDA to HSMCIx_CDA,
MCDAy to HSMCIx_DAy.
2. I: Input, O: Output, PP: Push/Pull, OD: Open Drain.
38.6
Product Dependencies
38.6.1
I/O Lines
The pins used for interfacing the High Speed MultiMedia Cards or SD Cards are multiplexed with PIO lines. The
programmer must first program the PIO controllers to assign the peripheral functions to HSMCI pins.
Table 38-3.
I/O Lines
Instance
Signal
I/O Line
Peripheral
HSMCI0
MCI0_CDA
PC5
HSMCI0
MCI0_CDB
PE0
HSMCI0
MCI0_CK
PC4
HSMCI0
MCI0_DA0
PC6
HSMCI0
MCI0_DA1
PC7
HSMCI0
MCI0_DA2
PC8
HSMCI0
MCI0_DA3
PC9
HSMCI0
MCI0_DA4
PC10
HSMCI0
MCI0_DA5
PC11
HSMCI0
MCI0_DA6
PC12
HSMCI0
MCI0_DA7
PC13
HSMCI0
MCI0_DB0
PE1
HSMCI0
MCI0_DB1
PE2
HSMCI0
MCI0_DB2
PE3
HSMCI0
MCI0_DB3
PE4
HSMCI1
MCI1_CDA
PE19
HSMCI1
MCI1_CK
PE18
HSMCI1
MCI1_DA0
PE20
HSMCI1
MCI1_DA1
PE21
HSMCI1
MCI1_DA2
PE22
HSMCI1
MCI1_DA3
PE23
1103
38.6.2
Power Management
The HSMCI is clocked through the Power Management Controller (PMC), so the programmer must first configure
the PMC to enable the HSMCI clock.
38.6.3
Interrupt
The HSMCI has an interrupt line connected to the interrupt controller.
Handling the HSMCI interrupt requires programming the interrupt controller before configuring the HSMCI.
Table 38-4.
38.7
Peripheral IDs
Instance
ID
HSMCI0
35
HSMCI1
36
Bus Topology
Figure 38-3.
9 10 11
1213 8
MMC
The High Speed MultiMedia Card communication is based on a 13-pin serial bus interface. It has three
communication lines and four supply lines.
Table 38-5.
Description
I/O/PP
Data
MCDz3
CMD
I/O/PP/OD
Command/response
MCCDz
VSS1
VSS
VDD
Supply voltage
VDD
CLK
I/O
Clock
MCCK
VSS2
VSS
DAT[0]
I/O/PP
Data 0
MCDz0
DAT[1]
I/O/PP
Data 1
MCDz1
DAT[2]
I/O/PP
Data 2
MCDz2
10
DAT[4]
I/O/PP
Data 4
MCDz4
11
DAT[5]
I/O/PP
Data 5
MCDz5
12
DAT[6]
I/O/PP
Data 6
MCDz6
13
DAT[7]
I/O/PP
Data 7
MCDz7
Pin Number
Name
Type
DAT[3]
Notes:
1104
Bus Topology
1.
(1)
2.
When several HSMCI (x HSMCI) are embedded in a product, MCCK refers to HSMCIx_CK, MCCDA to
HSMCIx_CDA, MCCDB to HSMCIx_CDB, MCDAy to HSMCIx_DAy, MCDBy to HSMCIx_DBy.
Figure 38-4.
HSMCI
MCDA0
MCCDA
MCCK
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
9 10 11
9 10 11
9 10 11
1213 8
MMC1
Note:
1213 8
MMC2
1213 8
MMC3
When several HSMCI (x HSMCI) are embedded in a product, MCCK refers to HSMCIx_CK, MCCDA to HSMCIx_CDA
MCDAy to HSMCIx_DAy.
Figure 38-5.
SD CARD
The SD Memory Card bus includes the signals listed in Table 38-6.
Table 38-6.
I/O/PP
MCDz3
CMD
PP
Command/response
MCCDz
VSS1
VSS
VDD
Supply voltage
VDD
CLK
I/O
Clock
MCCK
VSS2
VSS
DAT[0]
I/O/PP
MCDz0
DAT[1]
I/O/PP
MCDz1
DAT[2]
I/O/PP
MCDz2
Pin Number
Name
Type
CD/DAT[3]
Notes:
1.
2.
(1)
1105
Figure 38-6.
MCDA0 - MCDA3
MCCK
MCCDA
SD CARD
When several HSMCI (x HSMCI) are embedded in a product, MCCK refers to HSMCIx_CK, MCCDA to HSMCIx_CDA
MCDAy to HSMCIx_DAy.
Figure 38-7.
Note:
MCDA0 - MCDA3
MCCK
12 3 4 5 678
MCCDA
SD CARD 1
MCDB0 - MCDB3
MCCDB
SD CARD 2
Note:
When several HSMCI (x HSMCI) are embedded in a product, MCCK refers to HSMCIx_CK,MCCDA to HSMCIx_CDA,
MCDAy to HSMCIx_DAy, MCCDB to HSMCIx_CDB, MCDBy to HSMCIx_DBy.
Figure 38-8.
Mixing High Speed MultiMedia and SD Memory Cards with Two Slots
MCDA0 - MCDA7
MCCDA
MCCK
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
9 10 11
9 10 11
9 10 11
1213 8
MCDB0 - MCDB3
MMC2
1213 8
MMC3
SD CARD
MCCDB
1 2 3 4 5 6 78
MMC1
1213 8
Note:
1106
When several HSMCI (x HSMCI) are embedded in a product, MCCK refers to HSMCIx_CK, MCCDA to
HSMCIx_CDA, MCDAy to HSMCIx_DAy, MCCDB to HSMCIx_CDB, MCDBy to HSMCIx_DBy.
When the HSMCI is configured to operate with SD memory cards, the width of the data bus can be selected in the
HSMCI_SDCR. 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 High Speed MultiMedia cards, only the data line 0 is used. The other data lines can
be used as independent PIOs.
38.8
CommandA command is a token that starts an operation. A command is sent from the host either to a
single card (addressed command) or to all connected cards (broadcast command). A command is
transferred serially on the CMD line.
ResponseA response is a token which is sent from an addressed card or (synchronously) from all
connected cards to the host as an answer to a previously received command. A response is transferred
serially on the CMD line.
DataData can be transferred from the card to the host or vice versa. Data is transferred via the data line.
Card addressing is implemented using a session address assigned during the initialization phase by the bus
controller to all currently connected cards. Their unique CID number identifies individual cards.
The structure of commands, responses and data blocks is described in the High Speed MultiMedia Card System
Specification. See also Table 38-7 on page 1108.
High Speed MultiMedia Card bus data transfers are composed of these tokens.
There are different types of operations. Addressed operations always contain a command and a response token.
In addition, some operations have a data token; the others transfer their information directly within the command or
response structure. In this case, no data token is present in an operation. The bits on the DAT and the CMD lines
are transferred synchronous to the clock HSMCI clock.
Two types of data transfer commands are defined:
Sequential commandsThese commands initiate a continuous data stream. They are terminated only when
a stop command follows on the CMD line. This mode reduces the command overhead to an absolute
minimum.
Both read and write operations allow either single or multiple block transmission. A multiple block transmission is
terminated when a stop command follows on the CMD line similarly to the sequential read or when a multiple block
transmission has a pre-defined block count (see Section 38.8.2 Data Transfer Operation).
The HSMCI provides a set of registers to perform the entire range of High Speed MultiMedia Card operations.
38.8.1
1107
Host Command
CMD
Content
CRC
NID Cycles
E
******
High Impedance
State
Response
Z
CID
Content
The command ALL_SEND_CID and the fields and values for the HSMCI_CMDR are described in Table 38-7 and
Table 38-8.
Table 38-7.
CMD Index
Type
Argument
Response
Abbreviation
Command Description
CMD2
bcr(1)
R2
ALL_SEND_CID
Note:
1.
Table 38-8.
Field
Value
2 (CMD2)
0 (No transfer)
1108
Figure 38-9.
Read HSMCI_SR
0
CMDRDY
Yes
Status error flags?
RETURN ERROR(1)
No
RETURN OK
Read HSMCI_SR
0
NOTBUSY
1
RETURN OK
Note:
If the command is SEND_OP_COND, the CRC error flag is always present (refer to R3 response in the High Speed
MultiMedia Card specification).
1109
38.8.2
Multiple block read (or write) with pre-defined block count (since version 3.1 and higher):
The card will transfer (or program) the requested number of data blocks and terminate the transaction. The
stop command is not required at the end of this type of multiple block read (or write), unless terminated with
an error. In order to start a multiple block read (or write) with pre-defined block count, the host must correctly
program the HSMCI Block Register (HSMCI_BLKR). Otherwise the card will start an open-ended multiple
block read. The BCNT field of the HSMCI_BLKR defines the number of blocks to transfer (from 1 to 65535
blocks). Programming the value 0 in the BCNT field corresponds to an infinite block transfer.
38.8.3
Read Operation
The following flowchart (Figure 38-10) shows how to read a single block with or without use of DMAC facilities. In
this example, a polling method is used to wait for the end of read. Similarly, the user can configure the HSMCI
Interrupt Enable Register (HSMCI_IER) to trigger an interrupt at the end of read.
1110
No
Yes
Read with DMAC
Send READ_SINGLE_BLOCK
command(1)
Yes
Number of words to read = 0 ?
Read status register HSMCI_SR
No
Read status register HSMCI_SR
Poll the bit
XFRDONE = 0?
Yes
Yes
No
No
RETURN
RETURN
Notes:
38.8.4
1. It is assumed that this command has been correctly sent (see Figure 38-9).
Write Operation
In write operation, the HSMCI Mode Register (HSMCI_MR) is used to define the padding value when writing nonmultiple block size. If the bit PADV is 0, then 0x00 value is used when padding data, otherwise 0xFF is used.
1111
If set, the bit DMAEN in the HSMCI DMA Condiguration Register (HSMCI_DMA) enables DMA transfer.
The flowchart in Figure 38-11 shows how to write a single block with or without use of DMA facilities. Polling or
interrupt method can be used to wait for the end of write according to the contents of the HSMCI Interrupt Mask
Register (HSMCI_IMR).
Figure 38-11. Write Functional Flow Diagram
Send SELECT/DESELECT_CARD
command(1) to select the card
Yes
No
Write using DMAC
Send WRITE_SINGLE_BLOCK
command(1)
Send WRITE_SINGLE_BLOCK
(1)
command
DMAC_GE.EN[X] = TRUE
Yes
Number of words to write = 0 ?
Read status register HSMCI_SR
No
Read status register HSMCI_SR
Poll the bit
XFRDONE = 0?
Poll the bit
TXRDY = 0?
Yes
No
No
RETURN
RETURN
1112
Yes
Notes:
1. It is assumed that this command has been correctly sent (see Figure 38-9).
The flowchart in Figure 38-12 shows how to manage read multiple block and write multiple block transfers with the
DMA Controller. Polling or interrupt method can be used to wait for the end of write according to the contents of the
HSMCI_IMR.
Figure 38-12. Read and Write Multiple Block
Send SELECT/DESELECT_CARD
command(1) to select the card
Send WRITE_MULTIPLE_BLOCK or
READ_MULTIPLE_BLOCK command(1)
DMAC_GE.EN[X] = TRUE
Yes
No
Read status register HSMCI_SR
and Poll Bit FIFOEMPTY
Send STOP_TRANSMISSION
command(1)
No
Yes
RETURN
Notes:
1.
2.
It is assumed that this command has been correctly sent (see Figure 38-9).
Handle errors reported in HSMCI_SR.
1113
38.8.5
2.
3.
Program the block length in the HSMCI Configuration Register with block_length value.
4.
5.
6.
UBLEN is programmed with block_length/4 when the transfer length is multiple of 4, block_length
otherwise.
8.
7.
38.8.6
Enable Channel x, writing one to DMAC_GE.EN[x]. The DMAC is ready and waiting for request.
2.
3.
Program the block length in the HSMCI Configuration Register with block_length value.
4.
5.
6.
7.
1114
7.
UBLEN is programmed with block_length/4 when the transfer length is multiple of 4, block_length
otherwise.
8.
8.
38.9
Enable Channel x, writing one to DMAC_GE.EN[x]. The DMAC is ready and waiting for request.
38.9.1
38.9.2
SDIO Interrupts
Each function within an SDIO or Combo card may implement interrupts (Refer to the SDIO Specification for more
details). In order to allow the SDIO card to interrupt the host, an interrupt function is added to a pin on the DAT[1]
line to signal the cards interrupt to the host. An SDIO interrupt on each slot can be enabled through the HSMCI
Interrupt Enable Register. The SDIO interrupt is sampled regardless of the currently selected slot.
1115
FAST_IO (CMD39): Used for single register access to the ATA taskfile registers, 8-bit access only.
CE-ATA utilizes the same MMC command sequences for initialization as traditional MMC devices.
38.10.1 Executing an ATA Polling Command
1.
2.
3.
4.
Read the ATA status register until DRQ && BSY are configured to 0.
Issue READ_DMA_EXT with RW_MULTIPLE_REGISTER (CMD60) for 8 KB of DATA with nIEN field set to zero
to enable the command completion signal in the device.
2.
3.
ATA Status register reflects an error by setting the ERR bit to one.
The command completion signal does not arrive within a host specified time out period.
Error conditions are expected to happen infrequently. Thus, a robust error recovery mechanism may be used for
each error event. The recommended error recovery procedure after a timeout is:
Issue the command completion signal disable if nIEN was cleared to zero and the RW_MULTIPLE_BLOCK
(CMD61) response has been received.
If STOP_TRANMISSION (CMD12) is successful, then the device is again ready for ATA commands. However, if
the error recovery procedure does not work as expected or there is another timeout, the next step is to issue
GO_IDLE_STATE (CMD0) to the device. GO_IDLE_STATE (CMD0) is a hard reset to the device and completely
resets all device states.
1116
Note that after issuing GO_IDLE_STATE (CMD0), all device initialization needs to be completed again. If the CEATA device completes all MMC commands correctly but fails the ATA command with the ERR bit set in the ATA
Status register, no error recovery action is required. The ATA command itself failed implying that the device could
not complete the action requested, however, there was no communication or protocol failure. After the device
signals an error by setting the ERR bit to one in the ATA Status register, the host may attempt to retry the
command.
Configure the HSMCI data bus width programming SDCBUS Field in the HSMCI_SDCR. The
BOOT_BUS_WIDTH field located in the device Extended CSD register must be set accordingly.
2.
Set the byte count to 512 bytes and the block count to the desired number of blocks, writing BLKLEN and
BCNT fields of the HSMCI_BLKR.
3.
Issue the Boot Operation Request command by writing to the HSMCI_CMDR with SPCMD field set to
BOOTREQ, TRDIR set to READ and TRCMD set to start data transfer.
4.
The BOOT_ACK field located in the HSMCI_CMDR must be set to one, if the BOOT_ACK field of the MMC
device located in the Extended CSD register is set to one.
5.
Host processor can copy boot data sequentially as soon as the RXRDY flag is asserted.
6.
When Data transfer is completed, host processor shall terminate the boot stream by writing the
HSMCI_CMDR with SPCMD field set to BOOTEND.
Configure the HSMCI data bus width by programming SDCBUS Field in the HSMCI_SDCR. The
BOOT_BUS_WIDTH field in the device Extended CSD register must be set accordingly.
2.
Set the byte count to 512 bytes and the block count to the desired number of blocks by writing BLKLEN and
BCNT fields of the HSMCI_BLKR.
3.
4.
Configure DMA controller, program the total amount of data to be transferred and enable the relevant
channel.
5.
Issue the Boot Operation Request command by writing to the HSMCI_CMDR with SPCND set to
BOOTREQ, TRDIR set to READ and TRCMD set to start data transfer.
6.
7.
When DMA transfer is completed, host processor shall terminate the boot stream by writing the
HSMCI_CMDR with SPCMD field set to BOOTEND.
1117
Card response
The CMDRDY flag is released 8 tbit after the end of the card response.
CMDRDY flag
Data
Last Block
1st Block
Not busy flag
XFRDONE flag
CMDRDY flag
Card response
The CMDRDY flag is released 8 tbit after the end of the card response.
D0
1st Block
Last Block
1st Block
Last Block
Data bus - D0
XFRDONE flag
1118
1119
Register Mapping
Offset
Register
Name
Access
Reset
0x00
Control Register
HSMCI_CR
Write-only
0x04
Mode Register
HSMCI_MR
Read/Write
0x0
0x08
HSMCI_DTOR
Read/Write
0x0
0x0C
HSMCI_SDCR
Read/Write
0x0
0x10
Argument Register
HSMCI_ARGR
Read/Write
0x0
0x14
Command Register
HSMCI_CMDR
Write-only
0x18
Block Register
HSMCI_BLKR
Read/Write
0x0
0x1C
HSMCI_CSTOR
Read/Write
0x0
Response Register
(1)
HSMCI_RSPR
Read-only
0x0
Response Register
(1)
HSMCI_RSPR
Read-only
0x0
0x28
Response Register
(1)
HSMCI_RSPR
Read-only
0x0
0x2C
Response Register(1)
HSMCI_RSPR
Read-only
0x0
0x30
HSMCI_RDR
Read-only
0x0
0x34
HSMCI_TDR
Write-only
0x20
0x24
0x380x3C
Reserved
0x40
Status Register
HSMCI_SR
Read-only
0xC0E5
0x44
HSMCI_IER
Write-only
0x48
HSMCI_IDR
Write-only
0x4C
HSMCI_IMR
Read-only
0x0
0x50
HSMCI_DMA
Read/Write
0x00
0x54
Configuration Register
HSMCI_CFG
Read/Write
0x00
0x580xE0
Reserved
0xE4
HSMCI_WPMR
Read/Write
0xE8
HSMCI_WPSR
Read-only
0xEC0xFC
Reserved
0x1000x1FC
Reserved
HSMCI_FIFO0
Read/Write
0x0
...
...
...
HSMCI_FIFO255
Read/Write
0x0
0x200
...
0x5FC
Notes:
1120
1. The Response Register can be read by N accesses at the same HSMCI_RSPR or at consecutive addresses (0x20 to
0x2C). N depends on the size of the response.
HSMCI_CR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
7
SWRST
3
PWSDIS
2
PWSEN
1
MCIDIS
0
MCIEN
1121
HSMCI_MR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
CLKODD
15
14
PADV
13
FBYTE
12
WRPROOF
11
RDPROOF
10
9
PWSDIV
CLKDIV
This register can only be written if the WPEN bit is cleared in the HSMCI Write Protection Mode Register.
CLKDIV: Clock Divider
High Speed MultiMedia Card Interface clock (MCCK or HSMCI_CK) is Master Clock (MCK) divided by
({CLKDIV,CLKODD}+2).
PWSDIV: Power Saving Divider
High Speed MultiMedia Card Interface clock is divided by 2(PWSDIV) + 1 when entering Power Saving Mode.
Warning: This value must be different from 0 before enabling the Power Save Mode in the HSMCI_CR (HSMCI_PWSEN
bit).
RDPROOF: Read Proof Enable
Enabling Read Proof allows to stop the HSMCI Clock during read access if the internal FIFO is full. This will guarantee data
integrity, not bandwidth.
0: Disables Read Proof.
1: Enables Read Proof.
WRPROOF: Write Proof Enable
Enabling Write Proof allows to stop the HSMCI Clock during write access if the internal FIFO is full. This will guarantee
data integrity, not bandwidth.
0: Disables Write Proof.
1: Enables Write Proof.
FBYTE: Force Byte Transfer
Enabling Force Byte Transfer allow byte transfers, so that transfer of blocks with a size different from modulo 4 can be
supported.
Warning: BLKLEN value depends on FBYTE.
0: Disables Force Byte Transfer.
1: Enables Force Byte Transfer.
1122
1123
HSMCI_DTOR
Address:
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
5
DTOMUL
DTOCYC
This register can only be written if the WPEN bit is cleared in the HSMCI Write Protection Mode Register.
DTOCYC: Data Timeout Cycle Number
This field determines the maximum number of Master Clock cycles that the HSMCI waits between two data block transfers.
It equals (DTOCYC x Multiplier).
DTOMUL: Data Timeout Multiplier
Multiplier is defined by DTOMUL as shown in the following table:
Value
Name
Description
DTOCYC
16
DTOCYC x 16
128
DTOCYC x 128
256
DTOCYC x 256
1024
DTOCYC x 1024
4096
DTOCYC x 4096
65536
DTOCYC x 65536
1048576
DTOCYC x 1048576
If the data time-out set by DTOCYC and DTOMUL has been exceeded, the Data Time-out Error flag (DTOE) in the HSMCI
Status Register (HSMCI_SR) rises.
1124
HSMCI_SDCR
Address:
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
7
SDCBUS
0
SDCSEL
This register can only be written if the WPEN bit is cleared in the HSMCI Write Protection Mode Register.
SDCSEL: SDCard/SDIO Slot
Value
Name
Description
SLOTA
Slot A is selected.
SLOTB
Slot B is selected.
SLOTC
Reserved
SLOTD
Reserved
Name
Description
1 bit
Reserved
4 bits
8 bits
1125
HSMCI_ARGR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ARG
23
22
21
20
ARG
15
14
13
12
ARG
4
ARG
1126
HSMCI_CMDR
Address:
Access:
Write-only
31
30
29
28
27
BOOT_ACK
26
ATACS
25
23
22
21
20
TRTYP
19
18
TRDIR
17
15
14
13
12
MAXLAT
11
OPDCMD
10
9
SPCMD
7
RSPTYP
24
IOSPCMD
16
TRCMD
CMDNB
This register is write-protected while CMDRDY is 0 in HSMCI_SR. If an Interrupt command is sent, this register is only writable by an interrupt response (field SPCMD). This means that the current command execution cannot be interrupted or
modified.
CMDNB: Command Number
This is the command index.
RSPTYP: Response Type
Value
Name
Description
NORESP
No response
48_BIT
48-bit response
136_BIT
136-bit response
R1B
Name
Description
STD
INIT
Initialization CMD:
74 clock cycles for initialization sequence.
SYNC
CE_ATA
IT_CMD
Interrupt command:
Corresponds to the Interrupt Mode (CMD40).
IT_RESP
Interrupt response:
Corresponds to the Interrupt Mode (CMD40).
BOR
EBO
Synchronized CMD:
Wait for the end of the current data block transfer before sending the pending command.
1127
Name
Description
NO_DATA
START_DATA
STOP_DATA
No data transfer
Reserved
Name
Description
SINGLE
MULTIPLE
STREAM
BYTE
SDIO Byte
BLOCK
SDIO Block
Name
Description
STD
SUSPEND
RESUME
1128
HSMCI_BLKR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
BLKLEN
23
22
21
20
BLKLEN
15
14
13
12
BCNT
4
BCNT
1129
HSMCI_CSTOR
Address:
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
5
CSTOMUL
CSTOCYC
This register can only be written if the WPEN bit is cleared in the HSMCI Write Protection Mode Register.
CSTOCYC: Completion Signal Timeout Cycle Number
This field determines the maximum number of Master Clock cycles that the HSMCI waits between two data block transfers.
Its value is calculated by (CSTOCYC x Multiplier).
CSTOMUL: Completion Signal Timeout Multiplier
This field determines the maximum number of Master Clock cycles that the HSMCI waits between two data block transfers.
Its value is calculated by (CSTOCYC x Multiplier).
These fields determine the maximum number of Master Clock cycles that the HSMCI waits between the end of the data
transfer and the assertion of the completion signal. The data transfer comprises data phase and the optional busy phase. If
a non-DATA ATA command is issued, the HSMCI starts waiting immediately after the end of the response until the completion signal.
Multiplier is defined by CSTOMUL as shown in the following table:
Value
Name
Description
CSTOCYC x 1
16
CSTOCYC x 16
128
CSTOCYC x 128
256
CSTOCYC x 256
1024
CSTOCYC x 1024
4096
CSTOCYC x 4096
65536
CSTOCYC x 65536
1048576
CSTOCYC x 1048576
If the data time-out set by CSTOCYC and CSTOMUL has been exceeded, the Completion Signal Time-out Error flag
(CSTOE) in the HSMCI Status Register (HSMCI_SR) rises.
1130
HSMCI_RSPR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
RSP
23
22
21
20
RSP
15
14
13
12
RSP
4
RSP
RSP: Response
Note:
1. The response register can be read by N accesses at the same HSMCI_RSPR or at consecutive addresses (0x20 to 0x2C).
N depends on the size of the response.
1131
HSMCI_RDR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
DATA
23
22
21
20
DATA
15
14
13
12
DATA
4
DATA
1132
HSMCI_TDR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
DATA
23
22
21
20
DATA
15
14
13
12
DATA
4
DATA
1133
HSMCI_SR
Address:
Access:
Read-only
31
UNRE
30
OVRE
29
ACKRCVE
28
ACKRCV
27
XFRDONE
26
FIFOEMPTY
25
24
BLKOVRE
23
CSTOE
22
DTOE
21
DCRCE
20
RTOE
19
RENDE
18
RCRCE
17
RDIRE
16
RINDE
15
14
13
CSRCV
12
SDIOWAIT
11
10
9
SDIOIRQB
8
SDIOIRQA
5
NOTBUSY
4
DTIP
3
BLKE
2
TXRDY
1
RXRDY
0
CMDRDY
1134
For all the read operations, the NOTBUSY flag is cleared at the end of the host command.
For the Infinite Read Multiple Blocks, the NOTBUSY flag is set at the end of the STOP_TRANSMISSION host command
(CMD12).
For the Single Block Reads, the NOTBUSY flag is set at the end of the data read block.
For the Multiple Block Reads with pre-defined block count, the NOTBUSY flag is set at the end of the last received data
block.
The NOTBUSY flag allows to deal with these different states.
0: The HSMCI is not ready for new data transfer. Cleared at the end of the card response.
1: The HSMCI 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.
SDIOIRQA: SDIO Interrupt for Slot A
0: No interrupt detected on SDIO Slot A.
1: An SDIO Interrupt on Slot A occurred. Cleared when reading the HSMCI_SR.
SDIOIRQB: SDIO Interrupt for Slot B
0: No interrupt detected on SDIO Slot B.
1: An SDIO Interrupt on Slot B occurred. Cleared when reading the HSMCI_SR.
SDIOWAIT: SDIO Read Wait Operation Status
0: Normal Bus operation.
1: The data bus has entered IO wait state.
CSRCV: CE-ATA Completion Signal Received
0: No completion signal received since last status read operation.
1: The device has issued a command completion signal on the command line. Cleared by reading in the HSMCI_SR.
RINDE: Response Index Error
0: No error.
1: A mismatch is detected between the command index sent and the response index received. Cleared when writing in the
HSMCI_CMDR.
RDIRE: Response Direction Error
0: No error.
1: The direction bit from card to host in the response has not been detected.
RCRCE: Response CRC Error
0: No error.
1: A CRC7 error has been detected in the response. Cleared when writing in the HSMCI_CMDR.
RENDE: Response End Bit Error
0: No error.
1: The end bit of the response has not been detected. Cleared when writing in the HSMCI_CMDR.
1135
1136
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 or when setting FERRCTRL in HSMCI_CFG to 1.
When FERRCTRL in HSMCI_CFG is set, UNRE becomes reset after read.
1137
HSMCI_IER
Address:
Access:
Write-only
31
UNRE
30
OVRE
29
ACKRCVE
28
ACKRCV
27
XFRDONE
26
FIFOEMPTY
25
24
BLKOVRE
23
CSTOE
22
DTOE
21
DCRCE
20
RTOE
19
RENDE
18
RCRCE
17
RDIRE
16
RINDE
15
14
13
CSRCV
12
SDIOWAIT
11
10
9
SDIOIRQB
8
SDIOIRQA
5
NOTBUSY
4
DTIP
3
BLKE
2
TXRDY
1
RXRDY
0
CMDRDY
The following configuration values are valid for all listed bit names of this register:
0: No effect.
1: Enables the corresponding interrupt.
CMDRDY: Command Ready Interrupt Enable
RXRDY: Receiver Ready Interrupt Enable
TXRDY: Transmit Ready Interrupt Enable
BLKE: Data Block Ended Interrupt Enable
DTIP: Data Transfer in Progress Interrupt Enable
NOTBUSY: Data Not Busy Interrupt Enable
SDIOIRQA: SDIO Interrupt for Slot A Interrupt Enable
SDIOIRQB: SDIO Interrupt for Slot B Interrupt Enable
SDIOWAIT: SDIO Read Wait Operation Status Interrupt Enable
CSRCV: Completion Signal Received Interrupt Enable
RINDE: Response Index Error Interrupt Enable
RDIRE: Response Direction Error Interrupt Enable
RCRCE: Response CRC Error Interrupt Enable
RENDE: Response End Bit Error Interrupt Enable
RTOE: Response Time-out Error Interrupt Enable
DCRCE: Data CRC Error Interrupt Enable
DTOE: Data Time-out Error Interrupt Enable
1138
1139
HSMCI_IDR
Address:
Access:
Write-only
31
UNRE
30
OVRE
29
ACKRCVE
28
ACKRCV
27
XFRDONE
26
FIFOEMPTY
25
24
BLKOVRE
23
CSTOE
22
DTOE
21
DCRCE
20
RTOE
19
RENDE
18
RCRCE
17
RDIRE
16
RINDE
15
14
13
CSRCV
12
SDIOWAIT
11
10
9
SDIOIRQB
8
SDIOIRQA
5
NOTBUSY
4
DTIP
3
BLKE
2
TXRDY
1
RXRDY
0
CMDRDY
The following configuration values are valid for all listed bit names of this register:
0: No effect.
1: Disables the corresponding interrupt.
CMDRDY: Command Ready Interrupt Disable
RXRDY: Receiver Ready Interrupt Disable
TXRDY: Transmit Ready Interrupt Disable
BLKE: Data Block Ended Interrupt Disable
DTIP: Data Transfer in Progress Interrupt Disable
NOTBUSY: Data Not Busy Interrupt Disable
SDIOIRQA: SDIO Interrupt for Slot A Interrupt Disable
SDIOIRQB: SDIO Interrupt for Slot B Interrupt Disable
SDIOWAIT: SDIO Read Wait Operation Status Interrupt Disable
CSRCV: Completion Signal received interrupt Disable
RINDE: Response Index Error Interrupt Disable
RDIRE: Response Direction Error Interrupt Disable
RCRCE: Response CRC Error Interrupt Disable
RENDE: Response End Bit Error Interrupt Disable
RTOE: Response Time-out Error Interrupt Disable
DCRCE: Data CRC Error Interrupt Disable
DTOE: Data Time-out Error Interrupt Disable
1140
1141
HSMCI_IMR
Address:
Access:
Read-only
31
UNRE
30
OVRE
29
ACKRCVE
28
ACKRCV
27
XFRDONE
26
FIFOEMPTY
25
24
BLKOVRE
23
CSTOE
22
DTOE
21
DCRCE
20
RTOE
19
RENDE
18
RCRCE
17
RDIRE
16
RINDE
15
14
13
CSRCV
12
SDIOWAIT
11
10
9
SDIOIRQB
8
SDIOIRQA
5
NOTBUSY
4
DTIP
3
BLKE
2
TXRDY
1
RXRDY
0
CMDRDY
The following configuration values are valid for all listed bit names of this register:
0: The corresponding interrupt is not enabled.
1: The corresponding interrupt is enabled.
CMDRDY: Command Ready Interrupt Mask
RXRDY: Receiver Ready Interrupt Mask
TXRDY: Transmit Ready Interrupt Mask
BLKE: Data Block Ended Interrupt Mask
DTIP: Data Transfer in Progress Interrupt Mask
NOTBUSY: Data Not Busy Interrupt Mask
SDIOIRQA: SDIO Interrupt for Slot A Interrupt Mask
SDIOIRQB: SDIO Interrupt for Slot B Interrupt Mask
SDIOWAIT: SDIO Read Wait Operation Status Interrupt Mask
CSRCV: Completion Signal Received Interrupt Mask
RINDE: Response Index Error Interrupt Mask
RDIRE: Response Direction Error Interrupt Mask
RCRCE: Response CRC Error Interrupt Mask
RENDE: Response End Bit Error Interrupt Mask
RTOE: Response Time-out Error Interrupt Mask
DCRCE: Data CRC Error Interrupt Mask
DTOE: Data Time-out Error Interrupt Mask
1142
1143
HSMCI_DMA
Address:
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
8
DMAEN
5
CHKSIZE
This register can only be written if the WPEN bit is cleared in the HSMCI Write Protection Mode Register.
CHKSIZE: DMA Channel Read and Write Chunk Size
The CHKSIZE field indicates the number of data available when the DMA chunk transfer request is asserted.
Value
Name
Description
1 data available
2 data available
4 data available
8 data available
16
16 data available
1144
HSMCI_CFG
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
LSYNC
11
10
8
HSMODE
4
FERRCTRL
0
FIFOMODE
This register can only be written if the WPEN bit is cleared in the HSMCI Write Protection Mode Register.
FIFOMODE: HSMCI Internal FIFO control mode
0: A write transfer starts when a sufficient amount of data is written into the FIFO.
When the block length is greater than or equal to 3/4 of the HSMCI internal FIFO size, then the write transfer starts as soon
as half the FIFO is filled. When the block length is greater than or equal to half the internal FIFO size, then the write transfer starts as soon as one quarter of the FIFO is filled. In other cases, the transfer starts as soon as the total amount of data
is written in the internal FIFO.
1: A write transfer starts as soon as one data is written into the FIFO.
FERRCTRL: Flow Error flag reset control mode
0: When an underflow/overflow condition flag is set, a new Write/Read command is needed to reset the flag.
1: When an underflow/overflow condition flag is set, a read status resets the flag.
HSMODE: High Speed Mode
0: Default bus timing mode.
1: If set to one, the host controller outputs command line and data lines on the rising edge of the card clock. The Host
driver shall check the high speed support in the card registers.
LSYNC: Synchronize on the last block
0: The pending command is sent at the end of the current data block.
1: The pending command is sent at the end of the block transfer when the transfer length is not infinite (block count shall
be different from zero).
1145
HSMCI_WPMR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
0
WPEN
WPKEY
23
22
21
20
WPKEY
15
14
13
12
WPKEY
Name
0x4D4349
PASSWD
1146
Description
Writing any other value in this field aborts the write operation of the WPEN bit.
Always reads as 0.
HSMCI_WPSR
Address:
Access:
Read-only
31
30
29
28
23
22
21
20
27
26
25
24
19
18
17
16
11
10
0
WPVS
WPVSRC
15
14
13
12
WPVSRC
1147
39.
39.1
Description
The Serial Peripheral Interface (SPI) circuit is a synchronous serial data link that provides communication 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, contrary to single master protocol where one CPU is always the master while all of the others are
always slaves). One master can simultaneously shift data into multiple slaves. However, only one slave can 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:
39.2
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 can transmit data at a variety of baud rates; there is one SPCK pulse for each bit that is transmitted.
Slave Select (NSS)This control line allows slaves to be turned on and off by hardware.
Embedded Characteristics
Programmable transfer delay between consecutive transfers and delay before SPI clock per chip
select
Slave mode operates on SPCK, asynchronously with core and bus clock
Four chip selects with external decoder support allow communication with up to 15 peripherals
1148
Serial peripherals, such as ADCs, DACs, LCD controllers, CAN controllers and sensors
External coprocessors
39.3
Block Diagram
Figure 39-1.
Block Diagram
AHB Matrix
DMA
Peripheral bridge
Trigger
events
Bus clock
PMC
39.4
Peripheral
clock
SPI
Figure 39-2.
SPI Master
SPCK
SPCK
MISO
MISO
MOSI
MOSI
NPCS0
NSS
SPCK
NPCS1
NPCS2
NPCS3
Slave 0
NC
MISO
Slave 1
MOSI
NSS
SPCK
MISO
Slave 2
MOSI
NSS
1149
39.5
Signal Description
Table 39-1.
Signal Description
Type
39.6
Pin Name
Pin Description
Master
Slave
MISO
Input
Output
MOSI
Output
Input
SPCK
Serial Clock
Output
Input
NPCS1NPCS3
Output
Unused
NPCS0/NSS
Output
Input
Product Dependencies
1150
I/O Lines
Instance
Signal
I/O Line
Peripheral
SPI0
SPI0_MISO
PC0
SPI0
SPI0_MOSI
PC1
SPI0
SPI0_NPCS0
PC3
SPI0
SPI0_NPCS1
PC4
SPI0
SPI0_NPCS1
PC27
SPI0
SPI0_NPCS2
PC28
SPI0
SPI0_NPCS2
PD31
SPI0
SPI0_NPCS3
PC29
SPI0
SPI0_SPCK
PC2
SPI1
SPI1_MISO
PB18
SPI1
SPI1_MOSI
PB19
SPI1
SPI1_NPCS0
PB21
SPI1
SPI1_NPCS1
PA26
SPI1
SPI1_NPCS1
PB22
SPI1
SPI1_NPCS2
PA27
SPI1
SPI1_NPCS2
PB23
SPI1
SPI1_NPCS3
PA28
SPI1
SPI1_NPCS3
PB27
SPI1
SPI1_SPCK
PB20
SPI2
SPI2_MISO
PD11
SPI2
SPI2_MOSI
PD13
SPI2
SPI2_NPCS0
PD17
Table 39-2.
SPI2
SPI2_NPCS1
PB14
SPI2
SPI2_NPCS2
PB15
SPI2
SPI2_NPCS3
PB28
SPI2
SPI2_SPCK
PD15
Peripheral IDs
Instance
ID
SPI0
37
SPI1
38
SPI2
39
39.7
Functional Description
The SPI operates in Master mode by writing a 1 to the MSTR bit in the SPI Mode Register (SPI_MR):
The SPI operates in Slave mode if the MSTR bit in the SPI_MR is written to 0:
The NPCS0 pin becomes an input, and is used as a slave select signal (NSS)
NPCS1 to NPCS3 are not driven and can be used for other purposes.
The data transfers are identically programmable for both modes of operations. The baud rate generator is
activated only in Master mode.
39.7.2 Data Transfer
Four combinations of polarity and phase are available for data transfers. The clock polarity is programmed with the
CPOL bit in the SPI Chip Select register (SPI_CSR). The clock phase is programmed with the NCPHA bit. These
SAMA5D4 Series [DATASHEET]
Atmel-11238A-ATARM-SAMA5D4-Datasheet_30-Sep-14
1151
two parameters determine the edges of the clock signal on which data is driven and sampled. Each of the two
parameters has two possible states, resulting in four possible combinations that are incompatible with one another.
Consequently, a master/slave pair must use the same parameter pair values to communicate. If multiple slaves
are connected and require different configurations, the master must reconfigure itself each time it needs to
communicate with a different slave.
Table 39-4 shows the four modes and corresponding parameter settings.
Table 39-4.
SPI Mode
CPOL
NCPHA
Falling
Rising
Low
Rising
Falling
Low
Rising
Falling
High
Falling
Rising
High
SPCK
(CPOL = 0)
SPCK
(CPOL = 1)
MOSI
(from master)
MISO
(from slave)
MSB
MSB
LSB
LSB
NSS
(to slave)
* Not defined.
1152
Figure 39-4.
SPCK
(CPOL = 0)
SPCK
(CPOL = 1)
MOSI
(from master)
MISO
(from slave)
MSB
MSB
LSB
LSB
NSS
(to slave)
* Not defined.
1153
If the SPI_RDR has not been read before new data is received, the Overrun Error (OVRES) bit in the SPI_SR is
set. As long as this flag is set, data is loaded in the SPI_RDR. The user has to read the SPI_SR to clear the
OVRES bit.
Figure 39-5, shows a block diagram of the SPI when operating in Master mode. Figure 39-6 on page 1155 shows
a flow chart describing how transfers are handled.
39.7.3.1 Master Mode Block Diagram
Figure 39-5.
Peripheral clock
SPCK
SPI
Clock
SPI_CSRx
BITS
NCPHA
CPOL
LSB
MISO
SPI_RDR
RDRF
OVRES
RD
MSB
Shift Register
MOSI
SPI_TDR
TDRE
TD
SPI_CSRx
SPI_RDR
CSAAT
PCS
PS
NPCSx
PCSDEC
SPI_MR
PCS
0
Current
Peripheral
SPI_TDR
NPCS0
PCS
1
MSTR
MODF
NPCS0
MODFDIS
1154
TDRE ?
CSAAT ?
PS ?
0
0
Fixed
peripheral
PS ?
Fixed
peripheral
Variable
peripheral
Variable
peripheral
SPI_TDR(PCS)
= NPCS ?
no
NPCS = SPI_TDR(PCS)
NPCS = SPI_MR(PCS)
yes
SPI_MR(PCS)
= NPCS ?
no
NPCS deasserted
NPCS deasserted
Delay DLYBCS
Delay DLYBCS
NPCS = SPI_TDR(PCS)
NPCS = SPI_MR(PCS),
SPI_TDR(PCS)
Delay DLYBS
Serializer = SPI_TDR(TD)
TDRE = 1
Data Transfer
SPI_RDR(RD) = Serializer
RDRF = 1
Delay DLYBCT
TDRE ?
CSAAT ?
0
NPCS deasserted
Delay DLYBCS
1155
Figure 39-7 shows the behavior of Transmit Data Register Empty (TDRE), Receive Data Register (RDRF) and
Transmission Register Empty (TXEMPTY) status flags within the SPI_SR during an 8-bit data transfer in Fixed
mode without the DMA involved.
Figure 39-7.
SPCK
NPCS0
MOSI
(from master)
MSB
LSB
TDRE
RDR read
Write in
SPI_TDR
RDRF
MISO
(from slave)
MSB
LSB
TXEMPTY
1156
The SPI Baud rate clock is generated by dividing the peripheral clock by a value between 1 and 255.
If the SCBR field in the SPI_CSR is programmed to 1, the operating baud rate is peripheral clock (see the
electrical characteristics section for the SPCK maximum frequency). 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 to a valid value before performing the first transfer.
The divisor can be defined independently for each chip select, as it has to be programmed in the SCBR field. This
allows the SPI to automatically adapt the baud rate for each interfaced peripheral without reprogramming.
39.7.3.4 Transfer Delays
Figure 39-8 shows a chip select transfer change and consecutive transfers on the same chip select. Three delays
can be programmed to modify the transfer waveforms:
Delay between the chip selectsprogrammable only once for all chip selects by writing the DLYBCS field in
the SPI_MR. The SPI slave device deactivation delay is managed through DLYBCS. If there is only one SPI
slave device connected to the master, the DLYBCS field does not need to be configured. If several slave
devices are connected to a master, DLYBCS must be configured depending on the highest deactivation
delay. Refer to the SPI slave device electrical characteristics.
Delay before SPCKindependently programmable for each chip select by writing the DLYBS field. The SPI
slave device activation delay is managed through DLYBS. Refer to the SPI slave device electrical
characteristics to define DLYBS.
Delay between consecutive transfersindependently programmable for each chip select by writing the
DLYBCT field. The time required by the SPI slave device to process received data is managed through
DLYBCT. This time depends on the SPI slave system activity.
These delays allow the SPI to be adapted to the interfaced peripherals and their speed and bus release time.
Figure 39-8.
Programmable Delays
Chip Select 1
Chip Select 2
SPCK
DLYBCS
DLYBS
DLYBCT
DLYBCT
The serial peripherals are selected through the assertion of the NPCS0 to NPCS3 signals. By default, all NPCS
signals are high before and after each transfer.
Fixed Peripheral Select Mode: SPI exchanges data with only one peripheral.
Fixed peripheral select mode is enabled by writing the PS bit to zero in the SPI_MR. In this case, the current
peripheral is defined by the PCS field in the SPI_MR and the PCS field in the SPI_TDR has no effect.
Variable Peripheral Select Mode: Data can be exchanged with more than one peripheral without having to
reprogram the NPCS field in the SPI_MR.
Variable peripheral select mode is enabled by setting the PS bit to 1 in the SPI_MR. The PCS field in the
SPI_TDR is used to select the current peripheral. This means that the peripheral selection can be defined for
each new data. The value to write in the SPI_TDR has the following format:
SAMA5D4 Series [DATASHEET]
Atmel-11238A-ATARM-SAMA5D4-Datasheet_30-Sep-14
1157
[xxxxxxx(7-bit) + LASTXFER(1-bit)(1)+ xxxx(4-bit) + PCS (4-bit) + DATA (8 to 16-bit)] with PCS equals the
chip select to assert, as defined in Section 39.8.4 SPI Transmit Data Register and LASTXFER bit at 0 or 1
depending on the CSAAT bit.
Note:
1.
Optional
CSAAT, LASTXFER and CSNAAT bits are discussed in Section 39.7.3.9 Peripheral Deselection with
DMA.
If LASTXFER is used, the command must be issued before writing the last character. Instead of LASTXFER,
the user can use the SPIDIS command. After the end of the DMA transfer, it is necessary to wait for the
TXEMPTY flag and then write SPIDIS into the SPI Control Register (SPI_CR). This does not change the
configuration register values). The NPCS is disabled after the last character transfer. Then, another DMA
transfer can be started if the SPIEN has previously been written in the SPI_CR.
39.7.3.6 SPI Direct Access Memory Controller (DMAC)
In both Fixed and Variable modes, the Direct Memory Access Controller (DMAC) can be used to reduce processor
overhead.
The fixed peripheral selection allows buffer transfers with a single peripheral. Using the DMAC 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, if the
peripheral selection is modified, the SPI_MR must be reprogrammed.
The variable peripheral selection allows buffer transfers with multiple peripherals without reprogramming the
SPI_MR. Data written in the SPI_TDR is 32 bits wide and defines the real data to be transmitted and the
destination peripheral. Using the DMAC in this mode requires 32-bit wide buffers, with the data in the LSBs and the
PCS and LASTXFER fields in the MSBs. However, the SPI still controls the number of bits (8 to 16) to be
transferred through MISO and MOSI lines with the chip select configuration registers. This is not the optimal
means in terms of memory size for the buffers, but it provides a very effective means to exchange data with
several peripherals without any intervention of the processor.
39.7.3.7 Peripheral Chip Select Decoding
The user can program the SPI to operate with up to 15 slave peripherals by decoding the four chip select lines,
NPCS0 to NPCS3 with an external decoder/demultiplexer (refer to Figure 39-9). This can be enabled by writing a 1
to the PCSDEC bit in the SPI_MR.
When operating without decoding, the SPI makes sure that in any case only one chip select line is activated, i.e.,
one NPCS line driven low at a time. If two bits are defined low in a PCS field, only the lowest numbered chip select
is driven low.
When operating with decoding, the SPI directly outputs the value defined by the PCS field on the NPCS lines of
either SPI_MR or SPI_TDR (depending on PS).
As the SPI sets a default value of 0xF on the chip select lines (i.e., all chip select lines at 1) when not processing
any transfer, only 15 peripherals can be decoded.
The SPI has four Chip Select registers. As a result, when external decoding is activated, each NPCS chip select
defines the characteristics of up to four peripherals. As an example, SPI_CRS0 defines the characteristics of the
externally decoded peripherals 0 to 3, corresponding to the PCS values 0x0 to 0x3. Consequently, the user has to
make sure to connect compatible peripherals on the decoded chip select lines 0 to 3, 4 to 7, 8 to 11 and 12 to 14.
Figure 39-9 shows this type of implementation.
If the CSAAT bit is used, with or without the DMAC, the Mode Fault detection for NPCS0 line must be disabled.
This is not needed for all other chip select lines since Mode Fault detection is only on NPCS0.
1158
Figure 39-9.
Chip Select Decoding Application Block Diagram: Single Master/Multiple Slave Implementation
SPCK
MISO
MOSI
SPI Master
Slave 0
Slave 1
Slave 14
NSS
NSS
NSS
NPCS0
NPCS1
NPCS2
NPCS3
During a transfer of more than one unit of data on a Chip Select without the DMA, the SPI_TDR is loaded by the
processor, the TDRE flag rises as soon as the content of the SPI_TDR is transferred into the internal Shift register.
When this flag is detected high, the SPI_TDR can be reloaded. If this reload by the processor occurs before the
end of the current transfer and if the next transfer is performed on the same chip select as the current transfer, the
Chip Select is not de-asserted between the two transfers. But depending on the application software handling the
SPI status register flags (by interrupt or polling method) or servicing other interrupts or other tasks, the processor
may not reload the SPI_TDR in time to keep the chip select active (low). A null DLYBCT value (delay between
consecutive transfers) in the SPI_CSR, gives even less time for the processor to reload the SPI_TDR. With some
SPI slave peripherals, if the chip select line must remain active (low) during a full set of transfers, communication
errors can occur.
To facilitate interfacing with such devices, the Chip Select registers [CSR0...CSR3] can be programmed with the
Chip Select Active After Transfer (CSAAT) bit to 1. This allows the chip select lines to remain in their current state
(low = active) until a transfer to another chip select is required. Even if the SPI_TDR is not reloaded, the chip select
remains active. To de-assert the chip select line at the end of the transfer, the Last Transfer (LASTXFER) bit in the
SPI_MR must be set to 1 before writing the last data to transmit into the SPI_TDR.
39.7.3.9 Peripheral Deselection with DMA
DMA provides faster reloads of the SPI_TDR compared to software. However, depending on the system activity, it
is not guaranteed that the SPI_TDR is written with the next data before the end of the current transfer.
Consequently, data can be lost by the de-assertion of the NPCS line for SPI slave peripherals requiring the chip
select line to remain active between two transfers. The only way to guarantee a safe transfer in this case is the use
of the CSAAT and LASTXFER bits.
When the CSAAT bit is configured to 0, the NPCS does not rise in all cases between two transfers on the same
peripheral. During a transfer on a Chip Select, the TDRE flag rises as soon as the content of the SPI_TDR is
transferred into the internal shift register. When this flag is detected, the SPI_TDR can be reloaded. If this reload
occurs before the end of the current transfer and if the next transfer is performed on the same chip select as the
current transfer, the Chip Select is not de-asserted between the two transfers. This can lead to difficulties to
interface with some serial peripherals requiring the chip select to be de-asserted after each transfer. To facilitate
1159
interfacing with such devices, the SPI_CSR can be programmed with the Chip Select Not Active After Transfer
(CSNAAT) bit to 1. This allows the chip select lines to be de-asserted systematically during a time DLYBCS (the
value of the CSNAAT bit is processed only if the CSAAT bit is configured to 0 for the same chip select).
Figure 39-10 shows different peripheral deselection cases and the effect of the CSAAT and CSNAAT bits.
Figure 39-10. Peripheral Deselection
CSAAT = 0 and CSNAAT = 0
TDRE
NPCS[0..n]
DLYBCT
DLYBCT
DLYBCS
DLYBCS
PCS = A
PCS = A
Write SPI_TDR
TDRE
NPCS[0..n]
DLYBCT
DLYBCT
A
DLYBCS
DLYBCS
PCS=A
PCS = A
Write SPI_TDR
TDRE
NPCS[0..n]
DLYBCT
DLYBCT
B
DLYBCS
DLYBCS
PCS = B
PCS = B
Write SPI_TDR
DLYBCT
TDRE
NPCS[0..n]
A
DLYBCS
PCS = A
PCS = A
Write SPI_TDR
The SPI has the capability to operate in multi-master environment. Consequently, the NPCS0/NSS line must be
monitored. If one of the masters on the SPI bus is currently transmitting, the NPCS0/NSS line is low and the SPI
must not transmit any data. A mode fault is detected when the SPI is programmed in Master mode and a low level
1160
is driven by an external master on the NPCS0/NSS signal. In multi-master environment, NPCS0, MOSI, MISO and
SPCK pins must be configured in open drain (through the PIO controller). When a mode fault is detected, the
SPI_SR.MODF bit is set until SPI_SR is read and the SPI is automatically disabled until it is re-enabled by writing
a 1 to the SPI_CR.SPIEN bit.
By default, the mode fault detection is enabled. The user can disable it by setting the SPI_MR.MODFDIS bit.
39.7.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 until NSS goes active before receiving the serial clock from an external master. When NSS falls, the
clock is validated and the data is loaded in the SPI_RDR depending on the BITS field configured in the SPI_CSR0.
These bits are processed following a phase and a polarity defined respectively by the NCPHA and CPOL bits in
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 the BITS field, see also the note below the SPI_CSRx register bitmap (Section 39.8.9 SPI
Chip Select Register).
When all bits are processed, the received data is transferred in the SPI_RDR and the RDRF bit rises. If the
SPI_RDR has not been read before new data is received, the Overrun Error Status (OVRES) bit in the SPI_SR is
set. As long as this flag is set, data is loaded in the SPI_RDR. The user must read SPI_SR 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 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 register resets to 0.
When a first data is written in the SPI_TDR, it is transferred immediately in the Shift register and the TDRE flag
rises. If new data is written, it remains in the 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 the SPI_TDR is transferred in the Shift
register and the TDRE flag rises. This enables frequent updates of critical variables with single transfers.
Then, new data is loaded in the Shift register from the SPI_TDR. If no character is ready to be transmitted, i.e., no
character has been written in the SPI_TDR since the last load from the SPI_TDR to the Shift register, the
SPI_TDR is retransmitted. In this case the Underrun Error Status Flag (UNDES) is set in the SPI_SR.
Figure 39-11 shows a block diagram of the SPI when operating in Slave mode.
Figure 39-11. Slave Mode Functional Block Diagram
SPCK
NSS
SPI
Clock
SPIEN
SPIENS
SPIDIS
SPI_CSR0
BITS
NCPHA
CPOL
MOSI
LSB
SPI_RDR
RDRF
OVRES
RD
MSB
Shift Register
MISO
SPI_TDR
TD
TDRE
1161
1162
39.8
Table 39-5.
Register Mapping
Offset
Register
Name
Access
Reset
0x00
Control Register
SPI_CR
Write-only
0x04
Mode Register
SPI_MR
Read/Write
0x0
0x08
SPI_RDR
Read-only
0x0
0x0C
SPI_TDR
Write-only
0x10
Status Register
SPI_SR
Read-only
0x0
0x14
SPI_IER
Write-only
0x18
SPI_IDR
Write-only
0x1C
SPI_IMR
Read-only
0x0
Reserved
0x30
SPI_CSR0
Read/Write
0x0
0x34
SPI_CSR1
Read/Write
0x0
0x38
SPI_CSR2
Read/Write
0x0
0x3C
SPI_CSR3
Read/Write
0x0
Reserved
0xE4
SPI_WPMR
Read/Write
0x0
0xE8
SPI_WPSR
Read-only
0x0
0xEC0xF8
Reserved
0xFC
Reserved
0x200x2C
0x400xE0
1163
SPI_CR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
LASTXFER
23
22
21
20
19
18
17
16
15
14
13
12
11
10
SWRST
SPIDIS
SPIEN
1164
SPI_MR
Address:
Access:
Read/Write
31
30
29
28
27
26
19
18
25
24
17
16
DLYBCS
23
22
21
20
15
14
13
12
11
10
PCS
LLB
WDRBT
MODFDIS
PCSDEC
PS
MSTR
This register can only be written if the WPEN bit is cleared in the SPI Write Protection Mode Register.
MSTR: Master/Slave Mode
0: SPI is in Slave mode
1: SPI is in Master mode
PS: Peripheral Select
0: Fixed Peripheral Select
1: Variable Peripheral Select
PCSDEC: Chip Select Decode
0: The chip selects are directly connected to a peripheral device.
1: The four NPCS chip select lines are connected to a 4-bit to 16-bit decoder.
When PCSDEC = 1, up to 15 Chip Select signals can be generated with the four NPCS lines using an external 4-bit to 16bit decoder. The Chip Select registers define the characteristics of the 15 chip selects, with the following rules:
SPI_CSR0 defines peripheral chip select signals 0 to 3.
SPI_CSR1 defines peripheral chip select signals 4 to 7.
SPI_CSR2 defines peripheral chip select signals 8 to 11.
SPI_CSR3 defines peripheral chip select signals 12 to 14.
MODFDIS: Mode Fault Detection
0: Mode fault detection enabled
1: Mode fault detection disabled
WDRBT: Wait Data Read Before Transfer
0: No Effect. In Master mode, a transfer can be initiated regardless of the SPI_RDR state.
1: In Master mode, a transfer can start only if the SPI_RDR is empty, i.e., does not contain any unread data. This mode
prevents overrun error in reception.
1165
NPCS[3:0] = 1110
PCS = xx01
NPCS[3:0] = 1101
PCS = x011
NPCS[3:0] = 1011
PCS = 0111
NPCS[3:0] = 0111
PCS = 1111
(x = dont care)
If SPI_MR.PCSDEC = 1:
NPCS[3:0] output signals = PCS.
DLYBCS: Delay Between Chip Selects
This field defines the delay between the inactivation and the activation of NPCS. The DLYBCS time guarantees non-overlapping chip selects and solves bus contentions in case of peripherals having long data float times.
If DLYBCS is lower than 6, six peripheral clock periods are inserted by default.
Otherwise, the following equation determines the delay:
DLYBCS
Delay Between Chip Selects = --------------------------------f peripheral clock
1166
SPI_RDR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
PCS
11
10
RD
7
RD
1167
SPI_TDR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
LASTXFER
23
22
21
20
19
18
17
16
15
14
13
12
PCS
11
10
TD
7
TD
NPCS[3:0] = 1110
PCS = xx01
NPCS[3:0] = 1101
PCS = x011
NPCS[3:0] = 1011
PCS = 0111
NPCS[3:0] = 0111
PCS = 1111
(x = dont care)
If SPI_MR.PCSDEC = 1:
NPCS[3:0] output signals = PCS.
LASTXFER: Last Transfer
0: No effect
1: The current NPCS is de-asserted after the transfer of the character written in TD. When SPI_CSRx.CSAAT is set, the
communication with the current serial peripheral can be closed by raising the corresponding NPCS line as soon as TD
transfer is completed.
This field is only used if variable peripheral select is active (SPI_MR.PS = 1).
1168
SPI_SR
Address:
Access:
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
UNDES
TXEMPTY
NSSR
OVRES
MODF
TDRE
RDRF
1169
1170
SPI_IER
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
UNDES
TXEMPTY
NSSR
OVRES
MODF
TDRE
RDRF
The following configuration values are valid for all listed bit names of this register:
0: No effect.
1: Enables the corresponding interrupt.
RDRF: Receive Data Register Full Interrupt Enable
TDRE: SPI Transmit Data Register Empty Interrupt Enable
MODF: Mode Fault Error Interrupt Enable
OVRES: Overrun Error Interrupt Enable
NSSR: NSS Rising Interrupt Enable
TXEMPTY: Transmission Registers Empty Enable
UNDES: Underrun Error Interrupt Enable
1171
SPI_IDR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
UNDES
TXEMPTY
NSSR
OVRES
MODF
TDRE
RDRF
The following configuration values are valid for all listed bit names of this register:
0: No effect.
1: Disables the corresponding interrupt.
RDRF: Receive Data Register Full Interrupt Disable
TDRE: SPI Transmit Data Register Empty Interrupt Disable
MODF: Mode Fault Error Interrupt Disable
OVRES: Overrun Error Interrupt Disable
NSSR: NSS Rising Interrupt Disable
TXEMPTY: Transmission Registers Empty Disable
UNDES: Underrun Error Interrupt Disable
1172
SPI_IMR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
UNDES
TXEMPTY
NSSR
OVRES
MODF
TDRE
RDRF
The following configuration values are valid for all listed bit names of this register:
0: The corresponding interrupt is not enabled.
1: The corresponding interrupt is enabled.
RDRF: Receive Data Register Full Interrupt Mask
TDRE: SPI Transmit Data Register Empty Interrupt Mask
MODF: Mode Fault Error Interrupt Mask
OVRES: Overrun Error Interrupt Mask
NSSR: NSS Rising Interrupt Mask
TXEMPTY: Transmission Registers Empty Mask
UNDES: Underrun Error Interrupt Mask
1173
SPI_CSRx[x=0..3]
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
DLYBCT
23
22
21
20
DLYBS
15
14
13
12
SCBR
7
BITS
CSAAT
CSNAAT
NCPHA
CPOL
This register can only be written if the WPEN bit is cleared in the SPI Write Protection Mode Register.
Note: SPI_CSRx registers must be written even if the user wants to use the default reset values. The BITS field is not updated with the
translated value unless the register is written.
1174
The BITS field determines the number of data bits transferred. Reserved values should not be used.
Value
Name
Description
8_BIT
9_BIT
10_BIT
11_BIT
12_BIT
13_BIT
14_BIT
15_BIT
16_BIT
Reserved
10
Reserved
11
Reserved
12
Reserved
13
Reserved
14
Reserved
15
Reserved
1175
1176
SPI_WPMR
Address:
Access:
Read/Write.
31
30
29
28
27
26
25
24
19
18
17
16
11
10
WPKEY
23
22
21
20
WPKEY
15
14
13
12
WPKEY
7
WPEN
Name
PASSWD
Description
Writing any other value in this field aborts the write operation of the WPEN bit.
Always reads as 0.
1177
SPI_WPSR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
WPVSRC
7
WPVS
1178
40.
40.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 IC compatible device such as a Real Time
Clock (RTC), Dot Matrix/Graphic LCD Controllers and temperature sensor. The TWI is programmable as a master
or a slave with sequential or single-byte access. Multiple master capability is supported.
Arbitration 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.
Table 40-1 lists the compatibility level of the Atmel Two-wire Interface in master mode and a full I2C compatible
device.
Atmel TWI Compatibility with I2C Standard
Table 40-1.
I2C Standard
Atmel TWI
Supported
Supported
Supported
START byte
Not Supported
Supported
Supported
Not Supported
Clock Stretching/Synchronization
Supported
Supported
Note:
40.2
1.
Embedded Characteristics
Compatible with Atmel Two-wire Interface Serial Memory and IC Compatible Devices(1)
Note:
1.
1179
40.3
List of Abbreviations
Table 40-2.
40.4
Abbreviations
Abbreviation
Description
TWI
Two-wire Interface
Acknowledge
NA
Non Acknowledge
Stop
Start
Sr
Repeated Start
SADR
Slave Address
ADR
Read
Write
Block Diagram
Figure 40-1.
Block Diagram
Bus clock
Peripheral Bridge
TWCK
PIO
PMC
Peripheral
clock
TWD
Two-wire
Interface
TWI
Interrupt
1180
Interrupt
Controller
40.5
Host with
TWI
Interface
Rp
TWD
TWCK
Atmel TWI
Serial EEPROM
Slave 1
IC RTC
IC LCD
Controller
IC Temp.
Sensor
Slave 2
Slave 3
Slave 4
Table 40-3.
40.6
Pin Name
Pin Description
Type
TWD
Input/Output
TWCK
Input/Output
Product Dependencies
I/O Lines
Instance
Signal
I/O Line
Peripheral
TWI0
TWCK0
PA31
TWI0
TWD0
PA30
TWI1
TWCK1
PE30
TWI1
TWD1
PE29
TWI2
TWCK2
PB30
TWI2
TWD2
PB29
TWI3
TWCK3
PC26
TWI3
TWD3
PC25
1181
40.7
Peripheral IDs
Instance
ID
TWI0
32
TWI1
33
TWI2
34
TWI3
62
Functional Description
A high-to-low transition on the TWD line while TWCK is high defines the START condition.
A low-to-high transition on the TWD line while TWCK is high defines the STOP condition.
Figure 40-3.
TWD
TWCK
Start
Figure 40-4.
Stop
Transfer Format
TWD
TWCK
Start
1182
Address
R/W
Ack
Data
Ack
Data
Ack
Stop
The master is the device that starts a transfer, generates a clock and stops it.
40.7.3.2 Application Block Diagram
Figure 40-5.
Host with
TWI
Interface
Rp
TWD
TWCK
Atmel TWI
Serial EEPROM
Slave 1
IC RTC
IC LCD
Controller
IC Temp.
Sensor
Slave 2
Slave 3
Slave 4
4.
Note:
If the TWI is already in master mode, the device address (DADR) can be configured without disabling the master
mode.
After the master initiates a START condition when writing into the Transmit Holding register (TWI_THR), it sends a
7-bit slave address, configured in the Master Mode register (DADR in TWI_MMR), to notify the slave device. The
bit following the slave address indicates the transfer direction0 in this case (MREAD = 0 in TWI_MMR).
The TWI transfers require the slave to acknowledge each received byte. During the acknowledge clock pulse (9th
pulse), the master releases the data line (HIGH), enabling the slave to pull it down in order to generate the
acknowledge. The master polls the data line during this clock pulse and sets the Not Acknowledge bit (NACK) in
SAMA5D4 Series [DATASHEET]
Atmel-11238A-ATARM-SAMA5D4-Datasheet_30-Sep-14
1183
the Status Register (TWI_SR) if the slave does not acknowledge the byte. As with the other status bits, an interrupt
can be generated if enabled in the Interrupt Enable register (TWI_IER). If the slave acknowledges the byte, the
data written in the TWI_THR is then shifted in the internal shifter and transferred. When an acknowledge is
detected, the TXRDY bit is set until a new write in the TWI_THR.
When no more data is written into the TWI_THR, the master generates a STOP condition to end the transfer. A
TXCOMP bit value of one in the TWI_SR indicates that the transfer has completed. See Figure 40-6, Figure 40-7,
and Figure 40-8.
Figure 40-6.
DADR
DATA
TXCOMP
TXRDY
STOP sent automaticaly
(ACK received and TXRDY = 1)
Figure 40-7.
TWD
DADR
DATA n
DATA n+5
DATA n+x
TXCOMP
TXRDY
Write THR (Data n)
Figure 40-8.
TWD S
Master Write with One Byte Internal Address and Multiple Data Bytes
DADR
IADR(7:0)
DATA n
DATA n+5
DATA n+x
TXCOMP
TXRDY
Write THR (Data n)
The read sequence begins by setting the START bit. After the START condition has been sent, the master sends
a 7-bit slave address to notify the slave device. The bit following the slave address indicates the transfer
direction1 in this case (MREAD = 1 in TWI_MMR). During the acknowledge clock pulse (9th pulse), the master
1184
releases the data line (HIGH), enabling the slave to pull it down in order to generate the acknowledge. The master
polls the data line during this clock pulse and sets the NACK bit in the TWI_SR if the slave does not acknowledge
the byte.
If an acknowledge is received, the master is then ready to receive data from the slave. After data has been
received, the master sends an acknowledge condition to notify the slave that the data has been received except
for the last data. See . When the RXRDY bit is set in the TWI_SR, a character has been received in the Receive
Holding Register (TWI_RHR). The RXRDY bit is reset when reading the TWI_RHR.
When a single data byte read is performed, with or without internal address (IADR), the START and STOP bits
must be set at the same time. See . When a multiple data byte read is performed, with or without internal address
(IADR), the STOP bit must be set after the next-to-last data received. See . For internal address usage, see
Section 40.7.3.6.
If the Receive Holding Register (TWI_RHR) is full (RXRDY high) and the master is receiving data, the serial clock
line will be tied low before receiving the last bit of the data and until the TWI_RHR is read. Once the TWI_RHR is
read, the master will stop stretching the serial clock line and end the data reception. See Figure 40-11.
Warning: When receiving multiple bytes in master read mode, if the next-to-last access is not read (the RXRDY
flag remains high), the last access will not be completed until TWI_RHR is read. The last access stops on the nextto-last bit. When the TWI_RHR is read there is only half a bit period to send the STOP bit command, else another
read access might occur (spurious access).
A possible workaround is to set the STOP bit before reading the TWI_RHR on the next-to-last access (within IT
handler).
Figure 40-9.
DADR
DATA
NA
TXCOMP
RXRDY
DADR
DATA n
DATA (n+1)
DATA (n+m)-1
DATA (n+m)
NA
TXCOMP
Write START Bit
RXRDY
Read RHR
DATA n
Read RHR
DATA (n+1)
Read RHR
DATA (n+m)-1
Read RHR
DATA (n+m)
1185
Figure 40-11. Master Read Wait State with Multiple Data Bytes
STOP command performed
(by writing in the TWI_CR)
Clock Wait State
TWD
DADR
DATA n
DATA n+1
DATA n+2
TWCK
TXCOMP
RXRDY
The TWI interface can perform transfers with 7-bit slave address devices and 10-bit slave address devices.
7-bit Slave Addressing
When addressing 7-bit slave devices, the internal address bytes are used to perform random address (read or
write) accesses to reach one or more data bytes, e.g. within a memory page location in a serial memory. When
performing read operations with an internal address, the TWI performs a write operation to set the internal address
into the slave device, and then switch to master receiver mode. Note that the second START condition (after
sending the IADR) is sometimes called repeated start (Sr) in I2C fully-compatible devices. See Figure 40-13. See
Figure 40-12 and Figure 40-14 for master write operation with internal address.
The three internal address bytes are configurable through the Master Mode register (TWI_MMR).
If the slave device supports only a 7-bit address, i.e., no internal address, IADRSZ must be set to 0.
Table 40-6 shows the abbreviations used in Figure 40-12 and Figure 40-13.
Table 40-6.
1186
Abbreviations
Abbreviation
Definition
Start
Sr
Repeated Start
Stop
Write
Read
Acknowledge
NA
Not Acknowledge
DADR
Device Address
IADR
Internal Address
Figure 40-12. Master Write with One, Two or Three Bytes Internal Address and One Data Byte
Three bytes internal address
TWD
DADR
IADR(23:16)
IADR(15:8)
IADR(7:0)
IADR(15:8)
IADR(7:0)
DATA
IADR(7:0)
DATA
DATA
DADR
DADR
Figure 40-13. Master Read with One, Two or Three Bytes Internal Address and One Data Byte
Three bytes internal address
TWD
DADR
IADR(23:16)
IADR(15:8)
IADR(7:0)
Sr
DADR
DATA
NA
DADR
IADR(15:8)
IADR(7:0)
Sr
IADR(7:0)
Sr
DADR
DATA
NA
DADR
DADR
DATA
NA
For a slave address higher than seven bits, the user must configure the address size (IADRSZ) and set the other
slave address bits in the Internal Address register (TWI_IADR). The two remaining internal address bytes,
IADR[15:8] and IADR[23:16] can be used the same way as in 7-bit slave addressing.
Example: Address a 10-bit device (10-bit device address is b1 b2 b3 b4 b5 b6 b7 b8 b9 b10)
1. Program IADRSZ = 1,
2. Program DADR with 1 1 1 1 0 b1 b2 (b1 is the MSB of the 10-bit address, b2, etc.)
3.
Program TWI_IADR with b3 b4 b5 b6 b7 b8 b9 b10 (b10 is the LSB of the 10-bit address)
Figure 40-14 below shows a byte write to an Atmel AT24LC512 EEPROM. This demonstrates the use of internal
addresses to access the device.
Figure 40-14.
Device
Address
W
R
I
T
E
FIRST
WORD ADDRESS
SECOND
WORD ADDRESS
S
T
O
P
DATA
0
M
S
B
LR A
S / C
BW K
M
S
B
A
C
K
LA
SC
BK
A
C
K
1187
2.
3.
4.
5.
6.
7.
8.
9.
(Optional) Wait for the TXCOMP flag in TWI_SR before disabling the peripheral clock if required.
The DMA transfer size must be defined with the buffer size minus 2. The two remaining characters must be
managed without DMA to ensure that the exact number of bytes are received whatever the system bus latency
conditions encountered during the end of buffer transfer period.
In slave mode, the number of characters to receive must be known in order to configure the DMA.
1. Initialize the DMA (channels, memory pointers, size -2, etc.);
2. Configure the master mode (DADR, CKDIV, etc.) or slave mode.
3.
4.
(Master Only) Write the START bit in the TWI_CR to start the transfer.
5.
6.
7.
8.
9.
The following flowcharts shown in Figure 40-16 on page 1190, Figure 40-17 on page 1191, Figure 40-18 on page
1192, Figure 40-19 on page 1193 and Figure 40-20 on page 1194 give examples for read and write operations. A
polling or interrupt method can be used to check the status bits. The interrupt method requires that the Interrupt
Enable Register (TWI_IER) be configured first.
1188
Figure 40-15. TWI Write Operation with Single Data Byte without Internal Address
BEGIN
TXRDY = 1?
No
Yes
Read Status register
No
TXCOMP = 1?
Yes
Transfer finished
1189
Figure 40-16. TWI Write Operation with Single Data Byte and Internal Address
BEGIN
No
TXRDY = 1?
Yes
Read Status register
TXCOMP = 1?
Yes
Transfer finished
1190
No
Figure 40-17. TWI Write Operation with Multiple Data Bytes with or without Internal Address
BEGIN
No
Internal address size = 0?
Set the internal address
TWI_IADR = address
Yes
No
TXRDY = 1?
Yes
Data to send?
Yes
No
No
TXCOMP = 1?
Yes
END
1191
Figure 40-18. TWI Read Operation with Single Data Byte without Internal Address
BEGIN
RXRDY = 1?
No
Yes
Read Receive Holding Register
TXCOMP = 1?
Yes
END
1192
No
Figure 40-19. TWI Read Operation with Single Data Byte and Internal Address
BEGIN
RXRDY = 1?
No
Yes
Read Receive Holding register
TXCOMP = 1?
No
Yes
END
1193
Figure 40-20. TWI Read Operation with Multiple Data Bytes with or without Internal Address
BEGIN
No
Internal address size = 0?
Set the internal address
TWI_IADR = address
Yes
Start the transfer
TWI_CR = START
RXRDY = 1?
No
Yes
Read Receive Holding register (TWI_RHR)
No
RXRDY = 1?
No
Yes
Read Receive Holding register (TWI_RHR)
TXCOMP = 1?
Yes
END
1194
No
In multi-master mode, 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 that has lost arbitration may put its data on the bus by respecting arbitration.
Arbitration is illustrated in Figure 40-22 on page 1196.
40.7.4.2 Different Multi-master Modes
In this mode, TWI is considered as a Master only (MSEN is always at one) and must be driven like a Master with
the ARBLST (Arbitration Lost) flag in addition.
If arbitration is lost (ARBLST = 1), the user must reinitiate the data transfer.
If the user starts a transfer (ex.: DADR + START + W + Write in THR) and if the bus is busy, the TWI automatically
waits for a STOP condition on the bus to initiate the transfer (see Figure 40-21 on page 1196).
Note:
The state of the bus (busy or free) is not indicated in the user interface.
The automatic reversal from Master to Slave is not supported in case of a lost arbitration.
Then, in the case where TWI may be either a Master or a Slave, the user must manage the pseudo multi-master
mode described in the steps below.
1. Program TWI in slave mode (SADR + MSDIS + SVEN) and perform a slave access (if TWI is addressed).
2. If the TWI has to be set in master mode, wait until TXCOMP flag is at 1.
3.
Program the master mode (DADR + SVDIS + MSEN) and start the transfer (ex: START + Write in THR).
4.
As soon as the master mode is enabled, the TWI scans the bus in order to detect if it is busy or free. When
the bus is considered free, TWI initiates the transfer.
5.
As soon as the transfer is initiated and until a STOP condition is sent, the arbitration becomes relevant and
the user must monitor the ARBLST flag.
6.
If the arbitration is lost (ARBLST is set to 1), the user must program the TWI in slave mode in case the
Master that won the arbitration wants to access the TWI.
7.
If the TWI has to be set in slave mode, wait until TXCOMP flag is at 1 and then program the slave mode.
Note:
If the arbitration is lost and the TWI is addressed, the TWI will not acknowledge even if it is programmed in slave mode
as soon as ARBLST is set to 1. Then the Master must repeat SADR.
1195
TWCK
START sent by the TWI
TWD
Bus is busy
Bus is free
Transfer is kept
A transfer is programmed
(DADR + W + START + Write THR)
TWCK
TWD
TWCK
Data from a Master
0 0 1 1
TWD
0 0
Arbitration is lost
TWI stops sending data
1 1
Arbitration is lost
0 1
0 1
ARBLST
Bus is busy
Transfer is kept
Bus is free
Transfer is stopped
Transfer is programmed again
(DADR + W + START + Write THR)
The flowchart shown in Figure 40-23 on page 1197 gives an example of read and write operations in multi-master
mode.
1196
SVACC = 1 ?
Yes
GACC = 1 ?
No
No
No
No
SVREAD = 1 ?
EOSACC = 1 ?
TXRDY= 1 ?
Yes
Yes
Yes
No
TXCOMP = 1 ?
Write in TWI_THR
No
RXRDY= 1 ?
Yes
No
No
Yes
Read TWI_RHR
Need to perform
a master access ?
Prog seq
OK ?
Change SADR
Program the Master mode
DADR + SVDIS + MSEN + CLK + R / W
Yes
No
ARBLST = 1 ?
Yes
Yes
MREAD = 1 ?
RXRDY= 0 ?
No
TXRDY= 0 ?
No
Read TWI_RHR
Yes
Yes
No
Data to read?
Data to send ?
No
Yes
Write in TWI_THR
No
Stop transfer
TXCOMP = 0 ?
No
1197
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).
40.7.5.2 Application Block Diagram
Figure 40-24. Slave Mode Typical Application Block Diagram
VDD
R
Master
Host with
TWI
Interface
TWD
TWCK
LCD Controller
Slave 1
Slave 2
Slave 3
As the device receives the clock, values written in TWI_CWGR are ignored.
40.7.5.4 Receiving Data
After a START or REPEATED START condition is detected and if the address sent by the Master matches with the
Slave address programmed in the SADR (Slave Address) field, SVACC (Slave Access) flag is set and SVREAD
(Slave Read) indicates the direction of the transfer.
SVACC remains high until a STOP condition or a repeated START is detected. When such a condition is detected,
the EOSACC (End Of Slave Access) flag is set.
Read Sequence
In the case of a read sequence (SVREAD is high), TWI transfers data written in the TWI_THR (TWI Transmit
Holding Register) until a STOP condition or a REPEATED_START + an address different from SADR is detected.
Note that at the end of the read sequence TXCOMP (Transmission Complete) flag is set and SVACC reset.
As soon as data is written in the TWI_THR, the TXRDY (Transmit Holding Register Ready) flag is reset, and it is
set when the internal shifter is empty and the sent data acknowledged or not. If the data is not acknowledged, the
NACK flag is set.
Note that a STOP or a REPEATED START always follows a NACK.
See Figure 40-25 on page 1199.
1198
Write Sequence
In the case of a write sequence (SVREAD is low), the RXRDY (Receive Holding Register Ready) flag is set as
soon as a character has been received in the TWI_RHR (TWI Receive Holding Register). RXRDY is reset when
reading the TWI_RHR.
TWI continues receiving data until a STOP condition or a REPEATED_START + an address different from SADR
is detected. Note that at the end of the write sequence TXCOMP flag is set and SVACC reset.
See Figure 40-26 on page 1200.
Clock Synchronization Sequence
In the case where a GENERAL CALL is performed, the GACC (General Call Access) flag is set.
After GACC is set, the user must interpret the meaning of the GENERAL CALL and decode the new address
programming sequence.
See Figure 40-27 on page 1200.
40.7.5.5 Data Transfer
Read Operation
TWD
ADR
NA
DATA
NA
P/S/Sr
SADR R
DATA
DATA
NA
S/Sr
TXRDY
NACK
Write THR
Read RHR
SVACC
SVREAD
EOSVACC
1199
Notes:
Write Operation
TWD
ADR
NA
DATA
NA
SADR matches,
TWI answers with an ACK
P/S/Sr
SADR W
DATA
Read RHR
DATA NA
S/Sr
RXRDY
SVACC
SVREAD
EOSVACC
Notes:
General Call
The general call is performed in order to change the address of the slave.
If a GENERAL CALL is detected, GACC is set.
After the detection of GENERAL CALL, it is up to the programmer to decode the commands which come
afterwards.
In case of a WRITE command, the programmer has to decode the programming sequence and program a new
SADR if the programming sequence matches.
Figure 40-27 describes the GENERAL CALL access.
Figure 40-27. Master Performs a General Call
0000000 + W
TXD
GENERAL CALL
DATA1
DATA2
New SADR
New SADR
Programming sequence
GCACC
Note:
1200
This method allows the user to create a personal programming sequence by choosing the programming bytes and the
number of them. The programming sequence has to be provided to the master.
Clock Synchronization/Stretching
In both read and write modes, it may occur that TWI_THR/TWI_RHR buffer is not filled /emptied before the
emission/reception of a new character. In this case, to avoid sending/receiving undesired data, clock
stretching/synchronization mechanism is implemented.
Clock Stretching in Read Mode
The clock is tied low during the acknowledge phase if the internal shifter is empty and if a STOP or
REPEATED START condition was not detected. It is tied low until the internal shifter is loaded.
Figure 40-28 describes the clock stretching in read mode.
Figure 40-28. Clock Stretching in Read Mode
TWI_THR
SADR
DATA1
DATA0
DATA0
DATA1
DATA2
XXXXXXX
DATA2
NA
TWCK
Write THR
SCLWS
TXRDY
SVACC
SVREAD
As soon as a START is detected
TXCOMP
Notes:
The clock is stretched after the ACK, the state of TWD is undefined during clock stretching
1. TXRDY is reset when data has been written in the TWI_THR to the internal shifter and set when this data has been
acknowledged 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 stretching mechanism is started.
1201
The clock is tied low outside of the acknowledge phase if the internal shifter and the TWI_RHR is full. If a
STOP or REPEATED_START condition was not detected, it is tied low until TWI_RHR is read.
Figure 40-29 describes the clock synchronization in write mode.
Figure 40-29. Clock Synchronization in Write Mode
TWCK
CLOCK is tied low by the TWI as long as RHR is full
TWD
SADR
DATA0
TWI_RHR
DATA1
DATA2
DATA1
NA
ADR
DATA2
SCLWS
SCL is stretched on the last bit of DATA1
RXRDY
Rd DATA0
Rd DATA1
Rd DATA2
SVACC
SVREAD
TXCOMP
Notes:
1202
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
mechanism is finished.
The master initiates the communication by a read command and finishes it by a write command.
Figure 40-30 describes the repeated start + reversal from read to write mode.
Figure 40-30. Repeated Start + Reversal from Read to Write Mode
TWI_THR
TWD
DATA0
S
SADR
DATA0
DATA1
A
DATA1
NA
Sr
SADR
DATA2
TWI_RHR
DATA3
DATA2
DATA3
SVACC
SVREAD
TXRDY
RXRDY
EOSACC
TXCOMP
Note:
1. TXCOMP is only set at the end of the transmission because after the repeated start, SADR is detected again.
1203
The master initiates the communication by a write command and finishes it by a read command.
Figure 40-31 describes the repeated start + reversal from write to read mode.
Figure 40-31. Repeated Start + Reversal from Write to Read Mode
DATA2
TWI_THR
S
TWD
SADR
DATA0
TWI_RHR
DATA1
DATA0
Sr
SADR
DATA3
DATA2
DATA3
NA
DATA1
SVACC
SVREAD
TXRDY
RXRDY
Read TWI_RHR
EOSACC
TXCOMP
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.
2.
3.
4.
5.
6.
(Optional) Wait for the TXCOMP flag in TWI_SR before disabling the peripheral clock if required.
The DMA transfer size must be defined with the buffer size. In slave mode, the number of characters to receive
must be known in order to configure the DMA.
1. Initialize the DMA (channels, memory pointers, size, etc.).
2. Configure the slave mode.
1204
3.
4.
5.
6.
(Optional) Wait for the TXCOMP flag in TWI_SR before disabling the peripheral clock if required.
The flowchart shown in Figure 40-32 gives an example of read and write operations in slave mode. A polling or
interrupt method can be used to check the status bits. The interrupt method requires that the Interrupt Enable
Register (TWI_IER) be configured first.
Figure 40-32. Read Write Flowchart in Slave Mode
SVACC = 1 ?
No
No
EOSACC = 1 ?
GACC = 1 ?
No
SVREAD = 0 ?
TXRDY= 1 ?
No
No
Write in TWI_THR
No
TXCOMP = 1 ?
No
RXRDY= 0 ?
END
Read TWI_RHR
Decoding of the
programming sequence
No
Prog seq
OK ?
Change SADR
1205
1206
40.8
Table 40-7.
Register Mapping
Offset
Register
Name
Access
Reset
0x00
Control Register
TWI_CR
Write-only
0x04
TWI_MMR
Read/Write
0x00000000
0x08
TWI_SMR
Read/Write
0x00000000
0x0C
TWI_IADR
Read/Write
0x00000000
0x10
TWI_CWGR
Read/Write
0x00000000
0x140x1C
Reserved
0x20
Status Register
TWI_SR
Read-only
0x0000F009
0x24
TWI_IER
Write-only
0x28
TWI_IDR
Write-only
0x2C
TWI_IMR
Read-only
0x00000000
0x30
TWI_RHR
Read-only
0x00000000
0x34
TWI_THR
Write-only
0x380xE0
Reserved
0xE4
TWI_WPMR
Read/Write
0x00000000
0xE8
TWI_WPSR
Read-only
0x00000000
0xEC0xFC
Reserved
1207
TWI_CR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
7
SWRST
5
SVDIS
4
SVEN
3
MSDIS
2
MSEN
1
STOP
0
START
1208
1209
TWI_MMR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
DADR
18
17
16
15
14
13
12
MREAD
11
10
8
IADRSZ
0
Name
Description
NONE
1_BYTE
2_BYTE
3_BYTE
1210
TWI_SMR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
SADR
18
17
16
15
14
13
12
11
10
This register can only be written if the WPEN bit is cleared in the TWI Write Protection Mode Register.
SADR: Slave Address
The slave device address is used in slave mode in order to be accessed by master devices in read or write mode.
SADR must be programmed before enabling the slave mode or after a general call. Writes at other times have no effect.
1211
TWI_IADR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
11
10
IADR
15
14
13
12
IADR
4
IADR
1212
TWI_CWGR
Address:
Access:
Read/Write
31
30
29
28
27
26
HOLD
25
24
23
22
21
20
19
18
17
CKDIV
16
15
14
13
12
11
10
CHDIV
7
4
CLDIV
This register can only be written if the WPEN bit is cleared in the TWI Write Protection Mode Register.
TWI_CWGR is only used in master mode.
CLDIV: Clock Low Divider
The SCL low period is defined as follows: tlow = ((CLDIV 2CKDIV) + 4 tperipheral clock
CHDIV: Clock High Divider
The SCL high period is defined as follows: thigh = ((CHDIV 2CKDIV) + 4 tperipheral clock
CKDIV: Clock Divider
The CKDIV is used to increase both SCL high and low periods.
HOLD: TWD Hold Time versus TWCK falling
TWD is kept unchanged after TWCK falling edge for a period of (HOLD + 3) tperipheral clock.
1213
TWI_SR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
EOSACC
10
SCLWS
9
ARBLST
8
NACK
6
OVRE
5
GACC
4
SVACC
3
SVREAD
2
TXRDY
1
RXRDY
0
TXCOMP
If TXRDY is high and if a NACK has been detected, the transmission will be stopped. Thus when TRDY = NACK = 1, the
programmer must not fill TWI_THR to avoid losing it.
TXRDY behavior in slave mode can be seen in Figure 40-25 on page 1199, Figure 40-28 on page 1201, Figure 40-30 on
page 1203 and Figure 40-31 on page 1204.
SVREAD: Slave Read (automatically set / reset)
This bit is only used in slave mode. When SVACC is low (no Slave access has been detected) SVREAD is irrelevant.
0: Indicates that a write access is performed by a Master.
1: Indicates that a read access is performed by a Master.
SVREAD behavior can be seen in Figure 40-25 on page 1199, Figure 40-26 on page 1200, Figure 40-30 on page 1203
and Figure 40-31 on page 1204.
SVACC: Slave Access (automatically set / reset)
This bit is only used in slave mode.
0: TWI is not addressed. SVACC is automatically cleared after a NACK or a STOP condition is detected.
1: Indicates that the address decoding sequence has matched (A Master has sent SADR). SVACC remains high until a
NACK or a STOP condition is detected.
SVACC behavior can be seen in Figure 40-25 on page 1199, Figure 40-26 on page 1200, Figure 40-30 on page 1203 and
Figure 40-31 on page 1204.
GACC: General Call Access (clear on read)
This bit is only used in slave mode.
0: No General Call has been detected.
1: A General Call has been detected. After the detection of General Call, if need be, the programmer may acknowledge
this access and decode the following bytes and respond according to the value of the bytes.
GACC behavior can be seen in Figure 40-27 on page 1200.
OVRE: Overrun Error (clear on read)
This bit is only used in master mode.
0: TWI_RHR has not been loaded while RXRDY was set
1: TWI_RHR has been loaded while RXRDY was set. Reset by read in TWI_SR when TXCOMP is set.
NACK: Not Acknowledged (clear on read)
NACK used in master mode:
0: Each data byte has been correctly received by the far-end side TWI slave component.
1: A data byte or an address byte has not been acknowledged by the slave component. Set at the same time as TXCOMP.
NACK used in Slave Read mode:
0: Each data byte has been correctly received by the Master.
1: In read mode, a data byte has not been acknowledged by the Master. When NACK is set the programmer must not fill
TWI_THR even if TXRDY is set, because it means that the Master will stop the data transfer or re initiate it.
Note that in slave write mode all data are acknowledged by the TWI.
1215
1216
TWI_IER
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
EOSACC
10
SCL_WS
9
ARBLST
8
NACK
6
OVRE
5
GACC
4
SVACC
2
TXRDY
1
RXRDY
0
TXCOMP
The following configuration values are valid for all listed bit names of this register:
0: No effect.
1: Enables the corresponding interrupt.
TXCOMP: Transmission Completed Interrupt Enable
RXRDY: Receive Holding Register Ready Interrupt Enable
TXRDY: Transmit Holding Register Ready Interrupt Enable
SVACC: Slave Access Interrupt Enable
GACC: General Call Access Interrupt Enable
OVRE: Overrun Error Interrupt Enable
NACK: Not Acknowledge Interrupt Enable
ARBLST: Arbitration Lost Interrupt Enable
SCL_WS: Clock Wait State Interrupt Enable
EOSACC: End Of Slave Access Interrupt Enable
1217
TWI_IDR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
EOSACC
10
SCL_WS
9
ARBLST
8
NACK
6
OVRE
5
GACC
4
SVACC
2
TXRDY
1
RXRDY
0
TXCOMP
The following configuration values are valid for all listed bit names of this register:
0: No effect.
1: Disables the corresponding interrupt.
TXCOMP: Transmission Completed Interrupt Disable
RXRDY: Receive Holding Register Ready Interrupt Disable
TXRDY: Transmit Holding Register Ready Interrupt Disable
SVACC: Slave Access Interrupt Disable
GACC: General Call Access Interrupt Disable
OVRE: Overrun Error Interrupt Disable
NACK: Not Acknowledge Interrupt Disable
ARBLST: Arbitration Lost Interrupt Disable
SCL_WS: Clock Wait State Interrupt Disable
EOSACC: End Of Slave Access Interrupt Disable
1218
TWI_IMR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
EOSACC
10
SCL_WS
9
ARBLST
8
NACK
6
OVRE
5
GACC
4
SVACC
2
TXRDY
1
RXRDY
0
TXCOMP
The following configuration values are valid for all listed bit names of this register:
0: The corresponding interrupt is disabled.
1: The corresponding interrupt is enabled.
TXCOMP: Transmission Completed Interrupt Mask
RXRDY: Receive Holding Register Ready Interrupt Mask
TXRDY: Transmit Holding Register Ready Interrupt Mask
SVACC: Slave Access Interrupt Mask
GACC: General Call Access Interrupt Mask
OVRE: Overrun Error Interrupt Mask
NACK: Not Acknowledge Interrupt Mask
ARBLST: Arbitration Lost Interrupt Mask
SCL_WS: Clock Wait State Interrupt Mask
EOSACC: End Of Slave Access Interrupt Mask
1219
TWI_RHR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
RXDATA
1220
TWI_THR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TXDATA
1221
TWI_WPMR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
0
WPEN
WPKEY
23
22
21
20
WPKEY
15
14
13
12
WPKEY
1222
Name
PASSWD
Description
Writing any other value in this field aborts the write operation of the WPEN bit.
Always reads as 0
TWI_WPSR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
0
WPVS
WPVSRC
23
22
21
20
WPVSRC
15
14
13
12
WPVSRC
1223
41.
41.1
Description
The 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 programmed to start automatically or on different events
detected on the Frame Sync signal.
The SSC high-level of programmability and its use of DMA permit a continuous high bit rate data transfer without
processor intervention.
Featuring connection to the DMA, the SSC permits interfacing with low processor overhead to the following:
41.2
1224
Embedded Characteristics
Provides Serial Synchronous Communication Links Used in Audio and Telecom Applications
Receiver and Transmitter Can be Programmed to Start Automatically or on Detection of Different Events on
the Frame Sync Signal
Receiver and Transmitter Include a Data Signal, a Clock Signal and a Frame Synchronization Signal
41.3
Block Diagram
Figure 41-1.
Block Diagram
System
Bus
Peripheral Bridge
DMA
Bus Clock
Peripheral
Bus
TF
TK
PMC
TD
Peripheral Clock
PIO
SSC Interface
RF
RK
Interrupt Control
RD
SSC Interrupt
41.4
OS or RTOS Driver
Power
Management
Interrupt
Management
Test
Management
SSC
Serial AUDIO
Codec
Time Slot
Management
Frame
Management
Line Interface
1225
41.5
Figure 41-3.
I2S
RECEIVER
TF
Data SD
SSC
TD
RD
Clock SCK
RF
Word Select WS
RK
MSB
Data SD
LSB
Right Channel
Left Channel
Figure 41-4.
CODEC
TD
Serial Data In
RD
RF
RK
Serial Data In
1226
MSB
Dend
Figure 41-5.
CODEC
First
Time Slot
Data Out
TD
SSC
RD
Data In
RF
RK
CODEC
Second
Time Slot
Dstart
Dend
Serial Data in
41.6
Pin Name
Pin Description
Type
RF
Input/Output
RK
Receiver Clock
Input/Output
RD
Receiver Data
Input
TF
Input/Output
TK
Transmitter Clock
Input/Output
TD
Transmitter Data
Output
1227
41.7
Product Dependencies
I/O Lines
Instance
Signal
I/O Line
Peripheral
SSC0
RD0
PB29
SSC0
RF0
PB30
SSC0
RK0
PB26
SSC0
TD0
PA25
SSC0
TD0
PB28
SSC0
TF0
PB31
SSC0
TK0
PB27
SSC1
RD1
PC23
SSC1
RF1
PC22
SSC1
RK1
PC24
SSC1
TD1
PC21
SSC1
TF1
PC20
SSC1
TK1
PC19
1228
Peripheral IDs
Instance
ID
SSC0
48
SSC1
49
41.8
Functional Description
This chapter contains the functional description of the following: SSC Functional Block, Clock Management, Data
format, Start, Transmitter, Receiver and Frame Sync.
The receiver and transmitter operate separately. However, they can work synchronously by programming the
receiver to use the transmit clock and/or to start a data transfer when transmission starts. Alternatively, this can be
done by programming the transmitter to use the receive clock and/or to start a data transfer when reception starts.
The transmitter and the receiver can be programmed to operate with the clock signals provided on either the TK or
RK pins. This allows the SSC to support many slave-mode data transfers. The maximum clock speed allowed on
the TK and RK pins is the peripheral clock divided by 2.
Figure 41-6.
Peripheral
Clock
TK Input
Clock
Divider
Transmit Clock
Controller
RX clock
TXEN
RX Start Start
Selector
TF
TK
Frame Sync
Controller
TF
Data
Controller
TD
TX Start
Transmit Shift Register
Transmit Holding
Register
APB
TX clock
Clock Output
Controller
Transmit Sync
Holding Register
User
Interface
Receiver
RK Input
RK
Frame Sync
Controller
RF
Data
Controller
RD
TX Clock
RXEN
TX Start Start
RF
Selector
RC0R
Interrupt Control
Clock Output
Controller
RX Start
Receive Shift Register
Receive Holding
Register
Receive Sync
Holding Register
To Interrupt Controller
1229
Furthermore, the transmitter block can generate an external clock on the TK I/O pad, and the receiver block can
generate an external clock on the RK I/O pad.
This allows the SSC to support many Master and Slave Mode data transfers.
41.8.1.1 Clock Divider
Figure 41-7.
12-bit Counter
Divided Clock
The peripheral 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 peripheral 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 peripheral clock divided
by 2 times DIV. Each level of the Divided Clock has a duration of the peripheral clock multiplied by DIV. This
ensures a 50% duty cycle for the Divided Clock regardless of whether the DIV value is even or odd.
Figure 41-8.
Divided Clock
DIV = 1
Divided Clock Frequency = fperipheral clock/2
Peripheral Clock
Divided Clock
DIV = 3
1230
The transmitter clock is generated from the receiver clock or the divider clock or an external clock scanned on the
TK I/O pad. The transmitter clock is selected by the CKS field in the Transmit Clock Mode Register (SSC_TCMR).
Transmit Clock can be inverted independently by the CKI bits in the SSC_TCMR.
The transmitter can also drive the TK I/O pad continuously or be limited to the actual data transfer. The clock
output is configured by the SSC_TCMR. The Transmit Clock Inversion (CKI) bits have no effect on the clock
outputs. Programming the SSC_TCMR to select TK pin (CKS field) and at the same time Continuous Transmit
Clock (CKO field) can lead to unpredictable results.
Figure 41-9.
Tri_state
Controller
Receiver
Clock
Clock
Output
Divider
Clock
CKO
CKS
Data Transfer
INV
MUX
Tri_state
Controller
CKI
CKG
Transmitter
Clock
1231
The receiver clock is generated from the transmitter clock or the divider clock or an external clock scanned on the
RK I/O pad. The Receive Clock is selected by the CKS field in SSC_RCMR (Receive Clock Mode Register).
Receive Clocks can be inverted independently by the CKI bits in SSC_RCMR.
The receiver can also drive the RK I/O pad continuously or be limited to the actual data transfer. The clock output
is configured by the SSC_RCMR. The Receive Clock Inversion (CKI) bits have no effect on the clock outputs.
Programming the SSC_RCMR to select RK pin (CKS field) and at the same time Continuous Receive Clock (CKO
field) can lead to unpredictable results.
Figure 41-10. Receiver Clock Management
RK (pin)
MUX
Tri_state
Controller
Clock
Output
Transmitter
Clock
Divider
Clock
CKO
CKS
Data Transfer
INV
MUX
Tri_state
Controller
CKI
CKG
Receiver
Clock
The Transmitter and the Receiver can be programmed to operate with the clock signals provided on either the TK
or RK pins. This allows the SSC to support many slave-mode data transfers. In this case, the maximum clock
speed allowed on the RK pin is:
1232
When both the SSC_THR and the transmit shift register are empty, the status flag TXEMPTY is set in the
SSC_SR. When the Transmit Holding register is transferred in the transmit shift register, the status flag TXRDY is
set in the SSC_SR and additional data can be loaded in the holding register.
Figure 41-11. Transmitter Block Diagram
SSC_CRTXEN
SSC_SRTXEN
TXEN
SSC_CRTXDIS
SSC_RCMR.START SSC_TCMR.START
RXEN
TXEN
TX Start
RX Start
Start
RF
Selector
RF
RC0R
SSC_TCMR.STTDLY
SSC_TFMR.FSDEN
SSC_TFMR.DATNB
SSC_TFMR.DATDEF
SSC_TFMR.MSBF
TX Controller
TX Start
Start
Selector
TD
SSC_TFMR.DATLEN
SSC_THR
Transmitter Clock
SSC_TSHR
SSC_TFMR.FSLEN
1233
Start
Selector
RXEN
RF
RC0R
Start
Selector
SSC_RFMR.MSBF
SSC_RFMR.DATNB
RX Start
RX Controller
RD
SSC_RCMR.STTDLY != 0
load SSC_RSHR
load
SSC_RFMR.FSLEN
SSC_RHR
Receiver Clock
SSC_RFMR.DATLEN
RX Controller counter reached STTDLY
41.8.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.
A start can be programmed in the same manner on either side of the Transmit/Receive Clock Register
(SSC_RCMR/SSC_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
(SSC_TFMR/SSC_RFMR).
1234
TD
(Output)
TD
(Output)
BO
STTDLY
BO
B1
STTDLY
BO
TD
(Output)
B1
STTDLY
TD
(Output)
BO
B1
STTDLY
TD
(Output)
TD
(Output)
B1
BO
B1
BO
B1
STTDLY
B1
BO
BO
B1
STTDLY
RD
(Input)
RD
(Input)
BO
STTDLY
BO
B1
STTDLY
RD
(Input)
BO
B1
STTDLY
RD
(Input)
BO
B1
STTDLY
RD
(Input)
RD
(Input)
B1
BO
B1
BO
B1
STTDLY
BO
B1
BO
B1
STTDLY
1235
Programmable high levels before the start of data transfers or toggling are also supported.
If a pulse waveform is selected, the Frame Sync Length (FSLEN) field in SSC_RFMR and SSC_TFMR programs
the length of the pulse, from 1 bit time up to 256 bit times.
The periodicity of the Receive and Transmit Frame Sync pulse output can be programmed through the Period
Divider Selection (PERIOD) field in SSC_RCMR and SSC_TCMR.
41.8.5.1 Frame Sync Data
Frame Sync Data transmits or receives a specific tag during the Frame Sync signal.
During the Frame Sync signal, the Receiver can sample the RD line and store the data in the Receive Sync
Holding Register and the transmitter can transfer Transmit Sync Holding Register in the shift register. The data
length to be sampled/shifted out during the Frame Sync signal is programmed by the FSLEN field in
SSC_RFMR/SSC_TFMR and has a maximum value of 256.
Concerning the Receive Frame Sync Data operation, if the Frame Sync Length is equal to or lower than the delay
between the start event and the actual data reception, the data sampling operation is performed in the Receive
Sync Holding Register through the receive shift register.
The Transmit Frame Sync Operation is performed by the transmitter only if the bit Frame Sync Data Enable
(FSDEN) in SSC_TFMR is set. If the Frame Sync length is equal to or lower than the delay between the start event
and the actual data transmission, the normal transmission has priority and the data contained in the Transmit Sync
Holding Register is transferred in the Transmit Register, then shifted out.
41.8.5.2 Frame Sync Edge Detection
The Frame Sync Edge detection is programmed by the FSEDGE field in SSC_RFMR/SSC_TFMR. This sets the
corresponding flags RXSYN/TXSYN in the SSC Status Register (SSC_SR) on frame synchro edge detection
(signals RF/TF).
41.8.6 Receive Compare Modes
Figure 41-15. Receive Compare Modes
RK
RD
(Input)
CMP0
CMP1
CMP2
CMP3
Ignored
B0
B1
Start
FSLEN
1236
STDLY
DATLEN
B2
The 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 256 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 STOP bit in the SSC_RCMR.
41.8.7 Data Format
The data framing format of both the transmitter and the receiver are programmable through the Transmitter Frame
Mode Register (SSC_TFMR) and the Receiver Frame Mode Register (SSC_RFMR). In either case, the user can
independently select the following parameters:
Delay in number of bit periods between the start event and the first data bit (STTDLY)
Additionally, the transmitter can be used to transfer synchronization and select the level driven on the TD pin while
not in data transfer operation. This is done respectively by the Frame Sync Data Enable (FSDEN) and by the Data
Default Value (DATDEF) bits in SSC_TFMR.
Table 41-4.
Transmitter
Receiver
Field
Length
Comment
SSC_TFMR
SSC_RFMR
DATLEN
Up to 32
Size of word
SSC_TFMR
SSC_RFMR
DATNB
Up to 16
SSC_TFMR
SSC_RFMR
MSBF
SSC_TFMR
SSC_RFMR
FSLEN
Up to 256
SSC_TFMR
DATDEF
0 or 1
SSC_TFMR
FSDEN
SSC_TCMR
SSC_RCMR
PERIOD
Up to 512
Frame size
SSC_TCMR
SSC_RCMR
STTDLY
Up to 255
1237
Figure 41-16. Transmit and Receive Frame Format in Edge/Pulse Start Modes
Start
Start
PERIOD
(1)
TF/RF
FSLEN
TD
(If FSDEN = 1)
TD
(If FSDEN = 0)
RD
Sync Data
Default
Data
Data
Default
From SSC_THR
From SSC_THR
From DATDEF
Default
Ignored
Sync Data
Data
Data
From SSC_THR
From DATDEF
Data
To SSC_RHR
To SSC_RHR
DATLEN
DATLEN
STTDLY
Default
From DATDEF
From SSC_THR
Data
To SSC_RSHR
Sync Data
Ignored
Sync Data
DATNB
Note: 1. Example of input on falling edge of TF/RF.
In the example illustrated in Figure 41-17 Transmit Frame Format in Continuous Mode (STTDLY = 0), the
SSC_THR is loaded twice. The FSDEN value has no effect on the transmission. SyncData cannot be output in
continuous mode.
Figure 41-17. Transmit Frame Format in Continuous Mode (STTDLY = 0)
Start
Data
TD
Default
Data
From SSC_THR
From SSC_THR
DATLEN
DATLEN
RD
1238
Data
Data
To SSC_RHR
To SSC_RHR
DATLEN
DATLEN
SSC_IDR
Set
Clear
Transmitter
TXRDY
TXEMPTY
TXSYNC
Interrupt
Control
SSC Interrupt
Receiver
RXRDY
OVRUN
RXSYNC
1239
1240
41.9
Table 41-5.
Offset
Register Mapping
Register
0x0
Control Register
0x4
0x80xC
Reserved
Name
Access
Reset
SSC_CR
Write-only
SSC_CMR
Read/Write
0x0
0x10
SSC_RCMR
Read/Write
0x0
0x14
SSC_RFMR
Read/Write
0x0
0x18
SSC_TCMR
Read/Write
0x0
0x1C
SSC_TFMR
Read/Write
0x0
0x20
SSC_RHR
Read-only
0x0
0x24
SSC_THR
Write-only
0x280x2C
Reserved
0x30
SSC_RSHR
Read-only
0x0
0x34
SSC_TSHR
Read/Write
0x0
0x38
SSC_RC0R
Read/Write
0x0
0x3C
SSC_RC1R
Read/Write
0x0
0x40
Status Register
SSC_SR
Read-only
0x000000CC
0x44
SSC_IER
Write-only
0x48
SSC_IDR
Write-only
0x4C
SSC_IMR
Read-only
0x0
0x500xE0
Reserved
0xE4
SSC_WPMR
Read/Write
0x0
0xE8
SSC_WPSR
Read-only
0x0
0xEC0xFC
Reserved
0x1000x124
Reserved
1241
SSC_CR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
SWRST
14
13
12
11
10
9
TXDIS
8
TXEN
1
RXDIS
0
RXEN
1242
SSC_CMR
Address:
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
DIV
3
DIV
This register can only be written if the WPEN bit is cleared in the SSC Write Protection Mode Register.
DIV: Clock Divider
0: The Clock Divider is not active.
Any other value: The divided clock equals the peripheral clock divided by 2 times DIV.
The maximum bit rate is fperipheral clock/2. The minimum bit rate is fperipheral clock/2 4095 = fperipheral clock/8190.
1243
SSC_RCMR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
10
PERIOD
23
22
21
20
STTDLY
15
14
13
12
STOP
11
5
CKI
3
CKO
CKG
START
2
0
CKS
This register can only be written if the WPEN bit is cleared in the SSC Write Protection Mode Register.
CKS: Receive Clock Selection
Value
Name
Description
MCK
Divided Clock
TK
TK Clock signal
RK
RK pin
Name
Description
NONE
CONTINUOUS
TRANSFER
1244
Name
Description
CONTINUOUS
None
EN_RF_LOW
EN_RF_HIGH
Name
Description
CONTINUOUS
Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the
previous data.
TRANSMIT
Transmit start
RF_LOW
RF_HIGH
RF_FALLING
RF_RISING
RF_LEVEL
RF_EDGE
CMP_0
Compare 0
1245
SSC_RFMR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
FSEDGE
21
FSOS
20
19
18
17
16
FSLEN_EXT
23
22
15
14
13
12
11
7
MSBF
5
LOOP
FSLEN
10
DATNB
2
DATLEN
This register can only be written if the WPEN bit is cleared in the SSC Write Protection Mode Register.
DATLEN: Data Length
0: Forbidden value (1-bit data length not supported).
Any other value: The bit stream contains DATLEN + 1 data bits.
LOOP: Loop Mode
0: Normal operating mode.
1: RD is driven by TD, RF is driven by TF and TK drives RK.
MSBF: Most Significant Bit First
0: The lowest significant bit of the data register is sampled first in the bit stream.
1: The most significant bit of the data register is sampled first in the bit stream.
DATNB: Data Number per Frame
This field defines the number of data words to be received after each transfer start, which is equal to (DATNB + 1).
FSLEN: Receive Frame Sync Length
This field defines the number of bits sampled and stored in the Receive Sync Data Register. When this mode is selected by
the START field in the Receive Clock Mode Register, it also determines the length of the sampled data to be compared to
the Compare 0 or Compare 1 register.
This field is used with FSLEN_EXT to determine the pulse length of the Receive Frame Sync signal.
Pulse length is equal to FSLEN + (FSLEN_EXT 16) + 1 Receive Clock periods.
1246
Name
Description
NONE
NEGATIVE
POSITIVE
LOW
HIGH
TOGGLING
Name
Description
POSITIVE
NEGATIVE
1247
SSC_TCMR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
10
PERIOD
23
22
21
20
STTDLY
15
14
13
12
11
5
CKI
3
CKO
CKG
START
2
0
CKS
This register can only be written if the WPEN bit is cleared in the SSC Write Protection Mode Register.
CKS: Transmit Clock Selection
Value
Name
Description
MCK
Divided Clock
RK
RK Clock signal
TK
TK pin
Name
Description
NONE
CONTINUOUS
TRANSFER
1248
Name
Description
CONTINUOUS
None
EN_TF_LOW
EN_TF_HIGH
Name
Description
CONTINUOUS
Continuous, as soon as a word is written in the SSC_THR (if Transmit is enabled), and
immediately after the end of transfer of the previous data
RECEIVE
Receive start
TF_LOW
TF_HIGH
TF_FALLING
TF_RISING
TF_LEVEL
TF_EDGE
1249
SSC_TFMR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
FSEDGE
21
FSOS
20
19
18
17
16
FSLEN_EXT
23
FSDEN
22
15
14
13
12
11
7
MSBF
5
DATDEF
FSLEN
10
DATNB
2
DATLEN
This register can only be written if the WPEN bit is cleared in the SSC Write Protection Mode Register.
DATLEN: Data Length
0: Forbidden value (1-bit data length not supported).
Any other value: The bit stream contains DATLEN + 1 data bits. .
DATDEF: Data Default Value
This bit defines the level driven on the TD pin while out of transmission. Note that if the pin is defined as multi-drive by the
PIO Controller, the pin is enabled only if the SCC TD output is 1.
MSBF: Most Significant Bit First
0: The lowest significant bit of the data register is shifted out first in the bit stream.
1: The most significant bit of the data register is shifted out first in the bit stream.
DATNB: Data Number per Frame
This field defines the number of data words to be transferred after each transfer start, which is equal to (DATNB + 1).
FSLEN: Transmit Frame Sync Length
This field defines the length of the Transmit Frame Sync signal and the number of bits shifted out from the Transmit Sync
Data Register if FSDEN is 1.
This field is used with FSLEN_EXT to determine the pulse length of the Transmit Frame Sync signal.
Pulse length is equal to FSLEN + (FSLEN_EXT 16) + 1 Transmit Clock period.
1250
Name
Description
NONE
NEGATIVE
POSITIVE
LOW
HIGH
TOGGLING
Name
Description
POSITIVE
NEGATIVE
1251
SSC_RHR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
RDAT
23
22
21
20
RDAT
15
14
13
12
RDAT
4
RDAT
1252
SSC_THR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
TDAT
23
22
21
20
TDAT
15
14
13
12
TDAT
4
TDAT
1253
SSC_RSHR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
RSDAT
7
4
RSDAT
1254
SSC_TSHR
Address:
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
TSDAT
7
4
TSDAT
1255
SSC_RC0R
Address:
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
CP0
7
4
CP0
This register can only be written if the WPEN bit is cleared in the SSC Write Protection Mode Register.
CP0: Receive Compare Data 0
1256
SSC_RC1R
Address:
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
CP1
7
4
CP1
This register can only be written if the WPEN bit is cleared in the SSC Write Protection Mode Register.
CP1: Receive Compare Data 1
1257
SSC_SR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
RXEN
16
TXEN
15
14
13
12
11
RXSYN
10
TXSYN
9
CP1
8
CP0
5
OVRUN
4
RXRDY
1
TXEMPTY
0
TXRDY
1258
1259
SSC_IER
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
RXSYN
10
TXSYN
9
CP1
8
CP0
5
OVRUN
4
RXRDY
1
TXEMPTY
0
TXRDY
1260
1261
SSC_IDR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
RXSYN
10
TXSYN
9
CP1
8
CP0
5
OVRUN
4
RXRDY
1
TXEMPTY
0
TXRDY
1262
1263
SSC_IMR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
RXSYN
10
TXSYN
9
CP1
8
CP0
5
OVRUN
4
RXRDY
1
TXEMPTY
0
TXRDY
1264
1265
SSC_WPMR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
0
WPEN
WPKEY
23
22
21
20
WPKEY
15
14
13
12
WPKEY
1266
Name
PASSWD
Description
Writing any other value in this field aborts the write operation of the WPEN bit.
Always reads as 0.
SSC_WPSR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
11
10
0
WPVS
WPVSRC
15
14
13
12
WPVSRC
1267
42.
42.1
Description
The Debug Unit (DBGU) provides a single entry point from the processor for access to all the debug capabilities of
Atmels 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 communications. The Debug Unit two-pin
UART can be used stand-alone for general purpose serial communication. Moreover, the association with DMA
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 status 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 indicate 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.
42.2
Embedded Characteristics
Two-pin UART
Chip ID Registers
Two-pin UART
Independent Receiver and Transmitter with a Common Programmable Baud Rate Generator
Interrupt Generation
Support for Two DMA Channels with Connection to Receiver and Transmitter
Offers Visibility of COMMRX and COMMTX Signals from the ARM Processor
Interrupt Generation
Chip ID Registers
1268
Identification of the Device Revision, Sizes of the Embedded Memories, Set of Peripherals
Enables Software to Prevent System Access Through the ARM Processors ICE
Prevention is Made by Asserting the NTRST Line of the ARM Processors ICE
42.3
Block Diagram
Figure 42-1.
Bus clock
(Peripheral) DMA Controller
AHB Matrix
Peripheral bridge
Debug Unit
DTXD
Peripheral
clock
Power
Management
Controller
Transmit
Parallel
Input/
Output
Baud Rate
Generator
Receive
DRXD
COMMRX
ARM
Processor
COMMTX
DCC
Handler
Chip ID
nTRST
ICE
Access
Handler
Interrupt
Control
dbgu_irq
Power-on
Reset
force_ntrst
Table 42-1.
Pin Name
Description
Type
DRXD
Input
DTXD
Output
1269
Figure 42-2.
Debug Monitor
Trace Manager
Debug Unit
RS232 Drivers
Programming Tool
42.4
Debug Console
Trace Console
Product Dependencies
I/O Lines
Instance
Signal
I/O Line
Peripheral
DBGU
DRXD
PB24
DBGU
DTXD
PB25
42.5
UART Operations
The Debug Unit operates as a UART, (asynchronous mode only) and supports only 8-bit character handling (with
parity). It has no clock pin.
The Debug Unit's UART is made up of a receiver and a transmitter that operate independently, and a common
baud rate generator. Receiver timeout and transmitter time guard are not implemented. However, all the
implemented features are compatible with those of a standard USART.
1270
16-bit Counter
OUT
>1
1
0
Divide
by 16
Baud Rate
Clock
0
Receiver
Sampling Clock
42.5.2 Receiver
42.5.2.1 Receiver Reset, Enable and Disable
After device reset, the Debug Unit receiver is disabled and must be enabled before being used. The receiver can
be enabled by writing one to the RXEN bit in the Debug Unit Control register (DBGU_CR). At this command, the
receiver starts looking for a start bit.
The programmer can disable the receiver by writing a one to the RXDIS bit in the DBGU_CR. If the receiver is
waiting for a start bit, it is immediately stopped. However, if the receiver has already detected a start bit and is
receiving the data, it waits for the stop bit before actually stopping its operation.
The programmer can also put the receiver in its reset state by writing a one to the RSTRX bit in the DBGU_CR. In
doing so, the receiver immediately stops its current operations and is disabled, whatever its current state. If
RSTRX is applied when data is being processed, this data is lost.
42.5.2.2 Start Detection and Data Sampling
The Debug Unit only supports asynchronous operations, and this affects only its receiver. The Debug Unit receiver
detects the start of a received character by sampling the DRXD signal until it detects a valid start bit. A low level
(space) on DRXD is interpreted as a valid start bit if it is detected for more than 7 cycles of the sampling clock,
which is 16 times the baud rate. Hence, a space that is longer than 7/16 of the bit period is detected as a valid start
bit. A space which is 7/16 of a bit period or shorter is ignored and the receiver continues to wait for a valid start bit.
When a valid start bit has been detected, the receiver samples the DRXD at the theoretical midpoint of each bit. It
is assumed that each bit lasts 16 cycles of the sampling clock (1-bit period) so the bit sampling point is eight cycles
(0.5-bit period) after the start of the bit. The first sampling point is therefore 24 cycles (1.5-bit periods) after the
falling edge of the start bit was detected.
Each subsequent bit is sampled 16 cycles (1-bit period) after the previous one.
1271
Figure 42-4.
DRXD
True Start
Detection
D0
Baud Rate
Clock
Figure 42-5.
Character Reception
Example: 8-bit, parity enabled 1 stop
0.5 bit
period
1 bit
period
DRXD
Sampling
D0
D1
True Start Detection
D2
D3
D4
D5
D6
Stop Bit
D7
Parity Bit
When a complete character is received, it is transferred to the Debug Unit Receive Holding register (DBGU_RHR)
and the RXRDY status bit in the Debug Unit Status register (DBGU_SR) is set. The bit RXRDY is automatically
cleared when the receive holding register DBGU_RHR is read.
Figure 42-6.
Receiver Ready
DRXD
D0
D1
D2
D3
D4
D5
D6
D7
D0
D1
D2
D3
D4
D5
D6
D7
RXRDY
Read DBGU_RHR
If DBGU_RHR has not been read by the software (or the Peripheral Data Controller or DMA Controller) since the
last transfer, the RXRDY bit is still set and a new character is received, the OVRE status bit in DBGU_SR is set.
OVRE is cleared when the software writes a one to the bit RSTSTA (Reset Status) in the DBGU_CR.
Figure 42-7.
Receiver Overrun
DRXD
D0
D1
D2
D3
D4
D5
D6
D7
stop
D0
D1
D2
D3
D4
D5
D6
D7
stop
RXRDY
OVRE
RSTSTA
Each time a character is received, the receiver calculates the parity of the received data bits, in accordance with
the field PAR in the Debug Unit Mode register (DBGU_MR). It then compares the result with the received parity bit.
If different, the parity error bit PARE in DBGU_SR is set at the same time as the RXRDY is set. The parity bit is
1272
cleared when a one is written to the bit RSTSTA (Reset Status) in the DBGU_CR. If a new character is received
before the reset status command is written, the PARE bit remains at 1.
Figure 42-8.
Parity Error
DRXD
D0
D1
D2
D3
D4
D5
D6
D7
stop
RXRDY
PARE
RSTSTA
When a start bit is detected, it generates a character reception when all the data bits have been sampled. The stop
bit is also sampled and when it is detected at 0, the FRAME (Framing Error) bit in DBGU_SR is set at the same
time as the RXRDY bit is set. The bit FRAME remains high until a one is written to the RSTSTA bit in the
DBGU_CR.
Figure 42-9.
D0
D1
D2
D3
D4
D5
D6
D7
stop
RXRDY
FRAME
Stop Bit
Detected at 0
RSTSTA
The debug unit embeds a digital filter on the receive line. It is disabled by default and can be enabled by writing a
logical 1 in the FILTER bit of DBGU_MR. When enabled, the receive line is sampled using the 16x bit clock and a
three-sample filter (majority 2 over 3) determines the value of the line.
42.5.3 Transmitter
42.5.3.1 Transmitter Reset, Enable and Disable
After device reset, the Debug Unit transmitter is disabled and it must be enabled before being used. The
transmitter is enabled by writing a one to the TXEN bit in DBGU_CR. From this command, the transmitter waits for
a character to be written in the Transmit Holding register (DBGU_THR) before actually starting the transmission.
The programmer can disable the transmitter by writing a one to the TXDIS bit in the DBGU_CR. If the transmitter is
not operating, it is immediately stopped. However, if a character is being processed into the Shift Register and/or a
character has been written in the Transmit Holding Register, the characters are completed before the transmitter is
actually stopped.
The programmer can also put the transmitter in its reset state by writing a one to the RSTTX bit in the DBGU_CR.
This immediately stops the transmitter, whether or not it is processing characters.
42.5.3.2 Transmit Format
The Debug Unit transmitter drives the pin DTXD at the baud rate clock speed. The line is driven depending on the
format defined in DBGU_MR and the data stored in the Shift Register. One start bit at level 0, then the 8 data bits,
from the lowest to the highest bit, one optional parity bit and one stop bit at 1 are consecutively shifted out as
shown on the following figure. The field PARE in 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.
SAMA5D4 Series [DATASHEET]
Atmel-11238A-ATARM-SAMA5D4-Datasheet_30-Sep-14
1273
Start
Bit
D0
D1
D2
D3
D4
D5
D6
D7
Parity
Bit
Stop
Bit
When the transmitter is enabled, the bit TXRDY (Transmitter Ready) is set in DBGU_SR. The transmission starts
when the programmer writes in DBGU_THR, and after the written character is transferred from DBGU_THR to the
Shift Register. The bit TXRDY remains high until a second character is written in DBGU_THR. As soon as the first
character is completed, the last character written in DBGU_THR is transferred into the shift register and TXRDY
rises again, showing that the holding register is empty.
When both the Shift Register and the DBGU_THR are empty, i.e., all the characters written in DBGU_THR have
been processed, the bit TXEMPTY rises after the last stop bit has been completed.
Figure 42-11. Transmitter Control
DBGU_THR
Data 0
Data 1
Shift Register
DTXD
Data 0
Data 0
Data 1
stop
Data 1
stop
TXRDY
TXEMPTY
Write Data 0
in DBGU_THR
Write Data 1
in DBGU_THR
1274
The Remote Loopback mode directly connects the DRXD pin to the DTXD line. The transmitter and the receiver
are disabled and have no effect. This mode allows a bit-by-bit retransmission.
Figure 42-12. Test Modes
Automatic Echo
RXD
Receiver
Transmitter
Disabled
TXD
Local Loopback
Disabled
Receiver
RXD
VDD
Disabled
Transmitter
Remote Loopback
Receiver
Transmitter
TXD
VDD
Disabled
RXD
Disabled
TXD
1275
NVPTYP and NVPSIZ: identifies the type of embedded non-volatile memory and its size
The second register (DBGU_EXID) is device-dependent and is read as 0 if the bit EXT is 0 in DBGU_CIDR.
42.5.8 ICE Access Prevention
The Debug Unit allows blockage of access to the system through the ARM processor's ICE interface. This feature
is implemented via the Debug Unit Force NTRST register (DBGU_FNR), that allows assertion of the NTRST signal
of the ICE Interface. Writing the bit FNTRST (Force NTRST) to 1 in this register prevents any activity on the TAP
controller.
On standard devices, the bit FNTRST resets to 0 and thus does not prevent ICE access.
This feature is especially useful on custom ROM devices for customers who do not want their on-chip code to be
visible.
1276
42.6
Table 42-3.
Register Mapping
Offset
Register
Name
Access
Reset
0x0000
Control Register
DBGU_CR
Write-only
0x0004
Mode Register
DBGU_MR
Read/Write
0x0
0x0008
DBGU_IER
Write-only
0x000C
DBGU_IDR
Write-only
0x0010
DBGU_IMR
Read-only
0x0
0x0014
Status Register
DBGU_SR
Read-only
0x0018
DBGU_RHR
Read-only
0x0
0x001C
DBGU_THR
Write-only
0x0020
DBGU_BRGR
Read/Write
0x0
0x0024 - 0x003C
Reserved
0x0040
Chip ID Register
DBGU_CIDR
Read-only
0x0044
DBGU_EXID
Read-only
0x0048
DBGU_FNR
Read/Write
0x0
0x004C - 0x00FC
Reserved
1277
DBGU_CR
Address:
0xFC069000
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
RSTSTA
TXDIS
TXEN
RXDIS
RXEN
RSTTX
RSTRX
1278
DBGU_MR
Address:
0xFC069004
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
CHMODE
PAR
FILTER
Name
Description
0b000
EVEN
Even Parity
0b001
ODD
Odd Parity
0b010
SPACE
0b011
MARK
0b1xx
NONE
No Parity
Name
Description
0b00
NORM
Normal Mode
0b01
AUTO
Automatic Echo
0b10
LOCLOOP
Local Loopback
0b11
REMLOOP
Remote Loopback
1279
DBGU_IER
Address:
0xFC069008
Access:
Write-only
31
30
29
28
27
26
25
24
COMMRX
COMMTX
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TXEMPTY
PARE
FRAME
OVRE
TXRDY
RXRDY
1280
DBGU_IDR
Address:
0xFC06900C
Access:
Write-only
31
30
29
28
27
26
25
24
COMMRX
COMMTX
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TXEMPTY
PARE
FRAME
OVRE
TXRDY
RXRDY
1281
DBGU_IMR
Address:
0xFC069010
Access:
Read-only
31
30
29
28
27
26
25
24
COMMRX
COMMTX
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TXEMPTY
PARE
FRAME
OVRE
TXRDY
RXRDY
1282
DBGU_SR
Address:
0xFC069014
Access:
Read-only
31
30
29
28
27
26
25
24
COMMRX
COMMTX
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TXEMPTY
PARE
FRAME
OVRE
TXRDY
RXRDY
1283
DBGU_RHR
Address:
0xFC069018
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
RXCHR
1284
DBGU_THR
Address:
0xFC06901C
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TXCHR
1285
DBGU_BRGR
Address:
0xFC069020
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
CD
7
CD
Name
DISABLED
DBGU Disabled
MCK
Peripheral clock
2 to 65535
1286
Description
DBGU_CIDR
Address:
0xFC069040
Access:
Read-only
31
30
29
EXT
23
28
27
26
NVPTYP
22
21
20
19
18
ARCH
15
14
13
24
17
16
SRAMSIZ
12
11
10
NVPSIZ2
7
25
ARCH
NVPSIZ
5
EPROC
VERSION
Name
Description
ARM946ES
ARM946ES
ARM7TDMI
ARM7TDMI
CM3
Cortex-M3
ARM920T
ARM920T
ARM926EJS
ARM926EJS
CA5
Cortex-A5
1287
Name
Description
NONE
None
8K
8 Kbytes
16K
16 Kbytes
32K
32 Kbytes
Reserved
64K
64 Kbytes
Reserved
128K
128 Kbytes
Reserved
256K
256 Kbytes
10
512K
512 Kbytes
11
Reserved
12
1024K
1024 Kbytes
13
Reserved
14
2048K
2048 Kbytes
15
Reserved
Name
Description
NONE
None
8K
8 Kbytes
16K
16 Kbytes
32K
32 Kbytes
Reserved
64K
64 Kbytes
1288
Reserved
128K
128 Kbytes
Reserved
256K
256 Kbytes
10
512K
512 Kbytes
11
Reserved
12
1024K
1024 Kbytes
13
Reserved
14
2048K
2048 Kbytes
15
Reserved
Name
Description
Reserved
1K
1 Kbytes
2K
2 Kbytes
6K
6 Kbytes
112K
112 Kbytes
4K
4 Kbytes
80K
80 Kbytes
160K
160 Kbytes
8K
8 Kbytes
16K
16 Kbytes
10
32K
32 Kbytes
11
64K
64 Kbytes
12
128K
128 Kbytes
13
256K
256 Kbytes
14
96K
96 Kbytes
15
512K
512 Kbytes
1289
1290
Value
Name
Description
0x19
AT91SAM9xx
AT91SAM9xx Series
0x29
AT91SAM9XExx
AT91SAM9XExx Series
0x34
AT91x34
AT91x34 Series
0x37
CAP7
CAP7 Series
0x39
CAP9
CAP9 Series
0x3B
CAP11
CAP11 Series
0x40
AT91x40
AT91x40 Series
0x42
AT91x42
AT91x42 Series
0x55
AT91x55
AT91x55 Series
0x60
AT91SAM7Axx
AT91SAM7Axx Series
0x61
AT91SAM7AQxx
AT91SAM7AQxx Series
0x63
AT91x63
AT91x63 Series
0x70
AT91SAM7Sxx
AT91SAM7Sxx Series
0x71
AT91SAM7XCxx
AT91SAM7XCxx Series
0x72
AT91SAM7SExx
AT91SAM7SExx Series
0x73
AT91SAM7Lxx
AT91SAM7Lxx Series
0x75
AT91SAM7Xxx
AT91SAM7Xxx Series
0x76
AT91SAM7SLxx
AT91SAM7SLxx Series
0x80
ATSAM3UxC
0x81
ATSAM3UxE
0x83
ATSAM3AxC
0x84
ATSAM3XxC
0x85
ATSAM3XxE
0x86
ATSAM3XxG
0x88
ATSAM3SxA
0x89
ATSAM3SxB
0x8A
ATSAM3SxC
0x92
AT91x92
AT91x92 Series
0x93
ATSAM3NxA
0x94
ATSAM3NxB
0x95
ATSAM3NxC
0x98
ATSAM3SDxA
0x99
ATSAM3SDxB
0x9A
ATSAM3SDxC
0xA5
ATSAMA5xx
ATSAMA5xx Series
0xF0
AT75Cxx
AT75Cxx Series
Name
Description
ROM
ROM
ROMLESS
SRAM
FLASH
ROM_FLASH
1291
DBGU_EXID
Address:
0xFC069044
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
EXID
23
22
21
20
EXID
15
14
13
12
EXID
7
EXID
1292
DBGU_FNR
Address:
0xFC069048
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
FNTRST
1293
43.
43.1
Description
The Universal Asynchronous Receiver Transmitter features a two-pin UART that can be used for communication
and trace purposes and offers an ideal medium for in-situ programming solutions.
Moreover, the association with a DMA controller permits packet handling for these tasks with processor time
reduced to a minimum.
43.2
Embedded Characteristics
43.3
Two-pin UART
Independent Receiver and Transmitter with a Common Programmable Baud Rate Generator
Interrupt Generation
Support for Two DMA Channels with Connection to Receiver and Transmitter
Block Diagram
Figure 43-1.
UART
UTXD
Transmit
DMA Controller
Parallel
Input/
Output
Baud Rate
Generator
Receive
bus clock
URXD
Bridge
APB
Interrupt
Control
PMC
Table 43-1.
1294
peripheral clock
Pin Name
Description
Type
URXD
Input
UTXD
Output
uart_irq
43.4
Product Dependencies
I/O Lines
Instance
Signal
I/O Line
Peripheral
UART0
URXD0
PE29
UART0
UTXD0
PE30
UART1
URXD1
PC25
UART1
UTXD1
PC26
43.5
Functional Description
The UART operates in asynchronous mode only and supports only 8-bit character handling (with parity). It has no
clock pin.
The UART is made up of a receiver and a transmitter that operate independently, and a common baud rate
generator. Receiver timeout and transmitter time guard are not implemented. However, all the implemented
features are compatible with those of a standard USART.
1295
Figure 43-2.
CD
CD
peripheral clock
16-bit Counter
PCK (PMC)
OUT
>1
Divide
by 16
Baud Rate
Clock
Receiver
Sampling Clock
43.5.2 Receiver
43.5.2.1 Receiver Reset, Enable and Disable
After device reset, the UART receiver is disabled and must be enabled before being used. The receiver can be
enabled by writing the Control Register (UART_CR) with the bit RXEN at 1. At this command, the receiver starts
looking for a start bit.
The programmer can disable the receiver by writing UART_CR with the bit RXDIS at 1. If the receiver is waiting for
a start bit, it is immediately stopped. However, if the receiver has already detected a start bit and is receiving the
data, it waits for the stop bit before actually stopping its operation.
The receiver can be put in reset state by writing UART_CR with the bit RSTRX at 1. In this case, the receiver
immediately stops its current operations and is disabled, whatever its current state. If RSTRX is applied when data
is being processed, this data is lost.
43.5.2.2 Start Detection and Data Sampling
The UART only supports asynchronous operations, and this affects only its receiver. The UART receiver detects
the start of a received character by sampling the URXD signal until it detects a valid start bit. A low level (space) on
URXD is interpreted as a valid start bit if it is detected for more than seven cycles of the sampling clock, which is
16 times the baud rate. Hence, a space that is longer than 7/16 of the bit period is detected as a valid start bit. A
space which is 7/16 of a bit period or shorter is ignored and the receiver continues to wait for a valid start bit.
When a valid start bit has been detected, the receiver samples the URXD at the theoretical midpoint of each bit. It
is assumed that each bit lasts 16 cycles of the sampling clock (1-bit period) so the bit sampling point is eight cycles
(0.5-bit period) after the start of the bit. The first sampling point is therefore 24 cycles (1.5-bit periods) after
detecting the falling edge of the start bit.
Each subsequent bit is sampled 16 cycles (1-bit period) after the previous one.
Figure 43-3.
D0
D1 D2
D3
D4 D5 D6
D7
stop S
D0
D1 D2
D3 D4
D5
D6
D7
P stop
RXRDY
OVRE
RSTSTA
1296
Figure 43-4.
Character Reception
Example: 8-bit, parity enabled 1 stop
0.5 bit
period
1 bit
period
URXD
Sampling
D0
D1
True Start Detection
D2
D3
D4
D5
D6
Stop Bit
D7
Parity Bit
When a complete character is received, it is transferred to the Receive Holding Register (UART_RHR) and the
RXRDY status bit in the Status Register (UART_SR) is set. The bit RXRDY is automatically cleared when
UART_RHR is read.
Figure 43-5.
Receiver Ready
S
URXD
D0
D1
D2
D3
D4
D5
D6
D7
D0
D1
D2
D3
D4
D5
D6
D7
RXRDY
Read UART_RHR
The OVRE status bit in UART_SR is set if UART_RHR has not been read by the software (or the DMA Controller)
since the last transfer, the RXRDY bit is still set and a new character is received. OVRE is cleared when the
software writes a 1 to the bit RSTSTA (Reset Status) in UART_CR.
Figure 43-6.
URXD
Receiver Overrun
S
D0
D1
D2
D3
D4
D5
D6
D7
stop
D0
D1
D2
D3
D4
D5
D6
D7
stop
RXRDY
OVRE
RSTSTA
Each time a character is received, the receiver calculates the parity of the received data bits, in accordance with
the field PAR in the Mode Register (UART_MR). It then compares the result with the received parity bit. If different,
the parity error bit PARE in UART_SR is set at the same time RXRDY is set. The parity bit is cleared when
UART_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.
1297
Figure 43-7.
Parity Error
S
URXD
D0
D1
D2
D3
D4
D5
D6
D7
stop
RXRDY
PARE
RSTSTA
When a start bit is detected, it generates a character reception when all the data bits have been sampled. The stop
bit is also sampled and when it is detected at 0, the FRAME (Framing Error) bit in UART_SR is set at the same
time the RXRDY bit is set. The FRAME bit remains high until the Control Register (UART_CR) is written with the
bit RSTSTA at 1.
Figure 43-8.
URXD
D0
D1
D2
D3
D4
D5
D6
D7
stop
RXRDY
FRAME
Stop Bit
Detected at 0
RSTSTA
43.5.3 Transmitter
43.5.3.1 Transmitter Reset, Enable and Disable
After device reset, the UART transmitter is disabled and must be enabled before being used. The transmitter is
enabled by writing UART_CR with the bit TXEN at 1. From this command, the transmitter waits for a character to
be written in the Transmit Holding Register (UART_THR) before actually starting the transmission.
The programmer can disable the transmitter by writing UART_CR with the bit TXDIS at 1. If the transmitter is not
operating, it is immediately stopped. However, if a character is being processed into the internal shift register
and/or a character has been written in the UART_THR, the characters are completed before the transmitter is
actually stopped.
The programmer can also put the transmitter in its reset state by writing the UART_CR with the bit RSTTX at 1.
This immediately stops the transmitter, whether or not it is processing characters.
43.5.3.2 Transmit Format
The UART transmitter drives the pin UTXD at the baud rate clock speed. The line is driven depending on the
format defined in UART_MR and the data stored in the internal shift register. One start bit at level 0, then the 8
data bits, from the lowest to the highest bit, one optional parity bit and one stop bit at 1 are consecutively shifted
out as shown in the following figure. The field PARE in UART_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.
1298
Figure 43-9.
Character Transmission
Example: Parity enabled
Baud Rate
Clock
UTXD
Start
Bit
D0
D1
D2
D3
D4
D5
D6
D7
Parity
Bit
Stop
Bit
When the transmitter is enabled, the bit TXRDY (Transmitter Ready) is set in UART_SR. The transmission starts
when the programmer writes in the UART_THR, and after the written character is transferred from UART_THR to
the internal shift register. The TXRDY bit remains high until a second character is written in UART_THR. As soon
as the first character is completed, the last character written in UART_THR is transferred into the internal shift
register and TXRDY rises again, showing that the holding register is empty.
When both the internal shift register and UART_THR are empty, i.e., all the characters written in UART_THR have
been processed, the TXEMPTY bit rises after the last stop bit has been completed.
Figure 43-10. Transmitter Control
UART_THR
Data 0
Data 1
Shift Register
UTXD
Data 0
Data 0
Data 1
stop
Data 1
stop
TXRDY
TXEMPTY
Write Data 0
in UART_THR
Write Data 1
in UART_THR
1299
Receiver
Transmitter
Disabled
TXD
Local Loopback
Disabled
Receiver
RXD
VDD
Disabled
Transmitter
Remote Loopback
Receiver
Transmitter
1300
TXD
VDD
Disabled
Disabled
RXD
TXD
43.6
Table 43-3.
Register Mapping
Offset
Register
Name
Access
Reset
0x0000
Control Register
UART_CR
Write-only
0x0004
Mode Register
UART_MR
Read/Write
0x0
0x0008
UART_IER
Write-only
0x000C
UART_IDR
Write-only
0x0010
UART_IMR
Read-only
0x0
0x0014
Status Register
UART_SR
Read-only
0x0018
UART_RHR
Read-only
0x0
0x001C
UART_THR
Write-only
0x0020
UART_BRGR
Read/Write
0x0
0x00240x003C
Reserved
0x00400x00E0
Reserved
0x00E4
UART_WPMR
Read/Write
0x0
0x00E8
Reserved
0x00EC0x00FC
Reserved
1301
UART_CR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
RSTSTA
TXDIS
TXEN
RXDIS
RXEN
RSTTX
RSTRX
1302
UART_MR
Address:
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
BRSRCCK
CHMODE
PAR
Name
Description
EVEN
Even Parity
ODD
Odd Parity
SPACE
MARK
NO
No parity
Name
Description
NORMAL
Normal mode
AUTOMATIC
Automatic echo
LOCAL_LOOPBACK
Local loopback
REMOTE_LOOPBACK
Remote loopback
1303
UART_IER
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TXEMPTY
PARE
FRAME
OVRE
TXRDY
RXRDY
The following configuration values are valid for all listed bit names of this register:
0: No effect.
1: Enables the corresponding interrupt.
RXRDY: Enable RXRDY Interrupt
TXRDY: Enable TXRDY Interrupt
OVRE: Enable Overrun Error Interrupt
FRAME: Enable Framing Error Interrupt
PARE: Enable Parity Error Interrupt
TXEMPTY: Enable TXEMPTY Interrupt
1304
UART_IDR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TXEMPTY
PARE
FRAME
OVRE
TXRDY
RXRDY
The following configuration values are valid for all listed bit names of this register:
0: No effect.
1: Disables the corresponding interrupt.
RXRDY: Disable RXRDY Interrupt
TXRDY: Disable TXRDY Interrupt
OVRE: Disable Overrun Error Interrupt
FRAME: Disable Framing Error Interrupt
PARE: Disable Parity Error Interrupt
TXEMPTY: Disable TXEMPTY Interrupt
1305
UART_IMR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TXEMPTY
PARE
FRAME
OVRE
TXRDY
RXRDY
The following configuration values are valid for all listed bit names of this register:
0: The corresponding interrupt is disabled.
1: The corresponding interrupt is enabled.
RXRDY: Mask RXRDY Interrupt
TXRDY: Disable TXRDY Interrupt
OVRE: Mask Overrun Error Interrupt
FRAME: Mask Framing Error Interrupt
PARE: Mask Parity Error Interrupt
TXEMPTY: Mask TXEMPTY Interrupt
1306
UART_SR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TXEMPTY
PARE
FRAME
OVRE
TXRDY
RXRDY
1307
UART_RHR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
RXCHR
1308
UART_THR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
TXCHR
1309
UART_BRGR
Address:
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
CD
7
CD
1310
UART_WPMR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
WPKEY
23
22
21
20
WPKEY
15
14
13
12
WPKEY
7
WPEN
Name
PASSWD
Description
Writing any other value in this field aborts the write operation.
Always reads as 0.
1311
44.
44.1
Description
The Universal Synchronous Asynchronous Receiver Transceiver (USART) provides one full duplex universal
synchronous asynchronous serial link. Data frame format is widely programmable (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 handling 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, and SPI buses, with ISO7816 T =
0 or T = 1 smart card slots and infrared transceivers. The hardware handshaking feature enables an out-of-band
flow control by automatic management of the pins RTS and CTS.
The USART supports the connection to the DMA Controller, which enables data transfers to the transmitter and
from the receiver. The DMAC provides chained buffer management without any intervention of the processor.
44.2
Embedded Characteristics
MSB- or LSB-first
SPI Mode
Master or Slave
Test Modes
1312
44.3
Block Diagram
Figure 44-1.
USART Interrupt
PIO
Controller
USART
RXD
Receiver
Channel
RTS
(Peripheral)
DMA Controller
TXD
Channel
Transmitter
CTS
Bus clock
SCK
Baud Rate
Generator
Bridge
APB
User
Interface
Peripheral clock
PMC
44.4
Peripheral clock/DIV
Name
Description
Type
Active Level
SCK
Serial Clock
I/O
I/O
Input
Input
Low
Output
Low
RXD
CTS
RTS
Clear to Send
or Slave Select (NSS) in SPI slave mode
Request to Send
or Slave Select (NSS) in SPI master mode
1313
44.5
Product Dependencies
Table 44-2.
1314
I/O Lines
Instance
Signal
I/O Line
Peripheral
USART0
CTS0
PD10
USART0
RTS0
PD11
USART0
RXD0
PD12
USART0
SCK0
PD28
USART0
TXD0
PD13
USART1
CTS1
PD14
USART1
RTS1
PD15
USART1
RXD1
PD16
USART1
SCK1
PD29
USART1
TXD1
PD17
USART2
CTS2
PB3
USART2
RTS2
PB11
USART2
RXD2
PB4
USART2
SCK2
PB1
USART2
TXD2
PB5
USART3
CTS3
PE5
USART3
RTS3
PE24
USART3
RXD3
PE16
USART3
SCK3
PE15
USART3
TXD3
PE17
USART4
CTS4
PE0
USART4
RTS4
PE28
USART4
RXD4
PE26
USART4
SCK4
PE25
USART4
TXD4
PE27
Peripheral IDs
Instance
ID
USART0
USART1
USART2
29
USART3
30
USART4
31
1315
44.6
Functional Description
A division of the peripheral clock, where the divider is product-dependent, but generally set to 8
The baud rate generator is based upon a 16-bit divider, which is programmed with the CD field of the Baud Rate
Generator register (US_BRGR). If a 0 is written to CD, the baud rate generator does not generate any clock. If a 1
is written to CD, the divider is bypassed and becomes inactive.
If the external SCK clock is selected, the duration of the low and high levels of the signal provided on the SCK pin
must be longer than a peripheral clock period. The frequency of the signal provided on SCK must be at least 3
times lower than the frequency provided on the peripheral clock in USART mode (field USART_MODE differs from
0xE or 0xF), or 6 times lower in SPI mode (field USART_MODE equals 0xE or 0xF).
Figure 44-2.
Peripheral clock/DIV
Reserved
SCK
CD
1
2
SCK
(CLKO = 1)
CD
0
16-bit Counter
FIDI
>1
(CLKO = 0)
0
SYNC
OVER
Sampling
Divider
0
Baud Rate
Clock
1
1
SYNC
USCLKS = 3
Sampling
Clock
If the USART is programmed to operate in Asynchronous mode, the selected clock is first divided by CD, which is
field programmed in the US_BRGR. The resulting clock is provided to the receiver as a sampling clock and then
divided by 16 or 8, depending on how the OVER bit in the US_MR is programmed.
If OVER is set, the receiver sampling is eight times higher than the baud rate clock. If OVER is cleared, the
sampling is performed at 16 times the baud rate clock.
The baud rate is calculated as per the following formula:
SelectedClock
Baudrate = -------------------------------------------( 8 ( 2 Over )CD )
This gives a maximum baud rate of peripheral clock divided by 8, assuming that the peripheral clock is the highest
possible clock and that the OVER bit is set.
1316
Source Clock
(MHz)
Calculation Result
CD
Error
3,686,400
38,400
6.00
38,400.00
0.00%
4,915,200
38,400
8.00
38,400.00
0.00%
5,000,000
38,400
8.14
39,062.50
1.70%
7,372,800
38,400
12.00
12
38,400.00
0.00%
8,000,000
38,400
13.02
13
38,461.54
0.16%
12,000,000
38,400
19.53
20
37,500.00
2.40%
12,288,000
38,400
20.00
20
38,400.00
0.00%
14,318,180
38,400
23.30
23
38,908.10
1.31%
14,745,600
38,400
24.00
24
38,400.00
0.00%
18,432,000
38,400
30.00
30
38,400.00
0.00%
24,000,000
38,400
39.06
39
38,461.54
0.16%
24,576,000
38,400
40.00
40
38,400.00
0.00%
25,000,000
38,400
40.69
40
38,109.76
0.76%
32,000,000
38,400
52.08
52
38,461.54
0.16%
32,768,000
38,400
53.33
53
38,641.51
0.63%
33,000,000
38,400
53.71
54
38,194.44
0.54%
40,000,000
38,400
65.10
65
38,461.54
0.16%
50,000,000
38,400
81.38
81
38,580.25
0.47%
1317
The baud rate generator is subject to the following limitation: the output frequency changes only by integer
multiples of the reference frequency. An approach to this problem is to integrate a fractional N clock generator that
has a high resolution. The generator architecture is modified to obtain baud rate changes by a fraction of the
reference source clock. This fractional part is programmed with the FP field in the US_BRGR. If FP is not 0, the
fractional part is activated. The resolution is one eighth of the 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
-------
USCLKS
CD
Modulus
Control
FP
MCK
MCK/DIV
Reserved
SCK
(CLKO = 1)
CD
0
1
2
16-bit Counter
Glitch-free
Logic
SCK
(CLKO = 0)
FIDI
>1
0
SYNC
OVER
Sampling
Divider
0
Baud Rate
Clock
1
1
SYNC
USCLKS = 3
Sampling
Clock
If the USART is programmed to operate in Synchronous mode, the selected clock is simply divided by the field CD
in the US_BRGR.
SelectedClock
BaudRate = -------------------------------------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 3 times lower than the system clock. In Synchronous mode master (USCLKS = 0 or 1,
CLKO set to 1), the receive part limits the SCK maximum frequency tofperipheral clock/3 in USART mode, or fperipheral
clock/6 in SPI mode.
When either the external clock SCK or the internal clock divided (peripheral clock/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. When the
peripheral clock 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.
1318
The ISO7816 specification defines the bit rate with the following formula:
Di
B = ------ f
Fi
where:
Di is a binary value encoded on a 4-bit field, named DI, as represented in Table 44-5.
Table 44-5.
DI field
0001
0010
0011
0100
0101
0110
1000
1001
16
32
12
20
Di (decimal)
Fi is a binary value encoded on a 4-bit field, named FI, as represented in Table 44-6.
Table 44-6.
FI field
0000
0001
0010
0011
0100
0101
0110
1001
1010
1011
1100
1101
Fi (decimal)
372
372
558
744
1116
1488
1860
512
768
1024
1536
2048
Table 44-7 shows the resulting Fi/Di ratio, which is the ratio between the ISO7816 clock and the baud rate clock.
Table 44-7.
Fi/Di
372
558
744
1116
1488
1806
512
768
1024
1536
2048
372
558
744
1116
1488
1860
512
768
1024
1536
2048
186
279
372
558
744
930
256
384
512
768
1024
93
139.5
186
279
372
465
128
192
256
384
512
46.5
69.75
93
139.5
186
232.5
64
96
128
192
256
16
23.25
34.87
46.5
69.75
93
116.2
32
48
64
96
128
32
11.62
17.43
23.25
34.87
46.5
58.13
16
24
32
48
64
12
31
46.5
62
93
124
155
42.66
64
85.33
128
170.6
20
18.6
27.9
37.2
55.8
74.4
93
25.6
38.4
51.2
76.8
102.4
If the USART is configured in ISO7816 mode, the clock selected by the USCLKS field in US_MR is first divided by
the value programmed in the field CD in the US_BRGR. The resulting clock can be provided to the SCK pin to feed
the smart card clock inputs. This means that the CLKO bit can be set in US_MR.
This clock is then divided by the value programmed in the FI_DI_RATIO field in the FI_DI_Ratio register
(US_FIDI). This is performed by the Sampling Divider, which performs a division by up to 65535 in ISO7816 mode.
The non-integer values of the Fi/Di Ratio are not supported and the user must program the FI_DI_RATIO field to a
value as close as possible to the expected value.
The FI_DI_RATIO field resets to the value 0x174 (372 in decimal) and is the most common divider between the
ISO7816 clock and the bit rate (Fi = 372, Di = 1).
Figure 44-4 shows the relation between the Elementary Time Unit, corresponding to a bit time, and the ISO 7816
clock.
1319
Figure 44-4.
1 ETU
The transmitter performs the same in both Synchronous and Asynchronous operating modes (SYNC = 0 or SYNC
= 1). One start bit, up to 9 data bits, one optional parity bit and up to two stop bits are successively shifted out on
the TXD pin at each falling edge of the programmed serial clock.
The number of data bits is selected by the CHRL field and the MODE 9 bit in US_MR. Nine bits are selected by
setting the MODE 9 bit regardless of the CHRL field. The parity bit is set according to the PAR field in US_MR. The
even, odd, space, marked or none parity bit can be configured. The MSBF field in the US_MR configures which
data bit is sent first. If written to 1, the most significant bit is sent first. If written to 0, the less significant bit is sent
first. The number of stop bits is selected by the NBSTOP field in the US_MR. The 1.5 stop bit is supported in
Asynchronous mode only.
1320
Figure 44-5.
Character Transmit
Example: 8-bit, Parity Enabled One Stop
Baud Rate
Clock
TXD
D0
Start
Bit
D1
D2
D3
D4
D5
D6
D7
Parity
Bit
Stop
Bit
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.
Figure 44-6.
Transmitter Status
Baud Rate
Clock
TXD
Start
D0
Bit
D1
D2
D3
D4
D5
D6
D7
D1
D2
D3
D4
D5
D6
D7
Parity Stop
Bit Bit
Write
US_THR
TXRDY
TXEMPTY
When the Manchester encoder is in use, characters transmitted through the USART are encoded based on
biphase Manchester II format. To enable this mode, set the MAN bit in the US_MR to 1. Depending on polarity
configuration, a logic level (zero or one), is transmitted as a coded signal one-to-zero or zero-to-one. Thus, a
transition always occurs at the midpoint of each bit time. It consumes more bandwidth than the original NRZ signal
(2x) but the receiver has more error control since the expected input must show a change at the center of a bit cell.
An example of Manchester encoded sequence is: the byte 0xB1 or 10110001 encodes to 10 01 10 10 01 01 01 10,
assuming the default polarity of the encoder. Figure 44-7 illustrates this coding scheme.
Figure 44-7.
Manchester
encoded Txd
data
1321
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
predefined 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 44-8 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 transition. If the TX_MPOL field is set to 1, a logic one is encoded with a one-to-zero
transition and a logic zero is encoded with a zero-to-one transition.
Figure 44-8.
Txd
SFD
DATA
SFD
DATA
SFD
DATA
SFD
DATA
Manchester
encoded
data
Txd
Txd
Manchester
encoded
data
Txd
A start frame delimiter is to be configured using the ONEBIT bit in the US_MR. It consists of a user-defined pattern
that indicates the beginning of a valid data. Figure 44-9 illustrates these patterns. If the start frame delimiter, also
known as the start bit, is one bit, (ONEBIT = 1), a logic zero is Manchester encoded and indicates that a new
character is being sent serially on the line. If the start frame delimiter is a synchronization pattern also referred to
as sync (ONE BIT to 0), a sequence of three bit times is sent serially on the line to indicate the start of a new
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 bit in the US_MR is set to 1, the next character is a command. If it is set to 0, the next
character 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 bit in US_MR must be set to 1. In this
case, the MODSYNC bit in the US_MR is bypassed and the sync configuration is held in the TXSYNH in the
US_THR. The USART character format is modified and includes sync information.
1322
Figure 44-9.
SFD
DATA
Txd
Manchester
encoded
data
SFD
DATA
Txd
SFD
Command Sync
start frame delimiter
DATA
Txd
Data Sync
start frame delimiter
Drift Compensation
Drift compensation is available only in 16X oversampling mode. An hardware recovery system allows a larger
clock drift. To enable the hardware system, the bit in the USART_MAN register must be set. If the RXD edge is
one 16X clock cycle from the expected edge, this is considered as normal jitter and no corrective actions is taken.
If the RXD event is between 4 and 2 clock cycles before the expected edge, then the current period is shortened
by one clock cycle. If the RXD event is between 2 and 3 clock cycles after the expected edge, then the current
period is lengthened by one clock cycle. These intervals are considered to be drift and so corrective actions are
automatically taken.
Figure 44-10. Bit Resynchronization
Oversampling
16x Clock
RXD
Sampling
point
Expected edge
Synchro.
Error
Synchro.
Jump
Tolerance
Sync
Jump
Synchro.
Error
If the USART is programmed in Asynchronous operating mode (SYNC = 0), the receiver oversamples the RXD
input line. The oversampling is either 16 or 8 times the baud rate clock, depending on the OVER bit in the US_MR.
The receiver samples the RXD line. If the line is sampled during one half of a bit time to 0, a start bit is detected
and data, parity and stop bits are successively sampled on the bit rate clock.
If the oversampling is 16 (OVER = 0), a start is detected at the eighth sample to 0. Data bits, parity bit and stop bit
are assumed to have a duration corresponding to 16 oversampling clock cycles. If the oversampling is 8 (OVER =
1), a start bit is detected at the fourth sample to 0. Data bits, parity bit and stop bit are assumed to have a duration
corresponding to 8 oversampling clock cycles.
1323
The number of data bits, first bit sent and Parity mode are selected by the same fields and bits as the transmitter,
i.e., respectively CHRL, MODE9, MSBF and PAR. For the synchronization mechanism only, the number of stop
bits has no effect on the receiver as it considers only one stop bit, regardless of the field NBSTOP, so that
resynchronization between the receiver and the transmitter can occur. Moreover, as soon as the stop bit is
sampled, the receiver starts looking for a new start bit so that resynchronization can also be accomplished when
the transmitter is operating with one stop bit.
Figure 44-11 and Figure 44-12 illustrate start detection and character reception when USART operates in
Asynchronous mode.
Figure 44-11. Asynchronous Start Detection
Baud Rate
Clock
Sampling
Clock (x16)
RXD
Sampling
1
9 10 11 12 13 14 15 16
D0
Sampling
Start
Detection
RXD
Sampling
0 1
Start
Rejection
16
16
16
16
16
16
16
16
16
16
samples samples samples samples samples samples samples samples samples samples
D0
D1
D2
D3
D4
D5
D6
D7
Parity
Bit
Stop
Bit
When the MAN bit in the US_MR is set to 1, the Manchester decoder is enabled. The decoder performs both
preamble and start frame delimiter detection. One input line is dedicated to Manchester encoded input data.
An optional preamble sequence can be defined, its length is user-defined and totally independent of the emitter
side. Use RX_PL in US_MAN register to configure the length of the preamble sequence. If the length is set to 0, no
preamble is detected and the function is disabled. In addition, the polarity of the input stream is programmable with
RX_MPOL bit in US_MAN register. Depending on the desired application the preamble pattern matching is to be
defined via the RX_PP field in US_MAN. See Figure 44-8 for available preamble patterns.
Unlike preamble, the start frame delimiter is shared between Manchester Encoder and Decoder. So, if ONEBIT
field is set to 1, only a zero encoded Manchester can be detected as a valid start frame delimiter. If ONEBIT is set
1324
to 0, only a sync pattern is detected as a valid start frame delimiter. Decoder operates by detecting transition on
incoming stream. If RXD is sampled during one quarter of a bit time to zero, a start bit is detected. See Figure 4413. The sample pulse rejection mechanism applies.
Figure 44-13. Asynchronous Start Bit Detection
Sampling
Clock
(16 x)
Manchester
encoded
data
Txd
Start
Detection
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 resynchronizes 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 44-14 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 the US_CSR is raised. It is
cleared by writing a 1 to the RSTSTA in the US_CR. See Figure 44-15 for an example of Manchester error
detection during data phase.
Figure 44-14. Preamble Pattern Mismatch
Preamble Mismatch
Manchester coding error
Manchester
encoded
data
Preamble Mismatch
invalid pattern
SFD
Txd
DATA
Txd
Entering USART character area
sampling points
Preamble subpacket
and Start Frame Delimiter
were successfully
decoded
Manchester
Coding Error
detected
1325
When the start frame delimiter is a sync pattern (ONEBIT field to 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 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.
44.6.3.5 Radio Interface: Manchester Encoded USART Application
This section describes low data rate RF transmission systems and their integration with a Manchester encoded
USART. These systems are based on transmitter and receiver ICs that support ASK and FSK modulation
schemes.
The goal is to perform full duplex radio transmission of characters using two different frequency carriers. See the
configuration in Figure 44-16.
Figure 44-16. Manchester Encoded Characters RF Transmission
Upstream
Emitter
LNA
VCO
RF filter
Demod
Serial
Configuration
Interface
control
Fdown frequency Carrier
bi-dir
line
Manchester
decoder
USART
Receiver
Manchester
encoder
USART
Emitter
ASK/FSK
downstream transmitter
Downstream
Receiver
PA
RF filter
Mod
VCO
control
1326
NRZ stream
Manchester
encoded
data
default polarity
unipolar output
Txd
ASK Modulator
Output
Uptstream Frequency F0
Txd
FSK Modulator
Output
Uptstream Frequencies
[F0, F0+offset]
In Synchronous mode (SYNC = 1), the receiver samples the RXD signal on each rising edge of the baud rate
clock. If a low level is detected, it is considered as a start. All data bits, the parity bit and the stop bits are sampled
and the receiver waits for the next start bit. Synchronous mode operations provide a high-speed transfer capability.
Configuration fields and bits are the same as in Asynchronous mode.
Figure 44-19 illustrates a character reception in Synchronous mode.
Figure 44-19. Synchronous Mode Character Reception
Example: 8-bit, Parity Enabled 1 Stop
Baud Rate
Clock
RXD
Sampling
Start
D0
D1
D2
D3
D4
D5
D6
D7
Stop Bit
Parity Bit
When a character reception is completed, it is transferred to the Receive Holding register (US_RHR) and the
RXRDY bit in US_CSR rises. If a character is completed while the RXRDY is set, the OVRE (Overrun Error) bit is
set. The last character is transferred into US_RHR and overwrites the previous one. The OVRE bit is cleared by
writing a 1 to the RSTSTA (Reset Status) bit in the US_CR.
1327
D1
D2
D3
D4
D5
D6
D7
D1
D2
D3
D4
D5
D6
D7
Parity Stop
Bit Bit
RSTSTA = 1
Write
US_CR
Read
US_RHR
RXRDY
OVRE
44.6.3.8 Parity
The USART supports five Parity modes that are selected by writing to the PAR field in the US_MR. The PAR field
also enables the Multidrop mode, see Section 44.6.3.9 Multidrop Mode. 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 to 0 if a number of 1s in the
character data bit is even, and to 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 sampled parity bit does not correspond. If odd parity is
selected, the parity generator of the transmitter drives the parity bit to 1 if a number of 1s in the character data bit
is even, and to 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 to 1 for all characters. The receiver parity checker reports an error
if the parity bit is sampled to 0. If the space parity is used, the parity generator of the transmitter drives the parity bit
to 0 for all characters. The receiver parity checker reports an error if the parity bit is sampled to 1. If parity is
disabled, the transmitter does not generate any parity bit and the receiver does not report any parity error.
Table 44-8 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 set to 1 in the character value, the parity bit is set to 1
when the parity is odd, or configured to 0 when the parity is even.
Table 44-8.
Character
Hexadecimal
Binary
Parity Bit
Parity Mode
0x41
0100 0001
Odd
0x41
0100 0001
Even
0x41
0100 0001
Mark
0x41
0100 0001
Space
0x41
0100 0001
None
None
When the receiver detects a parity error, it sets the PARE (Parity Error) bit in the US_CSR. The PARE bit can be
cleared by writing a 1 to the RSTSTA bit the US_CR. Figure 44-21 illustrates the parity bit status setting and
clearing.
1328
Baud Rate
Clock
RXD
Start
D0
Bit
D1
D2
D3
D4
D5
D6
D7
Bad Stop
Parity Bit
Bit
RSTSTA = 1
Write
US_CR
PARE
Parity Error
Detect
Time
Flags
Report
Time
RXRDY
If the value 0x6 or 0x07 is written to the PAR field in the US_MR, the USART runs in Multidrop mode. This mode
differentiates the data characters and the address characters. Data is transmitted with the parity bit at 0 and
addresses are transmitted with the parity bit at 1.
If the USART is configured in Multidrop mode, the receiver sets the PARE parity error bit when the parity bit is high
and the transmitter is able to send a character with the parity bit high when a 1 is written to the SENTA bit in the
US_CR.
To handle parity error, the PARE bit is cleared when a 1 is written to the RSTSTA bit in the US_CR.
The transmitter sends an address byte (parity bit set) when SENDA is written to in the US_CR. In this case, the
next byte written to the US_THR is transmitted as an address. Any character written in the US_THR without having
written the command SENDA is transmitted normally with the parity at 0.
44.6.3.10Transmitter Timeguard
The timeguard feature enables the USART interface with slow remote devices.
The timeguard function enables the transmitter to insert an idle state on the TXD line between two characters. This
idle state actually acts as a long stop bit.
The duration of the idle state is programmed in the TG field of the Transmitter Timeguard register (US_TTGR).
When this field is written to zero no timeguard is generated. Otherwise, the transmitter holds a high level on TXD
after each transmitted byte during the number of bit periods programmed in TG in addition to the number of stop
bits.
As illustrated in Figure 44-22, the behavior of TXRDY and TXEMPTY status bits is modified by the programming of
a timeguard. TXRDY rises only when the start bit of the next character is sent, and thus remains to 0 during the
timeguard transmission if a character has been written in US_THR. TXEMPTY remains low until the timeguard
transmission is completed as the timeguard is part of the current character being transmitted.
1329
TG = 4
Baud Rate
Clock
TXD
Start
D0
Bit
D1
D2
D3
D4
D5
D6
D7
Parity Stop
Bit Bit
Start
D0
Bit
D1
D2
D3
D4
D5
D6
D7
Parity Stop
Bit Bit
Write
US_THR
TXRDY
TXEMPTY
Table 44-9 indicates the maximum length of a timeguard period that the transmitter can handle in relation to the
function of the baud rate.
Table 44-9.
Timeguard (ms)
1,200
833
212.50
9,600
104
26.56
14,400
69.4
17.71
19,200
52.1
13.28
28,800
34.7
8.85
38,400
26
6.63
56,000
17.9
4.55
57,600
17.4
4.43
115,200
8.7
2.21
44.6.3.11Receiver Time-out
The Receiver Time-out provides support in handling variable-length frames. This feature detects an idle condition
on the RXD line. When a time-out is detected, the bit TIMEOUT in the US_CSR rises and can generate an
interrupt, thus indicating to the driver an end of frame.
The time-out delay period (during which the receiver waits for a new character) is programmed in the TO field of
the Receiver Time-out register (US_RTOR). If the TO field is written to 0, the Receiver Time-out is disabled and no
time-out is detected. The TIMEOUT bit in the US_CSR remains at 0. Otherwise, the receiver loads a 16-bit counter
with the value programmed in TO. This counter is decremented at each bit period and reloaded each time a new
character is received. If the counter reaches 0, the TIMEOUT bit in US_CSR rises. Then, the user can either:
1330
Stop the counter clock until a new character is received. This is performed by writing a 1 to the STTTO (Start
Time-out) bit in the US_CR. In this case, the idle state 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 a 1 to the RETTO (Reload
and Start Time-out) bit in the US_CR. 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 44-23 shows the block diagram of the Receiver Time-out feature.
Figure 44-23. Receiver Time-out Block Diagram
TO
Baud Rate
Clock
Clock
16-bit Time-out
Counter
16-bit
Value
=
STTTO
Character
Received
RETTO
Load
Clear
TIMEOUT
Table 44-10 gives the maximum time-out period for some standard baud rates.
Table 44-10.
Time-out (ms)
600
1,667
109,225
1,200
833
54,613
2,400
417
27,306
4,800
208
13,653
9,600
104
6,827
14,400
69
4,551
19,200
52
3,413
28,800
35
2,276
38,400
26
1,704
56,000
18
1,170
57,600
17
1,138
200,000
328
44.6.3.12Framing Error
The receiver is capable of detecting framing errors. A framing error happens when the stop bit of a received
character is detected at level 0. This can occur if the receiver and the transmitter are fully desynchronized.
A framing error is reported on the FRAME bit of US_CSR. The FRAME bit is asserted in the middle of the stop bit
as soon as the framing error is detected. It is cleared by writing a 1 to the RSTSTA bit in the US_CR.
1331
D1
D2
D3
D4
D5
D6
D7
Parity Stop
Bit Bit
RSTSTA = 1
Write
US_CR
FRAME
RXRDY
44.6.3.13Transmit Break
The user can request the transmitter to generate a break condition on the TXD line. A break condition drives the
TXD line low during at least one complete character. It appears the same as a 0x00 character sent with the parity
and the stop bits at 0. However, the transmitter holds the TXD line at least during one character until the user
requests the break condition to be removed.
A break is transmitted by writing a 1 to the STTBRK bit in the US_CR. This can be performed at any time, either
while the transmitter is empty (no character in either the Shift register or in US_THR) or when a character is being
transmitted. If a break is requested while a character is being shifted out, the character is first completed before the
TXD line is held low.
Once STTBRK command is requested further STTBRK commands are ignored until the end of the break is
completed.
The break condition is removed by writing a 1 to the STPBRK bit in the US_CR. If the STPBRK is requested before
the end of the minimum break duration (one character, including start, data, parity and stop bits), the transmitter
ensures that the break condition completes.
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 to 1 and the start of the break condition clears the TXRDY
and TXEMPTY bits as if a character is processed.
Writing US_CR with both STTBRK and STPBRK bits to 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 44-25 illustrates the effect of both the Start Break (STTBRK) and Stop Break (STPBRK) commands on the
TXD line.
1332
D1
D2
D3
D4
D5
D6
D7
Parity Stop
Bit Bit
STTBRK = 1
Break Transmission
End of Break
STPBRK = 1
Write
US_CR
TXRDY
TXEMPTY
44.6.3.14Receive Break
The receiver detects a break condition when all data, parity and stop bits are low. This corresponds to detecting a
framing error with data to 0x00, but FRAME remains low.
When the low stop bit is detected, the receiver asserts the RXBRK bit in US_CSR. This bit may be cleared by
writing a 1 to the RSTSTA bit in the US_CR.
An end of receive break is detected by a high level for at least 2/16 of a bit period in Asynchronous operating mode
or one sample at high level in Synchronous operating mode. The end of break detection also asserts the RXBRK
bit.
44.6.3.15Hardware Handshaking
The USART features a hardware handshaking out-of-band flow control. The RTS and CTS pins are used to
connect with the remote device, as shown in Figure 44-26.
Figure 44-26. Connection with a Remote Device for Hardware Handshaking
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
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
DMACchannel for reception. The transmitter can handle hardware handshaking in any case.
Figure 44-27 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.
1333
The ISO7816 is a half duplex communication on only one bidirectional line. The baud rate is determined by a
division of the clock provided to the remote device (see Section 44-2 Baud Rate Generator).
The USART connects to a smart card as shown in Figure 44-28. The TXD line becomes bidirectional and the baud
rate generator feeds the ISO7816 clock on the SCK pin. As the TXD pin becomes bidirectional, its output remains
driven by the output of the transmitter but only when the transmitter is active while its input is directed to the input
of the receiver. The USART is considered as the master of the communication as it generates the clock.
Figure 44-28. Connection of a Smart Card to the USART
USART
SCK
TXD
CLK
I/O
Smart
Card
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 programmed 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 Section 44.7.3 USART Mode Register and PAR: Parity Type .
The USART cannot operate concurrently in both Receiver and Transmitter modes as the communication 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.
44.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 44-29.
If a parity error is detected by the receiver, it drives the I/O line to 0 during the guard time, as shown in Figure 4430. 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.
1334
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 register (US_SR) so that the software
can handle the error.
Figure 44-29. T = 0 Protocol without Parity Error
Baud Rate
Clock
RXD
Start
Bit
D0
D1
D2
D3
D4
D5
D6
D7
I/O
Start
Bit
D0
D1
D2
D3
D4
D5
D6
D7
Parity Guard
Bit Time 1
Guard Start
Time 2 Bit
D0
D1
Repetition
1335
44.6.4.3 Protocol T = 1
When operating in ISO7816 protocol T = 1, the transmission is similar to an asynchronous format with only one
stop bit. The parity is generated when transmitting and checked when receiving. Parity error detection sets the
PARE bit in the US_CSR.
44.6.5 IrDA Mode
The USART features an IrDA mode supplying half-duplex point-to-point wireless communication. It embeds the
modulator and demodulator which allows a glueless connection to the infrared transceivers, as shown in Figure
44-31. The modulator and demodulator are compliant with the IrDA specification version 1.1 and support data
transfer speeds ranging from 2.4 Kb/s to 115.2 Kb/s.
The IrDA mode is enabled by setting the USART_MODE field in US_MR to the value 0x8. The IrDA Filter register
(US_IF) is used to configure the demodulator filter. The USART transmitter and receiver operate in a normal
Asynchronous mode and all parameters are accessible. Note that the modulator and the demodulator are
activated.
Figure 44-31. Connection to IrDA Transceivers
USART
IrDA
Transceivers
Receiver
Demodulator
RXD
Transmitter
Modulator
TXD
RX
TX
The receiver and the transmitter must be enabled or disabled depending on the direction of the transmission to be
managed.
To receive IrDA signals, the following needs to be done:
Configure the TXD pin as PIO and set it as an output to 0 (to avoid LED emission). Disable the internal pullup (better for power consumption).
Receive data
For baud rates up to and including 115.2 Kb/s, the RZI modulation scheme is used. 0 is represented by a light
pulse of 3/16th of a bit time. Some examples of signal pulse duration are shown in Table 44-11.
Table 44-11.
Baud Rate
2.4 Kb/s
78.13 s
9.6 Kb/s
19.53 s
19.2 Kb/s
9.77 s
38.4 Kb/s
4.88 s
57.6 Kb/s
3.26 s
115.2 Kb/s
1.63 s
Stop
Bit
Data Bits
0
TXD
Bit Period
Table 44-12 gives some examples of CD values, baud rate error and pulse duration. Note that the requirement on
the maximum acceptable error of 1.87% must be met.
Table 44-12.
Peripheral Clock
CD
3,686,400
115,200
0.00%
1.63
20,000,000
115,200
11
1.38%
1.63
32,768,000
115,200
18
1.25%
1.63
40,000,000
115,200
22
1.38%
1.63
3,686,400
57,600
0.00%
3.26
20,000,000
57,600
22
1.38%
3.26
32,768,000
57,600
36
1.25%
3.26
40,000,000
57,600
43
0.93%
3.26
3,686,400
38,400
0.00%
4.88
20,000,000
38,400
33
1.38%
4.88
32,768,000
38,400
53
0.63%
4.88
40,000,000
38,400
65
0.16%
4.88
3,686,400
19,200
12
0.00%
9.77
20,000,000
19,200
65
0.16%
9.77
32,768,000
19,200
107
0.31%
9.77
40,000,000
19,200
130
0.16%
9.77
3,686,400
9,600
24
0.00%
19.53
20,000,000
9,600
130
0.16%
19.53
32,768,000
9,600
213
0.16%
19.53
40,000,000
9,600
260
0.16%
19.53
3,686,400
2,400
96
0.00%
78.13
20,000,000
2,400
521
0.03%
78.13
32,768,000
2,400
853
0.04%
78.13
1337
The demodulator is based on the IrDA Receive filter comprised of an 8-bit down counter which is loaded with the
value programmed in US_IF. When a falling edge is detected on the RXD pin, the Filter Counter starts counting
down at the peripheral clock speed. If a rising edge is detected on the RXD pin, the counter stops and is reloaded
with US_IF. If no rising edge is detected when the counter reaches 0, the input of the receiver is driven low during
one bit time.
Figure 44-33 illustrates the operations of the IrDA demodulator.
Figure 44-33. IrDA Demodulator Operations
MCK
RXD
Counter
Value
Receiver
Input
4 3
Pulse
Rejected
Pulse
Accepted
The programmed value in the US_IF register must always meet the following criteria:
tperipheral clock (IRDA_FILTER + 3) < 1.41 s
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.
44.6.6 RS485 Mode
The USART features the RS485 mode to enable line driver control. While operating in RS485 mode, the USART
behaves as though in Asynchronous or Synchronous mode and configuration of all the parameters is possible.
The difference is that the RTS pin is driven high when the transmitter is operating. The behavior of the RTS pin is
controlled by the TXEMPTY bit. A typical connection of the USART to an RS485 bus is shown in Figure 44-34.
Figure 44-34. Typical Connection to a RS485 Bus
USART
RXD
TXD
Differential
Bus
RTS
The USART is set in RS485 mode by writing the value 0x1 to the USART_MODE field in US_MR.
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 completion. Figure 44-35 gives an example
of the RTS waveform during a character transmission when the timeguard is enabled.
1338
1
Baud Rate
Clock
TXD
Start
D0
Bit
D1
D2
D3
D4
D5
D6
D7
Parity Stop
Bit Bit
RTS
Write
US_THR
TXRDY
TXEMPTY
Master Out Slave In (MOSI): This data line supplies the output data from the master shifted into the input of
the slave.
Master In Slave Out (MISO): This data line supplies the output data from a slave to the input of the master.
Serial Clock (SCK): 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 SCK line cycles once for each bit that is
transmitted.
Slave Select (NSS): This control line allows the master to select or deselect the slave.
The USART can operate in SPI Master mode or in SPI Slave mode.
Operation in SPI Master mode is programmed by writing 0xE to the USART_MODE field in US_MR. In this case
the SPI lines must be connected as described below:
1339
Operation in SPI Slave mode is programmed by writing to 0xF the USART_MODE field in US_MR. In this case the
SPI lines must be connected as described below:
In order to avoid unpredictable behavior, any change of the SPI mode must be followed by a software reset of the
transmitter and of the receiver (except the initial configuration after a hardware reset). (See Section 44.6.7.4).
44.6.7.2 Baud Rate
In SPI mode, the baud rate generator operates in the same way as in USART Synchronous mode. See Section
44.6.1.3 Baud Rate in Synchronous Mode or SPI Mode However, there are some restrictions:
In SPI Master mode:
The external clock SCK must not be selected (USCLKS 0x3), and the bit CLKO must be set to 1 in the
US_MR, in order to generate correctly the serial clock on the SCK pin.
To obtain correct behavior of the receiver and the transmitter, the value programmed in CD must be superior
or equal to 6.
If the divided peripheral clock is selected, the value programmed in CD must be even to ensure a 50:50
mark/space ratio on the SCK pin, this value can be odd if the peripheral clock is selected.
The external clock (SCK) selection is forced regardless of the value of the USCLKS field in the US_MR.
Likewise, the value written in US_BRGR has no effect, because the clock is provided directly by the signal
on the USART SCK pin.
To obtain correct behavior of the receiver and the transmitter, the external clock (SCK) frequency must be at
least 6 times lower than the system clock.
Up to nine data bits are successively shifted out on the TXD pin at each rising or falling edge (depending of CPOL
and CPHA) of the programmed serial clock. There is no Start bit, no Parity bit and no Stop bit.
The number of data bits is selected by the CHRL field and the MODE 9 bit in the US_MR. The nine bits are
selected by setting the MODE 9 bit regardless of the CHRL field. The MSB data bit is always sent first in SPI mode
(Master or Slave).
Four combinations of polarity and phase are available for data transfers. The clock polarity is programmed with the
CPOL bit in the US_MR. The clock phase is programmed with the CPHA bit. These two parameters determine the
edges of the clock signal upon which data is driven and sampled. Each of the two parameters has two possible
states, resulting in four possible combinations that are incompatible with one another. Thus, a master/slave pair
must use the same parameter pair values to communicate. If multiple slaves are used and fixed in different
configurations, the master must reconfigure itself each time it needs to communicate with a different slave.
Table 44-13.
1340
CPOL
CPHA
SCK
(CPOL = 0)
SCK
(CPOL = 1)
MOSI
SPI Master ->TXD
SPI Slave -> RXD
MISO
SPI Master -> RXD
SPI Slave -> TXD
MSB
MSB
LSB
LSB
NSS
SPI Master -> RTS
SPI Slave -> CTS
SCK
(CPOL = 0)
SCK
(CPOL = 1)
MOSI
SPI Master -> TXD
SPI Slave -> RXD
MSB
LSB
MISO
SPI Master -> RXD
SPI Slave -> TXD
MSB
LSB
NSS
SPI Master -> RTS
SPI Slave -> CTS
1341
The characters are sent by writing in the Transmit Holding register (US_THR). An additional condition for
transmitting a character can be added when the USART is configured in SPI Master mode. In the USART Mode
Register (SPI_MODE) (USART_MR), the value configured on the bit WRDBT can prevent any character
transmission (even if US_THR has been written) while the receiver side is not ready (character not read). When
WRDBT equals 0, the character is transmitted whatever the receiver status. If WRDBT is set to 1, the transmitter
waits for the Receive Holding register (US_RHR) to be read before transmitting the character (RXRDY flag
cleared), thus preventing any overflow (character loss) on the receiver side.
The transmitter reports two status bits in 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.
If the USART is in SPI Slave mode and if a character must be sent while the US_THR is empty, the UNRE
(Underrun Error) bit is set. The TXD transmission line stays at high level during all this time. The UNRE bit is
cleared by writing a 1 to the RSTSTA (Reset Status) bit in US_CR.
In SPI Master mode, the slave select line (NSS) is asserted at low level one tbit (tbit being the nominal time required
to transmit a bit) before the transmission of the MSB bit and released at high level one tbit after the transmission of
the LSB bit. So, the slave select line (NSS) is always released between each character transmission and a
minimum delay of three tbit always inserted. However, in order to address slave devices supporting the CSAAT
mode (Chip Select Active After Transfer), the slave select line (NSS) can be forced at low level by writing a 1 to the
RTSEN bit in the US_CR. The slave select line (NSS) can be released at high level only by writing a 1 to the
RTSDIS bit in the US_CR (for example, when all data have been transferred to the slave device).
In SPI Slave mode, the transmitter does not require a falling edge of the slave select line (NSS) to initiate a
character transmission but only a low level. However, this low level must be present on the slave select line (NSS)
at least one tbit before the first serial clock cycle corresponding to the MSB bit.
44.6.7.6 Character Reception
When a character reception is completed, it is transferred to the Receive Holding register (US_RHR) and the
RXRDY bit in the Status register (US_CSR) rises. If a character is completed while RXRDY is set, the OVRE
(Overrun Error) bit is set. The last character is transferred into US_RHR and overwrites the previous one. The
OVRE bit is cleared by writing a 1 to the RSTSTA (Reset Status) bit in the US_CR.
To ensure correct behavior of the receiver in SPI Slave mode, the master device sending the frame must ensure a
minimum delay of one tbit between each character transmission. The receiver does not require a falling edge of the
slave select line (NSS) to initiate a character reception but only a low level. However, this low level must be
present on the slave select line (NSS) at least one tbit before the first serial clock cycle corresponding to the MSB
bit.
44.6.7.7 Receiver Timeout
Because the receiver baud rate clock is active only during data transfers in SPI mode, a receiver timeout is
impossible in this mode, whatever the time-out value is (field TO) in the US_RTOR.
1342
Normal mode connects the RXD pin on the receiver input and the transmitter output on the TXD pin.
Figure 44-38. Normal Mode Configuration
RXD
Receiver
TXD
Transmitter
Automatic echo mode allows bit-by-bit retransmission. When a bit is received on the RXD pin, it is sent to the TXD
pin, as shown in Figure 44-39. Programming the transmitter has no effect on the TXD pin. The RXD pin is still
connected to the receiver input, thus the receiver remains active.
Figure 44-39. Automatic Echo Mode Configuration
RXD
Receiver
TXD
Transmitter
Local loopback mode connects the output of the transmitter directly to the input of the receiver, as shown in Figure
44-40. The TXD and RXD pins are not used. The RXD pin has no effect on the receiver and the TXD pin is
continuously driven high, as in idle state.
Figure 44-40. Local Loopback Mode Configuration
RXD
Receiver
Transmitter
TXD
Remote loopback mode directly connects the RXD pin to the TXD pin, as shown in Figure 44-41. The transmitter
and the receiver are disabled and have no effect. This mode allows bit-by-bit retransmission.
1343
RXD
TXD
Transmitter
1344
44.7
Table 44-14.
Register Mapping
Offset
Register
Name
Access
Reset
0x0000
Control Register
US_CR
Write-only
0x0004
Mode Register
US_MR
Read/Write
0x0
0x0008
US_IER
Write-only
0x000C
US_IDR
Write-only
0x0010
US_IMR
Read-only
0x0
0x0014
US_CSR
Read-only
0x0
0x0018
US_RHR
Read-only
0x0
0x001C
US_THR
Write-only
0x0020
US_BRGR
Read/Write
0x0
0x0024
US_RTOR
Read/Write
0x0
0x0028
US_TTGR
Read/Write
0x0
Reserved
0x0040
FI DI Ratio Register
US_FIDI
Read/Write
0x174
0x0044
US_NER
Read-only
0x0
0x0048
Reserved
0x004C
US_IF
Read/Write
0x0
0x0050
US_MAN
Read/Write
0x30011004
0x00540x005C
Reserved
0x00600x00E0
Reserved
0x00E4
US_WPMR
Read/Write
0x0
0x00E8
US_WPSR
Read-only
0x0
Reserved
0x2C0x3C
0x00EC0x00FC
1345
US_CR
Address:
0xF802C000 (0), 0xF8030000 (1), 0xFC008000 (2), 0xFC00C000 (3), 0xFC010000 (4)
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
RTSDIS
18
RTSEN
17
16
15
RETTO
14
RSTNACK
13
RSTIT
12
SENDA
11
STTTO
10
STPBRK
9
STTBRK
8
RSTSTA
7
TXDIS
6
TXEN
5
RXDIS
4
RXEN
3
RSTTX
2
RSTRX
For SPI control, see Section 44.7.2 USART Control Register (SPI_MODE).
RSTRX: Reset Receiver
0: No effect.
1: Resets the receiver.
RSTTX: Reset Transmitter
0: No effect.
1: Resets the transmitter.
RXEN: Receiver Enable
0: No effect.
1: Enables the receiver, if RXDIS is 0.
RXDIS: Receiver Disable
0: No effect.
1: Disables the receiver.
TXEN: Transmitter Enable
0: No effect.
1: Enables the transmitter if TXDIS is 0.
TXDIS: Transmitter Disable
0: No effect.
1: Disables the transmitter.
RSTSTA: Reset Status Bits
0: No effect.
1: Resets the status bits PARE, FRAME, OVRE, MANERR and RXBRK in US_CSR.
1346
1347
US_CR (SPI_MODE)
Address:
0xF802C000 (0), 0xF8030000 (1), 0xFC008000 (2), 0xFC00C000 (3), 0xFC010000 (4)
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
RCS
18
FCS
17
16
15
14
13
12
11
10
8
RSTSTA
7
TXDIS
6
TXEN
5
RXDIS
4
RXEN
3
RSTTX
2
RSTRX
This configuration is relevant only if USART_MODE = 0xE or 0xF in the USART Mode Register.
RSTRX: Reset Receiver
0: No effect.
1: Resets the receiver.
RSTTX: Reset Transmitter
0: No effect.
1: Resets the transmitter.
RXEN: Receiver Enable
0: No effect.
1: Enables the receiver, if RXDIS is 0.
RXDIS: Receiver Disable
0: No effect.
1: Disables the receiver.
TXEN: Transmitter Enable
0: No effect.
1: Enables the transmitter if TXDIS is 0.
TXDIS: Transmitter Disable
0: No effect.
1: Disables the transmitter.
RSTSTA: Reset Status Bits
0: No effect.
1: Resets the status bits OVRE, UNRE in US_CSR.
1348
1349
US_MR
Address:
0xF802C004 (0), 0xF8030004 (1), 0xFC008004 (2), 0xFC00C004 (3), 0xFC010004 (4)
Access:
Read/Write
31
ONEBIT
30
MODSYNC
29
MAN
28
FILTER
27
26
25
MAX_ITERATION
24
23
INVDATA
22
VAR_SYNC
21
DSNACK
20
INACK
19
OVER
18
CLKO
17
MODE9
16
MSBF
15
14
13
12
11
10
PAR
8
SYNC
CHMODE
7
NBSTOP
6
CHRL
USCLKS
USART_MODE
This register can only be written if the WPEN bit is cleared in the USART Write Protection Mode Register.
For SPI configuration, see Section 44.7.4 USART Mode Register (SPI_MODE).
USART_MODE: USART Mode of Operation
Value
Name
Description
0x0
NORMAL
Normal mode
0x1
RS485
0x2
HW_HANDSHAKING
0x3
0x4
IS07816_T_0
IS07816 Protocol: T = 0
0x6
IS07816_T_1
IS07816 Protocol: T = 1
0x8
IRDA
0xE
SPI_MASTER
SPI master
0xF
SPI_SLAVE
SPI Slave
RS485
Hardware Handshaking
Reserved
IrDA
Name
Description
MCK
DIV
SCK
1350
Reserved
Serial clock (SCK) is selected
Name
Description
5_BIT
6_BIT
7_BIT
8_BIT
Name
Description
EVEN
Even parity
ODD
Odd parity
SPACE
MARK
NO
MULTIDROP
No parity
Multidrop mode
Name
Description
1_BIT
1 stop bit
1_5_BIT
2_BIT
Name
Description
NORMAL
Normal mode
AUTOMATIC
LOCAL_LOOPBACK
REMOTE_LOOPBACK
1351
1352
1353
US_MR (SPI_MODE)
Address:
0xF802C004 (0), 0xF8030004 (1), 0xFC008004 (2), 0xFC00C004 (3), 0xFC010004 (4)
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
WRDBT
19
18
CLKO
17
16
CPOL
15
14
13
12
11
10
8
CPHA
7
CHRL
USCLKS
USART_MODE
This configuration is relevant only if USART_MODE = 0xE or 0xF in the USART Mode Register.
This register can only be written if the WPEN bit is cleared in the USART Write Protection Mode Register.
USART_MODE: USART Mode of Operation
Value
Name
Description
0xE
SPI_MASTER
SPI master
0xF
SPI_SLAVE
SPI Slave
Name
Description
MCK
DIV
SCK
Name
Description
8_BIT
1354
1355
US_IER
Address:
0xF802C008 (0), 0xF8030008 (1), 0xFC008008 (2), 0xFC00C008 (3), 0xFC010008 (4)
Access:
Write-only
31
30
29
28
27
26
25
24
MANE
23
22
21
20
19
CTSIC
18
17
16
15
14
13
NACK
12
11
10
ITER
9
TXEMPTY
8
TIMEOUT
7
PARE
6
FRAME
5
OVRE
2
RXBRK
1
TXRDY
0
RXRDY
For SPI specific configuration, see Section 44.7.6 USART Interrupt Enable Register (SPI_MODE).
The following configuration values are valid for all listed bit names of this register:
0: No effect
1: Enables the corresponding interrupt.
RXRDY: RXRDY Interrupt Enable
TXRDY: TXRDY Interrupt Enable
RXBRK: Receiver Break Interrupt Enable
OVRE: Overrun Error Interrupt Enable
FRAME: Framing Error Interrupt Enable
PARE: Parity Error Interrupt Enable
TIMEOUT: Time-out Interrupt Enable
TXEMPTY: TXEMPTY Interrupt Enable
ITER: Max number of Repetitions Reached Interrupt Enable
NACK: Non Acknowledge Interrupt Enable
CTSIC: Clear to Send Input Change Interrupt Enable
MANE: Manchester Error Interrupt Enable
1356
US_IER (SPI_MODE)
Address:
0xF802C008 (0), 0xF8030008 (1), 0xFC008008 (2), 0xFC00C008 (3), 0xFC010008 (4)
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
UNRE
9
TXEMPTY
5
OVRE
1
TXRDY
0
RXRDY
This configuration is relevant only if USART_MODE = 0xE or 0xF in the USART Mode Register.
The following configuration values are valid for all listed bit names of this register:
0: No effect
1: Enables the corresponding interrupt.
RXRDY: RXRDY Interrupt Enable
TXRDY: TXRDY Interrupt Enable
OVRE: Overrun Error Interrupt Enable
TXEMPTY: TXEMPTY Interrupt Enable
UNRE: SPI Underrun Error Interrupt Enable
1357
US_IDR
Address:
0xF802C00C (0), 0xF803000C (1), 0xFC00800C (2), 0xFC00C00C (3), 0xFC01000C (4)
Access:
Write-only
31
30
29
28
27
26
25
24
MANE
23
22
21
20
19
CTSIC
18
17
16
15
14
13
NACK
12
11
10
ITER
9
TXEMPTY
8
TIMEOUT
7
PARE
6
FRAME
5
OVRE
2
RXBRK
1
TXRDY
0
RXRDY
For SPI specific configuration, see Section 44.7.8 USART Interrupt Disable Register (SPI_MODE).
The following configuration values are valid for all listed bit names of this register:
0: No effect
1: Disables the corresponding interrupt.
RXRDY: RXRDY Interrupt Disable
TXRDY: TXRDY Interrupt Disable
RXBRK: Receiver Break Interrupt Disable
OVRE: Overrun Error Interrupt Enable
FRAME: Framing Error Interrupt Disable
PARE: Parity Error Interrupt Disable
TIMEOUT: Time-out Interrupt Disable
TXEMPTY: TXEMPTY Interrupt Disable
ITER: Max Number of Repetitions Reached Interrupt Disable
NACK: Non Acknowledge Interrupt Disable
CTSIC: Clear to Send Input Change Interrupt Disable
MANE: Manchester Error Interrupt Disable
1358
US_IDR (SPI_MODE)
Address:
0xF802C00C (0), 0xF803000C (1), 0xFC00800C (2), 0xFC00C00C (3), 0xFC01000C (4)
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
UNRE
9
TXEMPTY
5
OVRE
1
TXRDY
0
RXRDY
This configuration is relevant only if USART_MODE = 0xE or 0xF in the USART Mode Register.
The following configuration values are valid for all listed bit names of this register:
0: No effect
1: Disables the corresponding interrupt.
RXRDY: RXRDY Interrupt Disable
TXRDY: TXRDY Interrupt Disable
OVRE: Overrun Error Interrupt Disable
TXEMPTY: TXEMPTY Interrupt Disable
UNRE: SPI Underrun Error Interrupt Disable
1359
44.7.9
Name:
US_IMR
Address:
0xF802C010 (0), 0xF8030010 (1), 0xFC008010 (2), 0xFC00C010 (3), 0xFC010010 (4)
Access:
Read-only
31
30
29
28
27
26
25
24
MANE
23
22
21
20
19
CTSIC
18
17
16
15
14
13
NACK
12
11
10
ITER
9
TXEMPTY
8
TIMEOUT
7
PARE
6
FRAME
5
OVRE
2
RXBRK
1
TXRDY
0
RXRDY
For SPI specific configuration, see Section 44.7.10 USART Interrupt Mask Register (SPI_MODE).
The following configuration values are valid for all listed bit names of this register:
0: The corresponding interrupt is not enabled.
1: The corresponding interrupt is enabled.
RXRDY: RXRDY Interrupt Mask
TXRDY: TXRDY Interrupt Mask
RXBRK: Receiver Break Interrupt Mask
OVRE: Overrun Error Interrupt Mask
FRAME: Framing Error Interrupt Mask
PARE: Parity Error Interrupt Mask
TIMEOUT: Time-out Interrupt Mask
TXEMPTY: TXEMPTY Interrupt Mask
ITER: Max Number of Repetitions Reached Interrupt Mask
NACK: Non Acknowledge Interrupt Mask
CTSIC: Clear to Send Input Change Interrupt Mask
MANE: Manchester Error Interrupt Mask
1360
US_IMR (SPI_MODE)
Address:
0xF802C010 (0), 0xF8030010 (1), 0xFC008010 (2), 0xFC00C010 (3), 0xFC010010 (4)
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
UNRE
9
TXEMPTY
5
OVRE
1
TXRDY
0
RXRDY
This configuration is relevant only if USART_MODE = 0xE or 0xF in the USART Mode Register.
The following configuration values are valid for all listed bit names of this register:
0: The corresponding interrupt is not enabled.
1: The corresponding interrupt is enabled.
RXRDY: RXRDY Interrupt Mask
TXRDY: TXRDY Interrupt Mask
OVRE: Overrun Error Interrupt Mask
TXEMPTY: TXEMPTY Interrupt Mask
UNRE: SPI Underrun Error Interrupt Mask
1361
US_CSR
Address:
0xF802C014 (0), 0xF8030014 (1), 0xFC008014 (2), 0xFC00C014 (3), 0xFC010014 (4)
Access:
Read-only
31
30
29
28
27
26
25
24
MANERR
23
CTS
22
21
20
19
CTSIC
18
17
16
15
14
13
NACK
12
11
10
ITER
9
TXEMPTY
8
TIMEOUT
7
PARE
6
FRAME
5
OVRE
2
RXBRK
1
TXRDY
0
RXRDY
For SPI specific configuration, see Section 44.7.12 USART Channel Status Register (SPI_MODE).
RXRDY: Receiver Ready (automatically set / reset)
0: No complete character has been received since the last read of US_RHR or the receiver is disabled. If characters were
being received when the receiver was disabled, RXRDY changes to 1 when the receiver is enabled.
1: At least one complete character has been received and US_RHR has not yet been read.
TXRDY: Transmitter Ready (automatically set / reset)
0: A character is in the US_THR waiting to be transferred to the Transmit Shift Register, or an STTBRK command has
been requested, or the transmitter is disabled. As soon as the transmitter is enabled, TXRDY becomes 1.
1: There is no character in the US_THR.
RXBRK: Break Received/End of Break (cleared by US_CR.RSTSTA command)
0: No break received or end of break detected since the last RSTSTA.
1: Break received or end of break detected since the last RSTSTA.
1362
1363
US_CSR (SPI_MODE)
Address:
0xF802C014 (0), 0xF8030014 (1), 0xFC008014 (2), 0xFC00C014 (3), 0xFC010014 (4)
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
UNRE
9
TXEMPTY
5
OVRE
1
TXRDY
0
RXRDY
This configuration is relevant only if USART_MODE = 0xE or 0xF in the USART Mode Register.
RXRDY: Receiver Ready (automatically set / reset)
0: No complete character has been received since the last read of US_RHR or the receiver is disabled. If characters were
being received when the receiver was disabled, RXRDY changes to 1 when the receiver is enabled.
1: At least one complete character has been received and US_RHR has not yet been read.
TXRDY: Transmitter Ready (automatically set / reset)
0: A character is in the US_THR waiting to be transferred to the Transmit Shift Register or the transmitter is disabled. As
soon as the transmitter is enabled, TXRDY becomes 1.
1: There is no character in the US_THR.
OVRE: Overrun Error
0: No overrun error has occurred since the last RSTSTA.
1: At least one overrun error has occurred since the last RSTSTA.
TXEMPTY: Transmitter Empty (automatically set / reset)
0: There are characters in either US_THR or the Transmit Shift Register, or the transmitter is disabled.
1: There are no characters in US_THR, nor in the Transmit Shift Register.
UNRE: Underrun Error
0: No SPI underrun error has occurred since the last RSTSTA.
1: At least one SPI underrun error has occurred since the last RSTSTA.
1364
US_RHR
Address:
0xF802C018 (0), 0xF8030018 (1), 0xFC008018 (2), 0xFC00C018 (3), 0xFC010018 (4)
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
RXSYNH
14
13
12
11
10
8
RXCHR
RXCHR
1365
US_THR
Address:
0xF802C01C (0), 0xF803001C (1), 0xFC00801C (2), 0xFC00C01C (3), 0xFC01001C (4)
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
TXSYNH
14
13
12
11
10
8
TXCHR
TXCHR
1366
US_BRGR
Address:
0xF802C020 (0), 0xF8030020 (1), 0xFC008020 (2), 0xFC00C020 (3), 0xFC010020 (4)
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
FP
16
15
14
13
12
11
10
CD
7
4
CD
This register can only be written if the WPEN bit is cleared in the USART Write Protection Mode Register.
CD: Clock Divider
USART_MODE ISO7816
SYNC = 0
CD
OVER = 0
OVER = 1
0
1 to 65535
SYNC = 1
or
USART_MODE = SPI
(Master or Slave)
USART_MODE = ISO7816
Baud Rate =
Baud Rate =
Baud Rate =
Selected Clock / CD
1367
US_RTOR
Address:
0xF802C024 (0), 0xF8030024 (1), 0xFC008024 (2), 0xFC00C024 (3), 0xFC010024 (4)
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
TO
7
4
TO
This register can only be written if the WPEN bit is cleared in the USART Write Protection Mode Register.
TO: Time-out Value
0: The receiver time-out is disabled.
165535: The receiver time-out is enabled and the time-out delay is TO x bit period.
1368
US_TTGR
Address:
0xF802C028 (0), 0xF8030028 (1), 0xFC008028 (2), 0xFC00C028 (3), 0xFC010028 (4)
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
TG
This register can only be written if the WPEN bit is cleared in the USART Write Protection Mode Register.
TG: Timeguard Value
0: The transmitter timeguard is disabled.
1255: The transmitter timeguard is enabled and the timeguard delay is TG x bit period.
1369
US_FIDI
Address:
0xF802C040 (0), 0xF8030040 (1), 0xFC008040 (2), 0xFC00C040 (3), 0xFC010040 (4)
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
FI_DI_RATIO
FI_DI_RATIO
This register can only be written if the WPEN bit is cleared in the USART Write Protection Mode Register.
1370
US_NER
Address:
0xF802C044 (0), 0xF8030044 (1), 0xFC008044 (2), 0xFC00C044 (3), 0xFC010044 (4)
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
NB_ERRORS
This register is relevant only if USART_MODE = 0x4 or 0x6 in the USART Mode Register.
NB_ERRORS: Number of Errors
Total number of errors that occurred during an ISO7816 transfer. This register automatically clears when read.
1371
US_IF
Address:
0xF802C04C (0), 0xF803004C (1), 0xFC00804C (2), 0xFC00C04C (3), 0xFC01004C (4)
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
IRDA_FILTER
This register is relevant only if USART_MODE = 0x8 in the USART Mode Register.
This register can only be written if the WPEN bit is cleared in the USART Write Protection Mode Register.
IRDA_FILTER: IrDA Filter
The IRDA_FILTER value must be defined to meet the following criteria:
tperipheral clock (IRDA_FILTER + 3) < 1.41 s
1372
US_MAN
Address:
0xF802C050 (0), 0xF8030050 (1), 0xFC008050 (2), 0xFC00C050 (3), 0xFC010050 (4)
Access:
Read/Write
31
30
DRIFT
29
ONE
28
RX_MPOL
27
26
25
23
22
21
20
19
18
17
15
14
13
12
TX_MPOL
11
10
24
RX_PP
16
RX_PL
8
TX_PP
0
TX_PL
This register can only be written if the WPEN bit is cleared in the USART Write Protection Mode Register.
TX_PL: Transmitter Preamble Length
0: The transmitter preamble pattern generation is disabled
115: The preamble length is TX_PL x Bit Period
TX_PP: Transmitter Preamble Pattern
The following values assume that TX_MPOL field is not set:
Value
Name
Description
ALL_ONE
ALL_ZERO
ZERO_ONE
ONE_ZERO
1373
Name
Description
00
ALL_ONE
01
ALL_ZERO
10
ZERO_ONE
11
ONE_ZERO
1374
US_WPMR
Address:
0xF802C0E4 (0), 0xF80300E4 (1), 0xFC0080E4 (2), 0xFC00C0E4 (3), 0xFC0100E4 (4)
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
WPKEY
23
22
21
20
WPKEY
15
14
13
12
WPKEY
7
WPEN
Name
0x555341
PASSWD
Description
Writing any other value in this field aborts the write operation of the WPEN bit. Always reads as
0.
1375
US_WPSR
Address:
0xF802C0E8 (0), 0xF80300E8 (1), 0xFC0080E8 (2), 0xFC00C0E8 (3), 0xFC0100E8 (4)
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
11
10
WPVSRC
15
14
13
12
WPVSRC
7
WPVS
1376
45.
45.1
Description
The Software Modem Device (SMD) is a block for communication via a modems Digital Isolation Barrier (DIB) with
a complementary Line Side Device (LSD).
SMD and LSD are two parts of the Transformer only solution. The transformer is the only component connecting
SMD and LSD and is used for power, clock and data transfers. Power and clock are supplied by the SMD and
consumed by the LSD. The data flow is bidirectional. The data transfer is based on pulse width modulation for
transmission from the SMD to the LSD, and for receiving from the LSD.
There are two channels embedded into the protocol of the DIB link:
Data channel
Control channel
1377
45.2
Embedded Characteristics
V.90
V.34
V.29 FastPOS
Call Waiting (CW) detection and Type II Caller ID decoding during data mode
Embedded AT commands
SmartDAA
45.3
Line-in-use detection
Worldwide compliance
Block Diagram
Figure 45-1.
AHB
1378
Control
Channel Logic
Control/Status
Registers
AHB
Wrapper
FIFO
Interface
8x32 (2)
DMA
Parallel
Interface
DMA Channel
Logic
Ring
Detection
and Pulse
Dialing
Machines
(masters)
FIFO 2x16
FIFO 2x16
DIB
Interface
Circuitry
DIB
Pads
X
X
45.4
Table 45-1.
Register Mapping
Offset
Register
Name
Access
Reset
0x0C
SMD_DRIVE
Read/Write
0x00000002
1379
SMD_DRIVE
Address:
0x0090000C
Access:
Read/Write
Reset:
0x00000002
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
3
PWRCLKP_P
V
2
PWRCLKP_P
V2
1
DC_PWRCL
KPN
PWRCLKP_PCS
PWRCLKN_PCS2
MIE
1380
1381
46.
46.1
Description
The Timer Counter (TC) includes three identical 32-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 interrupt signal which can be programmed to
generate processor interrupts.
The Timer Counter (TC) embeds a quadrature decoder logic connected in front of the timers and driven by TIOA0,
TIOB0 and TIOB1 inputs. When enabled, the quadrature decoder performs the input lines filtering, decoding of
quadrature signals and connects to the timers/counters in order to read the position and speed of the motor
through the user interface.
The Timer Counter block has two global registers which act upon all TC channels:
Block Control Register (TC_BCR)allows channels to be started simultaneously with the same instruction
Block Mode Register (TC_BMR)defines the external clock inputs for each channel, allowing them to be
chained
Table 46-1 gives the assignment of the device Timer Counter clock inputs common to Timer Counter 0 to 2.
Table 46-1.
Name
Definition
TIMER_CLOCK1
div2
TIMER_CLOCK2
div8
TIMER_CLOCK3
div32
TIMER_CLOCK4
div128
TIMER_CLOCK5(1)
slow_clock
Note:
1382
1.
When Slow Clock is selected for Peripheral Clock (CSS = 0 in PMC Master Clock Register), TIMER_CLOCK5
input is equivalent to Peripheral Clock.
46.2
Embedded Characteristics
Frequency measurement
Event counting
Interval measurement
Pulse generation
Delay timing
Up/down capabilities
1383
46.3
Block Diagram
Figure 46-1.
Parallel I/O
Controller
TIMER_CLOCK1
TCLK0
TIMER_CLOCK2
TIOA1
TIOA2
TIMER_CLOCK3
XC0
TCLK1
TIMER_CLOCK4
Timer/Counter
Channel 0
XC1
TCLK2
TIOB
XC2
TIMER_CLOCK5
TIOA
TC0XC0S
SYNC
TCLK0
TCLK1
TCLK2
TIOA0
TIOB0
TIOA0
TIOB0
INT0
TCLK0
TCLK1
XC0
TIOA0
TIOA2
TCLK2
Timer/Counter
Channel 1
XC1
TIOB
XC2
SYNC
TC1XC1S
TCLK0
XC0
TCLK1
XC1
TCLK2
XC2
Timer/Counter
Channel 2
SYNC
TC2XC2S
TIOA1
TIOB1
TIOA1
TIOB1
INT1
TIOA
TIOB
TIOA0
TIOA1
TIOA
TIOA2
TIOB2
TIOA2
TIOB2
INT2
FAULT
Timer Counter
PWM
Interrupt
Controller
Note: The quadrature decoder logic connections are detailed in Figure 46-17 Predefined Connection of the Quadrature Decoder with
Timer Counters
Table 46-2.
Block/Channel
Signal Name
XC0, XC1, XC2
Channel Signal
TIOA
TIOB
INT
SYNC
1384
Description
46.4
46.5
TC pin list
Pin Name
Description
Type
TCLK0TCLK2
Input
TIOA0TIOA2
I/O Line A
I/O
TIOB0TIOB2
I/O Line B
I/O
Product Dependencies
I/O Lines
Instance
Signal
I/O Line
Peripheral
TC0
TCLK0
PE17
TC0
TCLK1
PE14
TC0
TCLK2
PE11
TC0
TIOA0
PE15
TC0
TIOA1
PE12
TC0
TIOA2
PE9
TC0
TIOB0
PE16
TC0
TIOB1
PE13
TC0
TIOB2
PE10
TC1
TCLK3
PE8
TC1
TCLK4
PE23
TC1
TCLK5
PE20
TC1
TIOA3
PE6
TC1
TIOA4
PE21
TC1
TIOA5
PE18
TC1
TIOB3
PE7
TC1
TIOB4
PE22
TC1
TIOB5
PE19
1385
46.5.3 Interrupt
The TC has an interrupt line connected to the Interrupt Controller (IC). Handling the TC interrupt requires
programming the IC before configuring the TC.
46.5.4 Synchronization Inputs from PWM
The TC has trigger/capture inputs internally connected to the PWM. Refer to Section 46.6.14 Synchronization with
PWM and to the product Pulse Width Modulation (PWM) implementation.
46.5.5 Fault Output
The TC has the FAULT output internally connected to the fault input of PWM. Refer to Section 46.6.19 Fault
Mode and to the product Pulse Width Modulation (PWM) implementation.
46.6
Functional Description
46.6.1 TC Description
The three channels of the Timer Counter are independent and identical in operation except when quadrature
decoder is enabled. The registers for channel programming are listed in Table 46-5 Register Mapping.
46.6.2 32-bit Counter
Each channel is organized around a 32-bit counter. The value of the counter is incremented at each positive edge
of the selected clock. When the counter has reached the value 232-1 and passes to zero, an overflow occurs and
the COVFS bit in the TC Status Register (TC_SR) is set.
The current value of the counter is accessible in real time by reading the TC Counter Value Register (TC_CV). The
counter can be reset by a trigger. In this case, the counter value passes to zero on the next valid edge of the
selected clock.
46.6.3 Clock Selection
At block level, input clock signals of each channel can either be connected to the external inputs TCLK0, TCLK1 or
TCLK2, or be connected to the internal I/O signals TIOA0, TIOA1 or TIOA2 for chaining by programming the TC
Block Mode Register (TC_BMR). See Figure 46-2 Clock Chaining Selection.
Each channel can independently select an internal or external clock source for its counter:
This selection is made by the TCCLKS bits in the TC Channel Mode Register (TC_CMR).
The selected clock can be inverted with the CLKI bit in the TC_CMR. This allows counting on the opposite edges
of the clock.
The burst function allows the clock to be validated when an external signal is high. The BURST parameter in the
TC_CMR defines this signal (none, XC0, XC1, XC2). See Figure 46-3 Clock Selection.
Note:
1386
In all cases, if an external clock is used, the duration of each of its levels must be longer than the peripheral clock
period. The external clock frequency must be at least 2.5 times lower than the peripheral clock.
Figure 46-2.
TCLK0
TIOA1
XC0
TIOA2
TIOA0
XC1 = TCLK1
XC2 = TCLK2
TIOB0
SYNC
TC1XC1S
Timer/Counter
Channel 1
TCLK1
XC0 = TCLK0
TIOA0
TIOA1
XC1
TIOA2
XC2 = TCLK2
TIOB1
SYNC
Timer/Counter
Channel 2
TC2XC2S
XC0 = TCLK0
TCLK2
TIOA2
XC1 = TCLK1
TIOA0
XC2
TIOB2
TIOA1
SYNC
Figure 46-3.
Clock Selection
TCCLKS
CLKI
TIMER_CLOCK1
Synchronous
Edge Detection
TIMER_CLOCK2
TIMER_CLOCK3
Selected
Clock
TIMER_CLOCK4
TIMER_CLOCK5
XC0
XC1
XC2
Peripheral Clock
BURST
1387
The clock can be enabled or disabled by the user with the CLKEN and the CLKDIS commands in the TC
Channel Control Register (TC_CCR). In Capture Mode it can be disabled by an RB load event if LDBDIS is set
to 1 in the TC_CMR. In Waveform Mode, it can be disabled by an RC Compare event if CPCDIS is set to 1 in
TC_CMR. When disabled, the start or the stop actions have no effect: only a CLKEN command in the
TC_CCR can re-enable the clock. When the clock is enabled, the CLKSTA bit is set in the TC_SR.
The clock can also be started or stopped: a trigger (software, synchro, external or compare) always starts the
clock. The clock can be stopped by an RB load event in Capture Mode (LDBSTOP = 1 in TC_CMR) or a RC
compare event in Waveform Mode (CPCSTOP = 1 in TC_CMR). The start and the stop commands have effect
only if the clock is enabled.
Figure 46-4.
Clock Control
Selected
Clock
Trigger
CLKSTA
Q
Q
CLKEN
CLKDIS
S
R
Counter
Clock
Stop
Event
Disable
Event
The TC Operating Mode is programmed with the WAVE bit in the TC Channel Mode Register.
In Capture Mode, TIOA and TIOB are configured as inputs.
In Waveform Mode, TIOA is always configured to be an output and TIOB is an output if it is not selected to be the
external trigger.
46.6.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.
Regardless of the trigger used, it will be taken into account at the following active edge of the selected clock. This
means that the counter value can be read differently from zero just after a trigger, especially when a low frequency
signal is selected as the clock.
1388
Software Trigger: Each channel has a software trigger, available by setting SWTRG in TC_CCR.
SYNC: Each channel has a synchronization signal SYNC. When asserted, this signal has the same effect as a
software trigger. The SYNC signals of all channels are asserted simultaneously by writing TC_BCR (Block
Control) with SYNC set.
Compare RC Trigger: RC is implemented in each channel and can provide a trigger when the counter value
matches the RC value if CPCTRG is set in the TC_CMR.
The channel can also be configured to have an external trigger. In Capture Mode, the external trigger signal can be
selected between TIOA and TIOB. In Waveform Mode, an external event can be programmed on one of the
following signals: TIOB, XC0, XC1 or XC2. This external event can then be programmed to perform a trigger by
setting bit ENETRG in the TC_CMR.
If an external trigger is used, the duration of the pulses must be longer than the peripheral clock period in order to
be detected.
46.6.7 Capture Operating Mode
This mode is entered by clearing the WAVE bit in the TC_CMR.
Capture Mode allows the TC channel to perform measurements such as pulse timing, frequency, period, duty
cycle and phase on TIOA and TIOB signals which are considered as inputs.
Figure 46-6 shows the configuration of the TC channel when programmed in Capture Mode.
46.6.8 Capture Registers A and B
Registers A and B (RA and RB) are used as capture registers. This means that they can be loaded with the
counter value when a programmable event occurs on the signal TIOA.
The LDRA field in the TC_CMR defines the TIOA selected edge for the loading of register A, and the LDRB field
defines the TIOA selected edge for the loading of Register B.
The subsampling ratio defined by the SBSMPLR field in TC_CMR is applied to these selected edges, so that the
loading of Register A and Register B occurs once every 1, 2, 4, 8 or 16 selected edges.
RA is loaded only if it has not been loaded since the last trigger or if RB has been loaded since the last loading of
RA.
RB is loaded only if RA has been loaded since the last trigger or the last loading of RB.
Loading RA or RB before the read of the last value loaded sets the Overrun Error Flag (LOVRS bit) in the TC_SR.
In this case, the old value is overwritten.
When DMA is used, the RAB register address must be configured as source address of the transfer. The RAB
register provides the next unread value from Register A and Register B. It may be read by the DMA after a request
has been triggered upon loading Register A or Register B.
46.6.9 Transfer with DMAC
The DMAC can only perform access from timer to system memory.
Figure 46-5 Example of Transfer with DMAC illustrates how TC_RA and TC_RB can be loaded in the system
memory without CPU intervention.
1389
Figure 46-5.
RA
RB
RA
RB
T1
T2
T3
T4
Peripheral trigger
Transfer to System Memory
RA
RA
RA
RA
T1
T2
T3
T4
1390
MTIOA
MTIOB
BURST
ABETRG
CLKI
SWTRG
If RA is not loaded
or RB is Loaded
Edge
Detector
ETRGEDG
Peripheral Clock
Synchronous
Edge Detection
OVF
LDRB
Edge
Detector
Edge
Detector
Edge Subsampler
SBSMPLR
Capture
Register A
LDBSTOP
CLKEN
LDRA
If RA is Loaded
CPCTRG
Counter
RESET
Trig
CLK
CLKSTA
Compare RC =
Register C
Timer/Counter Channel
LDBDIS
Capture
Register B
CLKDIS
TC1_SR
TIOA
TIOB
SYNC
XC2
XC1
XC0
TIMER_CLOCK5
TIMER_CLOCK4
TIMER_CLOCK3
TIMER_CLOCK2
TIMER_CLOCK1
TCCLKS
COVFS
LDRBS
INT
Figure 46-6.
Capture Mode
CPCS
LOVRS
ETRGS
LDRAS
TC1_IMR
Atmel-11238A-ATARM-SAMA5D4-Datasheet_30-Sep-14
1391
1392
TIOB
SYNC
XC2
XC1
XC0
TIMER_CLOCK5
TIMER_CLOCK4
TIMER_CLOCK3
TIMER_CLOCK2
TIMER_CLOCK1
EEVT
BURST
TCCLKS
ENETRG
CLKI
Trig
CLK
OVF
WAVSEL
RESET
Counter
WAVSEL
CLKSTA
Compare RA =
Register A
TC1_SR
Timer/Counter Channel
Edge
Detector
EEVTEDG
SWTRG
Peripheral Clock
Synchronous
Edge Detection
Compare RC =
Compare RB =
CPCSTOP
CPCDIS
Register C
CLKDIS
Register B
CLKEN
CPAS
INT
BSWTRG
BEEVT
BCPB
BCPC
ASWTRG
AEEVT
ACPA
ACPC
Output Controller
Output Controller
TIOB
MTIOB
TIOA
MTIOA
Figure 46-7.
Waveform Mode
CPCS
CPBS
COVFS
ETRGS
TC1_IMR
Atmel-11238A-ATARM-SAMA5D4-Datasheet_30-Sep-14
1393
46.6.12.1 WAVSEL = 00
When WAVSEL = 00, the value of TC_CV is incremented from 0 to 232-1. Once 232-1 has been reached, the value
of TC_CV is reset. Incrementation of TC_CV starts again and the cycle continues. See Figure 46-8.
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 46-9.
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).
Figure 46-8.
0xFFFF
RC
RB
RA
Time
Waveform Examples
TIOB
TIOA
Figure 46-9.
0xFFFF
RC
RB
RA
Waveform Examples
TIOB
TIOA
1394
Time
46.6.12.2 WAVSEL = 10
When WAVSEL = 10, the value of TC_CV is incremented from 0 to the value of RC, then automatically reset on a
RC Compare. Once the value of TC_CV has been reset, it is then incremented and so on. See Figure 46-10.
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 46-11.
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).
Figure 46-10. WAVSEL = 10 without Trigger
Counter Value
2n-1
(n = counter size)
RC
RB
RA
Time
Waveform Examples
TIOB
TIOA
RC
RB
RA
Waveform Examples
Time
TIOB
TIOA
1395
46.6.12.3 WAVSEL = 01
When WAVSEL = 01, the value of TC_CV is incremented from 0 to 232-1. Once 232-1 is reached, the value of
TC_CV is decremented to 0, then re-incremented to 232-1 and so on. See Figure 46-12.
A trigger such as an external event or a software trigger can modify TC_CV at any time. If a trigger 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 46-13.
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).
Figure 46-12. WAVSEL = 01 without Trigger
Counter Value
0xFFFF
RC
RB
RA
Time
Waveform Examples
TIOB
TIOA
0xFFFF
Counter decremented
by trigger
RC
RB
Counter incremented
by trigger
RA
Waveform Examples
TIOB
TIOA
1396
Time
46.6.12.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 46-14.
A trigger such as an external event or a software trigger can modify TC_CV at any time. If a trigger 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 46-15.
RC Compare can stop the counter clock (CPCSTOP = 1) and/or disable the counter clock (CPCDIS = 1).
Figure 46-14. WAVSEL = 11 without Trigger
Counter Value
2n-1
(n = counter size)
RC
RB
RA
Time
Waveform Examples
TIOB
TIOA
RA
Waveform Examples
Time
TIOB
TIOA
1397
1398
TIOA0
TIOA0
1
TC_EMR0.TRIGSRCB
TIOB0
TIOB0
1
TC_EMR1.TRIGSRCA
Timer/Counter
Channel 1
TIOA1
TIOA1
1
TC_EMR1.TRIGSRCB
TIOB1
TIOB1
1
TC_EMR2.TRIGSRCA
Timer/Counter
Channel 2
TIOA2
TIOA2
1
TC_EMR2.TRIGSRCB
TIOB2
TIOB2
1
1399
The quadrature decoder logic is driven by TIOA0, TIOB0, TIOB1 input pins and drives the timer/counter of channel
0 and 1. Channel 2 can be used as a time base in case of speed measurement requirements (refer to Figure 46-17
Predefined Connection of the Quadrature Decoder with Timer Counters).
When writing a 0 to bit QDEN of the TC_BMR, the quadrature decoder logic is totally transparent.
TIOA0 and TIOB0 are to be driven by the two dedicated quadrature signals from a rotary sensor mounted on the
shaft of the off-chip motor.
A third signal from the rotary sensor can be processed through pin TIOB1 and is typically dedicated to be driven by
an index signal if it is provided by the sensor. This signal is not required to decode the quadrature signals PHA,
PHB.
Field TCCLKS of TC_CMRx must be configured to select XC0 input (i.e., 0x101). Field TC0XC0S has no effect as
soon as quadrature decoder is enabled.
Either speed or position/revolution can be measured. Position channel 0 accumulates the edges of PHA, PHB
input signals giving a high accuracy on motor position whereas channel 1 accumulates the index pulses of the
sensor, therefore the number of rotations. Concatenation of both values provides a high level of precision on
motion system position.
In speed mode, position cannot be measured but revolution can be measured.
Inputs from the rotary sensor can be filtered prior to down-stream processing. Accommodation of input polarity,
phase definition and other factors are configurable.
Interruptions can be generated on different events.
A compare function (using TC_RC) is available on channel 0 (speed/position) or channel 1 (rotation) and can
generate an interrupt by means of the CPCS flag in the TC_SRx.
1400
Figure 46-17. Predefined Connection of the Quadrature Decoder with Timer Counters
Reset pulse
SPEEDEN
Quadrature
Decoder
1
1
(Filter + Edge
Detect + QD)
TIOA
Timer/Counter
Channel 0
TIOA0
QDEN
PHEdges
1
TIOB
XC0
TIOB0
TIOA0
PHA
TIOB0
PHB
TIOB1
IDX
XC0
Speed/Position
QDEN
Index
TIOB
TIOB1
XC0
Timer/Counter
Channel 1
XC0
Rotation
Direction
Timer/Counter
Channel 2
Input pre-processing consists of capabilities to take into account rotary sensor factors such as polarities and phase
definition followed by configurable digital filtering.
Each input can be negated and swapping PHA, PHB is also configurable.
The MAXFILT field in the TC_BMR is used to configure a minimum duration for which the pulse is stated as valid.
When the filter is active, pulses with a duration lower than MAXFILT +1 * tperipheral clock ns are not passed to downstream logic.
1401
Input Pre-Processing
MAXFILT
SWAP
PHA
Filter
TIOA0
MAXFILT > 0
PHedge
Direction
and
Edge
Detection
INVA
1
PHB
Filter
TIOB0
DIR
IDX
INVB
1
1
IDX
Filter
TIOB1
IDXPHB
INVIDX
Input filtering can efficiently remove spurious pulses that might be generated by the presence of particulate
contamination on the optical or magnetic disk of the rotary sensor.
Spurious pulses can also occur in environments with high levels of electro-magnetic interference. Or, simply if
vibration occurs even when rotation is fully stopped and the shaft of the motor is in such a position that the
beginning of one of the reflective or magnetic bars on the rotary sensor disk is aligned with the light or magnetic
(Hall) receiver cell of the rotary sensor. Any vibration can make the PHA, PHB signals toggle for a short duration.
1402
MAXFILT = 2
Peripheral Clock
particulate contamination
PHA,B
Filter Out
PHB
motor shaft stopped in such a position that
rotary sensor cell is aligned with an edge of the disk
rotation
stop
PHA
PHB Edge area due to system vibration
PHB
stop
mechanical shock on system
PHB
vibration
PHA, PHB electrical waveforms after filtering
PHA
PHB
1403
After filtering, the quadrature signals are analyzed to extract the rotation direction and edges of the two quadrature
signals detected in order to be counted by timer/counter logic downstream.
The direction status can be directly read at anytime in the TC_QISR. The polarity of the direction flag status
depends on the configuration written in TC_BMR. INVA, INVB, INVIDX, SWAP modify the polarity of DIR flag.
Any change in rotation direction is reported in the TC_QISR and can generate an interrupt.
The direction change condition is reported as soon as two consecutive edges on a phase signal have sampled the
same value on the other phase signal and there is an edge on the other signal. The two consecutive edges of one
phase signal sampling the same value on other phase signal is not sufficient to declare a direction change, for the
reason that particulate contamination may mask one or more reflective bars on the optical or magnetic disk of the
sensor. (Refer to Figure 46-20 Rotation Change Detection for waveforms.)
Figure 46-20. Rotation Change Detection
change condition
Report Time
PHB
DIR
DIRCHG
1404
predefined value is configurable and corresponds to (MAXFILT + 1) * tperipheral clock ns. After being filtered there is
no reason to have two edges closer than (MAXFILT + 1) * tperipheral clock ns under normal mode of operation.
Figure 46-21. Quadrature Error Detection
MAXFILT = 2
Peripheral Clock
PHB
strip edge inaccurary due to disk etching/printing process
PHA
PHB
resulting PHA, PHB electrical waveforms
PHA
Even with an abnorrmaly formatted disk, there is no occurence of PHA, PHB switching at the same time.
PHB
duration < MAXFILT
QERR
MAXFILT must be tuned according to several factors such as the peripheral clock frequency, type of rotary sensor
and rotation speed to be achieved.
46.6.16.4 Position and Rotation Measurement
When the POSEN bit is set in the TC_BMR, the motor axis position is processed on channel 0 (by means of the
PHA, PHB edge detections) and the number of motor revolutions are recorded on channel 1 if the IDX signal is
provided on the TIOB1 input. The position measurement can be read in the TC_CV0 register and the rotation
measurement can be read in the TC_CV1 register.
Channel 0 and 1 must be configured in capture mode (WAVE = 0 in TC_CMR0).
In parallel, the number of edges are accumulated on timer/counter channel 0 and can be read on the TC_CV0
register.
Therefore, the accurate position can be read on both TC_CV registers and concatenated to form a 32-bit word.
The timer/counter channel 0 is cleared for each increment of IDX count value.
Depending on the quadrature signals, the direction is decoded and allows to count up or down in timer/counter
channels 0 and 1. The direction status is reported on TC_QISR.
1405
46.6.16.5
Speed Measurement
When SPEEDEN is set in the TC_BMR, the speed measure is enabled on channel 0.
A time base must be defined on channel 2 by writing the TC_RC2 period register. Channel 2 must be configured in
waveform mode (WAVE bit set) in TC_CMR2. The WAVSEL field must be defined with 0x10 to clear the counter
by comparison and matching with TC_RC value. Field ACPC must be defined at 0x11 to toggle TIOA output.
This time base is automatically fed back to TIOA of channel 0 when QDEN and SPEEDEN are set.
Channel 0 must be configured in capture mode (WAVE = 0 in TC_CMR0). The ABETRG bit of TC_CMR0 must be
configured at 1 to select TIOA as a trigger for this channel.
EDGTRG can be set to 0x01, to clear the counter on a rising edge of the TIOA signal and field LDRA must be set
accordingly to 0x01, to load TC_RA0 at the same time as the counter is cleared (LDRB must be set to 0x01). As a
consequence, at the end of each time base period the differentiation required for the speed calculation is
performed.
The process must be started by configuring bits CLKEN and SWTRG in the TC_CCR.
The speed can be read on field RA in TC_RA0.
Channel 1 can still be used to count the number of revolutions of the motor.
46.6.16.6 Missing Pulse Detection and Auto-correction
The QDEC is equipped with a circuitry which detects and corrects some errors that may result from contamination
on optical disks or other materials producing the quadrature phase signals.
The detection and autocorrection only works if the count mode is configured for both phases (EDGPHA = 1 in
TC_BMR) and is enabled (AUTOC = 1 in TC_BMR).
If a pulse is missing on a phase signal, it is automatically detected and the pulse count reported in the CV field of
the TC_CV0/1 is automatically corrected.
There is no detection if both phase signals are affected at the same location on the device providing the
quadradure signals because the detection requires a valid phase signal to detect the contamination on the other
phase signal.
Figure 46-22. Detection and Auto-correction of Missing Pulses
PHA
PHB
detection
corrections
1
10
12 13
14
15
16
If a quadrature device is undamaged, the number of pulses counted for a predefined period of time must be the
same with or without detection and auto-correction feature.
Therefore, if the measurement results differ, a contamination exists on the device producing the quadrature
signals.
1406
This does not substitute the measurements of the number of pulses between two index pulses (if available) but
provides a complementary method to detect damaged quadrature devices.
When the device providing quadrature signals is severely damaged, potentially leading to a number of consecutive
missing pulses greater than 1, the downstream processing may be affected. It is possible to define the maximum
admissible number of consecutive missing pulses before issuing a Missing Pulse Error flag (MPE in TC_QISR).
The threshold triggering a MPE flag report can be configured in field MAXCMP of the TC_BMR. If the field
MAXCMP is cleared, MPE never rises. The flag MAXCMP can trigger an interrupt while the QDEC is operating,
thus providing a real time report of a potential problem on the quadrature device.
46.6.17 2-bit Gray Up/Down Counter for Stepper Motor
Each channel can be independently configured to generate a 2-bit gray count waveform on corresponding TIOA,
TIOB outputs by means of the GCEN bit in TC_SMMRx.
Up or Down count can be defined by writing bit DOWN in TC_SMMRx.
It is mandatory to configure the channel in WAVE mode in the TC_CMR.
The period of the counters can be programmed in TC_RCx.
Figure 46-23. 2-bit Gray Up/Down Counter
WAVEx = GCENx =1
TIOAx
TC_RCx
TIOBx
DOWNx
46.6.18 Register Write Protection
To prevent any single software error from corrupting TC behavior, certain registers in the address space can be
write-protected by setting the WPEN bit in the TC Write Protection Mode Register (TC_WPMR).
The following registers can be write-protected:
TC Register A
TC Register B
TC Register C
1407
This interrupt is processed but requires an unpredictable amount of time to be achieve the required action.
It is possible to trigger the FAULT output of the TIMER1 with CPCS from TC_SR0 and/or CPCS from TC_SR1.
Each source can be independently enabled/disabled in the TC_FMR.
This can be useful to detect an overflow on speed and/or position when QDEC is processed and to act
immediately by using the FAULT output.
Figure 46-24. Fault Output Generation
AND
TC_SR0 flag CPCS
OR
TC_FMR / ENCF0
AND
TC_SR1 flag CPCS
TC_FMR / ENCF1
1408
46.7
Table 46-5.
Register Mapping
Offset(1)
Register
Name
Access
Reset
TC_CCR
Write-only
TC_CMR
Read/Write
TC_SMMR
Read/Write
Register AB
TC_RAB
Read-only
Counter Value
TC_CV
Read-only
Register A
TC_RA
Read/Write
(2)
(2)
Register B
TC_RB
Register C
TC_RC
Read/Write
Status Register
TC_SR
Read-only
TC_IER
Write-only
TC_IDR
Write-only
TC_IMR
Read-only
TC_EMR
Read/Write
0xC0
TC_BCR
Write-only
0xC4
TC_BMR
Read/Write
0xC8
TC_QIER
Write-only
0xCC
TC_QIDR
Write-only
0xD0
TC_QIMR
Read-only
0xD4
TC_QISR
Read-only
0xD8
TC_FMR
Read/Write
0xE4
TC_WPMR
Read/Write
Reserved
0xE80xFC
Notes:
Read/Write
1409
TC_CCRx [x=0..2]
Address:
0xF801C000 (0)[0], 0xF801C040 (0)[1], 0xF801C080 (0)[2], 0xFC020000 (1)[0], 0xFC020040 (1)[1],
0xFC020080 (1)[2], 0xFC024000 (2)[0], 0xFC024040 (2)[1], 0xFC024080 (2)[2]
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
2
SWTRG
1
CLKDIS
0
CLKEN
1410
Address:
0xF801C004 (0)[0], 0xF801C044 (0)[1], 0xF801C084 (0)[2], 0xFC020004 (1)[0], 0xFC020044 (1)[1],
0xFC020084 (1)[2], 0xFC024004 (2)[0], 0xFC024044 (2)[1], 0xFC024084 (2)[2]
Access:
Read/Write
31
30
29
28
27
26
25
18
17
24
23
22
21
SBSMPLR
20
19
15
WAVE
14
CPCTRG
13
12
11
10
ABETRG
7
LDBDIS
6
LDBSTOP
3
CLKI
1
TCCLKS
16
LDRB
BURST
LDRA
8
ETRGEDG
0
This register can only be written if the WPEN bit is cleared in the TC Write Protection Mode Register.
TCCLKS: Clock Selection
Value
Name
Description
TIMER_CLOCK1
TIMER_CLOCK2
TIMER_CLOCK3
TIMER_CLOCK4
TIMER_CLOCK5
XC0
XC1
XC2
To operate at maximum peripheral clock frequency, please refer to Section 46.7.14 TC Extended Mode Register.
CLKI: Clock Invert
0: Counter is incremented on rising edge of the clock.
1: Counter is incremented on falling edge of the clock.
BURST: Burst Signal Selection
Value
Name
Description
NONE
XC0
XC1
XC2
1411
Name
Description
NONE
RISING
Rising edge
FALLING
Falling edge
EDGE
Each edge
Name
Description
NONE
None
RISING
FALLING
EDGE
1412
Value
Name
Description
NONE
None
RISING
FALLING
EDGE
Name
Description
ONE
HALF
FOURTH
EIGHTH
SIXTEENTH
1413
Access:
Read/Write
31
30
29
28
BSWTRG
23
27
BEEVT
22
20
19
AEEVT
15
WAVE
14
13
7
CPCDIS
6
CPCSTOP
WAVSEL
25
24
BCPC
21
ASWTRG
26
BCPB
18
17
16
ACPC
12
ENETRG
11
3
CLKI
5
BURST
ACPA
10
EEVT
8
EEVTEDG
1
TCCLKS
This register can only be written if the WPEN bit is cleared in the TC Write Protection Mode Register.
TCCLKS: Clock Selection
Value
Name
Description
TIMER_CLOCK1
TIMER_CLOCK2
TIMER_CLOCK3
TIMER_CLOCK4
TIMER_CLOCK5
XC0
XC1
XC2
To operate at maximum peripheral clock frequency, please refer to Section 46.7.14 TC Extended Mode Register.
CLKI: Clock Invert
0: Counter is incremented on rising edge of the clock.
1: Counter is incremented on falling edge of the clock.
BURST: Burst Signal Selection
Value
Name
Description
NONE
XC0
XC1
XC2
1414
Name
Description
NONE
None
RISING
Rising edge
FALLING
Falling edge
EDGE
Each edge
Note:
Name
Description
TIOB
(1)
TIOB Direction
TIOB
Input
XC0
XC0
Output
XC1
XC1
Output
XC2
XC2
Output
1. If TIOB is chosen as the external event signal, it is configured as an input and no longer generates waveforms and
subsequently no IRQs.
Name
Description
UP
UPDOWN
UP_RC
UPDOWN_RC
1415
Name
Description
NONE
None
SET
Set
CLEAR
Clear
TOGGLE
Toggle
Name
Description
NONE
None
SET
Set
CLEAR
Clear
TOGGLE
Toggle
Name
Description
NONE
None
SET
Set
CLEAR
Clear
TOGGLE
Toggle
Name
Description
NONE
None
SET
Set
CLEAR
Clear
TOGGLE
Toggle
Name
Description
NONE
None
SET
Set
CLEAR
Clear
TOGGLE
Toggle
1416
Value
Name
Description
NONE
None
SET
Set
CLEAR
Clear
TOGGLE
Toggle
Name
Description
NONE
None
SET
Set
CLEAR
Clear
TOGGLE
Toggle
Name
Description
NONE
None
SET
Set
CLEAR
Clear
TOGGLE
Toggle
1417
TC_SMMRx [x=0..2]
Address:
0xF801C008 (0)[0], 0xF801C048 (0)[1], 0xF801C088 (0)[2], 0xFC020008 (1)[0], 0xFC020048 (1)[1],
0xFC020088 (1)[2], 0xFC024008 (2)[0], 0xFC024048 (2)[1], 0xFC024088 (2)[2]
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
1
DOWN
0
GCEN
This register can only be written if the WPEN bit is cleared in the TC Write Protection Mode Register.
GCEN: Gray Count Enable
0: TIOAx [x=0..2] and TIOBx [x=0..2] are driven by internal counter of channel x.
1: TIOAx [x=0..2] and TIOBx [x=0..2] are driven by a 2-bit gray counter.
DOWN: Down Count
0: Up counter.
1: Down counter.
1418
46.7.5 TC Register AB
Name:
TC_RABx [x=0..2]
Address:
0xF801C00C (0)[0], 0xF801C04C (0)[1], 0xF801C08C (0)[2], 0xFC02000C (1)[0], 0xFC02004C (1)[1],
0xFC02008C (1)[2], 0xFC02400C (2)[0], 0xFC02404C (2)[1], 0xFC02408C (2)[2]
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
RAB
23
22
21
20
RAB
15
14
13
12
RAB
4
RAB
1419
TC_CVx [x=0..2]
Address:
0xF801C010 (0)[0], 0xF801C050 (0)[1], 0xF801C090 (0)[2], 0xFC020010 (1)[0], 0xFC020050 (1)[1],
0xFC020090 (1)[2], 0xFC024010 (2)[0], 0xFC024050 (2)[1], 0xFC024090 (2)[2]
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
CV
23
22
21
20
CV
15
14
13
12
CV
4
CV
1420
46.7.7 TC Register A
Name:
TC_RAx [x=0..2]
Address:
0xF801C014 (0)[0], 0xF801C054 (0)[1], 0xF801C094 (0)[2], 0xFC020014 (1)[0], 0xFC020054 (1)[1],
0xFC020094 (1)[2], 0xFC024014 (2)[0], 0xFC024054 (2)[1], 0xFC024094 (2)[2]
Access:
31
30
29
28
27
26
25
24
19
18
17
16
11
10
RA
23
22
21
20
RA
15
14
13
12
RA
4
RA
This register can only be written if the WPEN bit is cleared in the TC Write Protection Mode Register.
RA: Register A
RA contains the Register A value in real time.
1421
46.7.8 TC Register B
Name:
TC_RBx [x=0..2]
Address:
0xF801C018 (0)[0], 0xF801C058 (0)[1], 0xF801C098 (0)[2], 0xFC020018 (1)[0], 0xFC020058 (1)[1],
0xFC020098 (1)[2], 0xFC024018 (2)[0], 0xFC024058 (2)[1], 0xFC024098 (2)[2]
Access:
31
30
29
28
27
26
25
24
19
18
17
16
11
10
RB
23
22
21
20
RB
15
14
13
12
RB
4
RB
This register can only be written if the WPEN bit is cleared in the TC Write Protection Mode Register.
RB: Register B
RB contains the Register B value in real time.
1422
46.7.9 TC Register C
Name:
TC_RCx [x=0..2]
Address:
0xF801C01C (0)[0], 0xF801C05C (0)[1], 0xF801C09C (0)[2], 0xFC02001C (1)[0], 0xFC02005C (1)[1],
0xFC02009C (1)[2], 0xFC02401C (2)[0], 0xFC02405C (2)[1], 0xFC02409C (2)[2]
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
RC
23
22
21
20
RC
15
14
13
12
RC
4
RC
This register can only be written if the WPEN bit is cleared in the TC Write Protection Mode Register.
RC: Register C
RC contains the Register C value in real time.
1423
TC_SRx [x=0..2]
Address:
0xF801C020 (0)[0], 0xF801C060 (0)[1], 0xF801C0A0 (0)[2], 0xFC020020 (1)[0], 0xFC020060 (1)[1],
0xFC0200A0 (1)[2], 0xFC024020 (2)[0], 0xFC024060 (2)[1], 0xFC0240A0 (2)[2]
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
MTIOB
17
MTIOA
16
CLKSTA
15
14
13
12
11
10
7
ETRGS
6
LDRBS
5
LDRAS
4
CPCS
3
CPBS
2
CPAS
1
LOVRS
0
COVFS
1424
1425
TC_IERx [x=0..2]
Address:
0xF801C024 (0)[0], 0xF801C064 (0)[1], 0xF801C0A4 (0)[2], 0xFC020024 (1)[0], 0xFC020064 (1)[1],
0xFC0200A4 (1)[2], 0xFC024024 (2)[0], 0xFC024064 (2)[1], 0xFC0240A4 (2)[2]
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
7
ETRGS
6
LDRBS
5
LDRAS
4
CPCS
3
CPBS
2
CPAS
1
LOVRS
0
COVFS
1426
1427
TC_IDRx [x=0..2]
Address:
0xF801C028 (0)[0], 0xF801C068 (0)[1], 0xF801C0A8 (0)[2], 0xFC020028 (1)[0], 0xFC020068 (1)[1],
0xFC0200A8 (1)[2], 0xFC024028 (2)[0], 0xFC024068 (2)[1], 0xFC0240A8 (2)[2]
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
7
ETRGS
6
LDRBS
5
LDRAS
4
CPCS
3
CPBS
2
CPAS
1
LOVRS
0
COVFS
1428
1429
TC_IMRx [x=0..2]
Address:
0xF801C02C (0)[0], 0xF801C06C (0)[1], 0xF801C0AC (0)[2], 0xFC02002C (1)[0], 0xFC02006C (1)[1],
0xFC0200AC (1)[2], 0xFC02402C (2)[0], 0xFC02406C (2)[1], 0xFC0240AC (2)[2]
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
7
ETRGS
6
LDRBS
5
LDRAS
4
CPCS
3
CPBS
2
CPAS
1
LOVRS
0
COVFS
1430
1431
TC_EMRx [x=0..2]
Address:
0xF801C030 (0)[0], 0xF801C070 (0)[1], 0xF801C0B0 (0)[2], 0xFC020030 (1)[0], 0xFC020070 (1)[1],
0xFC0200B0 (1)[2], 0xFC024030 (2)[0], 0xFC024070 (2)[1], 0xFC0240B0 (2)[2]
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
8
NODIVCLK
TRIGSRCB
0
TRIGSRCA
Name
Description
EXTERNAL_TIOAx
PWMx
Name
Description
EXTERNAL_TIOBx
PWMx
1432
TC_BCR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
0
SYNC
1433
TC_BMR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
23
22
21
20
19
18
AUTOC
17
IDXPHB
16
SWAP
12
EDGPHA
11
QDTRANS
10
SPEEDEN
9
POSEN
8
QDEN
MAXCMP
MAXFILT
15
INVIDX
14
INVB
13
INVA
5
TC2XC2S
TC1XC1S
This register can only be written if the WPEN bit is cleared in the TC Write Protection Mode Register.
TC0XC0S: External Clock Signal 0 Selection
Value
Name
Description
TCLK0
Reserved
TIOA1
TIOA2
Name
Description
TCLK1
Reserved
TIOA0
TIOA2
Name
Description
TCLK2
Reserved
TIOA0
TIOA1
1434
24
MAXFILT
TC0XC0S
1435
1436
TC_QIER
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
2
QERR
1
DIRCHG
0
IDX
IDX: Index
0: No effect.
1: Enables the interrupt when a rising edge occurs on IDX input.
DIRCHG: Direction Change
0: No effect.
1: Enables the interrupt when a change on rotation direction is detected.
QERR: Quadrature Error
0: No effect.
1: Enables the interrupt when a quadrature error occurs on PHA, PHB.
1437
TC_QIDR
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
2
QERR
1
DIRCHG
0
IDX
IDX: Index
0: No effect.
1: Disables the interrupt when a rising edge occurs on IDX input.
DIRCHG: Direction Change
0: No effect.
1: Disables the interrupt when a change on rotation direction is detected.
QERR: Quadrature Error
0: No effect.
1: Disables the interrupt when a quadrature error occurs on PHA, PHB.
1438
TC_QIMR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
2
QERR
1
DIRCHG
0
IDX
IDX: Index
0: The interrupt on IDX input is disabled.
1: The interrupt on IDX input is enabled.
DIRCHG: Direction Change
0: The interrupt on rotation direction change is disabled.
1: The interrupt on rotation direction change is enabled.
QERR: Quadrature Error
0: The interrupt on quadrature error is disabled.
1: The interrupt on quadrature error is enabled.
1439
TC_QISR
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
8
DIR
3
MPE
2
QERR
1
DIRCHG
0
IDX
IDX: Index
0: No Index input change since the last read of TC_QISR.
1: The IDX input has changed since the last read of TC_QISR.
DIRCHG: Direction Change
0: No change on rotation direction since the last read of TC_QISR.
1: The rotation direction changed since the last read of TC_QISR.
QERR: Quadrature Error
0: No quadrature error since the last read of TC_QISR.
1: A quadrature error occurred since the last read of TC_QISR.
DIR: Direction
Returns an image of the actual rotation direction.
MPE: Consecutive Missing Pulse Error
0: The number of consecutive missing pulses has not reached the maximum value specified in MAXMP since the last read
of TC_QISR.
1: An occurrence of MAXCMP consecutive missing pulses has been detected since the last read of TC_QISR.
1440
TC_FMR
Address:
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
1
ENCF1
0
ENCF0
This register can only be written if the WPEN bit is cleared in the TC Write Protection Mode Register.
ENCF0: Enable Compare Fault Channel 0
0: Disables the FAULT output source (CPCS flag) from channel 0.
1: Enables the FAULT output source (CPCS flag) from channel 0.
ENCF1: Enable Compare Fault Channel 1
0: Disables the FAULT output source (CPCS flag) from channel 1.
1: Enables the FAULT output source (CPCS flag) from channel 1.
1441
TC_WPMR
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
0
WPEN
WPKEY
23
22
21
20
WPKEY
15
14
13
12
WPKEY
1442
Name
PASSWD
Description
Writing any other value in this field aborts the write operation of the WPEN bit.
Always reads as 0.
47.
47.1
Description
The PWM macrocell controls 4 channels independently. Each channel controls two complementary square output
waveforms. Characteristics of the output waveforms such as period, duty-cycle, polarity and dead-times (also
called dead-bands or non-overlapping times) are configured through the user interface. Each channel selects and
uses one of the clocks provided by the clock generator. The clock generator provides several clocks resulting from
the division of the PWM peripheral clock.
All PWM macrocell accesses are made through registers mapped on the peripheral bus. All channels integrate a
double buffering system in order to prevent an unexpected output waveform while modifying the period, the spread
spectrum, the duty-cycle or the dead-times.
Channels can be linked together as synchronous channels to be able to update their duty-cycle or dead-times at
the same time.
The update of duty-cycles of synchronous channels can be performed by the DMA Controller Channel (DMA)
which offers buffer transfer without processor Intervention.
The PWM macrocell includes a spread-spectrum counter to allow a constantly varying period (only for Channel 0).
This counter may be useful to minimize electromagnetic interference or to reduce the acoustic noise of a PWM
driven motor.
The PWM macrocell provides 8 independent comparison units capable of comparing a programmed value to the
counter of the synchronous channels (counter of channel 0). These comparisons are intended to generate
software interrupts, to trigger pulses on the 2 independent event lines (in order to synchronize ADC conversions
with a lot of flexibility independently of the PWM outputs) and to trigger DMA transfer requests.
The PWM outputs can be overridden synchronously or asynchronously to their channel counter.
The PWM block provides a fault protection mechanism with 8 fault inputs, capable to detect a fault condition and to
override the PWM outputs asynchronously (outputs forced to 0, 1 or Hi-Z).
For safety usage, some configuration registers are write-protected.
1443
47.2
Embedded Characteristics
4 Channels
Independent Channels
Independent Complementary Outputs with 12-bit Dead-Time Generator (Also Called Dead-Band or
Non-Overlapping Time) for Each Channel
Independent Double Buffering of Period, Duty-Cycle and Dead-Times for Each Channel
Independent Programmable Selection of The Output Waveform Polarity for Each Channel, with
Double Buffering
Independent Interrupt for Each Channel, at Each Period for Left-Aligned or Center-Aligned
Configuration
Independent Update Time Selection of Double Buffering Registers (Polarity, Duty Cycle ) for Each
Channel, at Each Period for Left-Aligned or Center-Aligned Configuration
Spread Spectrum Counter to Allow a Constantly Varying Duty Cycle (only for Channel 0)
Mode to Update the Synchronous Channels Registers after a Programmable Number of Periods
Synchronous Channels Supports Connection of one DMA Controller Channel (DMA) Which Offers
Buffer Transfer Without Processor Intervention To Update Duty-Cycle Registers
8 Comparison Units Intended to Generate Interrupts, Pulses on Event Lines and DMA Transfer Requests
1444
47.3
Block Diagram
Figure 47-1.
Period
Duty-Cycle
MUX
Counter
Channel x
Clock
Selector
DTOHx
Dead-Time
Generator DTOLx
OOOHx
Output
Override
OOOLx
PWMHx
Fault
Protection PWMLx
PWMHx
PWMLx
SYNCx
Comparator OCx
PIO
Channel 0
Update
Period
Comparator
OC0
DTOH0
Dead-Time
Generator DTOL0
OOOH0
Output
Override
OOOL0
PWMH0
Fault
Protection PWML0
PWMH0
PWML0
Duty-Cycle
Counter
Channel 0
Clock
Selector
PWMFIx
PIO
PWMFI0
event line 0
event line 1
Comparison
Units
Events
Generator
ADC
event line x
PMC
Peripheral Clock
CLOCK
Generator
APB
Interface
Interrupt Generator
Interrupt
Controller
APB
47.4
Name
Description
Type
PWMHx
Output
PWMLx
Output
PWMFIx
Input
1445
47.5
Product Dependencies
1446
I/O Lines
Instance
Signal
I/O Line
Peripheral
PWM
PWMFI0
PC29
PWM
PWMFI1
PE7
PWM
PWMH0
PA26
PWM
PWMH0
PB14
PWM
PWMH0
PB26
PWM
PWMH0
PC30
PWM
PWMH1
PA28
PWM
PWMH1
PB11
PWM
PWMH1
PB28
PWM
PWMH1
PC31
PWM
PWMH2
PC0
PWM
PWMH2
PE12
PWM
PWMH3
PC2
PWM
PWMH3
PE14
PWM
PWML0
PA27
PWM
PWML0
PB15
PWM
PWML0
PB27
PWM
PWML0
PC27
PWM
PWML1
PA29
PWM
PWML1
PB10
PWM
PWML1
PB29
PWM
PWML1
PC28
PWM
PWML2
PC1
PWM
PWML2
PE13
PWM
PWML3
PC3
PWM
PWML3
PE8
Peripheral IDs
Instance
ID
PWM
43
Table 47-4.
Fault Inputs
Fault Generator
Polarity Level(1)
Fault Input ID
PC29
PWMFI0
User-defined
PE7
PWMFI1
User-defined
To be configured to 1
ADC
To be configured to 1
Timer0
To be configured to 1
Timer1
To be configured to 1
Timer2
To be configured to 1
Note:
1447
47.6
Functional Description
The PWM macrocell is primarily composed of a clock generator module and 4 channels.
Clocked by the peripheral clock, the clock generator module provides 13 clocks.
Each channel can independently choose one of the clock generator outputs.
Each channel generates an output waveform with attributes that can be defined independently for each
channel through the user interface registers.
modulo n counter
peripheral clock
peripheral clock/2
peripheral clock/4
peripheral clock/8
peripheral clock/16
peripheral clock/32
peripheral clock/64
peripheral clock/128
peripheral clock/256
peripheral clock/512
peripheral clock/1024
Divider A
PREA
clkA
DIVA
PWM_MR
Divider B
PREB
clkB
DIVB
PWM_MR
The PWM peripheral clock is divided in the clock generator module to provide different clocks available for all
channels. Each channel can independently select one of the divided clocks.
The clock generator is divided into different blocks:
a modulo n counter which provides 11 clocks: fperipheral clock, fperipheral clock/2, fperipheral clock/4, fperipheral
clock/8, fperipheral clock/16, fperipheral clock/32, fperipheral clock/64, fperipheral clock/128, fperipheral clock/256, fperipheral
clock/512, fperipheral clock/1024
two linear dividers (1, 1/2, 1/3, ... 1/255) that provide two separate clocks: clkA and clkB
Each linear divider can independently divide one of the clocks of the modulo n counter. The selection of the clock
to be divided is made according to the PREA (PREB) field of the PWM Clock register (PWM_CLK). The resulting
clock clkA (clkB) is the clock selected divided by DIVA (DIVB) field value.
1448
After a reset of the PWM controller, DIVA (DIVB) and PREA (PREB) are set to 0. This implies that after reset clkA
(clkB) are turned off.
At reset, all clocks provided by the modulo n counter are turned off except the peripheral clock. This situation is
also true when the PWM peripheral clock is turned off through the Power Management Controller.
CAUTION:
Before using the PWM macrocell, the programmer must first enable the peripheral clock in the Power
Management Controller (PMC).
Update
Period
MUX
Comparator
x
OCx
PWMHx
OOOHx
DTOHx
Dead-Time
Output
Fault
OOOLx
PWMLx
Generator DTOLx Override
Protection
Duty-Cycle
MUX
from
Clock
Generator
Clock
Selector
SYNCx
Counter
Channel x
from APB
Peripheral Bus
Counter
Channel 0
2-bit gray
counter z
Comparator
y
MUX
z = 0 (x = 0, y = 1),
z = 1 (x = 2, y = 3),
z = 2 (x = 4, y = 5),
z = 3 (x = 6, y = 7)
Channel y (= x+1)
OCy
PWMHy
OOOHy
DTOHy
Dead-Time
Output
Fault
OOOLy
PWMLy
Generator DTOLy Override
Protection
A clock selector which selects one of the clocks provided by the clock generator (described in Section 47.6.1
on page 1448).
A counter clocked by the output of the clock selector. This counter is incremented or decremented according
to the channel configuration and comparators matches. The size of the counter is 16 bits.
A comparator used to compute the OCx output waveform according to the counter value and the
configuration. The counter value can be the one of the channel counter or the one of the channel 0 counter
according to SYNCx bit in the PWM Sync Channels Mode Register (PWM_SCM).
A 2-bit configurable gray counter enables the stepper motor driver. One gray counter drives 2 channels.
A dead-time generator providing two complementary outputs (DTOHx/DTOLx) which allows to drive external
power control switches safely.
An output override block that can force the two complementary outputs to a programmed value
(OOOHx/OOOLx).
An asynchronous fault protection mechanism that has the highest priority to override the two complementary
outputs (PWMHx/PWMLx) in case of fault detection (outputs forced to 0, 1 or Hi-Z).
1449
47.6.2.2 Comparator
The comparator continuously compares its counter value with the channel period defined by CPRD in the PWM
Channel Period Register (PWM_CPRDx) and the duty-cycle defined by CDTY in the PWM Channel Duty Cycle
Register (PWM_CDTYx) to generate an output signal OCx accordingly.
The different properties of the waveform of the output OCx are:
the clock selection. The channel counter is clocked by one of the clocks provided by the clock generator
described in the previous section. This channel parameter is defined in the CPRE field of the PWM Channel
Mode Register (PWM_CMRx). This field is reset at 0.
the waveform period. This channel parameter is defined in the CPRD field of the PWM_CPRDx register.
If the waveform is left-aligned, then the output waveform period depends on the counter source clock and
can be calculated:
By using the PWM peripheral clock divided by an X given prescaler value (with X being 1, 2, 4, 8, 16, 32, 64,
128, 256, 512, or 1024), the resulting period formula will be:
( X CPRD )------------------------------f peripheral clock
By using the PWM peripheral clock divided by one of both DIVA or DIVB divider, the formula becomes,
respectively:
( X C RPD DIVA -)
--------------------------------------------------or
f peripheral clock
( X C RPD DIVB -)
--------------------------------------------------f peripheral clock
If the waveform is center-aligned then the output waveform period depends on the counter source clock and
can be calculated:
By using the PWM peripheral clock divided by an X given prescaler value
(with X being 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, or 1024). The resulting period formula will be:
(---------------------------------------2 X CPRD )
f peripheral clock
By using the PWM peripheral clock divided by one of both DIVA or DIVB divider, the formula becomes,
respectively:
( 2 X C PRD DIVA )
------------------------------------------------------------or
f peripheral clock
( 2 X C PRD DIVB )
------------------------------------------------------------f peripheral clock
the waveform duty-cycle. This channel parameter is defined in the CDTY field of the PWM_CDTYx
register.
If the waveform is left-aligned then:
( period 1 fchannel_x_clock CDTY )
duty cycle = ---------------------------------------------------------------------------------------------------period
If the waveform is center-aligned, then:
( ( period 2 ) 1 fchannel_x_clock CDTY ) )
duty cycle = ------------------------------------------------------------------------------------------------------------------( period 2 )
1450
the waveform polarity. At the beginning of the period, the signal can be at high or low level. This property is
defined in the CPOL bit of the PWM_CMRx. By default the signal starts by a low level. the waveform
alignment. The output waveform can be left or center-aligned. Center-aligned waveforms can be used to
generate non-overlapped waveforms. This property is defined in the CALG bit of the PWM_CMRx. The
default mode is left-aligned.
Figure 47-4.
OC0
OC1
Period
Note:
1.
See Figure 47-5 on page 1452 for a detailed description of center-aligned waveforms.
When center-aligned, the channel counter increases up to CPRD and decreases down to 0. This ends the period.
When left-aligned, the channel counter increases up to CPRD and is reset. This ends the period.
Thus, for the same CPRD value, the period for a center-aligned channel is twice the period for a left-aligned
channel.
Waveforms are fixed at 0 when:
The waveform polarity must be set before enabling the channel. This immediately affects the channel output level.
Modifying CPOL in PWM Channel Mode Register while the channel is enabled can lead to an unexpected
behavior of the device being driven by PWM.
In addition to generating the output signals OCx, the comparator generates interrupts depending on the counter
value. When the output waveform is left-aligned, the interrupt occurs at the end of the counter period. When the
output waveform is center-aligned, the bit CES of PWM_CMRx defines when the channel counter interrupt occurs.
If CES is set to 0, the interrupt occurs at the end of the counter period. If CES is set to 1, the interrupt occurs at
the end of the counter period and at half of the counter period.
Figure 47-5 Waveform Properties illustrates the counter interrupts depending on the configuration.
1451
Figure 47-5.
Waveform Properties
Channel x
slected clock
CHIDx(PWM_SR)
CHIDx(PWM_ENA)
CHIDx(PWM_DIS)
Center Aligned
CALG(PWM_CMRx) = 1
PWM_CCNTx
CPRD(PWM_CPRDx)
CDTY(PWM_CDTYx)
Period
Output Waveform OCx
CPOL(PWM_CMRx) = 0
PWM_CCNTx
CPRD(PWM_CPRDx)
CDTY(PWM_CDTYx)
Period
Output Waveform OCx
CPOL(PWM_CMRx) = 0
Counter Event
CHIDx(PWM_ISR)
1452
A pair of channels may provide a 2-bit gray count waveform on two outputs. Dead-time generator and other
downstream logic can be configured on these channels.
Up or down count mode can be configured on-the-fly by means of PWM_SMMR configuration registers.
When GCEN0 is set to 1, channels 0 and 1 outputs are driven with gray counter.
Figure 47-6.
GCEN0 = 1
PWMH0
PWML0
PWMH1
PWML1
DOWNx
The dead-time generator uses the comparator output OCx to provide the two complementary outputs DTOHx and
DTOLx, which allows the PWM macrocell to drive external power control switches safely. When the dead-time
generator is enabled by setting the bit DTE to 1 or 0 in the PWM Channel Mode Register (PWM_CMRx), deadtimes (also called dead-bands or non-overlapping times) are inserted between the edges of the two
complementary outputs DTOHx and DTOLx. Note that enabling or disabling the dead-time generator is allowed
only if the channel is disabled.
The dead-time is adjustable by the PWM Channel Dead Time Register (PWM_DTx). Both outputs of the dead-time
generator can be adjusted separately by DTH and DTL. The dead-time values can be updated synchronously to
the PWM period by using the PWM Channel Dead Time Update Register (PWM_DTUPDx).
The dead-time is based on a specific counter which uses the same selected clock that feeds the channel counter
of the comparator. Depending on the edge and the configuration of the dead-time, DTOHx and DTOLx are delayed
until the counter has reached the value defined by DTH or DTL. An inverted configuration bit (DTHI and DTLI bit in
the PWM_CMRx) is provided for each output to invert the dead-time outputs. The following figure shows the
waveform of the dead-time generator.
1453
Figure 47-7.
DTHx
DTLx
DTHx
DTLx
1454
The two complementary outputs DTOHx and DTOLx of the dead-time generator can be forced to a value defined
by the software.
Figure 47-8.
0
OOOHx
OOVHx
OSHx
DTOLx
0
OOOLx
OOVLx
OSLx
The fields OSHx and OSLx in the PWM Output Selection Register (PWM_OS) allow the outputs of the dead-time
generator DTOHx and DTOLx to be overridden by the value defined in the fields OOVHx and OOVLx in the PWM
Output Override Value Register (PWM_OOV).
The set registers PWM Output Selection Set Register (PWM_OSS) and PWM Output Selection Set Update
Register (PWM_OSSUPD) enable the override of the outputs of a channel regardless of other channels. In the
same way, the clear registers PWM Output Selection Clear Register (PWM_OSC) and PWM Output Selection
Clear Update Register (PWM_OSCUPD) disable the override of the outputs of a channel regardless of other
channels.
By using buffer registers PWM_OSSUPD and PWM_OSCUPD, the output selection of PWM outputs is done
synchronously to the channel counter, at the beginning of the next PWM period.
By using registers PWM_OSS and PWM_OSC, the output selection of PWM outputs is done asynchronously to
the channel counter, as soon as the register is written.
The value of the current output selection can be read in PWM_OS.
While overriding PWM outputs, the channel counters continue to run, only the PWM outputs are forced to user
defined values.
1455
8 inputs provide fault protection which can force any of the PWM output pairs to a programmable value. This
mechanism has priority over output overriding.
Figure 47-9.
Fault Protection
0
fault input 0
Glitch
Filter
FIV0
0
SET
FMOD0
OUT
Fault 0 Status
FS0
FPEx[0]
CLR
FFIL0
0
fault input 1
Glitch
Filter
FIV1
FPE0[0]
Write FCLR0 at 1
FPOL0
FMOD0
0
SET
FMOD1
OUT
Write FCLR1 at 1
Fault 1 Status
FS1
FPEx[1]
FMOD1
From Output
Override
OOHx
0
1
1
High Impedance
State
FPE0[1]
FPOL1
FPVHx
SYNCx
from fault 1
CLR
FFIL1
from fault 0
PWMHx
1
0
FPZHx
Fault protection
on PWM
channel x
1
from fault y
SYNCx
fault input y
High Impedance
State
FPVLx
1
0
FPZLx
OOLx
From Output
Override
PWMLx
The polarity level of the fault inputs is configured by the FPOL field in the PWM Fault Mode Register (PWM_FMR).
For fault inputs coming from internal peripherals such as ADC, Timer Counter, to name but a few, the polarity level
must be FPOL = 1. For fault inputs coming from external GPIO pins the polarity level depends on the user's
implementation.
The configuration of the Fault Activation Mode (FMOD field in PWMC_FMR) depends on the peripheral generating
the fault. If the corresponding peripheral does not have Fault Clear management, then the FMOD configuration to
use must be FMOD = 1, to avoid spurious fault detection. Check the corresponding peripheral documentation for
details on handling fault generation.
The fault inputs can be glitch filtered or not in function of the FFIL field in the PWM_FMR. When the filter is
activated, glitches on fault inputs with a width inferior to the PWM peripheral clock period are rejected.
A fault becomes active as soon as its corresponding fault input has a transition to the programmed polarity level. If
the corresponding bit FMOD is set to 0 in the PWM_FMR, the fault remains active as long as the fault input is at
this polarity level. If the corresponding FMOD field is set to 1, the fault remains active until the fault input is not at
this polarity level anymore and until it is cleared by writing the corresponding bit FCLR in the PWM Fault Clear
Register (PWM_FCR). By reading the PWM Fault Status Register (PWM_FSR), the user can read the current
level of the fault inputs by means of the field FIV, and can know which fault is currently active thanks to the FS field.
Each fault can be taken into account or not by the fault protection mechanism in each channel. To be taken into
account in the channel x, the fault y must be enabled by the bit FPEx[y] in the PWM Fault Protection Enable
Registers (PWM_FPE1). However the synchronous channels (see Section 47.6.2.8 Synchronous Channels) do
not use their own fault enable bits, but those of the channel 0 (bits FPE0[y]).
The fault protection on a channel is triggered when this channel is enabled and when any one of the faults that are
enabled for this channel is active. It can be triggered even if the PWM peripheral clock is not running but only by a
fault input that is not glitch filtered.
When the fault protection is triggered on a channel, the fault protection mechanism resets the counter of this
channel and forces the channel outputs to the values defined by the fields FPVHx and FPVLx in the PWM Fault
Protection Value Register 1 (PWM_FPV) and fields FPZHx/FPZLx in the PWM Fault Protection Value Register 2,
as shown in Table 47-5. The output forcing is made asynchronously to the channel counter.
1456
Table 47-5.
FPZH/Lx
FPVH/Lx
CAUTION:
To prevent an unexpected activation of the status flag FSy in the PWM_FSR, the FMODy bit can be set to 1
only if the FPOLy bit has been previously configured to its final value.
To prevent an unexpected activation of the Fault Protection on the channel x, the bit FPEx[y] can be set to 1
only if the FPOLy bit has been previously configured to its final value.
If a comparison unit is enabled (see Section 47.6.3 PWM Comparison Units) and if a fault is triggered in the
channel 0, then the comparison cannot match.
As soon as the fault protection is triggered on a channel, an interrupt (different from the interrupt generated at the
end of the PWM period) can be generated but only if it is enabled and not masked. The interrupt is reset by reading
the interrupt status register, even if the fault which has caused the trigger of the fault protection is kept active.
47.6.2.7 Spread Spectrum Counter
The PWM macrocell includes a spread spectrum counter allowing the generation of a constantly varying duty cycle
on the output PWM waveform (only for the channel 0). This feature may be useful to minimize electromagnetic
interference or to reduce the acoustic noise of a PWM driven motor.
This is achieved by varying the effective period in a range defined by a spread spectrum value which is
programmed by the field SPRD in the PWM Spread Spectrum Register (PWM_SSPR). The effective period of the
output waveform is the value of the spread spectrum counter added to the programmed waveform period CPRD in
the PWM Channel Period Register (PWM_CPR0).
It will cause the effective period to vary from CPRD-SPRD to CPRD+SPRD. This leads to a constantly varying duty
cycle on the PWM output waveform because the duty cycle value programmed is unchanged.
The value of the spread spectrum counter can change in two ways depending on the bit SPRDM in the
PWM_SSPR.
If SPRDM = 0, the mode TRIANGULAR is selected:
The spread spectrum counter starts to count from -SPRD when the channel 0 is enabled or after reset and counts
upwards at each period of the channel counter. When it reaches SPRD, it restarts to count from -SPRD again.
If SPRDM = 1, the mode RANDOM is selected:
A new random value is assigned to the spread spectrum counter at each period of the channel counter. This
random value is between -SPRD and +SPRD and is uniformly distributed.
1457
Variation of the
effective period
CPRD-SPRD
0x0
Some channels can be linked together as synchronous channels. They have the same source clock, the same
period, the same alignment and are started together. In this way, their counters are synchronized together.
The synchronous channels are defined by the SYNCx bits in the PWM Sync Channels Mode Register
(PWM_SCM). Only one group of synchronous channels is allowed.
When a channel is defined as a synchronous channel, the channel 0 is automatically defined as a synchronous
channel too, because the channel 0 counter configuration is used by all the synchronous channels.
If a channel x is defined as a synchronous channel, it uses the following configuration fields of the channel 0
instead of its own:
CPRE0 field in PWM_CMR0 instead of CPREx field in PWM_CMRx (same source clock)
Thus writing these fields of a synchronous channel has no effect on the output waveform of this channel (except
channel 0 of course).
Because counters of synchronous channels must start at the same time, they are all enabled together by enabling
the channel 0 (by the CHID0 bit in PWM_ENA register). In the same way, they are all disabled together by
disabling channel 0 (by the CHID0 bit in PWM_DIS register). However, a synchronous channel x different from
channel 0 can be enabled or disabled independently from others (by the CHIDx bit in PWM_ENA and PWM_DIS
registers).
Defining a channel as a synchronous channel while it is an asynchronous channel (by writing the bit SYNCx to 1
while it was at 0) is allowed only if the channel is disabled at this time (CHIDx = 0 in PWM_SR). In the same way,
defining a channel as an asynchronous channel while it is a synchronous channel (by writing the SYNCx bit to 0
while it was 1) is allowed only if the channel is disabled at this time.
The field UPDM (Update Mode) in the PWM_SCM register allow to select one of the three methods to update the
registers of the synchronous channels:
1458
Method 1 (UPDM = 0): The period value, the duty-cycle values and the dead-time values must be written by
the CPU in their respective update registers (respectively PWM_CPRDUPDx, PWM_CDTYUPDx and
PWM_DTUPDx).The update is triggered at the next PWM period as soon as the bit UPDULOCK in the PWM
Sync Channels Update Control Register (PWM_SCUC) is set to 1 (see Method 1: Manual write of dutycycle values and manual trigger of the update on page 1459).
Method 2 (UPDM = 1): The period value, the duty-cycle values, the dead-time values and the update period
value must be written by the CPU in their respective update registers (respectively PWM_CPRDUPDx,
PWM_CDTYUPDx and PWM_DTUPD). The update of the period value and of the dead-time values is
triggered at the next PWM period as soon as the bit UPDULOCK in the PWM_SCUC register is set to 1.
The update of the duty-cycle values and the update period value is triggered automatically after an update
period defined by the field UPR in the PWM Sync Channels Update Period Register (PWM_SCUP) (see
Method 2: Manual write of duty-cycle values and automatic trigger of the update on page 1460).
Method 3 (UPDM = 2): Same as Method 2 apart from the fact that the duty-cycle values of ALL synchronous
channels are written by the DMA Controller (DMA) (see Method 3: Automatic write of duty-cycle values and
automatic trigger of the update on page 1461). The user can choose to synchronize the DMA transfer
request with a comparison match (see Section 47.6.3 PWM Comparison Units), by the fields PTRM and
PTRCS in the PWM_SCM register. The DMA destination address must be configured to access only the
PWM DMA Register (PWM_DMAR). The DMA buffer data structure must consist of sequentially repeated
duty cycles. The number of duty cycles in each sequence corresponds to the number of synchronized
channels. Duty cycles in each sequence must be ordered from the lowest to the highest channel index. The
size of the duty cycle is 16 bits.
Table 47-6.
Register
UPDM = 0
UPDM = 1
UPDM = 2
Period Value
(PWM_CPRDUPDx)
Update is triggered at the next PWM period as soon as the bit UPDULOCK is set to 1
Write by the CPU
Dead-Time Values
(PWM_DTUPDx)
Update is triggered at the next PWM period as soon as the bit UPDULOCK is set to 1
Write by the CPU
Duty-Cycle Values
(PWM_CDTYUPDx)
Not applicable
Not applicable
Method 1: Manual write of duty-cycle values and manual trigger of the update
In this mode, the update of the period value, the duty-cycle values and the dead-time values must be done by
writing in their respective update registers with the CPU (respectively PWM_CPRDUPDx, PWM_CDTYUPDx and
PWM_DTUPDx).
To trigger the update, the user must use the bit UPDULOCK in the PWM_SCUC register which allows to update
synchronously (at the same PWM period) the synchronous channels:
If the bit UPDULOCK is set to 1, the update is done at the next PWM period of the synchronous channels.
If the UPDULOCK bit is not set to 1, the update is locked and cannot be performed.
After writing the UPDULOCK bit to 1, it is held at this value until the update occurs, then it is read 0.
Sequence for Method 1:
1. Select the manual write of duty-cycle values and the manual update by setting the UPDM field to 0 in the
PWM_SCM register
2.
Define the synchronous channels by the SYNCx bits in the PWM_SCM register.
3.
1459
4.
If an update of the period value and/or the duty-cycle values and/or the dead-time values is required, write
registers that need to be updated (PWM_CPRDUPDx, PWM_CDTYUPDx and PWM_DTUPDx).
5.
6.
The update of the registers will occur at the beginning of the next PWM period. At this moment the
UPDULOCK bit is reset, go to Step 4.) for new values.
CDTYUPD
0x20
0x40
0x20
0x40
0x60
UPDULOCK
CDTY
0x60
Method 2: Manual write of duty-cycle values and automatic trigger of the update
In this mode, the update of the period value, the duty-cycle values, the dead-time values and the update period
value must be done by writing in their respective update registers with the CPU (respectively PWM_CPRDUPDx,
PWM_CDTYUPDx, PWM_DTUPDx and PWM_SCUPUPD).
To trigger the update of the period value and the dead-time values, the user must use the bit UPDULOCK in the
PWM_SCUC register, which allows to update synchronously (at the same PWM period) the synchronous
channels:
If the bit UPDULOCK is set to 1, the update is done at the next PWM period of the synchronous channels.
If the UPDULOCK bit is not set to 1, the update is locked and cannot be performed.
After writing the UPDULOCK bit to 1, it is held at this value until the update occurs, then it is read 0.
The update of the duty-cycle values and the update period is triggered automatically after an update period.
To configure the automatic update, the user must define a value for the Update Period by the UPR field in the
PWM_SCUP register. The PWM controller waits UPR+1 period of synchronous channels before updating
automatically the duty values and the update period value.
The status of the duty-cycle value write is reported in the PWM Interrupt Status Register 2 (PWM_ISR2) by the
following flags:
WRDY: this flag is set to 1 when the PWM Controller is ready to receive new duty-cycle values and a new
update period value. It is reset to 0 when the PWM_ISR2 register is read.
Depending on the interrupt mask in the PWM Interrupt Mask Register 2 (PWM_IMR2), an interrupt can be
generated by these flags.
Sequence for Method 2:
1. Select the manual write of duty-cycle values and the automatic update by setting the field UPDM to 1 in
the PWM_SCM register
2.
1460
Define the synchronous channels by the bits SYNCx in the PWM_SCM register.
3.
Define the update period by the field UPR in the PWM_SCUP register.
4.
5.
If an update of the period value and/or of the dead-time values is required, write registers that need to be
updated (PWM_CPRDUPDx, PWM_DTUPDx), else go to Step 8.
6.
7.
The update of these registers will occur at the beginning of the next PWM period. At this moment the bit
UPDULOCK is reset, go to Step 5. for new values.
8.
If an update of the duty-cycle values and/or the update period is required, check first that write of new update
values is possible by polling the flag WRDY (or by waiting for the corresponding interrupt) in the PWM_ISR2.
9.
10. The update of these registers will occur at the next PWM period of the synchronous channels when the
Update Period is elapsed. Go to Step 8. for new values.
Figure 47-12. Method 2 (UPDM = 1)
CCNT0
CDTYUPD
UPRUPD
0x1
UPR
0x1
UPRCNT
0x0
CDTY
0x20
0x60
0x40
0x20
0x3
0x3
0x1
0x0
0x1
0x0
0x1
0x0
0x1
0x2
0x3
0x40
0x0
0x1
0x2
0x60
WRDY
Method 3: Automatic write of duty-cycle values and automatic trigger of the update
In this mode, the update of the duty cycle values is made automatically by the DMA Controller (DMA). The update
of the period value, the dead-time values and the update period value must be done by writing in their respective
update registers with the CPU (respectively PWM_CPRDUPDx, PWM_DTUPDx and PWM_SCUPUPD).
To trigger the update of the period value and the dead-time values, the user must use the bit UPDULOCK which
allows to update synchronously (at the same PWM period) the synchronous channels:
If the bit UPDULOCK is set to 1, the update is done at the next PWM period of the synchronous channels.
If the UPDULOCK bit is not set to 1, the update is locked and cannot be performed.
After writing the UPDULOCK bit to 1, it is held at this value until the update occurs, then it is read 0.
The update of the duty-cycle values and the update period value is triggered automatically after an update period.
To configure the automatic update, the user must define a value for the Update Period by the field UPR in the
PWM_SCUP register. The PWM controller waits UPR+1 periods of synchronous channels before updating
automatically the duty values and the update period value.
Using the DMA 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.
The DMA must write the duty-cycle values in the synchronous channels index order. For example if the channels
0, 1 and 3 are synchronous channels, the DMA must write the duty-cycle of the channel 0 first, then the duty-cycle
of the channel 1, and finally the duty-cycle of the channel 3.
The status of the DMA transfer is reported in the PWM_ISR2 by the following flags:
1461
WRDY: this flag is set to 1 when the PWM Controller is ready to receive new duty-cycle values and a new
update period value. It is reset to 0 when the PWM_ISR2 is read. The user can choose to synchronize the
WRDY flag and the DMA transfer request with a comparison match (see Section 47.6.3 PWM Comparison
Units), by the fields PTRM and PTRCS in the PWM_SCM register.
UNRE: this flag is set to 1 when the update period defined by the UPR field has elapsed while the whole
data has not been written by the DMA. It is reset to 0 when the PWM_ISR2 is read.
Depending on the interrupt mask in the PWM_IMR2, an interrupt can be generated by these flags.
Sequence for Method 3:
1. Select the automatic write of duty-cycle values and automatic update by setting the field UPDM to 2 in the
PWM_SCM register.
2.
Define the synchronous channels by the bits SYNCx in the PWM_SCM register.
3.
Define the update period by the field UPR in the PWM_SCUP register.
4.
Define when the WRDY flag and the corresponding DMA transfer request must be set in the update period
by the PTRM bit and the PTRCS field in the PWM_SCM register (at the end of the update period or when a
comparison matches).
5.
Define the DMA transfer settings for the duty-cycle values and enable it in the DMA registers
6.
7.
If an update of the period value and/or of the dead-time values is required, write registers that need to be
updated (PWM_CPRDUPDx, PWM_DTUPDx), else go to Step 10.
8.
9.
The update of these registers will occur at the beginning of the next PWM period. At this moment the bit
UPDULOCK is reset, go to Step 7. for new values.
10. If an update of the update period value is required, check first that write of a new update value is possible by
polling the flag WRDY (or by waiting for the corresponding interrupt) in the PWM_ISR2, else go to Step 13.
11. Write the register that needs to be updated (PWM_SCUPUPD).
12. The update of this register will occur at the next PWM period of the synchronous channels when the Update
Period is elapsed. Go to Step 10. for new values.
13. Check the end of the DMA transfer by the flag BTCx in DMA controller. If the transfer has ended, define a
new DMA transfer for new duty-cycle values. Go to Step 5.
Figure 47-13. Method 3 (UPDM = 2 and PTRM = 0)
CCNT0
CDTYUPD
UPRUPD
0x1
UPR
0x1
UPRCNT
0x0
CDTY
0x60
0x40
0x20
0xB0
0xA0
0x3
0x3
0x1
0x0
0x1
0x20
transfer request
WRDY
1462
0x80
0x0
0x40
0x1
0x0
0x60
0x1
0x2
0x80
0x3
0x0
0x1
0x2
0xA0
CDTYUPD
0x20
UPRUPD
0x1
UPR
0x1
UPRCNT
0x0
CDTY
0x20
0x60
0x40
0x80
0xB0
0xA0
0x3
0x3
0x1
0x0
0x40
0x1
0x0
0x1
0x60
0x0
0x2
0x1
0x80
0x3
0x0
0x1
0x2
0xA0
CMP0 match
transfer request
WRDY
All channels integrate a double-buffering system in order to prevent an unexpected output waveform while
modifying the period, the spread spectrum value, the polarity, the duty-cycle, the dead-times, the output override,
and the synchronous channels update period.
This double-buffering system comprises the following update registers:
When one of these update registers is written to, the write is stored, but the values are updated only at the next
PWM period border. In left-aligned mode (CALG = 0), the update occurs when the channel counter reaches the
period value CPRD. In center-aligned mode, the update occurs when the channel counter value is decremented
and reaches the 0 value.
In center-aligned mode, it is possible to trigger the update of the polarity and the duty-cycle at the next half period
border. This mode concerns the following update registers:
The update occurs at the first half period following the write of the update register (either when the channel counter
value is incrementing and reaches the period value CPRD, or when the channel counter value is decrementing
and reaches the 0 value). To activate this mode, the user must write a one to the bit UPDS in the PWM Channel
Mode Register.
1463
CNT [PWM_CCNT0]
Comparison x
=
1
0
1
CVM [PWM_CMPVx]
CALG [PWM_CMR0]
CPRCNT [PWM_CMPMx]
CTR [PWM_CMPMx]
The comparison x matches when it is enabled by the bit CEN in the PWM Comparison x Mode Register
(PWM_CMPMx for the comparison x) and when the counter of the channel 0 reaches the comparison value
defined by the field CV in PWM Comparison x Value Register (PWM_CMPVx for the comparison x). If the counter
of the channel 0 is center-aligned (CALG = 1 in PWM Channel Mode Register), the bit CVM (in PWM_CMPVx)
defines if the comparison is made when the counter is counting up or counting down (in left alignment mode
CALG = 0, this bit is useless).
If a fault is active on the channel 0, the comparison is disabled and cannot match (see Section 47.6.2.6 Fault
Protection).
The user can define the periodicity of the comparison x by the fields CTR and CPR (in PWM_CMPVx). The
comparison is performed periodically once every CPR+1 periods of the counter of the channel 0, when the value of
the comparison period counter CPRCNT (in PWM_CMPMx) reaches the value defined by CTR. CPR is the
maximum value of the comparison period counter CPRCNT. If CPR = CTR = 0, the comparison is performed at
each period of the counter of the channel 0.
The comparison x configuration can be modified while the channel 0 is enabled by using the PWM Comparison x
Mode Update Register (PWM_CMPMUPDx registers for the comparison x). In the same way, the comparison x
value can be modified while the channel 0 is enabled by using the PWM Comparison x Value Update Register
(PWM_CMPVUPDx registers for the comparison x).
The update of the comparison x configuration and the comparison x value is triggered periodically after the
comparison x update period. It is defined by the field CUPR in the PWM_CMPMx. The comparison unit has an
update period counter independent from the period counter to trigger this update. When the value of the
comparison update period counter CUPRCNT (in PWM_CMPMx) reaches the value defined by CUPR, the update
1464
is triggered. The comparison x update period CUPR itself can be updated while the channel 0 is enabled by using
the PWM_CMPMUPDx register.
CAUTION: The write of PWM_CMPVUPDx must be followed by a write of PWM_CMPMUPDx.
The comparison match and the comparison update can be source of an interrupt, but only if it is enabled and not
masked. These interrupts can be enabled by the PWM Interrupt Enable Register 2 and disabled by the PWM
Interrupt Disable Register 2. The comparison match interrupt and the comparison update interrupt are reset by
reading the PWM Interrupt Status Register 2.
Figure 47-16. Comparison Waveform
CCNT0
CVUPD
0x6
0x6
0x2
CVMVUPD
CTRUPD
0x1
0x2
CPRUPD
0x1
0x3
CUPRUPD
0x3
0x2
CV
0x6
0x2
CTR
0x1
0x2
CPR
0x1
0x3
CUPR
0x3
0x2
CUPRCNT
0x0
0x1
0x2
0x3
0x0
0x1
0x2
0x0
0x1
0x2
0x0
0x1
CPRCNT
0x0
0x1
0x0
0x1
0x0
0x1
0x2
0x3
0x0
0x1
0x2
0x3
0x6
CVM
Comparison Update
CMPU
Comparison Match
CMPM
1465
PULSE
GENERATOR
Event Line x
CMPM7 (PWM_ISR2)
CSEL7 (PWM_ELMRx)
Before enabling the channels, they must be configured by the software application as described below:
1466
Configuration of the clock generator (DIVA, PREA, DIVB, PREB in the PWM_CLK register if required).
Configuration of the waveform alignment for each channel (CALG field in PWM_CMRx)
Selection of the counter event selection (if CALG = 1) for each channel (CES field in PWM_CMRx)
Configuration of the output waveform polarity for each channel (CPOL bit in PWM_CMRx)
Configuration of the period for each channel (CPRD in the PWM_CPRDx register). Writing in PWM_CPRDx
register is possible while the channel is disabled. After validation of the channel, the user must use
PWM_CPRDUPDx register to update PWM_CPRDx as explained below.
Configuration of the duty-cycle for each channel (CDTY in the PWM_CDTYx register). Writing in
PWM_CDTYx register is possible while the channel is disabled. After validation of the channel, the user
must use PWM_CDTYUPDx register to update PWM_CDTYx as explained below.
Configuration of the dead-time generator for each channel (DTH and DTL in PWM_DTx) if enabled (DTE bit
in the PWM_CMRx). Writing in the PWM_DTx register is possible while the channel is disabled. After
validation of the channel, the user must use PWM_DTUPDx register to update PWM_DTx
Selection of the moment when the WRDY flag and the corresponding DMA transfer request are set (PTRM
and PTRCS in the PWM_SCM register)
Configuration of the fault protection (FMOD and FFIL in PWM_FMR, PWM_FPV and PWM_FPE1)
Enable of the Interrupts (writing CHIDx and FCHIDx in PWM_IER1, and writing WRDYE, ENDTXE,
TXBUFE, UNRE, CMPMx and CMPUx in PWM_IER2)
The large number of source clocks can make selection difficult. The relationship between the value in the PWM
Channel Period Register (PWM_CPRDx) and the PWM Channel Duty Cycle Register (PWM_CDTYx) can help the
user in choosing. The event number written in the Period Register gives the PWM accuracy. The Duty-Cycle
quantum cannot be lower than 1/CPRDx value. The higher the value of PWM_CPRDx, the greater the PWM
accuracy.
For example, if the user sets 15 (in decimal) in PWM_CPRDx, the user is able to set a value from between 1 up to
14 in PWM_CDTYx. The resulting duty-cycle quantum cannot be lower than 1/15 of the PWM period.
47.6.5.3 Changing the Duty-Cycle, the Period and the Dead-Times
If the channel is an asynchronous channel (SYNCx = 0 in PWM Sync Channels Mode Register
(PWM_SCM)), these registers hold the new period, duty-cycle and dead-times values until the end of the
current PWM period and update the values for the next period.
If the channel is a synchronous channel and update method 0 is selected (SYNCx = 1 and UPDM = 0 in
PWM_SCM register), these registers hold the new period, duty-cycle and dead-times values until the bit
UPDULOCK is written at 1 (in PWM Sync Channels Update Control Register (PWM_SCUC)) and the end
of the current PWM period, then update the values for the next period.
If the channel is a synchronous channel and update method 1 or 2 is selected (SYNCx = 1 and UPDM = 1 or
2 in PWM_SCM register):
Note:
registers PWM_CPRDUPDx and PWM_DTUPDx hold the new period and dead-times values until the
bit UPDULOCK is written at 1 (in PWM_SCUC) and the end of the current PWM period, then update
the values for the next period.
register PWM_CDTYUPDx holds the new duty-cycle value until the end of the update period of
synchronous channels (when UPRCNT is equal to UPR in PWM Sync Channels Update Period
Register (PWM_SCUP)) and the end of the current PWM period, then updates the value for the next
period.
If the update registers PWM_CDTYUPDx, PWM_CPRDUPDx and PWM_DTUPDx are written several times between
two updates, only the last written value is taken into account.
1467
User's Writing
User's Writing
PWM_DTUPDx Value
PWM_CPRDUPDx Value
PWM_CDTYUPDx Value
PWM_CPRDx
PWM_DTx
PWM_CDTYx
- If Asynchronous Channel
-> End of PWM period
- If Synchronous Channel
-> End of PWM period and UPDULOCK = 1
- If Asynchronous Channel
-> End of PWM period
- If Synchronous Channel
- If UPDM = 0
-> End of PWM period and UPDULOCK = 1
- If UPDM = 1 or 2
-> End of PWM period and end of Update Period
It is possible to change the update period of synchronous channels while they are enabled. See Method 2:
Manual write of duty-cycle values and automatic trigger of the update on page 1460 and Method 3: Automatic
write of duty-cycle values and automatic trigger of the update on page 1461.
To prevent an unexpected update of the synchronous channels registers, the user must use the PWM Sync
Channels Update Period Update Register (PWM_SCUPUPD) to change the update period of synchronous
channels while they are still enabled. This register holds the new value until the end of the update period of
synchronous channels (when UPRCNT is equal to UPR in PWM_SCUP) and the end of the current PWM period,
then updates the value for the next period.
Note:
Note:
1468
If the update register PWM_SCUPUPD is written several times between two updates, only the last written value is
taken into account.
Changing the update period does make sense only if there is one or more synchronous channels and if the update
method 1 or 2 is selected (UPDM = 1 or 2 in PWM Sync Channels Mode Register).
PWM_SCUPUPD Value
PWM_SCUP
It is possible to change the comparison values and the comparison configurations while the channel 0 is enabled
(see Section 47.6.3 PWM Comparison Units).
To prevent unexpected comparison match, the user must use the PWM Comparison x Value Update Register
(PWM_CMPVUPDx) and the PWM Comparison x Mode Update Register (PWM_CMPMUPDx) to change
respectively the comparison values and the comparison configurations while the channel 0 is still enabled. These
registers hold the new values until the end of the comparison update period (when CUPRCNT is equal to CUPR in
PWM Comparison x Mode Register (PWM_CMPMx) and the end of the current PWM period, then update the
values for the next period.
CAUTION: The write of the register PWM_CMPVUPDx must be followed by a write of the register
PWM_CMPMUPDx.
Note:
If the update registers PWM_CMPVUPDx and PWM_CMPMUPDx are written several times between two updates,
only the last written value are taken into account.
1469
User's Writing
PWM_CMPVUPDx Value
Comparison value
for comparison x
PWM_CMPMUPDx Value
Comparison configuration
for comparison x
PWM_CMPVx
PWM_CMPMx
47.6.5.6 Interrupts
Depending on the interrupt mask in the PWM_IMR1 and PWM_IMR2, an interrupt can be generated at the end of
the corresponding channel period (CHIDx in the PWM Interrupt Status Register 1 (PWM_ISR1)), after a fault event
(FCHIDx in the PWM_ISR1), after a comparison match (CMPMx in the PWM_ISR2), after a comparison update
(CMPUx in the PWM_ISR2) or according to the transfer mode of the synchronous channels (WRDY, ENDTX,
TXBUFE and UNRE in the PWM_ISR2).
If the interrupt is generated by the flags CHIDx or FCHIDx, the interrupt remains active until a read operation in the
PWM_ISR1 occurs.
If the interrupt is generated by the flags WRDY or UNRE or CMPMx or CMPUx, the interrupt remains active until a
read operation in the PWM_ISR2 occurs.
A channel interrupt is enabled by setting the corresponding bit in PWM_IER1 and PWM_IER2. A channel interrupt
is disabled by setting the corresponding bit in PWM_IDR1 and PWM_IDR2.
1470
Register group 0:
Register group 1:
Register group 2:
Register group 3:
Register group 4:
Register group 5:
HW write protectioncan be enabled by software but only disabled by a hardware reset of the PWM
controller
Both types of write protection can be applied independently to a particular register group by means of the WPCMD
and WPRGx fields in the PWM_WPCR. If at least one type of write protection is active, the register group is writeprotected. The value of field WPCMD defines the action to be performed:
0: Disables SW write protection of the register groups of which the bit WPRGx is at 1
1: Enables SW write protection of the register groups of which the bit WPRGx is at 1
2: Enables HW write protection of the register groups of which the bit WPRGx is at 1
At any time, the user can determine whether SW or HW write protection is active in a particular register group by
the fields WPSWS and WPHWS in the PWM Write Protection Status Register (PWM_WPSR).
If a write access to a write-protected register is detected, the WPVS flag in the PWM_WPSR is set and the field
WPVSRC indicates the register in which the write access has been attempted.
The WPVS and WPVSRC fields are automatically cleared after reading the PWM_WPSR.
1471
47.7
Table 47-7.
Register Mapping
Offset
Register
Name
Access
Reset
0x00
PWM_CLK
Read/Write
0x0
0x04
PWM_ENA
Write-only
0x08
PWM_DIS
Write-only
0x0C
PWM_SR
Read-only
0x0
0x10
PWM_IER1
Write-only
0x14
PWM_IDR1
Write-only
0x18
PWM_IMR1
Read-only
0x0
0x1C
PWM_ISR1
Read-only
0x0
0x20
PWM_SCM
Read/Write
0x0
0x24
PWM_DMAR
Write-only
0x28
PWM_SCUC
Read/Write
0x0
0x2C
PWM_SCUP
Read/Write
0x0
0x30
PWM_SCUPUPD
Write-only
0x0
0x34
PWM_IER2
Write-only
0x38
PWM_IDR2
Write-only
0x3C
PWM_IMR2
Read-only
0x0
0x40
PWM_ISR2
Read-only
0x0
0x44
PWM_OOV
Read/Write
0x0
0x48
PWM_OS
Read/Write
0x0
0x4C
PWM_OSS
Write-only
0x50
PWM_OSC
Write-only
0x54
PWM_OSSUPD
Write-only
0x58
PWM_OSCUPD
Write-only
0x5C
PWM_FMR
Read/Write
0x0
0x60
PWM_FSR
Read-only
0x0
0x64
PWM_FCR
Write-only
0x68
PWM_FPV1
Read/Write
0x0
0x6C
PWM_FPE
Read/Write
0x0
0x700x78
Reserved
0x7C
PWM_ELMR0
Read/Write
0x0
0x80
PWM_ELMR1
Read/Write
0x0
0x840x9C
Reserved
0xA0
PWM_SSPR
Read/Write
0x0
0xA4
PWM_SSPUP
Write-only
0xA80xAC
Reserved
1472
Table 47-7.
Offset
Register
Name
Access
Reset
0xB0
PWM_SMMR
Read/Write
0x0
0xB40xBC
Reserved
0xC0
PWM_FPV2
Read/Write
0x003F_003F
0xC40xE0
Reserved
0xE4
PWM_WPCR
Write-only
0xE8
PWM_WPSR
Read-only
0x0
0xEC0xFC
Reserved
0x1000x12C
Reserved
0x130
PWM_CMPV0
Read/Write
0x0
0x134
PWM_CMPVUPD0
Write-only
0x138
PWM_CMPM0
Read/Write
0x0
0x13C
PWM_CMPMUPD0
Write-only
0x140
PWM_CMPV1
Read/Write
0x0
0x144
PWM_CMPVUPD1
Write-only
0x148
PWM_CMPM1
Read/Write
0x0
0x14C
PWM_CMPMUPD1
Write-only
0x150
PWM_CMPV2
Read/Write
0x0
0x154
PWM_CMPVUPD2
Write-only
0x158
PWM_CMPM2
Read/Write
0x0
0x15C
PWM_CMPMUPD2
Write-only
0x160
PWM_CMPV3
Read/Write
0x0
0x164
PWM_CMPVUPD3
Write-only
0x168
PWM_CMPM3
Read/Write
0x0
0x16C
PWM_CMPMUPD3
Write-only
0x170
PWM_CMPV4
Read/Write
0x0
0x174
PWM_CMPVUPD4
Write-only
0x178
PWM_CMPM4
Read/Write
0x0
0x17C
PWM_CMPMUPD4
Write-only
0x180
PWM_CMPV5
Read/Write
0x0
0x184
PWM_CMPVUPD5
Write-only
0x188
PWM_CMPM5
Read/Write
0x0
0x18C
PWM_CMPMUPD5
Write-only
0x190
PWM_CMPV6
Read/Write
0x0
0x194
PWM_CMPVUPD6
Write-only
0x198
PWM_CMPM6
Read/Write
0x0
0x19C
PWM_CMPMUPD6
Write-only
0x1A0
PWM_CMPV7
Read/Write
0x0
1473
Table 47-7.
Offset
Register
Name
Access
Reset
0x1A4
PWM_CMPVUPD7
Write-only
0x1A8
PWM_CMPM7
Read/Write
0x0
0x1AC
PWM_CMPMUPD7
Write-only
0x1B00x1FC
Reserved
0x200 + ch_num *
0x20 + 0x00
PWM_CMR
Read/Write
0x0
0x200 + ch_num *
0x20 + 0x04
PWM_CDTY
Read/Write
0x0
0x200 + ch_num *
0x20 + 0x08
PWM_CDTYUPD
Write-only
0x200 + ch_num *
0x20 + 0x0C
PWM_CPRD
Read/Write
0x0
0x200 + ch_num *
0x20 + 0x10
PWM_CPRDUPD
Write-only
0x200 + ch_num *
0x20 + 0x14
PWM_CCNT
Read-only
0x0
0x200 + ch_num *
0x20 + 0x18
PWM_DT
Read/Write
0x0
0x200 + ch_num *
0x20 + 0x1C
PWM_DTUPD
Write-only
Write-only
0x400 + ch_num *
PWM_CMUPD
PWM Channel Mode Update Register(1)
0x20 + 0x00
Note:
1. Some registers are indexed with ch_num index ranging from 0 to 3.
1474
PWM_CLK
Address:
0xF800C000
Access:
Read/Write
31
30
29
28
27
26
23
22
21
20
19
18
11
10
25
24
17
16
PREB
DIVB
15
14
13
12
PREA
3
DIVA
This register can only be written if bits WPSWS0 and WPHWS0 are cleared in the PWM Write Protection Status Register.
DIVA, DIVB: CLKA, CLKB Divide Factor
DIVA, DIVB
CLKA, CLKB
2255
CLKA, CLKB clock is clock selected by PREA, PREB divided by DIVA, DIVB factor.
Peripheral clock
Peripheral clock/2
Peripheral clock/4
Peripheral clock/8
Peripheral clock/16
Peripheral clock/32
Peripheral clock/64
Peripheral clock/128
Peripheral clock/256
Peripheral clock/512
Peripheral clock/1024
Other
Reserved
1475
PWM_ENA
Address:
0xF800C004
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
3
CHID3
2
CHID2
1
CHID1
0
CHID0
CHIDx: Channel ID
0: No effect.
1: Enable PWM output for channel x.
1476
PWM_DIS
Address:
0xF800C008
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
3
CHID3
2
CHID2
1
CHID1
0
CHID0
This register can only be written if bits WPSWS1 and WPHWS1 are cleared in the PWM Write Protection Status Register.
CHIDx: Channel ID
0: No effect.
1: Disable PWM output for channel x.
1477
PWM_SR
Address:
0xF800C00C
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
3
CHID3
2
CHID2
1
CHID1
0
CHID0
CHIDx: Channel ID
0: PWM output for channel x is disabled.
1: PWM output for channel x is enabled.
1478
PWM_IER1
Address:
0xF800C010
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
FCHID3
18
FCHID2
17
FCHID1
16
FCHID0
15
14
13
12
11
10
3
CHID3
2
CHID2
1
CHID1
0
CHID0
1479
PWM_IDR1
Address:
0xF800C014
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
FCHID3
18
FCHID2
17
FCHID1
16
FCHID0
15
14
13
12
11
10
3
CHID3
2
CHID2
1
CHID1
0
CHID0
1480
PWM_IMR1
Address:
0xF800C018
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
FCHID3
18
FCHID2
17
FCHID1
16
FCHID0
15
14
13
12
11
10
3
CHID3
2
CHID2
1
CHID1
0
CHID0
1481
PWM_ISR1
Address:
0xF800C01C
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
FCHID3
18
FCHID2
17
FCHID1
16
FCHID0
15
14
13
12
11
10
3
CHID3
2
CHID2
1
CHID1
0
CHID0
1482
PWM_SCM
Address:
0xF800C020
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
PTRCS
21
20
PTRM
19
18
17
16
15
14
13
12
11
10
3
SYNC3
2
SYNC2
1
SYNC1
0
SYNC0
UPDM
This register can only be written if bits WPSWS2 and WPHWS2 are cleared in the PWM Write Protection Status Register.
SYNCx: Synchronous Channel x
0: Channel x is not a synchronous channel.
1: Channel x is a synchronous channel.
UPDM: Synchronous Channels Update Mode
Value
Name
MODE0
Manual write of double buffer registers and manual update of synchronous channels(1)
MODE1
Manual write of double buffer registers and automatic update of synchronous channels(2)
MODE2
Automatic write of duty-cycle update registers by the DMA and automatic update of synchronous
channels(2)
Notes:
Description
1. The update occurs at the beginning of the next PWM period, when the UPDULOCK bit in PWM Sync Channels Update
Control Register is set.
2. The update occurs when the Update Period is elapsed.
PTRM
The WRDY flag in PWM Interrupt Status Register 2 and the DMA transfer request are never set
to 1.
The WRDY flag in PWM Interrupt Status Register 2 is set to 1 as soon as the update period is
elapsed, the DMA transfer request is never set to 1.
The WRDY flag in PWM Interrupt Status Register 2 and the DMA transfer request are set to 1 as
soon as the update period is elapsed.
The WRDY flag in PWM Interrupt Status Register 2 and the DMA transfer request are set to 1 as
soon as the selected comparison matches.
1483
PWM_DMAR
Address:
0xF800C024
Access:
Write- only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
11
10
DMADUTY
15
14
13
12
DMADUTY
4
DMADUTY
1484
PWM_SCUC
Address:
0xF800C028
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
0
UPDULOCK
1485
PWM_SCUP
Address:
0xF800C02C
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
UPRCNT
UPR
1486
PWM_SCUPUPD
Address:
0xF800C030
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
UPRUPD
This register acts as a double buffer for the UPR value. This prevents an unexpected automatic trigger of the update of
synchronous channels.
UPRUPD: Update Period Update
Defines the wanted time between each update of the synchronous channels if automatic trigger of the update is activated
(UPDM = 1 or UPDM = 2 in PWM Sync Channels Mode Register). This time is equal to UPR+1 periods of the synchronous
channels.
1487
PWM_IER2
Address:
0xF800C034
Access:
Write-only
31
30
29
28
27
26
25
24
23
CMPU7
22
CMPU6
21
CMPU5
20
CMPU4
19
CMPU3
18
CMPU2
17
CMPU1
16
CMPU0
15
CMPM7
14
CMPM6
13
CMPM5
12
CMPM4
11
CMPM3
10
CMPM2
9
CMPM1
8
CMPM0
3
UNRE
0
WRDY
1488
PWM_IDR2
Address:
0xF800C038
Access:
Write-only
31
30
29
28
27
26
25
24
23
CMPU7
22
CMPU6
21
CMPU5
20
CMPU4
19
CMPU3
18
CMPU2
17
CMPU1
16
CMPU0
15
CMPM7
14
CMPM6
13
CMPM5
12
CMPM4
11
CMPM3
10
CMPM2
9
CMPM1
8
CMPM0
3
UNRE
0
WRDY
1489
PWM_IMR2
Address:
0xF800C03C
Access:
Read-only
31
30
29
28
27
26
25
24
23
CMPU7
22
CMPU6
21
CMPU5
20
CMPU4
19
CMPU3
18
CMPU2
17
CMPU1
16
CMPU0
15
CMPM7
14
CMPM6
13
CMPM5
12
CMPM4
11
CMPM3
10
CMPM2
9
CMPM1
8
CMPM0
3
UNRE
0
WRDY
1490
PWM_ISR2
Address:
0xF800C040
Access:
Read-only
31
30
29
28
27
26
25
24
23
CMPU7
22
CMPU6
21
CMPU5
20
CMPU4
19
CMPU3
18
CMPU2
17
CMPU1
16
CMPU0
15
CMPM7
14
CMPM6
13
CMPM5
12
CMPM4
11
CMPM3
10
CMPM2
9
CMPM1
8
CMPM0
3
UNRE
0
WRDY
1491
PWM_OOV
Address:
0xF800C044
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
OOVL3
18
OOVL2
17
OOVL1
16
OOVL0
15
14
13
12
11
10
3
OOVH3
2
OOVH2
1
OOVH1
0
OOVH0
1492
PWM_OS
Address:
0xF800C048
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
OSL3
18
OSL2
17
OSL1
16
OSL0
15
14
13
12
11
10
3
OSH3
2
OSH2
1
OSH1
0
OSH0
1493
PWM_OSS
Address:
0xF800C04C
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
OSSL3
18
OSSL2
17
OSSL1
16
OSSL0
15
14
13
12
11
10
3
OSSH3
2
OSSH2
1
OSSH1
0
OSSH0
1494
PWM_OSC
Address:
0xF800C050
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
OSCL3
18
OSCL2
17
OSCL1
16
OSCL0
15
14
13
12
11
10
3
OSCH3
2
OSCH2
1
OSCH1
0
OSCH0
1495
PWM_OSSUPD
Address:
0xF800C054
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
OSSUPL3
18
OSSUPL2
17
OSSUPL1
16
OSSUPL0
15
14
13
12
11
10
3
OSSUPH3
2
OSSUPH2
1
OSSUPH1
0
OSSUPH0
1496
PWM_OSCUPD
Address:
0xF800C058
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
OSCUPL3
18
OSCUPL2
17
OSCUPL1
16
OSCUPL0
15
14
13
12
11
10
3
OSCUPH3
2
OSCUPH2
1
OSCUPH1
0
OSCUPH0
1497
PWM_FMR
Address:
0xF800C05C
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
23
22
21
20
FFIL
15
14
13
12
FMOD
4
FPOL
This register can only be written if bits WPSWS5 and WPHWS5 are cleared in the PWM Write Protection Status Register.
FPOL: Fault Polarity
For each field bit y (fault input number):
0: The fault y becomes active when the fault input y is at 0.
1: The fault y becomes active when the fault input y is at 1.
FMOD: Fault Activation Mode
For each field bit y (fault input number):
0: The fault y is active until the fault condition is removed at the peripheral(1) level.
1: The fault y stays active until the fault condition is removed at the peripheral(1) level AND until it is cleared in the PWM
Fault Clear Register.
Note:
CAUTION: To prevent an unexpected activation of the status flag FSy in the PWM Fault Status Register, the bit FMODy
can be set to 1 only if the FPOLy bit has been previously configured to its final value.
1498
PWM_FSR
Address:
0xF800C060
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
23
22
21
20
15
14
13
12
FS
4
FIV
1499
PWM_FCR
Address:
0xF800C064
Access:
Write-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
23
22
21
20
15
14
13
12
4
FCLR
1500
PWM_FPV1
Address:
0xF800C068
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
FPVL3
18
FPVL2
17
FPVL1
16
FPVL0
15
14
13
12
11
10
3
FPVH3
2
FPVH2
1
FPVH1
0
FPVH0
This register can only be written if bits WPSWS5 and WPHWS5 are cleared in the PWM Write Protection Status Register.
FPVHx: Fault Protection Value for PWMH output on channel x
This bit is taken into account only if the bit FPZHx is set to 0 in PWM Fault Protection Value Register 2.
0: PWMH output of channel x is forced to 0 when fault occurs.
1: PWMH output of channel x is forced to 1 when fault occurs.
FPVLx: Fault Protection Value for PWML output on channel x
This bit is taken into account only if the bit FPZLx is set to 0 in PWM Fault Protection Value Register 2.
0: PWML output of channel x is forced to 0 when fault occurs.
1: PWML output of channel x is forced to 1 when fault occurs.
1501
PWM_FPE
Address:
0xF800C06C
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
FPE3
23
22
21
20
FPE2
15
14
13
12
FPE1
4
FPE0
This register can only be written if bits WPSWS5 and WPHWS5 are cleared in the PWM Write Protection Status Register.
Only the first 8 bits (number of fault input pins) of fields FPE0, FPE1, FPE2 and FPE3 are significant.
FPEx: Fault Protection Enable for channel x
For each field bit y (fault input number):
0: Fault y is not used for the fault protection of channel x.
1: Fault y is used for the fault protection of channel x.
CAUTION: To prevent an unexpected activation of the fault protection, the bit y of FPEx field can be set to 1 only if the
corresponding FPOL field has been previously configured to its final value in PWM Fault Mode Register.
1502
PWM_ELMRx
Address:
0xF800C07C
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
7
CSEL7
6
CSEL6
5
CSEL5
4
CSEL4
3
CSEL3
2
CSEL2
1
CSEL1
0
CSEL0
1503
PWM_SSPR
Address:
0xF800C0A0
Access:
Read/Write
31
30
29
28
27
26
25
24
SPRDM
23
22
21
20
19
18
17
16
11
10
SPRD
15
14
13
12
SPRD
4
SPRD
This register can only be written if bits WPSWS3 and WPHWS3 are cleared in the PWM Write Protection Status Register.
Only the first 16 bits (channel counter size) are significant.
SPRD: Spread Spectrum Limit Value
The spread spectrum limit value defines the range for the spread spectrum counter. It is introduced in order to achieve constant varying PWM period for the output waveform.
SPRDM: Spread Spectrum Counter Mode
0: Triangular mode. The spread spectrum counter starts to count from -SPRD when the channel 0 is enabled and counts
upwards at each PWM period. When it reaches +SPRD, it restarts to count from -SPRD again.
1: Random mode. The spread spectrum counter is loaded with a new random value at each PWM period. This random
value is uniformly distributed and is between -SPRD and +SPRD.
1504
PWM_SSPUP
Address:
0xF800C0A4
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
11
10
SPRDUP
15
14
13
12
SPRDUP
4
SPRDUP
This register can only be written if bits WPSWS3 and WPHWS3 are cleared in the PWM Write Protection Status Register.
This register acts as a double buffer for the SPRD value. This prevents an unexpected waveform when modifying the
spread spectrum limit value.
Only the first 16 bits (channel counter size) are significant.
SPRDUP: Spread Spectrum Limit Value Update
The spread spectrum limit value defines the range for the spread spectrum counter. It is introduced in order to achieve constant varying period for the output waveform.
1505
PWM_SMMR
Address:
0xF800C0B0
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
DOWN1
16
DOWN0
15
14
13
12
11
10
1
GCEN1
0
GCEN0
1506
PWM_FPV2
Address:
0xF800C0C0
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
FPZL3
18
FPZL2
17
FPZL1
16
FPZL0
15
14
13
12
11
10
3
FPZH3
2
FPZH2
1
FPZH1
0
FPZH0
This register can only be written if bits WPSWS5 and WPHWS5 are cleared in the PWM Write Protection Status Register.
FPZHx: Fault Protection to Hi-Z for PWMH output on channel x
0: When fault occurs, PWMH output of channel x is forced to value defined by the bit FPVHx in PWM Fault Protection
Value Register 1.
1: When fault occurs, PWMH output of channel x is forced to high-impedance state.
FPZLx: Fault Protection to Hi-Z for PWML output on channel x
0: When fault occurs, PWML output of channel x is forced to value defined by the bit FPVLx in PWM Fault Protection Value
Register 1.
1: When fault occurs, PWML output of channel x is forced to high-impedance state.
1507
PWM_WPCR
Address:
0xF800C0E4
Access:
Write-only
Reset:
31
30
29
28
27
26
25
24
19
18
17
16
11
10
3
WPRG1
2
WPRG0
WPKEY
23
22
21
20
WPKEY
15
14
13
12
WPKEY
7
WPRG5
6
WPRG4
5
WPRG3
4
WPRG2
0
WPCMD
See Section 47.6.6 Register Write Protection for the list of registers that can be write-protected.
WPCMD: Write Protection Command
This command is performed only if the WPKEY corresponds to 0x50574D (PWM in ASCII).
Value
Name
DISABLE_SW_PROT
Disables the software write protection of the register groups of which the bit WPRGx is at 1.
ENABLE_SW_PROT
Enables the software write protection of the register groups of which the bit WPRGx is at 1.
ENABLE_HW_PROT
Enables the hardware write protection of the register groups of which the bit WPRGx is at 1.
Only a hardware reset of the PWM controller can disable the hardware write protection.
Moreover, to meet security requirements, the PIO lines associated with the PWM can not be
configured through the PIO interface.
Description
Name
0x50574D
PASSWD
1508
Description
Writing any other value in this field aborts the write operation of the WPCMD field.
Always reads as 0
PWM_WPSR
Address:
0xF800C0E8
Access:
Read-only
Reset:
31
30
29
28
27
26
25
24
19
18
17
16
WPVSRC
23
22
21
20
WPVSRC
15
14
13
WPHWS5
12
WPHWS4
11
WPHWS3
10
WPHWS2
9
WPHWS1
8
WPHWS0
7
WPVS
5
WPSWS5
4
WPSWS4
3
WPSWS3
2
WPSWS2
1
WPSWS1
0
WPSWS0
1509
PWM_CMPVx
Address:
0xF800C130 [0], 0xF800C140 [1], 0xF800C150 [2], 0xF800C160 [3], 0xF800C170 [4], 0xF800C180 [5],
0xF800C190 [6], 0xF800C1A0 [7]
Access:
Read/Write
31
30
29
28
23
22
21
20
27
26
25
24
CVM
19
18
17
16
11
10
CV
15
14
13
12
CV
4
CV
Only the first 16 bits (channel counter size) of field CV are significant.
CV: Comparison x Value
Define the comparison x value to be compared with the counter of the channel 0.
CVM: Comparison x Value Mode
0: The comparison x between the counter of the channel 0 and the comparison x value is performed when this counter is
incrementing.
1: The comparison x between the counter of the channel 0 and the comparison x value is performed when this counter is
decrementing.
Note: This bit is not relevant if the counter of the channel 0 is left-aligned (CALG = 0 in PWM Channel Mode Register)
1510
PWM_CMPVUPDx
Address:
0xF800C134 [0], 0xF800C144 [1], 0xF800C154 [2], 0xF800C164 [3], 0xF800C174 [4], 0xF800C184 [5],
0xF800C194 [6], 0xF800C1A4 [7]
Access:
Write-only
31
30
29
28
23
22
21
20
27
26
25
24
CVMUPD
19
18
17
16
11
10
CVUPD
15
14
13
12
CVUPD
4
CVUPD
This register acts as a double buffer for the CV and CVM values. This prevents an unexpected comparison x match.
Only the first 16 bits (channel counter size) of field CVUPD are significant.
CVUPD: Comparison x Value Update
Define the comparison x value to be compared with the counter of the channel 0.
CVMUPD: Comparison x Value Mode Update
0: The comparison x between the counter of the channel 0 and the comparison x value is performed when this counter is
incrementing.
1: The comparison x between the counter of the channel 0 and the comparison x value is performed when this counter is
decrementing.
Note: This bit is not relevant if the counter of the channel 0 is left-aligned (CALG = 0 in PWM Channel Mode Register)
CAUTION: The write of the register PWM_CMPVUPDx must be followed by a write of the register PWM_CMPMUPDx.
1511
PWM_CMPMx
Address:
0xF800C138 [0], 0xF800C148 [1], 0xF800C158 [2], 0xF800C168 [3], 0xF800C178 [4], 0xF800C188 [5],
0xF800C198 [6], 0xF800C1A8 [7]
Access:
Read/Write
31
30
23
22
29
28
27
26
21
20
19
18
CUPRCNT
15
14
13
24
17
16
0
CEN
CUPR
12
11
10
CPRCNT
7
25
CPR
5
CTR
1512
PWM_CMPMUPDx
Address:
0xF800C13C [0], 0xF800C14C [1], 0xF800C15C [2], 0xF800C16C [3], 0xF800C17C [4], 0xF800C18C [5],
0xF800C19C [6], 0xF800C1AC [7]
Access:
Write-only
31
30
29
28
27
26
23
22
21
20
19
18
15
14
13
12
11
CTRUPD
25
24
17
16
0
CENUPD
CUPRUPD
10
CPRUPD
2
This register acts as a double buffer for the CEN, CTR, CPR and CUPR values. This prevents an unexpected comparison
x match.
CENUPD: Comparison x Enable Update
0: The comparison x is disabled and can not match.
1: The comparison x is enabled and can match.
CTRUPD: Comparison x Trigger Update
The comparison x is performed when the value of the comparison x period counter (CPRCNT) reaches the value defined
by CTR.
CPRUPD: Comparison x Period Update
CPR defines the maximum value of the comparison x period counter (CPRCNT). The comparison x value is performed
periodically once every CPR+1 periods of the channel 0 counter.
CUPRUPD: Comparison x Update Period Update
Defines the time between each update of the comparison x mode and the comparison x value. This time is equal to
CUPR+1 periods of the channel 0 counter.
1513
PWM_CMRx [x=0..3]
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
DTLI
17
DTHI
16
DTE
15
14
13
12
11
UPDS
10
CES
9
CPOL
8
CALG
CPRE
This register can only be written if bits WPSWS2 and WPHWS2 are cleared in the PWM Write Protection Status Register.
CPRE: Channel Pre-scaler
Value
Name
Description
0b0000
MCK
Peripheral clock
0b0001
MCK_DIV_2
Peripheral clock/2
0b0010
MCK_DIV_4
Peripheral clock/4
0b0011
MCK_DIV_8
Peripheral clock/8
0b0100
MCK_DIV_16
Peripheral clock/16
0b0101
MCK_DIV_32
Peripheral clock/32
0b0110
MCK_DIV_64
Peripheral clock/64
0b0111
MCK_DIV_128
Peripheral clock/128
0b1000
MCK_DIV_256
Peripheral clock/256
0b1001
MCK_DIV_512
Peripheral clock/512
0b1010
MCK_DIV_1024
Peripheral clock/1024
0b1011
CLKA
Clock A
0b1100
CLKB
Clock B
1514
1515
PWM_CDTYx [x=0..3]
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
11
10
CDTY
15
14
13
12
CDTY
4
CDTY
1516
PWM_CDTYUPDx [x=0..3]
Address:
Access:
Write-only.
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
11
10
CDTYUPD
15
14
13
12
CDTYUPD
4
CDTYUPD
This register acts as a double buffer for the CDTY value. This prevents an unexpected waveform when modifying the
waveform duty-cycle.
Only the first 16 bits (channel counter size) are significant.
CDTYUPD: Channel Duty-Cycle Update
Defines the waveform duty-cycle. This value must be defined between 0 and CPRD (PWM_CPRx).
1517
PWM_CPRDx [x=0..3]
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
11
10
CPRD
15
14
13
12
CPRD
4
CPRD
This register can only be written if bits WPSWS3 and WPHWS3 are cleared in the PWM Write Protection Status Register.
Only the first 16 bits (channel counter size) are significant.
CPRD: Channel Period
If the waveform is left-aligned, then the output waveform period depends on the channel counter source clock and can be
calculated:
By using the PWM peripheral clock divided by an X given prescaler value (with X being 1, 2, 4, 8, 16, 32, 64,
128, 256, 512, or 1024). The resulting period formula will be:
( X CPRD )------------------------------f peripheral clock
By using the PWM peripheral clock divided by one of both DIVA or DIVB divider, the formula becomes,
respectively:
(----------------------------------------CRPD DIVA )( CRPD DIVB )
or -----------------------------------------f peripheral clock
f peripheral clock
If the waveform is center-aligned, then the output waveform period depends on the channel counter source clock and can
be calculated:
By using the PWM peripheral clock divided by an X given prescaler value (with X being 1, 2, 4, 8, 16, 32, 64,
128, 256, 512, or 1024). The resulting period formula will be:
(---------------------------------------2 X CPRD )
f peripheral clock
By using the PWM peripheral clock divided by one of both DIVA or DIVB divider, the formula becomes,
respectively:
(--------------------------------------------------2 CPRD DIVA )
( 2 CPRD DIVB )
or --------------------------------------------------f peripheral clock
f peripheral clock
1518
PWM_CPRDUPDx [x=0..3]
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
11
10
CPRDUPD
15
14
13
12
CPRDUPD
4
CPRDUPD
This register can only be written if bits WPSWS3 and WPHWS3 are cleared in the PWM Write Protection Status Register.
This register acts as a double buffer for the CPRD value. This prevents an unexpected waveform when modifying the
waveform period.
Only the first 16 bits (channel counter size) are significant.
CPRDUPD: Channel Period Update
If the waveform is left-aligned, then the output waveform period depends on the channel counter source clock and can be
calculated:
By using the PWM peripheral clock divided by an X given prescaler value (with X being 1, 2, 4, 8, 16, 32, 64,
128, 256, 512, or 1024). The resulting period formula will be:
(-------------------------------------------X CPRDUPD )
f peripheral clock
By using the PWM peripheral clock divided by one of both DIVA or DIVB divider, the formula becomes,
respectively:
(------------------------------------------------------CRPDUPD DIVA )( CRPDUPD DIVB )
or -------------------------------------------------------f peripheral clock
f peripheral clock
If the waveform is center-aligned, then the output waveform period depends on the channel counter source clock and can
be calculated:
By using the PWM peripheral clock divided by an X given prescaler value (with X being 1, 2, 4, 8, 16, 32, 64,
128, 256, 512, or 1024). The resulting period formula will be:
( 2 X CPRDUPD -)
----------------------------------------------------f peripheral clock
By using the PWM peripheral clock divided by one of both DIVA or DIVB divider, the formula becomes,
respectively:
( 2 CPRDUPD DIVA -)
( 2 CPRDUPD DIVB )
---------------------------------------------------------------or ----------------------------------------------------------------f peripheral clock
f peripheral clock
1519
PWM_CCNTx [x=0..3]
Address:
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
11
10
CNT
15
14
13
12
CNT
4
CNT
1520
PWM_DTx [x=0..3]
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
DTL
23
22
21
20
DTL
15
14
13
12
DTH
4
DTH
This register can only be written if bits WPSWS4 and WPHWS4 are cleared in the PWM Write Protection Status Register.
Only the first 12 bits (dead-time counter size) of fields DTH and DTL are significant.
DTH: Dead-Time Value for PWMHx Output
Defines the dead-time value for PWMHx output. This value must be defined between 0 and CPRD-CDTY (PWM_CPRx
and PWM_CDTYx).
DTL: Dead-Time Value for PWMLx Output
Defines the dead-time value for PWMLx output. This value must be defined between 0 and CDTY (PWM_CDTYx).
1521
PWM_DTUPDx [x=0..3]
Address:
Access:
Write-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
DTLUPD
23
22
21
20
DTLUPD
15
14
13
12
DTHUPD
4
DTHUPD
This register can only be written if bits WPSWS4 and WPHWS4 are cleared in the PWM Write Protection Status Register.
This register acts as a double buffer for the DTH and DTL values. This prevents an unexpected waveform when modifying
the dead-time values.
Only the first 12 bits (dead-time counter size) of fields DTHUPD and DTLUPD are significant.
DTHUPD: Dead-Time Value Update for PWMHx Output
Defines the dead-time value for PWMHx output. This value must be defined between 0 and CPRD-CDTY (PWM_CPRx
and PWM_CDTYx). This value is applied only at the beginning of the next channel x PWM period.
DTLUPD: Dead-Time Value Update for PWMLx Output
Defines the dead-time value for PWMLx output. This value must be defined between 0 and CDTY (PWM_CDTYx). This
value is applied only at the beginning of the next channel x PWM period.
1522
PWM_CMUPDx [x=0..3]
Address:
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
CPOLINVUP
12
11
10
9
CPOLUP
This register can only be written if bits WPSWS2 and WPHWS2 are cleared in the PWM Write Protection Status Register.
This register acts as a double buffer for the CPOL value. This prevents an unexpected waveform when modifying the polarity value.
CPOLUP: Channel Polarity Update
The write of this bit is taken into account only if the bit CPOLINVUP is written at 0 at the same time.
0: The OCx output waveform (output from the comparator) starts at a low level.
1: The OCx output waveform (output from the comparator) starts at a high level.
CPOLINVUP: Channel Polarity Inversion Update
If this bit is written at 1, the write of the bit CPOLUP is not taken into account.
0: No effect.
1: The OCx output waveform (output from the comparator) is inverted.
1523
48.
48.1
Description
The ADC is based on a 10-bit Analog-to-Digital Converter (ADC) managed by an ADC Controller providing
enhanced resolution up to 12 bits. Refer to Figure 48-1. "Analog-to-Digital Converter Block Diagram with
Touchscreen Mode". It also integrates a 5-to-1 analog multiplexer, making possible the analog-to-digital
conversions of 5 analog lines.The conversions extend from 0V to the voltage carried on pin ADVREF.
The ADC digital controller embeds circuitry to reduce the resolution down to 8 bits. The 8-bit resolution mode
prevents using 16-bit Peripheral DMA transfer into memory when only 8-bit resolution is required by the
application. Note that using this low resolution mode does not increase the conversion rate.
Conversion results are reported in a common register for all channels, as well as in a channel-dedicated register.
The 11-bit and 12-bit resolution modes are obtained by averaging multiple samples to decrease quantization
noise. For 11-bit mode, 4 samples are used, which gives a real sample rate of 1/4 of the actual sample frequency.
For 12-bit mode, 16 samples are used, giving a real sample rate of 1/16 of the actual sample frequency. This
arrangement allows conversion speed to be traded for better accuracy.
Software trigger, external trigger on rising edge of the ADTRG pin or internal triggers from Timer Counter output(s)
are configurable.
The comparison circuitry allows automatic detection of values below a threshold, higher than a threshold, in a
given range or outside the range, thresholds and ranges being fully configurable.
The ADC Controller internal fault output is directly connected to PWM fault input. This input can be asserted by
means of comparison circuitry in order to immediately put the PWM output in a safe state (pure combinational
path).
The ADC also integrates a Sleep mode and a conversion sequencer and connects with a DMA channel. These
features reduce both power consumption and processor intervention.
Finally, the user can configure ADC timings, such as startup time and tracking time.
This ADC Controller includes a Resistive Touchscreen Controller. It supports 4-wire and 5-wire technologies.
1524
48.2
Embedded Characteristics
DMA Support
Automatic Wakeup on Trigger and Back to Sleep Mode after Conversions of all Enabled Channels
1525
48.3
Block Diagram
Figure 48-1.
Periodic
Trigger
Trigger
Selection
ADTRG
Control
Logic
ADC Interrupt
Interrupt
Controller
ADC cell
VDDANA
ADCCLK
ADVREF
System Bus
Touchscreen
Analog
Inputs
AD0/XP/UL
AD1/XM/UR
Touchscreen
Switches
AD2/YP/LL
AD4/LR
AD-
Other
Analog
Inputs
AD3/YM/Sense
PIO
DMA
Peripheral Bridge
Successive
Approximation
Register
Analog-to-Digital
Converter
CHx
Signal Description
ADC Pin Description
Pin Name
Description
VDDANA
ADVREF
reference voltage
AD0AD4
ADTRG
External trigger
1526
APB
Peripheral Clock
GND
Table 48-1.
Bus Clock
AD-
AD-
48.4
User
Interface
PMC
48.5
Product Dependencies
Peripheral IDs
Instance
ID
ADC
44
I/O Lines
Instance
Signal
I/O Line
Peripheral
ADC
ADTRG
PE31
ADC
AD0
PC27
ADC
AD1
PC28
ADC
AD2
PC29
ADC
AD3
PC30
ADC
AD4
PC31
1527
48.6
Functional Description
ADCCLK
Trigger event
(Hard or Soft)
ADC_ON
ADC_Start
ADC_eoc
ADC_SEL
CH0
LCDR
CH1
CH2
CH0
CH1
DRDY
Conversion of CH0
Start Up Time
(and tracking of CH0)
Tracking of CH1
Conversion of CH1
Tracking of CH2
The 8-bit selection is performed by setting the LOWRES bit in ADC_MR. By default, after a reset, the resolution is
the highest and the DATA field in the data registers is fully used. By setting the LOWRES bit, the ADC switches to
the lowest resolution and the conversion results can be read in the lowest significant bits of the data registers. The
two highest bits of the DATA field in the corresponding Channel Data register (ADC_CDR) and of the LDATA field
in the Last Converted Data register (ADC_LCDR) read 0.
48.6.4 Conversion Results
When a conversion is completed, the resulting digital value is stored in the Channel Data register (ADC_CDRx) of
the current channel and in the ADC Last Converted Data register (ADC_LCDR). By setting the TAG option in the
Extended Mode register (ADC_EMR), the ADC_LCDR presents the channel number associated with the last
converted data in the CHNB field.
The channel EOC bit and the DRDY bit in the Interrupt Status register (ADC_ISR) are set. In the case of a
connected DMA channel, DRDY rising triggers a data request. In any case, either EOC and DRDY can trigger an
interrupt.
Reading one of the ADC_CDRx clears the corresponding EOC bit. Reading ADC_LCDR clears the DRDY bit.
Figure 48-3.
CHx
(ADC_CHSR)
EOCx
(ADC_ISR)
DRDY
(ADC_ISR)
If ADC_CDR is not read before further incoming data is converted, the corresponding OVREx flag is set in the
Overrun Status register (ADC_OVER).
New data converted when DRDY is high sets the GOVRE bit in ADC_ISR.
The OVREx flag is automatically cleared when ADC_OVER is read, and the GOVRE flag is automatically cleared
when ADC_ISR is read.
1529
Figure 48-4.
Trigger event
CH0
(ADC_CHSR)
CH1
(ADC_CHSR)
ADC_LCDR
Undefined Data
ADC_CDR0
Undefined Data
ADC_CDR1
EOC0
(ADC_ISR)
Data C
Data B
Conversion A
GOVRE
(ADC_ISR)
Data C
Data A
Undefined Data
EOC1
(ADC_ISR)
Data B
Data A
Conversion C
Conversion B
Read ADC_CDR0
Read ADC_CDR1
Read ADC_ISR
DRDY
(ADC_ISR)
Read ADC_OVER
OVRE0
(ADC_OVER)
OVRE1
(ADC_OVER)
Warning: If the corresponding channel is disabled during a conversion or if it is disabled and then reenabled during a conversion, its associated data and corresponding EOCx and GOVRE flags in ADC_ISR and OVREx flags in ADC_OVER are
unpredictable.
1530
any edge, either rising or falling or both, detected on the external trigger pin TSADTRG
the Pen Detect, depending on how the PENDET bit is set in the ADC Touchscreen Mode register
(ADC_TSMR)
a continuous trigger, meaning the ADC Controller restarts the next sequence as soon as it finishes the
current one
The minimum time between two consecutive trigger events must be strictly greater than the duration time of the
longest conversion sequence according to configuration of registers ADC_MR, ADC_CHSR, ADC_SEQRx,
ADC_TSMR.
If a hardware trigger is selected, the start of a conversion is triggered after a delay starting at each rising edge of
the selected signal. Due to asynchronous handling, the delay may vary in a range of two peripheral clock periods
to one ADC clock period.
Figure 48-5.
trigger
start
delay
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) registers permit the analog channels to be enabled or
disabled independently.
If the ADC is used with a DMA, only the transfers of converted data from enabled channels are performed and the
resulting data buffers should be interpreted accordingly.
48.6.6 Sleep Mode and Conversion Sequencer
The ADC Sleep mode maximizes power saving by automatically deactivating the ADC when it is not being used for
conversions. Sleep mode is selected by setting the SLEEP bit in ADC_MR.
Sleep mode is managed by a conversion sequencer, which automatically processes the conversions of all
channels at lowest power consumption.
This mode can be used when the minimum period of time between two successive trigger events is greater than
the startup period of the ADC. See the section ADC Characteristics in the Electrical Characteristics.
1531
When a start conversion request occurs, the ADC is automatically activated. As the analog cell requires a start-up
time, the logic waits during this time and starts the conversion on the enabled channels. When all conversions are
complete, the ADC is deactivated until the next trigger. Triggers occurring during the sequence are ignored.
The conversion sequencer allows automatic processing with minimum processor intervention and optimized power
consumption. Conversion sequences can be performed periodically using the internal timer (ADC_TRGR) or the
PWM event line. The periodic acquisition of several samples can be processed automatically without any
intervention of the processor via the DMA.
The sequence can be customized by programming the Sequence Channel Register ADC_SEQR1 and setting the
USEQ bit of the Mode Register (ADC_MR). The user can choose a specific order of channels and can program up
to 5 conversions by sequence. The user is free to create a personal sequence by writing channel numbers in
ADC_SEQR1. Not only can channel numbers be written in any sequence, channel numbers can be repeated
several times. When the bit USEQ in ADC_MR is set, the fields USCHx in ADC_SEQR1 are used to define the
sequence. Only enabled USCHx fields will be part of the sequence. Each USCHx field has a corresponding
enable, CHx, in ADC_CHER (USCHx field with the lowest x index is associated with bit CHx of the lowest index).
If all ADC channels (i.e., 5) are used on an application board, there is no restriction of usage of the user sequence.
However, if some ADC channels are not enabled for conversion but rather used as pure digital inputs, the
respective indexes of these channels cannot be used in the user sequence fields (see ADC_SEQRx). For
example, if channel 4 is disabled (ADC_CSR[4] = 0), ADC_SEQRx fields USCH1 up to USCH5 must not contain
the value 4. Thus the length of the user sequence may be limited by this behavior.
As an example, if only four channels over 5 (CH0 up to CH3) are selected for ADC conversions, the user sequence
length cannot exceed four channels. Each trigger event may launch up to four successive conversions of any
combination of channels 0 up to 3 but no more (i.e., in this case the sequence CH0, CH0, CH1, CH1, CH1 is
impossible).
A sequence that repeats the same channel several times requires more enabled channels than channels actually
used for conversion. For example, the sequence CH0, CH0, CH1, CH1 requires four enabled channels (four free
channels on application boards) whereas only CH0, CH1 are really converted.
Note:
The reference voltage pins always remain connected in normal mode as in sleep mode.
1532
Warning: No input buffer amplifier to isolate the source is included in the ADC. This must be taken into
consideration to program a precise value in the TRACKTIM field. See the section ADC Characteristics in the
Electrical Characteristics.
48.6.9 Enhanced Resolution Mode and Digital Averaging Function
The Enhanced Resolution mode is enabled if LOWRES is cleared in ADC_MR, and the OSR field is set to 1, 2 in
ADC_EMR. The enhancement is based on a digital averaging function.
There is no averaging on the last index channel if the measure is triggered by an RTC event.
In this mode the ADC Controller will trade conversion performance for accuracy by averaging multiple samples,
thus providing a digital low-pass filter function.
If 1-bit enhancement resolution is selected (OSR = 1 in ADC_EMR), the ADC real sample rate is the maximum
ADC sample rate divided by 4, therefore the oversampling ratio is 4.
When 2-bit enhancement resolution is selected (OSR = 2 in ADC_EMR), the ADC real sample rate is the
maximum ADC sample rate divided by 16 (oversampling ratio is 16).
The selected oversampling ratio applies to all enabled channels except for the temperature sensor channel when
triggered by an RTC event.
The average result is valid into the ADC_CDRx (x corresponding to the index of the channel) only if EOCn flag is
set in ADC_ISR and OVREn flag is cleared in ADC_OVER. The average result for all channels is valid in the
ADC_LCDR only if DRDY is set and GOVRE is cleared in the ADC_ISR.
Note that ADC_CDRs are not buffered. Therefore, when an averaging sequence is ongoing, the value in these
registers changes after each averaging sample. However, overrun flags in ADC_OVER rise as soon as the first
sample of an averaging sequence is received. Thus the previous averaged value is not read, even if the new
averaged value is not ready.
Consequently, when an overrun flag rises in ADC_OVER, it means that the previous unread data is lost but it does
not mean that this data has been overwritten by the new averaged value as the averaging sequence concerning
this channel can still be ongoing.
48.6.9.1 Averaging Function versus Trigger Events
The samples can be defined in different ways for the averaging function depending on the configuration of the
ASTE bit in ADC_EMR and the USEQ bit in ADC_MR.
When USEQ is cleared, there are two possible ways to generate the averaging through the trigger event. If ASTE
bit is cleared in ADC_EMR, every trigger event generates one sample for each enabled channel as described in
Figure 48-6. "Digital Averaging Function Waveforms Over Multiple Trigger Events". Therefore four trigger events
are requested to get the result of averaging if OSR = 1.
1533
Figure 48-6.
CH0_0
0i1
0i2
0i3
CH0_1
0i1
Read ADC_CDR[0]
EOC[0]
OVR[0]
ADC_CDR[1]
CH1_0
1i1
1i2
1i3
CH1_1
1i1
Read ADC_CDR[1]
Read ADC_CDR[1]
EOC[1]
ADC_LCDR
CH1_0
CH0_1
CH1_1
DRDY
Read ADC_LCDR
Read ADC_LCDR
Notes:
If ASTE = 1 in ADC_EMR and USEQ = 0 in ADC_MR, then the sequence to be converted, defined in ADC_CHSR,
is automatically repeated n times (where n corresponds to the oversampling ratio defined in the OSR field in
ADC_EMR). As a result, only one trigger is required to obtain the result of the averaging function as described in
Figure 48-7. "Digital Averaging Function Waveforms on a Single Trigger Event".
1534
Figure 48-7.
ADC_SEL
ADC_CDR[0]
CH0_0
0i1
0i2
0i3
CH0_1
Read ADC_CDR[0]
EOC[0]
ADC_CDR[1]
CH1_0
1i1
1i2
1i3
CH1_1
Read ADC_CDR[1]
EOC[1]
ADC_LCDR
CH0_1
CH1_1
DRDY
Read ADC_LCDR
Note:
When USEQ is set, the user can define the channel sequence to be converted by configuring ADC_SEQRx and
ADC_CHER so that channels are not interleaved during the averaging period. Under these conditions, a sample is
defined for each end of conversion as described in Figure 48-8. "Digital Averaging Function Waveforms on a
Single Trigger Event, Non-interleaved".
Therefore, if the same channel is configured to be converted four times consecutively, and the OSR = 1 in
ADC_EMR, the averaging result will be placed in the corresponding ADC_CDRx and in ADC_LCDR for each
trigger event.
In this case, the ADC real sample rate remains the maximum ADC sample rate divided by 4 or 16, depending on
OSR.
When USEQ = 1, ASTE = 1 and OSR is different from 0, it is important to notice that the user sequence must
follow a specific pattern. The user sequence must be programmed in such a way that it generates a stream of
conversion, where a given channel is successively converted with an integer multiple depending on OSR value.
Up to four channels can be converted in this specific mode.
When OSR = 1, each channel to convert must be consecutively repeated four times in the sequence, so the four
first single bit field enabled in ADC_CHSR must have their associated channel index programmed to the same
value in ADC_SEQRx registers. Therefore, for OSR = 1 a maximum of four channels can be converted (the user
sequence allows a maximum of 16 conversions for each trigger event).
When OSR = 2, a channel to convert must be consecutively repeated 16 times in the sequence, so all fields must
be enabled in ADC_CHSR, and their associated channel index programmed to the same value in the
ADC_SEQRx registers. Therefore, for OSR = 2 only one channel can be converted (the user sequence allows a
maximum of 16 conversions for each trigger event).
OSR = 3 and OSR = 4 are prohibited when USEQ = 1 and ASTE = 1.
1535
Figure 48-8.
ADC_CDR[0]
CH0_1
Read ADC_CDR[0]
EOC[0]
ADC_CDR[1]
CH1_1
Read ADC_CDR[1]
EOC[1]
CH0_1
ADC_LCDR
CH1_1
DRDY
Read ADC_LCDR
Note:
When an oversampling is performed, the maximum value that can be read on ADC_CDRx or ADC_LCDR is not
the full-scale value, even if the maximum voltage is supplied on the analog input. This is due to the digital
averaging function. For example, when OSR = 1, four samples are accumulated and the result is then right-shifted
by 1 (divided by 2).
The maximum output value carried on ADC_CDRx or ADC_LCDR depends on the OSR value configured in
ADC_EMR.
Table 48-4.
1536
Resolution
Samples
Shift
Maximum Value
8-bit
255
255
10-bit
1023
1023
11-bit
2047
2046
12-bit
16
4095
4092
48.6.10 Touchscreen
48.6.10.1 Touchscreen Mode
The TSMODE parameter of the ADC Touchscreen Mode register (ADC_TSMR) is used to enable/disable the
touchscreen functionality, to select the type of screen (4-wire or 5-wire) and, in the case of a 4-wire screen and to
activate (or not) the pressure measurement.
In 4-wire mode, channel 0, 1, 2 and 3 must not be used for classic ADC conversions. Likewise, in 5-wire mode,
channel 0, 1, 2, 3, and 4 must not be used for classic ADC conversions.
48.6.10.2 4-wire Resistive Touchscreen Principles
A resistive touchscreen is based on two resistive films, each one being fitted with a pair of electrodes, placed at the
top and bottom on one film, and on the right and left on the other. In between, there is a layer acting as an
insulator, but also enables contact when you press the screen. This is illustrated in Figure 48-9. "Touchscreen
Position Measurement".
The TSADC controller has the ability to perform without external components:
position measurement
pressure measurement
pen detection
Figure 48-9.
XP
YM
YP
XM
VDD
XP
VDD
YP
YP
XP
Volt
XM
Vertical Position Detection
GND
Volt
YM
GND
As shown in Figure 48-9. "Touchscreen Position Measurement", to detect the position of a contact, a supply is first
applied from top to bottom. Due to the linear resistance of the film, there is a voltage gradient from top to bottom.
When a contact is performed on the screen, the voltage propagates at the point the two surfaces come into contact
with the second film. If the input impedance on the right and left electrodes sense is high enough, the film does not
affect this voltage, despite its resistive nature.
For the horizontal direction, the same method is used, but by applying supply from left to right. The range depends
on the supply voltage and on the loss in the switches that connect to the top and bottom electrodes.
1537
In an ideal world (linear, with no loss through switches), the horizontal position is equal to:
VYM / VDD or VYP / VDD.
The implementation with on-chip power switches is shown in Figure 48-10. "Touchscreen Switches
Implementation". The voltage measurement at the output of the switch compensates for the switches loss.
It is possible to correct for switch loss by performing the operation:
[VYP - VXM] / [VXP - VXM].
This requires additional measurements, as shown in Figure 48-10.
Figure 48-10. Touchscreen Switches Implementation
XP
VDDANA
0
XM
GND
1
To the ADC
YP
VDDANA
2
YM
GND
VDDANA
VDDANA
Switch
Resistor
Switch
Resistor
YP
XP
XP
YP
YM
XM
Switch
Resistor
Switch
Resistor
GND
Horizontal Position Detection
GND
Vertical Position Detection
The method to measure the pressure (Rp) applied to the touchscreen is based on the known resistance of the XPanel resistance (Rxp).
Three conversions (Xpos,Z1,Z2) are necessary to determine the value of Rp (Zaxis resistance).
Rp = Rxp (Xpos/1024) [(Z2/Z1)-1]
1538
VDDANA
VDDANA
Switch
Resistor
Switch
Resistor
XP
YP
XP
YP
Rp
Open
circuit
Switch
Resistor
XP
YP
Rp
YM
XM
GND
XPos Measure(Yp)
Rp
YM
XM
YM
XM
Open
circuit
Switch
Resistor
Switch
Resistor
Open
circuit
Switch
Resistor
GND
GND
Z1 Measure(Xp)
Z2 Measure(Xp)
To make a 5-wire touchscreen, a resistive layer with a contact point at each corner and a conductive layer are
used.
The 5-wire touchscreen differs from the 4-wire type mainly in that the voltage gradient is applied only to one layer,
the resistive layer, while the other layer is the sense layer for both measurements.
The measurement of the X position is obtained by biasing the upper left corner and lower left corner to VDDANA
and the upper right corner and lower right to ground.
To measure along the Y axis, bias the upper left corner and upper right corner to VDDANA and bias the lower left
corner and lower right corner to ground.
1539
UL
Pen
Contact
Resistive layer
UR
Sense
LL
LR
Conductive Layer
UL
VDDANA
UR
VDDANA for Yp
GND for Xp
Sense
LL
VDDANA for Xp
GND for Yp
LR
GND
In an application only monitoring clicks, 100 points per second is typically needed. For handwriting or motion
detection, the number of measurements to consider is approximately 200 points per second. This must take into
account that multiple measurements are included (over sampling, filtering) to compute the correct point.
The 5-wire touchscreen panel works by applying a voltage at the corners of the resistive layer and measuring the
vertical or horizontal resistive network with the sense input. The ADC converts the voltage measured at the point
the panel is touched.
A measurement of the Y position of the pointing device is made by:
Connecting Upper left (UL) and upper right (UR) corners to VDDANA
Connecting Lower left (LL) and lower right (LR) corners to ground.
The voltage measured is determined by the voltage divider developed at the point of touch (Yposition) and
the SENSE input is converted by ADC.
1540
Connecting the upper left (UL) and lower left (LL) corners to ground
The voltage measured is determined by the voltage divider developed at the point of touch (Xposition) and
the SENSE input is converted by ADC.
UL
VDDANA
0
UR
GND
VDDANA
GND
LL
VDDANA
Sense
LR
UL
VDDANA
To the ADC
3
GND
UR
Sense
LL
LR
GND
The ADC Controller can manage ADC conversions and touchscreen measurement. On each trigger event the
sequence of ADC conversions is performed as described in Section 48.6.6 Sleep Mode and Conversion
Sequencer. The touchscreen measure frequency can be specified in number of trigger events by writing the
TSFREQ parameter in ADC_TSMR. An internal counter counts triggers up to TSFREQ, and every time it rolls out,
a touchscreen sequence is appended to the classic ADC conversion sequence (see Figure 48-14. "Insertion of
Touchscreen Sequences (TSFREQ = 2; TSAV = 1)").
Additionally the user can average multiple touchscreen measures by writing the TSAV parameter in ADC_TSMR.
This can be 1, 2, 4 or 8 measures performed on consecutive triggers as illustrated in Figure 48-14 below.
Consequently, the TSFREQ parameter must be greater or equal to the TSAV parameter.
1541
ADC_SEL
T: Touchscreen Sequence
XRDY
Read the
ADC_XPOSR
Read the
ADC_XPOSR
YRDY
Note:
Read the
ADC_YPOSR
Read the
ADC_YPOSR
As soon as the controller finishes the Touchscreen sequence, XRDY, YRDY and PRDY are set and can generate
an interrupt. These flags can be read in the ADC Interrupt Status register (ADC_ISR). They are reset
independently by reading in ADC Touchscreen X Position register (ADC_XPOSR), ADC Touchscreen Y Position
register (ADC_YPOSR) and ADC Touchscreen Pressure register (ADC_PRESSR).
The ADC_XPOSR presents XPOS (VX - VXmin) on its LSB and XSCALE (VXMAX - VXmin) aligned on the 16th bit.
The ADC_YPOSR presents YPOS (VY - VYmin) on its LSB and YSCALE (VYMAX - VYmin) aligned on the 16th bit.
To improve the quality of the measure, the user must calculate: XPOS/XSCALE and YPOS/YSCALE.
VXMAX, VXmin, VYMAX, and VYmin are measured at the first start up of the controller. These values can change during
use, so it can be necessary to refresh them. Refresh can be done by writing 1 in the TSCALIB field of the control
register (ADC_CR).
The ADC_PRESSR presents Z1 on its LSB and Z2 aligned on the 16th bit. See Section 48.6.10.4 4-wire Pressure
Measurement Method
48.6.10.9 Pen Detect Method
When there is no contact, it is not necessary to perform a conversion. However, it is important to detect a contact
by keeping the power consumption as low as possible.
The implementation polarizes one panel by closing the switch on (X P/UL) and ties the horizontal panel by an
embedded resistor connected to YM / Sense. This resistor is enabled by a fifth switch. Since there is no contact, no
current is flowing and there is no related power consumption. As soon as a contact occurs, a current is flowing in
the Touchscreen and a Schmitt trigger detects the voltage in the resistor.
The Touchscreen Interrupt configuration is entered by programming the PENDET bit in ADC_TSMR. If this bit is
written at 1, the controller samples the pen contact state when it is not converting and waiting for a trigger.
To complete the circuit, a programmable debouncer is placed at the output of the Schmitt trigger. This debouncer
is programmable up to 215 ADC clock periods. The debouncer length can be selected by programming the field
PENDBC in ADC_TSMR.
Due to the analog switchs structure, the debouncer circuitry is only active when no conversion (touchscreen or
classic ADC channels) is in progress. Thus, if the time between the end of a conversion sequence and the arrival
of the next trigger event is lower than the debouncing time configured on PENDBC, the debouncer will not detect
any contact.
1542
X+/UL
VDDANA
0
X-/UR
GND
VDDANA
GND
Y+/LL
Y-/SENSE
LR
VDDANA
GND
GND
To the ADC
3
4
PENDBC
Debouncer
Pen Interrupt
GND
The touchscreen pen detect can be used to generate an ADC interrupt to wake up the system. The pen detect
generates two types of status, reported in ADC_ISR:
the PEN bit is set as soon as a contact exceeds the debouncing time as defined by PENDBC and remains
set until ADC_ISR is read.
the NOPEN bit is set as soon as no current flows for a time over the debouncing time as defined by
PENDBC and remains set until ADC_ISR is read.
Both bits are automatically cleared as soon as ADC_ISR is read, and can generate an interrupt by writing
ADC_IER.
Moreover, the rising of either one of them clears the other, they cannot be set at the same time.
The PENS bit of the ADC_ISR indicates the current status of the pen contact.
48.6.11 Buffer Structure
The DMA read channel is triggered each time a new data is stored in ADC_LCDR. The same structure of data is
repeatedly stored in ADC_LCDR each time a trigger event occurs. Depending on user mode of operation
(ADC_MR, ADC_CHSR, ADC_SEQR1, ADC_TSMR) the structure differs. Each data read to DMA buffer, carried
on a half-word (16-bit), consists of last converted data right aligned and when TAG is set in ADC_EMR, the four
most significant bits are carrying the channel number thus allowing an easier post-processing in the DMA buffer or
better checking the DMA buffer integrity.
1543
Figure 48-16.
Buffer Structure
trig.event2
ADC_CDR5
DMA Transfer
Base Address (BA)
ADC_CDR6
BA + 0x02
ADC_CDR8
BA + 0x04
ADC_CDR5
trig.event1
ADC_CDR5
ADC_CDR6
ADC_CDR8
BA + 0x06
ADC_CDR5
ADC_CDR6
BA + 0x08
ADC_CDR6
ADC_CDR8
BA + 0x0A
ADC_CDR8
ADC_CDR5
BA + [(N-1) * 6]
ADC_CDR5
ADC_CDR6
ADC_CDR6
ADC_CDR8
ADC_CDR8
DMA Buffer
Structure
trig.event2
trig.eventN
trig.eventN
6
8
As soon as touchscreen conversions are required, the pen detection function may help the post-processing of the
buffer. Refer to Section 48.6.11.4 Pen Detection Status.
48.6.11.1 Classical ADC Channels Only
When no touchscreen conversion is required (i.e., TSMODE = 0 in ADC_TSMR), the structure of data within the
buffer is defined by ADC_MR, ADC_CHSR, ADC_SEQRx. See Figure 48-16. "Buffer Structure".
If the user sequence is not used (i.e., USEQ is cleared in ADC_MR) then only the value of ADC_CHSR defines the
data structure. For each trigger event, enabled channels will be consecutively stored in ADC_LCDR and
automatically read to the buffer.
When the user sequence is configured (i.e., USEQ is set in ADC_MR) not only does ADC_CHSR modify the data
structure of the buffer, but ADC_SEQRx registers may modify the data structure of the buffer as well.
48.6.11.2 Touchscreen Channels Only
When only touchscreen conversions are required (i.e., TSMODE 0 in ADC_TSMR and ADC_CHSR equals 0),
the structure of data within the buffer is defined by the ADC_TSMR.
When TSMODE = 1 or 3, each trigger event adds two half-words in the buffer (assuming TSAV = 0), first half-word
being XPOS of ADC_XPOSR then YPOS of ADC_YPOSR. If TSAV/TSFREQ 0, the data structure remains
unchanged. Not all trigger events add data to the buffer.
When TSMODE = 2, each trigger event adds four half-words to the buffer (assuming TSAV = 0), first half-word
being XPOS of ADC_XPOSR followed by YPOS of ADC_YPOSR and finally Z1 followed by Z2, both located in
ADC_PRESSR.
When TAG is set (ADC_EMR), the CHNB field (four most significant bits of the ADC_LCDR) is cleared when
XPOS is transmitted and set when YPOS is transmitted, allowing an easier post-processing of the buffer or better
checking buffer integrity. In case 4-wire with pressure mode is selected, Z1 value is transmitted to the buffer along
with tag set to 2 and Z2 is tagged with value 3.
XSCALE and YSCALE (calibration values) are not transmitted to the buffer because they are supposed to be
constant and moreover only measured at the very first start up of the controller or upon user request.
1544
There is no change in buffer structure whatever the value of PENDET bit configuration in ADC_TSMR but it is
recommended to use the pen detection function for buffer post-processing (refer to Pen Detection Status on
page 1547).
Figure 48-17.
Assuming ADC_TSMR(TSMOD) = 1 or 3
ADC_TSMR(TSAV) = 0
ADC_CHSR = 0x000_00000 , ADC_EMR(TAG) = 1
trig.event1
DMA Buffer
Structure
trig.event2
ADC_XPOSR
DMA Transfer
Base Address (BA)
ADC_YPOSR
BA + 0x02
ADC_XPOSR
BA + 0x04
ADC_YPOSR
BA + 0x06
ADC_XPOSR
BA + [(N-1) * 4]
trig.eventN
ADC_YPOSR
DMA Buffer
Structure
trig.event2
trig.event1
DMA Buffer
Structure
trig.event2
ADC_XPOSR
ADC_YPOSR
ADC_XPOSR
ADC_YPOSR
ADC_XPOSR
ADC_YPOSR
trig.eventN
Assuming ADC_TSMR(TSMOD) = 2
ADC_TSMR(TSAV) = 0
ADC_CHSR = 0x000_00000 , ADC_EMR(TAG) = 1
trig.event1
Assuming ADC_TSMR(TSMOD) =1 or 3
ADC_TSMR(TSAV) = 0
ADC_CHSR = 0x000_00000 , ADC_EMR(TAG) = 0
Assuming ADC_TSMR(TSMOD) = 2
ADC_TSMR(TSAV) = 0
ADC_CHSR = 0x000_00000 , ADC_EMR(TAG) = 0
ADC_XPOSR
trig.event1
DMA Transfer
Base Address (BA)
ADC_XPOSR
ADC_YPOSR
BA + 0x02
ADC_YPOSR
ADC_PRESSR(Z1)
BA + 0x04
ADC_PRESSR(Z1)
ADC_PRESSR(Z2)
BA + 0x06
ADC_PRESSR(Z2)
ADC_XPOSR
BA + 0x08
ADC_XPOSR
ADC_YPOSR
BA + 0x0A
ADC_YPOSR
ADC_PRESSR(Z1)
BA + 0x0C
ADC_PRESSR(Z1)
ADC_PRESSR(Z2)
BA + 0x0E
ADC_PRESSR(Z2)
ADC_XPOSR
BA + [(N-1) * 8]
ADC_XPOSR
ADC_YPOSR
DMA Buffer
Structure
trig.event2
trig.eventN
trig.eventN
BA + [(N-1) * 8]+ 0x02
ADC_YPOSR
ADC_PRESSR(Z1)
ADC_PRESSR(Z1)
ADC_PRESSR(Z2)
ADC_PRESSR(Z2)
When both classic ADC channels (CH4/CH5 up to CH5 are set in ADC_CHSR) and touchscreen conversions are
required (TSMODE 0 in ADC_TSMR) the structure of the buffer differs according to TSAV and TSFREQ values.
1545
If TSFREQ 0, not all events generate touchscreen conversions, therefore the buffer structure is based on
2TSFREQ trigger events. Given a TSFREQ value, the location of touchscreen conversion results depends on TSAV
value.
When TSFREQ = 0, TSAV must equal 0.
There is no change in buffer structure whatever the value of PENDET bit configuration in ADC_TSMR but it is
recommended to use the pen detection function for buffer post-processing (refer to Pen Detection Status on
page 1547).
1546
Figure 48-18.
Buffer Structure When Classic ADC and Touchscreen Channels are Interleaved
Assuming ADC_TSMR(TSMOD) = 1
ADC_TSMR(TSAV) = ADC_TSMR(TSFREQ) = 0
ADC_CHSR = 0x000_0100, ADC_EMR(TAG) =1
trig.event1
8
DMA Buffer
Structure
trig.event2
ADC_CDR8
DMA Transfer
Base Address (BA)
ADC_XPOSR
BA + 0x02
ADC_YPOSR
BA + 0x04
Assuming ADC_TSMR(TSMOD) = 1
ADC_TSMR(TSAV) = ADC_TSMR(TSFREQ) = 0
ADC_CHSR = 0x000_0100, ADC_EMR(TAG) = 0
trig.event1
DMA Buffer
Structure
trig.event2
8
0
ADC_CDR8
BA + 0x06
ADC_XPOSR
BA + 0x08
BA + 0x0A
ADC_YPOSR
ADC_CDR8
BA + [(N-1) * 6]
ADC_XPOSR
ADC_YPOSR
trig.eventN
Assuming ADC_TSMR(TSMOD) = 1
ADC_TSMR(TSAV) = 0 ADC_TSMR(TSFREQ) = 1
ADC_CHSR = 0x000_0100, ADC_EMR(TAG) = 1
trig.event1
ADC_CDR8
DMA Transfer
Base Address (BA)
ADC_XPOSR
BA + 0x02
ADC_YPOSR
BA + 0x04
ADC_CDR8
BA + 0x06
ADC_CDR8
BA + 0x08
ADC_XPOSR
BA + 0x0A
ADC_YPOSR
BA + 0x0c
ADC_CDR8
BA + 0x0e
ADC_CDR8
BA + [(N-1) * 8]
ADC_XPOSR
ADC_YPOSR
ADC_CDR8
trig.event3
trig.event4
trig.eventN
ADC_XPOSR
ADC_YPOSR
ADC_CDR8
ADC_XPOSR
ADC_YPOSR
ADC_CDR8
ADC_XPOSR
ADC_YPOSR
trig.event1
DMA Buffer
Structure
ADC_CDR8
ADC_CDR8
ADC_XPOSR
ADC_YPOSR
ADC_CDR8
ADC_CDR8
ADC_XPOSR
ADC_YPOSR
ADC_CDR8
ADC_CDR8
ADC_XPOSR
ADC_YPOSR
trig.event3
trig.event4
trig.eventN
0
trig.eventN+1
Assuming ADC_TSMR(TSMOD) = 1
ADC_TSMR(TSAV) = 1 ADC_TSMR(TSFREQ) = 1
ADC_CHSR = 0x000_0100, ADC_EMR(TAG) = 1
trig.event2
trig.event2
ADC_CDR8
trig.eventN
DMA Buffer
Structure
1
8
trig.eventN+1
If the pen detection measure is enabled (PENDET is set in ADC_TSMR), the XPOS, YPOS, Z1, Z2 values
transmitted to the buffer through ADC_LCDR are cleared (including the CHNB field), if the PENS flag of ADC_ISR
is 0. When the PENS flag is set, XPOS, YPOS, Z1, Z2 are normally transmitted.
1547
Therefore, using pen detection together with tag function eases the post-processing of the buffer, especially to
determine which touchscreen converted values correspond to a period of time when the pen was in contact with
the screen.
When the pen detection is disabled or the tag function is disabled, XPOS, YPOS, Z1, Z2 are normally transmitted
without tag and no relationship can be found with pen status, thus post-processing may not be easy.
Figure 48-19.
DMA Transfer
Base Address (BA)
ADC_XPOSR
BA + 0x02
ADC_YPOSR
BA + 0x04
PENS = 1
8
DMA buffer
Structure
trig.event2
8
0
ADC_CDR8
BA + 0x06
ADC_XPOSR
BA + 0x08
trig.event1
DMA buffer
Structure
PENS = 1
trig.event1
BA + 0x0A
ADC_YPOSR
ADC_CDR8
BA + [(N-1) * 6]
ADC_CDR8
ADC_CDR8
ADC_XPOSR
ADC_YPOSR
ADC_CDR8
ADC_XPOSR
ADC_YPOSR
ADC_CDR8
ADC_XPOSR*
ADC_YPOSR*
ADC_CDR8
ADC_XPOSR*
ADC_YPOSR*
trig.eventN
2 successive tags
cleared => PENS = 0
PENS = 0
PENS = 0
trig.eventN
trig.eventN+1
trig.event2
1548
1549
48.7
Table 48-5.
Register Mapping
Offset
Register
Name
Access
Reset
0x00
Control Register
ADC_CR
Write-only
0x04
Mode Register
ADC_MR
Read/Write
0x00000000
0x08
ADC_SEQR1
Read/Write
0x00000000
0x0C
Reserved
0x10
ADC_CHER
Write-only
0x14
ADC_CHDR
Write-only
0x18
ADC_CHSR
Read-only
0x00000000
0x1C
Reserved
0x20
ADC_LCDR
Read-only
0x00000000
0x24
ADC_IER
Write-only
0x28
ADC_IDR
Write-only
0x2C
ADC_IMR
Read-only
0x00000000
0x30
ADC_ISR
Read-only
0x00000000
0x34
Reserved
0x38
Reserved
0x3C
ADC_OVER
Read-only
0x00000000
0x40
ADC_EMR
Read/Write
0x00000000
0x44
ADC_CWR
Read/Write
0x00000000
0x50
ADC_CDR0
Read-only
0x00000000
0x54
ADC_CDR1
Read-only
0x00000000
...
...
...
ADC_CDR4
Read-only
0x00000000
ADC_ACR
Read/Write
0x00000100
ADC_TSMR
Read/Write
0x00000000
...
0x60
0x640x90
0x94
0x980xAC
...
Channel Data Register 4
Reserved
Analog Control Register
Reserved
0xB0
0xB4
ADC_XPOSR
Read-only
0x00000000
0xB8
ADC_YPOSR
Read-only
0x00000000
0xBC
ADC_PRESSR
Read-only
0x00000000
0xC0
Trigger Register
ADC_TRGR
Read/Write
0x00000000
0xC40xE0
Reserved
0xE4
ADC_WPMR
Read/Write
0x00000000
0xE8
ADC_WPSR
Read-only
0x00000000
0xEC0xF8
Reserved
0xFC
Reserved
1550
ADC_CR
Address:
0xFC034000
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
2
TSCALIB
1
START
0
SWRST
1551
ADC_MR
Address:
0xFC034004
Access:
Read/Write
31
USEQ
30
29
28
27
23
22
21
20
19
15
14
13
12
26
25
24
17
16
TRACKTIM
18
STARTUP
11
10
2
TRGSEL
PRESCAL
7
5
SLEEP
4
LOWRES
This register can only be written if the WPEN bit is cleared in the ADC Write Protection Mode Register.
TRGSEL: Trigger Selection
Value
Name
Description
ADC_TRIG0
ADTRG
ADC_TRIG1
TIOA0
ADC_TRIG2
TIOA1
ADC_TRIG3
TIOA2
ADC_TRIG4
ADC_TRIG5
PWM_even line 1
ADC_TRIG6
Reserved
Note: The trigger selection can be performed only if TRGMOD = 1,2 or 3 in ADC Trigger Register.
LOWRES: Resolution
Value
Name
Description
BITS_10
10-bit resolution. For higher resolution by averaging, please refer to ADC Extended
Mode Register on page 1565.
BITS_8
8-bit resolution
Name
NORMAL
SLEEP
Description
Normal Mode: The ADC core and reference voltage circuitry are kept ON between conversions.
Sleep Mode: The ADC core and reference voltage circuitry are OFF between conversions.
1552
Name
Description
SUT0
0 periods of ADCCLK
SUT8
8 periods of ADCCLK
SUT16
16 periods of ADCCLK
SUT24
24 periods of ADCCLK
SUT64
64 periods of ADCCLK
SUT80
80 periods of ADCCLK
SUT96
96 periods of ADCCLK
SUT112
SUT512
SUT576
10
SUT640
11
SUT704
12
SUT768
13
SUT832
14
SUT896
15
SUT960
Name
Description
NUM_ORDER
Normal Mode: The controller converts channels in a simple numeric order depending only on the
channel index.
REG_ORDER
User Sequence Mode: The sequence respects what is defined in ADC_SEQR1 register and can
be used to convert the same channel several times.
1553
ADC_SEQR1
Address:
0xFC034008
Access:
Read/Write
31
30
29
28
27
26
23
22
21
20
19
18
15
14
13
24
17
16
12
11
10
USCH4
7
25
USCH3
5
USCH2
2
USCH1
This register can only be written if the WPEN bit is cleared in the ADC Write Protection Mode Register .
USCHx: User Sequence Number x
The sequence number x (USCHx) can be programmed by the channel number CHy where y is the value written in this
field. The allowed range is 0 up to 4, thus only the sequencer from CH0 to CH4 can be used.
This register activates only if the USEQ field in ADC_MR field is set to 1.
Any USCHx field is processed only if the CHx field in ADC_CHSR reads logical 1, else any value written in USCHx does
not add the corresponding channel in the conversion sequence.
Configuring the same value in different fields leads to multiple samples of the same channel during the conversion
sequence. This can be done consecutively, or not, according to user needs.
When configuring consecutive fields with the same value, the associated channel is sampled as many time as the number
of consecutive values, this part of the conversion sequence being triggered by a unique event.
1554
ADC_CHER
Address:
0xFC034010
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
4
CH4
3
CH3
2
CH2
1
CH1
0
CH0
This register can only be written if the WPEN bit is cleared in the ADC Write Protection Mode Register .
CHx: Channel x Enable
0: No effect.
1: Enables the corresponding channel.
Note: If USEQ = 1 in the ADC_MR, CHx corresponds to the xth channel of the sequence described in ADC_SEQR1.
1555
ADC_CHDR
Address:
0xFC034014
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
4
CH4
3
CH3
2
CH2
1
CH1
0
CH0
This register can only be written if the WPEN bit is cleared in the ADC Write Protection Mode Register .
CHx: Channel x Disable
0: No effect.
1: Disables the corresponding channel.
Warning: If the corresponding channel is disabled during a conversion or if it is disabled and then reenabled during a conversion, its associated data and corresponding EOCx and GOVRE flags in ADC_ISR and OVREx flags in ADC_OVER are
unpredictable.
1556
ADC_CHSR
Address:
0xFC034018
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
4
CH4
3
CH3
2
CH2
1
CH1
0
CH0
1557
ADC_LCDR
Address:
0xFC034020
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
CHNB
7
LDATA
5
LDATA
1558
ADC_IER
Address:
0xFC034024
Access:
Write-only
31
30
NOPEN
29
PEN
28
27
26
COMPE
25
GOVRE
24
DRDY
23
22
PRDY
21
YRDY
20
XRDY
19
18
17
16
15
14
13
12
11
10
4
EOC4
3
EOC3
2
EOC2
1
EOC1
0
EOC0
The following configuration values are valid for all listed bit names of this register:
0: No effect.
1: Enables the corresponding interrupt.
EOCx: End of Conversion Interrupt Enable x
1559
ADC_IDR
Address:
0xFC034028
Access:
Write-only
31
30
NOPEN
29
PEN
28
27
26
COMPE
25
GOVRE
24
DRDY
23
22
PRDY
21
YRDY
20
XRDY
19
18
17
16
15
14
13
12
11
10
4
EOC4
3
EOC3
2
EOC2
1
EOC1
0
EOC0
The following configuration values are valid for all listed bit names of this register:
0: No effect.
1: Disables the corresponding interrupt.
EOCx: End of Conversion Interrupt Disable x
XRDY: Touchscreen Measure XPOS Ready Interrupt Disable
YRDY: Touchscreen Measure YPOS Ready Interrupt Disable
PRDY: Touchscreen Measure Pressure Ready Interrupt Disable
DRDY: Data Ready Interrupt Disable
GOVRE: General Overrun Error Interrupt Disable
COMPE: Comparison Event Interrupt Disable
PEN: Pen Contact Interrupt Disable
NOPEN: No Pen Contact Interrupt Disable
1560
ADC_IMR
Address:
0xFC03402C
Access:
Read-only
31
30
NOPEN
29
PEN
28
27
26
COMPE
25
GOVRE
24
DRDY
23
22
PRDY
21
YRDY
20
XRDY
19
18
17
16
15
14
13
12
11
10
4
EOC4
3
EOC3
2
EOC2
1
EOC1
0
EOC0
The following configuration values are valid for all listed bit names of this register:
0: The corresponding interrupt is disabled.
1: The corresponding interrupt is enabled.
EOCx: End of Conversion Interrupt Mask x
XRDY: Touchscreen Measure XPOS Ready Interrupt Mask
YRDY: Touchscreen Measure YPOS Ready Interrupt Mask
PRDY: Touchscreen Measure Pressure Ready Interrupt Mask
DRDY: Data Ready Interrupt Mask
GOVRE: General Overrun Error Interrupt Mask
COMPE: Comparison Event Interrupt Mask
PEN: Pen Contact Interrupt Mask
NOPEN: No Pen Contact Interrupt Mask
1561
ADC_ISR
Address:
0xFC034030
Access:
Read-only
31
PENS
30
NOPEN
29
PEN
28
27
26
COMPE
25
GOVRE
24
DRDY
23
22
PRDY
21
YRDY
20
XRDY
19
18
17
16
15
14
13
12
11
10
4
EOC4
3
EOC3
2
EOC2
1
EOC1
0
EOC0
1562
1563
ADC_OVER
Address:
0xFC03403C
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
4
OVRE4
3
OVRE3
2
OVRE2
1
OVRE1
0
OVRE0
1564
ADC_EMR
Address:
0xFC034040
Access:
Read/Write
31
30
29
28
27
26
25
23
22
21
20
ASTE
19
18
17
15
14
13
12
11
10
9
CMPALL
CMPFILTER
5
CMPSEL
24
TAG
16
OSR
CMPMODE
This register can only be written if the WPEN bit is cleared in the ADC Write Protection Mode Register .
CMPMODE: Comparison Mode
Value
Name
Description
LOW
Generates an event when the converted data is lower than the low threshold of the window.
HIGH
Generates an event when the converted data is higher than the high threshold of the window.
IN
OUT
Name
Description
NO_AVERAGE
OSR4
OSR16
1565
Name
Description
MULTI_TRIG_AVERAGE
SINGLE_TRIG_AVERAGE
1566
ADC_CWR
Address:
0xFC034044
Access:
Read/Write
31
30
29
28
23
22
21
20
27
26
25
24
17
16
HIGHTHRES
19
18
11
10
HIGHTHRES
15
14
13
12
LOWTHRES
3
LOWTHRES
This register can only be written if the WPEN bit is cleared in the ADC Write Protection Mode Register .
LOWTHRES: Low Threshold
Low threshold associated to compare settings of the ADC_EMR.
If LOWRES is set in ADC_MR, only the 10 LSB of LOWTHRES must be programmed. The two LSB will be automatically
discarded to match the value carried on ADC_CDR (8-bit).
HIGHTHRES: High Threshold
High threshold associated to compare settings of the ADC_EMR.
If LOWRES is set in ADC_MR, only the 10 LSB of HIGHTHRES must be programmed. The two LSB will be automatically
discarded to match the value carried on ADC_CDR (8-bit).
1567
ADC_CDRx [x=0..4]
Address:
0xFC034050
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
DATA
3
DATA
1568
ADC_ACR
Address:
0xFC034094
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
0
PENDETSENS
This register can only be written if the WPEN bit is cleared in the ADC Write Protection Mode Register .
PENDETSENS: Pen Detection Sensitivity
Modifies the pen detection input pull-up resistor value. See the section Electrical Characteristics for further details.
1569
ADC_TSMR
Address:
0xFC0340B0
Access:
Read/Write
31
30
29
28
27
26
18
PENDBC
23
22
NOTSDMA
21
20
19
15
14
13
12
11
TSAV
25
24
PENDET
17
16
TSSCTIM
10
TSFREQ
2
0
TSMODE
This register can only be written if the WPEN bit is cleared in the ADC Write Protection Mode Register .
TSMODE: Touchscreen Mode
Value
Name
Description
NONE
No Touchscreen
4_WIRE_NO_PM
4_WIRE
5_WIRE
5-wire Touchscreen
When TSMOD equals 01 or 10 (i.e., 4-wire mode), channels 0, 1, 2 and 3 must not be used for classic ADC conversions.
When TSMOD equals 11 (i.e., 5-wire mode), channels 0, 1, 2, 3, and 4 must not be used.
TSAV: Touchscreen Average
Value
Name
Description
NO_FILTER
AVG2CONV
AVG4CONV
AVG8CONV
1571
ADC_XPOSR
Address:
0xFC0340B4
Access:
Read-only
31
30
29
28
23
22
21
20
27
26
25
24
17
16
XSCALE
19
18
11
10
XSCALE
15
14
13
12
XPOS
3
XPOS
XPOS: X Position
The position measured is stored here. If XPOS = 0 or XPOS = XSIZE, the pen is on the border.
When pen detection is enabled (PENDET set to 1 in ADC_TSMR), XPOS is tied to 0 while there is no detection of contact
on the touchscreen (i.e., when PENS bit is cleared in ADC_ISR).
XSCALE: Scale of XPOS
Indicates the max value that XPOS can reach. This value should be close to 210.
1572
ADC_YPOSR
Address:
0xFC0340B8
Access:
Read-only
31
30
29
28
23
22
21
20
27
26
25
24
17
16
YSCALE
19
18
11
10
YSCALE
15
14
13
12
YPOS
3
YPOS
YPOS: Y Position
The position measured is stored here. If YPOS = 0 or YPOS = YSIZE, the pen is on the border.
When pen detection is enabled (PENDET set to 1 in ADC_TSMR), YPOS is tied to 0 while there is no detection of contact
on the touchscreen (i.e., when PENS bit is cleared in ADC_ISR).
YSCALE: Scale of YPOS
Indicates the max value that YPOS can reach. This value should be close to 210.
1573
ADC_PRESSR
Address:
0xFC0340BC
Access:
Read-only
31
30
29
28
23
22
21
20
27
26
25
24
17
16
Z2
19
18
11
10
Z2
15
14
13
12
Z1
3
Z1
1574
ADC_TRGR
Address:
0xFC0340C0
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
TRGPER
23
22
21
20
TRGPER
15
14
13
12
11
10
1
TRGMOD
Name
Description
NO_TRIGGER
EXT_TRIG_RISE
EXT_TRIG_FALL
EXT_TRIG_ANY
PEN_TRIG
PERIOD_TRIG
CONTINUOUS
Continuous Mode
Pen Detect Trigger (shall be selected only if PENDET is set and TSAMOD = Touchscreen only mode)
1575
ADC_WPMR
Address:
0xFC0340E4
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
0
WPEN
WPKEY
23
22
21
20
WPKEY
15
14
13
12
WPKEY
Name
0x414443
PASSWD
1576
Description
Writing any other value in this field aborts the write operation of the WPEN bit.
Always reads as 0
ADC_WPSR
Address:
0xFC0340E8
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
11
10
0
WPVS
WPVSRC
15
14
13
12
WPVSRC
1577
49.
49.1
Description
The True Random Number Generator (TRNG) passes the American NIST Special Publication 800-22 and Diehard
Random Tests Suites.
The TRNG may be used as an entropy source for seeding an NIST approved DRNG (Deterministic RNG) as
required by FIPS PUB 140-2 and 140-3.
49.2
49.3
Embedded Characteristics
May be used as Entropy Source for seeding an NIST approved DRNG (Deterministic RNG) as required by
FIPS PUB 140-2 and 140-3
Block Diagram
Figure 49-1.
Interrupt
Controller
Control Logic
MCK
PMC
User Interface
APB
1578
Entropy Source
49.4
Product Dependencies
49.5
Peripheral IDs
Instance
ID
TRNG
53
Functional Description
As soon as the TRNG is enabled in the control register (TRNG_CR), the generator provides one 32-bit value every
84 clock cycles. Interrupt trng_int can be enabled in the TRNG_IER (respectively disabled in the TRNG_IDR). This
interrupt is set when a new random value is available and is cleared when the status register (TRNG_ISR) is read.
The flag DATRDY of the (TRNG_ISR) is set when the random data is ready to be read out on the 32-bit output
data register (TRNG_ODATA).
The normal mode of operation checks that the status register flag equals 1 before reading the output data register
when a 32-bit random value is required by the software application.
Figure 49-2.
Clock
trng_cr
enable
84 clock cycles
84 clock cycles
84 clock cycles
trng_int
Read TRNG_ISR
Read TRNG_ISR
Read TRNG_ODATA
Read TRNG_ODATA
1579
49.6
Table 49-2.
Register Mapping
Offset
1580
Register
Name
Access
Reset
0x00
Control Register
TRNG_CR
Write-only
0x10
TRNG_IER
Write-only
0x14
TRNG_IDR
Write-only
0x18
TRNG_IMR
Read-only
0x0000_0000
0x1C
TRNG_ISR
Read-only
0x0000_0000
0x50
TRNG_ODATA
Read-only
0x0000_0000
0xFC
Reserved
TRNG_CR
Address:
0xFC030000
Access:
Write-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
KEY
23
22
21
20
KEY
15
14
13
12
KEY
7
ENABLE
Name
Description
PASSWD
Writing any other value in this field aborts the write operation.
1581
TRNG_IER
Address:
0xFC030010
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
DATRDY
1582
TRNG_IDR
Address:
0xFC030014
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
DATRDY
1583
TRNG_IMR
Address:
0xFC030018
Reset:
0x0000_0000
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
DATRDY
1584
TRNG_ISR
Address:
0xFC03001C
Reset:
0x0000_0000
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
DATRDY
1585
TRNG_ODATA
Address:
0xFC030050
Reset:
0x0000_0000
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ODATA
23
22
21
20
ODATA
15
14
13
12
ODATA
7
ODATA
1586
50.
50.1
Description
The Advanced Encryption Standard (AES) is compliant with the American FIPS (Federal Information Processing
Standard) Publication 197 specification.
The AES supports all five confidentiality modes of operation for symmetrical key block cipher algorithms (ECB,
CBC, OFB, CFB and CTR), as specified in the NIST Special Publication 800-38A Recommendation, as well as
Galois/Counter Mode (GCM) as specified in the NIST Special Publication 800-38D Recommendation. It is
compatible with all these modes via DMA Controller channels, minimizing processor intervention for large buffer
transfers.
The 128-bit/192-bit/256-bit key is stored in four/six/eight 32-bit write-only AES Key Word Registers
(AES_KEYWR03).
The 128-bit input data and initialization vector (for some modes) are each stored in four 32-bit write-only AES Input
Data Registers (AES_IDATAR03) and AES Initialization Vector Registers (AES_IVR03).
As soon as the initialization vector, the input data and the key are configured, the encryption/decryption process
may be started. Then the encrypted/decrypted data are ready to be read out on the four 32-bit AES Output Data
Registers (AES_ODATAR03) or through the DMA channels.
50.2
Embedded Characteristics
Support of the Modes of Operation Specified in the NIST Special Publication 800-38A and NIST Special
Publication 800-38D:
Counter (CTR)
Last Output Data Mode Allows Optimized Message Authentication Code (MAC) Generation
1587
50.3
Product Dependencies
50.4
Peripheral IDs
Instance
ID
AES
12
Functional Description
The Advanced Encryption Standard (AES) specifies a FIPS-approved cryptographic algorithm that can be used to
protect electronic data. The AES algorithm is a symmetric block cipher that can encrypt (encipher) and decrypt
(decipher) information.
Encryption converts data to an unintelligible form called ciphertext. Decrypting the ciphertext converts the data
back into its original form, called plaintext. The CIPHER bit in the AES Mode Register (AES_MR) allows selection
between the encryption and the decryption processes.
The AES is capable of using cryptographic keys of 128/192/256 bits to encrypt and decrypt data in blocks of 128
bits. This 128-bit/192-bit/256-bit key is defined in the AES_KEYWRx.
The input to the encryption processes of the CBC, CFB, and OFB modes includes, in addition to the plaintext, a
128-bit data block called the initialization vector (IV), which must be set in the AES_IVRx. The initialization vector
is used in an initial step in the encryption of a message and in the corresponding decryption of the message. The
AES_IVRx are also used by the CTR mode to set the counter value.
CFB128 (CFB where the length of the data segment is 128 bits)
CTR: Counter
The data pre-processing, post-processing and data chaining for the concerned modes are automatically
performed. Refer to the NIST Special Publication 800-38A and NIST Special Publication 800-38D for more
complete information.
These modes are selected by setting the OPMOD field in the AES_MR.
1588
In CFB mode, five data sizes are possible (8, 16, 32, 64 or 128 bits), configurable by means of the CFBS field in
the AES_MR (Section 50.5.2 AES Mode Register on page 1603).
In CTR mode, the size of the block counter embedded in the module is 16 bits. Therefore, there is a rollover after
processing 1 megabyte of data. If the file to be processed is greater than 1 megabyte, this file must be split into
fragments of 1 megabyte or less for the first fragment if the initial value of the counter is greater than 0. Prior to
loading the first fragment into AES_IDATARx, AES_IVRx must be fully programmed with the initial counter value.
For any fragment, after the transfer is completed and prior to transferring the next fragment, AES_IVRx must be
programmed with the appropriate counter value.
If the initial value of the counter is greater than 0 and the data buffer size to be processed is greater than 1
megabyte, the size of the first fragment to be processed must be 1 megabyte minus 16x(initial value) to prevent a
rollover of the internal 1-bit counter.
To have a sequential increment, the counter value must be programmed with the value programmed for the
previous fragment + 216 (or less for the first fragment).
All AES_IVRx fields must be programmed to take into account the possible carry propagation.
50.4.2 Double Input Buffer
The AES_IDATARx can be double-buffered to reduce the runtime of large files.
This mode allows writing a new message block when the previous message block is being processed. This is only
possible when DMA accesses are performed (SMOD = 0x2).
The DUALBUFF bit in the AES_MR must be set to 1 to access the double buffer.
50.4.3 Start Modes
The SMOD field in the AES_MR allows selection of the encryption (or decryption) start mode.
50.4.3.1 Manual Mode
Write the AES_MR with all required fields, including but not limited to SMOD and OPMOD.
Note:
Set the bit DATRDY (Data Ready) in the AES Interrupt Enable Register (AES_IER), depending on whether
an interrupt is required or not at the end of processing.
Write the data to be encrypted/decrypted in the authorized AES_IDATARx (see Table 50-2).
Table 50-2.
Operation Mode
ECB
All
CBC
All
OFB
All
128-bit CFB
All
64-bit CFB
32-bit CFB
AES_IDATAR0
16-bit CFB
AES_IDATAR0
1589
Table 50-2.
Operation Mode
8-bit CFB
AES_IDATAR0
CTR
All
GCM
All
Note:
Note:
In 64-bit CFB mode, writing to AES_IDATAR2 and AES_IDATAR3 is not allowed and may lead to errors in processing.
In 32, 16, and 8-bit CFB modes, writing to AES_IDATAR1, AES_IDATAR2 and AES_IDATAR3 is not allowed and may
lead to errors in processing.
Set the START bit in the AES Control Register (AES_CR) to begin the encryption or the decryption process.
When processing completes, the DATRDY flag in the AES Interrupt Status Register (AES_ISR) is raised. If
an interrupt has been enabled by setting the DATRDY bit in the AES_IER, the interrupt line of the AES is
activated.
When software reads one of the AES_ODATARx, the DATRDY bit is automatically cleared.
The Auto Mode is similar to the manual one, except that in this mode, as soon as the correct number of
AES_IDATARx is written, processing is automatically started without any action in the AES_CR.
50.4.3.3 DMA Mode
The DMA Controller can be used in association with the AES to perform an encryption/decryption of a buffer
without any action by software during processing.
The SMOD field in the AES_MR must be configured to 0x2 and the DMA must be configured with non-incremental
addresses.
The start address of any transfer descriptor must be configured with the address of AES_IDATAR0.
The DMA chunk size configuration depends on the AES mode of operation and is listed in Table 50-3 DMA Data
Transfer Type for the Different Operation Modes.
When writing data to AES with a first DMA channel, data are first fetched from a memory buffer (source data). It is
recommended to configure the size of source data to words even for CFB modes. On the contrary, the
destination data size depends on the mode of operation. When reading data from the AES with the second DMA
channel, the source data is the data read from AES and data destination is the memory buffer. In this case, the
source data size depends on the AES mode of operation and is listed in Table 50-3.
Table 50-3.
1590
Operation Mode
Chunk Size
ECB
Word
CBC
Word
OFB
Word
CFB 128-bit
Word
CFB 64-bit
Word
CFB 32-bit
Word
CFB 16-bit
Half-word
CFB 8-bit
Byte
CTR
Word
GCM
Word
If AES_MR.LOD = 0
The DATRDY flag is cleared when at least one of the AES_ODATARx is read (See Figure 50-1).
Figure 50-1.
DATRDY
If the user does not want to read the AES_ODATARx between each encryption/decryption, the DATRDY flag will
not be cleared. If the DATRDY flag is not cleared, the user cannot know the end of the following
encryptions/decryptions.
If AES_MR.LOD = 1
This mode is optimized to process AES CPC-MAC operating mode.
The DATRDY flag is cleared when at least one AES_IDATAR is written (See Figure 50-2). No more
AES_ODATAR reads are necessary between consecutive encryptions/decryptions.
Figure 50-2.
DATRDY
If AES_MR.LOD = 0
SAMA5D4 Series [DATASHEET]
Atmel-11238A-ATARM-SAMA5D4-Datasheet_30-Sep-14
1591
This mode may be used for all AES operating modes except CBC-MAC where AES_MR.LOD = 1 mode is
recommended.
The end of the encryption/decryption is indicated by the end of DMA transfer associated to AES_ODATARx (see
Figure 50-3). Two DMA channels are required: one for writing message blocks to AES_IDATARx and one to obtain
the result from AES_ODATARx.
Figure 50-3.
BTC /channel 0
BTC /channel 1
If AES_MR.LOD = 1
This mode is optimized to process AES CBC-MAC operating mode.
The user must first wait for the DMA flag (BTC = Buffer Transfer Complete) to be raised, then for DATRDY to
ensure that the encryption/decryption is completed (see Figure 50-4).
In this case, no receive buffers are required.
The output data are only available on the AES_ODATARx.
Figure 50-4.
1592
Table 50-4.
Sequence
AES_MR.LOD = 0
DATRDY Flag
Clearing Condition(1)
At least one
AES_ODATAR must be
read
At least one
AES_IDATAR must be
written
Not used
End of
Encryption/Decryption
Notification
DATRDY
DATRDY
Encrypted/Decrypted
Data Result Location
In the AES_ODATARx
In the AES_ODATARx
In the AES_ODATARx
Note:
AES_MR.LOD = 1
DMA Transfer
AES_MR.LOD = 0
AES_MR.LOD = 1
1. Depending on the mode, there are other ways of clearing the DATRDY flag. See Section 50.5.6 AES Interrupt Status
Register.
Warning: In DMA mode, reading the AES_ODATARx before the last data transfer may lead to unpredictable results.
50.4.5 Galois/Counter Mode (GCM)
50.4.5.1 Description
GCM comprises the AES engine in CTR mode along with a universal hash function (GHASH engine) that is
defined over a binary Galois field to produce a message authentication tag (the AES CTR engine and the GHASH
engine are depicted in Figure 50-5 GCM Block Diagram on page 1594).
The GHASH engine processes data packets after the AES operation. GCM provides assurance of the
confidentiality of data through the AES Counter mode of operation for encryption. Authenticity of the confidential
data is assured through the GHASH engine. GCM can also provide assurance of data that is not encrypted. Refer
to the NIST Special Publication 800-38D for more complete information.
GCM can be used with or without the DMA master. Messages may be processed as a single complete
packet of data or they may be broken into multiple packets of data over time.
GCM processing is computed on 128-bit input data fields. There is no support for unaligned data. The AES key
length can be whatever length is supported by the AES module.
The recommended programming procedure when using DMA is described in Section 50.4.5.3.
1593
Figure 50-5.
(AES_CTRR)
Counter 0
Incr32
Counter 1
(AES_CTRR)
Incr32
Counter N
(AES_KEYWRx)
Cipher(Key)
Cipher(Key)
(AES_IDATARx)
Cipher(Key)
(AES_IDATARx)
Plaintext N
Plaintext 1
Ciphertext 1
(AES_IDATARx)
(AES_IDATARx)
AAD 1
AAD N
(AES_GCMHRx)(1)
GF128Mult(H)
(AES_GHASHRx)
(AES_GHASHRx)
(AES_GHASHRx)
Ciphertext N
GF128Mult(H)
GF128Mult(H)
(AES_AADLENR, AES_CLENR)
GF128Mult(H)
len(AAD) || len(C)
GF128Mult(H)
(AES_TAGRx)
GHASH Engine
Auth Tag(T)
Notes: 1. Optional
Whenever a new key (AES_KEYWRx) is written to the hardware, two automatic actions are processed:
1594
GCM Hash Subkey H generationThe GCM hash subkey (H) is automatically generated. The GCM hash
subkey generation must be complete before doing any other action. The DATRDY bit of the AES_ISR
indicates when the subkey generation is complete (with interrupt if configured). The GCM hash subkey
calculation is processed with the formula H = CIPHER(Key, <128 bits to zero>. The generated GCM H value
is then available in the AES_GCMHRx. If the application software requires a specific hash subkey, the
automatically generated H value can be overwritten in the AES_GCMHRx.
The AES_GCMHRx can be written after the end of the hash subkey generation (see AES_ISR.DATRDY)
and prior to starting the input data feed.
AES_GHASHRx ClearThe AES_GHASHRx are automatically cleared. If a hash initial value is needed for
the GHASH it must be written to the AES_GHASHRx:
3.
Generating the Tag using length of AAD, length of C and J0 (see NIST documentation for details).
The Tag generation can be done either automatically, after the end of AAD/C processing if TAG_EN bit is set in
the AES_MR or done manually, using the GHASH field in AES_GHASHRx (see Section and Section for details).
Processing a Complete Message with Tag Generation
Use this procedure only if J0 four LSB bytes 0xFFFFFFFF.
NOTE: In the case where J 0 four LSB bytes = 0xFFFFFFFF or if the value is unknown, use the procedure
described in Section Processing a Complete Message without Tag Generation followed by the procedure in
Section Manual GCM Tag Generation.
Figure 50-6.
C (Text)
AAD
Padding
AADLEN
Padding
CLEN
To process a complete message with Tag generation, perform the following steps:
1. In AES_MR set OPMOD to GCM and GTAGEN to 1 (configuration as usual for the rest).
2.
Set KEYW in AES_KEYWRx and wait until DATRDY bit of AES_ISR is set (GCM hash subkey generation
complete); use interrupt if needed. See Section 50.4.5.2 Key Writing and Automatic Hash Subkey
Calculation for details.
3.
Calculate the J0 value as described in NIST documentation J0 = IV || 031 || 1 when len(IV) = 96 and
J0 = GHASHH(IV || 0s+64 || [len(IV)]64) if len(IV) 96. See Section Processing a Message with only AAD
(GHASHH) for J0 generation.
4.
5.
6.
Fill the IDATA field of AES_IDATARx with the message to process according to the SMOD configuration
used. If Manual Mode or Auto Mode is used, the DATRDY bit indicates when the data have been processed
(however, no output data are generated when processing AAD).
7.
Wait for TAGRDY to be set (use interrupt if needed), then read the TAG field of AES_TAGRx to obtain the
authentication tag of the message.
Set KEYW in AES_KEYWRx and wait until DATRDY bit of AES_ISR is set (GCM hash subkey generation
complete); use interrupt if needed. After the GCM hash subkey generation is complete the GCM hash
subkey can be read or overwritten with specific value in the AES_GCMHRx (see Section 50.4.5.2 Key
Writing and Automatic Hash Subkey Calculation for details).
1595
3.
Calculate the J0 value as described in NIST documentation J0 = IV || 031 || 1 when len(IV) = 96 and
J0 = GHASHH(IV || 0s+64 || [len(IV)]64) if len(IV) 96. See Section for J0 generation example when len(IV)
96.
4.
5.
6.
Fill the IDATA field of AES_IDATARx with the message to process according to the SMOD configuration
used. If Manual Mode or Auto Mode is used, the DATRDY bit indicates when the data have been processed
(however, no output data are generated when processing AAD).
7.
Make sure the last output data have been read if CLEN 0 (or wait for DATRDY), then read the GHASH field
of AES_GHASHRx to obtain the hash value after the last processed data.
First fragment:
1. In AES_MR set OPMOD to GCM and GTAGEN to 0 (configuration as usual for the rest).
2.
Set KEYW in AES_KEYWRx and wait for DATRDY bit of AES_ISR to be set (GCM hash subkey generation
complete); use interrupt if needed. After the GCM hash subkey generation is complete the GCM hash
subkey can be read or overwritten with specific value in the AES_GCMHRx (see Section 50.4.5.2 Key
Writing and Automatic Hash Subkey Calculation for details).
3.
Calculate the J0 value as described in NIST documentation J0 = IV || 031 || 1 when len(IV) = 96 and
J0 = GHASHH(IV || 0s+64 || [len(IV)]64) if len(IV) 96. See Section for J0 generation example when len(IV)
96.
4.
5.
Set AADLEN field in AES_AADLENR and CLEN field in AES_CLENR according to the length of the first
fragment, or set the fields with the full message length, both configurations work.
6.
Fill the IDATA field of AES_IDATARx with the first fragment of the message to process (aligned on 16-byte
boundary) according to the SMOD configuration used. If Manual Mode or Auto Mode is used the DATRDY
bit indicates when the data have been processed (however, no output data are generated when processing
AAD).
7.
Make sure the last output data have been read if the fragment ends in C phase (or wait for DATRDY if the
fragment ends in AAD phase), then read the GHASH field of AES_GHASHRx to obtain the value of the hash
after the last processed data and finally read the CTR field of the AES_CTR to obtain the value of the CTR
encryption counter (not needed when the fragment ends in AAD phase).
1. In AES_MR set OPMOD to GCM and GTAGEN to 0 (configuration as usual for the rest).
2.
Set KEYW in AES_KEYWRx and wait until DATRDY bit of AES_ISR is set (GCM hash subkey generation
complete); use interrupt if needed. After the GCM hash subkey generation is complete the GCM hash
subkey can be read or overwritten with specific value in the AES_GCMHRx (see Section 50.4.5.2 Key
Writing and Automatic Hash Subkey Calculation for details).
3.
If the first block of the fragment is a block of Additional Authenticated data, set IV in AES_IVRx with
the J0 initial value
1596
If the first block of the fragment is a block of Plaintext data, set IV in AES_IVRx with a value
constructed as follows: LSB96(J0) || CTR value, (96 bit LSB of J0 concatenated with saved CTR
value from previous fragment).
4.
Set AADLEN field in AES_AADLENR and CLEN field in AES_CLENR according to the length of the current
fragment, or set the fields with the remaining message length, both configurations work.
5.
Fill the GHASH field of AES_GHASHRx with the value stored after the previous fragment.
6.
Fill the IDATA field of AES_IDATARx with the current fragment of the message to process (aligned on 16
byte boundary) according to the SMOD configuration used. If Manual Mode or Auto Mode is used, the
DATRDY bit indicates when the data have been processed (however, no output data are generated when
processing AAD).
7.
Make sure the last output data have been read if the fragment ends in C phase (or wait for DATRDY if the
fragment ends in AAD phase), then read the GHASH field of AES_GHASHRx to obtain the value of the hash
after the last processed data and finally read the CTR field of the AES_CTR to obtain the value of the CTR
encryption counter (not needed when the fragment ends in AAD phase).
Note:
Step 1 and 2 are required only if the value of the concerned registers has been modified.
Once the last fragment has been processed, the GHASH value will allow manual generation of the GCM tag (see
Section for details).
Manual GCM Tag Generation
This section describes the last steps of the GCM Tag generation.
The Manual GCM Tag Generation is used to complete the GCM Tag Generation when the message has been
processed without Tag Generation.
Note:
The Message Processing without Tag Generation must be finished before processing the Manual GCM Tag
Generation.
Set KEYW in AES_KEYWRx and wait for DATRDY bit of AES_ISR to be set (GCM hash subkey generation
complete); use interrupt if needed. After the GCM hash subkey generation is complete the GCM hash
subkey can be read or overwritten with specific value in the AES_GCMHRx (see Section 50.4.5.2 Key
Writing and Automatic Hash Subkey Calculation for details).
3.
Set AADLEN field to 0x10 (16 bytes) in AES_AADLENR and CLEN field to 0 in AES_CLENR. This will
allow running a single GHASHH on a 16-byte input data (see Figure 50-7).
4.
Fill the GHASH field of AES_GHASHRx with the state of the GHASH field stored at the end of the message
processing.
5.
Fill the IDATA field of AES_IDATARx according to the SMOD configuration used with len(AAD)64 || len(C)64
value as described in the NIST documentation and wait for DATRDY to be set; use interrupt if needed.
6.
Read the GHASH field of AES_GHASHRx to obtain the current value of the hash.
8.
9.
Fill the IDATA field of AES_IDATARx with the GHASH value read at step 6 and wait for DATRDY to be set
(use interrupt if needed).
10. Read the ODATA field of AES_ODATARx to obtain the GCM Tag value.
Note:
Step 4 is optional if the GHASH field is to be filled with value 0 (0 length packet for instance).
1597
Figure 50-7.
IDATA
GF128Mult(H)
GHASH
It is possible to process a message with only AAD setting the CLEN field to 0 in the AES_CLENR, this can be
used for J0 generation when len(IV) 96 for instance.
Example: Processing J0 when len(IV) 96
To process J0 = GHASHH(IV || 0s+64 || [len(IV)]64) perform the following steps:
1. In AES_MR set OPMOD to GCM and GTAGEN to 0 (configuration as usual for the rest).
2.
Set KEYW in AES_KEYWRx and wait until DATRDY bit of AES_ISR is set (GCM hash subkey generation
complete); use interrupt if needed. After the GCM hash subkey generation is complete the GCM hash
subkey can be read or overwritten with specific value in the AES_GCMHRx (see Section 50.4.5.2 Key
Writing and Automatic Hash Subkey Calculation for details).
3.
Set AADLEN field with len(IV || 0s+64 || [len(IV)]64) in AES_AADLENR and CLEN field to 0 in AES_CLENR.
This will allow running a GHASHH only.
4.
Fill the IDATA field of AES_IDATARx with the message to process (IV || 0s+64 || [len(IV)]64) according to the
SMOD configuration used. If Manual Mode or Auto Mode is used, the DATRDY bit indicates when a
GHASHH step is over (use interrupt if needed).
5.
Note:
The GHASH value can be overwritten at any time by writing the GHASH field value of AES_GHASHRx, used to
perform a GHASHH with an initial value for GHASH (write GHASH field between step 3 and step 4 in this case).
Set AADLEN field with 0x10 (16 bytes) in AES_AADLENR and CLEN field to 0 in AES_CLENR. This will
allow running a single GHASHH.
3.
4.
Fill the IDATA field of AES_IDATARx with the A value according to the SMOD configuration used. If Manual
Mode or Auto Mode is used, the DATRDY bit indicates when a GHASHH computation is over (use interrupt if
needed).
5.
Note:
1598
The GHASH field of AES_GHASHRx can be initialized with a value C between step 3 and step 4 to run a ((A XOR C) x
B) GF128 multiplication.
When an unspecified register access occurs, the URAD flag in the AES_ISR is raised. Its source is then reported
in the Unspecified Register Access Type (URAT) field. Only the last unspecified register access is available
through the URAT field.
Several kinds of unspecified register accesses can occur:
Input Data Register written during the data processing when SMOD = IDATAR0_START
The URAD bit and the URAT field can only be reset by the SWRST bit in the AES_CR.
1599
50.5
Table 50-5.
Register Mapping
Offset
Register
Name
Access
Reset
0x00
Control Register
AES_CR
Write-only
0x04
Mode Register
AES_MR
Read/Write
0x0
Reserved
0x10
AES_IER
Write-only
0x14
AES_IDR
Write-only
0x18
AES_IMR
Read-only
0x0
0x1C
AES_ISR
Read-only
0x0
0x20
AES_KEYWR0
Write-only
0x24
AES_KEYWR1
Write-only
0x28
AES_KEYWR2
Write-only
0x2C
AES_KEYWR3
Write-only
0x30
AES_KEYWR4
Write-only
0x34
AES_KEYWR5
Write-only
0x38
AES_KEYWR6
Write-only
0x3C
AES_KEYWR7
Write-only
0x40
AES_IDATAR0
Write-only
0x44
AES_IDATAR1
Write-only
0x48
AES_IDATAR2
Write-only
0x4C
AES_IDATAR3
Write-only
0x50
AES_ODATAR0
Read-only
0x0
0x54
AES_ODATAR1
Read-only
0x0
0x58
AES_ODATAR2
Read-only
0x0
0x5C
AES_ODATAR3
Read-only
0x0
0x60
AES_IVR0
Write-only
0x64
AES_IVR1
Write-only
0x68
AES_IVR2
Write-only
0x6C
AES_IVR3
Write-only
0x70
AES_AADLENR
Read/Write
0x74
AES_CLENR
Read/Write
0x78
AES_GHASHR0
Read/Write
0x7C
AES_GHASHR1
Read/Write
0x80
AES_GHASHR2
Read/Write
0x84
AES_GHASHR3
Read/Write
0x88
AES_TAGR0
Read-only
0x8C
AES_TAGR1
Read-only
0x080x0C
1600
Table 50-5.
Offset
Register
Name
Access
Reset
0x90
AES_TAGR2
Read-only
0x94
AES_TAGR3
Read-only
0x98
AES_CTRR
Read-only
0x9C
AES_GCMHR0
Read/Write
0xA0
AES_GCMHR1
Read/Write
0xA4
AES_GCMHR2
Read/Write
0xA8
AES_GCMHR3
Read/Write
0xAC
Reserved
0xB00xFC
Reserved
1601
AES_CR
Address:
0xFC044000
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
SWRST
START
1602
AES_MR
Address:
0xFC044004
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
CKEY
15
14
13
LOD
12
11
OPMOD
CFBS
10
KEYSIZE
4
PROCDLY
SMOD
DUALBUFF
GTAGEN
CIPHER
Name
Description
0x0
INACTIVE
0x1
ACTIVE
AES_IDATARx can be written during processing of previous block when SMOD = 0x2. It speeds
up the overall runtime of large files.
Name
Description
0x0
MANUAL_STAR
T
Manual Mode
0x1
AUTO_START
Auto Mode
0x2
IDATAR0_START
1603
Values which are not listed in the table must be considered as reserved.
If a DMA transfer is used, configure SMOD to 0x2. Refer to Section 50.4.3.3 DMA Mode for more details.
KEYSIZE: Key Size
Value
Name
Description
0x0
AES128
0x1
AES192
0x2
AES256
Values which are not listed in the table must be considered as reserved.
OPMOD: Operation Mode
Value
Name
Description
0x0
ECB
0x1
CBC
0x2
OFB
0x3
CFB
0x4
CTR
0x5
GCM
Values which are not listed in the table must be considered as reserved.
For CBC-MAC operating mode, please set OPMOD to CBC and LOD to 1.
LOD: Last Output Data Mode
0: No effect.
After each end of encryption/decryption, the output data are available either on the output data registers (Manual and Auto
modes) or at the address specified in the Channel Buffer Transfer Descriptor for DMA mode.
In Manual and Auto modes, the DATRDY flag is cleared when at least one of the Output Data registers is read.
1: The DATRDY flag is cleared when at least one of the Input Data Registers is written.
No more Output Data Register reads is necessary between consecutive encryptions/decryptions (see Last Output Data
Mode on page 1591).
Warning: In DMA mode, reading to the Output Data registers before the last data encryption/decryption process may lead to
unpredictable results.
CFBS: Cipher Feedback Data Size
Value
Name
Description
0x0
SIZE_128BIT
128-bit
0x1
SIZE_64BIT
64-bit
0x2
SIZE_32BIT
32-bit
0x3
SIZE_16BIT
16-bit
0x4
SIZE_8BIT
8-bit
1604
CKEY: Key
Value
0xE
Name
Description
PASSWD
This field must be written with 0xE the first time that AES_MR is programmed. For subsequent
programming of the AES_MR, any value can be written, including that of 0xE.
Always reads as 0.
1605
AES_IER
Address:
0xFC044010
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
TAGRDY
15
14
13
12
11
10
URAD
DATRDY
The following configuration values are valid for all listed bit names of this register:
0: No effect.
1: Enables the corresponding interrupt.
DATRDY: Data Ready Interrupt Enable
URAD: Unspecified Register Access Detection Interrupt Enable
TAGRDY: GCM Tag Ready Interrupt Enable
1606
AES_IDR
Address:
0xFC044014
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
TAGRDY
15
14
13
12
11
10
URAD
DATRDY
The following configuration values are valid for all listed bit names of this register:
0: No effect.
1: Disables the corresponding interrupt.
DATRDY: Data Ready Interrupt Disable
URAD: Unspecified Register Access Detection Interrupt Disable
TAGRDY: GCM Tag Ready Interrupt Disable
1607
AES_IMR
Address:
0xFC044018
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
TAGRDY
15
14
13
12
11
10
URAD
DATRDY
The following configuration values are valid for all listed bit names of this register:
0: The corresponding interrupt is not enabled.
1: The corresponding interrupt is enabled.
DATRDY: Data Ready Interrupt Mask
URAD: Unspecified Register Access Detection Interrupt Mask
TAGRDY: GCM Tag Ready Interrupt Mask
1608
AES_ISR
Address:
0xFC04401C
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
TAGRDY
15
14
13
12
11
10
URAD
URAT
7
DATRDY
Name
Description
0x0
IDR_WR_PROCESSING
Input Data Register written during the data processing when SMOD = 0x2 mode.
0x1
ODR_RD_PROCESSING
0x2
MR_WR_PROCESSING
0x3
ODR_RD_SUBKGEN
0x4
MR_WR_SUBKGEN
0x5
WOR_RD_ACCESS
Only the last Unspecified Register Access Type is available through the URAT field.
1609
URAT field is reset only by the SWRST bit in the AES_CR.TAGRDY: GCM Tag Ready
0: GCM Tag is not valid.
1: GCM Tag generation is complete (cleared reading GCM Tag, starting another processing or when writing a new key).
1610
AES_KEYWRx [x=0..7]
Address:
0xFC044020
Access:
Write-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
KEYW
23
22
21
20
KEYW
15
14
13
12
KEYW
7
KEYW
1611
AES_IDATARx [x=0..3]
Address:
0xFC044040
Access:
Write-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
IDATA
23
22
21
20
IDATA
15
14
13
12
IDATA
7
IDATA
1612
AES_ODATARx [x=0..3]
Address:
0xFC044050
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ODATA
23
22
21
20
ODATA
15
14
13
12
ODATA
7
ODATA
1613
AES_IVRx [x=0..3]
Address:
0xFC044060
Access:
Write-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
IV
23
22
21
20
IV
15
14
13
12
IV
7
IV
1614
AES_AADLENR
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
AADLEN
23
22
21
20
AADLEN
15
14
13
12
AADLEN
7
AADLEN
1615
AES_CLENR
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
CLEN
23
22
21
20
CLEN
15
14
13
12
CLEN
7
CLEN
1616
AES_GHASHRx [x=0..3]
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
GHASH
23
22
21
20
GHASH
15
14
13
12
GHASH
7
GHASH
1617
AES_TAGRx [x=0..3]
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
TAG
23
22
21
20
TAG
15
14
13
12
TAG
7
TAG
1618
AES_CTRR
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
CTR
23
22
21
20
CTR
15
14
13
12
CTR
7
CTR
1619
AES_GCMHRx [x=0..3]
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
H
23
22
21
20
H
15
14
13
12
H
7
H: GCM H Word x
The four 32-bit H Word registers contain the 128-bit GCM hash subkey H value.
Whenever a new key (AES_KEYWRx) is written to the hardware two automatic actions are processed:
GCM hash subkey H generation
AES_GHASHRx Clear
If the application software requires a specific hash subkey, the automatically generated H value can be overwritten in the
AES_GCMHRx (see Section 50.4.5.2 for details).
The choice of a GCM hash subkey H by a write in the AES_GCMHRx permits
choosing the GCM hash subkey H for GHASH operations
choosing one operand to process a single GF128 multiply
1620
51.
51.1
Description
The Triple Data Encryption Standard (TDES) is compliant with the American FIPS (Federal Information Processing
Standard) Publication 46-3 specification.
The TDES supports the four different confidentiality modes of operation (ECB, CBC, OFB and CFB), specified in
the FIPS (Federal Information Processing Standard) Publication 81 and is compatible with the Peripheral Data
Controller channels for all of these modes, minimizing processor intervention for large buffer transfers.
The 64-bit long keys and input data (and initialization vector for some modes) are each stored in two
corresponding 32-bit write-only registers:
Key x Word Registers TDES_KEYxWR0 and TDES_KEYxWR1
Input Data Registers TDES_IDATAR0 and TDES_IDATAR1
Initialization Vector Registers TDES_IVR0 and TDES_IVR1
As soon as the initialization vector, the input data and the key are configured, the encryption/decryption process
may be started. Then the encrypted/decrypted data is ready to be read out on the two 32-bit output data registers
(TDES_ODATARx) or through the DMAchannels.
51.2
51.3
Embedded Characteristics
Supports Single Data Encryption Standard (DES) and Triple Data Encryption Algorithm (TDEA or TDES)
Support the Four Standard Modes of Operation specified in the FIPS Publication 81, DES Modes of
Operation
8-, 16-, 32- and 64-bit Data Sizes Possible in CFB Mode
Last Output Data Mode Allowing Optimized Message (Data) Authentication Code (MAC) Generation
Product Dependencies
1621
51.3.2 Interrupt
The TDES interface has an interrupt line connected to the Advanced Interrupt Controller (AIC). Handling the TDES
interrupt requires programming the AIC before configuring the TDES.
Table 51-1.
51.4
Peripheral IDs
Instance
ID
TDES
14
Functional Description
The Data Encryption Standard (DES) and the Triple Data Encryption Algorithm (TDES) specify FIPS-approved
cryptographic algorithms that can be used to protect electronic data. The TDES bit in the TDES Mode Register
(TDES_MR) is used to select either the single DES or the Triple DES mode.
Encryption (enciphering) converts data to an unintelligible form called ciphertext. Decrypting (deciphering) the
ciphertext converts the data back into its original form, called plaintext. The CIPHER bit in the TDES_MR is used to
choose between encryption and decryption.
A DES is capable of using cryptographic keys of 64 bits to encrypt and decrypt data in blocks of 64 bits. This 64-bit
key is defined in the Key 1 Word Registers (TDES_KEY1WRx).
A TDES key consists of three DES keys, which is also referred to as a key bundle. These three 64-bit keys are
defined, respectively, in the Key 1, 2 and 3 Word Registers (TDES_KEY1WRx, TDES_KEY2WRx and
TDES_KEY3WRx). In Triple DES mode (TDESMOD = 1 in TDES_MR), the KEYMOD bit in the TDES_MR is used
to choose between a two- and a three-key algorithm as summarized in Table 51-2.
Table 51-2.
Algorithm
Three-key
Two-key
Mode
First
Second
Third
Encryption
Decryption
Encryption
Decryption
The input to the encryption processes of the CBC, CFB, and OFB modes includes, in addition to the plaintext, a
64-bit data block called the initialization vector (IV), which must be set in the Initialization Vector Registers
(TDES_IVRx). The initialization vector is used in an initial step in the encryption of a message and in the
corresponding decryption of the message.
XTEA algorithm can be used instead of DES/TDES by configuring the TDESMOD field in the TDES_MR with the
appropriate value 0x2. An XTEA key consists of a 128-bit key. They are defined in the Key 1 and 2 Word Registers
(TDES_KEY1WRx, TDES_KEY2WRx).
The number of rounds of XTEA is defined in the TDES_XTEA_RNDR and can be programmed up to 64 (1 round =
2 Feistel network rounds).
All the start and operating modes of the TDES algorithm can be applied to the XTEA algorithm.
1622
OFBOutput Feedback
CFBCipher Feedback
The data pre-processing, post-processing and data chaining for each mode are automatically performed. Refer to
the FIPS Publication 81 for more complete information.
These modes are selected by setting the OPMOD field in the TDES_MR.
In CFB mode, four data sizes are possible (8, 16, 32 and 64 bits), configurable by means of the CFBS field in the
TDES_MR (see Section 51.5.2 TDES Mode Register on page 1630).
The OFB and CFB modes of operation are only available if 2-key mode is selected (KEYMOD = 1 in TDES_MR).
51.4.2 Start Modes
The SMOD field in the TDES_MR selects the encryption (or decryption) start mode.
51.4.2.1 Manual Mode
Write the initialization vector (or counter) in the Initialization Vector Registers (TDES_IVRx).
Note:
4.
Set the bit DATRDY (Data Ready) in the TDES Interrupt Enable register (TDES_IER), depending on whether
an interrupt is required or not at the end of processing.
5.
Write the data to be encrypted/decrypted in the authorized Input Data Registers (see Table 51-3).
Table 51-3.
Operation Mode
ECB
All
CBC
All
OFB
All
CFB 64-bit
All
CFB 32-bit
TDES_IDATAR0
CFB 16-bit
TDES_IDATAR0
CFB 8-bit
TDES_IDATAR0
Note:
6.
In 32-, 16- and 8-bit CFB mode, writing to TDES_IDATAR1 is not allowed and may lead to errors in processing.
Set the START bit in the TDES Control Register (TDES_CR) to begin the encryption or the decryption
process.
1623
7.
When the processing completes, the bit DATRDY in the TDES Interrupt Status Register (TDES_ISR) rises. If
an interrupt has been enabled by setting the bit DATRDY in TDES_IER, the interrupt line of the TDES is
activated.
8.
When the software reads one of the Output Data Registers (TDES_ODATARx), the DATRDY bit is
automatically cleared.
The Auto Mode is similar to Manual Mode, except that, as soon as the correct number of Input Data registers is
written, processing is automatically started without any action in the TDES_CR.
51.4.2.3 DMA Mode
The DMA Controller can be used in association with the TDES to perform an encryption/decryption of a buffer
without any action by the software during processing.
The SMOD field of the TDES_MR must be set to 0x2 and the DMA must be configured with non-incremental
addresses.
The start address of any transfer descriptor must be set in TDES_IDATAR0.
The DMA chunk size configuration depends on the TDES mode of operation and is listed in Table 51-4 DMA Data
Transfer Type for the Different Operation Modes.
When writing data to TDES with the first DMA channel, data will be fetched from a memory buffer (source data). It
is recommended to configure the size of source data to words even for CFB modes. On the contrary, the
destination data size depends on the mode of operation. When reading data from the TDES with the second DMA
channel, the source data is the data read from TDES and data destination is the memory buffer. In this case,
source data size depends on the TDES mode of operation and is listed in Table 51-4.
Table 51-4.
Operation Mode
Chunk Size
ECB
Word
CBC
Word
OFB
Word
CFB 64-bit
Word
CFB 32-bit
Word
CFB 16-bit
Half-word
CFB 8-bit
Byte
TDES_MR.LOD = 0
The DATRDY flag is cleared when at least one of the Output Data Registers is read. See Figure 51-1.
Figure 51-1.
DATRDY
If the user does not want to read the output data registers between each encryption/decryption, the DATRDY flag
will not be cleared. If the DATRDY flag is not cleared, the user will not be informed of the end of the
encryptions/decryptions that follow.
TDES_MR.LOD = 1
The DATRDY flag is cleared when at least one Input Data Register is written, before the start of a new transfer.
See Figure 51-2. No further Output Data Register reads are necessary between consecutive
encryptions/decryptions.
Figure 51-2.
DATRDY
TDES_MR.LOD = 0
This mode may be used for all TDES operating modes except CBC-MAC where LOD = 1 mode is recommended.
The end of the encryption/decryption is notified by the end of DMA transfer associated to TDES_ODATARx
registers (see Figure 51-3). Two DMA channels are required, one for writing message blocks to TDES_IDATARx
registers and the other one to get back the processed from TDES_ODATARx registers.
1625
Figure 51-3.
TDES_MR.LOD = 1
This mode is recommended to process TDES CBC-MAC operating mode.
The user must first wait for the DMA flag (BTC = Buffer Transfer Complete) to rise, then for DATRDY to ensure
that the encryption/decryption is completed (see Figure 51-4).
In this case, no receive buffers are required.
The output data is only available on the Output Data Registers (TDES_ODATARx).
Figure 51-4.
Sequence
DMA Transfer
LOD = 0
LOD = 1
LOD = 0
LOD = 1
DATRDY Flag
Clearing Condition (1)
Not used
Encrypted/Decrypted
Data Result Location
Not available
End of
DMA flag (BTC[n]) then
DATRDY
DATRDY
2 DMA flags (BTC[n/m])
Encryption/Decryption
TDES DATRDY
Note:
1. Depending on the mode, there are other ways of clearing the DATRDY flag. See: Section 51.5.6 TDES Interrupt Status
Register.
Warning: In DMA mode, reading to the Output Data registers before the last data transfer may lead to unpredictable
results.
1626
When an unspecified register access occurs, the URAD bit in the TDES_ISR is set. Its source is then reported in
the Unspecified Register Access Type field (URAT). Only the last unspecified register access is available through
the URAT field.
Several kinds of unspecified register accesses can occur:
Input Data Register written during the data processing in DMA mode
The URAD bit and the URAT field can only be reset by the SWRST bit in the TDES_CR.
1627
51.5
Table 51-6.
Register Mapping
Offset
Register
Name
Access
Reset
0x00
Control Register
TDES_CR
Write-only
0x04
Mode Register
TDES_MR
Read/Write
0x2
Reserved
0x10
TDES_IER
Write-only
0x14
TDES_IDR
Write-only
0x18
TDES_IMR
Read-only
0x0
0x1C
TDES_ISR
Read-only
0x0000001E
0x20
TDES_KEY1WR0
Write-only
0x24
TDES_KEY1WR1
Write-only
0x28
TDES_KEY2WR0
Write-only
0x2C
TDES_KEY2WR1
Write-only
0x30
TDES_KEY3WR0
Write-only
0x34
TDES_KEY3WR1
Write-only
Reserved
0x40
TDES_IDATAR0
Write-only
0x44
TDES_IDATAR1
Write-only
Reserved
0x50
TDES_ODATAR0
Read-only
0x0
0x54
TDES_ODATAR1
Read-only
0x0
Reserved
0x60
TDES_IVR0
Write-only
0x64
TDES_IVR1
Write-only
0x70
TDES_XTEA_RNDR
Reserved
0x080x0C
0x380x3C
0x480x4C
0x580x5C
0x680xFC
1628
TDES_CR
Address:
0xFC04C000
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
SWRST
START
1629
TDES_MR
Address:
0xFC04C004
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
15
14
13
12
11
10
LOD
OPMOD
KEYMOD
16
CFBS
9
SMOD
1
TDESMOD
CIPHER
Name
Description
0x0
SINGLE_DES
0x1
TRIPLE_DES
0x2
XTEA
Name
Description
0x0
MANUAL_START
Manual Mode
0x1
AUTO_START
Auto Mode
0x2
IDATAR0_START
Values which are not listed in the table must be considered as reserved.
If a DMA transfer is used, 0x2 must be configured. Refer to Section 51.4.3.2 DMA Mode for more details.
1630
Name
Description
0x0
ECB
0x1
CBC
0x2
OFB
0x3
CFB
For CBC-MAC operating mode, please set OPMOD to CBC and LOD to 1.
The OFB and CFB modes of operation are only available if 2-key mode is selected (KEYMOD = 1).
LOD: Last Output Data Mode
0: No effect.
After each end of encryption/decryption, the output data is available either on the output data registers (Manual and Auto
modes) .
In Manual and Auto modes, the DATRDY flag is cleared when at least one of the Output Data registers is read.
1: The DATRDY flag is cleared when at least one of the Input Data Registers is written.
No more Output Data Register reads are necessary between consecutive encryptions/decryptions (See Last Output Data
Mode on page 1624.).
Warning: In DMA mode, reading to the Output Data registers before the last data encryption/decryption process may lead to
unpredictable result.
CFBS: Cipher Feedback Data Size
Value
Name
Description
0x0
SIZE_64BIT
64-bit
0x1
SIZE_32BIT
32-bit
0x2
SIZE_16BIT
16-bit
0x3
SIZE_8BIT
8-bit
1631
TDES_IER
Address:
0xFC04C010
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
URAD
DATRDY
1632
TDES_IDR
Address:
0xFC04C014
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
URAD
DATRDY
1633
TDES_IMR
Address:
0xFC04C018
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
URAD
DATRDY
1634
TDES_ISR
Address:
0xFC04C01C
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
URAD
URAT
7
DATRDY
Name
Description
0x0
IDR_WR_PROCESSING
Input Data Register written during the data processing when SMOD = 0x2 mode.
0x1
ODR_RD_PROCESSING
0x2
MR_WR_PROCESSING
0x3
WOR_RD_ACCESS
Only the last Unspecified Register Access Type is available through the URAT field.
URAT field is reset only by the SWRST bit in the TDES_CR.
1635
TDES_KEY1WRx
Address:
0xFC04C020
Access:
Write-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
KEY1W
23
22
21
20
KEY1W
15
14
13
12
KEY1W
7
KEY1W
1636
TDES_KEY2WRx
Address:
0xFC04C028
Access:
Write-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
KEY2W
23
22
21
20
KEY2W
15
14
13
12
KEY2W
7
KEY2W
In XTEA mode, the key is defined on 128 bits. These registers contain the 64 MSB bits of the encryption/decryption key.
1637
TDES_KEY3WRx
Address:
0xFC04C030
Access:
Write-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
KEY3W
23
22
21
20
KEY3W
15
14
13
12
KEY3W
7
KEY3W
1638
TDES_IDATARx
Address:
0xFC04C040
Access:
Write-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
IDATA
23
22
21
20
IDATA
15
14
13
12
IDATA
7
IDATA
1639
TDES_ODATARx
Address:
0xFC04C050
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ODATA
23
22
21
20
ODATA
15
14
13
12
ODATA
7
ODATA
1640
TDES_IVRx
Address:
0xFC04C060
Access:
Write-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
IV
23
22
21
20
IV
15
14
13
12
IV
7
IV
1641
TDES_XTEA_RNDR
Address:
0xFC04C070
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
XTEA_RNDS
1642
52.
52.1
Description
The Secure Hash Algorithm (SHA) is compliant with the American FIPS (Federal Information Processing
Standard) Publication 180-2 specification.
The 512/1024-bit block of message is respectively stored in 16/32 x 32-bit registers
(SHA_IDATARx/SHA_IODATARx) which are all write-only.
As soon as the input data is written, the hash processing may be started. The registers comprising the block of a
padded message must be entered consecutively. Then the message digest is ready to be read out on the 5 up to
8/16 x 32-bit output data registers (SHA_IODATARx) or through the DMA channels.
52.2
Embedded Characteristics
Supports Secure Hash Algorithm (SHA1, SHA224, SHA256, SHA384, SHA512)Compliant with FIPS
Publication 180-2
52.3
85 Clock Cycles to obtain a fast SHA1 runtime, 88 clock cycles for SHA384,SHA512 or 209 Clock
Cycles for Maximizing Bandwidth of Other Applications
72 Clock Cycles to obtain a fast SHA224, SHA256 runtime or 194 Clock Cycles for Maximizing
Bandwidth of Other Applications
Product Dependencies
52.4
Peripheral IDs
Instance
ID
SHA
15
Functional Description
The Secure Hash Algorithm (SHA) module requires a padded message according to FIPS180-2 specification. The
first block of the message must be indicated to the module by a specific command. The SHA module produces a
N-bit message digest each time a block is written and processing period ends. N is 160 for SHA1, 224 for SHA224,
256 for SHA256, 384 for SHA384, 512 for SHA512.
1643
3.
1644
For the first block of a message, the FIRST command must be set by writing a 1 into the corresponding bit of
the Control Register (SHA_CR). For the other blocks, there is nothing to write in this Control Register.
4.
5.
6.
When the processing completes, the bit DATRDY in the SHA Interrupt Status Register (SHA_ISR) raises. If
an interrupt has been enabled by setting the bit DATRDY in SHA_IER, the interrupt line of the SHA is
activated.
7.
Repeat the write procedure for each block, start procedure and wait for the interrupt procedure up to the last
block of the entire message. Each time the start procedure is complete, the DATRDY flag is cleared.
8.
After the last block is processed (DATRDY flag is set, if an interrupt has been enabled by setting the bit
DATRDY in SHA_IER, the interrupt line of the SHA is activated), read the message digest in the Output Data
Registers. The DATRDY flag is automatically cleared when reading the SHA_IODATARx registers.
Auto Mode is similar to Manual Mode, except that in this mode, as soon as the correct number of Input Data
Registers is written, processing is automatically started without any action in the control register.
52.4.5.3 DMA Mode
The DMA can be used in association with the SHA to perform the algorithm on a complete message without any
action by the software during processing.
The SHA_MR SMOD field value must be configured to 2.
The DMA must be configured with non-incremental addresses.
The start address of any transfer descriptor must be set to point to the SHA_IDATAR0.
The DMA chunk size must be set to transfer, for each trigger request, 16 words of 32 bits.
The FIRST bit of the control register should be set to 1 prior to start the DMA.
Figure 52-1.
DATRDY
Message fully transferred
1645
In ARM processor based products, the AHB bus and processors manipulate data in Little Endian form. However,
following the protocol of FIPS 180-2 specification, data is collected, processed and stored by the SHA module in a
Big Endian form. The data presented to the SHA module (written to SHA_IDATAxR) must be in Little Endian form.
The data read from the SHA module (read from SHA_IODATAxR) will be in Little Endian form.
The SHA interface automatically converts into Big Endian format words that are presented into Little Endian.
Likewise, the SHA interface returns hash results into Little Endian format even if the internal processing is Big
Endian.
Managing how data is presented to the SHA registers should be managed by software.
As a clarification of this process consider the following example.
If the first 64 bits of a message (according to FIPS180-2, i.e., Big Endian format) to be processed is
0xcafedede_01234567 then the SHA_IDATA0R and SHA_IDATA1R registers should be written with the following
pattern:
SHA_IDATA0R = 0xdedefeca
SHA_IDATA1R = 0x67452301
In a Little Endian system, the message starting with pattern 0xcafedede_01234567 will be stored into memories as
follows:
Lets assume the message is received through a serial to parallel communication channel, the first received
character is 0xca and stored at first memory location (initial offset), second octet being 0xfe is stored at initial offset
+ 1.
When reading on a 32-bit Little Endian system bus, the first word read back from system memory is 0xdedefeca.
When the SHA_IODATAxR registers are read, the hash result is organized in Little Endian format, allowing system
memory storage in the same format as the message.
Taking an example from the FIPS 180-2 specification Appendix B.1, the endianism conversion can be observed.
For this example, the 512-bit message is:
0x61626380000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000018
and the expected SHA-256 result is:
0xba7816bf_8f01cfea_414140de_5dae2223_b00361a3_96177a9c_b410ff61_f20015ad
If the message has not already been stored in the system memory, the first step is to convert the input message to
Little Endian before writing to the SHA_IDATAxR registers. This would result in a write of:
SHA_IDATA0R = 0x80636261...... SHA_IDATA15R = 0x18000000
The data in the output message digest registers, SHA_IODATAxR, contain SHA_IODATA0R = 0xbf1678ba...
SHA_IODATA7R = 0xad1500f2 which is the Little Endian format of 0xba7816bf,..., 0xf20015ad.
Reading SHA_IODATA0R to SHA_IODATA1R and storing into a Little Endian memory system forces hash results
to be stored in the same format as the message.
When the output message is read, the user can convert back to Big Endian for a resulting message value of:
0xba7816bf_8f01cfea_414140de_5dae2223_b00361a3_96177a9c_b410ff61_f20015ad
1646
Input Data Register written during the data processing in DMA mode
The URAD bit and the URAT field can only be reset by the SWRST bit in the SHA_CR.
1647
52.5
Table 52-2.
Offset
Register
Name
Access
Reset
0x00
Control Register
SHA_CR
Write-only
0x04
Mode Register
SHA_MR
Read/Write
0x0000100
0x080x0C
Reserved
0x10
SHA_IER
Write-only
0x14
SHA_IDR
Write-only
0x18
SHA_IMR
Read-only
0x0
0x1C
SHA_ISR
Read-only
0x0
SHA_IDATAR0
Write-only
...
...
...
0x200x3C
0x40
...
Reserved
Input Data 0 Register
...
0x7C
SHA_IDATAR15
Write-only
0x80
SHA_IODATAR0
Read/Write
0x0
...
...
...
...
...
0x9C
SHA_IODATAR7
Read/Write
0x0
0xA0
SHA_IODATAR8
Read/Write
0x0
...
...
...
SHA_IODATAR15
Read/Write
0x0
...
0xBC
0x940xFC
1648
Register Mapping
...
Input/Output Data 15 Register
Reserved
SHA_CR
Address:
0xFC050000
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
WUIHV
SWRST
FIRST
START
1649
SHA_MR
Address:
0xFC050004
Access:
Read/Write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
DUALBUFF
15
14
13
12
11
10
ALGO
UIHV
PROCDLY
SMOD
Name
Description
MANUAL_START
Manual Mode
AUTO_START
Auto Mode
IDATAR0_START
Name
Description
SHORTEST
LONGEST
When SHA1 algorithm is processed, runtime period is either 85 or 209 clock cycles.
When SHA256 or SHA224 algorithm is processed, runtime period is either 72 or 194 clock cycles.
When SHA384 or SHA512 algorithm is processed, runtime period is either 88 or 209 clock cycles.
UIHV: User Initial Hash Values
0: The SHA algorithm is started with the standard initial values as defined in the FIPS180-2 specification.
1: The SHA algorithm is started with the user initial hash values set in the User Initial Hash Values registers.
1650
Name
Description
SHA1
SHA256
SHA384
SHA512
SHA224
10
HMAC_SHA384
11
HMAC_SHA512
12
HMAC_SHA224
Name
Description
INACTIVE
ACTIVE
1651
SHA_IER
Address:
0xFC050010
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
URAD
DATRDY
1652
SHA_IDR
Address:
0xFC050014
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
URAD
DATRDY
1653
SHA_IMR
Address:
0xFC050018
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
URAD
DATRDY
1654
SHA_ISR
Address:
0xFC05001C
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
URAD
URAT
7
DATRDY
Description
Input Data Register 0 to 15 written during the data processing in DMA mode (URAD = 1 and URAT = 0 can occur
only if DUALBUFF is cleared in SHA_MR)
Only the last Unspecified Register Access Type is available through the URAT field.
URAT field is reset only by the SWRST bit in the SHA_CR.
1655
SHA_IDATARx [x=0..15]
Address:
0xFC050040
Access:
Write-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
IDATA
23
22
21
20
IDATA
15
14
13
12
IDATA
7
IDATA
1656
SHA_IODATARx [x=0..15]
Address:
0xFC050080
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
IODATA
23
22
21
20
IODATA
15
14
13
12
IODATA
7
IODATA
1657
53.
53.1
Description
The Advanced Encryption Standard Bridge (AESB) is compliant with the American FIPS (Federal Information
Processing Standard) Publication 197 specification.
The AESB supports three confidentiality modes of operation for symmetrical key block cipher algorithms (ECB,
CBC and CTR), as specified in the NIST Special Publication 800-38A Recommendation.
The 128-bit key is stored in four 32-bit registers (AESB_KEYWRx) which are all write-only.
The 128-bit input data and initialization vector (for some modes) are each stored in four 32-bit registers
(AESB_IDATARx and AESB_IVRx) which are all write-only.
As soon as the initialization vector, the input data and the key are configured, the encryption/decryption process
may be started. Then the encrypted/decrypted data will be ready to be read out on the four 32-bit output data
registers (AESB_ODATARx).
53.2
Embedded Characteristics
On-The-Fly encryption/decryption
Support of the three standard modes of operation specified in the NIST Special Publication 800-38A,
Recommendation for Block Cipher Modes of Operation - Methods and Techniques:
53.3
Counter (CTR)
Last Output Data mode allows optimized Message Authentication Code (MAC) generation
Product Dependencies
1658
Peripheral IDs
Instance
ID
AESB
13
53.4
Functional Description
The Advanced Encryption Standard Bridge (AESB) specifies a FIPS-approved cryptographic algorithm that can be
used to protect electronic data. The AES algorithm is a symmetric block cipher that can encrypt (encipher) and
decrypt (decipher) information.
Encryption converts data to an unintelligible form called ciphertext. Decrypting the ciphertext converts the data
back into its original form, called plaintext. The CIPHER bit in the AESB Mode Register (AESB_MR) allows
selection between the encryption and the decryption processes.
The AESB is capable of using cryptographic keys of 128 bits to encrypt and decrypt data in blocks of 128 bits. This
128-bit key is defined in the Key Registers (AESB_KEYWRx).
The input to the encryption processes of the CBC mode includes, in addition to the plaintext, a 128-bit data block
called the initialization vector (IV), which must be set in the Initialization Vector Registers (AESB_IVRx). The
initialization vector is used in an initial step in the encryption of a message and in the corresponding decryption of
the message. The Initialization Vector Registers are also used by the CTR mode to set the counter value.
CTRCounter
The data pre-processing, post-processing and data chaining for the operation modes are automatically performed.
Refer to the NIST Special Publication 800-38A Recommendation for more complete information.
The modes are selected by the OPMOD field in the AESB_MR.
In CTR mode, the size of the block counter embedded in the module is 16 bits. Therefore, there is a rollover after
processing 1 megabyte of data. If the file to be processed is greater than 1 megabyte, this file must be split into
fragments of 1 megabyte or less for the first fragment if the initial value of the counter is greater than 0. Prior to
loading the first fragment into AESB_IDATARx registers, the AESB_IVRx registers must be cleared. For any
fragment, after the transfer is completed and prior to transferring the next fragment, AESB_IVR0 must be
programmed so that the fragment number (0 for the first fragment, 1 for the second one, and so on) is written in the
16 MSB of AESB_IVR0.
If the initial value of the counter is greater than 0 and the data buffer size to be processed is greater than 1
megabyte, the size of the first fragment to be processed must be 1 megabyte minus 16x(initial value) to prevent a
rollover of the internal 1-bit counter.
53.4.2 Double Input Buffer
The input data register can be double-buffered to reduce the runtime of large files.
This mode allows writing a new message block when the previous message block is being processed.
The DUALBUFF bit in the AESB_MR must be set to 1 to access the double buffer.
53.4.3 Start Modes
The SMOD field in the AESB_MR allows selection of the encryption (or decryption) start mode.
53.4.3.1 Manual Mode
3.
Write the initialization vector (or counter) in the Initialization Vector Registers (AESB_IVRx).
SAMA5D4 Series [DATASHEET]
Atmel-11238A-ATARM-SAMA5D4-Datasheet_30-Sep-14
1659
Note:
4.
Set the DATRDY (Data Ready) bit in the AESB Interrupt Enable Register (AESB_IER) depending on
whether an interrupt is required, or not, at the end of processing.
5.
Write the data to be encrypted/decrypted in the authorized Input Data Registers (see Table 53-2).
Table 53-2.
Operation Mode
ECB
All
CBC
All
CTR
All
6.
Set the START bit in the AESB Control Register (AESB_CR) to begin the encryption or decryption process.
7.
When processing is complete, the DATRDY bit in the AESB Interrupt Status Register (AESB_ISR) raises. If
an interrupt has been enabled by setting the DATRDY bit in AESB_IER, the interrupt line of the AESB is
activated.
8.
When the software reads one of the Output Data Registers (AESB_ODATARx), the AESB_ISR.DATRDY bit
is automatically cleared.
Auto Mode is similar to the manual mode, except that in Auto Mode, as soon as the correct number of Input Data
registers is written, processing is automatically started without any action in the Control Register.
53.4.4 Last Output Data Mode
Last Output Data Mode is used to generate cryptographic checksums on data (MAC) by means of a cipher block
chaining encryption algorithm (the CBC-MAC algorithm for example).
After each end of encryption/decryption, the output data are available on the output data registers for Manual and
Auto mode.
The Last Output Data (LOD) bit in the AESB_MR allows retrieval of only the last data of several
encryption/decryption processes.
This data are only available on the Output Data Registers (AESB_ODATARx).
53.4.5 Manual and Auto Modes
53.4.5.1 If AESB_MR.LOD = 0
The AESB_ISR.DATRDY bit is cleared when at least one of the Output Data Registers is read (see Figure 53-1).
Figure 53-1.
DATRDY
1660
If the user does not want to read the output data registers between each encryption/decryption, the
AESB_ISR.DATRDY bit will not be cleared. If the AESB_ISR.DATRDY bit is not cleared, the user cannot know the
end of the following encryptions/decryptions.
53.4.5.2 If AESB_MR.LOD = 1
The AESB_ISR.DATRDY bit is cleared when at least one Input Data Register is written, so before the start of a
new transfer (see Figure 53-2). No more Output Data Register reads are necessary between consecutive
encryptions/decryptions.
Figure 53-2.
DATRDY
The Automatic Bridge mode, when the AESB block is connected between the system bus and a DDR port,
provides automatic encryption/decryption to/from a DDR port without any action on the part of the user. For
Automatic Bridge mode, the OPMODE field must be configured to 0x4 in the AESB_MR (see Section 53.6.2
AESB Mode Register). If bit AESB_MR.AAHB is set and field AESB_MR.OPMODE = 0x4, there is no
compliance with the standard CTR mode of operation.
This mode, in case of write transfer, automatically encrypts the data before writing it to the final slave destination.
In case of read transfer, this mode automatically decrypts the data read from the target slave before putting it on
the system bus.
Therefore, this mode does not work if the automatically encrypted data is moved at another address outside of the
AESB IP scope. This means that for a given data, the encrypted value is not the same if written at different
addresses.
53.4.6.2 Configuration
1661
53.5
Security Features
Input Data Register written during the data processing when SMOD = IDATAR0_START
The URAD bit and the URAT field can only be reset by the SWRST bit in the AESB_CR.
1662
53.6
Table 53-3.
Register Mapping
Offset
Register
Name
Access
Reset
0x00
Control Register
AESB_CR
Write-only
0x04
Mode Register
AESB_MR
Read/Write
0x0
Reserved
0x10
AESB_IER
Write-only
0x14
AESB_IDR
Write-only
0x18
AESB_IMR
Read-only
0x0
0x1C
AESB_ISR
Read-only
0x0
0x20
AESB_KEYWR0
Write-only
0x24
AESB_KEYWR1
Write-only
0x28
AESB_KEYWR2
Write-only
0x2C
AESB_KEYWR3
Write-only
Reserved
0x40
AESB_IDATAR0
Write-only
0x44
AESB_IDATAR1
Write-only
0x48
AESB_IDATAR2
Write-only
0x4C
AESB_IDATAR3
Write-only
0x50
AESB_ODATAR0
Read-only
0x0
0x54
AESB_ODATAR1
Read-only
0x0
0x58
AESB_ODATAR2
Read-only
0x0
0x5C
AESB_ODATAR3
Read-only
0x0
0x60
AESB_IVR0
Write-only
0x64
AESB_IVR1
Write-only
0x68
AESB_IVR2
Write-only
0x6C
AESB_IVR3
Write-only
Reserved
0x080x0C
0x300x3C
0x700xFC
1663
AESB_CR
Address:
0xF0020000
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
SWRST
START
1664
AESB_MR
Address:
0xF0020004
Access:
Read-write
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
11
10
CKEY
15
14
13
LOD
7
12
OPMOD
6
PROCDLY
SMOD
DUALBUFF
AAHB
CIPHER
Name
Description
0x0
INACTIVE
0x1
ACTIVE
AESB_IDATARx can be written during processing of previous block when SMOD = 0x2. It speeds up
the overall runtime of large files.
Name
Description
0x0
MANUAL_STAR
T
Manual Mode
0x1
AUTO_START
Auto Mode
0x2
IDATAR0_START
Values which are not listed in the table must be considered as reserved.
1665
Name
Description
0x0
ECB
0x1
CBC
0x2
Reserved
0x3
Reserved
0x4
CTR
Values which are not listed in the table must be considered as reserved.
For CBC-MAC operating mode, configure OPMOD to 0x1 (CBC) and set LOD to 1.
Note: If the OPMODE field is set to 0x4 and AAHB = 1, there is no compliance with the standard CTR mode of operation.
1666
Name
Description
PASSWD
This field must be written with 0xE the first time that AES_MR is programmed. For subsequent
programming of the AES_MR register, any value can be written, including that of 0xE.Always reads as
0.
AESB_IER
Address:
0xF0020010
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
URAD
DATRDY
The following configuration values are valid for all listed bit names of this register:
0: No effect.
1: Enables the corresponding interrupt.
DATRDY: Data Ready Interrupt Enable
URAD: Unspecified Register Access Detection Interrupt Enable
1667
AESB_IDR
Address:
0xF0020014
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
URAD
The following configuration values are valid for all listed bit names of this register:
0: No effect.
1: Disables the corresponding interrupt.
DATRDY: Data Ready Interrupt Disable
URAD: Unspecified Register Access Detection Interrupt Disable
1668
DATRDY
AESB_IMR
Address:
0xF0020018
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
URAD
DATRDY
The following configuration values are valid for all listed bit names of this register:
0: The corresponding interrupt is not enabled.
1: The corresponding interrupt is enabled.
DATRDY: Data Ready Interrupt Mask
URAD: Unspecified Register Access Detection Interrupt Mask
1669
AESB_ISR
Address:
0xF002001C
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
URAD
URAT
7
DATRDY
Name
Description
0x0
IDR_WR_PROCESSING
Input Data Register written during the data processing when SMOD = 0x2 mode
0x1
ODR_RD_PROCESSING
0x2
MR_WR_PROCESSING
0x3
ODR_RD_SUBKGEN
0x4
MR_WR_SUBKGEN
0x5
WOR_RD_ACCESS
Only the last Unspecified Register Access Type is available through the URAT field.
URAT field is reset only by the SWRST bit in the AESB_CR.
1670
AESB_KEYWRx
Address:
0xF0020020
Access:
Write-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
KEYW
23
22
21
20
KEYW
15
14
13
12
KEYW
7
KEYW
1671
AESB_IDATARx
Address:
0xF0020040
Access:
Write-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
IDATA
23
22
21
20
IDATA
15
14
13
12
IDATA
7
IDATA
1672
AESB_ODATARx
Address:
0xF0020050
Access:
Read-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
ODATA
23
22
21
20
ODATA
15
14
13
12
ODATA
7
ODATA
1673
AESB_IVRx
Address:
0xF0020060
Access:
Write-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
IV
23
22
21
20
IV
15
14
13
12
IV
7
IV
1674
54.
54.1
Description
The Integrity Check Monitor (ICM) is a DMA controller that performs hash calculation over multiple memory
regions through the use of transfer descriptors located in memory (ICM Descriptor Area). The Hash function is
based on the Secure Hash Algorithm (SHA). The ICM controller integrates two modes of operation. The first one is
used to hash a list of memory regions and save the digests to memory (ICM Hash Area). The second operation
mode is an active monitoring of the memory. In that mode, the hash function is evaluated and compared to the
digest located at a predefined memory address (ICM Hash Area). If a mismatch occurs, an interrupt is raised. See
Figure 54-1 for an example of four-region monitoring. Hash and Descriptor areas are located in Memory instance
i2, and the four regions are split in memory instances i0 and i1.
The ICM SHA engine is compliant with the American FIPS (Federal Information Processing Standard) Publication
180-2 specification.
The following terms are concise definitions of the ICM concepts used throughout this document:
Region Attributesregion start address, region size, region SHA engine processing mode, Write Back or
Compare function mode
Context Registersa set of ICM non-memory-mapped, internal registers which are automatically loaded,
containing the attributes of the region being processed
Main Lista list of region descriptors. Each element associates the start address of a region with a set of
attributes.
Secondary Lista linked list defined on a per region basis that describes the memory layout of the region
(when the region is non-contiguous)
Hash Areapredefined memory space where the region hash results (digest) are stored
Figure 54-1.
Processor
Interrupt
Controller
ICM
System Interconnect
Memory i0
Memory
Region 0
Memory
Region 1
Memory i1
Memory i2
Memory
Region 2
ICM
Hash
Area
Memory
Region 3
ICM
Descriptor
Area
1675
54.2
Embedded Characteristics
54.3
When SHA1 algorithm is processed, the runtime period is either 85 or 209 clock cycles.
When SHA256 or SHA224 algorithm is processed, the runtime period is either 72 or 194 clock cycles.
Block Diagram
Figure 54-2.
APB
Host
Interface
Configuration
Registers
SHA
Hash
Engine
Context
Registers
Monitoring
FSM
Integrity
Scheduler
Master
DMA Interface
Bus Layer
54.4
Product Dependencies
1676
54.4.2 Interrupt
The ICM interface has an interrupt line connected to the Interrupt Controller.
Handling the ICM interrupt requires programming the interrupt controller before configuring the ICM.
Table 54-1.
54.5
Peripheral IDs
Instance
ID
ICM
Functional Description
The Integrity Check Monitor (ICM) is a DMA controller that performs SHA-based memory hashing over memory
regions. As shown in Figure 54-2, it integrates a DMA interface, a Monitoring Finite State Machine (FSM), an
integrity scheduler, a set of context registers, a SHA engine, an APB interface and configuration registers.
When the ICM module is enabled, it sequentially retrieves a circular list of region descriptors from the memory
(Main List described in Figure 54-3). Up to four regions may be monitored. Each region descriptor is composed of
four words indicating the layout of the memory region (see Figure 54-4). It also contains the hashing engine
configuration on a per region basis. As soon as the descriptor is loaded from the memory and context registers are
updated with the data structure, the hashing operation starts. A programmable number of blocks (see TRSIZE field
of the ICM_RCTRL structure member) is transferred from the memory to the SHA engine. When the desired
number of blocks have been transferred, the digest is whether moved to memory (Write Back function) or
compared with a digest reference located in the system memory (Compare function). If a digest mismatch occurs,
an interrupt is triggered if unmasked. The ICM module passes through the region descriptor list until the end of the
list marked by an End of List bit set to one. To continuously monitor the list of regions, the WRAP bit must be set to
one in the last data structure.
1677
Figure 54-3.
Main List
infinite loop
when wrap bit is set
End of Region N
WRAP=1
Region N
Descriptor
ICM Descriptor
Area - Contiguous
Read-only Memory
Secondary List
Region 1
Descriptor
End of Region 0
WRAP=0
Region 0
Descriptor
Region N Hash
ICM Hash Area Contiguous
Read-write once
Memory
Region 1 Hash
Region 0 Hash
Each region descriptor supports gathering of data through the use of the Secondary List. Unlike the Main List, the
Secondary List cannot modify the configuration attributes of the region. When the end of the Secondary List has
been encountered, the ICM returns to the Main List. Memory integrity monitoring can be considered as a
background service and the mandatory bandwidth shall be very limited. In order to limit the ICM memory
bandwidth, use the BBC field of the ICM_CFG register to control ICM memory load.
1678
Figure 54-4.
Region Descriptor
Main List
Region 3 Descriptor
Region 2 Descriptor
Optional Region 0 Secondary List
Region 1 Descriptor
ICMDSCR
Region 0 Descriptor
End of Region 0
0x00C
Region NEXT
0x00C
Region NEXT
0x008
Region CTRL
0x008
Region CTRL
0x004
Region CFG
0x004
Unused
0x000
Region ADDR
0x000
Region ADDR
The ICM integrates a Secure Hash Algorithm Engine (SHA). This module requires a message padded according to
FIPS180-2 specification. The SHA module produces an N-bit message digest each time a block is read and a
processing period ends. N is 160 for SHA1, 224 for SHA224, 256 for SHA256.
54.5.1 ICM Region Descriptor Structure
The ICM Region Descriptor Area is a contiguous area of system memory that the controller and the processor can
access. When the ICM controller is activated, the controller performs a descriptor fetch operation at *(ICM_DSCR)
address. If the Main List contains more than one descriptor (i.e., more than one region is to be monitored), the
fetch address is *(ICM_DSCR) + (RID<<4) where RID is the region identifier.
Table 54-2.
Structure Member
Name
ICM_DSCR+0x000+RID*(0x10)
ICM_RADDR
ICM_DSCR+0x004+RID*(0x10)
ICM_RCFG
ICM_DSCR+0x008+RID*(0x10)
ICM_RCTRL
ICM_DSCR+0x00C+RID*(0x10)
ICM_RNEXT
1679
Name:
ICM_RADDR
Address:
ICM_DSCR+0x000+RID*(0x10)
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
RADDR
23
22
21
20
RADDR
15
14
13
12
RADDR
7
RADDR
1680
Name:
ICM_RCFG
Address:
ICM_DSCR+0x004+RID*(0x10)
Access:
Read/Write
31
30
23
22
21
20
15
14
13
12
11
10
PROCDLY
SUIEN
ECIEN
29
28
27
26
25
24
19
18
17
16
MRPROT
ALGO
WCIEN
BEIEN
DMIEN
RHIEN
EOM
WRAP
CDWBN
1681
Name
Description
SHORTEST
LONGEST
When SHA1 algorithm is processed, the runtime period is either 85 or 209 clock cycles.
When SHA256 or SHA224 algorithm is processed, the runtime period is either 72 or 194 clock cycles.
ALGO: SHA Algorithm
Value
Name
Description
SHA1
SHA256
SHA224
Values which are not listed in the table must be considered as reserved.
MRPROT: Memory Region AHB Protection
This field indicates the value of HPROT AHB signal when the ICM retrieves the memory region.
1682
Name:
ICM_RCTRL
Address:
ICM_DSCR+0x008+RID*(0x10)
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
TRSIZE
7
TRSIZE
1683
Name:
ICM_RNEXT
Address:
ICM_DSCR+0x00C+RID*(0x10)
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
NEXT
23
22
21
20
NEXT
15
14
13
12
NEXT
7
NEXT
1684
Considering the following 512 bits message (example given in FIPS 180-2):
61626380000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000018
The message is written to memory in a Little Endian (LE) system architecture.
Table 54-3.
Memory Address
0x3 / 31:24
0x2 / 23:16
0x1 / 15:8
0x0 / 7:0
0x000
80
63
62
61
0x0040x038
00
00
00
00
0x03C
18
00
00
00
The digest is stored at the memory location pointed at by the ICM_HASH pointer with a Region Offset.
Table 54-4.
Memory Address
0x3 / 31:24
0x2 / 23:16
0x1 / 15:8
0x0 / 7:0
0x000
36
3e
99
a9
0x004
6a
81
06
47
0x008
71
25
3e
ba
0x00C
6c
c2
50
78
0x010
9d
d8
d0
9c
Table 54-5.
Memory Address
0x3 / 31:24
0x2 / 23:16
0x1 / 15:8
0x0 / 7:0
0x000
22
7d
09
23
0x004
22
d8
05
34
0x008
77
a4
42
86
0x00C
b3
55
a2
bd
0x010
e4
bc
ad
2a
0x014
f7
b3
a0
bd
0x018
a7
9d
6c
e3
1685
Table 54-6.
Memory Address
0x3 / 31:24
0x2 / 23:16
0x1 / 15:8
0x0 / 7:0
0x000
bf
16
78
ba
0x004
ea
cf
01
8f
0x008
de
40
41
41
0x00C
23
22
ae
5d
0x010
a3
61
03
b0
0x014
9c
7a
17
96
0x018
61
ff
10
b4
0x01C
ad
15
00
f2
Considering the following 1024 bits message (example given in FIPS 180-2):
6162638000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000018
The message is written to memory in a Little Endian (LE) system architecture.
Table 54-7.
Memory Address
0x3 / 31:24
0x2 / 23:16
0x1 / 15:8
0x0 / 7:0
0x000
80
63
62
61
0x0040x078
00
00
00
00
0x07C
18
00
00
00
1686
Unspecified structure member set to one detected when the descriptor is loaded
The URAD bit and the URAT field can only be reset by writing a 1 to the ICM_CTRL.SWRST bit.
54.5.5 ICM Automatic Monitoring Mode
The ASCD bit of the ICM_CFG register is used to activate the ICM Automatic Mode. When ICM_CFG.ASCD is set,
the ICM performs the following actions:
The ICM controller passes through the Main List once with CDWBN bit in the context register at 0 (i.e., Write
Back activated) and EOM bit in context register at 0.
When WRAP = 1 in ICM_RCFG, the ICM controller enters active monitoring with CDWBN bit in context
register now set and EOM bit in context register cleared. Bits CDWBN and EOM in the region descriptor
structure member (ICM_RCFG) have no effect.
1687
54.6
Table 54-8.
Region Attributes
ICM_RCFG
Transfer Type
Multiple Regions
Single Region
Main List
1 item
1 item
CDWBN
ICM_RNEXT
WRAP
EOM
NEXT
Comments
Secondary
List address
of the
current
region
identifier
1 item
More
than one
item
1 for the
last, 0
otherwise
More
than one
item
1 for the
last, 0
otherwise
More
than one
item
Secondary
List address
More
than one
item
Secondary
List address
1688
54.7
Table 54-9.
Offset
Register Mapping
Register
Name
Access
Reset
0x00
Configuration Register
ICM_CFG
Read/Write
0x0
0x04
Control Register
ICM_CTRL
Write-only
0x08
Status Register
ICM_SR
Write-only
0x0C
Reserved
0x10
ICM_IER
Write-only
0x14
ICM_IDR
Write-only
0x18
ICM_IMR
Read-only
0x0
0x1C
ICM_ISR
Read-only
0x0
0x20
ICM_UASR
Read-only
0x0
Reserved
0x30
ICM_DSCR
Read/Write
0x0
0x34
ICM_HASH
Read/Write
0x0
0x38
ICM_UIHVAL0
Write-only
...
...
...
...
ICM_UIHVAL7
Write-only
Reserved
0x240x2C
...
0x54
0x580xFC
1689
ICM_CFG
Address:
0xFC040000
Access:
Read/Write
31
30
23
22
15
14
29
27
26
25
24
18
17
16
DAPROT
21
20
19
HAPROT
13
UALGO
7
28
12
11
10
UIHASH
DUALBUFF
ASCD
BBC
SLBDIS
EOMDIS
WBDIS
1690
Name
Description
SHA1
SHA256
SHA224
1691
ICM_CTRL
Address:
0xFC040004
Access:
Write-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
RMEN
7
RMDIS
5
REHASH
SWRST
DISABLE
ENABLE
1692
ICM_SR
Address:
0xFC040008
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
RMDIS
RAWRMDIS
ENABLE
1693
ICM_IER
Address:
0xFC040010
Access:
Write-only
31
30
29
28
27
26
25
24
URAD
23
22
21
20
19
18
17
16
RSU
15
14
REC
13
12
11
10
RWC
7
RBE
5
RDM
1694
RHC
ICM_IDR
Address:
0xFC040014
Access:
Write-only
31
30
29
28
27
26
25
24
URAD
23
22
21
20
19
18
17
16
RSU
15
14
REC
13
12
11
10
RWC
7
RBE
5
RDM
RHC
1695
ICM_IMR
Address:
0xFC040018
Access:
Read-only
31
30
29
28
27
26
25
24
URAD
23
22
21
20
19
18
17
16
RSU
15
14
REC
13
12
11
10
RWC
7
RBE
5
RDM
1696
RHC
ICM_ISR
Address:
0xFC04001C
Access:
Read-only
31
30
29
28
27
26
25
24
URAD
23
22
21
20
19
18
17
16
RSU
15
14
REC
13
12
11
10
RWC
7
RBE
5
RDM
RHC
1697
ICM_UASR
Address:
0xFC040020
Access:
Read-only
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
URAT
Name
Description
UNSPEC_STRUCT_MEMBER
Unspecified structure member set to one detected when the descriptor is loaded.
ICM_CFG_MODIFIED
ICM_DSCR_MODIFIED
ICM_HASH_MODIFIED
READ_ACCESS
Only the first Undefined Register Access Trace is available through the URAT field.
The URAT field is only reset by the SWRST bit in the ICM_CTRL register.
1698
ICM_DSCR
Address:
0xFC040030
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
DASA
23
22
21
20
DASA
15
14
13
12
DASA
7
DASA
1699
ICM_HASH
Address:
0xFC040034
Access:
Read/Write
31
30
29
28
27
26
25
24
19
18
17
16
11
10
HASA
23
22
21
20
HASA
15
14
13
12
HASA
7
HASA
1700
ICM_UIHVALx [x=0..7]
Address:
0xFC040038
Access:
Write-only
31
30
29
28
27
26
25
24
19
18
17
16
11
10
VAL
23
22
21
20
VAL
15
14
13
12
VAL
7
VAL
Comment
0x67452301
SHA1 algorithm
0xC1059ED8
SHA224 algorithm
0x6A09E667
SHA256 algorithm
Comment
0xEFCDAB89
SHA1 algorithm
0x367CD507
SHA224 algorithm
0xBB67AE85
SHA256 algorithm
Comment
0x98BADCFE
SHA1 algorithm
0x3070DD17
SHA224 algorithm
0x3C6EF372
SHA256 algorithm
Comment
0x10325476
SHA1 algorithm
0xF70E5939
SHA224 algorithm
0xA54FF53A
SHA256 algorithm
1701
Comment
0xC3D2E1F0
SHA1 algorithm
0xFFC00B31
SHA224 algorithm
0x510E527F
SHA256 algorithm
Comment
0x68581511
SHA224 algorithm
0x9B05688C
SHA256 algorithm
Comment
0x64F98FA7
SHA224 algorithm
0x1F83D9AB
SHA256 algorithm
Comment
0xBEFA4FA4
SHA224 algorithm
0x5BE0CD19
SHA256 algorithm
0x3 / 31:24
0x2 / 23:16
0x1 / 15:8
0x0 / 7:0
0x000
ICM_UIHVAL0
01
23
45
67
0x004
ICM_UIHVAL1
89
ab
cd
ef
0x008
ICM_UIHVAL2
fe
dc
ba
98
0x00C
ICM_UIHVAL3
76
54
32
10
0x010
ICM_UIHVAL4
f0
e1
d2
c3
1702
55.
55.1
Description
The Classical Public Key Cryptography Controller (CPKCC) is an Atmel macrocell that processes public key
cryptography algorithm calculus in both GF(p) and GF(2n) fields. The ROMed CPKCL, the Classical Public Key
Cryptography Library, is the library built on the top of the CPKCC.
The Classical Public Key Cryptography Library includes complete implementation of the following public key
cryptography algorithms:
55.2
Prime generation
Elliptic Curves:
Point Multiply
Point Add/Doubling
Product Dependencies
55.3
Functional Description
The CPKCC macrocell is managed by the CPKCL available in the ROM memory of the SAMA5D4. The user
interface of the CPKCC is not described in this section.
The usage description of the CPKCC and its associated Library is provided in the application note "Using CPKCL
Version 02.05.01.xx on SAMA5D4", Atmel literature No. 11214. This document is available under Non-Disclosure
Agreement (NDA). Contact an Atmel Sales Representative for further details.
1703
56.
Electrical Characteristics
56.1
Table 56-1.
1704
*NOTICE:
56.2
DC Characteristics
The following characteristics are applicable to the operating temperature range: TA = -40C to +85C, unless otherwise
specified.
Table 56-2.
Symbol
DC Characteristics
Parameter
Conditions
Min
Typ
Max
Unit
TA
Operation Temperature
-40
+85
TJ
Junction Temperature
(1)
-40
+125
VDDCORE
DC Supply Core
Regulator
1.62
1.8
1.98
VCCCORE
DC Supply Core
1.16
1.26
1.32
VDDPLLA
DC Supply PLLA
Connected to VCCCORE
1.1
1.2
1.32
VDDUTMIC
Connected to VCCCORE
1.1
1.2
1.32
VDDUTMII
3.0
3.3
3.6
VDDBU
DC Supply Backup
1.8
2.0
2.6
VDDOSC
DC Supply Oscillator
1.65
3.6
VDDIOM
1.65/3.0
1.8/3.3
1.95/3.6
VDDIODDR
1.7
1.8
1.95
LP-DDR2 usage
1.14
1.2
1.30
VDDIOP
3.0
3.6
VDDANA
DC Supply Analog
3.0
3.3
3.6
VDDFUSE
2.25
2.50
2.75
VIL
-0.3
0.8
-0.3
0.3 VDDIO
VIH
VDDIO + 0.3
0.7 VDDIO
VDDIO + 0.3
0.34
0.21
VHYS
VOL
IO Max
0.4
VOH
IO Max
VDDIO - 0.4
1705
Table 56-2.
Symbol
RPULL
DC Characteristics (Continued)
Parameter
Pull-up Resistance
Pull-down Resistance
Conditions
Min
Typ
Max
60
100
180
50
70
140
50
70
140
200
400
600
Output Current
Serial Resistor
Note:
1706
10
(HI_DRIVE)
10
(LO_DRIVE)
(ME_DRIVE)
(HI_DRIVE)
mA
(LO_DRIVE)
(ME_DRIVE)
(HI_DRIVE)
(LO_DRIVE)
34
(HI_DRIVE)
13
TA = 25C
TA = 85C
37
TA = 25C
10
TA = 85C
18
On VDDCORE = 1.8V,
Static Current
8
(ME_DRIVE)
1
(LO_DRIVE)
20
RSERIAL
Unit
30
mA
1. Junction temperature depends on ambient temperature, on-chip power dissipation, package thermal resistance, board
thermal resistance and power dissipation of other components on the board.
56.3
Power Consumption
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
The purpose of Backup Mode is to achieve the lowest power consumption possible in a system which is
performing periodic wake-ups to perform tasks but not requiring fast start-up time.
The Zero-power Power-on Reset, RTC, Backup registers and 32 kHz oscillator (RC or Crystal Oscillator selected
by software in the Supply Controller) are running. The core supply is off.
The system can be awakened from this mode through the WKUP0 pin or an RTC wake-up event.
Backup mode is entered with the help of the Shutdown Controller that asserts the SHDN output pin. The SHDN pin
is to be connected to the Enable of the VDDCORE regulator.
Exit from Backup mode happens if one of the following enable wake-up events occurs:
RTC alarm
The purpose of Idle Mode is to optimize power consumption of the device versus response time. In this mode, only
the core clock is stopped. The peripheral clocks, including the DDR Controller clock, can be enabled. The current
consumption in this mode is application dependent.
This mode is entered via the Wait for Interrupt (WFI) instruction and PCK disabling.
The processor can be awakened from an interrupt. The system will resume where it was before entering in WFI
mode.
Table 56-6 represents the power consumption estimated on the power supplies.
56.3.2.3 Ultra Low-power Mode
The purpose of Ultra Low-power Mode is to reduce the power consumption of the device to the minimum without
disconnecting VDDCORE power supply. It is a combination of very low frequency operations and Idle Mode.
This mode is entered via the following steps:
1. Set the DDR in Self Refresh Mode
2. Reduce the system clock (PCK and MCK) to the minimum with the help of the PMC:
PCK and MCK configuration is to be defined regarding the expected power consumption and wake-up
time. Please refer to Table 56-7 for details.
1707
3.
PLLs are disabled. CKGR_PLLAR (eventually CKGR_PLLBR) is set to 0x3F00. CKGR_UCKR is set
to 0.
Main Oscillator is disabled. MOSCXTEN is set to 0 in CKGR_MOR.
If not used, 12 MHz RC Oscillator can be disabled. MOSCRCEN is set to 0 in CKGR_MOR.
Enter in Wait for Interrupt (WFI) mode and disable the PCK clock.
The modes detailed above are the main low-power modes. Each part can be set to On or Off separately and wake-up
sources can be individually configured. Table 56-3 summarizes the configurations of the low-power modes.
Table 56-3.
32 kHz RC,
12 MHz RC,
32 kHz Osc,
RTC,
Backup
Registers,
POR
Core,
(Backup VDDCORE Memory,
Region)
Regulator Peripherals Mode Entry
Mode
Potential
Wake-Up
Sources
PIO State
Wake-Up
Core at Wake- while in Low- PIO State at
Up
power Mode Wake-Up Consumption(2) Time(1)
Backup
ON
OFF
OFF
Shutdown
(Not powered) Controller
WKUP0 pin
RTC alarm
Reset
Reset
Inputs with
pull-ups
Idle
ON
ON
Powered
WFI
(Not clocked)
Any interrupt
Clocked back
at full speed
Previous
state saved
Ultra Lowpower
ON
ON
DDR in Self
Powered Refresh
Clocked back Previous
Any interrupt
(Not clocked) PMC
at previous one state saved
Unchanged
7 A typ(3)
Start-up
time
470 ns @
176 MHz
WFI
Notes:
1708
1. When considering wake-up time, the time required to start the PLL is not taken into account. Once started, the device works
with the Main Oscillator. The user has to add the PLL start-up time if it is needed in the system. The wake-up time is defined
as the time taken for wake up until the first instruction is fetched.
2. The external loads on PIOs are not taken into account in the calculation.
3. Total Current consumption
4. Depends on MCK frequency
VDDIOM = 1.8 V
VDDIOP = 3.3 V
VDDBU = 2.0 V
Figure 56-1.
Measures Schematics
VDDBU
AMP1
VDDCORE
AMP2
Unit
Maximum
Frequency
ADC
3.2
A/MHz
MCK/2
AES
2.3
A/MHz
MCK/2
AESB
0.2
A/MHz
MCK
DBGU
1.3
A/MHz
MCK/2
Peripheral
GMAC
Conditions
HSMCI
ICM
ISI
LCDC
MPDDRC
MCK/2
8.5
A/MHz
MCK/2
2.9
A/MHz
MCK/2
MCK
MCK
MCK
MCK
PIO Controller
1.8
A/MHz
CPKCC
3.0
A/MHz
MCK
PWM
7.0
A/MHz
MCK/2
SHA
4.4
A/MHz
MCK/2
SMD
6.6
A/MHz
MCK/2
1709
Unit
Maximum
Frequency
SPI
2.2
A/MHz
MCK/2
SSC
2.4
A/MHz
MCK/2
TDES
1.7
A/MHz
MCK/2
TC
3.9
A/MHz
MCK/2
TRNG
890
MCK/2
TWI
2.8
A/MHz
MCK/2
UART
1.5
A/MHz
MCK/2
mA
MCK/2
Peripheral
Conditions
UDPHS
UHPHS
mA
MCK/2
4.1
A/MHz
MCK/2
100
mA
MCK
MCK
USART
VDEC
XDMAC
10.1 MCK
1.
MCK: MHz
DR (Theoretical Datarate): MB/s
DR_Base (Datarate of Base layer): MB/s
DR_Overlayer (Datarate of Overlay layers): MB/s
Pix_CLK (Pixel Clock): MHz
For XDMAC, MPDDRC, UHPHS, and UDPHS, 1 MB/s = 1024*1024 = 1,048,576 bytes/s
For LCDC and ISI, 1 MB/s = 1,000,000 bytes/s
For GMAC: 1 Mbps = 1,000,000 bits/s
2.
3.
The data from sensor is in YUV422 format which means each pixel contains two bytes, so the Pix_CLK provided by the image sensor is 2 times of Pixel rate (two
Pix_CLK transfer one pixel).
4.
Power consumption of LCDC is the sum of the power consumption of each layer.
5.
The UPLL and Transceiver consumes 8 mA (measured from VDDCore), which must be taken into account once any UHPHS or UDPHS is enabled.
Table 56-5.
TA 25C
TA 85C
Unit
162
192
mA
1710
Table 56-6.
TA 85C
32.6
58.4
26.7
52.3
22.3
47.8
Table 56-7.
TA 25C
Mode is entered via Wait for Interrupt (WFI) instruction and PCK
disabling
mA
Mode
ULP 12 MHz
ULP 750 kHz
ULP 187 kHz
ULP 32 kHz
ULP 512 Hz
56.4
Unit
Conditions
TA 25C
TA 85C
Wakeup Time
(s)
6.3
31
9.2
4.9
29.4
151
4.8
29.3
592
4.7
29.2
3400
4.7
29.2
219000
Clock Characteristics
Conditions
Min
(1)
250
Max
Unit
528
MHz
1. Limitation for DDR2 usage only, there are no limitations to LP-DDR and LP-DDR2.
Conditions
Min
(1)
125
Max
Unit
176
MHz
1. Limitation for DDR2 usage only, there are no limitations to LP-DDR, LP-DDR2.
1711
56.5
Table 56-10.
Symbol
Parameter
Conditions
fOP
Operating Frequency
(1)
Min
Typ
Max
Unit
12
MHz
Load Capacitance
12.5
17.5
pF
CLEXT(1)
pF
CPARA
0.6
0.7
0.8
pF
Duty Cycle
40
60
tSTART-UP
Start-up Time
ms
PON
Drive Level
150
Current Dissipation
@ 12 MHz
0.5
mA
CLOAD
IDD ON
Note:
1. The external capacitors value can be determined by using the following formula:
CLEXT = (2 CLOAD) - CBOARD - CROUTING - CPACKAGE - (CPARA 2),
where
CLEXT: external capacitor value which must be soldered from XIN to GND and XOUT to GND
CLOAD: crystal targeted load. Please refer to CLOAD parameter in the electrical specification.
CBOARD: external calculated (or measured) parasitic value due to board
CROUTING: parasitic capacitance due to internal chip routing, typically 1.5 pF
CPACKAGE: parasitic capacitance due to package and bonding, typically 0.75 pF
CPARA: internal parasitic load due to internal structure.
Figure 56-2.
XIN
XOUT
GNDPLL
1K
CCRYSTAL
CLEXT
CLEXT
Crystal Characteristics
Symbol
Parameter
Conditions
Min
Typ
Max
Unit
ESR
@ 12 MHz
120
CM
Motional Capacitance
fF
CS
Shunt Capacitance
pF
1712
Symbol
Parameter
Conditions
Min
Max
Unit
1/(tCPXIN)
50
MHz
tCPXIN
20
ns
tCHXIN
0.4 x tCPXIN
0.6 x tCPXIN
ns
tCLXIN
0.4 x tCPXIN
0.6 x tCPXIN
ns
(1)
25
pF
RIN
(1)
500
VIN
XIN Voltage
(1)
VDDOSC
VDDOSC
CIN
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. See PMC Clock Generator Main Oscillator Register in the PMC section.
56.6
Table 56-13.
Symbol
Parameter
Conditions
Min
Typ
Max
Unit
F0
Nominal Frequency
11.88
12
12.12
MHz
Duty Cycle
45
50
55
IDD ON
100
1713
56.7
Table 56-14.
Symbol
Parameter
Conditions
Min
Typ
Max
Unit
1/(tCP32KHz)
32.768
kHz
CCRYSTAL32
Load Capacitance
12.5
pF
CLEXT32(2)
CCRYSTAL32 = 6 pF
pF
CCRYSTAL32 = 12.5 pF
19
pF
Duty Cycle
40
50
60
CCRYSTAL32 = 6 pF
400
ms
CCRYSTAL32 = 12.5 pF
900
ms
CCRYSTAL32 = 6 pF
600
ms
CCRYSTAL32 = 12.5 pF
1200
ms
0.2
RS = 50 k(1)
Start-up Time
tSTART-UP
RS = 100 k(1)
Drive Level
PON
Notes:
XIN32
XOUT32
GNDBU
CCRYSTAL32
CLEXT32
CLEXT32
Symbol
Parameter
Conditions
ESR
CM
CS
IDD ON
1714
Min
Typ
Max
Unit
50
100
Motional Capacitance
0.6
fF
Shunt Capacitance
0.6
pF
RS = 50 k CCRYSTAL32 = 6 pF
0.3
0.65
RS = 50 k CCRYSTAL32 = 12.5pF
0.45
0.7
RS = 100 k CCRYSTAL32 = 6 pF
0.45
0.75
0.45
0.65
Current dissipation
56.8
Table 56-16.
Symbol
Parameter
Conditions
Min
Typ
Max
Unit
1/(tCPRCz)
23
32
45
kHz
(1)
Duty Cycle
50
IDD ON
540
860
nA
Note:
1. The 32 kHz clock is created from 64 kHz RC oscillator. Its frequency is divided by 2, so the duty cycle is 50/50.
56.9
PLL Characteristics
Table 56-17.
PLLA Characteristics
Symbol
Parameter
Conditions
Min
Typ
Max
Unit
fOUT
Output Frequency
600
1200
MHz
fIN
Input Frequency
12
MHz
Multiplication Factor
45
112
IPLL
Current Consumption
10.6
16.7
mA
Standby mode
0.75
tSTART-UP
Start-up Time
30
Symbol
Parameter
Conditions
Min
Typ
Max
Unit
fIN
Input Frequency
12
MHz
fOUT
Output Frequency
480
MHz
IPLL
Current Consumption
Active mode
3.3
mA
Standby mode
0.08
25
tSTART-UP
Start-up Time
50
1715
Electrical Parameters
Symbol
Parameter
Conditions
Min
Typ
Max
Unit
RPUI
In LS or FS Mode
1.5
RPUA
In LS or FS Mode
15
Settling time
tBIAS
20
tOSC
ms
tSETTLING
Settling time
fIN = 12 MHz
0.3
0.5
ms
Min
Typ
Max
Unit
Symbol
Parameter
Conditions
IBIAS
IVDDUTMII
No connection (1)
IVDDUTMIC
Min
Typ
Max
Unit
Note:
Symbol
Parameter
Conditions
IBIAS
0.7
0.8
mA
HS transmission
47
60
mA
HS reception
IVDDUTMII
IVDDUTMIC
Note:
1716
18
27
mA
FS transmission 0m cable
(1)
mA
FS transmission 5m cable
(1)
26
30
mA
4.5
mA
5.5
mA
FS reception
(1)
Table 56-23.
Conditions
Min
Typ
Max
Unit
2.8
3.3
3.6
20
mV
Sleep Mode
Normal Mode
750
Min
Typ
Max
Unit
Current Consumption
Symbol
Parameter
Conditions
fADCCLK
10
MHz
tCP_ADC
100
ns
fSAMPLING
Sampling Frequency
fADC = 10 MHz
700
KSPS
tSTART-UP
40
tTRACKTIM
400
ns
tCONV
Conversion Time
10
tCP_ADC
Table 56-24.
Parameter
Conditions
Min
Typ
Max
Unit
2.8
3.3
VDDANA
ADVREF Current
600
Min
Typ
Max
Unit
Parameter
Conditions
Resolution
10
bits
-2
+2
LSB
-1
+1
LSB
-2
+2
LSB
-10
+10
mV
Table 56-26.
Parameter
Conditions
Min
Typ
Max
Unit
60
dB
60
dB
56
dB
bits
1717
Mux
RON
CSAMPLE
During the tracking phase the ADC needs to track the input signal during the tracking time shown below:
tTRACK = 0.1 ZSOURCE + 400
With tTRACK expressed in ns and ZSOURCE expressed in ohms.
Table 56-27.
Analog Inputs
Parameter
Min
Typ
Max
Unit
VADVREF
0.5
Input Capacitance
pF
50
For more information on data converter terminology, please refer to the application note Data Converter
Terminology, Atmel literature No. 6022, available on www.atmel.com.
1718
VDD
Vth+
Dynamic
Static
VthVop
Vnop
NRST
tRES
When a very slow (versus tRES) supply rising slope is applied on POR VDD pin, the reset time becomes negligible
and the reset signal is released when VDD rises higher than Vth+.
When a very fast (versus tRES) supply rising slope is applied on POR VDD pin, the voltage threshold becomes
negligible and the reset signal is released after tRES. It is the smallest possible reset time.
Table 56-28.
Symbol
Parameter
Conditions
Min
Typ
Max
Unit
Vth+
1.78
1.83
1.88
Vth-
1.67
1.73
1.83
tRES
Reset Time
120
260
650
IDD
Current Consumption
After tRES
240
500
nA
Table 56-29.
Symbol
Parameter
Conditions
Min
Typ
Max
Unit
Vth+
0.85
1.02
1.08
Vth-
0.8
0.96
1.06
tRES
Reset Time
100
260
600
IDD
Current Consumption
250
500
nA
Table 56-30.
Symbol
Parameter
Conditions
Min
Typ
Max
Unit
Vth+
2.8
2.9
3.0
Vth-
2.7
2.8
2.9
tRES
Reset Time
100
300
600
IDD
Current Consumption
After tRES
200
500
nA
1719
Capacitance Load
Corner
Supply
Max
Min
3.3V
50 pF
50 pF
1.8V
30 pF
30 pF
Symbol
Min
VDDIOM supply
Max
1.8V
3.3V
1.8V
3.3V
Unit
17.3
15.8
ns
SMC2
8.2
6.5
ns
13.0
11.5
ns
SMC4
8.2
6.5
ns
SMC5
SMC6
SMC7
Table 56-33.
(nrd setup +
nrd pulse)
tCPMCK + 4.3
(nrd setup +
nrd pulse)
tCPMCK + 4.4
ns
(nrd setup +
nrd pulse - ncs
rd setup)
tCPMCK + 3.6
(nrd setup +
nrd pulse - ncs
rd setup)
tCPMCK + 4.5
ns
nrd pulse
tCPMCK + 0.1
nrd pulse
tCPMCK
ns
Symbol
Min
VDDIOM supply
1.8V
Max
3.3V
1.8V
3.3V
Unit
30.8
29.0
ns
SMC9
8.9
7.2
ns
1720
Table 56-33.
Symbol
Min
VDDIOM supply
Max
1.8V
3.3V
1.8V
3.3V
Unit
26.2
24.5
ns
SMC11
8.9
7.2
ns
(ncs rd setup +
ncs rd pulse)
tCPMCK + 28.7
(ncs rd setup
+ ncs rd
pulse)
tCPMCK + 29.1
ns
SMC13
(ncs rd setup +
ncs rd pulse nrd setup)
tCPMCK + 23.4
(ncs rd setup
+ ncs rd pulse
- nrd setup)
tCPMCK +24.1
ns
SMC14
ncs rd pulse
length
tCPMCK
ncs rd pulse
length
tCPMCK
ns
SMC12
Symbol
Parameter
1.8V Supply
Max
3.3V Supply
1.8V Supply
3.3V Supply
Unit
nwe pulse
tCPMCK + 4.6
nwe pulse
tCPMCK + 5.8
ns
SMC16
nwe pulse
tCPMCK + 0.1
nwe pulse
tCPMCK
ns
SMC17
nwe setup
tCPMCK + 5.1
nwe pulse
tCPMCK + 5.0
ns
ns
SMC18
SMC20
nwe hold
tCPMCK + 2.7
nwe hold
tCPMCK +1.7
ns
ns
ns
1.3
0.7
1. hold length = total cycle duration - setup duration - pulse duration. hold length is for ncs wr hold length or NWE hold
length.
1721
Table 56-35.
Max
Symbol
Parameter
1.8V Supply
3.3V Supply
1.8V Supply
3.3V Supply
Unit
SMC22
ncs wr pulse
tCPMCK +
14.3
ncs wr pulse
tCPMCK +
15.6
ns
SMC23
ncs wr pulse
tCPMCK
ncs wr pulse
tCPMCK
ns
SMC24
ncs wr setup
tCPMCK + 6.3
ncs wr setup
tCPMCK + 6.4
ns
SMC25
ns
SMC26
ncs wr hold
tCPMCK + 5.0
ncs wr hold
tCPMCK + 4.7
ns
SMC27
ns
Figure 56-6.
SMC12
SMC12
SMC26
SMC24
A0/A1/NBS[3:0]/A2A25
SMC13
SMC13
NRD
NCS
SMC14
SMC14
SMC8
SMC9
SMC10
SMC23
SMC11
SMC22
SMC26
D0D15
SMC25
SMC27
NWE
1722
Figure 56-7.
SMC17
SMC5
SMC5
SMC17
SMC19
A0/A1/NBS[3:0]/A2A25
SMC6
SMC21 SMC6
SMC18
SMC18
SMC20
NCS
SMC7
SMC7
NRD
SMC1
SMC2
SMC15
SMC21
SMC3
SMC4
SMC15
SMC19
D0D31
NWE
SMC16
SMC16
1723
Max
Min
3.3V
40 pF
40 pF
20 pF
40 pF
SPCK
SPI0
SPI1
MISO
SPI2
MOSI
Figure 56-9.
SPCK
SPI3
MISO
SPI5
MOSI
1724
SPI4
NPCS0
SPI13
SPI12
SPCK
SPI6
MISO
SPI7
SPI8
MOSI
NPCS0
SPI13
SPI12
SPCK
SPI9
MISO
SPI10
SPI11
MOSI
SPI15
SPI14 SPI6
SPCK
(CPOL = 0)
SPI12
SPI9
SPI13
SPCK
(CPOL = 1)
SPI16
MISO
1725
Table 56-37.
Symbol
Conditions
Min
Max
Unit
Master Mode
SPI0
9.8
ns
SPI1
6.6
ns
(1)
SPI2
SPI3
SPI4
SPI5
(1)
5.4
ns
10.3
ns
6.6
ns
0(1)
5.4(1)
ns
Slave Mode
SPI6
2.6(1)
9.5(1)
ns
SPI7
3.3
ns
SPI8
0.7
ns
SPI9
SPI10
SPI11
SPI12
(1)
9.1
ns
3.3
ns
0.6
ns
6.9
ns
SPI13
20.8
ns
SPI14
6.6
ns
SPI15
21.3
ns
14.9
ns
SPI16
Notes:
2.5
(1)
1. For output signals, minimum and maximum access time must be extracted. The minimum access time is the time between
the SPCK rising or falling edge and the signal change. The maximum access timing is the time between the SPCK rising or
falling edge and the signal stabilizes. Figure 56-12 illustrates minimum and maximum accesses for SPI2. The same applies
for SPI5, SPI6 and SPI9.
Table 56-38.
Symbol
Conditions
Min
Max
Unit
Master Mode
SPI0
11.6
ns
SPI1
8.9
ns
(1)
SPI2
SPI3
SPI4
SPI5
(1)
5.1
ns
11.7
ns
8.6
ns
(1)
(1)
4.8
ns
Slave Mode
SPI6
3.5(1)
10.6(1)
ns
SPI7
3.5
ns
SPI8
0.6
SPI9
1726
3.3
(1)
ns
(1)
10.3
ns
Table 56-38.
Symbol
Parameter
Conditions
Min
Max
Unit
SPI10
3.5
ns
SPI11
0.6
ns
SPI12
7.0
ns
SPI13
20.4
ns
SPI14
6.7
ns
SPI15
20.8
ns
SPI16
16.6
ns
Figure 56-13. Minimum and Maximum Access Time for SPI Output Signal
SPCK
SPI0
SPI1
MISO
SPI2max
MOSI
SPI2min
1727
Symbol
Parameter
Conditions
Min
Max
Unit
tDDRCK
6.0
8.0
ns
tSDQS
0.6
ns
56.15.3 LPDDR1-SDRAM
Table 56-40.
Symbol
Parameter
Conditions
Min
Max
Unit
tDDRCK
7.5
ns
tSDQS
0.6
ns
56.15.4 LPDDR2-SDRAM
Table 56-41.
Symbol
Parameter
Conditions
Min
Max
Unit
tDDRCK
7.5
ns
tSDQS
0.6
ns
1728
Capacitance Load
Corner
Supply
Max
Min
3.3V
30 pF
30 pF
20 pF
20 pF
TK (CKI = 0)
TK (CKI = 1)
SSC0
TF/TD
TK (CKI = 0)
TK (CKI = 1)
SSC1
TF/TD
1729
TK (CKI = 1)
SSC2
SSC3
TF
SSC4
TD
TK (CKI = 0)
SSC5
TF
SSC7
TD
RK (CKI = 1)
SSC8
RF/RD
1730
SSC9
SSC6
RK (CKI = 0)
SSC9
SSC8
RD
SSC10
RF
RK (CKI = 0)
SSC11
SSC12
RD
SSC13
RF
RK (CKI = 1)
SSC11
SSC12
RF/RD
1731
Table 56-43.
Symbol
Conditions
Min
Max
Unit
Transmitter
SSC0
0(2)
6.1 (2)
ns
SSC1
2.5 (2)
10.9 (2)
ns
SSC2
8.2
ns
SSC3
5.4
ns
SSC4(1)
0
(+ 2 tCPMCK)(1)(2)
4.1
(+ 2 tCPMCK)(1)(2)
ns
SSC5
ns
SSC6
tCPMCK
ns
SSC7(1)
2.5
(+ 3 tCPMCK)(1)(2)
9.7
(+ 3 tCPMCK)(1)(2)
ns
Receiver
SSC8
ns
SSC9
tCPMCK
ns
SSC10
2.6(2)
10.5(2)
ns
SSC11
7.9 - tCPMCK
ns
SSC12
tCPMCK - 5.0
ns
SSC13
Notes:
Table 56-44.
Symbol
(2)
(2)
5.8
ns
Timings SSC4 and SSC7 depend on the start condition. When STTDLY = 0 (Receive start delay) and START = 4,
or 5 or 7 (Receive Start Selection), two Periods of the MCK must be added to timings.
For output signals (TF, TD, RF), minimum and maximum access times are defined. The minimum access time is
the time between the TK (or RK) edge and the signal change. The maximum access timing is the time between
the TK edge and the signal stabilization. Figure 56-23 illustrates minimum and maximum accesses for SSC0. The
same applies for SSC1, SSC4, SSC7, SSC10 and SSC13.
SSC Timing with 1.8V Peripheral Supply (SSC1 only)
Parameter
Conditions
Min
Max
Unit
0(2)
3.9 (2)
ns
Transmitter
SSC0
1732
(2)
SSC1
3.3
SSC2
10.2
ns
SSC3
7.3
ns
SSC4(1)
0
(+ 2 tCPMCK)(1)(2)
3.9
(+ 2 tCPMCK)(1)(2)
ns
SSC5
ns
SSC6
tCPMCK
ns
SSC7(1)
3.4
(+ 3 tCPMCK)(1)(2)
11.6
(+ 3 tCPMCK)(1)(2)
ns
11.7
(2)
ns
Table 56-44.
Symbol
Conditions
Min
Max
Unit
ns
Receiver
SSC8
SSC9
tCPMCK
SSC10
SSC11
SSC12
SSC13
(2)
3.1
ns
(2)
11.1
ns
9.9 - tCPMCK
ns
tCPMCK - 6.8
ns
(2)
3.9
(2)
ns
TK (CKI = 1)
TK (CKI = 0)
SSC0min
SSC0max
TF/TD
Capacitance Load
Corner
Supply
Max
Min
3.3V
30 pF
30 pF
PIXCLK
3
DATA[7:0]
VSYNC
HSYNC
Valid Data
1
Valid Data
Valid Data
1733
Table 56-46.
Symbol
Parameter
Min
Max
Unit
ISI1
3.2
ns
ISI2
0.7
ns
ISI3
PIXCLK frequency
75
MHz
Max
Min
3.3V
20 pF
0 pF
Symbol
Parameter
EMAC1
EMAC2
EMAC3
Note:
1.
Min
Max
Unit
10
ns
10
ns
(1)
(1)
300
For Ethernet MAC output signals, minimum and maximum access time are defined. The minimum access time is
the time between the GMDC rising edge and the signal change. The maximum access timing is the time between
the GMDC rising edge and the signal stabilizes. Figure 56-25 illustrates minimum and maximum accesses for
EMAC3.
Figure 56-25. Minimum and Maximum Access Time of Ethernet MAC Output Signals
GMDC
EMAC1
EMAC2
EMAC3 max
GMDIO
EMAC4
EMAC5
EMAC3 min
1734
ns
Symbol
Parameter
Min
Max
Unit
EMAC4
10
ns
EMAC5
10
ns
EMAC6
10
ns
EMAC7
10
ns
EMAC8
10(1)
25(1)
ns
EMAC9
10(1)
25(1)
ns
(1)
(1)
ns
EMAC10
EMAC11
10
ns
EMAC12
10
ns
EMAC13
10
ns
EMAC14
10
ns
EMAC15
10
ns
EMAC16
10
ns
Note:
1.
See Note
(1)
10
25
of Table 56-48.
1735
EMAC3
EMAC2
GMDIO
EMAC4
EMAC5
EMAC6
EMAC7
GCOL
GCRS
GTXCK
EMAC8
GTXER
EMAC9
GTXEN
EMAC10
GTX[3:0]
GRXCK
EMAC11
EMAC12
GRX[3:0]
EMAC13
EMAC14
EMAC15
EMAC16
GRXER
GRXDV
1736
Min
Max
(1)
(1)
Unit
16
ns
EMAC21
EMAC22
2(1)
16(1)
ns
EMAC23
ns
EMAC24
ns
EMAC25
ns
EMAC26
ns
EMAC27
ns
EMAC28
ns
Notes:
1.
EMAC24
GRX[1:0]
EMAC25
EMAC26
EMAC27
EMAC28
GRXER
GCRSDV
Max
Min
3.3V
40 pF
40 pF
20 pF
40 pF
NPCSx
SPI5
SPI3
CPOL=1
SPI0
SPCK=0
CPOL=0
SPI4
MISO
SPI4
MSB
SPI1
SPI2
LSB
MOSI
1737
NPCS0
SPI13
SPI12
SPCK
SPI6
MISO
SPI7
SPI8
MOSI
NSS
SPI14
SPI15
SCK
SPI9
MISO
SPI10
SPI11
MOSI
Table 56-52.
Symbol
Conditions
Min
Max
Unit
Master Mode
SPI0
SPCK frequency
MCK/6
Hz
SPI1
ns
SPI2
ns
SPI3
ns
SPI4
12.4
ns
SPI5
tSPCK + 2.2
ns
1738
Table 56-52.
Symbol
Conditions
Min
Max
Unit
Slave Mode
SPI6
2.4(1)
12.6(1)
ns
SPI7
2 tCPMCK + 2.8
ns
SPI8
1.1
ns
SPI9
2.3(1)
12.1(1)
ns
SPI10
2.7
ns
SPI11
0.6
ns
SPI12
ns
SPI13
ns
SPI14
ns
ns
SPI15
Notes: 1. The minimum access time is the time between the SPCK rising or falling edge and the signal change. The maximum access
timing is the time between the SPCK rising or falling edge and the signal stabilizes. Figure 56-12 illustrates minimum and
maximum accesses for SPI2. The same applies for SPI5, SPI6 and SPI9.
Table 56-53. USART SPI Timings 1.8V Peripheral Supply (USART3 and USART4 only)
Symbol
Parameter
Conditions
Min
Max
Unit
Master Mode
SPI0
SPCK frequency
MCK/6
Hz
SPI1
ns
SPI2
ns
SPI3
ns
SPI4
11.7
ns
SPI5
tSPCK + 2.3
ns
Slave Mode
SPI6
3.0(1)
13.0(1)
ns
SPI7
2 tCPMCK + 3.1
ns
SPI8
1.1
ns
SPI9
SPI10
SPI11
SPI12
2.8
(1)
(1)
12.5
ns
2.9
ns
0.7
ns
ns
SPI13
ns
SPI14
ns
SPI15
ns
1739
tOF
tR
tLOW
tLOW
SCL
tSU;STA
tHD;STA
tHD;DAT
tSU;DAT
tSU;STO
SDA
tBUF
Table 56-54 describes the requirements for devices connected to the Two-wire Serial Bus.
Table 56-54.
Symbol
Parameter
Conditions
Min
Max
Unit
VIL
Input Low-voltage
-0.3
0.3 VDDIO
VIH
Input High-voltage
0.7 VDDIO
VCC + 0.3
VHYS
0.150
VOL
Output Low-voltage
3 mA sink current
0.4
tR
20 + 0.1Cb(2)
300
ns
tOF
20 + 0.1Cb(2)
250
ns
Ci(1)
10
pF
fTWCK
400
kHz
Rp
1000ns Cb
300ns Cb
(3)
(3)
(4)
(4)
tHIGH
tHIGH
tHIGH
tHIGH
tLOW - (HOLD + 3)
tperipheral clock
ns
tLOW - (HOLD + 3)
tperipheral clock
ns
tLOW
tHIGH
tHD;STA
tSU;STA
tHD;DAT
tSU;DAT
1740
Table 56-54.
Symbol
Parameter
tSU;STO
tHD;STA
Notes:
1.
2.
3.
4.
Conditions
Min
Max
Unit
tHIGH
tHIGH
tHIGH
tHIGH
1741
57.
Mechanical Characteristics
57.1
Figure 57-1.
1742
Table 57-1.
Table 57-2.
TBD
Table 57-3.
mg
Package Reference
MO-275-LLAC-1
J-STD-609 Classification
e8
Table 57-4.
Package Information
Ball Land
0.45 mm 0.05
0.4 mm
0.35 mm 0.05
SMD
Solder
LF35
1743
57.2
Figure 57-2.
1744
Table 57-5.
Table 57-6.
TBD
Table 57-7.
mg
Package Reference
MO-275-JJAC-1
J-STD-609 Classification
e8
Table 57-8.
Package Information
Ball Land
0.45 mm 0.05
0.4 mm
0.35 mm 0.05
SMD
Solder
LF35
1745
58.
Schematic Checklist
The schematic checklist provides the user with the requirements regarding the different pin connections that must
be considered before starting any new board design. It also provides information on the minimum hardware
resources required to quickly develop an application with the SAMA5D4. It does not consider PCB layout
constraints.
It also provides recommendations regarding low-power design constraints to minimize power consumption.
This information is not intended to be exhaustive. Its objective is to cover as many configurations of use as
possible.
The checklist contains a column for use by designers, making it easy to track and verify each line item.
1746
58.1
Power Supply
CAUTION: The board design must comply with power-up and power down sequence guidelines provided in the
datasheet to guarantee reliable operation of the device.
Figure 58-1.
PMIC
DC/DC
GNDOSC
VDDIOM
100nF
3.3V
GNDIOM
VDDIOP
100nF
GNDIOP
VDDUTMII
100nF
GNDUTMI
VDDCORE
DC/DC
10F
5V
100nF
GNDCORE
1.8V
VDDIODDR
10F
100nF
GNDIODDR
LDO
VDDFUSE
100nF
2.5V
GNDFUSE
LDO
VDDANA
3.3V
100nF
GNDANA
LDO
VDDBU
2V
100nF
GNDBU
VCCCORE
10F
LDO
100nF
SAMA5D4
GNDCORE
VDDPLLA
VCCCORE
100nF
GNDPLL
VDDUTMIC
100nF
GNDUTMI
Note:
1.
1747
Table 58-1.
Signal Name
1.62 V to 1.98 V
VDDCORE
Description
Decoupling/Filtering capacitors
(10 F and 100 nF)(1)(2)
1.16 V to 1.32 V
VCCCORE
Decoupling/Filtering capacitors
(10 F and 100 nF)(1)(2)
VDDIODDR
1.70 V to 1.90 V
or
or
1.14 V to 1.30 V
Decoupling/Filtering capacitors
VDDIOM
1.65 V to 1.95 V
or
3.0 V to 3.6 V
Decoupling capacitor (100 nF)(1)(2)
VDDIOP(3)
VDDBU
3.0 V to 3.6 V
1.88 V to 2.12 V
VDDUTMIC
VDDUTMII
Powers the USB device and host UTMI+ core and the
UTMI PLL.
1.1 V to 1.32 V
Decoupling capacitors (100 nF)(1)(2)
3.0 V to 3.6 V
Decoupling capacitor (100 nF)(1)(2)
VDDPLLA
1.1 V to 1.32 V
(1)(2)
1748
Table 58-1.
Signal Name
Description
Powers the main oscillator cell.
VDDOSC
3.0 V to 3.6 V
Decoupling/Filtering RLC circuit(1)
3.0 V to 3.6 V
VDDANA
(3)
VDDFUSE
GNDCORE
GNDIODDR
GNDIOM
2.25 V to 2.75 V
DDR2/LPDDR/LPDDR2 interface
I/O lines ground
NAND and HSMC Interface
I/O lines ground
GNDIOP
GNDBU
Backup ground
GNDUTMI
GNDPLL
GNDOSC
GNDANA
Analog ground
GNDFUSE
Note:
1749
2. Decoupling capacitors must be connected as close as possible to the microcontroller and on each concerned pin.
100nF
VDDCORE
100nF
VDDCORE
100nF
VDDCORE
GND
3. Must rise in the same time due to internal constraints. There is specific power sequences to ensure a reliable operation of
the device and avoid unwanted security events.
4. For more information, see Table 56-29 "Core Power Supply POR Characteristics".
58.2
Table 58-2.
Signal Name
Description
Crystal Load Capacitance to check (CCRYSTAL).
SAMA5D4
XIN
XOUT
GNDOSC
XIN
XOUT
12 MHz
CCRYSTAL
Main Oscillator
in Normal Mode
CLEXT
CLEXT
XOUT
12 MHz
Main Oscillator
in Bypass Mode
1750
Table 58-2.
Signal Name
XIN
XOUT
12 MHz
Main Oscillator
Disabled
Description
SAMA5D4
XIN32
XIN32
XOUT32
Slow
Clock Oscillator
XOUT32
GNDBU
CLEXT32
Clock Oscillator
in Bypass Mode
XIN32
XOUT32
Slow
Clock Oscillator
Disabled
1751
Table 58-2.
Signal Name
Description
Bias Voltage Reference for USB
To reduce as much as possible the noise on VBG pin
please check the Layout consideration below:
- VBG path as short as possible
- ground connection to GNDUTMI
VBG
0.91.1V(2)
5K62 1%
VBG
10 pF
GNDUTMI
1752
58.3
Table 58-3.
Signal Name
TCK
TMS
TDI
TDO
Floating
NTRST
Description
This pin is a Schmitt trigger input.
Internal pull-up resistor to VDDIOP (100 k).
This pin is a Schmitt trigger input.
Internal pull-up resistor to VDDIOP (100 k).
This pin is a Schmitt trigger input.
Internal pull-up resistor to VDDIOP (100 k).
Output driven at up to VDDIOP.
This pin is a Schmitt trigger input.
Internal pull-up resistor to VDDIOP (100 k).
(3)
JTAGSEL
Notes:
58.4
Table 58-4.
Signal Name
NRST
TST
Description
NRST pin is a Schmitt trigger input.
No internal pull-up resistor.
This pin is a Schmitt trigger input.
Internal pull-down resistor to GNDBU (15 k).
Note:
1. In a well-shielded environment subject to low magnetic and electric field interference, the pin may be left unconnected. In
noisy environments, a connection to ground is recommended.
58.5
Shutdown/Wake-up Logic
Table 58-5.
Signal Name
Description
Application dependent.
SHDN
WKUP
1753
58.6
Table 58-6.
PIO Connections
Signal Name
Description
All PIOs are pulled-up inputs (100 k) at reset except
those which are multiplexed with the Address Bus signals
that require to be enabled as peripherals:
PAx
PBx
PCx
Application dependent.
Schmitt trigger on all inputs.
PDx
PEx
58.7
Table 58-7.
ADC Connections
Signal Name
ADVREF
Description
3.3 V to VDDANA
Decoupling/filtering capacitors.
Application dependent.
58.8
Table 58-8.
EBI Connections
Signal Name
D0D15
Application dependent.
A0A25
Application dependent.
Description
Data Bus (D0 to D15)
All data lines are pulled-up inputs to VDDIOM at reset.
Address Bus (A0 to A25)
All address lines are driven to 0 at reset.
Table 58-9 and Table 58-10 detail the connections to be applied between the EBI pins and the external devices for
each Memory Controller.
Table 58-9.
Signals:
EBI_
8-bit
Static Device
Controller
1754
2 x 8-bit
Static Devices
16-bit
Static Device
D0D7
D0D7
D0D7
D0D7
D8D15
D8D15
D8D15
A0/NBS0
A0
NLB
A1
A1
A0
A0
Table 58-9.
Signals:
EBI_
8-bit
Static Device
16-bit
Static Device
2 x 8-bit
Static Devices
Controller
A2A22
A[2:22]
A[1:21]
A[1:21]
A23A25
A[23:25]
A[22:24]
A[22:24]
NCS0
CS
CS
CS
NCS1
CS
CS
CS
NCS2
CS
CS
CS
NCS3/NANDCS
CS
CS
CS
NRD/NANDOE
OE
OE
OE
NWE/NWR0/NANDWE
WE
WE
(1)
NUB
WE
NWR1/NBS1
WE
Note:
1. NWR0 enables lower byte writes. NWR1 enables upper byte writes.
Table 58-10.
(1)
Signals:
EBI_
Controller
D0D7
NFD0NFD7
NFD0NFD7
D8D15
NFD8NFD15
A21/NANDALE
ALE
ALE
A22/NANDCLE
CLE
CLE
NRD/NANDOE
RE
RE
NWE/NWR0/NANDWE
WE
WE
NCS3/NANDCS
CE
CE
NANDRDY
R/B
R/B
A0/NBS0
A1A20
A23A25
NWR1/NBS1
NCS0
NCS1
NCS2
NWAIT
1755
58.9
1756
Signal Name
DDR2 Mode
Controller
DDR_VREF
VDDIODDR/2
VDDIODDR/2
VDDIODDR/2
DDR_CALP
DDR_CALN
DDR_CK, DDR_CKN
DDR_CKE
CLKE
CLKE
CLKE
DDR_CS
CS
CS
CS
DDR_BA[2..0]
BA[2..0]
BA[2..0]
BA[2..0]
DDR_WE
WE
CA2
WE
DDR_RASDDR_CAS
RAS, CAS
CA0, CA1
RAS, CAS
DDR_A[13..0]
A[13:0]
A[13:0]
DDR_D[31..0]
D[31:0]
D[31:0]
D[31:0]
DQS[3..0],
DQSN[3..0]
DQS[3:0]
DQSN[3:0]
DQS[3:0]
DQSN[3:0]
DQS[3:0]
DQSN connected to
DDR_VREF
DQM[3..0]
DQM[3..0]
DQM[3..0]
DQM[3..0]
LPDDR2 Mode
LPDDR
58.10 USB High-Speed Host Port (UHPHS)/USB High-Speed Device Port (UDPHS)
Table 58-12.
UHPHS/UDPHS Connections
Signal Name
Description
Application dependent(2)(3)
HHSDPB/HHSDMB
Application dependent(2)
HHSDPC/HHSDMC
(2)
HHSDPA/DHSDP
(1)
HHSDMA/DHSDM(1)
Notes:
Application dependent
+5V
HHSDM/HFSDM
3 4
Shell = Shield
1 2
HHSDP/HFSDP
5K62 1%
VBG
10 pF
GNDUTMI
15k
(1)
"B" Receptacle
1 = VBUS
2 = D3 = D+
4 = GND
1
DHSDM/DFSDM
Shell = Shield
(1)
22k
CRPB
CRPB:1F to 10F
DHSDP/DFSDP
5K62 1%
VBG
10 pF
GNDUTMI
(1) The values shown on the 22 k and 15 k resistors are only valid with 3.3V supplied PIOs.
1757
Peripheral
Pin
PIO Line
NANDOE
PC13
NANDWE
PC14
NANDCS
PC15
NANDRDY
PC16
NANDALE
PC17
NANDCLE
PC18
Cmd/Addr/Data
Peripheral
Pin
PIO Line
MCI1
MCI1_CK
PE18
MCI1
MCI1_CDA
PE19
MCI1
MCI1_D0
PE20
MCI1
MCI1_D1
PE21
MCI1
MCI1_D2
PE22
MCI1
MCI1_D3
PE23
Note:
The MCI1 pins are pull-down by default (typical value 70 k). To function correctly, the signals require an
external pull-up resistor and the internal pulldown resistor must be disabled.
1758
Table 58-15.
Peripheral
Pin
PIO Line
SPI0
MOSI
PC1
SPI0
MISO
PC0
SPI0
SPCK
PC2
SPI0
NPCS0
PC3
SPI0
NPCS1
PC4
Peripheral
Pin
PIO Line
TWI0
TWD0
PA30
TWI0
TWCK0
PA31
Peripheral
Pin
PIO Line
DBGU
DRXD
PB24
DBGU
DTXD
PB25
1759
59.
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
where
1760
V: revision
ARM
60.
Table 60-1.
Ordering Code
ATSAMA5D44A-CU
ATSAMA5D44A-CUR
ATSAMA5D43A-CU
ATSAMA5D43A-CUR
ATSAMA5D42A-CU
ATSAMA5D42A-CUR
ATSAMA5D41A-CU
ATSAMA5D41A-CUR
Package
BGA361
BGA289
BGA361
BGA289
Carrier Type
Package Type
Tray
Tape and Reel
Tray
Tape and Reel
Tray
Green
Industrial
-40C to 85C
1761
61.
Errata
The present errata provide information on SAMA5D4 series Rev. A parts.
61.1
61.2
61.3
1762
61.4
1.
If the SLEEP bit is set in ADC_MR and a new calibration is required at anytime, the SLEEP bit must first be disabled after which a dummy conversion must be performed. At the end of the conversion (EOC) a new calibration
can be started. At the end of the calibration, the SLEEP bit can be set again to 1 and normal conversions can
again be performed.
2.
If the SLEEP bit is not used but all channels are disabled at any time, the equivalent of the sleep state is
reached by the internal finite state machine of the ADC controller. Therefore a dummy conversion must be
performed, after which the calibration can be performed.
3.
The Soft reset command can be performed prior to start a calibration but the configuration of all channels is
cleared and must be reprogrammed.
1763
61.5
1764
Revision History
Table 61-1.
Revision History
Doc. Rev.
Date
30-Sep-14
Changes
First release
1765
Table of Contents
1.
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.
Signal Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.
5.
Power Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.1
5.2
5.3
5.4
5.5
5.6
5.7
5.8
6.
Embedded Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
External Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
System Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
8.1
9.
28
28
29
29
29
29
29
30
8.
Power Supplies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Power-up Consideration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Shut-down Consideration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Wake-up Consideration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Power-down Consideration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Power-on Reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Programmable I/O Lines and Current Drive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
I/O Drive Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Memories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
6.1
6.2
7.
Chip Identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
9.1
9.2
9.3
9.4
Peripheral Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Peripheral identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Peripheral Signal Multiplexing on I/O Lines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Peripheral Clock Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38
38
40
40
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Programmer Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Memory Management Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
41
42
42
50
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Application Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Debug and Test Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
55
55
56
57
59
60
11.7
11.8
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Boot Sequence Controller (BSC) Registers User Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
65
65
65
66
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Flow Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chip Setup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
NVM Boot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SAM-BA Monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Fuse Box Controller. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
68
69
69
70
80
83
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
L2 Cache Controller (L2CC) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
85
85
85
85
87
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
AXI Matrix (AXIMX) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MATRIX0 (H64MX) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MATRIX1 (H32MX) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Memory Mapping. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Special Bus Granting Mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
No Default Master . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Last Access Master . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Fixed Default Master . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Arbitration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Register Write Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TrustZone Extension to AHB and APB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AHB Matrix (MATRIX) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
125
125
126
128
130
130
130
130
130
131
134
134
146
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Special Function Registers (SFR) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
ii
18.2
18.3
18.4
18.5
18.6
18.7
18.8
18.9
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Watchdog Timer (WDT) User Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
211
211
211
212
214
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Reset Controller (RSTC) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
219
219
219
220
227
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
I/O Lines Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Shutdown Controller (SHDWC) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
231
231
231
232
232
232
233
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Periodic Interval Timer (PIT) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
237
237
237
237
239
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Real-time Clock (RTC) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
244
244
245
245
245
251
iii
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Slow Clock Controller (SCKC) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
270
270
271
272
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Secure Fuse Controller (SFC) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
274
274
275
275
277
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Main Clock Selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Main Clock. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Divider and PLLA Block. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
UTMI Phase Lock Loop Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Master Clock Controller. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
Processor Clock Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
Matrix Clock Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
LCDC Clock Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
USB Device and Host Clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
DDR2/LPDDR/LPDDR2 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Software Modem Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Peripheral Clock Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Programmable Clock Output Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Slow Crystal Clock Frequency Monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Programming Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Clock Switching Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
Register Write Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Power Management Controller (PMC) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
Parallel Input/Output Controller (PIO) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
MPDDRC Module Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
Product Dependencies, Initialization Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
Software Interface/SDRAM Organization, Address Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
AHB Multi-port DDR-SDRAM Controller (MPDDRC) User Interface. . . . . . . . . . . . . . . . . . . . . . . . 431
iv
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
I/O Lines Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Multiplexed Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Application Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
External Memory Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Connection to External Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Standard Read and Write Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Scrambling/Unscrambling Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Automatic Wait States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Data Float Wait States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
External Wait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Slow Clock Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Register Write Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
NFC Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PMECC Controller Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Software Implementation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Static Memory Controller (SMC) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
479
480
481
481
482
482
483
483
484
486
492
492
496
500
506
508
508
519
526
531
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DMA Controller Peripheral Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Linked List Descriptor Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XDMAC Maintenance Software Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XDMAC Software Requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Extensible DMA Controller (XDMAC) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
584
584
585
586
589
593
595
596
597
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
I/O Lines Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
LCD Controller (LCDC) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
635
635
636
637
637
639
673
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Decoding Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Post-Processing Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
H.264/MVC Decoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MPEG-4/H.263 Decoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functionality of the JPEG Decoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
829
829
830
831
833
835
838
838
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Image Sensor Interface (ISI) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
840
841
841
842
850
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Typical Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
USB High Speed Device Port (UDPHS) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
882
882
883
884
884
885
908
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Typical Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
958
958
959
960
961
963
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Signal Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Programming Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Ethernet MAC (GMAC) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
964
964
965
965
966
987
991
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Application Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Pin Name List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Bus Topology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
High Speed MultiMedia Card Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SD/SDIO Card Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CE-ATA Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
HSMCI Boot Operation Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
HSMCI Transfer Done Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Register Write Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
High Speed MultiMedia Card Interface (HSMCI) User Interface. . . . . . . . . . . . . . . . . . . . . . . . . .
1100
1100
1101
1102
1102
1103
1104
1107
1115
1116
1117
1118
1119
1120
vi
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Application Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Signal Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Serial Peripheral Interface (SPI) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1148
1148
1149
1149
1150
1150
1151
1163
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
List of Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Application Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Two-wire Interface (TWI) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1179
1179
1180
1180
1181
1181
1182
1207
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Application Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SSC Application Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Pin Name List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Synchronous Serial Controller (SSC) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1224
1224
1225
1225
1226
1227
1228
1229
1241
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
UART Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Debug Unit (DBGU) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1268
1268
1269
1270
1270
1277
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Universal Asynchronous Receiver Transmitter (UART) User Interface . . . . . . . . . . . . . . . . . . . .
1294
1294
1294
1295
1295
1301
vii
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
I/O Lines Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1312
1312
1313
1313
44.5
44.6
44.7
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1377
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1378
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1378
Software Modem Device (SMD) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1379
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Pin Name List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Timer Counter (TC) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1382
1383
1384
1385
1385
1386
1409
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
I/O Lines Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Pulse Width Modulation Controller (PWM) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1443
1444
1445
1445
1446
1448
1472
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Signal Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Analog-to-Digital Converter (ADC) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1524
1525
1526
1526
1527
1528
1550
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
True Random Number Generator (TRNG) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1578
1578
1578
1579
1579
1580
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Advanced Encryption Standard (AES) User Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1587
1587
1588
1588
1600
viii
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Triple Data Encryption Standard (TDES) User Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1621
1621
1621
1622
1628
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Secure Hash Algorithm (SHA) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1643
1643
1643
1643
1648
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Security Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Advanced Encryption Standard Bridge (AESB) User Interface. . . . . . . . . . . . . . . . . . . . . . . . . . .
1658
1658
1658
1659
1662
1663
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1675
Embedded Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1676
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1676
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1676
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1677
Programming the ICM for Multiple Regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1688
Integrity Check Monitor (ICM) User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1689
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1703
Product Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1703
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1703
ix
1704
1705
1707
1711
1712
1713
1714
1715
1715
1716
1717
1719
1720
1723
1728
56.16
56.17
56.18
56.19
56.20
56.21
SSC Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ISI Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MCI Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Ethernet MAC (GMAC) Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
USART in SPI Mode Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Two-wire Interface Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1729
1733
1734
1734
1737
1740
Power Supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Clock, Oscillator and PLL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ICE and JTAG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Reset and Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Shutdown/Wake-up Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Parallel Input/Output (PIO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Analog-to-Digital Converter (ADC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
External Bus Interface (EBI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DDR2 Bus Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
USB High-Speed Host Port (UHPHS)/USB High-Speed Device Port (UDPHS) . . . . . . . . . . . . . .
Boot Program Hardware Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1747
1750
1753
1753
1753
1754
1754
1754
1756
1757
1758
1762
1762
1762
1763
1764
XXXXXX
Atmel Corporation
T: (+1)(408) 441.0311
F: (+1)(408) 436.4200
www.atmel.com