32-Bit AVR Microcontroller
32-Bit AVR Microcontroller
2
32072H–AVR32–10/2012
AT32UC3A3
1. Description
The AT32UC3A3/A4 is a complete System-On-Chip microcontroller based on the AVR32 UC
RISC processor running at frequencies up to 84MHz. AVR32 UC is a high-performance 32-bit
RISC microprocessor core, designed for cost-sensitive embedded applications, with particular
emphasis on low power consumption, high code density and high performance.
The processor implements a Memory Protection Unit (MPU) and a fast and flexible interrupt con-
troller for supporting modern operating systems and real-time operating systems. Higher
computation capabilities are achievable using a rich set of DSP instructions.
The AT32UC3A3/A4 incorporates on-chip Flash and SRAM memories for secure and fast
access. 64 KBytes of SRAM are directly coupled to the AVR32 UC for performances optimiza-
tion. Two blocks of 32 Kbytes SRAM are independently attached to the High Speed Bus Matrix,
allowing real ping-pong management.
The Peripheral Direct Memory Access Controller (PDCA) enables data transfers between
peripherals and memories without processor involvement. The PDCA drastically reduces pro-
cessing overhead when transferring continuous and large data streams.
The Power Manager improves design flexibility and security: the on-chip Brown-Out Detector
monitors the power supply, the CPU runs from the on-chip RC oscillator or from one of external
oscillator sources, a Real-Time Clock and its associated timer keeps track of the time.
The device includes two sets of three identical 16-bit Timer/Counter (TC) channels. Each chan-
nel can be independently programmed to perform frequency measurement, event counting,
interval measurement, pulse generation, delay timing and pulse width modulation. 16-bit chan-
nels are combined to operate as 32-bit channels.
The AT32UC3A3/A4 also features many communication interfaces for communication intensive
applications like UART, SPI or TWI. The USART supports different communication modes, like
SPI Mode and LIN Mode. Additionally, a flexible Synchronous Serial Controller (SSC) is avail-
able. The SSC provides easy access to serial communication protocols and audio standards like
I2S.
The AT32UC3A3/A4 includes a powerfull External Bus Interface to interface all standard mem-
ory device like SRAM, SDRAM, NAND Flash or parallel interfaces like LCD Module.
The peripheral set includes a High Speed MCI for SDIO/SD/MMC and a hardware encryption
module based on AES algorithm.
The device embeds a 10-bit ADC and a Digital Audio bistream DAC.
The Direct Memory Access controller (DMACA) allows high bandwidth data flows between high
speed peripherals (USB, External Memories, MMC, SDIO, ...) and through high speed internal
features (AES, internal memories).
The High-Speed (480MBit/s) USB 2.0 Device and Host interface supports several USB Classes
at the same time thanks to the rich Endpoint configuration. The Embedded Host interface allows
device like a USB Flash disk or a USB printer to be directly connected to the processor. This
periphal has its own dedicated DMA and is perfect for Mass Storage application.
AT32UC3A3/A4 integrates a class 2+ Nexus 2.0 On-Chip Debug (OCD) System, with non-intru-
sive real-time trace, full-speed read/write memory access in addition to basic runtime control.
3
32072H–AVR32–10/2012
AT32UC3A3
2. Overview
TCK
TDO JTAG AVR32UC LOCAL BUS FAST GPIO
MEMORY INTERFACE
INTERFACE
TDI INTERFACE
TMS
NEXUS
CPU
MCKO CLASS 2+
MDO[5..0] MEMORY PROTECTION UNIT
OCD 64 KB
MSEO[1..0]
EVTI_N INSTR DATA SRAM
EVTO_N INTERFACE INTERFACE
USB_VBIAS
USB_VBUS
DMFS, DMHS USB HS PBB
DPFS, DPHS INTERFACE
CONTROLLER
ID
VBOF 256/128/64
FLASH
S M M M S
DMA KB
M S FLASH
HRAM0/1
32KB RAM S
32KB RAM S
HIGH SPEED DATA[15..0]
NWE0
NWE1
DMA
AES S S S M NWE3
RAS
CAS
CONFIGURATION REGISTERS BUS
SDA10
SDCK
PB HSB HSB
PERIPHERAL SDCKE
HSB-PB HSB-PB
DMA
BRIDGE B BRIDGE A SDWE
CONTROLLER
PB CFCE1
CFCE2
CFRW
PBA
NANDOE
CLK MULTIMEDIA CARD NANDWE
DMA
USART2 CLK
RTS, CTS
EXTINT[7..0] EXTERNAL
SCAN[7..0] INTERRUPT RXD
NMI CONTROLLER
DMA
USART3 TXD
CLK
REAL TIME
COUNTER SPCK
SERIAL
DMA
MISO, MOSI
PERIPHERAL
VDDIN NPCS0
1V8
INTERFACE 0/1 NPCS[3..1]
GNDCORE Regulator WATCHDOG
VDDCORE TIMER TX_CLOCK, TX_FRAME_SYNC
SYNCHRONOUS
DMA
TX_DATA
SERIAL
RX_CLOCK, RX_FRAME_SYNC
115 kHz CONTROLLER
POWER RX_DATA
RCSYS
MANAGER
TWCK
XIN32 32 KHz TWO-WIRE
DMA
XIN1 DIGITAL
OSC1
XOUT1 CONVERTER
SLEEP
PLL0 CONTROLLER
PLL1 AUDIO DATA[1..0]
DMA
A[2..0]
TIMER/COUNTER
B[2..0]
CLK[2..0] 0/1
4
32072H–AVR32–10/2012
AT32UC3A3
Flash 256/128/64 KB
SRAM 64 KB
HSB RAM 64 KB
EBI Full Nand flash only
GPIO 110 70
External Interrupts 8
TWI 2
USART 4
Peripheral DMA Channels 8
Generic DMA Channels 4
SPI 2
1 MMC/SD slot
MCI slots 2 MMC/SD slots
+ 1 SD slot
High Speed USB 1
AES (S option) 1
SSC 1
Audio Bitstream DAC 1
Timer/Counter Channels 6
Watchdog Timer 1
Real-Time Clock Timer 1
Power Manager 1
PLL 80-240 MHz (PLL0/PLL1)
Crystal Oscillators 0.4-20 MHz (OSC0/OSC1)
Oscillators
Crystal Oscillator 32 KHz (OSC32K)
RC Oscillator 115 kHz (RCSYS)
10-bit ADC 1
number of channels 8
JTAG 1
Max Frequency 84 MHz
Package LQFP144, TFBGA144 VFBGA100
5
32072H–AVR32–10/2012
AT32UC3A3
3.1 Package
The device pins are multiplexed with peripheral functions as described in the Peripheral Multi-
plexing on I/O Line section.
1 2 3 4 5 6 7 8 9 10 11 12
A
PX40 PB00 PA28 PA27 PB03 PA29 PC02 PC04 PC05 DPHS DMHS USB_VBUS
B
PX10 PB11 PA31 PB02 VDDIO PB04 PC03 VDDIO USB_VBIAS DMFS GNDPLL PA09
C
PX09 PX35 GNDIO PB01 PX16 PX13 PA30 PB08 DPFS GNDCORE PA08 PA10
D
PX08 PX37 PX36 PX47 PX19 PX12 PB10 PA02 PA26 PA11 PB07 PB06
E
PX38 VDDIO PX54 PX53 VDDIO PX15 PB09 VDDIN PA25 PA07 VDDCORE PA12
F
PX39 PX07 PX06 PX49 PX48 GNDIO GNDIO PA06 PA04 PA05 PA13 PA16
G
PX00 PX05 PX59 PX50 PX51 GNDIO GNDIO PA23 PA24 PA03 PA00 PA01
H
PX01 VDDIO PX58 PX57 VDDIO PC01 PA17 VDDIO PA21 PA22 VDDANA PB05
J
PX04 PX02 PX34 PX56 PX55 PA14 PA15 PA19 PA20 TMS TDO RESET_N
K
PX03 PX44 GNDIO PX46 PC00 PX17 PX52 PA18 PX27 GNDIO PX29 TCK
L
PX11 GNDIO PX45 PX20 VDDIO PX18 PX43 VDDIN PX26 PX28 GNDANA TDI
M
PX22 PX41 PX42 PX14 PX21 PX23 PX24 PX25 PX32 PX31 PX30 PX33
6
32072H–AVR32–10/2012
AT32UC3A3
RESET_N
GNDIO
GNDIO
VDDIO
VDDIO
PC01
PC00
PA15
PA14
PX31
PX30
PX33
PX29
PX32
PX25
PX28
PX26
PX27
PX43
PX52
PX24
PX23
PX18
PX17
PX21
PX55
PX56
PX51
PX57
PX50
PX46
PX20
TDO
TMS
TCK
TDI
108
107
106
105
104
103
102
101
100
99
98
97
96
95
94
93
92
91
90
89
88
87
86
85
84
83
82
81
80
79
78
77
76
75
74
73
PA21 109 72 PX22
PA22 110 71 PX41
PA23 111 70 PX45
PA24 112 69 PX42
PA20 113 68 PX14
PA19 114 67 PX11
PA18 115 66 PX44
PA17 116 65 GNDIO
GNDANA 117 64 VDDIO
VDDANA 118 63 PX03
PA25 119 62 PX02
PA26 120 61 PX34
PB05 121 60 PX04
PA00 122 59 PX01
PA01 123 58 PX05
PA05 124 57 PX58
PA03 125 56 PX59
PA04 126 55 PX00
PA06 127 54 PX07
PA16 128 53 PX06
PA13 129 52 PX39
VDDIO 130 51 PX38
GNDIO 131 50 PX08
PA12 132 49 PX09
PA07 133 48 VDDIO
PB06 134 47 GNDIO
PB07 135 46 PX54
PA11 136 45 PX37
PA08 137 44 PX36
PA10 138 43 PX49
PA09 139 42 PX53
GNDCORE 140 41 PX48
VDDCORE 141 40 PX15
VDDIN 142 39 PX47
VDDIN 143 38 PX35
GNDPLL 144 37 PX10
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
1
2
3
4
5
6
7
8
9
USB_VBUS
VDDIO
USB_VBIAS
GNDIO
DMHS
DPHS
GNDIO
DMFS
DPFS
VDDIO
PB08
PC05
PC04
PA30
PA02
PB10
PB09
PC02
PC03
GNDIO
VDDIO
PB04
PA29
PB03
PB02
PA27
PB01
PA28
PA31
PB00
PB11
PX16
PX13
PX12
PX19
PX40
7
32072H–AVR32–10/2012
AT32UC3A3
1 2 3 4 5 6 7 8 9 10
A
PA28 PA27 PB04 PA30 PC02 PC03 PC05 DPHS DMHS USB_VBUS
B
PB00 PB01 PB02 PA29 VDDIO VDDIO PC04 DPFS DMFS GNDPLL
C
PB11 PA31 GNDIO PB03 PB09 PB08 USB_VBIAS GNDIO PA11 PA10
D PX16/
PX12 PX10 PX13 PX53(1)
PB10 PB07 PB06 PA09 VDDIN VDDIN
E PA02/ PA06/
PX47(1)
GNDIO PX08 PX09 VDDIO GNDIO PA16 PA13(1)
PA04 VDDCORE
F PX19/ PA26/
VDDIO PX06 PX07 GNDIO VDDIO PA08 PA03 GNDCORE
PX59(1) PB05(1)
J PA15/ PA24/
PX03 PX24 PX26 PX29 VDDIO VDDANA
PX45(1)
TDO RESET_N
PX17(1)
Note: 1. Those balls are physically connected to 2 GPIOs. Software must managed carrefully the GPIO
configuration to avoid electrical conflict
8
32072H–AVR32–10/2012
AT32UC3A3
Each GPIO line can be assigned to one of the peripheral functions. The following table
describes the peripheral signals multiplexed to the GPIO lines.
Note that GPIO 44 is physically implemented in silicon but it must be kept unused and config-
ured in input mode.
G10 125 F9 PA03 3 VDDIO x1 USART0 - RXD EIC - EXTINT[4] ABDAC - DATA[0]
E10 133 H10(1) PA07 7 VDDIO x1 SPI0 - NPCS[3] ABDAC - DATAN[0] USART1 - CLK
C12 138 C10 PA10 10 VDDIO x2 SPI0 - MOSI USB - VBOF TC1 - B0
J7 101 J7(1) PA15 15 VDDIO x1 MCI - CMD[1] SPI1 - SPCK TWIMS1 - TWD
F12 128 E7 PA16 16 VDDIO x1 MCI - DATA[11] SPI1 - MOSI TC1 - CLK2
(1)
H7 116 G10 PA17 17 VDDANA x1 MCI - DATA[10] SPI1 - NPCS[1] ADC - AD[7]
(1)
K8 115 G8 PA18 18 VDDANA x1 MCI - DATA[9] SPI1 - NPCS[2] ADC - AD[6]
J8 114 H10(1) PA19 19 VDDANA x1 MCI - DATA[8] SPI1 - MISO ADC - AD[5]
J9 113 H9(1) PA20 20 VDDANA x1 EIC - NMI SSC - RX_FRAME_SYNC ADC - AD[4]
(1)
H9 109 K10 PA21 21 VDDANA x1 ADC - AD[0] EIC - EXTINT[0] USB - ID
(1)
H10 110 H6 PA22 22 VDDANA x1 ADC - AD[1] EIC - EXTINT[1] USB - VBOF
G8 111 G6(1) PA23 23 VDDANA x1 ADC - AD[2] EIC - EXTINT[2] ABDAC - DATA[1]
G9 112 J10(1) PA24 24 VDDANA x1 ADC - AD[3] EIC - EXTINT[3] ABDAC - DATAN[1]
(1)
E9 119 G7 PA25 25 VDDIO x1 TWIMS0 - TWD TWIMS1 - TWALM USART1 - DCD
(1)
D9 120 F7 ) PA26 26 VDDIO x1 TWIMS0 - TWCK USART2 - CTS USART1 - DSR
A4 26 A2 PA27 27 VDDIO x2 MCI - CLK SSC - RX_DATA USART3 - RTS MSI - SCLK
A6 23 B4 PA29 29 VDDIO x1 MCI - DATA[0] USART3 - TXD TC0 - CLK0 MSI - DATA[0]
9
32072H–AVR32–10/2012
AT32UC3A3
B3 29 C2 PA31 31 VDDIO x1 MCI - DATA[2] USART2 - RXD DMACA - DMARQ[0] MSI - DATA[2]
A2 30 B1 PB00 32 VDDIO x1 MCI - DATA[3] USART2 - TXD ADC - TRIGGER MSI - DATA[3]
C4 27 B2 PB01 33 VDDIO x1 MCI - DATA[4] ABDAC - DATA[1] EIC - SCAN[0] MSI - INS
D11 135 D6 PB07 39 VDDIO x3 SPI1 - SPCK SSC - TX_CLOCK EIC - SCAN[6]
H6 99 K6 PC01 46 VDDIO x1
A7 18 A5 PC02 47 VDDIO x1
B7 19 A6 PC03 48 VDDIO x1
A8 13 B7 PC04 49 VDDIO x1
A9 12 A7 PC05 50 VDDIO x1
10
32072H–AVR32–10/2012
AT32UC3A3
11
32072H–AVR32–10/2012
AT32UC3A3
Note: 1. Those balls are physically connected to 2 GPIOs. Software must managed carrefully the GPIO
configuration to avoid electrical conflict.
2. Refer to ”Electrical Characteristics” on page 960 for a description of the electrical properties of
the pad types used..
Note: 1. This ball is physically connected to 2 GPIOs. Software must managed carrefully the GPIO con-
figuration to avoid electrical conflict
12
32072H–AVR32–10/2012
AT32UC3A3
13
32072H–AVR32–10/2012
AT32UC3A3
Power
Power
VDDCORE Voltage Regulator Output for Digital Supply 1.65 to 1.95 V
Output
XOUT0, XOUT1,
Crystal 0, 1, 32 Output Analog
XOUT32
JTAG
Power Manager - PM
14
32072H–AVR32–10/2012
AT32UC3A3
15
32072H–AVR32–10/2012
AT32UC3A3
16
32072H–AVR32–10/2012
AT32UC3A3
Analog
AD0 - AD7 Analog input pins
input
17
32072H–AVR32–10/2012
AT32UC3A3
18
32072H–AVR32–10/2012
AT32UC3A3
19
32072H–AVR32–10/2012
AT32UC3A3
3.3V VDDIN
CIN2 CIN1
1.8V
Regulator
1.8V VDDCORE
COUT2 COUT1
For decoupling recommendations for VDDIO and VDDANA please refer to the Schematic
checklist.
20
32072H–AVR32–10/2012
AT32UC3A3
4.1 Features
• 32-bit load/store AVR32A RISC architecture
– 15 general-purpose 32-bit registers
– 32-bit Stack Pointer, Program Counter and Link Register reside in register file
– Fully orthogonal instruction set
– Privileged and unprivileged modes enabling efficient and secure Operating Systems
– Innovative instruction set together with variable instruction length ensuring industry leading
code density
– DSP extention with saturating arithmetic, and a wide variety of multiply instructions
• 3-stage pipeline allows one instruction per clock cycle for most instructions
– Byte, halfword, word and double word memory access
– Multiple interrupt priority levels
• MPU allows for operating systems with memory protection
21
32072H–AVR32–10/2012
AT32UC3A3
The register file is organized as sixteen 32-bit registers and includes the Program Counter, the
Link Register, and the Stack Pointer. In addition, register R12 is designed to hold return values
from function calls and is used implicitly by some instructions.
22
32072H–AVR32–10/2012
AT32UC3A3
Reset interface
OCD interface
Interrupt controller interface
Power/
OCD
Reset
system
control
MPU
High
High CPU Local
Speed
High Speed Bus master Speed Bus
Bus
Bus slave master
23
32072H–AVR32–10/2012
AT32UC3A3
Load-store
LS
unit
24
32072H–AVR32–10/2012
AT32UC3A3
The following table shows the instructions with support for unaligned addresses. All other
instructions require aligned addresses.
25
32072H–AVR32–10/2012
AT32UC3A3
Bit 31 Bit 0 Bit 31 Bit 0 Bit 31 Bit 0 Bit 31 Bit 0 Bit 31 Bit 0 Bit 31 Bit 0 Bit 31 Bit 0 Bit 31 Bit 0 Bit 31 Bit 0
PC PC PC PC PC PC PC PC PC
LR LR LR LR LR LR LR LR LR
SP_APP SP_SYS SP_SYS SP_SYS SP_SYS SP_SYS SP_SYS SP_SYS SP_SEC
R12 R12 R12 R12 R12 R12 R12 R12 R12
R11 R11 R11 R11 R11 R11 R11 R11 R11
R10 R10 R10 R10 R10 R10 R10 R10 R10
R9 R9 R9 R9 R9 R9 R9 R9 R9
R8 R8 R8 R8 R8 R8 R8 R8 R8
INT0PC
R7 INT0PC
R7 INT0PC
R7 INT0PC
R7 INT0PC
R7 INT0PC
R7 INT0PC
R7 INT0PC
R7 INT0PC
R7
INT1PC
R6 INT1PC
R6 INT1PC
R6 INT1PC
R6 INT1PC
R6 INT1PC
R6 INT1PC
R6 INT1PC
R6 INT1PC
R6
FINTPC
R5 FINTPC
R5 FINTPC
R5 FINTPC
R5 FINTPC
R5 FINTPC
R5 FINTPC
R5 FINTPC
R5 FINTPC
R5
SMPC
R4 SMPC
R4 SMPC
R4 SMPC
R4 SMPC
R4 SMPC
R4 SMPC
R4 SMPC
R4 SMPC
R4
R3 R3 R3 R3 R3 R3 R3 R3 R3
R2 R2 R2 R2 R2 R2 R2 R2 R2
R1 R1 R1 R1 R1 R1 R1 R1 R1
R0 R0 R0 R0 R0 R0 R0 R0 R0
SR SR SR SR SR SR SR SR SR
SS_STATUS
SS_ADRF
SS_ADRR
SS_ADR0
SS_ADR1
SS_SP_SYS
SS_SP_APP
SS_RAR
SS_RSR
26
32072H–AVR32–10/2012
AT32UC3A3
- T - - - - - - - - L Q V N Z C Bit name
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Initial value
Carry
Zero
Sign
Overflow
Saturation
Lock
Reserved
Scratch
Reserved
Table 4-2. Overview of Execution Modes, their Priorities and Privilege Levels.
Priority Mode Security Description
1 Non Maskable Interrupt Privileged Non Maskable high priority interrupt mode
2 Exception Privileged Execute exceptions
3 Interrupt 3 Privileged General purpose interrupt mode
4 Interrupt 2 Privileged General purpose interrupt mode
5 Interrupt 1 Privileged General purpose interrupt mode
6 Interrupt 0 Privileged General purpose interrupt mode
N/A Supervisor Privileged Runs supervisor calls
N/A Application Unprivileged Normal program execution mode
Mode changes can be made under software control, or can be caused by external interrupts or
exception processing. A mode can be interrupted by a higher priority mode, but never by one
with lower priority. Nested exceptions can be supported with a minimal software overhead.
When running an operating system on the AVR32, user processes will typically execute in the
application mode. The programs executed in this mode are restricted from executing certain
instructions. Furthermore, most system registers together with the upper halfword of the status
register cannot be accessed. Protected memory areas are also not available. All other operating
modes are privileged and are collectively called System Modes. They have full access to all priv-
ileged and unprivileged resources. After a reset, the processor will be in supervisor mode.
27
32072H–AVR32–10/2012
AT32UC3A3
All interrupt levels are by default disabled when debug state is entered, but they can individually
be switched on by the monitor routine by clearing the respective mask bit in the status register.
Debug state can be entered as described in the AVR32UC Technical Reference Manual.
Debug state is exited by the retd instruction.
28
32072H–AVR32–10/2012
AT32UC3A3
29
32072H–AVR32–10/2012
AT32UC3A3
30
32072H–AVR32–10/2012
AT32UC3A3
The user must also make sure that the system stack is large enough so that any event is able to
push the required registers to stack. If the system stack is full, and an event occurs, the system
will enter an UNDEFINED state.
31
32072H–AVR32–10/2012
AT32UC3A3
status register. Upon entry into Debug mode, hardware sets the SR[D] bit and jumps to the
Debug Exception handler. By default, Debug mode executes in the exception context, but with
dedicated Return Address Register and Return Status Register. These dedicated registers
remove the need for storing this data to the system stack, thereby improving debuggability. The
mode bits in the status register can freely be manipulated in Debug mode, to observe registers
in all contexts, while retaining full privileges.
Debug mode is exited by executing the retd instruction. This returns to the previous context.
32
32072H–AVR32–10/2012
AT32UC3A3
33
32072H–AVR32–10/2012
AT32UC3A3
34
32072H–AVR32–10/2012
AT32UC3A3
5. Memories
35
32072H–AVR32–10/2012
AT32UC3A3
0xFFFD0000
AES Advanced Encryption Standard - AES
0xFFFE0000
USB USB 2.0 Device and Host Interface - USB
0xFFFE1000
HMATRIX HSB Matrix - HMATRIX
0xFFFE1400
FLASHC Flash Controller - FLASHC
0xFFFE1C00
SMC Static Memory Controller - SMC
0xFFFE2000
SDRAMC SDRAM Controller - SDRAMC
0xFFFE2800
BUSMON Bus Monitor module - BUSMON
0xFFFE4000
MCI Mulitmedia Card Interface - MCI
0xFFFE8000
MSI Memory Stick Interface - MSI
0xFFFF0000
PDCA Peripheral DMA Controller - PDCA
0xFFFF0800
INTC Interrupt controller - INTC
36
32072H–AVR32–10/2012
AT32UC3A3
0xFFFF0D00
RTC Real Time Counter - RTC
0xFFFF0D30
WDT Watchdog Timer - WDT
0xFFFF0D80
EIC External Interrupt Controller - EIC
0xFFFF1000
GPIO General Purpose Input/Output Controller - GPIO
0xFFFF2400
SPI0 Serial Peripheral Interface - SPI0
0xFFFF2800
SPI1 Serial Peripheral Interface - SPI1
0xFFFF2C00
TWIM0 Two-wire Master Interface - TWIM0
0xFFFF3000
TWIM1 Two-wire Master Interface - TWIM1
0xFFFF3400
SSC Synchronous Serial Controller - SSC
0xFFFF3800
TC0 Timer/Counter - TC0
0xFFFF3C00
ADC Analog to Digital Converter - ADC
0xFFFF4000
ABDAC Audio Bitstream DAC - ABDAC
0xFFFF4400
TC1 Timer/Counter - TC1
37
32072H–AVR32–10/2012
AT32UC3A3
0xFFFF5400
TWIS1 Two-wire Slave Interface - TWIS1
38
32072H–AVR32–10/2012
AT32UC3A3
39
32072H–AVR32–10/2012
AT32UC3A3
6. Boot Sequence
This chapter summarizes the boot sequence of the AT32UC3A3/A4. The behavior after power-
up is controlled by the Power Manager. For specific details, refer to Section 7. ”Power Manager
(PM)” on page 41.
40
32072H–AVR32–10/2012
AT32UC3A3
7.1 Features
• Controls integrated oscillators and PLLs
• Generates clocks and resets for digital logic
• Supports 2 crystal oscillators 0.4-20MHz
• Supports 2 PLLs 40-240MHz
• Supports 32KHz ultra-low power oscillator
• Integrated low-power RC oscillator
• On-the fly frequency change of CPU, HSB, PBA, and PBB clocks
• Sleep modes allow simple disabling of logic clocks, PLLs, and oscillators
• Module-level clock gating through maskable peripheral clocks
• Wake-up from internal or external interrupts
• Generic clocks with wide frequency range provided
• Automatic identification of reset sources
• Controls brownout detector (BOD and BOD33), RC oscillator, and bandgap voltage reference
through control and calibration registers
7.2 Overview
The Power Manager (PM) controls the oscillators and PLLs, and generates the clocks and
resets in the device. The PM controls two fast crystal oscillators, as well as two PLLs, which can
multiply the clock from either oscillator to provide higher frequencies. Additionally, a low-power
32KHz oscillator is used to generate the real-time counter clock for high accuracy real-time mea-
surements. The PM also contains a low-power RC oscillator with fast start-up time, which can be
used to clock the digital logic.
The provided clocks are divided into synchronous and generic clocks. The synchronous clocks
are used to clock the main digital logic in the device, namely the CPU, and the modules and
peripherals connected to the HSB, PBA, and PBB buses. The generic clocks are asynchronous
clocks, which can be tuned precisely within a wide frequency range, which makes them suitable
for peripherals that require specific frequencies, such as timers and communication modules.
The PM also contains advanced power-saving features, allowing the user to optimize the power
consumption for an application. The synchronous clocks are divided into three clock domains,
one for the CPU and HSB, one for modules on the PBA bus, and one for modules on the PBB
bus.The three clocks can run at different speeds, so the user can save power by running periph-
erals at a relatively low clock, while maintaining a high CPU performance. Additionally, the
clocks can be independently changed on-the-fly, without halting any peripherals. This enables
the user to adjust the speed of the CPU and memories to the dynamic load of the application,
without disturbing or re-configuring active peripherals.
Each module also has a separate clock, enabling the user to switch off the clock for inactive
modules, to save further power. Additionally, clocks and oscillators can be automatically
switched off during idle periods by using the sleep instruction on the CPU. The system will return
to normal on occurrence of interrupts.
The Power Manager also contains a Reset Controller, which collects all possible reset sources,
generates hard and soft resets, and allows the reset source to be identified by software.
41
32072H–AVR32–10/2012
AT32UC3A3
Synchronous
RCSYS Synchronous clocks
Clock Generator CPU, HSB,
PBA, PBB
O scillator 0
PLL0
O scillator 1 PLL1
G eneric Clock
Generic clocks
G enerator
32 KHz
CLK_32
O scillator
OSC /PLL
Control signals RC
O scillator
Slow clock
Voltage Regulator
Sleep
Interrupts Sleep Controller instruction
Calibration
fuses
Registers
Brown-O ut
Reset Controller resets
Detector
Power-O n
Detector
Other reset
sources
42
32072H–AVR32–10/2012
AT32UC3A3
7.4.2 Interrupt
The PM interrupt line is connected to one of the internal sources of the interrupt controller. Using
the PM interrupt requires the interrupt controller to be programmed first.
43
32072H–AVR32–10/2012
AT32UC3A3
C2
XO UT
XIN
C1
44
32072H–AVR32–10/2012
AT32UC3A3
PLLMUL
Output
Mask PLL clock
Divider
Osc0 clock 0
Input Fin PLL LOCK
1
Divider
Osc1 clock
PLLEN
PLLOSC PLLOPT
PLLDIV
PLLn is enabled by writing the PLLEN bit in the PLLn register. PLLOSC selects Oscillator 0 or 1
as clock source. The PLLMUL and PLLDIV bitfields must be written with the multiplication and
division factors, respectively, creating the voltage controlled ocillator frequency fVCO and the PLL
frequency fPLL :
if PLLDIV > 0
fIN = fOSC/2 • PLLDIV
fVCO = (PLLMUL+1)/(PLLDIV) • fOSC
if PLLDIV = 0
fIN = fOSC
fVCO = 2 • (PLLMUL+1) • fOSC
Note: Refer to Electrical Characteristics section for FIN and FVCO frequency range.
45
32072H–AVR32–10/2012
AT32UC3A3
The PLLn:PLLOPT field should be set to proper values according to the PLL operating fre-
quency. The PLLOPT field can also be set to divide the output frequency of the PLLs by 2.
The lock signal for each PLL is available as a LOCKn flag in POSCSR. An interrupt can be gen-
erated on a 0 to 1 transition of these bits.
Sleep Sleep
instruction Controller
0
Main clock Mask CPU clocks
Slow clock
1
Osc0 clock HSB clocks
PLL0 clock
Prescaler
PBAclocks
CPUMASK
CPUDIV
PBB clocks
MCSEL CPUSEL
46
32072H–AVR32–10/2012
AT32UC3A3
( CPUSEL + 1 )
f CPU = f main ⁄ 2
Similarly, the clock for the PBA, and PBB can be divided by writing their respective fields. To
ensure correct operation, frequencies must be selected so that fCPU ≥ fPBA,B. Also, frequencies
must never exceed the specified maximum frequency for each clock domain.
CKSEL can be written without halting or disabling peripheral modules. Writing CKSEL allows a
new clock setting to be written to all synchronous clocks at the same time. It is possible to keep
one or more clocks unchanged by writing the same value a before to the xxxDIV and xxxSEL
fields. This way, it is possible to e.g. scale CPU and HSB speed according to the required perfor-
mance, while keeping the PBA and PBB frequency constant.
For modules connected to the HSB bus, the PB clock frequency must be set to the same fre-
quency than the CPU clock.
47
32072H–AVR32–10/2012
AT32UC3A3
48
32072H–AVR32–10/2012
AT32UC3A3
The power level of the internal voltage regulator is also adjusted according to the sleep mode to
reduce the internal regulator power consumption.
The USB can be used to wake up the part from sleep modes through register AWEN of the
Power Manager.
49
32072H–AVR32–10/2012
AT32UC3A3
Each generic clock module runs from either Oscillator 0 or 1, or PLL0 or 1. The selected source
can optionally be divided by any even integer up to 512. Each clock can be independently
enabled and disabled, and is also automatically disabled along with peripheral clocks by the
Sleep Controller.
Sleep
Controller
0
Osc0 clock 0 Mask Generic Clock
Osc1 clock
PLL0 clock
Divider 1
PLL1 clock 1
50
32072H–AVR32–10/2012
AT32UC3A3
51
32072H–AVR32–10/2012
AT32UC3A3
R C _R CAU SE
RESET_N
R eset
B ro w n o u t C o n tro lle r O C D , R T C /W D T ,
D e te c to r C lo c k G e n e ra to r
JTA G
OCD
WDT
In addition to the listed reset types, the JTAG can keep parts of the device statically reset
through the JTAG Reset Register. See JTAG documentation for details.
When a reset occurs, some parts of the chip are not necessarily reset, depending on the reset
source. Only the Power On Reset (POR) will force a reset of the whole chip.
52
32072H–AVR32–10/2012
AT32UC3A3
Table 7-4 on page 53 lists parts of the device that are reset, depending on the reset source.
The cause of the last reset can be read from the RCAUSE register. This register contains one bit
for each reset source, and can be read during the boot sequence of an application to determine
the proper action to be taken.
53
32072H–AVR32–10/2012
AT32UC3A3
54
32072H–AVR32–10/2012
AT32UC3A3
55
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
56
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
PBBDIV - - - - PBBSEL
23 22 21 20 19 18 17 16
PBADIV - - - - PBASEL
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
CPUDIV - - - - CPUSEL
57
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
MASK[31:24]
23 22 21 20 19 18 17 16
MASK[23:16]
15 14 13 12 11 10 9 8
MASK[15:8]
7 6 5 4 3 2 1 0
MASK[7:0]
58
32072H–AVR32–10/2012
AT32UC3A3
Note: 1. This bit must be set to one if the user wishes to debug the device with a JTAG debugger.
2. This bits must be set to one
59
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
PLLTEST - PLLCOUNT
23 22 21 20 19 18 17 16
- - - - PLLMUL
15 14 13 12 11 10 9 8
- - - - PLLDIV
7 6 5 4 3 2 1 0
Description
PLLOPT[0]: VCO frequency 0 80MHz<fvco<180MHz
1 160MHz<fvco<240MHz
PLLOPT[1]: Output divider 0 fPLL = fvco
1 fPLL = fvco/2
PLLOPT[2] 0 Wide Bandwidth Mode enabled
1 Wide Bandwidth Mode disabled
60
32072H–AVR32–10/2012
AT32UC3A3
61
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - STARTUP
7 6 5 4 3 2 1 0
- - - - - MODE
62
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - STARTUP
15 14 13 12 11 10 9 8
- - - - - MODE
7 6 5 4 3 2 1 0
- - - - - - - OSC32EN
63
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - BOD33DET BODDET
15 14 13 12 11 10 9 8
- - - - - - OSC32RDY OSC1RDY
7 6 5 4 3 2 1 0
Writing a one to a bit in this register will set the corresponding bit in IMR.
Writing a zero to a bit in this register has no effect.
64
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - BOD33DET BODDET
15 14 13 12 11 10 9 8
- - - - - - OSC32RDY OSC1RDY
7 6 5 4 3 2 1 0
Writing a one to a bit in this register will clear the corresponding bit in IMR.
Writing a zero to a bit in this register has no effect.
65
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - BOD33DET BODDET
15 14 13 12 11 10 9 8
- - - - - - OSC32RDY OSC1RDY
7 6 5 4 3 2 1 0
66
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - BOD33DET BODDET
15 14 13 12 11 10 9 8
- - - - - - OSC32RDY OSC1RDY
7 6 5 4 3 2 1 0
67
32072H–AVR32–10/2012
AT32UC3A3
68
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - BOD33DET BODDET
15 14 13 12 11 10 9 8
- - - - - - OSC32RDY OSC1RDY
7 6 5 4 3 2 1 0
69
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - BOD33DET BODDET
15 14 13 12 11 10 9 8
- - - - - - OSC32RDY OSC1RDY
7 6 5 4 3 2 1 0
70
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
DIV[7:0]
7 6 5 4 3 2 1 0
71
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
KEY
23 22 21 20 19 18 17 16
- - - - - - - FCD
15 14 13 12 11 10 9 8
- - - - - - CALIB
7 6 5 4 3 2 1 0
CALIB
72
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
KEY
23 22 21 20 19 18 17 16
- - - - - - - FCD
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - CALIB
73
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
KEY
23 22 21 20 19 18 17 16
- - - - - - - FCD
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - CALIB
74
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
KEY
23 22 21 20 19 18 17 16
- - - - - - - FCD
15 14 13 12 11 10 9 8
- - - - - - CTRL
7 6 5 4 3 2 1 0
- HYST LEVEL
75
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
KEY
23 22 21 20 19 18 17 16
- - - - - - - FCD
15 14 13 12 11 10 9 8
- - - - - - CTRL
7 6 5 4 3 2 1 0
- - LEVEL
76
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - BOD33 - OCDRST
7 6 5 4 3 2 1 0
77
32072H–AVR32–10/2012
AT32UC3A3
Name: AWEN
Access Type: Read/Write
Offset: 0x144
Reset Value: -
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - USB_WAKEN
78
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
GPLP
23 22 21 20 19 18 17 16
GPLP
15 14 13 12 11 10 9 8
GPLP
7 6 5 4 3 2 1 0
GPLP
These registers are general purpose 32-bit registers that are reset only by power-on-reset. Any other reset will keep the content
of these registers untouched. User software can use these register to save context variables in a very low power mode.
Two GPLP register are implemented in AT32UC3A3.
79
32072H–AVR32–10/2012
AT32UC3A3
8.1 Features
• 32-bit real-time counter with 16-bit prescaler
• Clocked from RC oscillator or 32KHz oscillator
• Long delays
– Max timeout 272years
• High resolution: Max count frequency 16KHz
• Extremely low power consumption
• Available in all sleep modes except Static
• Interrupt on wrap
8.2 Overview
The Real Time Counter (RTC) enables periodic interrupts at long intervals, or accurate mea-
surement of real-time sequences. The RTC is fed from a 16-bit prescaler, which is clocked from
the system RC oscillator or the 32KHz crystal oscillator. Any tapping of the prescaler can be
selected as clock source for the RTC, enabling both high resolution and long timeouts. The pres-
caler cannot be written directly, but can be cleared by the user.
The RTC can generate an interrupt when the counter wraps around the value stored in the top
register (TOP), producing accurate periodic interrupts.
CTRL TOP
CLK32 EN PSEL
CLK_32 1
VAL
80
32072H–AVR32–10/2012
AT32UC3A3
8.4.2 Clocks
The RTC can use the system RC oscillator as clock source. This oscillator is always enabled
whenever this module is active. Please refer to the Electrical Characteristics chapter for the
characteristic frequency of this oscillator (fRC).
The RTC can also use the 32 KHz crystal oscillator as clock source. This oscillator must be
enabled before use. Please refer to the Power Manager chapter for details.
The clock for the RTC bus interface (CLK_RTC) is generated by the Power Manager. This clock
is enabled at reset, and can be disabled in the Power Manager. It is recommended to disable the
RTC before disabling the clock, to avoid freezing the RTC in an undefined state.
8.4.3 Interrupts
The RTC interrupt request line is connected to the interrupt controller. Using the RTC interrupt
requires the interrupt controller to be programmed first.
( PSEL + 1 )
f RTC = f INPUT ⁄ 2
81
32072H–AVR32–10/2012
AT32UC3A3
The RTC count value can be read from or written to the Value register (VAL). Due to synchroni-
zation, continuous reading of the VAL register with the lowest prescaler setting will skip every
other value.
82
32072H–AVR32–10/2012
AT32UC3A3
83
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - CLKEN
15 14 13 12 11 10 9 8
- - - - PSEL
7 6 5 4 3 2 1 0
84
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
VAL[31:24]
23 22 21 20 19 18 17 16
VAL[23:16]
15 14 13 12 11 10 9 8
VAL[15:8]
7 6 5 4 3 2 1 0
VAL[7:0]
85
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
VAL[31:24]
23 22 21 20 19 18 17 16
VAL[23:16]
15 14 13 12 11 10 9 8
VAL[15:8]
7 6 5 4 3 2 1 0
VAL[7:0]
86
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - TOPI
87
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - TOPI
88
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - TOPI
89
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - TOPI
90
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - TOPI
91
32072H–AVR32–10/2012
AT32UC3A3
9.1 Features
• Watchdog timer counter with 32-bit prescaler
• Clocked from the system RC oscillator (RCSYS)
9.2 Overview
The Watchdog Timer (WDT) has a prescaler generating a time-out period. This prescaler is
clocked from the RC oscillator. The watchdog timer must be periodically reset by software within
the time-out period, otherwise, the device is reset and starts executing from the boot vector. This
allows the device to recover from a condition that has caused the system to be unstable.
CLR
32-bit Watchdog
RCSYS Watchdog Reset
Prescaler Detector
EN CTRL
9.4.2 Clocks
The WDT can use the system RC oscillator (RCSYS) as clock source. This oscillator is always
enabled whenever these modules are active. Please refer to the Electrical Characteristics chap-
ter for the characteristic frequency of this oscillator (fRC).
92
32072H–AVR32–10/2012
AT32UC3A3
93
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
KEY
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - PSEL
7 6 5 4 3 2 1 0
- - - - - - - EN
94
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
CLR[31:24]
23 22 21 20 19 18 17 16
CLR[23:16]
15 14 13 12 11 10 9 8
CLR[15:8]
7 6 5 4 3 2 1 0
CLR[7:0]
• CLR:
Writing periodically any value to this field when the WDT is enabled, within the watchdog time-out period, will prevent a
watchdog reset.
This field always reads as zero.
95
32072H–AVR32–10/2012
AT32UC3A3
10.1 Features
• Autovectored low latency interrupt service with programmable priority
– 4 priority levels for regular, maskable interrupts
– One Non-Maskable Interrupt
• Up to 64 groups of interrupts with up to 32 interrupt requests in each group
10.2 Overview
The INTC collects interrupt requests from the peripherals, prioritizes them, and delivers an inter-
rupt request and an autovector to the CPU. The AVR32 architecture supports 4 priority levels for
regular, maskable interrupts, and a Non-Maskable Interrupt (NMI).
The INTC supports up to 64 groups of interrupts. Each group can have up to 32 interrupt request
lines, these lines are connected to the peripherals. Each group has an Interrupt Priority Register
(IPR) and an Interrupt Request Register (IRR). The IPRs are used to assign a priority level and
an autovector to each group, and the IRRs are used to identify the active interrupt request within
each group. If a group has only one interrupt request line, an active interrupt group uniquely
identifies the active interrupt request line, and the corresponding IRR is not needed. The INTC
also provides one Interrupt Cause Register (ICR) per priority level. These registers identify the
group that has a pending interrupt of the corresponding priority level. If several groups have a
pending interrupt of the same level, the group with the lowest number takes priority.
96
32072H–AVR32–10/2012
AT32UC3A3
Masks SREG
Masks
I[3-0]M
GrpReqN ValReqN GM
OR
. IPRn INT_level,
offset
. . .
IRRn INTLEVEL
. Request . .
Prioritizer
IREQ63 .
Masking ValReq1 .
GrpReq1
IREQ34 OR
IREQ33 INT_level,
IREQ32 IPR1 AUTOVECTOR
offset
IRR1
IREQ31 ValReq0
GrpReq0
IREQ2 OR
IREQ1 INT_level,
IREQ0 IPR0 offset
IRR0
10.4.2 Clocks
The clock for the INTC bus interface (CLK_INTC) is generated by the Power Manager. This
clock is enabled at reset, and can be disabled in the Power Manager.
The INTC sampling logic runs on a clock which is stopped in any of the sleep modes where the
system RC oscillator is not running. This clock is referred to as CLK_SYNC. This clock is
enabled at reset, and only turned off in sleep modes where the system RC oscillator is stopped.
97
32072H–AVR32–10/2012
AT32UC3A3
Interrupt Priority Register (IPR). The GrpReq inputs are then masked by the mask bits from the
CPU status register. Any interrupt group that has a pending interrupt of a priority level that is not
masked by the CPU status register, gets its corresponding ValReq line asserted.
Masking of the interrupt requests is done based on five interrupt mask bits of the CPU status
register, namely Interrupt Level 3 Mask (I3M) to Interrupt Level 0 Mask (I0M), and Global Inter-
rupt Mask (GM). An interrupt request is masked if either the GM or the corresponding interrupt
level mask bit is set.
The Prioritizer hardware uses the ValReq lines and the INTLEVEL field in the IPRs to select the
pending interrupt of the highest priority. If an NMI interrupt request is pending, it automatically
gets the highest priority of any pending interrupt. If several interrupt groups of the highest pend-
ing interrupt level have pending interrupts, the interrupt group with the lowest number is
selected.
The INTLEVEL and handler autovector offset (AUTOVECTOR) of the selected interrupt are
transmitted to the CPU for interrupt handling and context switching. The CPU does not need to
know which interrupt is requesting handling, but only the level and the offset of the handler
address. The IRR registers contain the interrupt request lines of the groups and can be read via
user interface registers for checking which interrupts of the group are actually active.
The delay through the INTC from the peripheral interrupt request is set until the interrupt request
to the CPU is set is three cycles of CLK_SYNC.
98
32072H–AVR32–10/2012
AT32UC3A3
pipeline stall, which prevents the interrupt from accidentally re-triggering in case the handler is
exited and the interrupt mask is cleared before the interrupt request is cleared.
99
32072H–AVR32–10/2012
AT32UC3A3
100
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
INTLEVEL - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - AUTOVECTOR[13:8]
7 6 5 4 3 2 1 0
AUTOVECTOR[7:0]
101
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
102
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - CAUSE
103
32072H–AVR32–10/2012
AT32UC3A3
104
32072H–AVR32–10/2012
AT32UC3A3
105
32072H–AVR32–10/2012
AT32UC3A3
106
32072H–AVR32–10/2012
AT32UC3A3
11.1 Features
• Dedicated interrupt request for each interrupt
• Individually maskable interrupts
• Interrupt on rising or falling edge
• Interrupt on high or low level
• Asynchronous interrupts for sleep modes without clock
• Filtering of interrupt lines
• Maskable NMI interrupt
• Keypad scan support
11.2 Overview
The External Interrupt Controller (EIC) allows pins to be configured as external interrupts. Each
external interrupt has its own interrupt request and can be individually masked. Each external
interrupt can generate an interrupt on rising or falling edge, or high or low level. Every interrupt
input has a configurable filter to remove spikes from the interrupt source. Every interrupt pin can
also be configured to be asynchronous in order to wake up the part from sleep modes where the
CLK_SYNC clock has been disabled.
A Non-Maskable Interrupt (NMI) is also supported. This has the same properties as the other
external interrupts, but is connected to the NMI request of the CPU, enabling it to interrupt any
other interrupt mode.
The EIC can wake up the part from sleep modes without triggering an interrupt. In this mode,
code execution starts from the instruction following the sleep instruction.
The External Interrupt Controller has support for keypad scanning for keypads laid out in rows
and columns. Columns are driven by a separate set of scanning outputs, while rows are sensed
by the external interrupt lines. The pressed key will trigger an interrupt, which can be identified
through the user registers of the module.
107
32072H–AVR32–10/2012
AT32UC3A3
LEVEL
MODE ASYNC
EDGE
EN P o la r it y A s y n c h ro n u s IC R IE R
D IS c o n tro l d e te c to r CTRL ID R
E n a b le LEVEL IN T n M ask IR Q n
F IL T E R MODE
EDGE
E X T IN T n
NMI IS R IM R
CTRL E d g e /L e v e l
F ilt e r
D e te c to r
W ake
E IC _ W A K E
CLK_SYN C d e te c t
CLK_RC SYS
P r e s c a le r S h if t e r SCANm
PRESC EN P IN
SCAN
108
32072H–AVR32–10/2012
AT32UC3A3
11.5.3 Clocks
The clock for the EIC bus interface (CLK_EIC) is generated by the Power Manager. This clock is
enabled at reset, and can be disabled in the Power Manager.
The filter and synchronous edge/level detector runs on a clock which is stopped in any of the
sleep modes where the system RC oscillator is not running. This clock is referred to as
CLK_SYNC. Refer to the Module Configuration section at the end of this chapter for details.
The Keypad scan function operates on the system RC oscillator clock CLK_RCSYS.
11.5.4 Interrupts
The external interrupt request lines are connected to the interrupt controller. Using the external
interrupts requires the interrupt controller to be programmed first.
Using the Non-Maskable Interrupt does not require the interrupt controller to be programmed.
11.5.5 Debug Operation
The EIC is frozen during debug operation, unless the OCD system keeps peripherals running
during debug operation.
109
32072H–AVR32–10/2012
AT32UC3A3
gate to the interrupt controller. However, the corresponding bit in ISR will be set, and
EIC_WAKE will be set.
If the CTRL.INTn bit is zero, then the corresponding bit in ISR will always be zero. Disabling an
external interrupt by writing to the DIS.INTn bit will clear the corresponding bit in ISR.
Figure 11-2. Timing Diagram, Synchronous Interrupts, High Level or Rising Edge
CLK_SYNC
EXTINTn/NMI
ISR.INTn:
FILTER off
ISR.INTn:
FILTER on
Figure 11-3. Timing Diagram, Synchronous Interrupts, Low Level or Falling Edge
CLK_SYNC
EXTINTn/NMI
ISR.INTn:
FILTER off
ISR.INTn:
FILTER on
110
32072H–AVR32–10/2012
AT32UC3A3
CLK_SYNC CLK_SYNC
EXTINTn/NMI EXTINTn/NMI
ISR.INTn: ISR.INTn:
rising EDGE or high rising EDGE or high
LEVEL LEVEL
EIC_WAKE: EIC_WAKE:
rising EDGE or high rising EDGE or high
LEVEL LEVEL
11.6.5 Wakeup
The external interrupts can be used to wake up the part from sleep modes. The wakeup can be
interpreted in two ways. If the corresponding bit in IMR is one, then the execution starts at the
interrupt handler for this interrupt. If the bit in IMR is zero, then the execution starts from the next
instruction after the sleep instruction.
111
32072H–AVR32–10/2012
AT32UC3A3
112
32072H–AVR32–10/2012
AT32UC3A3
113
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - NMI
7 6 5 4 3 2 1 0
114
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - NMI
7 6 5 4 3 2 1 0
115
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - NMI
7 6 5 4 3 2 1 0
116
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - NMI
7 6 5 4 3 2 1 0
117
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - NMI
7 6 5 4 3 2 1 0
118
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - NMI
7 6 5 4 3 2 1 0
119
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - NMI
7 6 5 4 3 2 1 0
120
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - NMI
7 6 5 4 3 2 1 0
121
32072H–AVR32–10/2012
AT32UC3A3
Name: FILTER
Access Type: Read/Write
Offset: 0x020
Reset Value: 0x00000000
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - NMI
7 6 5 4 3 2 1 0
122
32072H–AVR32–10/2012
AT32UC3A3
Name: TEST
Access Type: Read/Write
Offset: 0x024
Reset Value: 0x00000000
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - NMI
7 6 5 4 3 2 1 0
123
32072H–AVR32–10/2012
AT32UC3A3
Name: ASYNC
Access Type: Read/Write
Offset: 0x028
Reset Value: 0x00000000
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - NMI
7 6 5 4 3 2 1 0
124
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - PIN[2:0]
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - PRESC[4:0]
7 6 5 4 3 2 1 0
- - - - - - - EN
• EN
0: Keypad scanning is disabled
1: Keypad scanning is enabled
• PRESC
Prescale select for the keypad scan rate:
Scan rate = 2(SCAN.PRESC+1) TRC
The RC clock period can be found in the Electrical Characteristics section.
• PIN
The index of the currently active scan pin. Writing to this bitfield has no effect.
125
32072H–AVR32–10/2012
AT32UC3A3
Name: EN
Access Type: Write-only
Offset: 0x030
Reset Value: 0x00000000
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - NMI
7 6 5 4 3 2 1 0
126
32072H–AVR32–10/2012
AT32UC3A3
Name: DIS
Access Type: Write-only
Offset: 0x034
Reset Value: 0x00000000
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - NMI
7 6 5 4 3 2 1 0
127
32072H–AVR32–10/2012
AT32UC3A3
Name: CTRL
Access Type: Read-only
Offset: 0x038
Reset Value: 0x00000000
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - NMI
7 6 5 4 3 2 1 0
128
32072H–AVR32–10/2012
AT32UC3A3
129
32072H–AVR32–10/2012
AT32UC3A3
12.1 Features
• Controls flash block with dual read ports allowing staggered reads.
• Supports 0 and 1 wait state bus access.
• Allows interleaved burst reads for systems with one wait state, outputting one 32-bit word per
clock cycle.
• 32-bit HSB interface for reads from flash array and writes to page buffer.
• 32-bit PB interface for issuing commands to and configuration of the controller.
• 16 lock bits, each protecting a region consisting of (total number of pages in the flash block / 16)
pages.
• Regions can be individually protected or unprotected.
• Additional protection of the Boot Loader pages.
• Supports reads and writes of general-purpose NVM bits.
• Supports reads and writes of additional NVM pages.
• Supports device protection through a security bit.
• Dedicated command for chip-erase, first erasing all on-chip volatile memories before erasing
flash and clearing security bit.
• Interface to Power Manager for power-down of flash-blocks in sleep mode.
•
12.2 Overview
The flash controller (None) interfaces a flash block with the 32-bit internal HSB bus. Perfor-
mance for uncached systems with high clock-frequency and one wait state is increased by
placing words with sequential addresses in alternating flash subblocks. Having one read inter-
face per subblock allows them to be read in parallel. While data from one flash subblock is being
output on the bus, the sequential address is being read from the other flash subblock and will be
ready in the next clock cycle.
The controller also manages the programming, erasing, locking and unlocking sequences with
dedicated commands.
130
32072H–AVR32–10/2012
AT32UC3A3
131
32072H–AVR32–10/2012
AT32UC3A3
The flash controller supports flash blocks with up to 2^21 word addresses, as displayed in Figure
12-1. Reading the memory space between address pw and 2^21-1 returns an undefined result.
The User page is permanently mapped to word address 2^21.
2^21+128 U nused
2^21 U ser page
Unused
pw
p w -1
Flash data array
0
F la s h w it h
e x tra p a g e
Figure 12-2.
132
32072H–AVR32–10/2012
AT32UC3A3
Frequency
1 wait state
0 wait state
Frequency limit
for 0 wait state
operation
N Speed mode
H
or
ig
m
h
al
133
32072H–AVR32–10/2012
AT32UC3A3
The page buffer is not automatically reset after a page write. The programmer should do this
manually by issuing the Clear Page Buffer flash command. This can be done after a page write,
or before the page buffer is loaded with data to be stored to the flash page.
Example: Writing a word into word address 130 of a flash with 128 words in the page buffer.
PAGEN will be updated with the value 1, and the word will be written into word 2 in the page
buffer.
134
32072H–AVR32–10/2012
AT32UC3A3
If the current command writes or erases a page in a locked region, or a page protected by the
BOOTPROT fuses, the command has no effect on the flash memory; however, the LOCKE flag
is set in the FSR register. This flag is automatically cleared by a read access to the FSR register.
135
32072H–AVR32–10/2012
AT32UC3A3
set and the command is cancelled. If the bit LOCKE has been written to 1 in FCR, the interrupt
line rises.
When the command is complete, the bit FRDY bit in the Flash Status Register (FSR) is set. If an
interrupt has been enabled by setting the bit FRDY in FCR, the interrupt line of the flash control-
ler is set. Two errors can be detected in the FSR register after issuing the command:
• Programming Error: A bad keyword and/or an invalid command have been written in the
FCMD register.
• Lock Error: At least one lock region to be erased is protected, or BOOTPROT is different from
0. The erase command has been refused and no page has been erased. A Clear Lock Bit
command must be executed previously to unlock the corresponding lock regions.
136
32072H–AVR32–10/2012
AT32UC3A3
through a dedicated Peripheral Bus address. Some of the general-purpose fuse bits are
reserved for special purposes, and should not be used for other functions.:
The BOOTPROT fuses protects the following address space for the Boot Loader:
137
32072H–AVR32–10/2012
AT32UC3A3
To erase or write a general-purpose fuse bit, the commands Write General-Purpose Fuse Bit
(WGPB) and Erase General-Purpose Fuse Bit (EGPB) are provided. Writing one of these com-
mands, together with the number of the fuse to write/erase, performs the desired operation.
An entire General-Purpose Fuse byte can be written at a time by using the Program GP Fuse
Byte (PGPFB) instruction. A PGPFB to GP fuse byte 2 is not allowed if the flash is locked by the
security bit. The PFB command is issued with a parameter in the PAGEN field:
• PAGEN[2:0] - byte to write
• PAGEN[10:3] - Fuse value to write
All General-Purpose fuses can be erased by the Erase All General-Purpose fuses (EAGP) com-
mand. An EAGP command is not allowed if the flash is locked by the security bit.
Two errors can be detected in the FSR register after issuing these commands:
• Programming Error: A bad keyword and/or an invalid command have been written in the
FCMD register.
• Lock Error: A write or erase of any of the special-function fuse bits in Table 12-3 was
attempted while the flash is locked by the security bit.
The lock bits are implemented using the lowest 16 general-purpose fuse bits. This means that
the 16 lowest general-purpose fuse bits can also be written/erased using the commands for
locking/unlocking regions, see Section 12.5.3.
138
32072H–AVR32–10/2012
AT32UC3A3
(*) The value of the Lock bits is dependent of their programmed state. All other bits in FSR are 0.
All bits in FGPFR and FCFR are dependent on the programmed state of the fuses they map to.
Any bits in these registers not mapped to a fuse read 0.
139
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- FWS - - PROGE LOCKE - FRDY
140
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
KEY
23 22 21 20 19 18 17 16
PAGEN [15:8]
15 14 13 12 11 10 9 8
PAGEN [7:0]
7 6 5 4 3 2 1 0
- - CMD
• CMD: Command
This field defines the flash command. Issuing any unused command will cause the Programming Error flag to be set, and the
corresponding interrupt to be requested if the PROGE bit in FCR is set.
141
32072H–AVR32–10/2012
AT32UC3A3
142
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
LOCK15 LOCK14 LOCK13 LOCK12 LOCK11 LOCK10 LOCK9 LOCK8
23 22 21 20 19 18 17 16
LOCK7 LOCK6 LOCK5 LOCK4 LOCK3 LOCK2 LOCK1 LOCK0
15 14 13 12 11 10 9 8
FSZ - - - -
7 6 5 4 3 2 1 0
- QPRR SECURITY PROGE LOCKE - FRDY
143
32072H–AVR32–10/2012
AT32UC3A3
144
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
GPF63 GPF62 GPF61 GPF60 GPF59 GPF58 GPF57 GPF56
23 22 21 20 19 18 17 16
GPF55 GPF54 GPF53 GPF52 GPF51 GPF50 GPF49 GPF48
15 14 13 12 11 10 9 8
GPF47 GPF46 GPF45 GPF44 GPF43 GPF42 GPF41 GPF40
7 6 5 4 3 2 1 0
GPF39 GPF38 GPF37 GPF36 GPF35 GPF34 GPF33 GPF32
145
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
GPF31 GPF30 GPF29 GPF28 GPF27 GPF26 GPF25 GPF24
23 22 21 20 19 18 17 16
GPF23 GPF22 GPF21 GPF20 GPF19 GPF18 GPF17 GPF16
15 14 13 12 11 10 9 8
GPF15 GPF14 GPF13 GPF12 GPF11 GPF10 GPF09 GPF08
7 6 5 4 3 2 1 0
GPF07 GPF06 GPF05 GPF04 GPF03 GPF02 GPF01 GPF00
146
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
GPF31 GPF30 GPF29 BODEN BODHYST BODLEVEL[5:4]
23 22 21 20 19 18 17 16
BODLEVEL[3:0] BOOTPROT EPFL
15 14 13 12 11 10 9 8
LOCK[15:8]
7 6 5 4 3 2 1 0
LOCK[7:0]
147
32072H–AVR32–10/2012
AT32UC3A3
148
32072H–AVR32–10/2012
AT32UC3A3
13.1 Features
• User Interface on peripheral bus
• Configurable Number of Masters (Up to sixteen)
• Configurable Number of Slaves (Up to sixteen)
• One Decoder for Each Master
•
• Programmable Arbitration for Each Slave
– Round-Robin
– Fixed Priority
• Programmable Default Master for Each Slave
– No Default Master
– Last Accessed Default Master
– Fixed Default Master
• One Cycle Latency for the First Access of a Burst
• Zero Cycle Latency for Default Master
• One Special Function Register for Each Slave (Not dedicated)
13.2 Overview
The Bus Matrix implements a multi-layer bus structure, that enables parallel access paths
between multiple High Speed Bus (HSB) masters and slaves in a system, thus increasing the
overall bandwidth. The Bus Matrix interconnects up to 16 HSB Masters to up to 16 HSB Slaves.
The normal latency to connect a master to a slave is one cycle except for the default master of
the accessed slave which is connected directly (zero cycle latency). The Bus Matrix provides 16
Special Function Registers (SFR) that allow the Bus Matrix to support application specific
features.
13.3.1 Clocks
The clock for the HMATRIX bus interface (CLK_HMATRIX) is generated by the Power Manager.
This clock is enabled at reset, and can be disabled in the Power Manager. It is recommended to
disable the HMATRIX before disabling the clock, to avoid freezing the HMATRIX in an undefined
state.
149
32072H–AVR32–10/2012
AT32UC3A3
At the end of the current access, if no other request is pending, the slave remains connected to
its associated default master. A slave can be associated with three kinds of default masters: no
default master, last access master and fixed default master.
13.4.2 Arbitration
The Bus Matrix provides an arbitration mechanism that reduces latency when conflict cases
occur, i.e. when two or more masters try to access the same slave at the same time. One arbiter
per HSB slave is provided, thus arbitrating each slave differently.
The Bus Matrix provides the user with the possibility of choosing between 2 arbitration types for
each slave:
1. Round-Robin Arbitration (default)
2. Fixed Priority Arbitration
This choice is made via the field ARBT of the Slave Configuration Registers (SCFG).
Each algorithm may be complemented by selecting a default master configuration for each
slave.
When a re-arbitration must be done, specific conditions apply. See Section 13.4.2.1 ”Arbitration
Rules” on page 150.
150
32072H–AVR32–10/2012
AT32UC3A3
3. End of Burst Cycles: When the current cycle is the last cycle of a burst transfer. For
defined length burst, predicted end of burst matches the size of the transfer but is man-
aged differently for undefined length burst.
4. 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.
151
32072H–AVR32–10/2012
AT32UC3A3
the current access, if no other request is pending, the slave is disconnected from all masters.
This configuration incurs one latency cycle for the first access of a burst. Arbitration without
default master can be used for masters that perform significant bursts.
152
32072H–AVR32–10/2012
AT32UC3A3
153
32072H–AVR32–10/2012
AT32UC3A3
154
32072H–AVR32–10/2012
AT32UC3A3
155
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – ULBT
156
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – ARBT
23 22 21 20 19 18 17 16
– – FIXED_DEFMSTR DEFMSTR_TYPE
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
SLOT_CYCLE
157
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – M7PR – – M6PR
23 22 21 20 19 18 17 16
– – M5PR – – M4PR
15 14 13 12 11 10 9 8
– – M3PR – – M2PR
7 6 5 4 3 2 1 0
– – M1PR – – M0PR
158
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – M15PR – – M14PR
23 22 21 20 19 18 17 16
– – M13PR – – M12PR
15 14 13 12 11 10 9 8
– – M11PR – – M10PR
7 6 5 4 3 2 1 0
– – M9PR – – M8PR
159
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
SFR
23 22 21 20 19 18 17 16
SFR
15 14 13 12 11 10 9 8
SFR
7 6 5 4 3 2 1 0
SFR
160
32072H–AVR32–10/2012
AT32UC3A3
Each slave has its own arbiter, thus allowing a different arbitration per slave. The slave number
in the table below can be used to index the HMATRIX control registers. For example, HMATRIX
SCFG4 register is associated with the Embedded CPU SRAM Slave Interface.
161
32072H–AVR32–10/2012
AT32UC3A3
HMATRIX SLAVES
Internal Flash
USB DPRAM
CPU SRAM
Embedded
HRAMC0
HRAMC1
Bridge A
Bridge B
HSB-PB
HSB-PB
DMACA
Slave
AES
EBI
0 1 2 3 4 5 6 7 8 9
CPU Data 0
CPU
1
Instruction
CPU SAB 2
HMATRIX MASTERS
PDCA 3
DMACA
4
Master 0
DMACA
5
Master 1
USBB
6
DMA
162
32072H–AVR32–10/2012
AT32UC3A3
14.1 Features
• Optimized for application memory space support
• Integrates three external memory controllers:
– Static Memory Controller (SMC)
– SDRAM Controller (SDRAMC)
– Error Corrected Code (ECCHRS) controller
• Additional logic for NAND Flash/SmartMediaTM and CompactFlashTM support
– NAND Flash support: 8-bit as well as 16-bit devices are supported
– CompactFlash support: Attribute Memory, Common Memory, I/O modes are supported but
the signal _IOIS16 (I/O mode) is not handled.
• Optimized external bus:16-bit data bus
– Up to 24-bit Address Bus, Up to 8-Mbytes Addressable
– Optimized pin multiplexing to reduce latencies on external memories
• Up to 6 Chip Selects, Configurable Assignment:
– Static Memory Controller on Chip Select 0
– SDRAM Controller or Static Memory Controller on Chip Select 1
– Static Memory Controller on Chip Select 2, Optional NAND Flash support
– Static Memory Controller on Chip Select 3, Optional NAND Flash support
– Static Memory Controller on Chip Select 4, Optional CompactFlashTM support
– Static Memory Controller on Chip Select 5, Optional CompactFlashTM support
14.2 Overview
The External Bus Interface (EBI) is designed to ensure the successful data transfer between
several external devices and the embedded memory controller of an 32-bit AVR device. The
Static Memory, SDRAM and ECCHRS Controllers are all featured external memory controllers
on the EBI. These external memory controllers are capable of handling several types of external
memory and peripheral devices, such as SRAM, PROM, EPROM, EEPROM, Flash, and
SDRAM.
The EBI also supports the CompactFlash and the NAND Flash/SmartMedia protocols via inte-
grated circuitry that greatly reduces the requirements for external components. Furthermore, the
EBI handles data transfers with up to six external devices, each assigned to six address spaces
defined by the embedded memory controller. Data transfers are performed through a 16-bit, an
address bus of up to 23 bits, up to six chip select lines (NCS[5:0]), and several control pins that
are generally multiplexed between the different external memory controllers.
163
32072H–AVR32–10/2012
AT32UC3A3
INTC
SDRAMC_irq ECCHRS_irq
HMATRIX EBI
DATA[15:0]
HSB SDRAM
Controller
NWE1
NWE0
Static NRD
Memory
Controller NCS[5:0]
ADDR[23:0]
CAS
ECCHRS
Controller I/O
RAS
MUX
Logic Controller
SDA10
NANDWE
Address Chip Select
Decoders Assignor CFRNW
CFCE1
CFCE2
HSB-PB
Bridge NWAIT
Peripheral Bus
164
32072H–AVR32–10/2012
AT32UC3A3
Alternate Active
Pin Name Name Pin Description Type Level
EBI common lines
DATA[15:0] Data Bus I/O
SMC dedicated lines
ADDR[1] SMC Address Bus Line 1 Output
ADDR[12] SMC Address Bus Line 12 Output
ADDR[15] SMC Address Bus Line 15 Output
ADDR[23:18] SMC Address Bus Line [23:18] Output
NCS[0] SMC Chip Select Line 0 Output Low
NWAIT SMC External Wait Signal Input Low
SDRAMC dedicated lines
SDCK SDRAM Clock Output
SDCKE SDRAM Clock Enable Output High
SDWE SDRAM Write Enable Output Low
SDA10 SDRAM Address Bus Line 10 Output Low
RAS - CAS Row and Column Signal Output Low
CompactFlash dedicated lines
CFCE1 -
CompactFlash Chip Enable Output Low
CFCE2
CFRNW CompactFlash Read Not Write Signal Output
NAND Flash/SmartMedia dedicated lines
NANDOE NAND Flash Output Enable Output Low
NANDWE NAND Flash Write Enable Output Low
SMC/SDRAMC shared lines
NCS[1] SMC Chip Select Line 1
NCS[1] Output Low
SDCS0 SDRAMC Chip Select Line 0
DQM0 SDRAMC DQM1
ADDR[0] Output
ADDR[0]-NBS0 SMC Address Bus Line 0 or Byte Select 1
ADDR[9:0] SDRAMC Address Bus Lines [9:0]
ADDR[11:2] Output
ADDR[11:2] SMC Address Bus Lines [11:2]
ADDR[9:0] SDRAMC Address Bus Lines [12:11]
ADDR[14:13] Output
ADDR[14:13] SMC Address Bus Lines [14:13]
BA0 SDRAMC Bank 0
ADDR[16] Output
ADDR[16] SMC Address Bus Line 16
165
32072H–AVR32–10/2012
AT32UC3A3
Alternate Active
Pin Name Name Pin Description Type Level
BA1 SDRAMC Bank 1
ADDR[17] Output
ADDR[17] SMCAddress Bus Line 17
SMC/CompactFlash shared lines
NRD SMC Read Signal
NRD Output Low
CFNOE CompactFlash CFNOE
NWE0-NWE SMC Write Enable10 or Write enable
NWE0 Output Low
CFNWE CompactFlash CFNWE
NCS[4] SMC Chip Select Line 4
NCS[4] Output Low
CFCS[0] CompactFlash Chip Select Line 0
NCS[5] SMC Chip Select Line 5
NCS[5] Output Low
CFCS[1] CompactFlash Chip Select Line 1
SMC/NAND Flash/SmartMedia shared lines
SMC Chip Select Line 2
NCS[2]
NCS[2] NANDFlash/SmartMedia Chip Select Line Output Low
NANDCS[0]
0
SMC Chip Select Line 3
NCS[3]
NCS[3] NANDFlash/SmartMedia Chip Select Line Output Low
NANDCS[1]
1
SDRAMC/SMC/CompactFlash shared lines
DQM1/ SDRAMC DQM1
NWE1 NWE1-NBS1/ SMC Write Enable1 or Byte Select 1 Output
CFNIORD CompactFlash CFNIORD
14.5.3 Clocks
A number of clocks can be selected as source for the EBI. The selected clock must be enabled
by the Power Manager.
The following clock sources are available:
• CLK_EBI
• CLK_SDRAMC
• CLK_SMC
166
32072H–AVR32–10/2012
AT32UC3A3
• CLK_ECCHRS
Refer to Table 14-2 on page 167 to configure those clocks.
14.5.4 Interrupts
The EBI interface has two interrupt lines connected to the Interrupt Controller:
• SDRAMC_IRQ: Interrupt signal coming from the SDRAMC
• ECCHRS_IRQ: Interrupt signal coming from the ECCHRS
Handling the EBI interrupt requires configuring the interrupt controller before configuring the EBI.
14.5.5 HMATRIX
The EBI interface is connected to the HMATRIX Special Function Register 6 (SFR6). The user
must first write to this HMATRIX.SFR6 to configure the EBI correctly.
167
32072H–AVR32–10/2012
AT32UC3A3
0 Reserved
168
32072H–AVR32–10/2012
AT32UC3A3
Note: The ADDR[22] I/O line is used to drive the REG signal of the CompactFlash Device.
169
32072H–AVR32–10/2012
AT32UC3A3
ured to drive 8-bit memory devices on the corresponding NCS pin (NCS[4] or NCS[5]). The Data
Bus Width (DBW) field in the SMC Mode (MODE) register of the NCS[4] and/or NCS[5] address
space must be written as shown in Table 14-5 on page 170 to enable the required access type.
NBS1 and NBS0 are the byte selection signals from SMC and are available when the SMC is set
in Byte Select mode on the corresponding Chip Select.
The CFCE1 and CFCE2 waveforms are identical to the corresponding NCSx waveform. For
details on these waveforms and timings, refer to the SMC Section.
Attribute memory mode, common memory mode and I/O mode are supported by writing the
address setup and hold time on the NCS[4] (and/or NCS[5]) chip select to the appropriate val-
ues. For details on these signal waveforms, please refer to the section: Setup and Hold Cycles
of the SMC Section.
170
32072H–AVR32–10/2012
AT32UC3A3
EBI
A23
1
1
0 CFNOE
0
CFNWE
1 1
A22
NRD
0 CFNIORD
NWR0/NWE
1 1
171
32072H–AVR32–10/2012
AT32UC3A3
DATA[15:0] D[15:0]
DIR /OE
CFRNW
NCS[4]
_CD1
Pxx
_CD2
/OE
ADDR[10:0] A[10:0]
ADDR[22] _REG
NRD _OE
NWE0 _WE
NWE1 _IORD
_IOWR
ADDR[21]
CFCE1 _CE1
CFCE2 _CE2
NWAIT _WAIT
172
32072H–AVR32–10/2012
AT32UC3A3
DATA[15:0] D[15:0]
DIR /OE
CFRNW
NCS[4]
_CD1
Pxx
_CD2
/OE
ADDR[10:0] A[10:0]
ADDR[22] _REG
NRD _OE
NWE0 _WE
NWE1 _IORD
_IOWR
ADDR[21]
CFCE1 _CE1
CFCE2 _CE2
NWAIT _WAIT
173
32072H–AVR32–10/2012
AT32UC3A3
SMC NandFlash
Logic
NANDOE
NCS[2]/[3]
NRD
NANDWE
NWR0_NWE
DATA[7:0] AD[7:0]
ADDR[22] ALE
ADDR[21] CLE
NandFlash
EBI
NANDOE NOE
NANDWE NWE
NCS[2/3]
Or I/O line CE
Note: The External Bus Interfaces is also able to support 16-bits devices.
174
32072H–AVR32–10/2012
AT32UC3A3
NRD OE OE OE
(1)
NWE0 WE WE WE
(1)
NWE1 – WE NBS1(2)
Note: 1. NWE1 enables upper byte writes. NWE0 enables lower byte writes.
2. NBS1 enables upper byte writes. NBS0 enables lower byte writes.
ADDR[1] – A[1] –
SDA10 A[10] – –
ADDR[12] – – –
ADDR[14:13] A[12:11] – –
ADDR[15] – – –
ADDR[16] BA0 – –
ADDR[17] BA1 – –
ADDR[20:18] – – –
175
32072H–AVR32–10/2012
AT32UC3A3
NCS[1] SDCS[0] – –
NCS[2] – – CE0
NCS[3] – – CE1
(1)
NCS[4] – CFCS0 –
(1)
NCS[5] – CFCS1 –
NANDOE – – OE
NANDWE – – WE
NRD – OE –
NWE0 – WE –
NWE1 DQM1 IOR –
(1)
CFRNW – CFRNW –
CFCE1 – CE1 –
CFCE2 – CE2 –
SDCK CLK – –
SDCKE CKE – –
RAS RAS – –
CAS CAS – –
SDWE WE – –
NWAIT – WAIT –
(2)
Pxx – CD1 or CD2 –
(2)
Pxx – – RDY
Note: 1. Not directly connected to the CompactFlash slot. Permits the control of the bidirectional buffer
between the EBI data bus and the CompactFlash slot.
2. Any I/O Controller line.
3. The CLE and ALE signals of the NAND Flash device may be driven by any address bit. For
details, see Section 14.6.6.
176
32072H–AVR32–10/2012
AT32UC3A3
EBI
DATA[15:0]
RAS
CAS SDRAM SDRAM
SDCK
SDCKE
DATA[7:0]
D[7:0]
2Mx8 DATA[15:8] 2Mx8
D[7:0]
SDWE
ADDR[0] CS ADDR[11:2] CS ADDR[11:2]
SDCK A[9:0] SDCK A[9:0]
NWE1 CLK SDA10 CLK SDA10
SDCKE A[10] SDCKE A[10]
NRD CKE ADDR[13] CKE ADDR[13]
SDWE A[11] SDWE A[11]
NWE0 WE ADDR[16] WE ADDR[16]
RAS BA0 ADDR[17]
RAS BA0 ADDR[17]
CAS RAS BA1 CAS RAS BA1
ADDR[0] CAS NWE1 CAS
DQM DQM
SDA10
ADDR[17:1]
NCS[1]
NCS[0]
DATA[15:8]
DATA[7:0]
SRAM SRAM
128Kx8 128Kx8
D[7:0] A[16:0] ADDR[17:1] D[7:0] A[16:0] ADDR[17:1]
NCS[0] NCS[0]
CS CS
NRD NRD
OE OE
NWE0 NWE1
WE WE
177
32072H–AVR32–10/2012
AT32UC3A3
15.1 Features
• 6 chip selects available
• 16-Mbytes address space per chip select
• 8- or 16-bit data bus
• Word, halfword, byte transfers
• Byte write or byte select lines
• Programmable setup, pulse and hold time for read signals per chip select
• Programmable setup, pulse and hold time for write signals per chip select
• Programmable data float time per chip select
• Compliant with LCD module
• External wait request
• Automatic switch to slow clock mode
• Asynchronous read in page mode supported: page size ranges from 4 to 32 bytes
15.2 Overview
The Static Memory Controller (SMC) generates the signals that control the access to the exter-
nal memory devices or peripheral devices. It has 6 chip selects and a 24-bit address bus. The
16-bit data bus can be configured to interface with 8-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
supports asynchronous burst read in page mode access for page size up to 32 bytes.
178
32072H–AVR32–10/2012
AT32UC3A3
NCS[5:0]
NCS[5:0]
SMC NRD
NRD
HMatrix Chip Select
NWR0/NWE
NWE0
A0/NBS0
ADDR[0]
NWR1/NBS1
NWE1
SMC A1/NWR2/NBS2 EBI I/O
ADDR[1]
Mux Logic Controller
Power CLK_SMC
Manager A[AD_MSB:2]
ADDR[AD_MSB:2]
D[15:0]
DATA[15:0]
NWAIT
NWAIT
User Interface
Peripheral Bus
179
32072H–AVR32–10/2012
AT32UC3A3
15.5.2 Clocks
The clock for the SMC bus interface (CLK_SMC) is generated by the Power Manager. This clock
is enabled at reset, and can be disabled in the Power Manager. It is recommended to disable the
SMC before disabling the clock, to avoid freezing the SMC in an undefined state.
D0-D15
CS CS
A0-A16 A2-A18 A0-A16 A2-A18
NRD NRD
NCS0 OE OE
NCS1 NWR0/NWE NWR1/NBS1
WE WE
NCS2
NCS3
NCS4
NCS5
Static Memory
Controller
A2-A18
180
32072H–AVR32–10/2012
AT32UC3A3
NCS[0] - NCS[5]
NRD
SMC NWE NCS5
Memory Enable
A[AD_MSB:0] NCS4
Memory Enable
D[15:0] NCS3
Memory Enable
NCS2
Memory Enable
NCS1
Memory Enable
NCS0
Memory Enable
Output Enable
Write Enable
A[AD_MSB:0]
8 or 16
D[15:0] or D[7:0]
D[7:0] D[7:0]
A[18:2] A[18:2]
A0 A0
SMC A1 A1
181
32072H–AVR32–10/2012
AT32UC3A3
D[15:0] D[15:0]
A[19:2] A[18:1]
A1 A[0]
The byte write access mode supports one byte 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.
The byte write access mode is used to connect two 8-bit devices as a 16-bit memory.
The byte write option is illustrated on Figure 15-6 on page 183.
In this mode, read/write operations can be enabled/disabled at a byte level. One byte select line
per byte of the data bus is provided. One NRD and one NWE signal control read and write.
• 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. The byte select access is used to
connect one 16-bit device.
182
32072H–AVR32–10/2012
AT32UC3A3
Figure 15-6. Connection of two 8-bit Devices on a 16-bit Bus: Byte Write Option
D[7:0] D[7:0]
D[15:8]
A[24:2] A[23:1]
SMC A1 A[0]
NWR0 Write Enable
NWR1
NRD Read Enable
NCS[3] Memory Enable
D[15:8]
A[23:1]
A[0]
Write Enable
Read Enable
Memory Enable
•Signal multiplexing
Depending on the MODE.BAT bit, only the write signals or the byte select signals are used. To
save I/Os at the external bus interface, control signals at the SMC interface are multiplexed.
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 to NBS1 are unused.
183
32072H–AVR32–10/2012
AT32UC3A3
access type. NWR0 to NWR1 have the same timings and protocol as NWE. In the same way,
NCS represents one of the NCS[0..5] chip select lines.
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
NRD
NCS
D[15:0]
NRDCYCLE
•NRD waveform
The NRD signal is characterized by a setup timing, a pulse width, and a hold timing.
1. NRDSETUP: the NRD setup time is defined as the setup of address before the NRD
falling edge.
2. NRDPULSE: the NRD pulse length is the time between NRD falling edge and NRD ris-
ing edge.
3. NRDHOLD: the NRD hold time is defined as the hold time of address after the NRD ris-
ing edge.
•NCS waveform
Similarly, the NCS signal can be divided into a setup time, pulse length and hold time.
184
32072H–AVR32–10/2012
AT32UC3A3
1. NCSRDSETUP: the NCS setup time is defined as the setup time of address before the
NCS falling edge.
2. NCSRDPULSE: the NCS pulse length is the time between NCS falling edge and NCS
rising edge.
3. NCSRDHOLD: the NCS hold time is defined as the hold time of address after the NCS
rising edge.
•Read cycle
The NRDCYCLE time is defined as the total duration of the read cycle, i.e., from the time where
address is set on the address bus to the point where address may change. The total read cycle
time is equal to:
Similarly,
All NRD and NCS timings are defined separately for each chip select as an integer number of
CLK_SMC cycles. To ensure that the NRD and NCS timings are coherent, the user must define
the total read cycle instead of the hold timing. NRDCYCLE implicitly defines the NRD hold time
and NCS hold time as:
And,
If null setup and hold parameters are programmed for NRD and/or NCS, NRD and NCS remain
active continuously in case of consecutive read cycles in the same memory (see Figure 15-8 on
page 186).
185
32072H–AVR32–10/2012
AT32UC3A3
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
NRD
NCS
D[15:0]
• Null Pulse
Programming null pulse is not permitted. Pulse must be at least written to one. A null value leads
to unpredictable behavior.
Figure 15-9 on page 187 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 ris-
ing edge of NRD. In this case, the MODE.READMODE bit must be written to one (read is
controlled by NRD), to indicate that data is available with the rising edge of NRD. The SMC sam-
ples the read data internally on the rising edge of CLK_SMC that generates the rising edge of
NRD, whatever the programmed waveform of NCS may be.
186
32072H–AVR32–10/2012
AT32UC3A3
Figure 15-9. READMODE = 1: Data Is Sampled by SMC Before the Rising Edge of NRD
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
NRD
NCS
tPACC
D[15:0]
Data Sampling
Figure 15-10 on page 188 shows the typical read cycle of an LCD module. 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 MODE.READMODE bit must be written
to zero (read is controlled by NCS): the SMC internally samples the data on the rising edge of
CML_SMC that generates the rising edge of NCS, whatever the programmed waveform of NRD
may be.
187
32072H–AVR32–10/2012
AT32UC3A3
Figure 15-10. READMODE = 0: Data Is Sampled by SMC Before the Rising Edge of NCS
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
NRD
NCS
tPACC
D[15:0]
Data Sampling
•NWE waveforms
The NWE signal is characterized by a setup timing, a pulse width and a hold timing.
1. NWESETUP: the NWE setup time is defined as the setup of address and data before
the NWE falling edge.
2. NWEPULSE: the NWE pulse length is the time between NWE falling edge and NWE
rising edge.
3. NWEHOLD: 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.
188
32072H–AVR32–10/2012
AT32UC3A3
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
NWE
NCS
NWECYCLE
•Write 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:
Similarly,
All NWE and NCS (write) timings are defined separately for each chip select as an integer num-
ber of CLK_SMC cycles. To ensure that the NWE and NCS timings are coherent, the user must
define the total write cycle instead of the hold timing. This implicitly defines the NWE hold time
and NCS (write) hold times as:
And,
189
32072H–AVR32–10/2012
AT32UC3A3
If null setup parameters are programmed for NWE and/or NCS, NWE and/or NCS remain active
continuously in case of consecutive write cycles in the same memory (see Figure 15-12 on page
190). However, for devices that perform write operations on the rising edge of NWE or NCS,
such as SRAM, either a setup or a hold must be programmed.
Figure 15-12. Null Setup and Hold Values of NCS and NWE in Write Cycle
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
NWE,
NWE0, NWE1
NCS
D[15:0]
•Null pulse
Programming null pulse is not permitted. Pulse must be at least written to one. A null value leads
to unpredictable behavior.
Figure 15-13 on page 191 shows the waveforms of a write operation with MODE.WRITEMODE
equal to one. The data is put on the bus during the pulse and hold steps of the NWE signal. The
internal data buffers are turned out after the NWESETUP time, and until the end of the write
cycle, regardless of the programmed waveform on NCS.
190
32072H–AVR32–10/2012
AT32UC3A3
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
NWE,
NWR0, NWR1
NCS
D[15:0]
Figure 15-14 on page 191 shows the waveforms of a write operation with MODE.WRITEMODE
written to zero. The data is put on the bus during the pulse and hold steps of the NCS signal.
The internal data buffers are turned out after the NCSWRSETUP time, and until the end of the
write cycle, regardless of the programmed waveform on NWE.
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
NWE,
NWR0, NWR1
NCS
D[15:0]
191
32072H–AVR32–10/2012
AT32UC3A3
192
32072H–AVR32–10/2012
AT32UC3A3
Figure 15-15. Chip Select Wait State Between a Read Access on NCS0 and a Write Access on
NCS2
CLK_SMC
_MSB:2]
, NBS1,
, A1
NRD
NWE
NCS0
NCS2
NRDCYCLE NWECYCLE
D[15:0]
193
32072H–AVR32–10/2012
AT32UC3A3
An early read wait state is automatically inserted if at least one of the following conditions is
valid:
• if the write controlling signal has no hold time and the read controlling signal has no setup
time (Figure 15-16 on page 194).
• in NCS write controlled mode (MODE.WRITEMODE = 0), if there is no hold timing on the
NCS signal and the NCSRDSETUP parameter is set to zero, regardless of the read mode
(Figure 15-17 on page 195). The write operation must end with a NCS rising edge. Without
an early read wait state, the write operation could not complete properly.
• in NWE controlled mode (MODE.WRITEMODE = 1) and if there is no hold timing
(NWEHOLD = 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 15-18 on page 196.
Figure 15-16. Early Read Wait State: Write with No Hold Followed by Read with No Setup.
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
NWE
NRD
No hold
No setup
D[15:0]
194
32072H–AVR32–10/2012
AT32UC3A3
Figure 15-17. Early Read Wait State: NCS Controlled Write with No Hold Followed by a Read
with No Setup.
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
NWE
NRD
No hold No setup
D[15:0]
195
32072H–AVR32–10/2012
AT32UC3A3
Figure 15-18. Early Read Wait State: NWE-controlled Write with No Hold Followed by a Read
with one Set-up Cycle.
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
D[15:0]
•User procedure
To insert a reload configuration wait state, the SMC detects a write access to any MODE register
of the user interface. If the user only modifies timing registers (SETUP, PULSE, CYCLE regis-
ters) in the user interface, he must validate the modification by writing the MODE register, even
if no change was made on the mode parameters.
196
32072H–AVR32–10/2012
AT32UC3A3
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 15.6.8).
197
32072H–AVR32–10/2012
AT32UC3A3
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
NRD
NCS
tPACC
D[15:0]
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
NRD
NCS
tPACC
D[15:0]
198
32072H–AVR32–10/2012
AT32UC3A3
Figure 15-21. TDF Optimization: No TDF Wait States Are Inserted if the TDF Period Is over when the Next Access Begins
CLK_SMC
A[AD_MSB:2]
NRD
NRDHOLD = 4
NWE
NWESETUP = 3
NCS0
TDFCYCLES = 6
D[15:0]
Read access on NCS0 (NRD controlled) Write access on NCS0 (NWE controlled)
Read to Write
Wait State
199
32072H–AVR32–10/2012
AT32UC3A3
Figure 15-22. TDF Optimization Disabled (MODE.TDFMODE = 0). TDF Wait States between Two Read Accesses on Dif-
ferent Chip Selects.
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
Read1 controlling
signal(NRD) Read1 hold = 1 Read2 setup = 1
Read2 controlling
signal(NRD) TDFCYCLES = 6
D[15:0]
Figure 15-23. TDF Optimization Disabled (MODE.TDFMODE= 0). TDF Wait States between a Read and a Write Access
on Different Chip Selects.
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
Read1 controlling
signal(NRD)
Read1 hold = 1 Write2 setup = 1
Write2 controlling
signal(NWE) TDFCYCLES = 4
D[15:0]
200
32072H–AVR32–10/2012
AT32UC3A3
Figure 15-24. TDF Optimization Disabled (MODE.TDFMODE = 0). TDF Wait States between Read and Write accesses on
the Same Chip Select.
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
Read1 controlling
signal(NRD)
Read1 hold = 1 Write2 setup = 1
Write2 controlling
signal(NWE) TDFCYCLES = 5
D[15:0]
15.6.7.1 Restriction
When one of the MODE.EXNWMODE is enabled, it is mandatory to program at least one hold
cycle for the read/write controlling signal. For that reason, the NWAIT signal cannot be used in
Page Mode (Section 15.6.9), or in Slow Clock Mode (Section 15.6.8).
The NWAIT signal is assumed to be a response of the external device to the read/write request
of the SMC. Then NWAIT is examined by the SMC only in the pulse state of the read or write
controlling signal. The assertion of the NWAIT signal outside the expected period has no impact
on SMC behavior.
201
32072H–AVR32–10/2012
AT32UC3A3
The assertion of the NWAIT signal outside the expected period is ignored as illustrated in Figure
15-26 on page 203.
Figure 15-25. Write Access with NWAIT Assertion in Frozen Mode (MODE.EXNWMODE = 2).
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
FROZEN STATE
4 3 2 1 1 1 1 0
NWE
6 5 4 3 2 2 2 2 0
NCS
D[15:0]
NWAIT
Internally synchronized
NWAIT signal
Write cycle
EXNWMODE = 2 (Frozen)
WRITEMODE = 1 (NWE controlled)
NWEPULSE = 5
NCSWRPULSE = 7
202
32072H–AVR32–10/2012
AT32UC3A3
Figure 15-26. Read Access with NWAIT Assertion in Frozen Mode (MODE.EXNWMODE = 2).
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
FROZEN STATE
4 3 2 2 2 1 0
NCS 2 1 0
1 0
NRD 5 5 5 4 3 2 1 0
NWAIT
Internally synchronized
NWAIT signal
Read cycle
EXNWMODE = 2 (Frozen)
READMODE = 0 (NCS controlled)
Assertion is ignored
NRDPULSE = 2, NRDHOLD = 6
NCSRDPULSE = 5, NCSRDHOLD = 3
203
32072H–AVR32–10/2012
AT32UC3A3
Figure 15-27. NWAIT Assertion in Write Access: Ready Mode (MODE.EXNWMODE = 3).
CLK_SM C
A [A D _ M S B :2 ]
N B S 0, N B S 1,
A0, A1
FRO ZEN STATE
4 3 2 1 0 0 0
NW E
6 5 4 3 2 1 1 1 0
NCS
D [1 5 :0 ]
N W A IT
In te rn a lly s y n c h ro n iz e d
N W A IT s ig n a l
W rite c y c le
E X N W M O D E = 3 (R e a d y m o d e)
W R IT E M O D E = 1 (N W E _ c o n tro lle d )
NW EPULSE = 5
NCSW RPULSE = 7
204
32072H–AVR32–10/2012
AT32UC3A3
Figure 15-28. NWAIT Assertion in Read Access: Ready Mode (EXNWMODE = 3).
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
Wait STATE
6 5 4 3 2 1 0 0
NCS
6 5 4 3 2 1 1 0
NRD
NWAIT
Internally synchronized
NWAIT signal
Read cycle
205
32072H–AVR32–10/2012
AT32UC3A3
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
Wait STATE
4 3 2 1 0 0 0
NRD
Minimal pulse length
NWAIT
Read cycle
EXNWMODE = 2 or 3
READMODE = 1 (NRD controlled)
NRDPULSE = 5
206
32072H–AVR32–10/2012
AT32UC3A3
CLK_SMC CLK_SMC
A[AD_MSB:2] A[AD_MSB:2]
NRD
NWE 1 1 1
1 1
NCS
NCS
NRDCYCLES = 2
NWECYCLES = 3
Table 15-5. Read and Write Timing Parameters in Slow Clock Mode
Read Parameters Duration (cycles) Write Parameters Duration (cycles)
NRDSETUP 1 NWESETUP 1
NRDPULSE 1 NWEPULSE 1
NCSRDSETUP 0 NCSWRSETUP 0
NCSRDPULSE 2 NCSWRPULSE 3
NRDCYCLE 2 NWECYCLE 3
207
32072H–AVR32–10/2012
AT32UC3A3
15.6.8.2 Switching from (to) slow clock mode to (from) normal mode
When switching from slow clock mode to the normal mode, the current slow clock mode transfer
is completed at high clock rate, with the set of slow clock mode parameters. See Figure 15-31
on page 208. The external device may not be fast enough to support such timings.
Figure 15-32 on page 209 illustrates the recommended procedure to properly switch from one
mode to the other.
Figure 15-31. Clock Rate Transition Occurs while the SMC is Performing a Write Operation
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
NWE
1 1 1 1 1 1 2 3 2
NCS
NWECYCLE = 3 NWECYCLE = 7
SLOW CLOCK MODE WRITE SLOW CLOCK MODE WRITE NORMAL MODE WRITE
This write cycle finishes with the slow clock mode set Slow clock mode transition is detected:
of parameters after the clock rate transition Reload Configuration Wait State
208
32072H–AVR32–10/2012
AT32UC3A3
Figure 15-32. 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 PM
CLK_SMC
A[AD_MSB:2]
NBS0, NBS1,
A0, A1
NWE
1 1 1 2 3 2
NCS
Reload Configuration
Wait State
209
32072H–AVR32–10/2012
AT32UC3A3
Figure 15-33. Page Mode Read Protocol (Address MSB and LSB Are Defined in Table 15-6 on page 209)
CLK_SMC
A[MSB]
A[LSB]
NRD
tpa tsa tsa
NCS
D[15:0]
The NRD and NCS signals are held low during all read transfers, whatever the programmed val-
ues of the setup and hold timings in the User Interface may be. Moreover, the NRD and NCS
timings are identical. The pulse length of the first access to the page is defined with the
PULSE.NCSRDPULSE field value. The pulse length of subsequent accesses within the page
are defined using the PULSE.NRDPULSE field value.
In page mode, the programming of the read timings is described in Table 15-7 on page 210:
The SMC does not check the coherency of timings. It will always apply the NCSRDPULSE tim-
ings as page access timing (tpa) and the NRDPULSE for accesses to the page (tsa), even if the
programmed value for tpa is shorter than the programmed value for tsa.
210
32072H–AVR32–10/2012
AT32UC3A3
CLK_SMC
A[2], A1, A0 A1 A3 A7
NRD
NCS
D[7:0]
D1 D3 D7
211
32072H–AVR32–10/2012
AT32UC3A3
212
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – NCSRDSETUP
23 22 21 20 19 18 17 16
– – NRDSETUP
15 14 13 12 11 10 9 8
– – NCSWRSETUP
7 6 5 4 3 2 1 0
– – NWESETUP
NCS Setup Length in read access = ( 128 × NCSRDSETUP [ 5 ] + NCSRDSETUP [ 4:0 ] ) clock cycles
NCS Setup Length in write access = ( 128 × NCSWRSETUP [ 5 ] + NCSWRSETUP [ 4:0 ] ) clock cycles
213
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– NCSRDPULSE
23 22 21 20 19 18 17 16
– NRDPULSE
15 14 13 12 11 10 9 8
– NCSWRPULSE
7 6 5 4 3 2 1 0
– NWEPULSE
NCS Pulse Length in read access = ( 256 × NCSRDPULSE [ 6 ] + NCSRDPULSE [ 5:0 ] ) clock cycles
NCS Pulse Length in write access = ( 256 × NCSWRPULSE [ 6 ] + NCSWRPULSE [ 5:0 ] ) clock cycles
214
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – NRDCYCLE[8]
23 22 21 20 19 18 17 16
NRDCYCLE[7:0]
15 14 13 12 11 10 9 8
– – – – – – – NWECYCLE[8]
7 6 5 4 3 2 1 0
NWECYCLE[7:0]
Read Cycle Length = ( 256 × NRDCYCLE [ 8:7 ] + NRDCYCLE [ 6:0 ] ) clock cycles
Write Cycle Length = ( 256 × NWECYCLE [ 8:7 ] + NWECYCLE [ 6:0 ] ) clock cycles
215
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – PS – – – PMEN
23 22 21 20 19 18 17 16
– – – TDFMODE TDFCYCLES
15 14 13 12 11 10 9 8
– – DBW – – – BAT
7 6 5 4 3 2 1 0
PS Page Size
0 4-byte page
1 8-byte page
2 16-byte page
3 32-byte page
216
32072H–AVR32–10/2012
AT32UC3A3
217
32072H–AVR32–10/2012
AT32UC3A3
218
32072H–AVR32–10/2012
AT32UC3A3
16.1 Features
• 128-Mbytes address space
• Numerous configurations supported
– 2K, 4K, 8K row address memory parts
– SDRAM with two or four internal banks
– SDRAM with 16-bit data path
• Programming facilities
– Word, halfword, byte access
– Automatic page break when memory boundary has been reached
– Multibank ping-pong access
– Timing parameters specified by software
– Automatic refresh operation, refresh rate is programmable
– Automatic update of DS, TCR and PASR parameters (mobile SDRAM devices)
• Energy-saving capabilities
– Self-refresh, power-down, and deep power-down modes supported
– Supports mobile SDRAM devices
• Error detection
– Refresh error interrupt
• SDRAM power-up initialization by software
• CAS latency of one, two, and three supported
• Auto Precharge command not used
16.2 Overview
The SDRAM Controller (SDRAMC) extends the memory capabilities of a chip by providing the
interface to an external 16-bit SDRAM device. The page size supports ranges from 2048 to 8192
and the number of columns from 256 to 2048. It supports byte (8-bit) and halfword (16-bit)
accesses.
The SDRAMC supports a read or write burst length of one location. It keeps track of the active
row in each bank, thus maximizing SDRAM performance, e.g., the application may be placed in
one bank and data in the other banks. So as to optimize performance, it is advisable to avoid
accessing different rows in the same bank.
The SDRAMC supports a CAS latency of one, two, or three and optimizes the read access
depending on the frequency.
The different modes available (self refresh, power-down, and deep power-down modes) mini-
mize power consumption on the SDRAM device.
219
32072H–AVR32–10/2012
AT32UC3A3
SDCK SDCK
SDCKE
SDRAMC SDCKE
C h ip S elect
SDCS
M e m o ry N C S [1]
C o ntro lle r B A [1:0]
A D D R [17:1 6]
SDRAMC
In te rrup t RAS
RAS
CAS
CAS
SDW E
SDW E
P ow e r C L K _S D R A M C SDRAMC
EBI I/O
M a n ag e r D Q M [0 ]
M U X Lo g ic C on trolle r A D D R [0]
D Q M [1 ]
NW E1
S D R A M C _A [9:0]
A D D R [11:2 ]
S D R A M C _ A [10]
SDA10
S D R A M C _ A [1 2:11]
A D D R [13:1 4]
U se r Interfa ce
D [1 5:0 ]
D A T A [15:0]
P e rip h eral B us
220
32072H–AVR32–10/2012
AT32UC3A3
Figure 16-2. SDRAM Controller Connections to SDRAM Devices: 16-bit Data Bus Width
D0-D31
Controller
SDRAMC_A[0-12]
BA0
BA1
SDCS
221
32072H–AVR32–10/2012
AT32UC3A3
27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
222
32072H–AVR32–10/2012
AT32UC3A3
16.6.3 Clocks
The clock for the SDRAMC bus interface (CLK_SDRAMC) is generated by the Power Manager.
This clock is enabled at reset, and can be disabled in the Power Manager. It is recommended to
disable the SDRAMC before disabling the clock, to avoid freezing the SDRAMC in an undefined
state.
16.6.4 Interrupts
The SDRAMC interrupt request line is connected to the interrupt controller. Using the SDRAMC
interrupt requires the interrupt controller to be programmed first.
223
32072H–AVR32–10/2012
AT32UC3A3
quency, the TR register must be written with the value 1562 (15.625 µs x 100 MHz) or
781 (7.81 µs x 100 MHz).
After initialization, the SDRAM devices are fully functional.
SDCKE
tRP tRC tMRD
SDCK
SDRAMC_A[9:0]
A10
SDRAMC_A[12:11]
SDCS
RAS
CAS
SDWE
DQM
Inputs Stable for Precharge All Banks 1st Auto Refresh 8th Auto Refresh LMR Command Valid Command
200 usec
224
32072H–AVR32–10/2012
AT32UC3A3
tRCD = 3
SDCS
SDCK
SDRAMC_A[12:0] Row n Col a Col b Col c Col d Col e Col f Col g Col h Col i Col j Col k Col l
RAS
CAS
SDWE
D[15:0] Dna Dnb Dnc Dnd Dne Dnf Dng Dnh Dni Dnj Dnk Dnl
225
32072H–AVR32–10/2012
AT32UC3A3
tRCD = 3 CAS = 2
SDCS
SDCK
RAS
CAS
SDWE
226
32072H–AVR32–10/2012
AT32UC3A3
SDCS
SDCK
Row n
SDRAMC_A[12:0] Col a Col b Col c Col d Row m Col a Col b Col c Col d Col e
RAS
CAS
SDWE
D[15:0] Dna Dnb Dnc Dnd Dma Dmb Dmc Dmd Dme
227
32072H–AVR32–10/2012
AT32UC3A3
SDCS
SDCK
Row n
SDRAMC_A[12:0] Col c Col d Row m Col a
RAS
CAS
SDWE
D[15:0] Dma
Dnb Dnc Dnd
(input)
228
32072H–AVR32–10/2012
AT32UC3A3
and Drive Strength (DS) parameters must be set by writing the corresponding fields in the LPR
register, and transmitted to the low power SDRAM device during initialization.
After initialization, as soon as the LPR.PASR, LPR.DS, or LPR.TCSR fields are modified and
self refresh mode is activated, the SDRAMC issues an Extended Load Mode Register command
to the SDRAM and the Extended Mode Register of the SDRAM device is accessed automati-
cally. The PASR/DS/TCSR parameters values are therefore updated before entry into self
refresh mode.
The SDRAM device must remain in self refresh mode for a minimum period of tRAS and may
remain in self refresh mode for an indefinite period. This is described in Figure 16-8 on page
229.
SDRAMC_A[12:0] Row
SDCK
SDCKE
SDCS
RAS
CAS
SDWE
Access Request
To the SDRAM Controller
229
32072H–AVR32–10/2012
AT32UC3A3
SDCS
SDCK
RAS
CAS
SDCKE
D[15:0]
Dna Dnb Dnc Dnd Dne Dnf
(input)
230
32072H–AVR32–10/2012
AT32UC3A3
tRP = 3
SDCS
SDCK
Row n
SDRAMC_A[12:0] Col c Col d
RAS
CAS
SDWE
SCKE
D[15:0]
Dnb Dnc Dnd
(Input)
231
32072H–AVR32–10/2012
AT32UC3A3
1. The reset values for these fields are device specific. Please refer to the Module Configuration section at the end of this chap-
ter.
232
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - MODE
MODE Description
0 Normal mode. Any access to the SDRAM is decoded normally.
1 The SDRAMC issues a “NOP” command when the SDRAM device is accessed regardless of the cycle.
The SDRAMC issues an “All Banks Precharge” command when the SDRAM device is accessed regardless of
2
the cycle.
The SDRAMC issues a “Load Mode Register” command when the SDRAM device is accessed regardless of the
cycle. This command will load the CR.CAS field into the SDRAM device Mode Register. All the other parameters
3
of the SDRAM device Mode Register will be set to zero (burst length, burst type, operating mode, write burst
mode...).
The SDRAMC issues an “Auto Refresh” command when the SDRAM device is accessed regardless of the cycle.
4
Previously, an “All Banks Precharge” command must be issued.
The SDRAMC issues an “Extended Load Mode Register” command when the SDRAM device is accessed
regardless of the cycle. This command will load the LPR.PASR, LPR.DS, and LPR.TCR fields into the SDRAM
5
device Extended Mode Register. All the other bits of the SDRAM device Extended Mode Register will be set to
zero.
6 Deep power-down mode. Enters deep power-down mode.
233
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - COUNT[11:8]
7 6 5 4 3 2 1 0
COUNT[7:0]
234
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
TXSR TRAS
23 22 21 20 19 18 17 16
TRCD TRP
15 14 13 12 11 10 9 8
TRC TWR
7 6 5 4 3 2 1 0
DBW CAS NB NR NC
235
32072H–AVR32–10/2012
AT32UC3A3
NB Number of Banks
0 2
1 4
NR Row Bits
0 11
1 12
2 13
3 Reserved
NC Column Bits
0 8
1 9
2 10
3 11
236
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - DA
237
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - TIMEOUT DS TCSR
7 6 5 4 3 2 1 0
- PASR - - LPCB
238
32072H–AVR32–10/2012
AT32UC3A3
239
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - RES
240
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - RES
241
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - RES
242
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - RES
243
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - MD
MD Device Type
0 SDRAM
1 Low power SDRAM
Other Reserved
244
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - VARIANT
15 14 13 12 11 10 9 8
- - - - VERSION
7 6 5 4 3 2 1 0
VERSION
245
32072H–AVR32–10/2012
AT32UC3A3
17.1 Features
• Hardware Error Corrected Code Generation with two methods :
– Hamming code detection and correction by software (ECC-H)
– Reed-Solomon code detection by hardware, correction by hardware or software (ECC-RS)
• Supports NAND Flash and SmartMedia™ devices with 8- or 16-bit data path for ECC-H, and with
8-bit data path for ECC-RS
• Supports NAND Flash and SmartMedia™ with page sizes of 528, 1056, 2112, and 4224 bytes
(specified by software)
• ECC_H supports :
– One bit correction per page of 512,1024,2048, or 4096 bytes
– One bit correction per sector of 512 bytes of data for a page size of 512, 1024, 2048, or 4096
bytes
– One bit correction per sector of 256 bytes of data for a page size of 512, 1024, 2048, or 4096
bytes
• ECC_RS supports :
– 4 errors correction per sector of 512 bytes of data for a page size of 512, 1024, 2048, and
4096 bytes with 8-bit data path
17.2 Overview
NAND Flash and SmartMedia™ devices contain by default invalid blocks which have one or
more invalid bits. Over the NAND Flash and SmartMedia™ lifetime, additional invalid blocks may
occur which can be detected and corrected by an Error Corrected Code (ECC).
The ECC Controller is a mechanism that encodes data in a manner that makes possible the
identification and correction of certain errors in data. The ECC controller is capable of single-bit
error correction and two-bit random detection when using the Hamming code (ECC-H) and up to
four symbols (a symbol is a 8-bit data) correction whatever the number of errors in symbol (1 to
8 bits of error) when using the Reed-Solomon code (ECC-RS).
When NAND Flash/SmartMedia™ have more than two erroneous bits when using the Hamming
code (ECC-H) or more than four bits in error when using the Reed-Solomon code (ECC-RS), the
data cannot be corrected.
246
32072H–AVR32–10/2012
AT32UC3A3
NAND Flash
Rom 1024x10
Encoder RS4 10
Error Evaluator
SmartMedia GF(2 )
Logic
Polynomial
Partial Syndrome Chien Search
process
Peripheral Bus
17.4.3 Clocks
The clock for the ECCHRS bus interface (CLK_ECCHRS) is generated by the Power Manager.
This clock is enabled at reset, and can be disabled in the Power Manager. It is recommended to
disable the ECCHRS before disabling the clock, to avoid freezing the ECCHRS in an undefined
state.
17.4.4 Interrupts
The ECCHRS interrupt request line is connected to the interrupt controller. Using the ECCHRS
interrupt requires the interrupt controller to be programmed first.
247
32072H–AVR32–10/2012
AT32UC3A3
248
32072H–AVR32–10/2012
AT32UC3A3
FREEZE
The application can check the ECC Status Registers (SR1/SR2) for any detected errors. It is up
to the application to correct any detected error for ECC-H. The application can correct any
detected error or let the hardware do the correction by writing a one to the Correction Enable bit
in the MD register (MD.CORRS4) for ECC-RS.
ECC computation can detect four different circumstances:
• No error: XOR between the ECC computation and the ECC code stored at the end of the
NAND Flash or SmartMedia™ page is equal to zero. All bits in the SR1 and SR2 registers will
be cleared.
• Recoverable error: Only the Recoverable Error bits in the ECC Status registers
(SR1.RECERRn and/or SR2.RECERRn) are set. The corrupted word offset in the read page
is defined by the Word Address field (WORDADDR) in the PR0 to PR15 registers. The
corrupted bit position in the concerned word is defined in the Bit Address field (BITADDR) in
the PR0 to PR15 registers.
• ECC error: The ECC Error bits in the ECC Status Registers (SR1.ECCERRn /
SR2.ECCERRn) are set. An error has been detected in the ECC code stored in the Flash
memory. The position of the corrupted bit can be found by the application performing an XOR
between the Parity and the NParity contained in the ECC code stored in the Flash memory.
For ECC-RS it is the responsibility of the software to determine where the error is located on
ECC code stored in the spare zone flash area and not on user data area.
• Non correctable error: The Multiple Error bits (MULERRn) in the SR1 and SR2 registers are
set. Several unrecoverable errors have been detected in the Flash memory page.
ECC Status Registers, ECC Parity Registers are cleared when a read/write command is
detected or a software reset is performed.
For Single-bit Error Correction and Double-bit Error Detection (SEC-DED) Hsiao code is used.
24-bit ECC is generated in order to perform one bit correction per 256 or 512 bytes for pages of
512/2048/4096 8-bit words. 32-bit ECC is generated in order to perform one bit correction per
512/1024/2048/4096 8- or 16-bit words.They are generated according to the schemes shown in
Figure 17-3 on page 250 and Figure 17-4 on page 251.
249
32072H–AVR32–10/2012
AT32UC3A3
(page size-3)th byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 P8
P16
(page size-2)th byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 P8' PX’
P32'
(page size-1)th byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 P8
P16'
page size th byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 P8'
P2 P2' P2 P2'
P4 P4'
P1=bit7(+)bit5(+)bit3(+)bit1(+)P1
Page size = 512 Px = 2048 P2=bit7(+)bit6(+)bit3(+)bit2(+)P2
Page size = 1024 Px = 4096 P4=bit7(+)bit6(+)bit5(+)bit4(+)P4
Page size = 2048 Px = 8192 P1'=bit6(+)bit4(+)bit2(+)bit0(+)P1'
Page size = 4096 Px = 16384 P2'=bit5(+)bit4(+)bit1(+)bit0(+)P2'
P4'=bit7(+)bit6(+)bit5(+)bit4(+)P4'
To calculate P8’ to PX’ and P8 to PX, apply the algorithm that follows.
Page size = 2n
for i =0 to n
begin
for (j = 0 to page_size_byte)
begin
if(j[i] ==1)
P[2i+3]=bit7(+)bit6(+)bit5(+)bit4(+)bit3(+)
bit2(+)bit1(+)bit0(+)P[2i+3]
else
P[2i+3]’=bit7(+)bit6(+)bit5(+)bit4(+)bit3(+)
bit2(+)bit1(+)bit0(+)P[2i+3]'
end
end
250
32072H–AVR32–10/2012
AT32UC3A3
(page size-3)th byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 P8
P16
(page size-2)th byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 P8' PX’
P32'
(page size-1)th byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 P8
P16'
page size th byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 P8'
P4 P4' P4 P4'
P5 P5'
To calculate P8’ to PX’ and P8 to PX, apply the algorithm that follows.
Page size = 2n
for i =0 to n
begin
for (j = 0 to page_size_word)
begin
if(j[i] ==1)
P[2i+3]= bit15(+)bit14(+)bit13(+)bit12(+)
bit11(+)bit10(+)bit9(+)bit8(+)
bit7(+)bit6(+)bit5(+)bit4(+)bit3(+)
bit2(+)bit1(+)bit0(+)P[2n+3]
else
P[2i+3]’=bit15(+)bit14(+)bit13(+)bit12(+)
bit11(+)bit10(+)bit9(+)bit8(+)
bit7(+)bit6(+)bit5(+)bit4(+)bit3(+)
bit2(+)bit1(+)bit0(+)P[2i+3]'
end
end
251
32072H–AVR32–10/2012
AT32UC3A3
For ECC-RS, in order to perform 4-error correction per 512 bytes of 8-bit words, the codeword
have to be generated by the RS4 Encoder module and stored into the NAND Flash extra area,
according to the scheme shown in Figure 17-5 on page 252
Feedback
In read mode, firstly, the detection for any error is done with the partial syndrome module. It is
the responsibility of the ECC-RS Controller to determine after receiving the old codeword stored
in the extra area if there is any error on data and /or on the old codeword. If all syndromes (Si)
are equal to zero, there is no error, otherwise a polynomial representation is written into
CWPS00 to CWPS79 registers. The Partial Syndrome module performs an algorithm according
to the scheme in Figure 17-6 on page 252
S7
Mult α i
x S2
x S1
x RegOct S0
DataIn(x)
If the Correction Enable bit is set in the ECC Mode Register (MD.CORRS4) then the polynomial
representation of error are sent to the polynomial processor. The aim of this module is to per-
form the polynomial division in order to calculate two polynomials, Omega (Z) and Lambda (Z),
which are necessary for the two following modules (Chien Search and Error Evaluator). In order
to perform addition, multiplication, and division a Read Only Memory (ROM) has been added
containing the 1024 elements of the Galois field. Both Chien Search and Error Evaluator work in
parallel. The Error Evaluator has the responsibility to determine the Nth error value in the data
and in the old codeword according to the scheme in Figure 17-7 on page 253
252
32072H–AVR32–10/2012
AT32UC3A3
α -1 α -3 α -4 α-5 α -7
ω0 ω1 ω3 ω4 ω5 ω7
+
ω (α )
-j
Λ odd( α )
-j Rom 1024x10
10 Array - Mult Error value
GF(2 ) inverted
@ position j
ErrorLoc
The Chien Search takes charge of determining if an error has occurred at symbol N according to
the scheme in Figure 17-8 on page 253
λ 00 λ2 λ8 λ1 λ3 λ7
+ +
Degree of Lambda
+
Λ (α )
-j
Error Located
Not
counter
253
32072H–AVR32–10/2012
AT32UC3A3
254
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - RST
255
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - CORRS4 - FREEZE
7 6 5 4 3 2 1 0
- TYPECORREC - PAGESIZE
256
32072H–AVR32–10/2012
AT32UC3A3
A word has a value of 8 bits or 16 bits, depending on the NAND Flash or SmartMedia™ memory organization.
This table defines the page size of the NAND Flash device when using the ECC-RS code (TYPECORREC = 0b1xx)
i.e.: for NAND Flash device with page size of 4096 bytes and 128 bytes extra area ECC-RS can manage any sub page of
512 bytes up to 8.
257
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
• MULERRn: Multiple Error in the sector number n of 256/512 bytes in the page
1: Multiple errors are detected.
0: No multiple error is detected.
• ECCERRn: ECC Error in the packet number n of 256/512 bytes in the page
1: A single bit error has occurred.
0: No error have been detected.
258
32072H–AVR32–10/2012
AT32UC3A3
• RECERRn: Recoverable Error in the packet number n of 256/512 Bytes in the page
1: Errors detected. If MULERRn is zero, a single correctable error was detected. Otherwise multiple uncorrected errors were
detected.
0: No errors have been detected.
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
SYNVEC
259
32072H–AVR32–10/2012
AT32UC3A3
260
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
WORDADDR[11:4]
7 6 5 4 3 2 1 0
WORDADDR[3:0] BITADDR
Once the entire main area of a page is written with data, this register content must be stored at any free location of the spare
area.
• WORDADDR: Word Address
During a page read, this field contains the word address (8-bit or 16-bit word, depending on the memory plane organization)
where an error occurred, if a single error was detected. If multiple errors were detected, this field is meaningless.
• BITADDR: Bit Address
During a page read, this field contains the corrupted bit offset where an error occurred, if a single error was detected. If multiple
errors were detected, this field is meaningless.
Using ECC-H code, one bit correction per sector of 256 bytes (MD.TYPECORREC=0b001)
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- NPARITY0[10:4]
15 14 13 12 11 10 9 8
261
32072H–AVR32–10/2012
AT32UC3A3
NPARITY0[3:0] 0 WORDADD0[7:5]
7 6 5 4 3 2 1 0
WORDADD0[4:0] BITADDR0
Once the entire main area of a page is written with data, this register content must be stored at any free location of the spare
area.
• NPARITY0: Parity N
Parity calculated by the ECC-H.
• WORDADDR0: Corrupted Word Address in the page between the first byte and the 255th byte
During a page read, this field contains the word address (8-bit word) where an error occurred, if a single error was detected. If
multiple errors were detected, this field is meaningless.
• BITADDR0: Corrupted Bit Address in the page between the first byte and the 255th byte
During a page read, this field contains the corrupted bit offset where an error occurred, if a single error was detected. If multiple
errors were detected, this field is meaningless.
262
32072H–AVR32–10/2012
AT32UC3A3
Using ECC-H code, one bit correction per sector of 512 bytes (MD.TYPECORREC=0b010)
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
NPARITY0[11:4]
15 14 13 12 11 10 9 8
NPARITY0[3:0] WORDADD0[8:5]
7 6 5 4 3 2 1 0
WORDADD0[4:0] BITADDR0
Once the entire main area of a page is written with data, this register content must be stored at any free location of the spare
area.
• NPARITY0: Parity N
Parity calculated by the ECC-H.
• WORDADDR0: Corrupted Word Address in the page between the first byte and the 511th byte
During a page read, this field contains the word address (8-bit word) where an error occurred, if a single error was detected. If
multiple errors were detected, this field is meaningless.
• BITADDR0: Corrupted Bit Address in the page between the first byte and the 511th byte
During a page read, this field contains the corrupted bit offset where an error occurred, if a single error was detected. If multiple
errors were detected, this field is meaningless.
263
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
NPARITY[15:8]
7 6 5 4 3 2 1 0
NPARITY[7:0]
• NPARITY: Parity N
During a write, the field of this register must be written in the extra area used for redundancy (for a 512-byte page size:
address 514-515).
Using ECC-H code, one bit correction per sector of 256 bytes (MD.TYPECORREC=0b001)
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- NPARITY1[10:0]
15 14 13 12 11 10 9 8
NPARITY1[3:0] 0 WORDADD1[7:5]
7 6 5 4 3 2 1 0
WORDADD1[4:0] BITADDR1
264
32072H–AVR32–10/2012
AT32UC3A3
Once the entire main area of a page is written with data, this register content must be stored at any free location of the spare
area.
• NPARITY1: Parity N
Parity alculated by the ECC-H.
• WORDADDR1: corrupted Word Address in the page between the 256th and the 511th byte
During a page read, this field contains the word address (8-bit word) where an error occurred, if a single error was detected. If
multiple errors were detected, this field is meaningless.
• BITADDR1: corrupted Bit Address in the page between the 256th and the 511th byte
During a page read, this field contains the corrupted bit offset where an error occurred, if a single error was detected. If multiple
errors were detected, this field is meaningless.
Using ECC-H code, one bit correction per sector of 512 bytes (MD.TYPECORREC=0b010)
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
NPARITY1[11:4]
15 14 13 12 11 10 9 8
NPARITY1[3:0] WORDADD1[8:5]
7 6 5 4 3 2 1 0
WORDADD1[4:0] BITADDR1
Once the entire main area of a page is written with data, this register content must be stored at any free location of the spare
area.
• NPARITY1: Parity N
Parity calculated by the ECC-H.
• WORDADDR1: Corrupted Word Address in the page between the 512th and the 1023th byte
During a page read, this field contains the word address (8-bit word) where an error occurred, if a single error was detected. If
multiple errors were detected, this field is meaningless.
• BITADDR1: Corrupted Bit Address in the page between the 512th and the 1023th byte
During a page read, this field contains the corrupted bit offset where an error occurred, if a single error was detected. If multiple
errors were detected, this field is meaningless.
265
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
• MULERRn: Multiple Error in the sector number n of 256/512 bytes in the page
1: Multiple errors are detected.
0: No multiple error is detected.
• ECCERRn: ECC Error in the packet number n of 256/512 bytes in the page
1: A single bit error has occurred.
0: No error is detected.
266
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - MULERR RECERR
Only one sub page of 512 bytes is corrected at a time. If several sub page are on error then it is necessary to do several time the
correction process.
• MULERR: Multiple error
This bit is set to one when a multiple error have been detected by the ECC-RS.
This bit is cleared when a read/write command is detected or a software reset is performed.
1: Multiple errors detected: more than four errors.Registers for one ECC for a page of 512/1024/2048/4096 bytes
0: No multiple error detected
• RECERR: Number of recoverable errors if MULERR is zero
RECERR Comments
000 no error
001 one single error detected
010 two errors detected
011 three errors detected
100 four errors detected
267
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- NPARITYn[10:4]
15 14 13 12 11 10 9 8
NPARITYn[3:0] 0 WORDADDn[7:5]
7 6 5 4 3 2 1 0
WORDADDn[4:0] BITADDRn
Once the entire main area of a page is written with data, this register content must be stored at any free location of the spare
area.
• NPARITYn: Parity N
Parity calculated by the ECC-H.
• WORDADDRn: corrupted Word Address in the packet number n of 256 bytes in the page
During a page read, this field contains the word address (8-bit word) where an error occurred, if a single error was detected. If
multiple errors were detected, this field is meaningless.
• BITADDRn: corrupted Bit Address in the packet number n of 256 bytes in the page
During a page read, this field contains the corrupted bit offset where an error occurred, if a single error was detected. If multiple
errors were detected, this field is meaningless.
268
32072H–AVR32–10/2012
AT32UC3A3
Using ECC-H code, one bit correction per sector of 512 bytes (MD.TYPECORREC=0b010)
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
NPARITYn[11:4]
15 14 13 12 11 10 9 8
NPARITYn[3:0] WORDADDn[8:5]
7 6 5 4 3 2 1 0
WORDADDn[4:0] BITADDRn
Once the entire main area of a page is written with data, this register content must be stored to any free location of the spare
area.
Only PR2 to PR7 registers are available in this case.
• NPARITYn: Parity N
Parity calculated by the ECC-H.
• WORDADDRn: corrupted Word Address in the packet number n of 512 bytes in the page
During a page read, this field contains the word address (8-bit word) where an error occurred, if a single error was detected. If
multiple errors were detected, this field is meaningless.
• BITADDRn: corrupted Bit Address in the packet number n of 512 bytes in the page
During a page read, this field contains the corrupted bit offset where an error occurred, if a single error was detected. If multiple
errors were detected, this field is meaningless.
269
32072H–AVR32–10/2012
AT32UC3A3
Page Write:
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
CODEWORD
• CODEWORD:
Once the 512 bytes of a page is written with data, this register content must be stored to any free location of the spare area.
For a page of 512 bytes the entire redundancy words are made of 8 words of 10 bits. All those redundancies words are
concatenated to a word of 80 bits and then cut to 10 words of 8 bits to facilitate their writing in the extra area.
At the end of a page write, this field contains the redundancy word to be stored to the extra area.
Page Read:
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
PARSYND
270
32072H–AVR32–10/2012
AT32UC3A3
• PARSYND:
At the end of a page read, this field contains the Partial Syndrome S.
PARSYND00-PARSYND09: this conclude all the codeword and partial syndrome word for the sub page 1
PARSYND10-PARSYND19: this conclude all the codeword and partial syndrome word for the sub page 2
PARSYND20-PARSYND29: this conclude all the codeword and partial syndrome word for the sub page 3
PARSYND30-PARSYND39: this conclude all the codeword and partial syndrome word for the sub page 4
PARSYND40-PARSYND49: this conclude all the codeword and partial syndrome word for the sub page 5
PARSYND50-PARSYND59: this conclude all the codeword and partial syndrome word for the sub page 6
PARSYND60-PARSYND69: this conclude all the codeword and partial syndrome word for the sub page 7
PARSYND70-PARSYND79: this conclude all the codeword and partial syndrome word for the sub page 8
271
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - MASKDATA[9:8]
7 6 5 4 3 2 1 0
MASKDATA[7:0]
• MASKDATA:
At the end of the correction process, this field contains the mask to be XORed with the data read to perform the final
correction.This XORed is under the responsibility of the software.
This field is meaningless if MD.CORRS4 is zero.
272
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - OFFSET[9:8]
7 6 5 4 3 2 1 0
OFFSET[7:0]
• OFFSET:
At the end of correction process, this field contains the offset address of the data read to be corrected.
This field is meaningless if MD.CORRS4 is zero.
273
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - ENDCOR
• ENDCOR:
Writing a zero to this bit has no effect.
Writing a one to this bit will set the corresponding bit in IMR.
274
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - ENDCOR
• ENDCOR:
Writing a zero to this bit has no effect.
Writing a one to this bit will clear the corresponding bit in IMR.
275
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - ENDCOR
• ENDCOR:
0: The corresponding interrupt is disabled.
1: The corresponding interrupt is enabled.
This bit is cleared when the corresponding bit in IDR is written to one.
This bit is set when the corresponding bit in IER is written to one.
276
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - ENDCOR
• ENDCOR:
This bit is cleared when the corresponding bit in ISCR is written to one.
This bit is set when a correction process has ended.
277
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - ENDCOR
• ENDCOR:
Writing a zero to this bit has no effect
Writing a one to this bit will clear the corresponding bit in ISR and the corresponding interrupt request.
278
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - VARIANT
15 14 13 12 11 10 9 8
- - - - VERSION[11:8]
7 6 5 4 3 2 1 0
VERSION[7:0]
279
32072H–AVR32–10/2012
AT32UC3A3
280
32072H–AVR32–10/2012
AT32UC3A3
18.1 Features
• Multiple channels
• Generates transfers between memories and peripherals such as USART and SPI
• Two address pointers/counters per channel allowing double buffering
• Performance monitors to measure average and maximum transfer latency
18.2 Overview
The Peripheral DMA Controller (PDCA) transfers data between on-chip peripheral modules such
as USART, SPI and memories (those memories may be on- and off-chip memories). Using the
PDCA avoids CPU intervention for data transfers, improving the performance of the microcon-
troller. The PDCA can transfer data from memory to a peripheral or from a peripheral to memory.
The PDCA consists of multiple DMA channels. Each channel has:
• A Peripheral Select Register
• A 32-bit memory pointer
• A 16-bit transfer counter
• A 32-bit memory pointer reload value
• A 16-bit transfer counter reload value
The PDCA communicates with the peripheral modules over a set of handshake interfaces. The
peripheral signals the PDCA when it is ready to receive or transmit data. The PDCA acknowl-
edges the request when the transmission has started.
When a transmit buffer is empty or a receive buffer is full, an optional interrupt request can be
generated.
281
32072H–AVR32–10/2012
AT32UC3A3
Peripheral
Memory
0
HSB to PB
HSB Bridge
HSB Peripheral
1
Peripheral Bus
High Speed
Bus Matrix
HSB Peripheral
2
Peripheral DMA
...
Controller
(PDCA)
Interrupt IRQ Peripheral
Controller (n-1)
Handshake Interfaces
18.4.2 Clocks
The PDCA has two bus clocks connected: One High Speed Bus clock (CLK_PDCA_HSB) and
one Peripheral Bus clock (CLK_PDCA_PB). These clocks are generated by the Power Man-
ager. Both clocks are enabled at reset, and can be disabled in the Power Manager. It is
recommended to disable the PDCA before disabling the clocks, to avoid freezing the PDCA in
an undefined state.
18.4.3 Interrupts
The PDCA interrupt request lines are connected to the interrupt controller. Using the PDCA
interrupts requires the interrupt controller to be programmed first.
282
32072H–AVR32–10/2012
AT32UC3A3
283
32072H–AVR32–10/2012
AT32UC3A3
18.5.8 Interrupts
Interrupts can be enabled by writing a one to the corresponding bit in the Interrupt Enable Regis-
ter (IER) and disabled by writing a one to the corresponding bit in the Interrupt Disable Register
(IDR). The Interrupt Mask Register (IMR) can be read to see whether an interrupt is enabled or
not. The current status of an interrupt source can be read through the Interrupt Status Register
(ISR).
The PDCA has three interrupt sources:
• Reload Counter Zero - The TCRR register is zero.
• Transfer Finished - Both the TCR and TCRR registers are zero.
• Transfer Error - An error has occurred in accessing memory.
18.5.9 Priority
If more than one PDCA channel is requesting transfer at a given time, the PDCA channels are
prioritized by their channel number. Channels with lower numbers have priority over channels
with higher numbers, giving channel zero the highest priority.
284
32072H–AVR32–10/2012
AT32UC3A3
bit in the Interrupt Status Register (ISR.TERR) will be set and the DMA channel that caused the
error will be stopped. In order to restart the channel, the user must program the Memory
Address Register to a valid address and then write a one to the Error Clear bit in the Control
Register (CR.ECLR). If the Transfer Error interrupt is enabled, an interrupt request will be gener-
ated when a transfer error occurs.
285
32072H–AVR32–10/2012
AT32UC3A3
The channels are mapped as shown in Table 18-1. Each channel has a set of configuration reg-
isters, shown in Table 18-2, where n is the channel number.
Note: 1. The reset values are device specific. Please refer to the Module Configuration section at the
end of this chapter.
286
32072H–AVR32–10/2012
AT32UC3A3
Note: 1. The number of performance monitors is device specific. If the device has only one perfor-
mance monitor, the Channel1 registers are not available. Please refer to the Module
Configuration section at the end of this chapter for the number of performance monitors on this
device.
Note: 1. The reset values are device specific. Please refer to the Module Configuration section at the end of this chapter.
287
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
MADDR[31:24]
23 22 21 20 19 18 17 16
MADDR[23:16]
15 14 13 12 11 10 9 8
MADDR[15:8]
7 6 5 4 3 2 1 0
MADDR[7:0]
288
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
PID
289
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
TCV[15:8]
7 6 5 4 3 2 1 0
TCV[7:0]
290
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
MARV[31:24]
23 22 21 20 19 18 17 16
MARV[23:16]
15 14 13 12 11 10 9 8
MARV[15:8]
7 6 5 4 3 2 1 0
MARV[7:0]
291
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
TCRV[15:8]
7 6 5 4 3 2 1 0
TCRV[7:0]
292
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - ECLR
7 6 5 4 3 2 1 0
- - - - - - TDIS TEN
293
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - SIZE
294
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - TEN
295
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
296
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
297
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
298
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
299
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - MON1CH
23 22 21 20 19 18 17 16
- - MON0CH
15 14 13 12 11 10 9 8
- - - - - - CH1RES CH0RES
7 6 5 4 3 2 1 0
- - CH1OF CH0OF - - CH1EN CH0EN
300
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
DATA[31:24]
23 22 21 20 19 18 17 16
DATA[23:16]
15 14 13 12 11 10 9 8
DATA[15:8]
7 6 5 4 3 2 1 0
DATA[7:0]
301
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
STALL[31:24]
23 22 21 20 19 18 17 16
STALL[23:16]
15 14 13 12 11 10 9 8
STALL[15:8]
7 6 5 4 3 2 1 0
STALL[7:0]
302
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
LAT[15:8]
7 6 5 4 3 2 1 0
LAT[7:0]
303
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
DATA[31:24]
23 22 21 20 19 18 17 16
DATA[23:16]
15 14 13 12 11 10 9 8
DATA[15:8]
7 6 5 4 3 2 1 0
DATA[7:0]
304
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
STALL[31:24]
23 22 21 20 19 18 17 16
STALL[23:16]
15 14 13 12 11 10 9 8
STALL[15:8]
7 6 5 4 3 2 1 0
STALL[7:0]
305
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
LAT[15:8]
7 6 5 4 3 2 1 0
LAT[7:0]
306
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
DATA[31:24]
23 22 21 20 19 18 17 16
DATA[23:16]
15 14 13 12 11 10 9 8
DATA[15:8]
7 6 5 4 3 2 1 0
DATA[7:0]
307
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
STALL[31:24]
23 22 21 20 19 18 17 16
STALL[23:16]
15 14 13 12 11 10 9 8
STALL[15:8]
7 6 5 4 3 2 1 0
STALL[7:0]
308
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
LAT[15:8]
7 6 5 4 3 2 1 0
LAT[7:0]
309
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
DATA[31:24]
23 22 21 20 19 18 17 16
DATA[23:16]
15 14 13 12 11 10 9 8
DATA[15:8]
7 6 5 4 3 2 1 0
DATA[7:0]
310
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
STALL[31:24]
23 22 21 20 19 18 17 16
STALL[23:16]
15 14 13 12 11 10 9 8
STALL[15:8]
7 6 5 4 3 2 1 0
STALL[7:0]
311
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
LAT[15:8]
7 6 5 4 3 2 1 0
LAT[7:0]
312
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - VARIANT
15 14 13 12 11 10 9 8
- - - - VERSION[11:8]
7 6 5 4 3 2 1 0
VERSION[7:0]
313
32072H–AVR32–10/2012
AT32UC3A3
314
32072H–AVR32–10/2012
AT32UC3A3
315
32072H–AVR32–10/2012
AT32UC3A3
19.1 Features
• 2 HSB Master Interfaces
• 4 Channels
• Software and Hardware Handshaking Interfaces
– 8 Hardware Handshaking Interfaces
• Memory/Non-Memory Peripherals to Memory/Non-Memory Peripherals Transfer
• Single-block DMA Transfer
• Multi-block DMA Transfer
– Linked Lists
– Auto-Reloading
– Contiguous Blocks
• DMA Controller is Always the Flow Controller
• Additional Features
– Scatter and Gather Operations
– Channel Locking
– Bus Locking
– FIFO Mode
– Pseudo Fly-by Operation
19.2 Overview
The DMA Controller (DMACA) is an HSB-central DMA controller core that transfers data from a
source peripheral to a destination peripheral over one or more System Bus. One channel is
required for each source/destination pair. In the most basic configuration, the DMACA has one
master interface and one channel. The master interface reads the data from a source and writes
it to a destination. Two System Bus transfers are required for each DMA data transfer. This is
also known as a dual-access transfer.
The DMACA is programmed via the HSB slave interface.
316
32072H–AVR32–10/2012
AT32UC3A3
Channel 1
Channel 0
FIFO
HSB Master
HSB Master
I/F
SRC DST
FSM FSM
19.4.3 Clocks
The CLK_DMACA to the DMACA is generated by the Power Manager (PM). Before using the
DMACA, the user must ensure that the DMACA clock is enabled in the power manager.
19.4.4 Interrupts
The DMACA interface has an interrupt line connected to the Interrupt Controller. Handling the
DMACA interrupt requires programming the interrupt controller before configuring the DMACA.
19.4.5 Peripherals
Both the source peripheral and the destination peripheral must be set up correctly prior to the
DMA transfer.
317
32072H–AVR32–10/2012
AT32UC3A3
318
32072H–AVR32–10/2012
AT32UC3A3
Transfer hierarchy: Figure 19-2 on page 319 illustrates the hierarchy between DMACA trans-
fers, block transfers, transactions (single or burst), and System Bus transfers (single or burst) for
non-memory peripherals. Figure 19-3 on page 319 shows the transfer hierarchy for memory.
Block Transfer
Block Block Block
Level
System Bus System Bus System Bus System Bus System Bus
Burst Single Single System Bus
Burst Burst
Transfer Transfer Transfer Transfer Transfer Transfer Level
Block Transfer
Block Block Block
Level
Block: A block of DMACA data. The amount of data (block length) is determined by the flow
controller. For transfers between the DMACA and memory, a block is broken directly into a
sequence of System Bus bursts and single transfers. For transfers between the DMACA and a
non-memory peripheral, a block is broken into a sequence of DMACA transactions (single and
bursts). These are in turn broken into a sequence of System Bus transfers.
Transaction: A basic unit of a DMACA transfer as determined by either the hardware or soft-
ware handshaking interface. A transaction is only relevant for transfers between the DMACA
and a source or destination peripheral if the source or destination peripheral is a non-memory
device. There are two types of transactions: single and burst.
319
32072H–AVR32–10/2012
AT32UC3A3
320
32072H–AVR32–10/2012
AT32UC3A3
Gather is enabled by writing a ‘1’ to the CTLx.SRC_GATHER_EN bit. The CTLx.SINC field
determines if the address is incremented, decremented or remains fixed when a gather bound-
ary is reached. If the CTLx.SINC field indicates a fixed-address control throughout a DMA
transfer, then the CTLx.SRC_GATHER_EN bit is ignored and the gather feature is automatically
disabled.
Note: For multi-block transfers, the counters that keep track of the number of transfer left to
reach a gather/scatter boundary are re-initialized to the source gather count (SGRx.SGC) and
destination scatter count (DSRx.DSC), respectively, at the start of each block transfer.
System Memory
Scatter Increment
0 x 080
321
32072H–AVR32–10/2012
AT32UC3A3
System Memory
Channel locking: Software can program a channel to keep the HSB master interface by locking
the arbitration for the master bus interface for the duration of a DMA transfer, block, or transac-
tion (single or burst).
Bus locking: Software can program a channel to maintain control of the System Bus bus by
asserting hlock for the duration of a DMA transfer, block, or transaction (single or burst). Chan-
nel locking is asserted for the duration of bus locking at a minimum.
FIFO mode: Special mode to improve bandwidth. When enabled, the channel waits until the
FIFO is less than half full to fetch the data from the source peripheral and waits until the FIFO is
greater than or equal to half full to send data to the destination peripheral. Thus, the channel can
transfer the data using System Bus bursts, eliminating the need to arbitrate for the HSB master
interface for each single System Bus transfer. When this mode is not enabled, the channel only
waits until the FIFO can transmit/accept a single System Bus transfer before requesting the
master bus interface.
Pseudo fly-by operation: Typically, it takes two System Bus cycles to complete a transfer, one
for reading the source and one for writing to the destination. However, when the source and des-
tination peripherals of a DMA transfer are on different System Bus layers, it is possible for the
DMACA to fetch data from the source and store it in the channel FIFO at the same time as the
DMACA extracts data from the channel FIFO and writes it to the destination peripheral. This
activity is known as pseudo fly-by operation. For this to occur, the master interface for both
source and destination layers must win arbitration of their HSB layer. Similarly, the source and
destination peripherals must win ownership of their respective master interfaces.
322
32072H–AVR32–10/2012
AT32UC3A3
323
32072H–AVR32–10/2012
AT32UC3A3
324
32072H–AVR32–10/2012
AT32UC3A3
Hclk
DMA Transaction
nDMAREQx
dma_req
dma_ack
325
32072H–AVR32–10/2012
AT32UC3A3
A block descriptor (LLI) consists of following registers, SARx, DARx, LLPx, CTL. These regis-
ters, along with the CFGx register, are used by the DMACA to set up and describe the block
transfer.
CTLx[63..32] CTLx[63..32]
CTLx[31..0] CTLx[31..0]
LLPx(1) LLPx(2)
DARx DARx
326
32072H–AVR32–10/2012
AT32UC3A3
Table 19-1. Programming of Transfer Types and Channel Register Update Method (DMACA State Machine Table)
RELOAD RELOAD_ CTLx,
LLP. LLP_S_EN _SR LLP_D_EN DS LLPx SARx DARx
Transfer Type LOC ( ( ( ( Update Update Update Write
=0 CTLx) CFGx) CTLx) CFGx) Method Method Method Back
1) Single Block or
None, user None
last transfer of Yes 0 0 0 0 None (single) No
reprograms (single)
multi-Block
2) Auto Reload
CTLx,LLPx are
multi-block transfer Auto-
Yes 0 0 0 1 reloaded from Contiguous No
with contiguous Reload
initial values.
SAR
3) Auto Reload
CTLx,LLPx are
multi-block transfer Con-
Yes 0 1 0 0 reloaded from Auto-Reload No
with contiguous tiguous
initial values.
DAR
CTLx,LLPx are
4) Auto Reload Auto-
Yes 0 1 0 1 reloaded from Auto-Reload No
multi-block transfer Reload
initial values.
5) Single Block or
None, user None
last transfer of No 0 0 0 0 None (single) Yes
reprograms (single)
multi-block
CTLx,LLPx
10) Linked List loaded from Linked
No 1 0 1 0 Linked List Yes
multi-block transfer next Linked List List
item
327
32072H–AVR32–10/2012
AT32UC3A3
328
32072H–AVR32–10/2012
AT32UC3A3
programmed to zero in the end of block interrupt service routine that services the next-to-last
block transfer. This puts the DMACA into Row 1 state.
For rows 6, 8, and 10 (both CFGx.RELOAD_SR and CFGx.RELOAD_DS cleared) the user must
setup the last block descriptor in memory such that both LLI.CTLx.LLP_S_EN and
LLI.CTLx.LLP_D_EN are zero. If the LLI.LLPx register of the last block descriptor in memory is
non-zero, then the DMA transfer is terminated in Row 5. If the LLI.LLPx register of the last block
descriptor in memory is zero, then the DMA transfer is terminated in Row 1.
For rows 7 and 9, the end-of-block interrupt service routine that services the next-to-last block
transfer should clear the CFGx.RELOAD_SR and CFGx.RELOAD_DS reload bits. The last
block descriptor in memory should be set up so that both the LLI.CTLx.LLP_S_EN and
LLI.CTLx.LLP_D_EN are zero. If the LLI.LLPx register of the last block descriptor in memory is
non-zero, then the DMA transfer is terminated in Row 5. If the LLI.LLPx register of the last block
descriptor in memory is zero, then the DMA transfer is terminated in Row 1.
Note: The only allowed transitions between the rows of Table 19-1 on page 327are from any row into
row 1 or row 5. As already stated, a transition into row 1 or row 5 is used to terminate the DMA
transfer. All other transitions between rows are not allowed. Software must ensure that illegal tran-
sitions between rows do not occur between blocks of a multi-block transfer. For example, if block N
is in row 10 then the only allowed rows for block N + 1 are rows 10, 5 or 1.
329
32072H–AVR32–10/2012
AT32UC3A3
19.10.1.2 Multi-block Transfer with Linked List for Source and Linked List for Destination (Row 10)
1. Read the Channel Enable register to choose a free (disabled) channel.
2. Set up the chain of Linked List Items (otherwise known as block descriptors) in memory.
Write the control information in the LLI.CTLx register location of the block descriptor for
each LLI in memory (see Figure 19-7 on page 326) for channel x. For example, in the
register, you can program the following:
a. Set up the transfer type (memory or non-memory peripheral for source and desti-
nation) and flow control device by programming the TT_FC of the CTLx register.
b. Set up the transfer characteristics, such as:
– i. Transfer width for the source in the SRC_TR_WIDTH field.
– ii. Transfer width for the destination in the DST_TR_WIDTH field.
– iii. Source master layer in the SMS field where source resides.
– iv. Destination master layer in the DMS field where destination resides.
– v. Incrementing/decrementing or fixed address for source in SINC field.
– vi. Incrementing/decrementing or fixed address for destination DINC field.
3. Write the channel configuration information into the CFGx register for channel x.
330
32072H–AVR32–10/2012
AT32UC3A3
a. Designate the handshaking interface type (hardware or software) for the source
and destination peripherals. This is not required for memory. This step requires pro-
gramming the HS_SEL_SRC/HS_SEL_DST bits, respectively. Writing a ‘0’
activates the hardware handshaking interface to handle source/destination
requests for the specific channel. Writing a ‘1’ activates the software handshaking
interface to handle source/destination requests.
b. If the hardware handshaking interface is activated for the source or destination
peripheral, assign the handshaking interface to the source and destination periph-
eral. This requires programming the SRC_PER and DEST_PER bits, respectively.
4. Make sure that the LLI.CTLx register locations of all LLI entries in memory (except the
last) are set as shown in Row 10 of Table 19-1 on page 327. The LLI.CTLx register of
the last Linked List Item must be set as described in Row 1 or Row 5 of Table 19-1 on
page 327. Figure 19-9 on page 333 shows a Linked List example with two list items.
5. Make sure that the LLI.LLPx register locations of all LLI entries in memory (except the
last) are non-zero and point to the base address of the next Linked List Item.
6. Make sure that the LLI.SARx/LLI.DARx register locations of all LLI entries in memory
point to the start source/destination block address preceding that LLI fetch.
7. Make sure that the LLI.CTLx.DONE field of the LLI.CTLx register locations of all LLI
entries in memory are cleared.
8. Clear any pending interrupts on the channel from the previous DMA transfer by writing
to the Interrupt Clear registers: ClearTfr, ClearBlock, ClearSrcTran, ClearDstTran,
ClearErr. Reading the Interrupt Raw Status and Interrupt Status registers confirms that
all interrupts have been cleared.
9. Program the CTLx, CFGx registers according to Row 10 as shown in Table 19-1 on
page 327.
10. Program the LLPx register with LLPx(0), the pointer to the first Linked List item.
11. Finally, enable the channel by writing a ‘1’ to the ChEnReg.CH_EN bit. The transfer is
performed.
12. The DMACA fetches the first LLI from the location pointed to by LLPx(0).
Note: The LLI.SARx, LLI. DARx, LLI.LLPx and LLI.CTLx registers are fetched. The DMACA automati-
cally reprograms the SARx, DARx, LLPx and CTLx channel registers from the LLPx(0).
13. Source and destination request single and burst DMA transactions to transfer the block
of data (assuming non-memory peripheral). The DMACA acknowledges at the comple-
tion of every transaction (burst and single) in the block and carry out the block transfer.
Note: Table 19-1 on page 327
14. The DMACA does not wait for the block interrupt to be cleared, but continues fetching
the next LLI from the memory location pointed to by current LLPx register and automat-
ically reprograms the SARx, DARx, LLPx and CTLx channel registers. The DMA
transfer continues until the DMACA determines that the CTLx and LLPx registers at the
end of a block transfer match that described in Row 1 or Row 5 of Table 19-1 on page
327. The DMACA then knows that the previous block transferred was the last block in
the DMA transfer. The DMA transfer might look like that shown in Figure 19-8 on page
332.
331
32072H–AVR32–10/2012
AT32UC3A3
Figure 19-8. Multi-Block with Linked List Address for Source and Destination
Address of Address of
Source Layer Destination Layer
Block 2 Block 2
SAR(2) DAR(2)
Block 1 Block 1
SAR(1) DAR(1)
Block 0 Block 0
SAR(0) DAR(0)
If the user needs to execute a DMA transfer where the source and destination address are con-
tiguous but the amount of data to be transferred is greater than the maximum block size
CTLx.BLOCK_TS, then this can be achieved using the type of multi-block transfer as shown in
Figure 19-9 on page 333.
332
32072H–AVR32–10/2012
AT32UC3A3
Figure 19-9. Multi-Block with Linked Address for Source and Destination Blocks are
Contiguous
Address of Address of
Source Layer Destination Layer
Block 2
DAR(3)
Block 2
Block 2
SAR(3) DAR(2)
Block 2 Block 1
SAR(2) DAR(1)
Block 1
Block 0
SAR(1) DAR(0)
Block 0
SAR(0)
333
32072H–AVR32–10/2012
AT32UC3A3
Figure 19-10. DMA Transfer Flow for Source and Destination Linked List Address
Channel enabled by
software
LLI Fetch
Hardware reprograms
SARx, DARx, CTLx, LLPx
Source/destination
status fetch
Is DMAC in
Row1 of no
DMAC State Machine Table?
Channel Disabled by
hardware
19.10.1.3 Multi-block Transfer with Source Address Auto-reloaded and Destination Address Auto-reloaded (Row 4)
1. Read the Channel Enable register to choose an available (disabled) channel.
2. Clear any pending interrupts on the channel from the previous DMA transfer by writing
to the Interrupt Clear registers: ClearTfr, ClearBlock, ClearSrcTran, ClearDstTran,
ClearErr. Reading the Interrupt Raw Status and Interrupt Status registers confirms that
all interrupts have been cleared.
3. Program the following channel registers:
334
32072H–AVR32–10/2012
AT32UC3A3
a. Write the starting source address in the SARx register for channel x.
b. Write the starting destination address in the DARx register for channel x.
c. Program CTLx and CFGx according to Row 4 as shown in Table 19-1 on page 327.
Program the LLPx register with ‘0’.
d. Write the control information for the DMA transfer in the CTLx register for channel
x. For example, in the register, you can program the following:
– i. Set up the transfer type (memory or non-memory peripheral for source and
destination) and flow control device by programming the TT_FC of the CTLx register.
– ii. Set up the transfer characteristics, such as:
– Transfer width for the source in the SRC_TR_WIDTH field.
– Transfer width for the destination in the DST_TR_WIDTH field.
– Source master layer in the SMS field where source resides.
– Destination master layer in the DMS field where destination resides.
– Incrementing/decrementing or fixed address for source in SINC field.
– Incrementing/decrementing or fixed address for destination in DINC field.
e. Write the channel configuration information into the CFGx register for channel x.
Ensure that the reload bits, CFGx. RELOAD_SR and CFGx.RELOAD_DS are
enabled.
– i. Designate the handshaking interface type (hardware or software) for the source
and destination peripherals. This is not required for memory. This step requires
programming the HS_SEL_SRC/HS_SEL_DST bits, respectively. Writing a ‘0’
activates the hardware handshaking interface to handle source/destination requests
for the specific channel. Writing a ‘1’ activates the software handshaking interface to
handle source/destination requests.
– ii. If the hardware handshaking interface is activated for the source or destination
peripheral, assign handshaking interface to the source and destination peripheral.
This requires programming the SRC_PER and DEST_PER bits, respectively.
4. After the DMACA selected channel has been programmed, enable the channel by writ-
ing a ‘1’ to the ChEnReg.CH_EN bit. Make sure that bit 0 of the DmaCfgReg register is
enabled.
5. Source and destination request single and burst DMACA transactions to transfer the
block of data (assuming non-memory peripherals). The DMACA acknowledges on com-
pletion of each burst/single transaction and carry out the block transfer.
6. When the block transfer has completed, the DMACA reloads the SARx, DARx and
CTLx registers. Hardware sets the Block Complete interrupt. The DMACA then sam-
ples the row number as shown in Table 19-1 on page 327. If the DMACA is in Row 1,
then the DMA transfer has completed. Hardware sets the transfer complete interrupt
and disables the channel. So you can either respond to the Block Complete or Transfer
Complete interrupts, or poll for the Channel Enable (ChEnReg.CH_EN) bit until it is dis-
abled, to detect when the transfer is complete. If the DMACA is not in Row 1, the next
step is performed.
7. The DMA transfer proceeds as follows:
a. If interrupts are enabled (CTLx.INT_EN = 1) and the block complete interrupt is un-
masked (MaskBlock[x] = 1’b1, where x is the channel number) hardware sets the
block complete interrupt when the block transfer has completed. It then stalls until
the block complete interrupt is cleared by software. If the next block is to be the last
block in the DMA transfer, then the block complete ISR (interrupt service routine)
335
32072H–AVR32–10/2012
AT32UC3A3
Figure 19-11. Multi-Block DMA Transfer with Source and Destination Address Auto-reloaded
Address of Address of
Source Layer Destination Layer
Block0
Block1
Block2
SAR DAR
BlockN
336
32072H–AVR32–10/2012
AT32UC3A3
Figure 19-12. DMA Transfer Flow for Source and Destination Address Auto-reloaded
Channel Enabled by
software
Block Transfer
Channel Disabled by
hardware no
CTLx.INT_EN=1
no
&&
MASKBLOCK[x]=1?
yes
19.10.1.4 Multi-block Transfer with Source Address Auto-reloaded and Linked List Destination Address (Row7)
1. Read the Channel Enable register to choose a free (disabled) channel.
2. Set up the chain of linked list items (otherwise known as block descriptors) in memory.
Write the control information in the LLI.CTLx register location of the block descriptor for
each LLI in memory for channel x. For example, in the register you can program the
following:
a. Set up the transfer type (memory or non-memory peripheral for source and desti-
nation) and flow control peripheral by programming the TT_FC of the CTLx register.
b. Set up the transfer characteristics, such as:
– i. Transfer width for the source in the SRC_TR_WIDTH field.
– ii. Transfer width for the destination in the DST_TR_WIDTH field.
– iii. Source master layer in the SMS field where source resides.
– iv. Destination master layer in the DMS field where destination resides.
– v. Incrementing/decrementing or fixed address for source in SINC field.
– vi. Incrementing/decrementing or fixed address for destination DINC field.
337
32072H–AVR32–10/2012
AT32UC3A3
3. Write the starting source address in the SARx register for channel x.
Note: The values in the LLI.SARx register locations of each of the Linked List Items (LLIs) setup up in
memory, although fetched during a LLI fetch, are not used.
4. Write the channel configuration information into the CFGx register for channel x.
a. Designate the handshaking interface type (hardware or software) for the source
and destination peripherals. This is not required for memory. This step requires pro-
gramming the HS_SEL_SRC/HS_SEL_DST bits, respectively. Writing a ‘0’
activates the hardware handshaking interface to handle source/destination
requests for the specific channel. Writing a ‘1’ activates the software handshaking
interface source/destination requests.
b. If the hardware handshaking interface is activated for the source or destination
peripheral, assign handshaking interface to the source and destination peripheral.
This requires programming the SRC_PER and DEST_PER bits, respectively.
5. Make sure that the LLI.CTLx register locations of all LLIs in memory (except the last)
are set as shown in Row 7 of Table 19-1 on page 327 while the LLI.CTLx register of the
last Linked List item must be set as described in Row 1 or Row 5 of Table 19-1 on page
327. Figure 19-7 on page 326 shows a Linked List example with two list items.
6. Make sure that the LLI.LLPx register locations of all LLIs in memory (except the last)
are non-zero and point to the next Linked List Item.
7. Make sure that the LLI.DARx register location of all LLIs in memory point to the start
destination block address proceeding that LLI fetch.
8. Make sure that the LLI.CTLx.DONE field of the LLI.CTLx register locations of all LLIs in
memory is cleared.
9. Clear any pending interrupts on the channel from the previous DMA transfer by writing
to the Interrupt Clear registers: ClearTfr, ClearBlock, ClearSrcTran, ClearDstTran,
ClearErr. Reading the Interrupt Raw Status and Interrupt Status registers confirms that
all interrupts have been cleared.
10. Program the CTLx, CFGx registers according to Row 7 as shown in Table 19-1 on page
327.
11. Program the LLPx register with LLPx(0), the pointer to the first Linked List item.
12. Finally, enable the channel by writing a ‘1’ to the ChEnReg.CH_EN bit. The transfer is
performed. Make sure that bit 0 of the DmaCfgReg register is enabled.
13. The DMACA fetches the first LLI from the location pointed to by LLPx(0).
Note: The LLI.SARx, LLI.DARx, LLI. LLPx and LLI.CTLx registers are fetched. The LLI.SARx register
although fetched is not used.
14. Source and destination request single and burst DMACA transactions to transfer the
block of data (assuming non-memory peripherals). DMACA acknowledges at the com-
pletion of every transaction (burst and single) in the block and carry out the block
transfer.
15. Table 19-1 on page 327The DMACA reloads the SARx register from the initial value.
Hardware sets the block complete interrupt. The DMACA samples the row number as
shown in Table 19-1 on page 327. If the DMACA is in Row 1 or 5, then the DMA trans-
fer has completed. Hardware sets the transfer complete interrupt and disables the
channel. You can either respond to the Block Complete or Transfer Complete interrupts,
or poll for the Channel Enable (ChEnReg.CH_EN) bit until it is cleared by hardware, to
detect when the transfer is complete. If the DMACA is not in Row 1 or 5 as shown in
Table 19-1 on page 327 the following steps are performed.
16. The DMA transfer proceeds as follows:
a. If interrupts are enabled (CTLx.INT_EN = 1) and the block complete interrupt is un-
masked (MaskBlock[x] = 1’b1, where x is the channel number) hardware sets the
338
32072H–AVR32–10/2012
AT32UC3A3
block complete interrupt when the block transfer has completed. It then stalls until
the block complete interrupt is cleared by software. If the next block is to be the last
block in the DMA transfer, then the block complete ISR (interrupt service routine)
should clear the CFGx.RELOAD_SR source reload bit. This puts the DMACA into
Row1 as shown in Table 19-1 on page 327. If the next block is not the last block in
the DMA transfer, then the source reload bit should remain enabled to keep the
DMACA in Row 7 as shown in Table 19-1 on page 327.
b. If interrupts are disabled (CTLx.INT_EN = 0) or the block complete interrupt is
masked (MaskBlock[x] = 1’b0, where x is the channel number) then hardware does
not stall until it detects a write to the block complete interrupt clear register but
starts the next block transfer immediately. In this case, software must clear the
source reload bit, CFGx.RELOAD_SR, to put the device into Row 1 of Table 19-1
on page 327 before the last block of the DMA transfer has completed.
17. The DMACA fetches the next LLI from memory location pointed to by the current LLPx
register, and automatically reprograms the DARx, CTLx and LLPx channel registers.
Note that the SARx is not re-programmed as the reloaded value is used for the next
DMA block transfer. If the next block is the last block of the DMA transfer then the CTLx
and LLPx registers just fetched from the LLI should match Row 1 or Row 5 of Table 19-
1 on page 327. The DMA transfer might look like that shown in Figure 19-13 on page
339.
Figure 19-13. Multi-Block DMA Transfer with Source Address Auto-reloaded and Linked List
Address of Address of
Source Layer Destination Layer
Block0
DAR(0)
Block1
DAR(1)
SAR Block2
DAR(2)
BlockN
DAR(N)
Destination Address
339
32072H–AVR32–10/2012
AT32UC3A3
Figure 19-14. DMA Transfer Flow for Source Address Auto-reloaded and Linked List Destina-
tion Address
Channel Enabled by
software
LLI Fetch
Hardware reprograms
DARx, CTLx, LLPx
Reload SARx
Block Complete interrupt
generated here
Is DMAC in
yes Row1 or Row5 of
DMAC Transfer Complete
DMAC State Machine Table?
interrupt generated here
Channel Disabled by
no
hardware
CTLx.INT_EN=1 no
&&
MASKBLOCK[X]=1 ?
yes
340
32072H–AVR32–10/2012
AT32UC3A3
19.10.1.5 Multi-block Transfer with Source Address Auto-reloaded and Contiguous Destination Address (Row 3)
1. Read the Channel Enable register to choose a free (disabled) channel.
2. Clear any pending interrupts on the channel from the previous DMA transfer by writing
a ‘1’ to the Interrupt Clear registers: ClearTfr, ClearBlock, ClearSrcTran, ClearDstTran,
ClearErr. Reading the Interrupt Raw Status and Interrupt Status registers confirms that
all interrupts have been cleared.
3. Program the following channel registers:
a. Write the starting source address in the SARx register for channel x.
b. Write the starting destination address in the DARx register for channel x.
c. Program CTLx and CFGx according to Row 3 as shown in Table 19-1 on page 327.
Program the LLPx register with ‘0’.
d. Write the control information for the DMA transfer in the CTLx register for channel
x. For example, in this register, you can program the following:
– i. Set up the transfer type (memory or non-memory peripheral for source and
destination) and flow control device by programming the TT_FC of the CTLx register.
– ii. Set up the transfer characteristics, such as:
– Transfer width for the source in the SRC_TR_WIDTH field.
– Transfer width for the destination in the DST_TR_WIDTH field.
– Source master layer in the SMS field where source resides.
– Destination master layer in the DMS field where destination resides.
– Incrementing/decrementing or fixed address for source in SINC field.
– Incrementing/decrementing or fixed address for destination in DINC field.
e. Write the channel configuration information into the CFGx register for channel x.
– i. Designate the handshaking interface type (hardware or software) for the source
and destination peripherals. This is not required for memory. This step requires
programming the HS_SEL_SRC/HS_SEL_DST bits, respectively. Writing a ‘0’
activates the hardware handshaking interface to handle source/destination requests
for the specific channel. Writing a ‘1’ activates the software handshaking interface to
handle source/destination requests.
– ii. If the hardware handshaking interface is activated for the source or destination
peripheral, assign handshaking interface to the source and destination peripheral.
This requires programming the SRC_PER and DEST_PER bits, respectively.
4. After the DMACA channel has been programmed, enable the channel by writing a ‘1’ to
the ChEnReg.CH_EN bit. Make sure that bit 0 of the DmaCfgReg register is enabled.
5. Source and destination request single and burst DMACA transactions to transfer the
block of data (assuming non-memory peripherals). The DMACA acknowledges at the
completion of every transaction (burst and single) in the block and carries out the block
transfer.
6. When the block transfer has completed, the DMACA reloads the SARx register. The
DARx register remains unchanged. Hardware sets the block complete interrupt. The
DMACA then samples the row number as shown in Table 19-1 on page 327. If the
DMACA is in Row 1, then the DMA transfer has completed. Hardware sets the transfer
complete interrupt and disables the channel. So you can either respond to the Block
Complete or Transfer Complete interrupts, or poll for the Channel Enable (ChEn-
341
32072H–AVR32–10/2012
AT32UC3A3
Reg.CH_EN) bit until it is cleared by hardware, to detect when the transfer is complete.
If the DMACA is not in Row 1, the next step is performed.
7. The DMA transfer proceeds as follows:
a. If interrupts are enabled (CTLx.INT_EN = 1) and the block complete interrupt is un-
masked (MaskBlock[x] = 1’b1, where x is the channel number) hardware sets the
block complete interrupt when the block transfer has completed. It then stalls until
the block complete interrupt is cleared by software. If the next block is to be the last
block in the DMA transfer, then the block complete ISR (interrupt service routine)
should clear the source reload bit, CFGx.RELOAD_SR. This puts the DMACA into
Row1 as shown in Table 19-1 on page 327. If the next block is not the last block in
the DMA transfer then the source reload bit should remain enabled to keep the
DMACA in Row3 as shown in Table 19-1 on page 327.
b. If interrupts are disabled (CTLx.INT_EN = 0) or the block complete interrupt is
masked (MaskBlock[x] = 1’b0, where x is the channel number) then hardware does
not stall until it detects a write to the block complete interrupt clear register but
starts the next block transfer immediately. In this case software must clear the
source reload bit, CFGx.RELOAD_SR, to put the device into ROW 1 of Table 19-1
on page 327 before the last block of the DMA transfer has completed.
The transfer is similar to that shown in Figure 19-15 on page 342.
The DMA Transfer flow is shown in Figure 19-16 on page 343.
Figure 19-15. Multi-block Transfer with Source Address Auto-reloaded and Contiguous Desti-
nation Address
Address of Address of
Source Layer Destination Layer
Block2
DAR(2)
Block1
DAR(1)
Block0
SAR
DAR(0)
342
32072H–AVR32–10/2012
AT32UC3A3
Figure 19-16. DMA Transfer for Source Address Auto-reloaded and Contiguous Destination
Address
Channel Enabled by
software
Block Transfer
Channel Disabled by no
hardware
CTLx.INT_EN=1
no
&&
MASKBLOCK[x]=1?
yes
19.10.1.6 Multi-block DMA Transfer with Linked List for Source and Contiguous Destination Address (Row 8)
1. Read the Channel Enable register to choose a free (disabled) channel.
2. Set up the linked list in memory. Write the control information in the LLI. CTLx register
location of the block descriptor for each LLI in memory for channel x. For example, in
the register, you can program the following:
a. Set up the transfer type (memory or non-memory peripheral for source and desti-
nation) and flow control device by programming the TT_FC of the CTLx register.
b. Set up the transfer characteristics, such as:
– i. Transfer width for the source in the SRC_TR_WIDTH field.
– ii. Transfer width for the destination in the DST_TR_WIDTH field.
– iii. Source master layer in the SMS field where source resides.
– iv. Destination master layer in the DMS field where destination resides.
343
32072H–AVR32–10/2012
AT32UC3A3
344
32072H–AVR32–10/2012
AT32UC3A3
5 of Table 19-1 on page 327. The DMACA then knows that the previous block trans-
ferred was the last block in the DMA transfer.
The DMACA transfer might look like that shown in Figure 19-17 on page 345 Note that the des-
tination address is decrementing.
Figure 19-17. DMA Transfer with Linked List Source Address and Contiguous Destination
Address
Address of Address of
Source Layer Destination Layer
Block 2
SAR(2) Block 2
DAR(2)
Block 1 Block 1
SAR(1) DAR(1)
Block 0
Block 0 DAR(0)
SAR(0)
Figure 19-18.
345
32072H–AVR32–10/2012
AT32UC3A3
Figure 19-19. DMA Transfer Flow for Source Address Auto-reloaded and Contiguous Destination Address
Channel Enabled by
software
LLI Fetch
Hardware reprograms
SARx, CTLx, LLPx
Source/destination
status fetch
Is DMAC in no
Row 1 of Table 4 ?
Channel Disabled by
hardware
346
32072H–AVR32–10/2012
AT32UC3A3
3. The ChEnReg.CH_EN bit can then be cleared by software once the channel FIFO is
empty.
When CTLx.SRC_TR_WIDTH is less than CTLx.DST_TR_WIDTH and the CFGx.CH_SUSP bit
is high, the CFGx.FIFO_EMPTY is asserted once the contents of the FIFO do not permit a single
word of CTLx.DST_TR_WIDTH to be formed. However, there may still be data in the channel
FIFO but not enough to form a single transfer of CTLx.DST_TR_WIDTH width. In this configura-
tion, once the channel is disabled, the remaining data in the channel FIFO are not transferred to
the destination peripheral. It is permitted to remove the channel from the suspension state by
writing a ‘0’ to the CFGx.CH_SUSP register. The DMA transfer completes in the normal manner.
Note: If a channel is disabled by software, an active single or burst transaction is not guaranteed to
receive an acknowledgement.
347
32072H–AVR32–10/2012
AT32UC3A3
348
32072H–AVR32–10/2012
AT32UC3A3
349
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
SADD[31:24]
23 22 21 20 19 18 17 16
SADD[23:16]
15 14 13 12 11 10 9 8
SADD[15:8]
7 6 5 4 3 2 1 0
SADD[7:0]
350
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
DADD[31:24]
23 22 21 20 19 18 17 16
DADD[23:16]
15 14 13 12 11 10 9 8
DADD[15:8]
7 6 5 4 3 2 1 0
DADD[7:0]
351
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
LOC[29:22]
23 22 21 20 19 18 17 16
LOC[21:14]
15 14 13 12 11 10 9 8
LOC[13:6]
7 6 5 4 3 2 1 0
LOC[5:0] LMS
352
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
LLP_SRC_E LLP_DST_E
SMS DMS[1]
N N
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
This register contains fields that control the DMA transfer. The CTLxL register is part of the block descriptor (linked list item)
when block chaining is enabled. It can be varied on a block-by-block basis within a DMA transfer when block chaining is
enabled.
• LLP_SRC_EN
Block chaining is only enabled on the source side if the LLP_SRC_EN field is high and LLPx.LOC is non-zero.
• LLP_DST_EN
Block chaining is only enabled on the destination side if the LLP_DST_EN field is high and LLPx.LOC is non-zero.
• SMS: Source Master Select
Identifies the Master Interface layer where the source device (peripheral or memory) is accessed from
353
32072H–AVR32–10/2012
AT32UC3A3
354
32072H–AVR32–10/2012
AT32UC3A3
Source Address
SINC Increment
0 Increment
1 Decrement
Other No change
Destination Address
DINC Increment
0 Increment
1 Decrement
Other No change
355
32072H–AVR32–10/2012
AT32UC3A3
356
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - DONE BLOCK_TS[11:8]
7 6 5 4 3 2 1 0
BLOCK_TS[7:0]
357
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
RELOAD_D RELOAD_S - - - - - -
ST RC
23 22 21 20 19 18 17 16
- - - - SRC_HS_P DST_HS_PO - -
OL L
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
CH_PRIOR - - - - -
358
32072H–AVR32–10/2012
AT32UC3A3
359
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- DEST_PER SRC_PER[3:1]
7 6 5 4 3 2 1 0
360
32072H–AVR32–10/2012
AT32UC3A3
361
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
SGC[11:4]
23 22 21 20 19 18 17 16
SGC[3:0] SGI[19:16]
15 14 13 12 11 10 9 8
SGI[15:8]
7 6 5 4 3 2 1 0
SGI[7:0]
362
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
DSC[11:4]
23 22 21 20 19 18 17 16
DSC[3:0] DSI[19:16]
15 14 13 12 11 10 9 8
DSI[15:8]
7 6 5 4 3 2 1 0
DSI[7:0]
363
32072H–AVR32–10/2012
AT32UC3A3
364
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
365
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
• STATUS[3:0]
All interrupt events from all channels are stored in these Interrupt Status Registers after masking: StatusTfr, StatusBlock,
StatusSrcTran, StatusDstTran, StatusErr. Each Interrupt Status register has a bit allocated per channel, for example, Sta-
tusTfr[2] is Channel 2’s status transfer complete interrupt.The contents of these registers are used to generate the interrupt
signals leaving the DMACA.
366
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
The contents of the Raw Status Registers are masked with the contents of the Mask Registers: MaskTfr, MaskBlock, Mask-
SrcTran, MaskDstTran, MaskErr. Each Interrupt Mask register has a bit allocated per channel, for example, MaskTfr[2] is
the mask bit for Channel 2’s transfer complete interrupt.
A channel’s INT_MASK bit is only written if the corresponding mask write enable bit in the INT_MASK_WE field is asserted
on the same System Bus write transfer. This allows software to set a mask bit without performing a read-modified write
operation.
For example, writing hex 01x1 to the MaskTfr register writes a 1 into MaskTfr[0], while MaskTfr[7:1] remains unchanged.
Writing hex 00xx leaves MaskTfr[7:0] unchanged.
Writing a 1 to any bit in these registers unmasks the corresponding interrupt, thus allowing the DMACA to set the appropri-
ate bit in the Status Registers.
• INT_M_WE[11:8]: Interrupt Mask Write Enable
0 = Write disabled
1 = Write enabled
• INT_MASK[3:0]: Interrupt Mask
0= Masked
1 = Unmasked
367
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
368
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
The contents of each of the five Status Registers (StatusTfr, StatusBlock, StatusSrcTran, StatusDstTran, StatusErr) is
OR’ed to produce a single bit per interrupt type in the Combined Status Register (StatusInt).
• ERR
OR of the contents of StatusErr Register.
• DSTT
OR of the contents of StatusDstTran Register.
• SRCT
OR of the contents of StatusSrcTran Register.
• BLOCK
OR of the contents of StatusBlock Register.
• TFR
OR of the contents of StatusTfr Register.
369
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
A bit is assigned for each channel in this register. ReqSrcReg[n] is ignored when software handshaking is not enabled for
the source of channel n.
A channel SRC_REQ bit is written only if the corresponding channel write enable bit in the REQ_WE field is asserted on
the same System Bus write transfer.
For example, writing 0x101 writes a 1 into ReqSrcReg[0], while ReqSrcReg[4:1] remains unchanged. Writing hex 0x0yy
leaves ReqSrcReg[4:0] unchanged. This allows software to set a bit in the ReqSrcReg register without performing a read-
modified write
• REQ_WE[11:8]: Request write enable
0 = Write disabled
1 = Write enabled
• SRC_REQ[3:0]: Source request
370
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
A bit is assigned for each channel in this register. ReqDstReg[n] is ignored when software handshaking is not enabled for
the source of channel n.
A channel DST_REQ bit is written only if the corresponding channel write enable bit in the REQ_WE field is asserted on the
same System Bus write transfer.
• REQ_WE[11:8]: Request write enable
0 = Write disabled
1 = Write enabled
• DST_REQ[3:0]: Destination request
371
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
A bit is assigned for each channel in this register. SglReqSrcReg[n] is ignored when software handshaking is not enabled
for the source of channel n.
A channel S_SG_REQ bit is written only if the corresponding channel write enable bit in the REQ_WE field is asserted on
the same System Bus write transfer.
• REQ_WE[11:8]: Request write enable
0 = Write disabled
1 = Write enabled
• S_SG_REQ[3:0]: Source single request
372
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
A bit is assigned for each channel in this register. SglReqDstReg[n] is ignored when software handshaking is not enabled
for the source of channel n.
A channel D_SG_REQ bit is written only if the corresponding channel write enable bit in the REQ_WE field is asserted on
the same System Bus write transfer.
• REQ_WE[11:8]: Request write enable
0 = Write disabled
1 = Write enabled
• D_SG_REQ[3:0]: Destination single request
373
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
A bit is assigned for each channel in this register. LstSrcReg[n] is ignored when software handshaking is not enabled for
the source of channel n.
A channel LSTSRC bit is written only if the corresponding channel write enable bit in the LSTSRC_WE field is asserted on
the same System Bus write transfer.
• LSTSRC_WE[11:8]: Source Last Transaction request write enable
0 = Write disabled
1 = Write enabled
• LSTSRC[3:0]: Source Last Transaction request
374
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
A bit is assigned for each channel in this register. LstDstReg[n] is ignored when software handshaking is not enabled for
the source of channel n.
A channel LSTDST bit is written only if the corresponding channel write enable bit in the LSTDST_WE field is asserted on
the same System Bus write transfer.
• LSTDST_WE[11:8]: Destination Last Transaction request write enable
0 = Write disabled
1 = Write enabled
• LSTDST[3:0]: Destination Last Transaction request
375
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - DMA_EN
376
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
377
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
DMA_COMP_TYPE[31:24]
23 22 21 20 19 18 17 16
DMA_COMP_TYPE[23:16]
15 14 13 12 11 10 9 8
DMA_COMP_TYPE[15:8]
7 6 5 4 3 2 1 0
DMA_COMP_TYPE[7:0]
• DMA_COMP_TYPE
DesignWare component type number = 0x44571110.
This assigned unique hex value is constant and is derived from the two ASCII letters “DW” followed by a 32-bit unsigned
number
378
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
DMA_COMP_VERSION[31:24]
23 22 21 20 19 18 17 16
DMA_COMP_VERSION[23:16]
15 14 13 12 11 10 9 8
DMA_COMP_VERSION[15:8]
7 6 5 4 3 2 1 0
DMA_COMP_VERSION[7:0]
379
32072H–AVR32–10/2012
AT32UC3A3
380
32072H–AVR32–10/2012
AT32UC3A3
20.1 Features
Each I/O line of the GPIO features:
• Configurable pin-change, rising-edge or falling-edge interrupt on any I/O line
• A glitch filter providing rejection of pulses shorter than one clock cycle
• Input visibility and output control
• Multiplexing of up to four peripheral functions per I/O line
• Programmable internal pull-up resistor
20.2 Overview
The General Purpose Input/Output Controller manages the I/O pins of the microcontroller. Each
I/O line may be dedicated as a general-purpose I/O or be assigned to a function of an embedded
peripheral. This assures effective optimization of the pins of a product.
PIN
General Purpose
MCU
Input/Output - GPIO PIN
I/O Pins
CLK_GPIO PIN
Power Manager
PIN
381
32072H–AVR32–10/2012
AT32UC3A3
20.4.2 Clocks
The clock for the GPIO bus interface (CLK_GPIO) is generated by the Power Manager. This
clock is enabled at reset, and can be disabled in the Power Manager.
The CLK_GPIO must be enabled in order to access the configuration registers of the GPIO or to
use the GPIO interrupts. After configuring the GPIO, the CLK_GPIO can be disabled if interrupts
are not used.
20.4.3 Interrupts
The GPIO interrupt lines are connected to the interrupt controller. Using the GPIO interrupt
requires the interrupt controller to be configured first.
382
32072H–AVR32–10/2012
AT32UC3A3
PUER
1
PMR1
GPER
PMR0
1
OVR
Edge Detector
1
1
Glitch Filter
Interrupt Request
0
IMR1
GFER IMR0
383
32072H–AVR32–10/2012
AT32UC3A3
responding I/O line is driven by the GPIO. When the bit is written to zero, the GPIO does not
drive the line.
The level driven on an I/O line can be determined by writing to the Output Value Register (OVR).
20.5.1.4 Inputs
The level on each I/O line can be read through the Pin Value Register (PVR). This register indi-
cates the level of the I/O lines regardless of whether the lines are driven by the GPIO or by an
external component. Note that due to power saving measures, the PVR register can only be
read when GPER is written to one for the corresponding pin or if interrupt is enabled for the pin.
CLK_GPIO
PVR
384
32072H–AVR32–10/2012
AT32UC3A3
20.5.3 Interrupts
The GPIO can be configured to generate an interrupt when it detects an input change on an I/O
line. The module can be configured to signal an interrupt whenever a pin changes value or only
to trigger on rising edges or falling edges. Interrupts are enabled on a pin by writing a one to the
corresponding bit in the Interrupt Enable Register (IER). The interrupt mode is set by writing to
the Interrupt Mode Register 0 (IMR0) and the Interrupt Mode Register 1(IMR1). Interrupts can be
enabled on a pin, regardless of the configuration of the I/O line, i.e. whether it is controlled by the
GPIO or assigned to a peripheral function.
In every port there are four interrupt lines connected to the interrupt controller. Groups of eight
interrupts in the port are ORed together to form an interrupt line.
When an interrupt event is detected on an I/O line, and the corresponding bit in IER is written to
one, the GPIO interrupt request line is asserted. A number of interrupt signals are ORed-wired
together to generate a single interrupt signal to the interrupt controller.
The Interrupt Flag Register (IFR) can by read to determine which pin(s) caused the interrupt.
The interrupt bit must be cleared by writing a one to the Interrupt Flag Clear Register (IFRC). To
take effect, the clear operation must be performed when the interrupt line is enabled in IER. Oth-
erwise, it will be ignored.
GPIO interrupts can only be triggered when the CLK_GPIO is enabled.
clock
Pin Level
GPIO_IFR
The figure below shows the timing for rising edge (or pin-change) interrupts when the glitch filter
is enabled. For the pulse to be registered, it must be sampled on two subsequent rising edges.
In the example, the first pulse is rejected while the second pulse is accepted and causes an
interrupt request.
clock
Pin Level
GPIO_IFR
385
32072H–AVR32–10/2012
AT32UC3A3
The GPIO controls all the I/O pins on the AVR32 microcontroller. The pins are managed as 32-
bit ports that are configurable through a PB interface. Each port has a set of configuration regis-
ters. The overall memory map of the GPIO is shown below. The number of pins and hence the
number of ports are product specific.
0x0000
0x0100
0x0200
0x0300
0x0400
In the GPIO Controller Function Multiplexingtable in the Package and Pinout chapter, each
GPIO line has a unique number. Note that the PA, PB, PC and PX ports do not directly corre-
spond to the GPIO ports. To find the corresponding port and pin the following formula can be
used:
GPIO port = floor((GPIO number) / 32), example: floor((36)/32) = 1
GPIO pin = GPIO number mod 32, example: 36 mod 32 = 4
The table below shows the configuration registers for one port. Addresses shown are relative to
the port address offset. The specific address of a configuration register is found by adding the
386
32072H–AVR32–10/2012
AT32UC3A3
register offset and the port offset to the GPIO start address. One bit in each of the configuration
registers corresponds to an I/O pin.
387
32072H–AVR32–10/2012
AT32UC3A3
1) The reset value for these registers are device specific. Please refer to the Module Config-
uration section at the end of this chapter.
2) The reset value is undefined depending on the pin states.
388
32072H–AVR32–10/2012
AT32UC3A3
25 24
31 30 29 28 27 26
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
389
32072H–AVR32–10/2012
AT32UC3A3
25 24
31 30 29 28 27 26
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
390
32072H–AVR32–10/2012
AT32UC3A3
25 24
31 30 29 28 27 26
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
391
32072H–AVR32–10/2012
AT32UC3A3
25 24
31 30 29 28 27 26
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
392
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
393
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
394
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
395
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
396
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
397
32072H–AVR32–10/2012
AT32UC3A3
25 24
31 30 29 28 27 26
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
398
32072H–AVR32–10/2012
AT32UC3A3
25 24
31 30 29 28 27 26
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
399
32072H–AVR32–10/2012
AT32UC3A3
25 24
31 30 29 28 27 26
P31 P30 P29 P28 P27 P26 P25 P24
23 22 21 20 19 18 17 16
P23 P22 P21 P20 P19 P18 P17 P16
15 14 13 12 11 10 9 8
P15 P14 P13 P12 P11 P10 P9 P8
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
The number of interrupt request lines is dependant on the number of I/O pins on the MCU. Refer to the product specific data for
details. Note also that a bit in the Interrupt Flag register is only valid if the corresponding bit in IER is set.
400
32072H–AVR32–10/2012
AT32UC3A3
loop:
// Only change 8 LSB
mov R3, 0x00FF
and R3, R2
st.w R0[AVR32_GPIO_OVRT], R3
rol R2
rcall delay
rjmp loop
It is assumed in this example that a subroutine "delay" exists that returns after a given time.
401
32072H–AVR32–10/2012
AT32UC3A3
402
32072H–AVR32–10/2012
AT32UC3A3
The reset values for all GPIO registers are zero with the following exceptions:
403
32072H–AVR32–10/2012
AT32UC3A3
21.1 Features
• Compatible with an embedded 32-bit microcontroller
• Supports communication with serial external devices
– Four chip selects with external decoder support allow communication with up to 15
peripherals
– Serial memories, such as DataFlash and 3-wire EEPROMs
– Serial peripherals, such as ADCs, DACs, LCD controllers, CAN controllers and Sensors
– External co-processors
• Master or Slave Serial Peripheral Bus Interface
– 4 - to 16-bit programmable data length per chip select
– Programmable phase and polarity per chip select
– Programmable transfer delays between consecutive transfers and between clock and data
per chip select
– Programmable delay between consecutive transfers
– Selectable mode fault detection
• Connection to Peripheral DMA Controller channel capabilities optimizes data transfers
– One channel for the receiver, one channel for the transmitter
– Next buffer support
– Four character FIFO in reception
21.2 Overview
The Serial Peripheral Interface (SPI) circuit is a synchronous serial data link that provides com-
munication with external devices in Master or Slave mode. It also enables communication
between processors if an external processor is connected to the system.
The Serial Peripheral Interface is essentially a shift register that serially transmits data bits to
other SPIs. During a data transfer, one SPI system acts as the “master”' which controls the data
flow, while the other devices act as “slaves'' which have data shifted into and out by the master.
Different CPUs can take turn being masters (Multiple Master Protocol opposite to Single Master
Protocol where one CPU is always the master while all of the others are always slaves) and one
master may simultaneously shift data into multiple slaves. However, only one slave may drive its
output to write data back to the master at any given time.
A slave device is selected when the master asserts its NSS signal. If multiple slave devices
exist, the master generates a separate slave select signal for each slave (NPCS).
The SPI system consists of two data lines and two control lines:
• Master Out Slave In (MOSI): this data line supplies the output data from the master shifted
into the input(s) of the slave(s).
• Master In Slave Out (MISO): this data line supplies the output data from a slave to the input of
the master. There may be no more than one slave transmitting data during any particular
transfer.
• Serial Clock (SPCK): this control line is driven by the master and regulates the flow of the
data bits. The master may transmit data at a variety of baud rates; the SPCK line cycles once
for each bit that is transmitted.
• Slave Select (NSS): this control line allows slaves to be turned on and off by hardware.
404
32072H–AVR32–10/2012
AT32UC3A3
Peripheral DMA
Controller
Peripheral Bus
SPCK
MISO
CLK_SPI MOSI
I/O
Spi Interface NPCS0/NSS
Controller
NPCS1
NPCS2
Interrupt Control
NPCS3
SPI Interrupt
SPCK SPCK
MISO MISO
Slave 0
MOSI MOSI
NPCS1
NPCS2 NC SPCK
NPCS3 MISO
Slave 1
MOSI
NSS
SPCK
MISO
Slave 2
MOSI
NSS
405
32072H–AVR32–10/2012
AT32UC3A3
21.6.2 Clocks
The clock for the SPI bus interface (CLK_SPI) is generated by the Power Manager. This clock is
enabled at reset, and can be disabled in the Power Manager. It is recommended to disable the
SPI before disabling the clock, to avoid freezing the SPI in an undefined state.
21.6.3 Interrupts
The SPI interrupt request line is connected to the interrupt controller. Using the SPI interrupt
requires the interrupt controller to be programmed first.
406
32072H–AVR32–10/2012
AT32UC3A3
Figure 21-3 on page 407 and Figure 21-4 on page 408 show examples of data transfers.
SPCK
(CPOL = 0)
SPCK
(CPOL = 1)
NSS
(to slave)
407
32072H–AVR32–10/2012
AT32UC3A3
SPCK
(CPOL = 0)
SPCK
(CPOL = 1)
NSS
(to slave)
408
32072H–AVR32–10/2012
AT32UC3A3
In master mode, if the received data is not read fast enough compared to the transfer rhythm
imposed by the write accesses in the TDR, some overrun errors may occur, even if the FIFO is
enabled. To insure a perfect data integrity of received data (especially at high data rate), the
mode Wait Data Read Before Transfer can be enabled in the MR register (MR.WDRBT). When
this mode is activated, no transfer starts while received data remains unread in the RDR. When
data is written to the TDR and if unread received data is stored in the RDR, the transfer is
paused until the RDR is read. In this mode no overrun error can occur. Please note that if this
mode is enabled, it is useless to activate the FIFO in reception.
Figure 21-5 on page 409shows a block diagram of the SPI when operating in master mode. Fig-
ure 21-6 on page 410 shows a flow chart describing how transfers are handled.
SPI
Clock
RXFIFOEN
RDR RDRF
RD OVRES
CSR0..3
BITS
NCPHA 0
CPOL 1 4 – Character FIFO
TDR
TD TDRE
RXFIFOEN
RDR
CSR0..3
CSNAAT 0
1 4 – Character FIFO
PS CSAAT
MR NPCS3
PCSDEC
PCS
NPCS2
0 Current
Peripheral NPCS1
TDR
PCS
NPCS0
1
MSTR
MODF
NPCS0
MODFDIS
409
32072H–AVR32–10/2012
AT32UC3A3
Fixed
1 0 peripheral
CSAAT ? PS ?
Variable
0 1 peripheral
Fixed
0 peripheral yes
PS ? TDR(PCS) MR(PCS)
= NPCS ? = NPCS ?
Variable
1 peripheral no no
NPCS = TDR(PCS) NPCS = MR(PCS) NPCS = 0xF NPCS = 0xF
Delay DLYBS
Serializer = TDR(TD)
TDRE = 1
Data Transfer
RDR(RD) = Serializer
RDRF = 1
Delay DLYBCT
0
TDRE ?
1
CSAAT ?
NPCS = 0xF
Delay DLYBCS
410
32072H–AVR32–10/2012
AT32UC3A3
Chip Select 1
Chip Select 2
SPCK
DLYBCS DLYBS DLYBCT DLYBCT
411
32072H–AVR32–10/2012
AT32UC3A3
412
32072H–AVR32–10/2012
AT32UC3A3
to an interrupt, and thus might lead to difficulties for interfacing with some serial peripherals
requiring the chip select line to remain active during a full set of transfers.
To facilitate interfacing with such devices, the CSRn registers can be configured with the Chip
Select Active After Transfer bit written to one (CSRn.CSAAT) . This allows the chip select lines
to remain in their current state (low = active) until transfer to another peripheral is required.
When the CSRn.CSAAT bit is written to qero, the NPCS does not rise in all cases between two
transfers on the same peripheral. During a transfer on a Chip Select, the SR.TDRE bit rises as
soon as the content of the TDR is transferred into the internal shifter. When this bit is detected
the 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 might lead to difficulties for interfacing with some
serial peripherals requiring the chip select to be de-asserted after each transfer. To facilitate
interfacing with such devices, the CSRn registers can be configured with the Chip Select Not
Active After Transfer bit (CSRn.CSNAAT) written to one. This allows to de-assert systematically
the chip select lines during a time DLYBCS. (The value of the CSRn.CSNAAT bit is taken into
account only if the CSRn.CSAAT bit is written to zero for the same Chip Select).
Figure 21-8 on page 414 shows different peripheral deselection cases and the effect of the
CSRn.CSAAT and CSRn.CSNAAT bits.
413
32072H–AVR32–10/2012
AT32UC3A3
TDRE
DLYBCT DLYBCT
NPCS[0..3] A A A A A
DLYBCS DLYBCS
PCS = A PCS = A
Write TDR
TDRE
DLYBCT DLYBCT
NPCS[0..3] A A A A A
DLYBCS DLYBCS
PCS=A PCS = A
Write TDR
TDRE
DLYBCT DLYBCT
NPCS[0..3] A B A B
DLYBCS DLYBCS
PCS = B PCS = B
Write TDR
DLYBCT DLYBCT
TDRE
NPCS[0..3] A A A A
DLYBCS
PCS = A PCS = A
Write TDR
Figure 21-8 on page 414 shows different peripheral deselection cases and the effect of the
CSRn.CSAAT and CSRn.CSNAAT bits.
414
32072H–AVR32–10/2012
AT32UC3A3
register (MR.MODFDIS). In systems with open-drain I/O lines, a mode fault is detected when a
low level is driven by an external master on the NPCS0/NSS signal.
When a mode fault is detected, the Mode Fault Error bit in the SR (SR.MODF) is set until the SR
is read and the SPI is automatically disabled until re-enabled by writing a one to the SPI Enable
bit in the CR register (CR.SPIEN).
By default, the mode fault detection circuitry is enabled. The user can disable mode fault detec-
tion by writing a one to the Mode Fault Detection bit in the MR register (MR.MODFDIS).
Figure 21-9 on page 416 shows a block diagram of the SPI when operating in slave mode.
415
32072H–AVR32–10/2012
AT32UC3A3
SPCK
SPI
NSS Clock
SPIEN
SPIENS RXFIFOEN
RDR RDRF
SPIDIS RD OVRES
CSR0
BITS
0
NCPHA 4 - Character FIFO
1
CPOL
TDR UNDES
TD TDRE
416
32072H–AVR32–10/2012
AT32UC3A3
417
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - LASTXFER
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - FLUSHFIFO
7 6 5 4 3 2 1 0
418
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
DLYBCS
23 22 21 20 19 18 17 16
- - - - PCS
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
419
32072H–AVR32–10/2012
AT32UC3A3
0: The FIFO is not used in reception (only one character can be stored in the SPI).
• WDRBT: Wait Data Read Before Transfer
1: In master mode, a transfer can start only if the RDR register is empty, i.e. does not contain any unread data. This mode
prevents overrun error in reception.
0: No Effect. In master mode, a transfer can be initiated whatever the state of the RDR register is.
• MODFDIS: Mode Fault Detection
1: Mode fault detection is disabled. If the I/O controller does not have open-drain capability, mode fault detection must be
disabled for proper operation of the SPI.
0: Mode fault detection is enabled.
• PCSDEC: Chip Select Decode
0: The chip selects are directly connected to a peripheral device.
1: The four chip select lines are connected to a 4- to 16-bit decoder.
When PCSDEC equals one, up to 15 Chip Select signals can be generated with the four lines using an external 4- to 16-bit
decoder. The CSRn registers define the characteristics of the 15 chip selects according to the following rules:
CSR0 defines peripheral chip select signals 0 to 3.
CSR1 defines peripheral chip select signals 4 to 7.
CSR2 defines peripheral chip select signals 8 to 11.
CSR3 defines peripheral chip select signals 12 to 14.
• PS: Peripheral Select
1: Variable Peripheral Select.
0: Fixed Peripheral Select.
• MSTR: Master/Slave Mode
1: SPI is in master mode.
0: SPI is in slave mode.
420
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
RD[15:8]
7 6 5 4 3 2 1 0
RD[7:0]
421
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - LASTXFER
23 22 21 20 19 18 17 16
- - - - PCS
15 14 13 12 11 10 9 8
TD[15:8]
7 6 5 4 3 2 1 0
TD[7:0]
This field is only used if Variable Peripheral Select is active (MR.PS = 1).
• PCS: Peripheral Chip Select
If PCSDEC = 0:
PCS = xxx0NPCS[3:0] = 1110
PCS = xx01NPCS[3:0] = 1101
PCS = x011NPCS[3:0] = 1011
PCS = 0111NPCS[3:0] = 0111
PCS = 1111forbidden (no peripheral is selected)
(x = don’t care)
If PCSDEC = 1:
NPCS[3:0] output signals = PCS
This field is only used if Variable Peripheral Select is active (MR.PS = 1).
• TD: Transmit Data
Data to be transmitted by the SPI Interface is stored in this register. Information to be transmitted must be written to the TDR
register in a right-justified format.
422
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - SPIENS
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
423
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
424
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
425
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
426
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
DLYBCT
23 22 21 20 19 18 17 16
DLYBS
15 14 13 12 11 10 9 8
SCBR
7 6 5 4 3 2 1 0
32 × DLYBCT
Delay Between Consecutive Transfers = ------------------------------------
CLKSPI
• DLYBS: Delay Before SPCK
This field defines the delay from NPCS valid to the first valid SPCK transition.
When DLYBS equals zero, the NPCS valid to SPCK transition is 1/2 the SPCK clock period.
Otherwise, the following equations determine the delay:
DLYBS-
Delay Before SPCK = --------------------
CLKSPI
• SCBR: Serial Clock Baud Rate
In Master Mode, the SPI Interface uses a modulus counter to derive the SPCK baud rate from the CLK_SPI. The Baud rate is
selected by writing a value from 1 to 255 in the SCBR field. The following equations determine the SPCK baud rate:
CLKSPI
SPCK Baudrate = ---------------------
SCBR
Writing the SCBR field to zero is forbidden. Triggering a transfer while SCBR is zero can lead to unpredictable results.
At reset, SCBR is zero and the user has to write it to a valid value before performing the first transfer.
If a clock divider (SCBRn) field is set to one and the other SCBR fields differ from one, access on CSn is correct but no correct
access will be possible on other CS.
427
32072H–AVR32–10/2012
AT32UC3A3
DLYBCS
----------------------- (if DLYBCT field is different from 0)
CLKSPI
DLYBCS + 1- (if DLYBCT field equals 0)
--------------------------------
CLKSPI
• NCPHA: Clock Phase
1: Data is captured after the leading (inactive-to-active) edge of SPCK and changed on the trailing (active-to-inactive) edge of
SPCK.
0: Data is changed on the leading (inactive-to-active) edge of SPCK and captured after the trailing (active-to-inactive) edge of
SPCK.
NCPHA determines which edge of SPCK causes data to change and which edge causes data to be captured. NCPHA is used
with CPOL to produce the required clock/data relationship between master and slave devices.
• CPOL: Clock Polarity
1: The inactive state value of SPCK is logic level one.
0: The inactive state value of SPCK is logic level zero.
428
32072H–AVR32–10/2012
AT32UC3A3
CPOL is used to determine the inactive state value of the serial clock (SPCK). It is used with NCPHA to produce the required
clock/data relationship between master and slave devices.
429
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
DLYBCT
23 22 21 20 19 18 17 16
DLYBS
15 14 13 12 11 10 9 8
SCBR
7 6 5 4 3 2 1 0
32 × DLYBCT
Delay Between Consecutive Transfers = ------------------------------------
CLKSPI
• DLYBS: Delay Before SPCK
This field defines the delay from NPCS valid to the first valid SPCK transition.
When DLYBS equals zero, the NPCS valid to SPCK transition is 1/2 the SPCK clock period.
Otherwise, the following equations determine the delay:
DLYBS-
Delay Before SPCK = --------------------
CLKSPI
• SCBR: Serial Clock Baud Rate
In Master Mode, the SPI Interface uses a modulus counter to derive the SPCK baud rate from the CLK_SPI. The Baud rate is
selected by writing a value from 1 to 255 in the SCBR field. The following equations determine the SPCK baud rate:
CLKSPI
SPCK Baudrate = ---------------------
SCBR
Writing the SCBR field to zero is forbidden. Triggering a transfer while SCBR is zero can lead to unpredictable results.
At reset, SCBR is zero and the user has to write it to a valid value before performing the first transfer.
If a clock divider (SCBRn) field is set to one and the other SCBR fields differ from one, access on CSn is correct but no correct
access will be possible on other CS.
430
32072H–AVR32–10/2012
AT32UC3A3
DLYBCS
----------------------- (if DLYBCT field is different from 0)
CLKSPI
DLYBCS + 1- (if DLYBCT field equals 0)
--------------------------------
CLKSPI
• NCPHA: Clock Phase
1: Data is captured after the leading (inactive-to-active) edge of SPCK and changed on the trailing (active-to-inactive) edge of
SPCK.
0: Data is changed on the leading (inactive-to-active) edge of SPCK and captured after the trailing (active-to-inactive) edge of
SPCK.
NCPHA determines which edge of SPCK causes data to change and which edge causes data to be captured. NCPHA is used
with CPOL to produce the required clock/data relationship between master and slave devices.
• CPOL: Clock Polarity
1: The inactive state value of SPCK is logic level one.
0: The inactive state value of SPCK is logic level zero.
431
32072H–AVR32–10/2012
AT32UC3A3
CPOL is used to determine the inactive state value of the serial clock (SPCK). It is used with NCPHA to produce the required
clock/data relationship between master and slave devices.
432
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
DLYBCT
23 22 21 20 19 18 17 16
DLYBS
15 14 13 12 11 10 9 8
SCBR
7 6 5 4 3 2 1 0
32 × DLYBCT
Delay Between Consecutive Transfers = ------------------------------------
CLKSPI
• DLYBS: Delay Before SPCK
This field defines the delay from NPCS valid to the first valid SPCK transition.
When DLYBS equals zero, the NPCS valid to SPCK transition is 1/2 the SPCK clock period.
Otherwise, the following equations determine the delay:
DLYBS-
Delay Before SPCK = --------------------
CLKSPI
• SCBR: Serial Clock Baud Rate
In Master Mode, the SPI Interface uses a modulus counter to derive the SPCK baud rate from the CLK_SPI. The Baud rate is
selected by writing a value from 1 to 255 in the SCBR field. The following equations determine the SPCK baud rate:
CLKSPI
SPCK Baudrate = ---------------------
SCBR
Writing the SCBR field to zero is forbidden. Triggering a transfer while SCBR is zero can lead to unpredictable results.
At reset, SCBR is zero and the user has to write it to a valid value before performing the first transfer.
If a clock divider (SCBRn) field is set to one and the other SCBR fields differ from one, access on CSn is correct but no correct
access will be possible on other CS.
433
32072H–AVR32–10/2012
AT32UC3A3
DLYBCS
----------------------- (if DLYBCT field is different from 0)
CLKSPI
DLYBCS + 1- (if DLYBCT field equals 0)
--------------------------------
CLKSPI
• NCPHA: Clock Phase
1: Data is captured after the leading (inactive-to-active) edge of SPCK and changed on the trailing (active-to-inactive) edge of
SPCK.
0: Data is changed on the leading (inactive-to-active) edge of SPCK and captured after the trailing (active-to-inactive) edge of
SPCK.
NCPHA determines which edge of SPCK causes data to change and which edge causes data to be captured. NCPHA is used
with CPOL to produce the required clock/data relationship between master and slave devices.
• CPOL: Clock Polarity
1: The inactive state value of SPCK is logic level one.
0: The inactive state value of SPCK is logic level zero.
434
32072H–AVR32–10/2012
AT32UC3A3
CPOL is used to determine the inactive state value of the serial clock (SPCK). It is used with NCPHA to produce the required
clock/data relationship between master and slave devices.
435
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
DLYBCT
23 22 21 20 19 18 17 16
DLYBS
15 14 13 12 11 10 9 8
SCBR
7 6 5 4 3 2 1 0
32 × DLYBCT
Delay Between Consecutive Transfers = ------------------------------------
CLKSPI
• DLYBS: Delay Before SPCK
This field defines the delay from NPCS valid to the first valid SPCK transition.
When DLYBS equals zero, the NPCS valid to SPCK transition is 1/2 the SPCK clock period.
Otherwise, the following equations determine the delay:
DLYBS-
Delay Before SPCK = --------------------
CLKSPI
• SCBR: Serial Clock Baud Rate
In Master Mode, the SPI Interface uses a modulus counter to derive the SPCK baud rate from the CLK_SPI. The Baud rate is
selected by writing a value from 1 to 255 in the SCBR field. The following equations determine the SPCK baud rate:
CLKSPI
SPCK Baudrate = ---------------------
SCBR
Writing the SCBR field to zero is forbidden. Triggering a transfer while SCBR is zero can lead to unpredictable results.
At reset, SCBR is zero and the user has to write it to a valid value before performing the first transfer.
If a clock divider (SCBRn) field is set to one and the other SCBR fields differ from one, access on CSn is correct but no correct
access will be possible on other CS.
436
32072H–AVR32–10/2012
AT32UC3A3
DLYBCS
----------------------- (if DLYBCT field is different from 0)
CLKSPI
DLYBCS + 1- (if DLYBCT field equals 0)
--------------------------------
CLKSPI
• NCPHA: Clock Phase
1: Data is captured after the leading (inactive-to-active) edge of SPCK and changed on the trailing (active-to-inactive) edge of
SPCK.
0: Data is changed on the leading (inactive-to-active) edge of SPCK and captured after the trailing (active-to-inactive) edge of
SPCK.
NCPHA determines which edge of SPCK causes data to change and which edge causes data to be captured. NCPHA is used
with CPOL to produce the required clock/data relationship between master and slave devices.
• CPOL: Clock Polarity
1: The inactive state value of SPCK is logic level one.
0: The inactive state value of SPCK is logic level zero.
437
32072H–AVR32–10/2012
AT32UC3A3
CPOL is used to determine the inactive state value of the serial clock (SPCK). It is used with NCPHA to produce the required
clock/data relationship between master and slave devices.
438
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
SPIWPKEY[23:16]
23 22 21 20 19 18 17 16
SPIWPKEY[15:8]
15 14 13 12 11 10 9 8
SPIWPKEY[7:0]
7 6 5 4 3 2 1 0
- - - - - - - SPIWPEN
439
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
SPIWPVSRC
7 6 5 4 3 2 1 0
- - - - - SPIWPVS
440
32072H–AVR32–10/2012
AT32UC3A3
•
•
441
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - MFN
15 14 13 12 11 10 9 8
VERSION[11:8]
7 6 5 4 3 2 1 0
VERSION[7:0]
• MFN
Reserved. No functionality associated.
• VERSION
Version number of the module. No functionality associated.
442
32072H–AVR32–10/2012
AT32UC3A3
443
32072H–AVR32–10/2012
AT32UC3A3
22.1 Features
• Compatible with I²C standard
– Transfer speeds of 100 and 400 kbit/s
– 7 and 10-bit and General Call addressing
• Compatible with SMBus standard
– Hardware Packet Error Checking (CRC) generation and verification with ACK response
– SMBALERT interface
– 25 ms clock low timeout delay
– 25 ms slave cumulative clock low extend time
• Compatible with PMBus
• DMA interface for reducing CPU load
• Arbitrary transfer lengths, including 0 data bytes
• Optional clock stretching if transmit or receive buffers not ready for data transfer
• 32-bit Peripheral Bus interface for configuration of the interface
22.2 Overview
The Atmel Two-wire Slave Interface (TWIS) interconnects components on a unique two-wire
bus, made up of one clock line and one data line with speeds of up to 400 kbit/s, based on a
byte-oriented transfer format. It can be used with any Atmel Two-wire Interface bus, I²C, or
SMBus-compatible master. The TWIS is always a bus slave and can transfer sequential or sin-
gle bytes.
Below, Table 22-1 lists the compatibility level of the Atmel Two-wire Slave Interface and a full I²C
compatible device.
444
32072H–AVR32–10/2012
AT32UC3A3
Below, Table 22-2 lists the compatibility level of the Atmel Two-wire Slave Interface and a full
SMBus compatible device.
Peripheral
Bus Bridge
TWCK
Two-wire
TWALM
Interface
Power
Manager
CLK_TWIS Interrupt
Controller
TWI Interrupt
445
32072H–AVR32–10/2012
AT32UC3A3
Rp Rp
TWD
Host with
TWI
Interface TWCK
446
32072H–AVR32–10/2012
AT32UC3A3
22.7.3 Clocks
The clock for the TWIS bus interface (CLK_TWIS) is generated by the Power Manager. This
clock is enabled at reset, and can be disabled in the Power Manager. It is recommended to dis-
able the TWIS before disabling the clock, to avoid freezing the TWIS in an undefined state.
22.7.4 DMA
The TWIS DMA handshake interface is connected to the Peripheral DMA Controller. Using the
TWIS DMA functionality requires the Peripheral DMA Controller to be programmed after setting
up the TWIS.
22.7.5 Interrupts
The TWIS interrupt request lines are connected to the interrupt controller. Using the TWIS inter-
rupts requires the interrupt controller to be programmed first.
TWD
TWCK
Start Stop
447
32072H–AVR32–10/2012
AT32UC3A3
TWD
TWCK
22.8.2 Operation
The TWIS has two modes of operation:
• Slave transmitter mode
• Slave receiver mode
A master is a device which starts and stops a transfer and generates the TWCK clock. A slave is
assigned an address and responds to requests from the master. These modes are described in
the following chapters.
Rp Rp
TWD
Host with
TWI
Interface TWCK
f CLK_TWIS
f PRESCALED = ------------------------
-
( EXP + 1 )
2
448
32072H–AVR32–10/2012
AT32UC3A3
t HIGH
t LOW
t LOW
t t t t t
HD:STA SU:DAT HD:DAT SU:DAT SU:STO
S P
t
SU:STA
Sr
449
32072H–AVR32–10/2012
AT32UC3A3
In I²C mode:
• The address in CR.ADR is checked for address match if CR.SMATCH is one.
• The General Call address is checked for address match if CR.GCMATCH is one.
In SMBus mode:
• The address in CR.ADR is checked for address match if CR.SMATCH is one.
• The Alert Response Address is checked for address match if CR.SMAL is one.
• The Default Address is checked for address match if CR.SMDA is one.
• The Host Header Address is checked for address match if CR.SMHH is one.
450
32072H–AVR32–10/2012
AT32UC3A3
TCOMP
TXRDY
451
32072H–AVR32–10/2012
AT32UC3A3
TCOMP
TXRDY
STOP sent by master
Write THR (Data n) Write THR (Data n+1) Write THR (Data n+m)
NBYTES set to m Last data sent
TWCK
SR.NAK
SR.BTF
t1 t1
452
32072H–AVR32–10/2012
AT32UC3A3
slave to pull it down in order to generate the acknowledge. The master polls the data line during
this clock pulse.
The SR.RXRDY bit indicates that a data byte is available in the RHR. The RXRDY bit is also
used as Receive Ready for the Peripheral DMA Controller receive channel.
TCOMP
RXRDY
Read RHR
TCOMP
RXRDY
453
32072H–AVR32–10/2012
AT32UC3A3
22.8.6.2 Timeouts
The Timing Register (TR) configures the SMBus timeout values. If a timeout occurs, the slave
will leave the bus. The SR.SMBTOUT bit is also set.
22.8.6.3 SMBALERT
A slave can get the master’s attention by pulling the SMBALERT line low. This is done by writing
a one to the SMBus Alert (SMBALERT) bit in CR. This will also enable address match on the
Alert Response Address (ARA).
454
32072H–AVR32–10/2012
AT32UC3A3
455
32072H–AVR32–10/2012
AT32UC3A3
456
32072H–AVR32–10/2012
AT32UC3A3
Note: 1. The reset values for these registers are device specific. Please refer to the Module Configuration section at the end of this
chapter.
457
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - TENBIT ADR[9:8]
23 22 21 20 19 18 17 16
ADR[7:0]
15 14 13 12 11 10 9 8
SOAM CUP ACK PECEN SMHH SMDA SMBALERT
7 6 5 4 3 2 1 0
SWRST - - STREN GCMATCH SMATCH SMEN SEN
458
32072H–AVR32–10/2012
AT32UC3A3
459
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
NBYTES
460
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
EXP - - - -
23 22 21 20 19 18 17 16
SUDAT
15 14 13 12 11 10 9 8
TTOUT
7 6 5 4 3 2 1 0
TLOWS
f CLK_TWIS
f PRESCALED = ------------------------
-
( EXP + 1 )
2
• SUDAT: Data Setup Cycles
Non-prescaled clock cycles for data setup count. Used to time TSU_DAT. Data is driven SUDAT cycles after TWCK low detected.
This timing is used for timing the ACK/NAK bits, and any data bits driven in slave transmitter mode.
• TTOUT: SMBus TTIMEOUT Cycles
Prescaled clock cycles used to time SMBus TTIMEOUT.
• TLOWS: SMBus TLOW:SEXT Cycles
Prescaled clock cycles used to time SMBus TLOW:SEXT.
461
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
RXDATA
462
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
TXDATA
463
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
PEC
464
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
BTF REP STO SMBDAM SMBHHM SMBALERTM GCM SAM
15 14 13 12 11 10 9 8
- BUSERR SMBPECERR SMBTOUT - - - NAK
7 6 5 4 3 2 1 0
ORUN URUN TRA - TCOMP SEN TXRDY RXRDY
465
32072H–AVR32–10/2012
AT32UC3A3
466
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
BTF REP STO SMBDAM SMBHHM SMBALERTM GCM SAM
15 14 13 12 11 10 9 8
- BUSERR SMBPECERR SMBTOUT - - - NAK
7 6 5 4 3 2 1 0
ORUN URUN - - TCOMP - TXRDY RXRDY
467
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
BTF REP STO SMBDAM SMBHHM SMBALERTM GCM SAM
15 14 13 12 11 10 9 8
- BUSERR SMBPECERR SMBTOUT - - - NAK
7 6 5 4 3 2 1 0
ORUN URUN - - TCOMP - TXRDY RXRDY
468
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
BTF REP STO SMBDAM SMBHHM SMBALERTM GCM SAM
15 14 13 12 11 10 9 8
- BUSERR SMBPECERR SMBTOUT - - - NAK
7 6 5 4 3 2 1 0
ORUN URUN - - TCOMP - TXRDY RXRDY
469
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
BTF REP STO SMBDAM SMBHHM SMBALERTM GCM SAM
15 14 13 12 11 10 9 8
- BUSERR SMBPECERR SMBTOUT - - - NAK
7 6 5 4 3 2 1 0
ORUN URUN - - TCOMP - - -
470
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - -
471
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - VARIANT
15 14 13 12 11 10 9 8
- - - - VERSION [11:8]
7 6 5 4 3 2 1 0
VERSION [7:0]
472
32072H–AVR32–10/2012
AT32UC3A3
473
32072H–AVR32–10/2012
AT32UC3A3
23.1 Features
• Compatible with I²C standard
– Multi-master support
– Transfer speeds of 100 and 400 kbit/s
– 7- and 10-bit and General Call addressing
• Compatible with SMBus standard
– Hardware Packet Error Checking (CRC) generation and verification with ACK control
– SMBus ALERT interface
– 25 ms clock low timeout delay
– 10 ms master cumulative clock low extend time
– 25 ms slave cumulative clock low extend time
• Compatible with PMBus
• Compatible with Atmel Two-wire Interface Serial Memories
• DMA interface for reducing CPU load
• Arbitrary transfer lengths, including 0 data bytes
• Optional clock stretching if transmit or receive buffers not ready for data transfer
23.2 Overview
The Atmel Two-wire Master Interface (TWIM) interconnects components on a unique two-wire
bus, made up of one clock line and one data line with speeds of up to 400 kbit/s, based on a
byte-oriented transfer format. It can be used with any Atmel Two-wire Interface bus serial
EEPROM and I²C compatible device such as a real time clock (RTC), dot matrix/graphic LCD
controller, and temperature sensor, to name a few. The TWIM is always a bus master and can
transfer sequential or single bytes. Multiple master capability is supported. Arbitration of the bus
is performed internally and relinquishes the bus 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 23-1 lists the compatibility level of the Atmel Two-wire Interface in
Master Mode and a full I²C compatible device.
474
32072H–AVR32–10/2012
AT32UC3A3
Table 23-2 lists the compatibility level of the Atmel Two-wire Master Interface and a full SMBus
compatible master.
Peripheral
Bus Bridge
TWCK
Two-wire
TWALM
Interface
Power
Manager
CLK_TWIM
INTC
TWI Interrupt
475
32072H–AVR32–10/2012
AT32UC3A3
Rp Rp Rp
TWD
TWI TWCK
Master
TWALM
476
32072H–AVR32–10/2012
AT32UC3A3
23.7.3 Clocks
The clock for the TWIM bus interface (CLK_TWIM) is generated by the Power Manager. This
clock is enabled at reset, and can be disabled in the Power Manager. It is recommended to dis-
able the TWIM before disabling the clock, to avoid freezing the TWIM in an undefined state.
23.7.4 DMA
The TWIM DMA handshake interface is connected to the Peripheral DMA Controller. Using the
TWIM DMA functionality requires the Peripheral DMA Controller to be programmed after setting
up the TWIM.
23.7.5 Interrupts
The TWIM interrupt request lines are connected to the interrupt controller. Using the TWIM inter-
rupts requires the interrupt controller to be programmed first.
477
32072H–AVR32–10/2012
AT32UC3A3
TWD
TWCK
Start Stop
TWD
TWCK
23.8.2 Operation
The TWIM has two modes of operation:
• Master transmitter mode
• Master receiver mode
The master is the device which starts and stops a transfer and generates the TWCK clock.
These modes are described in the following chapters.
478
32072H–AVR32–10/2012
AT32UC3A3
f CLK_TWIM
f PRESCALER = -------------------------
-
( EXP + 1 )
2
t HIGH
t LOW
t LOW
t t t t t
HD:STA SU:DAT HD:DAT SU:DAT SU:STO
S P
t
SU:STA
Sr
479
32072H–AVR32–10/2012
AT32UC3A3
480
32072H–AVR32–10/2012
AT32UC3A3
TWI transfers require the slave to acknowledge each received data byte. During the acknowl-
edge 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 Data Acknowledge bit (DNACK) in the Status Register if the slave does not
acknowledge the data byte. As with the other status bits, an interrupt can be generated if
enabled in the Interrupt Enable Register (IER).
TXRDY is used as Transmit Ready for the Peripheral DMA Controller transmit channel.
The end of a command is marked when the TWIM sets the SR.CCOMP bit. See Figure 23-6 and
Figure 23-7.
SR.IDLE
TXRDY
Write THR (DATA) STOP sent automatically
NBYTES set to 1 (ACK received and NBYTES=0)
SR.IDLE
TXRDY
Write THR Write THR STOP sent automatically
Write THR (ACK received and NBYTES=0)
(DATAn+1) (DATAn+m)
(DATAn)
Last data sent
NBYTES set to n
481
32072H–AVR32–10/2012
AT32UC3A3
1. Wait until RHR is empty, stretching low period of TWCK. SR.RXRDY indicates the state
of RHR. Software or the Peripheral DMA Controller must read any data byte present in
RHR.
2. Release TWCK generating a clock that the slave uses to transmit a data byte.
3. Place the received data byte in RHR, set RXRDY.
4. If NBYTES=0, generate a NAK after the data byte, otherwise generate an ACK.
5. Decrement NBYTES
6. If (NBYTES==0) and STOP=1, transmit STOP condition.
Writing CMDR with START=STOP=1 and NBYTES=0 will generate a transmission with no data
bytes, ie START, DADR+R, STOP
The TWI transfers require the master to acknowledge each received data byte. During the
acknowledge clock pulse (9th pulse), the slave releases the data line (HIGH), enabling the mas-
ter to pull it down in order to generate the acknowledge. All data bytes except the last are
acknowledged by the master. Not acknowledging the last byte informs the slave that the transfer
is finished.
RXRDY is used as Receive Ready for the Peripheral DMA Controller receive channel.
SR.IDLE
RXRDY
SR.IDLE
RXRDY
Write START +
STOP bit
Read RHR Read RHR Read RHR Read RHR
NBYTES set to m DATAn DATAn+m-2 DATAn+m-1 DATAn+m
Send STOP
When NBYTES=0
482
32072H–AVR32–10/2012
AT32UC3A3
483
32072H–AVR32–10/2012
AT32UC3A3
TWCK
TWCK
TWD
TWCK
Arbitration is lost
Data from a Master S 1 0 0 1 1 P S 1 0 1
The master stops sending data
Arbitration is lost
Data from TWI S 1 0 1 S 1 0 0 1 1
TWI stops sending data
ARBLST
Bus is busy Bus is free
484
32072H–AVR32–10/2012
AT32UC3A3
As for single data transfers, the TXRDY and RXRDY bits in the Status Register indicates when
data to transmit can be written to THR, or when received data can be read from RHR. Transfer
of data to THR and from RHR can also be done automatically by DMA, see Section 23.8.5
485
32072H–AVR32–10/2012
AT32UC3A3
SR.IDLE 1
TXRDY
RXRDY
SR.IDLE 2
TXRDY
Read
RXRDY TWI_RHR
486
32072H–AVR32–10/2012
AT32UC3A3
487
32072H–AVR32–10/2012
AT32UC3A3
23.8.9.2 Timeouts
The TLOWS and TLOWM fields in SMBTR configure the SMBus timeout values. If a timeout
occurs, the master will transmit a STOP condition and leave the bus. The SR.TOUT bit is set.
488
32072H–AVR32–10/2012
AT32UC3A3
489
32072H–AVR32–10/2012
AT32UC3A3
Note: 1. The reset values for these registers are device specific. Please refer to the Module Configuration section at the end of this
chapter.
490
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - STOP
7 6 5 4 3 2 1 0
SWRST - SMDIS SMEN - - MDIS MEN
491
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- EXP DATA
23 22 21 20 19 18 17 16
STASTO
15 14 13 12 11 10 9 8
HIGH
7 6 5 4 3 2 1 0
LOW
492
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
EXP - - - -
23 22 21 20 19 18 17 16
THMAX
15 14 13 12 11 10 9 8
TLOWM
7 6 5 4 3 2 1 0
TLOWS
493
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - ACKLAST PECEN
23 22 21 20 19 18 17 16
NBYTES
15 14 13 12 11 10 9 8
VALID STOP START REPSAME TENBIT SADR[9:7]
7 6 5 4 3 2 1 0
SADR[6:0] READ
494
32072H–AVR32–10/2012
AT32UC3A3
Write this bit to one if the command in CMDR performs a repeated start to the same slave address as addressed in the previous
transfer in order to enter master receiver mode.
Write this bit to zero otherwise.
• TENBIT: Ten Bit Addressing Mode
0: Use 7-bit addressing mode.
1: Use 10-bit addressing mode. Must not be used when the TWIM is in SMBus mode.
• SADR: Slave Address
Address of the slave involved in the transfer. Bits 9-7 are don’t care if 7-bit addressing is used.
• READ: Transfer Direction
0: Allow the master to transmit data.
1: Allow the master to receive data.
495
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - ACKLAST PECEN
23 22 21 20 19 18 17 16
NBYTES
15 14 13 12 11 10 9 8
VALID STOP START REPSAME TENBIT SADR[9:7]
7 6 5 4 3 2 1 0
SADR[6:0] READ
This register is identical to CMDR. When the VALID bit in CMDR becomes 0, the content of NCMDR is copied into CMDR,
clearing the VALID bit in NCMDR. If the VALID bit in CMDR is cleared when NCMDR is written, the content is copied
immediately.
496
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
RXDATA
497
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
TXDATA
498
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - MENB
15 14 13 12 11 10 9 8
- STOP PECERR TOUT SMBALERT ARBLST DNAK ANAK
7 6 5 4 3 2 1 0
- - BUSFREE IDLE CCOMP CRDY TXRDY RXRDY
499
32072H–AVR32–10/2012
AT32UC3A3
500
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - PECERR TOUT SMBALERT ARBLST DNAK ANAK
7 6 5 4 3 2 1 0
- - BUSFREE IDLE CCOMP CRDY TXRDY RXRDY
501
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - PECERR TOUT SMBALERT ARBLST DNAK ANAK
7 6 5 4 3 2 1 0
- - BUSFREE IDLE CCOMP CRDY TXRDY RXRDY
502
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - PECERR TOUT SMBALERT ARBLST DNAK ANAK
7 6 5 4 3 2 1 0
- - BUSFREE IDLE CCOMP CRDY TXRDY RXRDY
503
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- STOP PECERR TOUT SMBALERT ARBLST DNAK ANAK
7 6 5 4 3 2 1 0
- - - - CCOMP - - -
504
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - -
505
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - VARIANT
15 14 13 12 11 10 9 8
- - - - VERSION [11:8]
7 6 5 4 3 2 1 0
VERSION [7:0]
506
32072H–AVR32–10/2012
AT32UC3A3
507
32072H–AVR32–10/2012
AT32UC3A3
24.1 Features
• Provides serial synchronous communication links used in audio and telecom applications
• Independent receiver and transmitter, common clock divider
• Interfaced with two Peripheral DMA Controller channels to reduce processor overhead
• Configurable frame sync and data length
• Receiver and transmitter can be configured 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
24.2 Overview
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 consists of a receiver, a transmitter, and a common clock divider. Both the receiver
and the transmitter interface with three signals:
• the TX_DATA/RX_DATA signal for data
• the TX_CLOCK/RX_CLOCK signal for the clock
• the TX_FRAME_SYNC/RX_FRAME_SYNC signal for the frame synchronization
The transfers can be programmed to start automatically or on different events detected on the
Frame Sync signal.
The SSC’s high-level of programmability and its two dedicated Peripheral DMA Controller chan-
nels of up to 32 bits permit a continuous high bit rate data transfer without processor
intervention.
Featuring connection to two Peripheral DMA Controller channels, the SSC permits interfacing
with low processor overhead to the following:
• CODEC’s in master or slave mode
• DAC through dedicated serial interface, particularly I2S
• Magnetic card reader
508
32072H–AVR32–10/2012
AT32UC3A3
High
Speed
Bus
Peripheral Bus
Bridge
Peripheral DMA
Controller
Peripheral
Bus
TX_FRAME_SYNC
TX_CLOCK
TX_DATA
Power CLK_SSC
Manager I/O
SSC Interface Controller
RX_FRAME_SYNC
RX_CLOCK
Interrupt Control
RX_DATA
SSC Interrupt
SSC
509
32072H–AVR32–10/2012
AT32UC3A3
24.6.2 Clocks
The clock for the SSC bus interface (CLK_SSC) is generated by the Power Manager. This clock
is enabled at reset, and can be disabled in the Power Manager. It is recommended to disable the
SSC before disabling the clock, to avoid freezing the SSC in an undefined state.
24.6.3 Interrupts
The SSC interrupt request line is connected to the interrupt controller. Using the SSC interrupt
requires the interrupt controller to be programmed first.
510
32072H–AVR32–10/2012
AT32UC3A3
Transmitter
Clock Output TX_CLOCK
Controller
TX_CLOCK Input
CLK_SSC Clock Transmit Clock TX clock Frame Sync TX_FRAME_SYNC
Divider Controller Controller
RX clock
TX_FRAME_SYNC
Start TX_DATA
RX_FRAME_SYNC Transmit Shift Register
Selector
Receiver
Clock Output
RX_CLOCK
Controller
RX_CLOCK
Input Receive Clock RX clock Frame Sync
Controller Controller RX_FRAME_SYNC
TX clock
TX_FRAME_SYNC
Start
Receive Shift Register RX_DATA
RX_FRAME_SYNC Selector
Interrupt Controller
511
32072H–AVR32–10/2012
AT32UC3A3
CMR
The peripheral clock divider is determined by the 12-bit Clock Divider field (its maximal value is
4095) in the Clock Mode Register (CMR.DIV), allowing a peripheral clock division by up to 8190.
The divided clock is provided to both the receiver and transmitter. When this field is written to
zero, the clock divider is not used and remains inactive.
When CMR.DIV is written to a value equal to or greater than one, the divided clock has a fre-
quency of CLK_SSC divided by two times CMR.DIV. Each level of the divided clock has a
duration of the peripheral clock multiplied by CMR.DIV. This ensures a 50% duty cycle for the
divided clock regardless of whether the CMR.DIV value is even or odd.
CLK_SSC
Divided Clock
DIV = 1
CLK_SSC
Divided Clock
DIV = 3
512
32072H–AVR32–10/2012
AT32UC3A3
be inverted independently by writing a one to the Transmit Clock Inversion bit in TCMR
(TCMR.CKI).
The transmitter can also drive the TX_CLOCK pin continuously or be limited to the actual data
transfer, depending on the Transmit Clock Output Mode Selection field in the TCMR register
(TCMR.CKO). The TCMR.CKI bit has no effect on the clock outputs.
Writing 0b10 to the TCMR.CKS field to select TX_CLOCK pin and 0b001 to the TCMR.CKO field
to select Continuous Transmit Clock can lead to unpredictable results.
TX_CLOCK
Divider
Clock
CKO Data Transfer
CKI CKG
513
32072H–AVR32–10/2012
AT32UC3A3
RX_CLOCK
Divider
Clock
CKI CKG
514
32072H–AVR32–10/2012
AT32UC3A3
CR.TXEN
SR.TXEN
CR.TXDIS
TFMR.DATDEF TCMR.STTDLY
TFMR.FSDEN
TFMR.DATNB
1
TX_FRAME_SYNC TX_DATA
TFMR.MSBF 0
RX_FRAME_SYNC
Transmitter Clock
Start
Transmit Shift Register
Selector
TFMR.FSDEN 0 1
TCMR.STTDLY
515
32072H–AVR32–10/2012
AT32UC3A3
MUX T ri-sta te C lo ck
C o n tro lle r O u tp u t
T ra n sm itte r
C lo ck
D ivid e r
C lo ck
CKO D a ta T ra n sfe r
CKS IN V T ri-sta te
MUX C o n tro lle r R e ce ive r
C lo ck
CKI CKG
24.7.4 Start
The transmitter and receiver can both be programmed to start their operations when an event
occurs, respectively in the Transmit Start Selection field of the TCMR register (TCMR.START)
and in the Receive Start Selection field of the RCMR register (RCMR.START).
Under the following conditions the start event is independently programmable:
• Continuous: in this case, the transmission starts as soon as a word is written to the THR
register and the reception starts as soon as the receiver is enabled
• Synchronously with the transmitter/receiver
• On detection of a falling/rising edge on TX_FRAME_SYNC/RX_FRAME_SYNC
• On detection of a low/high level on TX_FRAME_SYNC/RX_FRAME_SYNC
• On detection of a level change or an edge on TX_FRAME_SYNC/RX_FRAME_SYNC
A start can be programmed in the same manner on either side of the Transmit/Receive Clock
Mode Register (TCMR/RCMR). Thus, the start could be on TX_FRAME_SYNC (transmit) or
RX_FRAME_SYNC (receive).
Moreover, the receiver can start when data is detected in the bit stream with the compare func-
tions. See Section 24.7.6 for more details on receive compare modes.
Detection on TX_FRAME_SYNC input/output is done by the Transmit Frame Sync Output
Selection field in the TFMR register (TFMR.FSOS). Similarly, detection on RX_FRAME_SYNC
input/output is done by the Receive Frame Output Sync Selection field in the RFMR register
(RFMR.FSOS).
516
32072H–AVR32–10/2012
AT32UC3A3
TX_CLOCK (Input)
TX_FRAME_SYNC (Input)
TX_DATA (Output)
Start= Low Level on TX_FRAME_SYNC X B0 B1
STTDLY
TX_DATA (Output) B0 B1
X
Start= Falling Edge on TX_FRAME_SYNC STTDLY
TX_DATA (Output) X B0 B1
Start= High Level on TX_FRAME_SYNC STTDLY
TX_DATA (Output) B0 B1
X
Start= Rising Edge on TX_FRAME_SYNC STTDLY
TX_DATA (Output)
Start= Level Change on TX_FRAME_SYNC X B0 B1 B0 B1
STTDLY
TX_DATA (Output)
X B0 B1 B0 B1
Start= Any Edge on TX_FRAME_SYNC STTDLY
RX_CLOCK
RX_FRAME_SYNC (Input)
RX_DATA (Input)
Start = Low Level on RX_FRAME_SYNC X
STTDLY
RX_DATA (Input)
X B0 B1
Start = Falling Edge on RX_FRAME_SYNC STTDLY
RX_DATA (Input)
X B0 B1
Start = High Level on RX_FRAME_SYNC STTDLY
RX_DATA (Input)
X B0 B1
Start = Rising Edge on RX_FRAME_SYNC STTDLY
RX_DATA (Input)
X B0 B1 B0 B1
Start = Level Change on RX_FRAME_SYNC STTDLY
RX_DATA (Input)
Start = Any Edge on RX_FRAME_SYNC X B0 B1 B0 B1
STTDLY
517
32072H–AVR32–10/2012
AT32UC3A3
Similarly, in transmission, the Transmit Frame Sync Length High Part and the Transmit Frame
Sync Length fields in the TFMR register (TFMR.FSLENHI and TFMR.FSLEN) define the length
of the pulse, from 1 bit up to 256 bit time.
The periodicity of the RX_FRAME_SYNC and TX_FRAME_SYNC pulse outputs can be config-
ured respectively through the Receive Period Divider Selection field in the RCMR register
(RCMR.PERIOD) and the Transmit Period Divider Selection field in the TCMR register
(TCMR.PERIOD).
518
32072H–AVR32–10/2012
AT32UC3A3
and Transmit Sync bits in the SR register (SR.RXSYN and SR.TXSYN) on frame synchro edge
detection (signals RX_FRAME_SYNC/TX_FRAME_SYNC).
RX_CLOCK
519
32072H–AVR32–10/2012
AT32UC3A3
Figure 24-13. Transmit and Receive Frame Format in Edge/Pulse Start Modes
Start Start
PERIOD
TX_FRAME_SYNC
/ (1)
RX_FRAME_SYNC
FSLEN
TX_DATA
Sync Data Default Data Data Default Sync Data
(If FSDEN = 1)
From TSHR From DATDEF From THR From THR From DATDEF
TX_DATA
(If FSDEN = 0) Default Data Data Default
From DATDEF From THR From THR From DATDEF
DATNB
Start
DATLEN DATLEN
Note: STTDLY is written to zero. In this example, THR is loaded twice. FSDEN value has no effect on the
transmission. SyncData cannot be output in continuous mode.
520
32072H–AVR32–10/2012
AT32UC3A3
DATLEN DATLEN
24.7.9 Interrupt
Most bits in the SR register have a corresponding bit in interrupt management registers.
The SSC can be programmed to generate an interrupt when it detects an event. The interrupt is
controlled by writing to the Interrupt Enable Register (IER) and Interrupt Disable Register (IDR).
These registers enable and disable, respectively, the corresponding interrupt by setting and
clearing the corresponding bit in the Interrupt Mask Register (IMR), which controls the genera-
tion of interrupts by asserting the SSC interrupt line connected to the interrupt controller.
IM R
IE R ID R
Set C le a r
T ra n s m itte r
TXRDY
TXEM PTY
TXSYNC
S S C In te rru p t
In te rru p t
C o n tro l
R e c e iv e r
RXRDY
OVRUN
RXSYNC
521
32072H–AVR32–10/2012
AT32UC3A3
Clock SCK
TX_CLOCK
Word Select WS
TX_FRAME_SYNC I2S
RECEIVER
Data SD
TX_DATA
SSC
RX_CLOCK
Data SD MSB LSB MSB
RX_FRAME_SYNC
Serial Data Clock (SCLK)
Serial Data In
522
32072H–AVR32–10/2012
AT32UC3A3
SCLK
TX_CLOCK
FSYNC
TX_FRAME_SYNC CODEC
First
Data Out
TX_DATA Time Slot
SSC
Data in
RX_DATA
RX_FRAME_SYNC
RX_CLOCK CODEC
Second
Time Slot
Serial Data In
523
32072H–AVR32–10/2012
AT32UC3A3
524
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
- - - - - - RXDIS RXEN
525
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - DIV[11:8]
7 6 5 4 3 2 1 0
DIV[7:0]
526
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
PERIOD
23 22 21 20 19 18 17 16
STTDLY
15 14 13 12 11 10 9 8
- - - STOP START
7 6 5 4 3 2 1 0
527
32072H–AVR32–10/2012
AT32UC3A3
528
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
FSLENHI - - - FSEDGE
23 22 21 20 19 18 17 16
- FSOS FSLEN
15 14 13 12 11 10 9 8
- - - - DATNB
7 6 5 4 3 2 1 0
529
32072H–AVR32–10/2012
AT32UC3A3
530
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
PERIOD
23 22 21 20 19 18 17 16
STTDLY
15 14 13 12 11 10 9 8
- - - - START
7 6 5 4 3 2 1 0
531
32072H–AVR32–10/2012
AT32UC3A3
532
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
FSLENHI - - - FSEDGE
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
- - - - DATNB
7 6 5 4 3 2 1 0
533
32072H–AVR32–10/2012
AT32UC3A3
The pulse length is equal to ({FSLENHI,FSLEN} + 1) transmit clock periods, i.e., the pulse length can range from 1 to 256
transmit clock periods. If {FSLENHI,FSLEN} is zero, the Transmit Frame Sync signal is generated during one transmit clock
period.
• 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).
• MSBF: Most Significant Bit First
1: The most significant bit of the data register is shifted out first in the bit stream.
0: The lowest significant bit of the data register is shifted out first in the bit stream.
• DATDEF: Data Default Value
This bit defines the level driven on the TX_DATA pin while out of transmission.
Note that if the pin is defined as multi-drive by the I/O Controller, the pin is enabled only if the TX_DATA output is one.
1: The level driven on the TX_DATA pin while out of transmission is one.
0: The level driven on the TX_DATA pin while out of transmission is zero.
• DATLEN: Data Length
The bit stream contains (DATLEN + 1) data bits.
This field also defines the transfer size performed by the Peripheral DMA Controller assigned to the transmitter.
534
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
RDAT[31:24]
23 22 21 20 19 18 17 16
RDAT[23:16]
15 14 13 12 11 10 9 8
RDAT[15:8]
7 6 5 4 3 2 1 0
RDAT[7:0]
535
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
TDAT[31:24]
23 22 21 20 19 18 17 16
TDAT[23:16]
15 14 13 12 11 10 9 8
TDAT[15:8]
7 6 5 4 3 2 1 0
TDAT[7:0]
536
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
RSDAT[15:8]
7 6 5 4 3 2 1 0
RSDAT[7:0]
537
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
TSDAT[15:8]
7 6 5 4 3 2 1 0
TSDAT[7:0]
538
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
CP0[15:8]
7 6 5 4 3 2 1 0
CP0[7:0]
539
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
CP1[[15:8]
7 6 5 4 3 2 1 0
CP1[7:0]
540
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - RXEN TXEN
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
541
32072H–AVR32–10/2012
AT32UC3A3
542
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
543
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
544
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
545
32072H–AVR32–10/2012
AT32UC3A3
25.1 Features
• Configurable baud rate generator
• 5- to 9-bit full-duplex, synchronous and asynchronous, serial communication
– 1, 1.5, or 2 stop bits in asynchronous mode, and 1 or 2 in synchronous mode
– Parity generation and error detection
– Framing- and overrun error detection
– MSB- or LSB-first
– Optional break generation and detection
– Receiver frequency oversampling by 8 or 16 times
– Optional RTS-CTS hardware handshaking
– Optional DTR-DSR-DCD-RI modem signal management
– Receiver Time-out and transmitter Timeguard
– Optional Multidrop mode with address generation and detection
• RS485 with line driver control
• ISO7816, T=0 and T=1 protocols for Interfacing with smart cards
– , NACK handling, and customizable error counter
• IrDA modulation and demodulation
– Communication at up to 115.2Kbit/s
• SPI Mode
– Master or slave
– Configurable serial clock phase and polarity
– CLK SPI serial clock frequency up to a quarter of the CLK_USART internal clock frequency
• LIN Mode
– Compliant with LIN 1.3 and LIN 2.0 specifications
– Master or slave
– Processing of Frames with up to 256 data bytes
– Configurable response data length, optionally defined automatically by the Identifier
– Self synchronization in slave node configuration
– Automatic processing and verification of the “Break Field” and “Sync Field”
– The “Break Field” is detected even if it is partially superimposed with a data byte
– Optional, automatic identifier parity management
– Optional, automatic checksum management
– Supports both “Classic” and “Enhanced” checksum types
– Full LIN error checking and reporting
– Frame Slot Mode: the master allocates slots to scheduled frames automatically.
– Wakeup signal generation
• Test Modes
– Automatic echo, remote- and local loopback
• Supports two Peripheral DMA Controller channels
– Buffer transfers without processor intervention
25.2 Overview
The Universal Synchronous Asynchronous Receiver Transmitter (USART) provides a full
duplex, universal, synchronous/asynchronous serial link. Data frame format is widely configu-
rable, including basic length, parity, and stop bit settings, maximizing standards support. The
receiver implements parity-, framing-, and overrun error detection, and can handle un-fixed
546
32072H–AVR32–10/2012
AT32UC3A3
frame lengths with the time-out feature. The USART supports several operating modes, provid-
ing an interface to RS485, LIN, and SPI buses, with ISO7816 T=0 and T=1 smart card slots,
infrared transceivers, and modem port connections. Communication with slow and remote
devices is eased by the timeguard. Duplex multidrop communication is supported by address
and data differentiation through the parity bit. The hardware handshaking feature enables an
out-of-band flow control, automatically managing RTS and CTS pins. The Peripheral DMA Con-
troller connection enables memory transactions, and the USART supports chained buffer
management without processor intervention. Automatic echo, remote-, and local loopback test
modes are also supported.
Channel Channel
USART I/O
Controller
RXD
Receiver
RTS
DTR
CLK
BaudRate
Generator
User
Interface
Peripheral bus
547
32072H–AVR32–10/2012
AT32UC3A3
548
32072H–AVR32–10/2012
AT32UC3A3
25.5.2 Clocks
The clock for the USART bus interface (CLK_USART) is generated by the Power Manager. This
clock is enabled at reset, and can be disabled in the Power Manager. It is recommended to dis-
able the USART before disabling the clock, to avoid freezing the USART in an undefined state.
25.5.3 Interrupts
The USART interrupt request line is connected to the interrupt controller. Using the USART
interrupt requires the interrupt controller to be programmed first.
549
32072H–AVR32–10/2012
AT32UC3A3
550
32072H–AVR32–10/2012
AT32UC3A3
4. Check that CSR.TXRDY and/or CSR.RXRDY is one before writing to THR and/or read-
ing from RHR respectively
Baud Rate
Clock
TXD
The characters are sent by writing to the Character to be Transmitted field (THR.TXCHR). The
transmitter status can be read from the Transmitter Ready and Transmitter Empty bits in the
Channel Status Register (CSR.TXRDY/CSR.TXEMPTY). CSR.TXRDY is set when THR is
empty. CSR.TXEMPTY is set when both THR and the transmit shift register are empty (trans-
mission complete). An interrupt request is generated if the corresponding bit in the Interrupt
Mask Register (IMR) is set (IMR.TXRDY/IMR.TXEMPTY). Both CSR.TXRDY and
CSR.TXEMPTY are cleared when the transmitter is disabled. CSR.TXRDY and CSR.TXEMPY
can also be cleared by writing a one to the Start Break bit in CR (CR.STTBRK). Writing a char-
acter to THR while CSR.TXRDY is zero has no effect and the written character will be lost.
551
32072H–AVR32–10/2012
AT32UC3A3
TXD
Start Parity Stop Start Parity Stop
D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7
Bit Bit Bit Bit Bit Bit
Write
THR
TXRDY
TXEMPTY
Sampling
Clock (x16)
RXD
Sampling
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
D0
Start Sampling
Detection
RXD
Sampling
1 2 3 4 5 6 7 0 1 2 3 4
Start
Rejection
552
32072H–AVR32–10/2012
AT32UC3A3
Baud Rate
Clock
RXD
Start 16 16 16 16 16 16 16 16 16 16
Detection samples samples samples samples samples samples samples samples samples samples
D0 D1 D2 D3 D4 D5 D6 D7 Parity Stop
Bit Bit
Baud Rate
Clock
RXD
Sampling
Start D0 D1 D2 D3 D4 D5 D6 D7 Stop Bit
Parity Bit
RXD
Start Parity Stop Start Parity Stop
D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7
Bit Bit Bit Bit Bit Bit
RSTSTA = 1
Write
CR
Read
RHR
RXRDY
OVRE
553
32072H–AVR32–10/2012
AT32UC3A3
Interrupt Mask Register (IMR.RXRDY) is set. If CSR.RXRDY is already set, RHR will be over-
written and the Overrun Error bit (CSR.OVRE) is set. An interrupt request is generated if the
Overrun Error bit in IMR is set. Reading RHR will clear CSR.RXRDY, and writing a one to the
Reset Status bit in the Control Register (CR.RSTSTA) will clear CSR.OVRE. Refer to Figure 25-
7.
25.6.3.1 Parity
The USART supports five parity modes, selected by MR.PAR:
• Even parity
• Odd parity
• Parity forced to zero (space)
• Parity forced to one (mark)
• No parity
The PAR field also enables the Multidrop mode, see ”Multidrop Mode” on page 555. If even par-
ity is selected (MR.PAR is 0x0), the parity bit will be zero if there is an even number of ones in
the data character, and one if there is an odd number. For odd parity the reverse applies. If
space or mark parity is chosen (MR.PAR is 0x2 or 0x3, respectively), the parity bit will always be
a zero or one, respectively. See Table 25-4.
The receiver will report parity errors in CSR.PARE, unless parity is disabled. An interrupt request
is generated if the PARE bit in the Interrupt Mask Register is set (IMR.PARE). Writing a one to
CR.RSTSTA will clear CSR.PARE. See Figure 25-8.
RXD
Start Bad Stop
D0 D1 D2 D3 D4 D5 D6 D7
Bit Parity Bit
Bit RSTSTA = 1
Write
CR
PARE
RXRDY
554
32072H–AVR32–10/2012
AT32UC3A3
Baud Rate
Clock
TXD
Start Parity Stop Start Parity Stop
D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7
Bit Bit Bit Bit Bit Bit
Write
THR
TXRDY
TXEMPTY
555
32072H–AVR32–10/2012
AT32UC3A3
Baud Rate TO
Clock
16-bit
Value
1 D Q Clock 16-bit Time-out
Counter
STTTO = TIMEOUT
Load 0
Clear
Character
Received
RETTO
556
32072H–AVR32–10/2012
AT32UC3A3
Baud Rate
Clock
RXD
Start Parity Stop
D0 D1 D2 D3 D4 D5 D6 D7
Bit Bit Bit
RSTSTA = 1
Write
CR
FRAME
RXRDY
Baud Rate
Clock
TXD
Start Parity Stop
Bit
D0 D1 D2 D3 D4 D5 D6 D7
Bit Bit
Break Transmission End of Break
STTBRK = 1 STPBRK = 1
Write
CR
TXRDY
TXEMPTY
557
32072H–AVR32–10/2012
AT32UC3A3
USCLKS CD
CLK_USART CD
0 CLK
CLK_USART/DIV
1
Reserved 16-bit Counter
CLK 2 >1 FIDI
SYNC
3 OVER
1
0
0 0 Sampling
0
Divider
BaudRate
1 Clock
1
SYNC
Sampling
USCLKS= 3 Clock
SelectedClock -
BaudRate = -----------------------------------------------
( 8 ( 2 – OVER )CD )
558
32072H–AVR32–10/2012
AT32UC3A3
This gives a maximum baud rate of CLK_USART divided by 8, assuming that CLK_USART is
the fastest clock available, and that MR.OVER is one.
559
32072H–AVR32–10/2012
AT32UC3A3
the Fractional Part field in BRGR (BRGR.FP), and is activated by giving it a non-zero value. The
resolution is one eighth of CD. The resulting baud rate is calculated using the following formula:
SelectedClock
BaudRate = -------------------------------------------------------------------
-
⎛ 8 ( 2 – OVER ) ⎛ CD + FP -------⎞ ⎞
⎝ ⎝ 8 ⎠⎠
USCLKS Modulus
CD
Control
FP
CLK_USART CD
0 CLK
CLK_USART/DIV
1
Reserved 16-bit Counter glitch-free
CLK 2
logic >1 SYNC
3 OVER
1 0
0 0 Sampling
Divider 0
BaudRate
1 Clock
1
SYNC Sampling
USCLKS = 3 Clock
BaudRate = SelectedClock
--------------------------------------
CD
When CLK is selected, the frequency of the external clock must be at least 4.5 times lower than
the system clock, and when either CLK or CLK_USART/DIV are selected, BRGR.CD must be
even to ensure a 50/50 duty cycle. If CLK_USART is selected, the generator ensures this
regardless of value.
560
32072H–AVR32–10/2012
AT32UC3A3
USART
RXD
Differential
TXD Bus
RTS
If a timeguard has been configured the RTS pin will remain high for the duration specified in TG,
as shown in Figure 25-16.
TXD
Start Parity Stop
D0 D1 D2 D3 D4 D5 D6 D7
Bit Bit Bit
Write
THR
TXRDY
TXEMPTY
RTS
USART Remote
Device
TXD RXD
RXD TXD
CTS RTS
RTS CTS
561
32072H–AVR32–10/2012
AT32UC3A3
Writing 0x2 to the MR.MODE field configures the USART to operate in hardware handshaking
mode. The receiver will drive its RTS pin high when disabled or when the Reception Buffer Full
bit (CSR.RXBUFF) is set by the Buffer Full signal from the Peripheral DMA controller. If the
receiver RTS pin is high, the transmitter CTS pin will also be high and only the active character
transmissions will be completed. Allocating a new buffer to the DMA controller by clearing
RXBUFF, will drive the RTS pin low, allowing the transmitter to resume transmission. Detected
level changes on the CTS pin are reported by the CTS Input Change bit in the Channel Status
Register (CSR.CTSIC). An interrupt request is generated if the Input Change bit in the Interrupt
Mask Register is set. CSR.CTSIC is cleared when reading CSR.
Figure 25-18 illustrates receiver functionality, and Figure 25-19 illustrates transmitter
functionality.
RXD
RXEN = 1 RXDIS = 1
Write
CR
RTS
RXBUFF
CTS
TXD
562
32072H–AVR32–10/2012
AT32UC3A3
The DTR pin is controlled by the DTR enable and disable bits in CR (CR.DTREN and
CR.DTRDIS). Writing a one to CR.DTRDIS drives DTR high, and writing a one to CR.DTREN
drives DTR low. The RTS pin is controlled automatically.
Detected level changes are reported by the respective Input Change bits in CSR (CSR.RIIC,
CSR.DSRIC, CSR.DCDIC, and CSR.CTSIC). An interrupt request is generated if the corre-
sponding bit in the Interrupt Mask Register is set. The Input Change bits in CSR are
automatically cleared when CSR is read. When the CTS pin goes high, the USART will wait for
the transmitter to complete any ongoing character transmission before automatically disabling it.
In both T=0 and T=1 modes, the character format is fixed to eight data bits, and one or two stop
bits, regardless of CHRL, MODE9, and CHMODE values. Parity according to specification is
even. If the inverse transmission format is used, where payload data bits are transmitted
inverted on the I/O line, the user can use odd parity and perform an XOR on data headed to
THR and coming from RHR.
563
32072H–AVR32–10/2012
AT32UC3A3
Fi is a binary value encoded on a 4-bit field, named FI, as represented in Table 25-10.
Table 25-11 shows the resulting Fi/Di ratio, which is the ratio between the ISO7816 clock and
the Baud Rate Clock.
564
32072H–AVR32–10/2012
AT32UC3A3
ISO7816 Clock
on CLK
1 ETU
RXD
I/O Error
565
32072H–AVR32–10/2012
AT32UC3A3
USART IrDA
Transceivers
Receiver Demodulator RXD RX
TX
Transmitter Modulator TXD
The receiver and the transmitter must be exclusively enabled or disabled, according to the direc-
tion of the transmission. To receive IrDA signals, the following needs to be done:
• Disable TX and enable RX.
• Configure the TXD pin as an I/O, outputting zero to avoid LED activation. Disable the internal
pull-up for improved power consumption.
• Receive data.
566
32072H–AVR32–10/2012
AT32UC3A3
TXD
Bit Period 3
16 Bit Period
567
32072H–AVR32–10/2012
AT32UC3A3
CLK_USART
RXD
Counter Pulse
Value 6 5 4 3 2 6 6 5 4 3 2 1 0 Accepted
Pulse
Rejected
Receiver
Input Driven Low During 16 Baud Rate Clock Cycles
568
32072H–AVR32–10/2012
AT32UC3A3
TXD
Break Start Stop Start Stop
Break Field 1 0 1 0 1 0 1 0 ID0 ID1 ID2 ID3 ID4 ID5 ID6 ID7
Delimiter Bit Bit Bit Bit
13 dominant bits (at 0) Synch Byte = 0x55
1 recessive bit
Write (at 1)
LINIR
LINIR ID
TXRDY
569
32072H–AVR32–10/2012
AT32UC3A3
RXD
Break Field Break Start Stop Start Stop
1 0 1 0 1 0 1 0 ID0 ID1 ID2 ID3 ID4 ID5 ID6 ID7
13 dominant bits (at 0) Delimiter Bit Bit Bit Bit
1 recessive bit Synch Byte = 0x55
(at 1)
LINID
US_LINIR
Write US_CR
With RSTSTA=1
See also ”Slave Node Configuration” on page 576.
Start Stop
bit bit
The counter starts when the Sync field start bit is detected, and continues for eight bit periods.
The 16 most significant bits (counter value divided by 8) becomes the new clock divider
(BRGR.CD), and the three least significant bits (the remainder) becomes the new fractional part
(BRGR.FP).
RXD
Break Start Stop Start Stop
Break Field 1 0 1 0 1 0 1 0 ID0 ID1 ID2 ID3 ID4 ID5 ID6 ID7
Delimiter Bit Bit Bit Bit
13 dominant bits (at 0) Synch Byte = 0x55
1 recessive bit
(at 1)
LINIDRX
Reset
Synchro Counter 000_0011_0001_0110_1101
570
32072H–AVR32–10/2012
AT32UC3A3
• The theoretical slave node clock frequency; nominal clock frequency (FNom)
• The baud rate
• The oversampling mode (OVER=0 => 16x, or OVER=1 => 8x)
The following formula is used to calculate synchronization deviation, where FSLAVE is the real
slave node clock frequency, and FTOL_UNSYNC is the difference between FNom and FSLAVE. Accord-
ing to the LIN specification, FTOL_UNSYNCH may not exceed ±15%, and the bit rates between two
nodes must be within ±2% of each other, resulting in a maximal BaudRate_deviation of ±1%.
[ α × 8 × ( 2 – OVER ) + β ] × BaudRate
BaudRate_deviation = ⎛ 100 × ---------------------------------------------------------------------------------------------------⎞ %
⎝ 8 × F SLAVE ⎠
⎛ ⎞
⎜ α × 8 × ( 2 – OVER ) + β ] × BaudRate-⎟
[--------------------------------------------------------------------------------------------------
BaudRate_deviation = ⎜ 100 × ⎟%
⎜ ⎛
F TOL_UNSYNC
⎞ ⎟
⎝ 8 × ------------------------------------ xF Nom ⎠
⎝ 100 ⎠
⎛ ⎞
⎜ 0,5 × 8 × ( 2 – OVER ) + 1 ] × BaudRate-⎟
[------------------------------------------------------------------------------------------------------
F Nom ( min ) = ⎜ 100 × ⎟ Hz
⎜ ⎛ – 15
8 × ---------- + 1 × 1% ⎞ ⎟
⎝ ⎝ 100 ⎠ ⎠
Examples:
• Baud rate = 20 kbit/s, OVER=0 (Oversampling 16x) => FNom(min) = 2.64 MHz
• Baud rate = 20 kbit/s, OVER=1 (Oversampling 8x) => FNom(min) = 1.47 MHz
• Baud rate = 1 kbit/s, OVER=0 (Oversampling 16x) => FNom(min) = 132 kHz
• Baud rate = 1 kbit/s, OVER=1 (Oversampling 8x) => FNom(min) = 74 kHz
If the fractional part is not used, the synchronization accuracy is much lower. The 16 most signif-
icant bits, added with the first least significant bit, becomes the new clock divider (CD). The
equation of the baud rate deviation is the same as above, but the constants are:
– 4 ≤ α ≤ +4 -1 < β < +1
Examples:
• Baud rate = 20 kbit/s, OVER=0 (Oversampling 16x) => FNom(min) = 19.12 MHz
• Baud rate = 20 kbit/s, OVER=1 (Oversampling 8x) => FNom(min) = 9.71 MHz
• Baud rate = 1 kbit/s, OVER=0 (Oversampling 16x) => FNom(min) = 956 kHz
• Baud rate = 1 kbit/s, OVER=1 (Oversampling 8x) => FNom(min) = 485 kHz
571
32072H–AVR32–10/2012
AT32UC3A3
enabled by default, and can be disabled by writing a one to the Parity Disable bit in the LIN
Mode register (LINMR.PARDIS).
• LINMR.PARDIS=0: During header transmission, the parity bits are computed and in the shift
register they replace bits 6 and 7 from LINIR.IDCHR. During header reception, the parity bits
are checked and can generate a LIN Identifier Parity Error (see Section 25.6.10.13). Bits 6
and 7 in LINIR.IDCHR read as zero when receiving.
• LINMR.PARDIS=1: During header transmission, all the bits in LINIR.IDCHR are sent on the
bus. During header reception, all the bits in LINIR.IDCHR are updated with the received
Identifier.
572
32072H–AVR32–10/2012
AT32UC3A3
• LINMR.DLM=1: the response data length is defined by the Identifier (LINIR.IDCHR) bits
according to the table below.
25.6.10.11 Checksum
The last frame field is the checksum. It is configured by the Checksum Type (LINMR.CHKTYP),
and the Checksum Disable (LINMR.CHKDIS) bits. CSR.TXRDY will not be set after the last THR
data write if enabled. Writing a one to LINMR.CHKDIS will disable the automatic checksum gen-
eration/checking, and the user may send/check this last byte manually, disguised as a normal
data. The checksum is an inverted 8-bit sum with carry, either:
• Over all data bytes, called a classic checksum. This is used for LIN 1.3 compliant slaves, and
automatically managed when CHKDIS=0, and CHKTYP=1.
• Over all data bytes and the protected identifier, called an enhanced checksum. This is used
for LIN 2.0 compliant slaves, and automatically managed when CHKDIS=0, and CHKTYP=0.
Frame
Inter-
frame
Response
space
space
Header Data3 Response
TXRDY
Frame Slot Mode Frame Slot Mode
Disabled Enabled
Write
LINID
Write
THR Data 1 Data 2 Data 3 Data N
LINTC
573
32072H–AVR32–10/2012
AT32UC3A3
The minimum frame slot size is determined by TFrame_Maximum, and calculated below (all val-
ues in bit periods):
• THeader_Nominal = 34
• TFrame_Maximum = 1.4 x (THeader_Nominal + TResponse_Nominal + 1)
Note: The term “+1” leads to an integer result for TFrame_Max (LIN Specification 1.3)
If the Checksum is sent (CHKDIS=0):
• TResponse_Nominal = 10 x (NData + 1)
• TFrame_Maximum = 1.4 x (34 + 10 x (DLC + 1 + 1) + 1)
• TFrame_Maximum = 77 + 14 x DLC
If the Checksum is not sent (CHKDIS=1):
• TResponse_Nominal = 10 x NData
• TFrame_Maximum = 1.4 x (34 + 10 x (DLC + 1) + 1)
• TFrame_Maximum = 63 + 14 x DLC
574
32072H–AVR32–10/2012
AT32UC3A3
• Write a one to CR.TXEN and CR.RXEN to enable both transmitter and receiver
• Wait until CSR.TXRDY is one
• Send the header by writing to LINIR.IDCHR
The following procedure depends on the LINMR.NACT setting:
• Case 1: LINMR.NACT is 0x0 (PUBLISH, the USART transmits the response)
– Wait until CSR.TXRDY is one
– Send a byte by writing to THR.TXCHR
– Repeat the two previous steps until there is no more data to send
– Wait until CSR.LINTC is one
– Check for LIN errors
• Case 2: LINMR.NACT is 0x1 (SUBSCRIBE, the USART receives the response)
– Wait until CSR.RXRDY is one
– Read RHR.RXCHR
– Repeat the two previous steps until there is no more data to read
– Wait until CSR.LINTC is one
– Check for LIN errors
• Case 3: LINMR.NACT is 0x2 (IGNORE, the USART is not concerned by a response)
– Wait until CSR.LINTC is one
– Check for LIN errors
Frame
Inter-
frame
Response space
space
Header Data3 Response
TXRDY
FSDIS=1 FSDIS=0
RXRDY
Write
LINIR
Write
THR Data 1 Data 2 Data 3 Data N
LINTC
575
32072H–AVR32–10/2012
AT32UC3A3
Frame Inter-
frame
Response space
space
Header Data3 Response
TXRDY
FSDIS=1 FSDIS=0
RXRDY
Write
LINIR
Read
RHR Data 1 Data N-2 Data N-1 Data N
LINTC
Frame Inter-
frame
Response space
space
Header Data3 Response
TXRDY
FSDIS=1 FSDIS=0
RXRDY
Write
LINIR
LINTC
576
32072H–AVR32–10/2012
AT32UC3A3
The different LINMR.NACT settings result in the same procedure as for the master node, see
page 574.
TXRDY
RXRDY
LINIDRX
Read
LINID
Write
THR Data 1 Data 2 Data 3 Data N
LINTC
TXRDY
RXRDY
LINIDRX
Read
LINID
Read
RHR Data 1 Data N-2 Data N-1 Data N
LINTC
TXRDY
RXRDY
LINIDRX
Read
LINID
Read
RHR
LINTC
577
32072H–AVR32–10/2012
AT32UC3A3
CSR.RXRDY bits to trigger one byte writes or reads. It always writes to THR, and it always reads
RHR.
DATA 0
DATA N
578
32072H–AVR32–10/2012
AT32UC3A3
NACT NACT
PARDIS PARDIS
CHKDIS CHKDIS
CHKTYP CHKTYP
DLM DLM
FSDIS FSDIS
DLC DLC
|
|
|
|
|
| |
|
DATA N
DATA N
DATA N DATA N
579
32072H–AVR32–10/2012
AT32UC3A3
According to LIN 1.3, the wakeup request should be generated with the character 0x80 in order
to impose eight successive dominant bits.
According to LIN 2.0, the wakeup request is issued by forcing the bus into the dominant state for
250µs to 5ms. Sending the character 0xF0 does this, regardless of baud rate.
• Baud rate max = 20 kbit/s -> one bit period = 50µs -> five bit periods = 250µs
• Baud rate min = 1 kbit/s -> one bit period = 1ms -> five bit periods = 5ms
580
32072H–AVR32–10/2012
AT32UC3A3
581
32072H–AVR32–10/2012
AT32UC3A3
C LK
(C POL= 0)
C LK
(CPO L= 1)
M O SI
SPI M aster ->TXD M SB 6 5 4 3 2 1 LSB
SPI Slave ->RXD
M ISO
SPI M aster ->RXD M SB 6 5 4 3 2 1 LSB
SPI Slave ->TXD
NSS
SPI M aster ->RTS
SPI Slave ->CTS
CLK
(CPOL= 0)
CLK
(CPOL= 1)
M O SI
SPI M aster -> TXD M SB 6 5 4 3 2 1 LSB
SPI Slave -> RXD
M ISO
SPI M aster -> RXD M SB 6 5 4 3 2 1 LSB
SPI Slave -> TXD
NSS
SPI M aster -> RTS
SPI Slave -> CTS
582
32072H–AVR32–10/2012
AT32UC3A3
In SPI slave mode, a low level on NSS for at least one bit period will allow the slave to initiate a
transmission or reception. The Underrun Error bit (CSR.UNRE) is set if a character must be sent
while THR is empty, and TXD will be high during character transmission, as if 0xFF was being
sent. An interrupt request is generated if the Underrun Error bit in the Interrupt Mask Register
(IMR.UNRE) is set. If a new character is written to THR it will be sent correctly during the next
transmission slot. Writing a one to CR.RSTSTA will clear CSR.UNRE. To ensure correct behav-
ior of the receiver in SPI slave mode, the master device sending the frame must ensure a
minimum delay of one bit period in between each character transmission.
A Manchester encoded character can be preceded by both a preamble sequence and a start
frame delimiter. The preamble sequence is a pre-defined pattern with a configurable length from
1 to 15 bit periods. If the preamble length is zero, the preamble waveform is not generated. The
preamble length is selected by writing to the Transmitter Preamble Length field (MAN.TX_PL).
The available preamble sequence patterns are:
• ALL_ONE
• ALL_ZERO
• ONE_ZERO
• ZERO_ONE
and are selected by writing to the Transmitter Preamble Pattern field (MAN.TX_PP). Figure 25-
45 illustrates the supported patterns.
583
32072H–AVR32–10/2012
AT32UC3A3
Manchester
encoded SFD DATA
data Txd
Manchester
encoded SFD DATA
data Txd
Manchester
encoded SFD
Txd DATA
data
Manchester
encoded SFD DATA
data Txd
The Start Frame Delimiter Selector bit (MR.ONEBIT) configures the Manchester start bit pattern
following the preamble. If MR.ONEBIT is one, a Manchester encoded zero is transmitted to indi-
cate that a new character is about to be sent. If MR.ONEBIT is zero, a synchronization pattern is
sent for the duration of three bit periods to inaugurate the new character. The sync pattern wave-
form by itself is an invalid Manchester encoding, since the transition only occurs at the middle of
the second bit period.
The Manchester Synchronization Mode bit (MR.MODSYNC) selects sync pattern, and this also
defines if the character is data (MODSYNC=0) with a zero to one transition, or a command
(MODSYNC=1) with a one to zero transition. When direct memory access is used, the sync pat-
tern can be updated on-the-fly with a modified character located in memory. To enable this
mode the Variable Synchronization of Command/Data Sync Start Frame Delimiter bit
(MR.VAR_SYNC) must be written to one. In this case, MODSYNC is bypassed and
THR.TXSYNH selects the sync type to be included. Figure 25-46 illustrates supported patterns.
584
32072H–AVR32–10/2012
AT32UC3A3
SFD
Manchester
encoded DATA
data Txd
Command Sync
start frame delimiter
SFD
Manchester
encoded DATA
data Txd
Data Sync
start frame delimiter
Oversampling
16x Clock
RXD
Sampling
point
Expected edge
Synchro. Tolerance Sync Synchro.
Synchro. Jump Jump Error
Error
585
32072H–AVR32–10/2012
AT32UC3A3
The Manchester endec uses the same Start Frame Delimiter Selector (MR.ONEBIT) for both
encoder and decoder. If ONEBIT is one, only a Manchester encoded zero will be accepted as a
valid start frame delimiter. If ONEBIT is zero, a data or command sync pattern will be expected.
The Received Sync bit in the Receive Holding Register (RHR.RXSYNH) will be zero if the last
character received is a data sync, and a one if it is a command sync.
Manchester
encoded SFD DATA
data Txd
The receiver samples the RXD line in continuos bit period quarters, making the smallest time
frame in which to assume a bit value three quarters. A start bit is assumed if RXD is zero during
one of these quarters, see Figure 25-49.
If a valid preamble pattern or start frame delimiter is detected, the receiver continues decoding
with the same synchronization. If a non-valid preamble pattern or a start frame delimiter is
detected, the receiver re-synchronizes at the next valid edge. When a valid start sequence has
been detected, the decoded data is passed to the USART and the user will be notified of any
incoming Manchester encoding violations by the Manchester Error bit (CSR.MANERR). An inter-
rupt request is generated if one of the Manchester Error bits in the Interrupt Mask Register
(IMR.MANE or IMR.MANEA) is set. CSR.MANERR is cleared by writing a one to the Reset Sta-
tus bits in the Control Register (CR.RSTSTA). A violation occurs when there is no transition in
the middle of a bit period. See Figure 25-50 for an illustration of a violation causing the Man-
chester Error bit to be set.
586
32072H–AVR32–10/2012
AT32UC3A3
sampling points
ASK/FSK
Upstream Receiver
Upstream
LNA Serial
Emitter VCO Configuration
RF filter Interface
Demod
ASK/FSK
downstream transmitter
Manchester USART
Downstream encoder Emitter
Receiver PA
RF filter
Mod
VCO
control
To transmit downstream, encoded data is sent serially to the RF modulator and then through
space to the RF receiver. To receive, another frequency carrier is used and the RF demodulator
does a bit-checking search for valid patterns before it switches to a receiving mode and forwards
data to the decoder. Defining preambles to help distinguish between noise and valid data has to
be done in conjunction with the RF module, and may sometimes be filtered away from the endec
stream. Using the ASK modulation scheme, a one is transmitted as an RF signal at the down-
stream frequency, while a zero is transmitted as no signal. See Figure 25-52. The FSK
modulation scheme uses two different frequencies to transmit data. A one is sent as a signal on
one frequency, and a zero on the other. See Figure 25-53.
587
32072H–AVR32–10/2012
AT32UC3A3
Manchester
encoded
data Txd
default polarity
unipolar output
FSK Modulator
Output
Uptstream Frequencies
[F0, F0+offset]
TXD
Transmitter
588
32072H–AVR32–10/2012
AT32UC3A3
TXD
Transmitter
TXD
Transmitter 1
TXD
Transmitter
25.6.18 Interrupts
– – MANEA
23 22 21 20 19 18 17 16
– – – MANE CTSIC DCDIC DSRIC RIIC
15 14 13 12 11 10 9 8
LINTC LINIR NACK RXBUFF – ITER/UNRE TXEMPTY TIMEOUT
589
32072H–AVR32–10/2012
AT32UC3A3
7 6 5 4 3 2 1 0
PARE FRAME OVRE – – RXBRK TXRDY RXRDY
590
32072H–AVR32–10/2012
AT32UC3A3
– There has been a time-out since the last Start Time-out command.
• PARE: Parity Error
– Either at least one parity error has been detected, or the parity bit is a one in
multidrop mode, since the last RSTSTA.
• FRAME: Framing Error
– At least one stop bit has been found as low since the last RSTSTA.
• OVRE: Overrun Error
– At least one overrun error has occurred since the last RSTSTA.
• RXBRK: Break Received/End of Break
– Break received or End of Break detected since the last RSTSTA.
• TXRDY: Transmitter Ready
– There is no character in the THR.
• RXRDY: Receiver Ready
– At least one complete character has been received and RHR has not yet been read.
An interrupt source will set a corresponding bit in the Channel Status Register (CSR). The inter-
rupt sources will generate an interrupt request if the corresponding bit in the Interrupt Mask
Register (IMR) is set. The interrupt sources are ORed together to form one interrupt request.
The USART will generate an interrupt request if at least one of the bits in IMR is set. Bits in IMR
are set by writing a one to the corresponding bit in the Interrupt Enable Register (IER), and
cleared by writing a one to the corresponding bit in the Interrupt Disable Register (IDR). The
interrupt request remains active until the corresponding bit in CSR is cleared. The clearing of the
bits in CSR is described in ”Channel Status Register” on page 602. Because all the interrupt
sources are ORed together, the interrupt request from the USART will remain active until all the
bits in CSR are cleared.
591
32072H–AVR32–10/2012
AT32UC3A3
592
32072H–AVR32–10/2012
AT32UC3A3
593
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – LINWKUP LINABT RTSDIS/RCS RTSEN/FCS DTRDIS DTREN
15 14 13 12 11 10 9 8
RETTO RSTNACK RSTIT SENDA STTTO STPBRK STTBRK RSTSTA
7 6 5 4 3 2 1 0
TXDIS TXEN RXDIS RXEN RSTTX RSTRX – –
594
32072H–AVR32–10/2012
AT32UC3A3
595
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
ONEBIT MODSYNC MAN FILTER – MAX_ITERATION
23 22 21 20 19 18 17 16
– VAR_SYNC DSNACK INACK OVER CLKO MODE9 MSBF/CPOL
15 14 13 12 11 10 9 8
CHMODE NBSTOP PAR SYNC/CPHA
7 6 5 4 3 2 1 0
CHRL USCLKS MODE
This register can only be written if write protection is disabled in the “Write Protect Mode Register” (WPMR.WPEN is zero).
• ONEBIT: Start Frame Delimiter Selector
0: The start frame delimiter is a command or data sync, as defined by MODSYNC.
1: The start frame delimiter is a normal start bit, as defined by MODSYNC.
• MODSYNC: Manchester Synchronization Mode
0: The manchester start bit is either a 0-to-1 transition, or a data sync.
1: The manchester start bit is either a 1-to-0 transition, or a command sync.
• MAN: Manchester Encoder/Decoder Enable
0: Manchester endec is disabled.
1: Manchester endec is enabled.
• FILTER: Infrared Receive Line Filter
0: The USART does not filter the receive line.
1: The USART filters the receive line by doing three consecutive samples and uses the majority value.
• MAX_ITERATION
This field determines the number of acceptable consecutive NACKs when in protocol T=0.
• VAR_SYNC: Variable Synchronization of Command/Data Sync Start Frame Delimiter
0: Sync pattern according to MODSYNC.
1: Sync pattern according to THR.TXSYNH.
• DSNACK: Disable Successive NACK
0: NACKs are handled as normal, unless disabled by INACK.
1: The receiver restricts the amount of consecutive NACKs by MAX_ITERATION value. If MAX_ITERATION=0 no NACK will be
issued and the first erroneous message is accepted as a valid character, setting CSR.ITER.
• INACK: Inhibit Non Acknowledge
0: The NACK is generated.
1: The NACK is not generated.
• OVER: Oversampling Mode
0: Oversampling at 16 times the baud rate.
1: Oversampling at 8 times the baud rate.
• CLKO: Clock Output Select
0: The USART does not drive the CLK pin.
1: The USART drives the CLK pin unless USCLKS selects the external clock.
596
32072H–AVR32–10/2012
AT32UC3A3
Table 25-18.
CHMODE Mode Description
0 0 Normal Mode
0 1 Automatic Echo. Receiver input is connected to the TXD pin.
1 0 Local Loopback. Transmitter output is connected to the Receiver input.
1 1 Remote Loopback. RXD pin is internally connected to the TXD pin.
Table 25-19.
NBSTOP Asynchronous (SYNC=0) Synchronous (SYNC=1)
0 0 1 stop bit 1 stop bit
0 1 1.5 stop bits Reserved
1 0 2 stop bits 2 stop bits
1 1 Reserved Reserved
Table 25-20.
PAR Parity Type
0 0 0 Even parity
0 0 1 Odd parity
0 1 0 Parity forced to 0 (Space)
0 1 1 Parity forced to 1 (Mark)
1 0 x No parity
1 1 x Multidrop mode
597
32072H–AVR32–10/2012
AT32UC3A3
CPHA = 1: Data is captured on the leading edge of CLK and changed on the following edge of CLK.
• CHRL: Character Length.
Table 25-21.
CHRL Character Length
0 0 5 bits
0 1 6 bits
1 0 7 bits
1 1 8 bits
Table 25-22.
USCLKS Selected Clock
0 0 CLK_USART
0 1 CLK_USART/DIV(1)
1 0 Reserved
1 1 CLK
Note: 1. The value of DIV is device dependent. Please refer to the Module Configuration section at the end of this chapter.
• MODE
Table 25-23.
MODE Mode of the USART
0 0 0 0 Normal
0 0 0 1 RS485
0 0 1 0 Hardware Handshaking
0 0 1 1 Modem
0 1 0 0 IS07816 Protocol: T = 0
0 1 1 0 IS07816 Protocol: T = 1
1 0 0 0 IrDA
1 0 1 0 LIN Master
1 0 1 1 LIN Slave
1 1 1 0 SPI Master
1 1 1 1 SPI Slave
Others Reserved
598
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – LINSNRE LINCE LINIPE LINISFE LINBE MANEA
23 22 21 20 19 18 17 16
– – – MANE CTSIC DCDIC DSRIC RIIC
15 14 13 12 11 10 9 8
LINTC LINIR NACK RXBUFF – ITER/UNRE TXEMPTY TIMEOUT
7 6 5 4 3 2 1 0
PARE FRAME OVRE – – RXBRK TXRDY RXRDY
599
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – LINSNRE LINCE LINIPE LINISFE LINBE MANEA
23 22 21 20 19 18 17 16
– – – MANE CTSIC DCDIC DSRIC RIIC
15 14 13 12 11 10 9 8
LINTC LINIR NACK RXBUFF – ITER/UNRE TXEMPTY TIMEOUT
7 6 5 4 3 2 1 0
PARE FRAME OVRE – – RXBRK TXRDY RXRDY
600
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – LINSNRE LINCE LINIPE LINISFE LINBE MANEA
23 22 21 20 19 18 17 16
– – – MANE CTSIC DCDIC DSRIC RIIC
15 14 13 12 11 10 9 8
LINTC LINIR NACK RXBUFF – ITER/UNRE TXEMPTY TIMEOUT
7 6 5 4 3 2 1 0
PARE FRAME OVRE – – RXBRK TXRDY RXRDY
601
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – LINSNRE LINCE LINIPE LINISFE LINBE MANERR
23 22 21 20 19 18 17 16
CTS DCD DSR RI CTSIC DCDIC DSRIC RIIC
15 14 13 12 11 10 9 8
LINTC LINIR NACK RXBUFF – ITER/UNRE TXEMPTY TIMEOUT
7 6 5 4 3 2 1 0
PARE FRAME OVRE – – RXBRK TXRDY RXRDY
602
32072H–AVR32–10/2012
AT32UC3A3
1: DSR is high.
• RI: Image of RI Input
0: RI is low.
1: RI is high.
• CTSIC: Clear to Send Input Change Flag
0: No change has been detected on the CTS pin since the last CSR read.
1: At least one change has been detected on the CTS pin since the last CSR read.
This bit is cleared when reading CSR.
• DCDIC: Data Carrier Detect Input Change Flag
0: No change has been detected on the DCD pin since the last CSR read.
1: At least one change has been detected on the DCD pin since the last CSR read.
This bit is cleared when reading CSR.
• DSRIC: Data Set Ready Input Change Flag
0: No change has been detected on the DSR pin since the last CSR read.
1: At least one change has been detected on the DSR pin since the last CSR read.
This bit is cleared when reading CSR.
• RIIC: Ring Indicator Input Change Flag
0: No change has been detected on the RI pin since the last CSR read.
1: At least one change has been detected on the RI pin since the last CSR read.
This bit is cleared when reading CSR.
• LINTC: LIN Transfer Completed
0: The USART is either idle or a LIN transfer is ongoing.
1: A LIN transfer has been completed since the last RSTSTA.
This bit is cleared by writing a one to CR.RSTSTA:
• LINIR: LIN Identifier
0: No LIN Identifier has been sent or received.
1: A LIN Identifier has been sent (master) or received (slave), since the last RSTSTA.
This bit is cleared by writing a one to CR.RSTSTA:
• NACK: Non Acknowledge
0: No Non Acknowledge has been detected since the last RSTNACK.
1: At least one Non Acknowledge has been detected since the last RSTNACK.
This bit is cleared by writing a one to CR.RSTNACK.
• RXBUFF: Reception Buffer Full
0: The Buffer Full signal from the Peripheral DMA Controller channel is inactive.
1: The Buffer Full signal from the Peripheral DMA Controller channel is active.
• ITER/UNRE: Max Number of Repetitions Reached or SPI Underrun Error
If USART operates in SPI Slave Mode:
UNRE = 0: No SPI underrun error has occurred since the last RSTSTA.
UNRE = 1: At least one SPI underrun error has occurred since the last RSTSTA.
If USART does not operate in SPI Slave Mode, no functionality is associated to UNRE. The bit will behave as ITER if the USART
is in ISO7816 mode:
ITER = 0: Maximum number of repetitions has not been reached since the last RSTSTA.
ITER = 1: Maximum number of repetitions has been reached since the last RSTSTA.
This bit is cleared by writing a one to CR.RSTSTA.
• TXEMPTY: Transmitter Empty
0: The transmitter is either disabled or there are characters in THR, or in the transmit shift register.
1: There are no characters in neither THR, nor in the transmit shift register.
This bit is cleared by writing a one to CR.STTBRK.
• TIMEOUT: Receiver Time-out
0: There has not been a time-out since the last Start Time-out command (CR.STTTO), or RTOR.TO is zero.
1: There has been a time-out since the last Start Time-out command.
This bit is cleared by writing a one to CR.STTTO or CR.RETTO.
603
32072H–AVR32–10/2012
AT32UC3A3
604
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
RXSYNH – – – – – – RXCHR[8]
7 6 5 4 3 2 1 0
RXCHR[7:0]
605
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
TXSYNH – – – – – – TXCHR[8]
7 6 5 4 3 2 1 0
TXCHR[7:0]
606
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – FP
15 14 13 12 11 10 9 8
CD[15:8]
7 6 5 4 3 2 1 0
CD[7:0]
This register can only be written if write protection is disabled in the “Write Protect Mode Register” (WPMR.WPEN is zero).
• FP: Fractional Part
0: Fractional divider is disabled.
1 - 7: Baud rate resolution, defined by FP x 1/8.
• CD: Clock Divider
Table 25-25. Baud Rate in Synchronous Mode (MR.SYNC is 1) and SPI Mode(MR.MODE is 0xE or 0xF)
CD Baud Rate
0 Baud Rate Clock Disabled
607
32072H–AVR32–10/2012
AT32UC3A3
608
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – TO[16]
15 14 13 12 11 10 9 8
TO[15:8]
7 6 5 4 3 2 1 0
TO[7:0]
This register can only be written if write protection is disabled in the “Write Protect Mode Register” (WPMR.WPEN is zero).
• TO: Time-out Value
0: The receiver Time-out is disabled.
1 - 131071: The receiver Time-out is enabled and the time-out delay is TO x bit period.
Note that the size of the TO counter is device dependent, please refer to the Module Configuration section.
609
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
TG
This register can only be written if write protection is disabled in the “Write Protect Mode Register” (WPMR.WPEN is zero).
• TG: Timeguard Value
0: The transmitter Timeguard is disabled.
1 - 255: The transmitter timeguard is enabled and the timeguard delay is TG bit periods.
610
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – FI_DI_RATIO[10:8]
7 6 5 4 3 2 1 0
FI_DI_RATIO[7:0]
This register can only be written if write protection is disabled in the “Write Protect Mode Register” (WPMR.WPEN is zero).
• FI_DI_RATIO: FI Over DI Ratio Value
0: If ISO7816 mode is selected, the baud rate generator does not generate a signal.
1 - 2047: If ISO7816 mode is selected, the baud rate is the clock provided on CLK divided by FI_DI_RATIO.
611
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
NB_ERRORS
612
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
IRDA_FILTER
This register can only be written if write protection is disabled in the “Write Protect Mode Register” (WPMR.WPEN is zero).
• IRDA_FILTER: IrDA Filter
Configures the IrDA demodulator filter.
613
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– DRIFT 1 RX_MPOL – – RX_PP
23 22 21 20 19 18 17 16
– – – – RX_PL
15 14 13 12 11 10 9 8
– – – TX_MPOL – – TX_PP
7 6 5 4 3 2 1 0
– – – – TX_PL
This register can only be written if write protection is disabled in the “Write Protect Mode Register” (WPMR.WPEN is zero).
• DRIFT: Drift cCompensation
0: The USART can not recover from a clock drift.
1: The USART can recover from clock drift (only available in 16x oversampling mode).
• RX_MPOL: Receiver Manchester Polarity
0: Zeroes are encoded as zero-to-one transitions, and ones are encoded as a one-to-zero transitions.
1: Zeroes are encoded as one-to-zero transitions, and ones are encoded as a zero-to-one transitions.
• RX_PP: Receiver Preamble Pattern detected
Table 25-27.
RX_PP Preamble Pattern default polarity assumed (RX_MPOL field not set)
0 0 ALL_ONE
0 1 ALL_ZERO
1 0 ZERO_ONE
1 1 ONE_ZERO
614
32072H–AVR32–10/2012
AT32UC3A3
Table 25-28.
TX_PP Preamble Pattern default polarity assumed (TX_MPOL field not set)
0 0 ALL_ONE
0 1 ALL_ZERO
1 0 ZERO_ONE
1 1 ONE_ZERO
615
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – PDCM
15 14 13 12 11 10 9 8
DLC
7 6 5 4 3 2 1 0
WKUPTYP FSDIS DLM CHKTYP CHKDIS PARDIS NACT
Table 25-29.
NACT Mode Description
0 0 PUBLISH: The USART transmits the response.
616
32072H–AVR32–10/2012
AT32UC3A3
Table 25-29.
0 1 SUBSCRIBE: The USART receives the response.
1 0 IGNORE: The USART does not transmit and does not receive the response.
1 1 Reserved
617
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
IDCHR
618
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
WPKEY[23:16]
23 22 21 20 19 18 17 16
WPKEY[15:8]
15 14 13 12 11 10 9 8
WPKEY[7:0]
7 6 5 4 3 2 1 0
- - - - - - - WPEN
619
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
WPVSRC[15:8]
15 14 13 12 11 10 9 8
WPVSRC[7:0]
7 6 5 4 3 2 1 0
- - - - - - - WPVS
620
32072H–AVR32–10/2012
AT32UC3A3
Name: VERSION
Access Type: Read-only
Offset: 0xFC
Reset Value: -
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - MFN
15 14 13 12 11 10 9 8
- - - - VERSION[11:8]
7 6 5 4 3 2 1 0
VERSION[7:0]
• MFN
Reserved. No functionality associated.
• VERSION
Version of the module. No functionality associated.
26.
621
32072H–AVR32–10/2012
AT32UC3A3
622
32072H–AVR32–10/2012
AT32UC3A3
623
32072H–AVR32–10/2012
AT32UC3A3
27.1 Features
• Compatible with the USB 2.0 specification
• Supports High (480Mbit/s), Full (12Mbit/s) and Low (1.5Mbit/s) speed Device and Embedded Host
• eight pipes/endpoints
• 2368bytes of Embedded Dual-Port RAM (DPRAM) for Pipes/Endpoints
• Up to 2 memory banks per Pipe/Endpoint (Not for Control Pipe/Endpoint)
• Flexible Pipe/Endpoint configuration and management with dedicated DMA channels
• On-Chip UTMI transceiver including Pull-Ups/Pull-downs
• On-Chip pad including VBUS analog comparator
27.2 Overview
The Universal Serial Bus (USB) MCU device complies with the Universal Serial Bus (USB) 2.0
specification, in all speeds.
Each pipe/endpoint can be configured in one of several transfer types. It can be associated with
one or more banks of a dual-port RAM (DPRAM) used to store the current data payload. If sev-
eral banks are used (“ping-pong” mode), then one DPRAM bank is read or written by the CPU or
the DMA while the other is read or written by the USBB core. This feature is mandatory for iso-
chronous pipes/endpoints.
Table 27-1 on page 624 describes the hardware configuration of the USB MCU device.
The theoretical maximal pipe/endpoint configuration (3648bytes) exceeds the real DPRAM size
(2368bytes). The user needs to be aware of this when configuring pipes/endpoints. To fully use
the 2368bytes of DPRAM, the user could for example use the configuration described inTable
27-2 on page 624.
624
32072H–AVR32–10/2012
AT32UC3A3
USB_VBUS
USB_ID
I/O
USB
User Controller
USB_VBOF
PB Interface
2.0 Core
DMFS
DPFS
UTMI
DMHS
DPHS
GCLK_USBB
625
32072H–AVR32–10/2012
AT32UC3A3
3.3 V
Regulator
USB
USB_VBUS Connector
DPHS GND
626
32072H–AVR32–10/2012
AT32UC3A3
USB
USB_VBUS Connector
I/O
USB_ID VBus
USB Controller
USB_VBOF
ID
2.0 Core
DMFS 39 ohms
D-
DPFS 39 ohms
UTMI
D+
DMHS
DPHS GND
5V DC/DC
Generator
USB
USB_VBUS Connector
USB_ID VBus
I/O
USB Controller
USB_VBOF
ID
2.0 Core
DMFS 39 ohms
D-
DPFS 39 ohms
UTMI
D+
DMHS
DPHS GND
627
32072H–AVR32–10/2012
AT32UC3A3
628
32072H–AVR32–10/2012
AT32UC3A3
27.6.2 Clocks
The clock for the USBB bus interface (CLK_USBB) is generated by the Power Manager. This
clock is enabled at reset, and can be disabled in the Power Manager. It is recommended to dis-
able the USBB before disabling the clock, to avoid freezing the USBB in an undefined state.
The UTMI transceiver needs a 12MHz clock as a clock reference for its internal 480MHz PLL.
Before using the USB, the user must ensure that this 12 MHz clock is available. The 12 MHz
input is connected to a Generic Clock (GCLK_USBB) provided by the Power Manager.
27.6.3 Interrupts
The USBB interrupt request line is connected to the interrupt controller. Using the USBB inter-
rupt requires the interrupt controller to be programmed first.
629
32072H–AVR32–10/2012
AT32UC3A3
27.7.1.1 Introduction
After a hardware reset, the USBB is disabled. When enabled, the USBB runs either in device
mode or in host mode according to the ID detection.
If the USB_ID pin is not connected to ground, the USB_ID Pin State bit in the General Status
register (USBSTA.ID) is set (the internal pull-up resistor of the USB_ID pin must be enabled by
the I/O Controller) and device mode is engaged.
The USBSTA.ID bit is cleared when a low level has been detected on the USB_ID pin. Host
mode is then engaged.
USBE = 1
ID = 1
USBE = 0 USBE = 1
ID = 0
Device USBE = 0
Host
After a hardware reset, the USBB is in the Reset state. In this state:
• The macro is disabled. The USBB Enable bit in the General Control register
(USBCON.USBE) is zero.
• The macro clock is stopped in order to minimize power consumption. The Freeze USB Clock
bit in USBCON (USBON.FRZCLK) is set.
• The UTMI is in suspend mode.
• The internal states and registers of the device and host modes are reset.
• The DPRAM is not cleared and is accessible.
• The USBSTA.ID bit and the VBus Level bit in the UBSTA (UBSTA.VBUS) reflect the states of
the USB_ID and USB_VBUS input pins.
• The OTG Pad Enable (OTGPADE) bit, the VBus Polarity (VBUSPO) bit, the FRZCLK bit, the
USBE bit, the USB_ID Pin Enable (UIDE) bit, the USBB Mode (UIMOD) bit in USBCON, and
the Low-Speed Mode Force bit in the Device General Control (UDCON.LS) register can be
written by software, so that the user can program pads and speed before enabling the macro,
but their value is only taken into account once the macro is enabled and unfrozen.
630
32072H–AVR32–10/2012
AT32UC3A3
After writing a one to USBCON.USBE, the USBB enters the Device or the Host mode (according
to the ID detection) in idle state.
The USBB can be disabled at any time by writing a zero to USBCON.USBE. In fact, writing a
zero to USBCON.USBE acts as a hardware reset, except that the OTGPADE, VBUSPO,
FRZCLK, UIDE, UIMOD and, LS bits are not reset.
27.7.1.3 Interrupts
One interrupt vector is assigned to the USB interface. Figure 27-6 on page 632 shows the struc-
ture of the USB interrupt system.
631
32072H–AVR32–10/2012
AT32UC3A3
USBSTA.IDTI
USBCON.IDTE
USBSTA.VBUSTI
USBCON.VBUSTE
USBSTA.SRPI
UESTAX.TXINI
USBCON.SRPE
UECONX.TXINE USBSTA.VBERRI
UESTAX.RXOUTI USB General
USBCON.VBERRE
UECONX.RXOUTE USBSTA.BCERRI Interrupt
UESTAX.RXSTPI
USBCON.BCERRE
UECONX.RXSTPE USBSTA.ROLEEXI
UESTAX.UNDERFI
USBCON.ROLEEXE
UECONX.UNDERFE USBSTA.HNPERRI
UESTAX.NAKOUTI
USBCON.HNPERRE
UECONX.NAKOUTE USBSTA.STOI
UESTAX.HBISOINERRI
USBCON.STOE
UECONX.HBISOINERRE
UESTAX.NAKINI
UECONX.NAKINE
UESTAX.HBISOFLUSHI
UECONX.HBISOFLUSHE
UESTAX.OVERFI USB Device
Endpoint X
UECONX.OVERFE
Interrupt
UESTAX.STALLEDI
UECONX.STALLEDE
UESTAX.CRCERRI
UECONX.CRCERRE
UESTAX.SHORTPACKET
UECONX.SHORTPACKETE UDINT.MSOF
UESTAX.DTSEQ=MDATA & UESTAX.RXOUTI UDINTE.MSOFE
UECONX.MDATAE UDINT.SUSP
UESTAX.DTSEQ=DATAX & UESTAX.RXOUTI UDINTE.SUSPE
UECONX.DATAXE UDINT.SOF
UESTAX.TRANSERR UDINTE.SOFE
UECONX.TRANSERRE UDINT.EORST USB
UESTAX.NBUSYBK UDINTE.EORSTE Interrupt
UECONX.NBUSYBKE UDINT.WAKEUP
UDINTE.WAKEUPE USB Device
UDINT.EORSM Interrupt
UDINTE.EORSME
UDINT.UPRSM
UDINTE.UPRSME
UDDMAX_STATUS.EOT_STA UDINT.EPXINT
UDDMAX_CONTROL.EOT_IRQ_EN UDINTE.EPXINTE
UDDMAX_STATUS.EOCH_BUFF_STA UDINT.DMAXINT
UDDMAX_CONTROL.EOBUFF_IRQ_EN USB Device UDINTE.DMAXINTE
UDDMAX_STATUS.DESC_LD_STA DMA Channel X
UDDMAX_CONTROL.DESC_LD_IRQ_EN Interrupt
UPSTAX.RXINI
UPCONX.RXINE
UPSTAX.TXOUTI
UPCONX.TXOUTE
UPSTAX.TXSTPI
UPCONX.TXSTPE
UPSTAX.UNDERFI
UPCONX.UNDERFIE
UPSTAX.PERRI
UPCONX.PERRE UHINT.DCONNI
UPSTAX.NAKEDI UHINTE.DCONNIE
UPCONX.NAKEDE UHINT.DDISCI
UPSTAX.OVERFI UHINTE.DDISCIE
UPCONX.OVERFIE UHINT.RSTI
UPSTAX.RXSTALLDI UHINTE.RSTIE
UPCONX.RXSTALLDE UHINT.RSMEDI
UPSTAX.CRCERRI USB Host
Pipe X UHINTE.RSMEDIE
UPCONX.CRCERRE UHINT.RXRSMI USB Host
Interrupt Interrupt
UPSTAX.SHORTPACKETI UHINTE.RXRSMIE
UPCONX.SHORTPACKETIE UHINT.HSOFI
UPSTAX.NBUSYBK UHINTE.HSOFIE
UPCONX.NBUSYBKE UHINT.HWUPI
UHINTE.HWUPIE
UHDMAX_STATUS.EOT_STA UHINT.PXINT
UHDMAX_CONTROL.EOT_IRQ_EN UHINTE.PXINTE
UHDMAX_STATUS.EOCH_BUFF_STA UHINT.DMAXINT
UHDMAX_CONTROL.EOBUFF_IRQ_EN USB Host
DMA Channel X UHINTE.DMAXINTE
UHDMAX_STATUS.DESC_LD_STA
Interrupt
UHDMAX_CONTROL.DESC_LD_IRQ_EN
See Section 27.7.2.19 and Section 27.7.3.13 for further details about device and host interrupts.
There are two kinds of general interrupts: processing, i.e. their generation is part of the normal
processing, and exception, i.e. errors (not related to CPU exceptions).
632
32072H–AVR32–10/2012
AT32UC3A3
•Run mode
In this mode, all MCU clocks can run, including the USB clock.
•Idle mode
In this mode, the CPU is halted, i.e. the CPU clock is stopped. The Idle mode is entered what-
ever the state of the USBB. The MCU wakes up on any USB interrupt.
•Frozen mode
Same as the Idle mode, except that the HSB module is stopped, so the USB DMA, which is an
HSB master, can not be used. Moreover, the USB DMA must be stopped before entering this
sleep mode in order to avoid erratic behavior. The MCU wakes up on any USB interrupt.
Same as the Frozen mode, except that the USB generic clock and other clocks are stopped, so
the USB macro is frozen. Only the asynchronous USB interrupt sources can wake up the MCU
in these modes (1). The Power Manager (PM) may have to be configured to enable asynchro-
nous wake up from USB. The USB module must be frozen by writing a one to the FRZCLK bit.
Note: 1. When entering a sleep mode deeper or equal to DeepStop, the VBus asynchronous interrupt can not be triggered because
the bandgap voltage reference is off. Thus this interrupt should be disabled (USBCON.VBUSTE = 0).
In the run, idle and frozen MCU modes, the USBB can be frozen when the USB line is in the sus-
pend mode, by writing a one to the FRZCLK bit, what reduces power consumption.
In deeper MCU power modes (from StandBy mode), the USBC must be frozen.
In this case, it is still possible to access the following elements, but only in Run mode:
• The OTGPADE, VBUSPO, FRZCLK, USBE, UIDE, UIMOD and LS bits in the USBCON
register
• The DPRAM (through the USB Pipe/Endpoint n FIFO Data (USBFIFOnDATA) registers, but
not through USB bus transfers which are frozen)
633
32072H–AVR32–10/2012
AT32UC3A3
Moreover, when FRZCLK is written to one, only the asynchronous interrupt sources may trigger
the USB interrupt:
• The ID Transition Interrupt (IDTI)
• The VBus Transition Interrupt (VBUSTI)
• The Wake-up Interrupt (WAKEUP)
• The Host Wake-up Interrupt (HWUPI)
In peripheral mode, the Suspend Interrupt bit in the Device Global Interrupt register
(UDINT.SUSP)indicates that the USB line is in the suspend mode. In this case, the transceiver
is automatically set in suspend mode to reduce the consumption.The 480MHz internal PLL is
stopped. The USBSTA.CLKUSABLE bit is cleared.
•Device mode
When the USB interface is in device mode, the speed selection (full-speed or high-speed) is per-
formed automatically by the USBB during the USB reset according to the host speed capability.
At the end of the USB reset, the USBB enables or disables high-speed terminations and pull-up.
It is possible to restraint the USBB to full-speed or low-speed mode by handling the LS and the
Speed Configuration (SPDCONF) bits in UDCON.
•Host mode
When the USB interface is in host mode, internal pull-down resistors are connected on both D+
and D- and the interface detects the speed of the connected device, which is reflected by the
Speed Status (SPEED) field in USBSTA.
634
32072H–AVR32–10/2012
AT32UC3A3
To free its memory, the user shall write a zero to the UECFGn.ALLOC bit. The n+1 pipe/end-
point memory window then slides down and its data is lost. Note that the following pipe/endpoint
memory windows (from n+2) does not slide.
Figure 27-7 on page 635 illustrates the allocation and reorganization of the DPRAM in a typical
example.
PEP4 Conflict
PEP4 PEP4 PEP4 Lost Memory
PEP3 PEP3 (larger size)
PEP3 (ALLOC stays at 1) PEP4
635
32072H–AVR32–10/2012
AT32UC3A3
FIFO size (i.e. the DPRAM size), so the value of CFGOK does not consider memory
allocation conflicts.
USBE = 1
& DETACH = 0
Idle & Suspend
USBE = 0 Active
| DETACH = 1
| Suspend
• In the Idle state, the pad is put in low power consumption mode, i.e., the differential receiver
of the USB pad is off, and internal pull-down with strong value(15K) are set in both DP/DM to
avoid floating lines.
• In the Active state, the pad is working.
Figure 27-9 on page 636 illustrates the pad events leading to a PAD state change.
PAD State
The SUSP bit is set and the Wake-Up Interrupt (WAKEUP) bit in UDINT is cleared when a USB
“Suspend” state has been detected on the USB bus. This event automatically puts the USB pad
in the Idle state. The detection of a non-idle event sets WAKEUP, clears SUSP and wakes up
the USB pad.
636
32072H–AVR32–10/2012
AT32UC3A3
Moreover, the pad goes to the Idle state if the macro is disabled or if the DETACH bit is written to
one. It returns to the Active state when USBE is written to one and DETACH is written to zero.
VBus_pulsing
RPU
Session_valid
RPD
VBus_discharge
GND
Pad Logic
27.7.1.9 ID detection
Figure 27-11 on page 638 shows how the ID transitions are detected.
637
32072H–AVR32–10/2012
AT32UC3A3
RPU
1
USB_ID
0 ID IDTI
UIMOD USBSTA USBSTA
USBCON
UIDE
USBCON
I/O Controller
The USB mode (device or host) can be either detected from the USB_ID pin or software
selected by writing to the UIMOD bit, according to the UIDE bit. This allows the USB_ID pin to be
used as a general purpose I/O pin even when the USB interface is enabled.
By default, the USB_ID pin is selected (UIDE is written to one) and the USBB is in device mode
(UBSTA.ID is one), what corresponds to the case where no Mini-A plug is connected, i.e. no
plug or a Mini-B plug is connected and the USB_ID pin is kept high by the internal pull-up resis-
tor from the I/O Controller (which must be enabled if USB_ID is used).
The ID Transition Interrupt (IDTI) bit in USBSTA is set on each transition of the ID bit, i.e. when a
Mini-A plug (host mode) is connected or disconnected. This does not occur when a Mini-B plug
(device mode) is connected or disconnected.
The USBSTA.ID bit is effective whether the USBB is enabled or not.
638
32072H–AVR32–10/2012
AT32UC3A3
27.7.2.1 Introduction
In device mode, the USBB supports hi- full- and low-speed data transfers.
In addition to the default control endpoint, seven endpoints are provided, which can be config-
ured with the types isochronous, bulk or interrupt, as described in .Table 27-1 on page 624.
The device mode starts in the Idle state, so the pad consumption is reduced to the minimum.
<any
other
USBE = 0 state>
| ID = 0
USBE = 0
| ID = 0 Idle
Reset USBE = 1
& ID = 1
HW
RESET
After a hardware reset, the USBB device mode is in the Reset state. In this state:
• The macro clock is stopped in order to minimize power consumption (FRZCLK is written to
one).
• The internal registers of the device mode are reset.
• The endpoint banks are de-allocated.
• Neither D+ nor D- is pulled up (DETACH is written to one).
D+ or D- will be pulled up according to the selected speed as soon as the DETACH bit is written
to zero and VBus is present. See “Device mode” for further details.
When the USBB is enabled (USBE is written to one) in device mode (ID is one), its device mode
state goes to the Idle state with minimal power consumption. This does not require the USB
clock to be activated.
The USBB device mode can be disabled and reset at any time by disabling the USBB (by writing
a zero to USBE) or when host mode is engaged (ID is zero).
639
32072H–AVR32–10/2012
AT32UC3A3
• The default control endpoint is reset (see Section 27.7.2.4 for more details).
• The data toggle sequence of the default control endpoint is cleared.
• At the end of the reset process, the End of Reset (EORST) bit in UDINT interrupt is set.
• During a reset, the USBB automatically switches to the Hi-Speed mode if the host is Hi-
Speed capable (the reset is called a Hi-Speed reset). The user should observe the
USBSTA.SPEED field to know the speed running at the end of the reset (EORST is one).
640
32072H–AVR32–10/2012
AT32UC3A3
Endpoint
Activation
Endpoint
ERROR
Activated
As long as the endpoint is not correctly configured (CFGOK is zero), the controller does not
acknowledge the packets sent by the host to this endpoint.
The CFGOK bit is set only if the configured size and number of banks are correct compared to
their maximal allowed values for the endpoint (see Table 27-1 on page 624) and to the maximal
FIFO size (i.e. the DPRAM size).
See Section 27.7.1.6 for more details about DPRAM management.
641
32072H–AVR32–10/2012
AT32UC3A3
27.7.2.8 Detach
The reset value of the DETACH bit is one.
It is possible to initiate a device re-enumeration simply by writing a one then a zero to DETACH.
DETACH acts on the pull-up connections of the D+ and D- pads. See “Device mode” for further
details.
642
32072H–AVR32–10/2012
AT32UC3A3
If a SETUP packet is received into a control endpoint for which a STALL is requested, the
Received SETUP Interrupt (RXSTPI) bit in UESTAn is set and STALLRQ and STALLEDI are
cleared. The SETUP has to be ACKed.
This management simplifies the enumeration process management. If a command is not sup-
ported or contains an error, the user requests a STALL and can return to the main task, waiting
for the next SETUP request.
The retry mechanism has priority over the STALL handshake. A STALL handshake is sent if the
STALLRQ bit is set and if there is no retry required.
•Overview
A SETUP request is always ACKed. When a new SETUP packet is received, the RXSTPI is set,
but not the Received OUT Data Interrupt (RXOUTI) bit.
The FIFO Control (FIFOCON) bit in UECONn and the Read/Write Allowed (RWALL) bit in
UESTAn are irrelevant for control endpoints. The user shall therefore never use them on these
endpoints. When read, their value are always zero.
Control endpoints are managed using:
• The RXSTPI bit which is set when a new SETUP packet is received and which shall be
cleared by firmware to acknowledge the packet and to free the bank.
• The RXOUTI bit which is set when a new OUT packet is received and which shall be cleared
by firmware to acknowledge the packet and to free the bank.
• The Transmitted IN Data Interrupt (TXINI) bit which is set when the current bank is ready to
accept a new IN packet and which shall be cleared by firmware to send the packet.
•Control write
Figure 27-14 on page 644 shows a control write transaction. During the status stage, the control-
ler will not necessarily send a NAK on the first IN token:
• If the user knows the exact number of descriptor bytes that must be read, it can then
anticipate the status stage and send a zero-length packet after the next IN token.
• Or it can read the bytes and wait for the NAKed IN Interrupt (NAKINI) which tells that all the
bytes have been sent by the host and that the transaction is now in the status stage.
643
32072H–AVR32–10/2012
AT32UC3A3
RXOUTI HW SW HW SW
TXINI SW
•Control read
Figure 27-15 on page 644 shows a control read transaction. The USBB has to manage the
simultaneous write requests from the CPU and the USB host.
RXOUTI HW SW
TXINI SW HW SW
Wr Enable
HOST
Wr Enable
CPU
Once the OUT status stage has been received, the USBB waits for a SETUP request. The
SETUP request has priority over any other request and has to be ACKed. This means that any
other bit should be cleared and the FIFO reset when a SETUP is received.
The user has to take care of the fact that the byte counter is reset when a zero-length OUT
packet is received.
644
32072H–AVR32–10/2012
AT32UC3A3
•Overview
IN packets are sent by the USB device controller upon IN requests from the host. All the data
can be written which acknowledges or not the bank when it is full.
The endpoint must be configured first.
The TXINI bit is set at the same time as FIFOCON when the current bank is free. This triggers
an EPnINT interrupt if the Transmitted IN Data Interrupt Enable (TXINE) bit in UECONn is one.
TXINI shall be cleared by software (by writing a one to the Transmitted IN Data Interrupt Enable
Clear bit in the Endpoint n Control Clear register (UECONnCLR.TXINIC)) to acknowledge the
interrupt, what has no effect on the endpoint FIFO.
The user then writes into the FIFO (see ”USB Pipe/Endpoint n FIFO Data Register (USBFIFOn-
DATA)” on page 747) and write a one to the FIFO Control Clear (FIFOCONC) bit in
UECONnCLR to clear the FIFOCON bit. This allows the USBB to send the data. If the IN end-
point is composed of multiple banks, this also switches to the next bank. The TXINI and
FIFOCON bits are updated in accordance with the status of the next bank.
TXINI shall always be cleared before clearing FIFOCON.
The RWALL bit is set when the current bank is not full, i.e. the software can write further data
into the FIFO.
NAK DATA
IN ACK IN
(bank 0)
HW
TXINI SW SW
645
32072H–AVR32–10/2012
AT32UC3A3
DATA DATA
IN ACK IN ACK
(bank 0) (bank 1)
HW
TXINI SW SW SW
FIFOCON write data to CPU SW write data to CPU SW write data to CPU
BANK 0 BANK 1 BANK0
•Detailed description
646
32072H–AVR32–10/2012
AT32UC3A3
Endpoint
Abort
No
Abort Done
•Overview
OUT packets are sent by the host. All the data can be read which acknowledges or not the bank
when it is empty.
The endpoint must be configured first.
The RXOUTI bit is set at the same time as FIFOCON when the current bank is full. This triggers
an EPnINT interrupt if the Received OUT Data Interrupt Enable (RXOUTE) bit in UECONn is
one.
RXOUTI shall be cleared by software (by writing a one to the Received OUT Data Interrupt Clear
(RXOUTIC) bit) to acknowledge the interrupt, what has no effect on the endpoint FIFO.
The user then reads from the FIFO (see ”USB Pipe/Endpoint n FIFO Data Register (USBFIFOn-
DATA)” on page 747) and clears the FIFOCON bit to free the bank. If the OUT endpoint is
composed of multiple banks, this also switches to the next bank. The RXOUTI and FIFOCON
bits are updated in accordance with the status of the next bank.
RXOUTI shall always be cleared before clearing FIFOCON.
The RWALL bit is set when the current bank is not empty, i.e. the software can read further data
from the FIFO.
647
32072H–AVR32–10/2012
AT32UC3A3
HW HW
RXOUTI SW SW
HW
HW
RXOUTI SW SW
•Detailed description
648
32072H–AVR32–10/2012
AT32UC3A3
responds to the OUT/DATA transaction with an ACK handshake when the endpoint accepted
the data successfully and has room for another data payload (the second bank is free).
27.7.2.14 Underflow
This error exists only for isochronous IN/OUT endpoints. It set the Underflow Interrupt
(UNDERFI) bit in UESTAn, what triggers an EPnINT interrupt if the Underflow Interrupt Enable
(UNDERFE) bit is one.
An underflow can occur during IN stage if the host attempts to read from an empty bank. A zero-
length packet is then automatically sent by the USBB.
An underflow can not occur during OUT stage on a CPU action, since the user may read only if
the bank is not empty (RXOUTI is one or RWALL is one).
An underflow can also occur during OUT stage if the host sends a packet while the bank is
already full. Typically, the CPU is not fast enough. The packet is lost.
An underflow can not occur during IN stage on a CPU action, since the user may write only if the
bank is not full (TXINI is one or RWALL is one).
27.7.2.15 Overflow
This error exists for all endpoint types. It set the Overflow interrupt (OVERFI) bit in UESTAn,
what triggers an EPnINT interrupt if the Overflow Interrupt Enable (OVERFE) bit is one.
An overflow can occur during OUT stage if the host attempts to write into a bank that is too small
for the packet. The packet is acknowledged and the RXOUTI bit is set as if no overflow had
occurred. The bank is filled with all the first bytes of the packet that fit in.
An overflow can not occur during IN stage on a CPU action, since the user may write only if the
bank is not full (TXINI is one or RWALL is one).
27.7.2.17 HB IsoFlush
This error exists only for high-bandwidth isochronous IN endpoints if the high-bandwidth isochro-
nous feature is supported by the device (see the UFEATURES register for this).
At the end of the micro-frame, if at least one packet has been sent to the host, if there is missing
IN token during this micro-frame, the bank(s) destined to this micro-frame is/are flushed out to
ensure a good data synchronization between the host and the device.
649
32072H–AVR32–10/2012
AT32UC3A3
For instance, if NBTRANS is three (three transactions per micro-frame), if only the first IN token
(among 3) is well received by the USBB, then the two last banks will be discarded.
27.7.2.19 Interrupts
See the structure of the USB device interrupt system on Figure 27-6 on page 632.
There are two kinds of device interrupts: processing, i.e. their generation is part of the normal
processing, and exception, i.e. errors (not related to CPU exceptions).
•Global interrupts
•Endpoint interrupts
650
32072H–AVR32–10/2012
AT32UC3A3
•DMA interrupts
651
32072H–AVR32–10/2012
AT32UC3A3
In host mode, the USBB associates a pipe to a device endpoint, considering the device configu-
ration descriptors.
Device <any
Macro off other
Clock stopped Disconnection
state>
Idle
Device
Connection
Device
Disconnection
Ready
SOFE = 0
SOFE = 1 Suspend
After a hardware reset, the USBB host mode is in the Reset state.
When the USBB is enabled (USBE is one) in host mode (ID is zero), its host mode state goes to
the Idle state. In this state, the controller waits for device connection with minimal power con-
652
32072H–AVR32–10/2012
AT32UC3A3
sumption. The USB pad should be in the Idle state. Once a device is connected, the macro
enters the Ready state, what does not require the USB clock to be activated.
The controller enters the Suspend state when the USB bus is in a “Suspend” state, i.e., when
the host mode does not generate the “Start of Frame (SOF)”. In this state, the USB consumption
is minimal. The host mode exits the Suspend state when starting to generate the SOF over the
USB line.
653
32072H–AVR32–10/2012
AT32UC3A3
Pipe
Activation
As long as the pipe is not correctly configured (UPSTAn.CFGOK is zero), the controller can not
send packets to the device through this pipe.
The UPSTAn.CFGOK bit is set only if the configured size and number of banks are correct com-
pared to their maximal allowed values for the pipe (see Table 27-1 on page 624) and to the
maximal FIFO size (i.e. the DPRAM size).
See Section 27.7.1.6 for more details about DPRAM management.
Once the pipe is correctly configured (UPSTAn.CFGOK is zero), only the PTOKEN and INTFRQ
fields can be written by software. INTFRQ is meaningless for non-interrupt pipes.
When starting an enumeration, the user gets the device descriptor by sending a
GET_DESCRIPTOR USB request. This descriptor contains the maximal packet size of the
device default control endpoint (bMaxPacketSize0) and the user re-configures the size of the
default control pipe with this size parameter.
654
32072H–AVR32–10/2012
AT32UC3A3
When the host controller sends an USB reset, the UHADDRPn field is reset by hardware and the
following host requests will be performed using the default device address 0.
655
32072H–AVR32–10/2012
AT32UC3A3
RXINI shall be cleared by software (by writing a one to the Received IN Data Interrupt Clear bit
in the Pipe n Control Clear register(UPCONnCLR.RXINIC)) to acknowledge the interrupt, what
has no effect on the pipe FIFO.
The user then reads from the FIFO (see ”USB Pipe/Endpoint n FIFO Data Register (USBFIFOn-
DATA)” on page 747) and clears the FIFOCON bit (by writing a one to the FIFO Control Clear
(FIFOCONC) bit in UPCONnCLR) to free the bank. If the IN pipe is composed of multiple banks,
this also switches to the next bank. The RXINI and FIFOCON bits are updated in accordance
with the status of the next bank.
RXINI shall always be cleared before clearing FIFOCON.
The Read/Write Allowed (RWALL) bit in UPSTAn is set when the current bank is not empty, i.e.,
the software can read further data from the FIFO.
DATA DATA
IN ACK IN ACK
(bank 0) (bank 0)
HW HW
RXINI SW SW
DATA DATA
IN ACK IN ACK
(bank 0) (bank 1)
HW HW
RXINI SW SW
656
32072H–AVR32–10/2012
AT32UC3A3
The Transmitted OUT Data Interrupt (TXOUTI) bit in UPSTAn is set at the same time as FIFO-
CON when the current bank is free. This triggers a PnINT interrupt if the Transmitted OUT Data
Interrupt Enable (TXOUTE) bit in UPCONn is one.
TXOUTI shall be cleared by software (by writing a one to the Transmitted OUT Data Interrupt
Clear (TXOUTIC) bit in UPCONnCLR) to acknowledge the interrupt, what has no effect on the
pipe FIFO.
The user then writes into the FIFO (see ”USB Pipe/Endpoint n FIFO Data Register (USBFIFOn-
DATA)” on page 747) and clears the FIFOCON bit to allow the USBB to send the data. If the
OUT pipe is composed of multiple banks, this also switches to the next bank. The TXOUTI and
FIFOCON bits are updated in accordance with the status of the next bank.
TXOUTI shall always be cleared before clearing FIFOCON.
The UPSTAn.RWALL bit is set when the current bank is not full, i.e., the software can write fur-
ther data into the FIFO.
Note that if the user decides to switch to the Suspend state (by writing a zero to the
UHCON.SOFE bit) while a bank is ready to be sent, the USBB automatically exits this state and
the bank is sent.
Note that in High-Speed operating mode, the host controller automatically manages the PING
protocol to maximize the USB bandwidth. The user can tune the PING protocol by handling the
Ping Enable (PINGEN) bit and the bInterval Parameter for the Bulk-Out/Ping Transaction
(BINTERVALL) field in UPCFGn. See the Section 27.8.3.12 for more details.
DATA
OUT ACK OUT
(bank 0)
HW
TXOUTI SW SW
657
32072H–AVR32–10/2012
AT32UC3A3
Figure 27-27. Example of an OUT Pipe with two Data Banks and no Bank Switching Delay
DATA DATA
OUT ACK OUT ACK
(bank 0) (bank 1)
HW
TXOUTI SW SW SW
FIFOCON write data to CPU SW write data to CPU write data to CPU
BANK 0 BANK 1 SW BANK0
Figure 27-28. Example of an OUT Pipe with two Data Banks and a Bank Switching Delay
DATA DATA
OUT ACK OUT ACK
(bank 0) (bank 1)
HW
TXOUTI SW SW SW
FIFOCON write data to CPU SW write data to CPU SW write data to CPU
BANK 0 BANK 1 BANK0
27.7.3.13 Interrupts
See the structure of the USB host interrupt system on Figure 27-6 on page 632.
There are two kinds of host interrupts: processing, i.e. their generation is part of the normal pro-
cessing, and exception, i.e. errors (not related to CPU exceptions).
•Global interrupts
658
32072H–AVR32–10/2012
AT32UC3A3
•Pipe interrupts
•DMA interrupts
659
32072H–AVR32–10/2012
AT32UC3A3
27.7.4.1 Introduction
USB packets of any length may be transferred when required by the USBB. These transfers
always feature sequential addressing. These two characteristics mean that in case of high
USBB throughput, both HSB ports will benefit from “incrementing burst of unspecified length”
since the average access latency of HSB slaves can then be reduced.
The DMA uses word “incrementing burst of unspecified length” of up to 256 beats for both data
transfers and channel descriptor loading. A burst may last on the HSB busses for the duration of
a whole USB packet transfer, unless otherwise broken by the HSB arbitration or the HSB 1kbyte
boundary crossing.
Packet data HSB bursts may be locked on a DMA buffer basis for drastic overall HSB bus band-
width performance boost with paged memories. This is because these memories row (or bank)
changes, which are very clock-cycle consuming, will then likely not occur or occur once instead
of dozens of times during a single big USB packet DMA transfer in case other HSB masters
address the memory. This means up to 128 words single cycle unbroken HSB bursts for bulk
pipes/endpoints and 256 words single cycle unbroken bursts for isochronous pipes/endpoints.
This maximal burst length is then controlled by the lowest programmed USB pipe/endpoint size
(PSIZE/EPSIZE) and the Channel Byte Length (CHBYTELENGTH) field in the Device DMA
Channel n Control (UDDMAnCONTROL) register.
The USBB average throughput may be up to nearly 53 Mbyte/s. Its average access latency
decreases as burst length increases due to the zero wait-state side effect of unchanged
pipe/endpoint. Word access allows reducing the HSB bandwidth required for the USB by four
compared to native byte access. If at least 0 wait-state word burst capability is also provided by
the other DMA HSB bus slaves, each of both DMA HSB busses need less than 60% bandwidth
allocation for full USB bandwidth usage at 33MHz, and less than 30% at 66MHz.
660
32072H–AVR32–10/2012
AT32UC3A3
Transfer Descriptor
USB DMA Channel X Registers
(Current Transfer Descriptor) Next Descriptor Address
Memory Area
Data Buffer 1
Data Buffer 2
Data Buffer 3
661
32072H–AVR32–10/2012
AT32UC3A3
•Programming example for single-block dma transfer with automatic closure for OUT transfer :
The idea is to automatically close the DMA transfer at the end of the OUT transaction (received
short packet). The following sequence may be used:
• Configure the targerted endpoint (source) as OUT type, and set the automatic bank switching
for this endpoint in the UECFGn register to handle multiple OUT packet.
• Write the starting destination address in the UDDMAnADDR register.
• There is no need to program the UDDMAnNEXTDESC register.
• Program the channel byte length in the UDDMAnCONTROL register.
• Set the BUFFCLOSEINEN bit in the UDDMAnCONTROL register.
• Program the UDDMAnCONTROL according to Row 2 as shown in Figure 27-6 on page 714
to set up a single block transfer.
As soon as an OUT packet is stored inside the endpoint, the UDDMAnSTATUS.CHACTIVE bit
is set to one, indicating that the DMA channel is transfering data from the endpoint to the desti-
nation address until the endpoint is empty. Once the endpoint is empty, the
UDDMAnSTATUS.CHACTIVE bit is cleared.
After one or multiple processed OUT packet, the DMA channel is completed after sourcing a
short packet. Then, the UDDMAnCONTROL.CHEN bit is cleared. As a consequence, after a few
cycles latency, the UDDMAnSTATUS.CHEN bit is also cleared, and the UDDMAnSTA-
TUS.EOTSTA bit is set indicating that the DMA was closed by a end of USB transaction.
662
32072H–AVR32–10/2012
AT32UC3A3
•Programming example for multi-block dma transfer : run and link at end of buffer
The idea is to run first a single block transfer followed automatically by a linked list of DMA. The
following sequence may be used:
• Configure the targerted endpoint (source) as OUT type, and set the automatic bank switching
for this endpoint in the UECFGn register to handle multiple OUT packet.
• Set up the chain of linked list of descripor in memory. Each descriptor is composed of 3 items
: channel next descriptor address, channel destination address and channel control. The last
descriptor should be programmed according to row 2 as shown in Figure 27-6 on page 714.
• Write the starting destination address in the UDDMAnADDR register.
• Program the UDDMAnNEXTDESC register.
• Program the channel byte length in the UDDMAnCONTROL register.
• Optionnaly set the BUFFCLOSEINEN bit in the UDDMAnCONTROL register.
• Program the UDDMAnCONTROL according to Row 4 as shown in Figure 27-6 on page 714.
The UDDMAnSTATUS.CHEN bit is set indicating that the dma channel is enable.
As soon as an OUT packet is stored inside the endpoint, the UDDMAnSTATUS.CHACTIVE bit
is set to one, indicating that the DMA channel is transfering data from the endpoint to the desti-
nation address until the endpoint is empty or the channel byte length is reached. Once the
endpoint is empty, the UDDMAnSTATUS.CHACTIVE bit is cleared.
Once the first DMA channel is completed (i.e : the channel byte length is reached), after one or
multiple processed OUT packet, the UDDMAnCONTROL.CHEN bit is cleared. As a conse-
quence, the UDDMAnSTATUS.CHEN bit is also cleared, and the
UDDMAnSTATUS.EOCHBUFFSTA bit is set indicating a end of dma channel. If the UDDMAn-
CONTROL.DMAENDEN bit was set, the last endpoint bank will be properly released even if
there are some residual datas inside, i.e: OUT packet truncation at the end of DMA buffer when
the dma channel byte lenght is not an integral multiple of the endpoint size. Note that the
UDDMAnCONTROL.LDNXTCH bit remains to one indicating that a linked descriptor will be
loaded.
Once the new descriptor is loaded from the UDDMAnNEXTDESC memory address, the UDDM-
AnSTATUS.DESCLDSTA bit is set, and the UDDMAnCONTROL register is updated from the
memory. As a consequence, the UDDMAnSTATUS.CHEN bit is set, and the UDDMAnSTA-
TUS.CHACTIVE is set as soon as the endpoint is ready to be sourced by the DMA (received
OUT data packet).
This sequence is repeated until a last linked descriptor is processed. The last descriptor is
detected according to row 2 as shown in Figure 27-6 on page 714.
At the end of the last descriptor, the UDDMAnCONTROL.CHEN bit is cleared. As a conse-
quence, after a few cycles latency, the UDDMAnSTATUS.CHEN bit is also cleared.
•Programming example for multi-block dma transfer : load next descriptor now
The idea is to directly run first a linked list of DMA. The following sequence may be used: The
following sequence may be used:
• Configure the targerted endpoint (source) as OUT type, and set the automatic bank switching
for this endpoint in the UECFGn register to handle multiple OUT packet.
663
32072H–AVR32–10/2012
AT32UC3A3
• Set up the chain of linked list of descripor in memory. Each descriptor is composed of 3 items
: channel next descriptor address, channel destination address and channel control. The last
descriptor should be programmed according to row 2 as shown in Figure 27-6 on page 714.
• Program the UDDMAnNEXTDESC register.
• Program the UDDMAnCONTROL according to Row 3 as shown in Figure 27-6 on page 714.
The UDDMAnSTATUS.CHEN bit is 0 and the UDDMAnSTATUS.LDNXTCHDESCEN is set indi-
cating that the DMA channel is pending until the endpoint is ready (received OUT packet).
As soon as an OUT packet is stored inside the endpoint, the UDDMAnSTATUS.CHACTIVE bit
is set to one. Then after a few cycle latency, the new descriptor is loaded from the memory and
the UDDMAnSTATUS.DESCLDSTA is set.
At the end of this DMA (for instance when the channel byte length has reached 0), the
UDDMAnCONTROL.CHEN bit is cleared, and then the UDDMAnSTATUS.CHEN bit is also
cleared. If the UDDMAnCONTROL.LDNXTCH value is one, a new descriptor is loaded.
This sequence is repeated until a last linked descriptor is processed. The last descriptor is
detected according to row 2 as shown in Figure 27-6 on page 714.
At the end of the last descriptor, the UDDMAnCONTROL.CHEN bit is cleared. As a conse-
quence, after a few cycles latency, the UDDMAnSTATUS.CHEN bit is also cleared.
664
32072H–AVR32–10/2012
AT32UC3A3
665
32072H–AVR32–10/2012
AT32UC3A3
666
32072H–AVR32–10/2012
AT32UC3A3
667
32072H–AVR32–10/2012
AT32UC3A3
668
32072H–AVR32–10/2012
AT32UC3A3
669
32072H–AVR32–10/2012
AT32UC3A3
670
32072H–AVR32–10/2012
AT32UC3A3
671
32072H–AVR32–10/2012
AT32UC3A3
Note: 1. The reset values are device specific. Please refer to the Module Configuration section at the end of this chapter.
672
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - UIMOD UIDE
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
673
32072H–AVR32–10/2012
AT32UC3A3
674
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
675
32072H–AVR32–10/2012
AT32UC3A3
676
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - VBUSRQC -
7 6 5 4 3 2 1 0
Writing a one to a bit in this register will clear the corresponding bit in UBSTA.
Writing a zero to a bit in this register has no effect.
This bit always reads as zero.
677
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - VBUSRQS -
7 6 5 4 3 2 1 0
Writing a one to a bit in this register will set the corresponding bit in UBSTA, what may be useful for test or debug purposes.
Writing a zero to a bit in this register has no effect.
This bit always reads as zero.
678
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - VARIANT
15 14 13 12 11 10 9 8
- - - - VERSION[11:8]
7 6 5 4 3 2 1 0
VERSION[7:0]
679
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
BYTEWRITE
FIFOMAXSIZE DMAFIFOWORDDEPTH
DPRAM
7 6 5 4 3 2 1 0
DMABUFFE
DMACHANNELNBR EPTNBRMAX
RSIZE
680
32072H–AVR32–10/2012
AT32UC3A3
681
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
UADDRSIZE[31:24]
23 22 21 20 19 18 17 16
UADDRSIZE[23:16]
15 14 13 12 11 10 9 8
UADDRSIZE[15:8]
7 6 5 4 3 2 1 0
UADDRSIZE[7:0]
682
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
UNAME1[31:24]
23 22 21 20 19 18 17 16
UNAME1[23:16]
15 14 13 12 11 10 9 8
UNAME1[15:8]
7 6 5 4 3 2 1 0
UNAME1[7:0]
683
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
UNAME2[31:24]
23 22 21 20 19 18 17 16
UNAME2[23:16]
15 14 13 12 11 10 9 8
UNAME2[15:8]
7 6 5 4 3 2 1 0
UNAME2[7:0]
684
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - DRDSTATE
• DRDSTATE
This field indicates the state of the USBB.
DRDSTATE Description
0 a_idle state: this is the start state for A-devices (when the ID pin is 0)
a_wait_vrise: In this state, the A-device waits for the voltage on VBus to rise above the A-
1
device VBus Valid threshold (4.4 V).
2 a_wait_bcon: In this state, the A-device waits for the B-device to signal a connection.
3 a_host: In this state, the A-device that operates in Host mode is operational.
4 a_suspend: The A-device operating as a host is in the suspend mode.
5 a_peripheral: The A-device operates as a peripheral.
a_wait_vfall: In this state, the A-device waits for the voltage on VBus to drop below the A-
6
device Session Valid threshold (1.4 V).
a_vbus_err: In this state, the A-device waits for recovery of the over-current condition that
7
caused it to enter this state.
8 a_wait_discharge: In this state, the A-device waits for the data usb line to discharge (100 us).
9 b_idle: this is the start state for B-device (when the ID pin is 1).
10 b_peripheral: In this state, the B-device acts as the peripheral.
b_wait_begin_hnp: In this state, the B-device is in suspend mode and waits until 3 ms before
11
initiating the HNP protocol if requested.
b_wait_discharge: In this state, the B-device waits for the data usb line to discharge (100 us)
12
before becoming Host.
685
32072H–AVR32–10/2012
AT32UC3A3
DRDSTATE Description
b_wait_acon: In this state, the B-device waits for the A-device to signal a connect before
13
becoming B-Host.
14 b_host: In this state, the B-device acts as the Host.
15 b_srp_init: In this state, the B-device attempts to start a session using the SRP protocol.
686
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - OPMODE2
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
ADDEN UADD
687
32072H–AVR32–10/2012
AT32UC3A3
SPDCONF Speed
Normal mode: the peripheral starts in full-speed mode and performs a high-speed reset to
0 0
switch to the high-speed mode if the host is high-speed capable.
0 1 reserved, do not use this configuration
1 0 reserved, do not use this configuration
1 1 Full-speed: the peripheral remains in full-speed mode whatever is the host speed capability.
688
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
689
32072H–AVR32–10/2012
AT32UC3A3
690
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
Writing a one to a bit in this register will clear the corresponding bit in UDINT.
Writing a zero to a bit in this register has no effect.
This bit always reads as zero.
691
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
Writing a one to a bit in this register will set the corresponding bit in UDINT, what may be useful for test or debug purposes.
Writing a zero to a bit in this register has no effect.
This bit always reads as zero.
692
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
693
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
Writing a one to a bit in this register will clear the corresponding bit in UDINTE.
Writing a zero to a bit in this register has no effect.
This bit always reads as zero.
694
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
Writing a one to a bit in this register will set the corresponding bit in UDINTE.
Writing a zero to a bit in this register has no effect.
This bit always reads as zero.
695
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
696
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
FNCERR - FNUM[10:5]
7 6 5 4 3 2 1 0
FNUM[4:0] MFNUM
697
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
698
32072H–AVR32–10/2012
AT32UC3A3
This field is cleared upon receiving a USB reset (except for the endpoint 0).
• EPBK: Endpoint Banks
This field shall be written to select the number of banks for the endpoint:
699
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- BYCT
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
700
32072H–AVR32–10/2012
AT32UC3A3
This field may be updated one clock cycle after the RWALL bit changes, so the user should not poll this field as an interrupt bit.
• NBUSYBK: Number of Busy Banks
This field is set to indicate the number of busy banks:
For IN endpoints, it indicates the number of banks filled by the user and ready for IN transfer. When all banks are free, this
triggers an EPnINT interrupt if NBUSYBKE is one.
For OUT endpoints, it indicates the number of banks filled by OUT transactions from the host. When all banks are busy, this
triggers an EPnINT interrupt if NBUSYBKE is one.
When the FIFOCON bit is cleared (by writing a one to the FIFOCONC bit) to validate a new bank, this field is updated two or
three clock cycles later to calculate the address of the next bank.
An EPnINT interrupt is triggered if:
- for IN endpoint, NBUSYBKE is one and all the banks are free.
- for OUT endpoint, NBUSYBKE is one and all the banks are busy.
• ERRORTRANS: High-bandwidth isochronous OUT endpoint transaction error Interrupt
This bit is set when a transaction error occurs during the current micro-frame (the data toggle sequencing does not respect the
usb 2.0 standard). This triggers an EPnINT interrupt if ERRORTRANSE is one.
This bit is set as long as the current bank (CURRBK) belongs to the bad n-transactions (n=1,2 or 3) transferred during the
micro-frame. Shall be cleared by software by clearing (at least once) the FIFOCON bit to switch to the bank that belongs to the
next n-transactions (next micro-frame).
Look at the UFEATURES register to know if the high-bandwidth isochronous feature is supported by the device.
• DTSEQ: Data Toggle Sequence
This field is set to indicate the PID of the current bank:
For IN transfers, it indicates the data toggle sequence that will be used for the next packet to be sent. This is not relative to the
current bank.
701
32072H–AVR32–10/2012
AT32UC3A3
For OUT transfers, this value indicates the last data toggle sequence received on the current bank.
By default DTSEQ is 0b01, as if the last data toggle sequence was Data1, so the next sent or expected data toggle sequence
should be Data0.
For High-bandwidth isochronous endpoint, an EPnINT interrupt is triggered if:
- MDATAE is one and a MData packet has been received (DTSEQ=MData and RXOUTI is one).
- DATAXE is one and a Data0/1/2 packet has been received (DTSEQ=Data0/1/2 and RXOUTI is one)
Look at the UFEATURES register to know if the high-bandwidth isochronous feature is supported by the device.
• SHORTPACKET: Short Packet Interrupt
This bit is set for non-control OUT endpoints, when a short packet has been received.
This bit is set for non-control IN endpoints, a short packet is transmitted upon ending a DMA transfer, thus signaling an end of
isochronous frame or a bulk or interrupt end of transfer, this only if the End of DMA Buffer Output Enable (DMAENDEN) bit and
the Automatic Switch (AUTOSW) bit are written to one.
This triggers an EPnINT interrupt if SHORTPACKETE is one.
This bit is cleared when the SHORTPACKETC bit is written to one. This will acknowledge the interrupt.
• STALLEDI: STALLed Interrupt
This bit is set to signal that a STALL handshake has been sent. To do that, the software has to set the STALLRQ bit (by writing a
one to the STALLRQS bit). This triggers an EPnINT interrupt if STALLEDE is one.
This bit is cleared when the STALLEDIC bit is written to one. This will acknowledge the interrupt.
• CRCERRI: CRC Error Interrupt
This bit is set to signal that a CRC error has been detected in an isochronous OUT endpoint. The OUT packet is stored in the
bank as if no CRC error had occurred. This triggers an EPnINT interrupt if CRCERRE is one.
This bit is cleared when the CRCERRIC bit is written to one. This will acknowledge the interrupt.
• OVERFI: Overflow Interrupt
This bit is set when an overflow error occurs. This triggers an EPnINT interrupt if OVERFE is one.
For all endpoint types, an overflow can occur during OUT stage if the host attempts to write into a bank that is too small for the
packet. The packet is acknowledged and the RXOUTI bit is set as if no overflow had occurred. The bank is filled with all the first
bytes of the packet that fit in.
This bit is cleared when the OVERFIC bit is written to one. This will acknowledge the interrupt.
• NAKINI: NAKed IN Interrupt
This bit is set when a NAK handshake has been sent in response to an IN request from the host. This triggers an EPnINT
interrupt if NAKINE is one.
This bit is cleared when the NAKINIC bit is written to one. This will acknowledge the interrupt.
• HBISOFLUSHI: High Bandwidth Isochronous IN Flush Interrupt
This bit is set, for High-bandwidth isochronous IN endpoint (with NBTRANS=2 or 3), at the end of the micro-frame, if less than N
transaction has been completed by the USBB without underflow error. This may occur in case of a missing IN token. In this
case, the bank are flushed out to ensure the data synchronization between the host and the device. This triggers an EPnINT
interrupt if HBISOFLUSHE is one.
This bit is cleared when the HBISOFLUSHIC bit is written to one. This will acknowledge the interrupt.
Look at the UFEATURES register to know if the high-bandwidth isochronous feature is supported by the device.
• NAKOUTI: NAKed OUT Interrupt
This bit is set when a NAK handshake has been sent in response to an OUT request from the host. This triggers an EPnINT
interrupt if NAKOUTE is one.
This bit is cleared when the NAKOUTIC bit is written to one. This will acknowledge the interrupt.
• HBISOINERRI: High bandwidth isochronous IN Underflow Error Interrupt
This bit is set, for High-bandwidth isochronous IN endpoint (with NBTRANS=2 or 3), at the end of the microframe, if less than N
bank was written by the cpu within this micro-frame. This triggers an EPnINT interrupt if HBISOINERRE is one.
This bit is cleared when the HBISOINERRIC bit is written to one. This will acknowledge the interrupt.
Look at the UFEATURES register to know if the high-bandwidth isochronous feature is supported by the device.
• UNDERFI: Underflow Interrupt
This bit is set, for isochronous IN/OUT endpoints, when an underflow error occurs. This triggers an EPnINT interrupt if
UNDERFE is one.
702
32072H–AVR32–10/2012
AT32UC3A3
An underflow can occur during IN stage if the host attempts to read from an empty bank. A zero-length packet is then
automatically sent by the USBB.
An underflow can also occur during OUT stage if the host sends a packet while the bank is already full. Typically, the CPU is not
fast enough. The packet is lost.
Shall be cleared by writing a one to the UNDERFIC bit. This will acknowledge the interrupt.
This bit is inactive (cleared) for bulk and interrupt IN/OUT endpoints and it means RXSTPI for control endpoints.
• RXSTPI: Received SETUP Interrupt
This bit is set, for control endpoints, to signal that the current bank contains a new valid SETUP packet. This triggers an EPnINT
interrupt if RXSTPE is one.
Shall be cleared by writing a one to the RXSTPIC bit. This will acknowledge the interrupt and free the bank.
This bit is inactive (cleared) for bulk and interrupt IN/OUT endpoints and it means UNDERFI for isochronous IN/OUT endpoints.
• RXOUTI: Received OUT Data Interrupt
This bit is set, for control endpoints, when the current bank contains a bulk OUT packet (data or status stage). This triggers an
EPnINT interrupt if RXOUTE is one.
Shall be cleared for control end points, by writing a one to the RXOUTIC bit. This will acknowledge the interrupt and free the
bank.
This bit is set for isochronous, bulk and, interrupt OUT endpoints, at the same time as FIFOCON when the current bank is full.
This triggers an EPnINT interrupt if RXOUTE is one.
Shall be cleared for isochronous, bulk and, interrupt OUT endpoints, by writing a one to the RXOUTIC bit. This will acknowledge
the interrupt, what has no effect on the endpoint FIFO.
The user then reads from the FIFO and clears the FIFOCON bit to free the bank. If the OUT endpoint is composed of multiple
banks, this also switches to the next bank. The RXOUTI and FIFOCON bits are set/cleared in accordance with the status of the
next bank.
RXOUTI shall always be cleared before clearing FIFOCON.
This bit is inactive (cleared) for isochronous, bulk and interrupt IN endpoints.
• TXINI: Transmitted IN Data Interrupt
This bit is set for control endpoints, when the current bank is ready to accept a new IN packet. This triggers an EPnINT interrupt
if TXINE is one.
This bit is cleared when the TXINIC bit is written to one. This will acknowledge the interrupt and send the packet.
This bit is set for isochronous, bulk and interrupt IN endpoints, at the same time as FIFOCON when the current bank is free.
This triggers an EPnINT interrupt if TXINE is one.
This bit is cleared when the TXINIC bit is written to one. This will acknowledge the interrupt, what has no effect on the endpoint
FIFO.
The user then writes into the FIFO and clears the FIFOCON bit to allow the USBB to send the data. If the IN endpoint is
composed of multiple banks, this also switches to the next bank. The TXINI and FIFOCON bits are set/cleared in accordance
with the status of the next bank.
TXINI shall always be cleared before clearing FIFOCON.
This bit is inactive (cleared) for isochronous, bulk and interrupt OUT endpoints.
703
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
Writing a one to a bit in this register will clear the corresponding bit in UESTA.
Writing a zero to a bit in this register has no effect.
This bit always reads as zero.
704
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - NBUSYBKS - - -
7 6 5 4 3 2 1 0
Writing a one to a bit in this register will set the corresponding bit in UESTA, what may be useful for test or debug purposes.
Writing a zero to a bit in this register has no effect.
This bit always reads as zero.
705
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
706
32072H–AVR32–10/2012
AT32UC3A3
707
32072H–AVR32–10/2012
AT32UC3A3
This bit is cleared when the HBISOFLUSHEC bit disable the HBISOFLUSHI interrupt.
Look at the UFEATURES register to know if the high-bandwidth isochronous feature is supported by the device.
• NAKOUTE: NAKed OUT Interrupt Enable
This bit is set when the NAKOUTES bit is written to one. This will enable the NAKed OUT interrupt (NAKOUTI).
This bit is cleared when the NAKOUTEC bit is written to one. This will disable the NAKed OUT interrupt (NAKOUTI).
• HBISOINERRE: High Bandwidth Isochronous IN Error Interrupt Enable
This bit is set when the HBISOINERRES bit is written to one. This will enable the HBISOINERRI interrupt.
This bit is cleared when the HBISOINERREC bit disable the HBISOINERRI interrupt.
Look at the UFEATURES register to know if the high-bandwidth isochronous feature is supported by the device.
• RXSTPE: Received SETUP Interrupt Enable
This bit is set when the RXSTPES bit is written to one. This will enable the Received SETUP interrupt (RXSTPI).
This bit is cleared when the RXSTPEC bit is written to one. This will disable the Received SETUP interrupt (RXSTPI).
• UNDERFE: Underflow Interrupt Enable
This bit is set when the UNDERFES bit is written to one. This will enable the Underflow interrupt (UNDERFI).
This bit is cleared when the UNDERFEC bit is written to one. This will disable the Underflow interrupt (UNDERFI).
• RXOUTE: Received OUT Data Interrupt Enable
This bit is set when the RXOUTES bit is written to one. This will enable the Received OUT Data interrupt (RXOUT).
This bit is cleared when the RXOUTEC bit is written to one. This will disable the Received OUT Data interrupt (RXOUT).
• TXINE: Transmitted IN Data Interrupt Enable
This bit is set when the TXINES bit is written to one. This will enable the Transmitted IN Data interrupt (TXINI).
This bit is cleared when the TXINEC bit is written to one. This will disable the Transmitted IN Data interrupt (TXINI).
708
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
Writing a one to a bit in this register will clear the corresponding bit in UECONn.
Writing a zero to a bit in this register has no effect.
This bit always reads as zero.
709
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
Writing a one to a bit in this register will set the corresponding bit in UECONn.
Writing a zero to a bit in this register has no effect.
This bit always reads as zero.
710
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
NXTDESCADDR[31:24]
23 22 21 20 19 18 17 16
NXTDESCADDR[23:16]
15 14 13 12 11 10 9 8
NXTDESCADDR[15:8]
7 6 5 4 3 2 1 0
NXTDESCADDR[7:4] - - - -
711
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
HSBADDR[31:24]
23 22 21 20 19 18 17 16
HSBADDR[23:16]
15 14 13 12 11 10 9 8
HSBADDR[15:8]
7 6 5 4 3 2 1 0
HSBADDR[7:0]
712
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
CHBYTELENGTH[15:8]
23 22 21 20 19 18 17 16
CHBYTELENGTH[7:0]
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
BUFFCLOSE LDNXTCH
BURSTLOCKEN DESCLDIRQEN EOBUFFIRQEN EOTIRQEN DMAENDEN CHEN
INEN DESCEN
713
32072H–AVR32–10/2012
AT32UC3A3
LDNXTCHDES
CHEN
CEN Current Bank
0 0 stop now
0 1 Run and stop at end of buffer
1 0 Load next descriptor now
1 1 Run and link at end of buffer
714
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
CHBYTECNT[15:8]
23 22 21 20 19 18 17 16
CHBYTECNT[7:0]
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
DESCLD EOCHBUFF
- EOTSTA - - CHACTIVE CHEN
STA STA
715
32072H–AVR32–10/2012
AT32UC3A3
0: the DMA channel no longer transfers data, and may load the next descriptor if the UDDMAnCONTROL.LDNXTCHDESCEN
bit is zero.
1: the DMA channel is currently enabled and transfers data upon request.
If a channel request is currently serviced when the UDDMAnCONTROL.CHEN bit is written to zero, the DMA FIFO buffer is
drained until it is empty, then this status bit is cleared.
716
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
- - - - - - - -
SPDCONF Speed
Normal mode: the host start in full-speed mode and perform a high-speed reset to switch to
0 0
the high-speed mode if the downstream peripheral is high-speed capable.
0 1 reserved, do not use this configuration
1 0 reserved, do not use this configuration
1 1 Full-speed: the host remains to full-speed mode whatever is the peripheral speed capability.
717
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
23 22 21 20 19 18 17 16
- - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
718
32072H–AVR32–10/2012
AT32UC3A3
719
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
Writing a one to a bit in this register will clear the corresponding bit in UHINT.
Writing a zero to a bit in this register has no effect.
This bit always reads as zero.
720
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
Writing a one to a bit in this register will set the corresponding bit in UHINT, what may be useful for test or debug purposes.
Writing a zero to a bit in this register has no effect.
This bit always reads as zero.
721
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
722
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
Writing a one to a bit in this register will clear the corresponding bit in UHINTE.
Writing a zero to a bit in this register has no effect.
This bit always reads as zero.
723
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
Writing a one to a bit in this register will set the corresponding bit in UHINT.
Writing a zero to a bit in this register has no effect.
This bit always reads as zero.
724
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
FLENHIGH
15 14 13 12 11 10 9 8
- - FNUM[10:5]
7 6 5 4 3 2 1 0
FNUM[4:0] MFNUM
725
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- UHADDRP3
23 22 21 20 19 18 17 16
- UHADDRP2
15 14 13 12 11 10 9 8
- UHADDRP1
7 6 5 4 3 2 1 0
- UHADDRP0
726
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- UHADDRP7
23 22 21 20 19 18 17 16
- UHADDRP6
15 14 13 12 11 10 9 8
- UHADDRP5
7 6 5 4 3 2 1 0
- UHADDRP4
727
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
728
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
INTFRQ/BINTERVAL
23 22 21 20 19 18 17 16
- - - PINGEN PEPNUM
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
729
32072H–AVR32–10/2012
AT32UC3A3
730
32072H–AVR32–10/2012
AT32UC3A3
731
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- PBYCT[10:4]
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
732
32072H–AVR32–10/2012
AT32UC3A3
This field may be updated 1 clock cycle after the RWALL bit changes, so the user shall not poll this field as an interrupt bit.
• NBUSYBK: Number of Busy Banks
This field indicates the number of busy bank.
For OUT pipe, this field indicates the number of busy bank(s), filled by the user, ready for OUT transfer. When all banks are
busy, this triggers an PnINT interrupt if UPCONn.NBUSYBKE is one.
For IN pipe, this field indicates the number of busy bank(s) filled by IN transaction from the Device. When all banks are free, this
triggers an PnINT interrupt if UPCONn.NBUSYBKE is one.
For OUT pipe, this field indicates the data toggle of the next packet that will be sent.
For IN pipe, this field indicates the data toggle of the received packet stored in the current bank.
• SHORTPACKETI: Short Packet Interrupt
This bit is set when a short packet is received by the host controller (packet length inferior to the PSIZE programmed field).
This bit is cleared when the SHORTPACKETIC bit is written to one.
• RXSTALLDI: Received STALLed Interrupt
This bit is set, for all endpoints but isochronous, when a STALL handshake has been received on the current bank of the pipe.
The Pipe is automatically frozen. This triggers an interrupt if the RXSTALLE bit is one.
This bit is cleared when the RXSTALLDIC bit is written to one.
• CRCERRI: CRC Error Interrupt
This bit is set, for isochronous endpoint, when a CRC error occurs on the current bank of the Pipe. This triggers an interrupt if
the TXSTPE bit is one.
This bit is cleared when the CRCERRIC bit is written to one.
• OVERFI: Overflow Interrupt
This bit is set when the current pipe has received more data than the maximum length of the current pipe. An interrupt is
triggered if the OVERFIE bit is one.
This bit is cleared when the OVERFIC bit is written to one.
• NAKEDI: NAKed Interrupt
This bit is set when a NAK has been received on the current bank of the pipe. This triggers an interrupt if the NAKEDE bit is one.
733
32072H–AVR32–10/2012
AT32UC3A3
734
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
RXSTALLDI
SHORT TXSTPIC/
C/ OVERFIC NAKEDIC - TXOUTIC RXINIC
PACKETIC UNDERFIC
CRCERRIC
Writing a one to a bit in this register will clear the corresponding bit in UPSTAn.
Writing a zero to a bit in this register has no effect.
This bit always reads as zero.
735
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - NBUSYBKS - - - -
7 6 5 4 3 2 1 0
Writing a one to a bit in this register will set the corresponding bit in UPSTAn, what may be useful for test or debug purposes.
Writing a zero to a bit in this register has no effect.
This bit always reads as zero.
736
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
- FIFOCON - NBUSYBKE - - - -
7 6 5 4 3 2 1 0
737
32072H–AVR32–10/2012
AT32UC3A3
738
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - PFREEZEC PDISHDMAC
15 14 13 12 11 10 9 8
- FIFOCONC - NBUSYBKEC - - - -
7 6 5 4 3 2 1 0
Writing a one to a bit in this register will clear the corresponding bit in UPCONn.
Writing a zero to a bit in this register has no effect.
This bit always reads as zero.
739
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
- - - NBUSYBKES - - - -
7 6 5 4 3 2 1 0
Writing a one to a bit in this register will set the corresponding bit in UPCONn.
Writing a zero to a bit in this register has no effect.
This bit always reads as zero.
740
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - INMODE
7 6 5 4 3 2 1 0
INRQ
741
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
742
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
NXTDESCADDR[31:24]
23 22 21 20 19 18 17 16
NXTDESCADDR[23:16]
15 14 13 12 11 10 9 8
NXTDESCADDR[15:8]
7 6 5 4 3 2 1 0
NXTDESCADDR[7:4] - - - -
743
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
HSBADDR[31:24]
23 22 21 20 19 18 17 16
HSBADDR[23:16]
15 14 13 12 11 10 9 8
HSBADDR[15:8]
7 6 5 4 3 2 1 0
HSBADDR[7:0]
744
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
CHBYTELENGTH[15:8]
23 22 21 20 19 18 17 16
CHBYTELENGTH[7:0]
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
745
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
CHBYTECNT[15:8]
23 22 21 20 19 18 17 16
CHBYTECNT[7:0]
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
746
32072H–AVR32–10/2012
AT32UC3A3
747
32072H–AVR32–10/2012
AT32UC3A3
748
32072H–AVR32–10/2012
AT32UC3A3
28.1 Features
• Three 16-bit Timer Counter channels
• A wide range of functions including:
– Frequency measurement
– Event counting
– Interval measurement
– Pulse generation
– Delay timing
– Pulse width modulation
– Up/down capabilities
• Each channel is user-configurable and contains:
– Three external clock inputs
– Five internal clock inputs
– Two multi-purpose input/output signals
• Internal interrupt signal
• Two global registers that act on all three TC channels
28.2 Overview
The Timer Counter (TC) includes three identical 16-bit Timer Counter channels.
Each channel can be independently programmed to perform a wide range of functions including
frequency measurement, event counting, interval measurement, pulse generation, delay timing,
and pulse width modulation.
Each channel has three external clock inputs, five internal clock inputs, and two multi-purpose
input/output signals which can be configured by the user. Each channel drives an internal inter-
rupt signal which can be programmed to generate processor interrupts.
The TC block has two global registers which act upon all three TC channels.
The Block Control Register (BCR) allows the three channels to be started simultaneously with
the same instruction.
The Block Mode Register (BMR) defines the external clock inputs for each channel, allowing
them to be chained.
749
32072H–AVR32–10/2012
AT32UC3A3
I/O
TIMER_CLOCK1 Contr oller
CLK0
TCLK0
CLK1
TIMER_CLOCK2
TIOA1 CLK2
TCLK0
TCLK1 XC0
Timer/Counter TIOA
XC1 Channel 1 A1
TIOA0 TIOA1
TIOB B1
TIOA2 XC2 TIOB1
Timer Count er
Interrupt
Controller
750
32072H–AVR32–10/2012
AT32UC3A3
28.5.3 Clocks
The clock for the TC bus interface (CLK_TC) is generated by the Power Manager. This clock is
enabled at reset, and can be disabled in the Power Manager. It is recommended to disable the
TC before disabling the clock, to avoid freezing the TC in an undefined state.
28.5.4 Interrupts
The TC interrupt request line is connected to the interrupt controller. Using the TC interrupt
requires the interrupt controller to be programmed first.
28.6.1 TC Description
The three channels of the Timer Counter are independent and identical in operation. The regis-
ters for channel programming are listed in Figure 28-3 on page 766.
751
32072H–AVR32–10/2012
AT32UC3A3
TCCLKS
TIMER_CLOCK1
TIMER_CLOCK2 CLKI
TIMER_CLOCK3
TIMER_CLOCK4
TIMER_CLOCK5 Selected
XC0 Clock
XC1
XC2
BURST
752
32072H–AVR32–10/2012
AT32UC3A3
• The clock can be enabled or disabled by the user by writing to the Counter Clock
Enable/Disable Command bits in the Channel n Clock Control Register (CCRn.CLKEN and
CCRn.CLKDIS). In Capture mode it can be disabled by an RB load event if the Counter Clock
Disable with RB Loading bit in CMRn is written to one (CMRn.LDBDIS). In Waveform mode,
it can be disabled by an RC Compare event if the Counter Clock Disable with RC Compare
bit in CMRn is written to one (CMRn.CPCDIS). When disabled, the start or the stop actions
have no effect: only a CLKEN command in CCRn can re-enable the clock. When the clock is
enabled, the Clock Enabling Status bit is set in SRn (SRn.CLKSTA).
• The clock can also be started or stopped: a trigger (software, synchro, external or compare)
always starts the clock. In Capture mode the clock can be stopped by an RB load event if the
Counter Clock Stopped with RB Loading bit in CMRn is written to one (CMRn.LDBSTOP). In
Waveform mode it can be stopped by an RC compare event if the Counter Clock Stopped
with RC Compare bit in CMRn is written to one (CMRn.CPCSTOP). The start and the stop
commands have effect only if the clock is enabled.
Selected
Clock Trigger
Q S
R
Q S
R
Stop Disable
Event Event
Counter
Clock
753
32072H–AVR32–10/2012
AT32UC3A3
28.6.1.6 Trigger
A trigger resets the counter and starts the counter clock. Three types of triggers are common to
both modes, and a fourth external trigger is available to each mode.
The following triggers are common to both modes:
• Software Trigger: each channel has a software trigger, available by writing a one to the
Software Trigger Command bit in CCRn (CCRn.SWTRG).
• 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 a one to the Synchro Command bit in the BCR register
(BCR.SYNC).
• Compare RC Trigger: RC is implemented in each channel and can provide a trigger when the
counter value matches the RC value if the RC Compare Trigger Enable bit in CMRn
(CMRn.CPCTRG) is written to one.
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 to be one of the following signals: TIOB, XC0, XC1, or XC2. This external
event can then be programmed to perform a trigger by writing a one to the External Event Trig-
ger Enable bit in CMRn (CMRn.ENETRG).
If an external trigger is used, the duration of the pulses must be longer than the CLK_TC period
in order to be detected.
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.
754
32072H–AVR32–10/2012
AT32UC3A3
755
32072H–AVR32–10/2012
TCCLKS
CLKSTA CLKEN CLKDIS
CLKI
32072H–AVR32–10/2012
TIMER_CLOCK1
TIMER_CLOCK2
TIMER_CLOCK3 Q S
TIMER_CLOCK4
TIMER_CLOCK5
R
Figure 28-4. Capture Mode
Q S
XC0
R
XC1
XC2
LDBSTOP LDBDIS
BURST
Register C
Capture Capture
1 Register A Register B Compare RC =
16-bit
SWTRG Counter
CLK
OVF
RESET
SYNC
Trig
ABETRG
ETRGEDG CPCTRG
MTIOB Edge
Detector
COVFS
LOVRS
LDRBS
LDRAS
ETRGS
Timer/Counter Channel
INT
756
AT32UC3A3
AT32UC3A3
757
32072H–AVR32–10/2012
32072H–AVR32–10/2012
TCCLKS
CLKSTA CLKEN CLKDIS
TIMER_CLOCK1 ACPC
CLKI
TIMER_CLOCK2
TIMER_CLOCK3 Q S
TIMER_CLOCK4 CPCDIS MTIOA
R ACPA
TIMER_CLOCK5 Q S
XC0
R
XC1
XC2 CPCSTOP TIOA
AEEVT
O utput Contr oller
Figure 28-5. Waveform Mode
BCPC
SYNC
Trig
BCPB MTIOB
WAVSEL
EEVT
TIOB
BEEVT
EEVTEDG
O utput Cont r oller
ENETRG
SR
CPBS
CPCS
CPAS
Edge
ETRGS
COVFS
Detector BSWTRG
TIOB
IMR
Timer/Counter Channel
INT
758
AT32UC3A3
AT32UC3A3
28.6.3.2 WAVSEL = 0
When CMRn.WAVSEL is zero, the value of CVn is incremented from 0 to 0xFFFF. Once
0xFFFF has been reached, the value of CVn is reset. Incrementation of CVn starts again and
the cycle continues. See Figure 28-6 on page 759.
An external event trigger or a software trigger can reset the value of CVn. It is important to note
that the trigger may occur at any time. See Figure 28-7 on page 760.
RC Compare cannot be programmed to generate a trigger in this configuration. At the same
time, RC Compare can stop the counter clock (CMRn.CPCSTOP = 1) and/or disable the counter
clock (CMRn.CPCDIS = 1).
RC
RB
RA
Time
Waveform Examples
TIOB
TIOA
759
32072H–AVR32–10/2012
AT32UC3A3
0xFFFF
RB
RA
Time
Waveform Examples
TIOB
TIOA
28.6.3.3 WAVSEL = 2
When CMRn.WAVSEL is two, the value of CVn is incremented from zero to the value of RC,
then automatically reset on a RC Compare. Once the value of CVn has been reset, it is then
incremented and so on. See Figure 28-8 on page 761.
It is important to note that CVn can be reset at any time by an external event or a software trig-
ger if both are programmed correctly. See Figure 28-9 on page 761.
In addition, RC Compare can stop the counter clock (CMRn.CPCSTOP) and/or disable the
counter clock (CMRn.CPCDIS = 1).
760
32072H–AVR32–10/2012
AT32UC3A3
Counter Value
0xFFFF
Counter cleared by compare match
with RC
RC
RB
RA
Time
Waveform Examples
TIOB
TIOA
0xFFFF
Counter cleared by compare match with RC Counter cleared by trigger
RC
RB
RA
TIOB
TIOA
28.6.3.4 WAVSEL = 1
When CMRn.WAVSEL is one, the value of CVn is incremented from 0 to 0xFFFF. Once 0xFFFF
is reached, the value of CVn is decremented to 0, then re-incremented to 0xFFFF and so on.
See Figure 28-10 on page 762.
761
32072H–AVR32–10/2012
AT32UC3A3
A trigger such as an external event or a software trigger can modify CVn at any time. If a trigger
occurs while CVn is incrementing, CVn then decrements. If a trigger is received while CVn is
decrementing, CVn then increments. See Figure 28-11 on page 762.
RC Compare cannot be programmed to generate a trigger in this configuration.
At the same time, RC Compare can stop the counter clock (CMRn.CPCSTOP = 1) and/or dis-
able the counter clock (CMRn.CPCDIS = 1).
RC
RB
RA
Time
Waveform Examples
TIOB
TIOA
0xFFFF
Counter decremented by trigger
RC
RB
Counter incremented by trigger
RA
TIOB
TIOA
762
32072H–AVR32–10/2012
AT32UC3A3
28.6.3.5 WAVSEL = 3
When CMRn.WAVSEL is three, the value of CVn is incremented from zero to RC. Once RC is
reached, the value of CVn is decremented to zero, then re-incremented to RC and so on. See
Figure 28-12 on page 763.
A trigger such as an external event or a software trigger can modify CVn at any time. If a trigger
occurs while CVn is incrementing, CVn then decrements. If a trigger is received while CVn is
decrementing, CVn then increments. See Figure 28-13 on page 764.
RC Compare can stop the counter clock (CMRn.CPCSTOP = 1) and/or disable the counter clock
(CMRn.CPCDIS = 1).
0xFFFF
Counter cleared by compare match with RC
RC
RB
RA
TIOB
TIOA
763
32072H–AVR32–10/2012
AT32UC3A3
0xFFFF
Counter decremented by compare match
with RC
RC
Counter decremented by trigger
RB
Counter incremented by trigger
RA
Time
Waveform Examples
TIOB
TIOA
764
32072H–AVR32–10/2012
AT32UC3A3
765
32072H–AVR32–10/2012
AT32UC3A3
766
32072H–AVR32–10/2012
AT32UC3A3
767
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
768
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - LDRB LDRA
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
LDRB Edge
0 none
1 rising edge of TIOA
2 falling edge of TIOA
3 each edge of TIOA
LDRA Edge
0 none
1 rising edge of TIOA
2 falling edge of TIOA
3 each edge of TIOA
• WAVE
1: Capture mode is disabled (Waveform mode is enabled).
0: Capture mode is enabled.
• CPCTRG: RC Compare Trigger Enable
1: RC Compare resets the counter and starts the counter clock.
0: RC Compare has no effect on the counter and its clock.
• ABETRG: TIOA or TIOB External Trigger Selection
1: TIOA is used as an external trigger.
769
32072H–AVR32–10/2012
AT32UC3A3
ETRGEDG Edge
0 none
1 rising edge
2 falling edge
3 each edge
770
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
BSWTRG Effect
0 none
1 set
2 clear
3 toggle
BEEVT Effect
0 none
1 set
2 clear
3 toggle
771
32072H–AVR32–10/2012
AT32UC3A3
BCPC Effect
0 none
1 set
2 clear
3 toggle
BCPB Effect
0 none
1 set
2 clear
3 toggle
ASWTRG Effect
0 none
1 set
2 clear
3 toggle
AEEVT Effect
0 none
1 set
2 clear
3 toggle
ACPC Effect
0 none
1 set
2 clear
3 toggle
772
32072H–AVR32–10/2012
AT32UC3A3
ACPA Effect
0 none
1 set
2 clear
3 toggle
• WAVE
1: Waveform mode is enabled.
0: Waveform mode is disabled (Capture mode is enabled).
• WAVSEL: Waveform Selection
WAVSEL Effect
0 UP mode without automatic trigger on RC Compare
1 UPDOWN mode without automatic trigger on RC Compare
2 UP mode with automatic trigger on RC Compare
3 UPDOWN mode with automatic trigger on RC Compare
EEVTEDG Edge
0 none
1 rising edge
2 falling edge
3 each edge
773
32072H–AVR32–10/2012
AT32UC3A3
774
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
CV[15:8]
7 6 5 4 3 2 1 0
CV[7:0]
775
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
RA[15:8]
7 6 5 4 3 2 1 0
RA[7:0]
• RA: Register A
RA contains the Register A value in real time.
776
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
RB[15:8]
7 6 5 4 3 2 1 0
RB[7:0]
• RB: Register B
RB contains the Register B value in real time.
777
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
RC[15:8]
7 6 5 4 3 2 1 0
RC[7:0]
• RC: Register C
RC contains the Register C value in real time.
778
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
Note: Reading the Status Register will also clear the interrupt bit for the corresponding interrupts.
• MTIOB: TIOB Mirror
1: TIOB is high. If CMRn.WAVE is zero, this means that TIOB pin is high. If CMRn.WAVE is one, this means that TIOB is driven
high.
0: TIOB is low. If CMRn.WAVE is zero, this means that TIOB pin is low. If CMRn.WAVE is one, this means that TIOB is driven
low.
• MTIOA: TIOA Mirror
1: TIOA is high. If CMRn.WAVE is zero, this means that TIOA pin is high. If CMRn.WAVE is one, this means that TIOA is driven
high.
0: TIOA is low. If CMRn.WAVE is zero, this means that TIOA pin is low. If CMRn.WAVE is one, this means that TIOA is driven
low.
• CLKSTA: Clock Enabling Status
1: This bit is set when the clock is enabled.
0: This bit is cleared when the clock is disabled.
• ETRGS: External Trigger Status
1: This bit is set when an external trigger has occurred.
0: This bit is cleared when the SR register is read.
• LDRBS: RB Loading Status
1: This bit is set when an RB Load has occurred and CMRn.WAVE is zero.
0: This bit is cleared when the SR register is read.
• LDRAS: RA Loading Status
1: This bit is set when an RA Load has occurred and CMRn.WAVE is zero.
0: This bit is cleared when the SR register is read.
• CPCS: RC Compare Status
1: This bit is set when an RC Compare has occurred.
0: This bit is cleared when the SR register is read.
779
32072H–AVR32–10/2012
AT32UC3A3
780
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
781
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
782
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
783
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - SYNC
784
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
785
32072H–AVR32–10/2012
AT32UC3A3
786
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - -
15 14 13 12 11 10 9 8
- - - - - - BRPBHSB UPDNIMPL
7 6 5 4 3 2 1 0
CTRSIZE
787
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - VARIANT
15 14 13 12 11 10 9 8
- - - - VERSION[11:8]
7 6 5 4 3 2 1 0
VERSION[7:0]
788
32072H–AVR32–10/2012
AT32UC3A3
789
32072H–AVR32–10/2012
AT32UC3A3
29.1 Features
• Integrated multiplexer offering up to eight independent analog inputs
• Individual enable and disable of each channel
• Hardware or software trigger
– External trigger pin
– Timer counter outputs (corresponding TIOA trigger)
• Peripheral DMA Controller support
• Possibility of ADC timings configuration
• Sleep mode and conversion sequencer
– Automatic wakeup on trigger and back to sleep mode after conversions of all enabled
channels
29.2 Overview
The Analog-to-Digital Converter (ADC) is based on a Successive Approximation Register (SAR)
10-bit ADC. It also integrates an 8-to-1 analog multiplexer, making possible the analog-to-digital
conversions of 8 analog lines. The conversions extend from 0V to VDDANA.
The ADC supports an 8-bit or 10-bit resolution mode, and conversion results are reported in a
common register for all channels, as well as in a channel-dedicated register. Software trigger,
external trigger on rising edge of the TRIGGER pin, or internal triggers from timer counter out-
put(s) are configurable.
The ADC also integrates a sleep mode and a conversion sequencer and connects with a Periph-
eral DMA Controller channel. These features reduce both power consumption and processor
intervention.
Finally, the user can configure ADC timings, such as startup time and sample & hold time.
790
32072H–AVR32–10/2012
AT32UC3A3
ADC
Trigger
TRIGGER Selection ADC Interrupt Interrupt
Control
Logic Controller
VDDANA
VREF
High Speed
Bus (HSB)
AD- Peripheral
Dedicated DMA
AD- Controller
Analog
Inputs User
Interface Peripheral Bridge
AD- Successive
Approximation
Register
AD- Analog-to-Digital
Analog Inputs Converter Peripheral Bus
Multiplexed AD- I/O (PB)
With I/O lines Controller
AD-
GND
791
32072H–AVR32–10/2012
AT32UC3A3
29.5.3 Clocks
The clock for the ADC bus interface (CLK_ADC) is generated by the Power Manager. This clock
is enabled at reset, and can be disabled in the Power Manager. It is recommended to disable the
ADC before disabling the clock, to avoid freezing the ADC in an undefined state.
The CLK_ADC clock frequency must be in line with the ADC characteritics. Refer to Electrical
Characteristics section for details.
29.5.4 Interrupts
The ADC interrupt request line is connected to the interrupt controller. Using the ADC interrupt
requires the interrupt controller to be programmed first.
792
32072H–AVR32–10/2012
AT32UC3A3
as zero. The two highest bits of the Last Data Converted field in the Last Converted Data Regis-
ter (LCDR.LDATA) will be read as zero too.
Moreover, when a Peripheral DMA channel is connected to the ADC, a 10-bit resolution sets the
transfer request size to 16-bit. Writing a one to the LOWRES bit automatically switches to 8-bit
data transfers. In this case, the destination buffers are optimized.
Write CR Write CR
With START=1 Read CDRn Read LCDR
With START=1
CHn(CHSR)
EOCn(SR)
DRDY(SR)
793
32072H–AVR32–10/2012
AT32UC3A3
If the CDR register is not read before further incoming data is converted, the corresponding
Overrun Error bit in the SR register (SR.OVREn) is set.
In the same way, new data converted when DRDY is high sets the General Overrun Error bit in
the SR register (SR.GOVRE).
The OVREn and GOVRE bits are automatically cleared when the SR register is read.
Read SR
TRIGGER
CH0(CHSR)
CH1(CHSR)
Conversion
EOC0(SR) Conversion Read CDR0
GOVRE(SR)
DRDY(ASR)
OVRE0(SR)
794
32072H–AVR32–10/2012
AT32UC3A3
795
32072H–AVR32–10/2012
AT32UC3A3
796
32072H–AVR32–10/2012
AT32UC3A3
797
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
– – – – – – START SWRST
798
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – SHTIM
23 22 21 20 19 18 17 16
– STARTUP
15 14 13 12 11 10 9 8
PRESCAL
7 6 5 4 3 2 1 0
– – SLEEP LOWRES TRGSEL TRGEN
799
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0
800
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0
Warning: If the corresponding channel is disabled during a conversion or if it is disabled then reenabled during a conversion, its
associated data and its corresponding EOC and OVRE flags in SR are unpredictable.
801
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – – –
7 6 5 4 3 2 1 0
CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0
802
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – RXBUFF ENDRX GOVRE DRDY
15 14 13 12 11 10 9 8
OVRE7 OVRE6 OVRE5 OVRE4 OVRE3 OVRE2 OVRE1 OVRE0
7 6 5 4 3 2 1 0
EOC7 EOC6 EOC5 EOC4 EOC3 EOC2 EOC1 EOC0
803
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – LDATA[9:8]
7 6 5 4 3 2 1 0
LDATA[7:0]
804
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – RXBUFF ENDRX GOVRE DRDY
15 14 13 12 11 10 9 8
OVRE7 OVRE6 OVRE5 OVRE4 OVRE3 OVRE2 OVRE1 OVRE0
7 6 5 4 3 2 1 0
EOC7 EOC6 EOC5 EOC4 EOC3 EOC2 EOC1 EOC0
805
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – RXBUFF ENDRX GOVRE DRDY
15 14 13 12 11 10 9 8
OVRE7 OVRE6 OVRE5 OVRE4 OVRE3 OVRE2 OVRE1 OVRE0
7 6 5 4 3 2 1 0
EOC7 EOC6 EOC5 EOC4 EOC3 EOC2 EOC1 EOC0
806
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – RXBUFF ENDRX GOVRE DRDY
15 14 13 12 11 10 9 8
OVRE7 OVRE6 OVRE5 OVRE4 OVRE3 OVRE2 OVRE1 OVRE0
7 6 5 4 3 2 1 0
EOC7 EOC6 EOC5 EOC4 EOC3 EOC2 EOC1 EOC0
807
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – – – – –
15 14 13 12 11 10 9 8
– – – – – – DATA[9:8]
7 6 5 4 3 2 1 0
DATA[7:0]
808
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
– – – – – – – –
23 22 21 20 19 18 17 16
– – – – VARIANT
15 14 13 12 11 10 9 8
– – – – VERSION[11:8]
7 6 5 4 3 2 1 0
VERSION[7:0]
809
32072H–AVR32–10/2012
AT32UC3A3
810
32072H–AVR32–10/2012
AT32UC3A3
30.1 Features
• Allows performance monitoring of High Speed Bus master interfaces
– Up to 4 masters can be monitored
– Peripheral Bus access to monitor registers
• The following is monitored
– Data transfer cycles
– Bus stall cycles
– Maximum access latency for a single transfer
• Automatic handling of event overflow
30.2 Overview
BUSMON allows the user to measure the activity and stall cycles on the High Speed Bus (HSB).
Up to 4 device-specific masters can be measured. Each of these masters is part of a measure-
ment channel. Which masters that are connected to a channel is device-specific. Devices may
choose not to implement all channels.
Channel 0
Master A
Master B Slave 0
Master C Registers
Master D
Channel 1
Master E
Master F Slave 1
Master G Registers
Master H
Channel 2
Master I
Master J Slave 2
Master K Registers
Master L
Channel 3
Master M
Master N Slave 3
Master O Registers
Master P
Control
811
32072H–AVR32–10/2012
AT32UC3A3
30.4.1 Clocks
The clock for the BUSMON bus interface (CLK_BUSMON) is generated by the Power Manager.
This clock is enabled at reset and can be disabled in the Power Manager. It is recommended to
disable the BUSMON before disabling the clock, to avoid freezing the BUSMON in an undefined
state.
812
32072H–AVR32–10/2012
AT32UC3A3
Note: 1. The reset values are device specific. Please refer to the Module Configuration section at the end of this chapter.
813
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - CH3RES CH2RES CH1RES CH0RES
15 14 13 12 11 10 9 8
- - - - CH3OF CH2OF CH1OF CH0OF
7 6 5 4 3 2 1 0
- - - - CH3EN CH2EN CH1EN CH0EN
814
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
DATA[31:24]
23 22 21 20 19 18 17 16
DATA[23:16]
15 14 13 12 11 10 9 8
DATA[15:8]
7 6 5 4 3 2 1 0
DATA[7:0]
• DATA:
Data cycles counted since the last reset.
815
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
STALL[31:24]
23 22 21 20 19 18 17 16
STALL[23:16]
15 14 13 12 11 10 9 8
STALL[15:8]
7 6 5 4 3 2 1 0
STALL[7:0]
• STALL:
Stall cycles counted since the last reset.
816
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
LAT[31:24]
23 22 21 20 19 18 17 16
LAT[23:16]
15 14 13 12 11 10 9 8
LAT[15:8]
7 6 5 4 3 2 1 0
LAT[7:0]
• LAT:
This field is cleared whenever the DATA or STALL register is reset.
Maximum transfer initiation cycles counted since the last reset.
This counter is saturating.
817
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
818
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - VARIANT
15 14 13 12 11 10 9 8
- - - - VERSION[11:8]
7 6 5 4 3 2 1 0
VERSION[7:0]
819
32072H–AVR32–10/2012
AT32UC3A3
820
32072H–AVR32–10/2012
AT32UC3A3
31.1 Features
• Compatible with Multimedia Card specification version 4.3
• Compatible with SD Memory Card specification version 2.0
• Compatible with SDIO specification version 1.1
• Compatible with CE-ATA specification 1.1
• Cards clock rate up to master clock divided by two
• Boot Operation Mode support
• High Speed mode support
• Embedded power management to slow down clock rate when not used
• Supports 2
– Each slot for either a MultiMediaCard bus (up to 30 cards) or an SD Memory Card
• Support for stream, block and multi-block data read and write
• Supports connection to DMA Controller
– Minimizes processor intervention for large buffer transfers
• Built in FIFO (from 16 to 256 bytes) with large memory aperture supporting incremental access
• Support for CE-ATA completion cignal disable command
• Protection against unexpected modification on-the-Fly of the configuration registers
31.2 Overview
The Multimedia Card Interface (MCI) supports the MultiMedia Card (MMC) specification V4.3,
the SD Memory Card specification V2.0, the SDIO V1.1 specificationand CE-ATA specification
V1.1.
The MCI includes a Command Register (CMDR), Response Registers (RSPRn), data registers,
time-out counters and error detection logic that automatically handle the transmission of com-
mands and, when required, the reception of the associated responses and data with a limited
processor overhead.
The MCI supports stream, block and multi block data read and write, and is compatible with the
DMA Controller, minimizing processor intervention for large buffers transfers.
The MCI operates at a rate of up to CLK_MCI divided by 2 and supports the interfacing of 2.
Each slot may be used to interface with a MultiMediaCard bus (up to 30 Cards) or with a SD
Memory Card. Only one slot can be selected at a time (slots are multiplexed). The SDCard/SDIO
Slot Selection field in the SDCard/SDIO Register (SDCR.SDCSEL) performs this selection.
The SD Memory Card communication is based on a 9-pin interface (clock, command, four data
and three power lines) and the MultiMedia Card on a 7-pin to 13-pin nterface (clock, command,
one to eight data, three power lines and one reserved for future use).
The SD Memory Card interface also supports MultiMedia Card operations. The main differences
between SD and MultiMedia Cards are the initialization process and the bus topology.
MCI fully supports CE-ATA Revision 1.1, built on the MMC System specification V4.0. The mod-
ule includes dedicated hardware to issue the command completion signal and capture the host
command completion signal disable.
821
32072H–AVR32–10/2012
AT32UC3A3
DMA Controller
Peripheral
Bus
CLK
CMD
I/O
MCI Interface controller DATA
Power CLK_MCI
Manager
Interrupt Control
MCI Interrupt
Application Layer
Ex: File System, Audio, Security, etc
Physical Layer
MCI Interface
12 34567
12 3 4 56 78
9
910 1213 8
MMC SDCard
822
32072H–AVR32–10/2012
AT32UC3A3
31.5.3 Clocks
The clock for the MCI bus interface (CLK_MCI) is generated by the Power Manager. This clock
is enabled at reset, and can be disabled in the Power Manager. It is recommended to disable the
MCI before disabling the clock, to avoid freezing the MCI in an undefined state.
31.5.4 Interrupt
The MCI interrupt request line is connected to the interrupt controller. Using the MCI interrupt
requires the interrupt controller to be programmed first.
12 34567
910 1213 8
MMC
823
32072H–AVR32–10/2012
AT32UC3A3
The MultiMedia Card communication is based on a 13-pin serial bus interface. It has three com-
munication lines and four supply lines.
MCI
CMD
DATA[0]
CLK
12345678
9
SDCARD
824
32072H–AVR32–10/2012
AT32UC3A3
The SD Memory Card bus includes the signals listed in Table 31-3 on page 825.
1 2 34 5 6 78
DATA[3:0]
CLK SDCARD
CMD
9
Figure 31-7. SD Card Bus Connections with Two Slots 1 234 5678
DATA[3:0]
CLK SDCARD1
CMD[0]
9
1 234 5678
DATA[7:4]
CLK SDCARD2
CMD[1]
9
825
32072H–AVR32–10/2012
AT32UC3A3
Figure 31-8. Mixing MultiMedia and SD Memory Cards with Two Slots
DATA[7:0]
CMD[0]
CLK
DATA[11:8]
12 345 678
CLK SDCARD
CMD[1]
9
When the MCI is configured to operate with SD memory cards, the width of the data bus can be
selected in the SDCard /SDIO Bus Width field in the SDCR register (SDCR.SDCBUS). See Sec-
tion “31.7.4” on page 847. for details.
In the case of multimedia cards, only the data line 0 is used. The other data lines can be used as
independent GPIOs.
When more than one card (MMC or SD) is plugged to the device, it is strongly recommended to
connect each card’s clock to a dedicate MCI CLK pin of the device. Otherwise, Compliance to
specifications is not guaranteed.
826
32072H–AVR32–10/2012
AT32UC3A3
The structure of commands, responses and data blocks is described in the MultiMedia-Card
System Specification. Refer also to Table 31-5 on page 828.
MultiMediaCard 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 infor-
mation 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 MCI
clock (CLK).
Two types of data transfer commands are defined:
• Sequential commands: these 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.
• Block-oriented commands: these commands send a data block succeeded by CRC bits.
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 Sec-
tion “31.6.3” on page 829.).
The MCI provides a set of registers to perform the entire range of MultiMedia Card operations.
827
32072H–AVR32–10/2012
AT32UC3A3
The command ALL_SEND_CID and the fields and values for CMDR register are described in
Table 31-5 on page 828 and Table 31-6 on page 828.
The Argument Register (ARGR) contains the argument field of the command.
To send a command, the user must perform the following steps:
• Set the ARGR register with the command argument.
• Set the CMDR register (see Table 31-6 on page 828).
The command is sent immediately after writing the command register.
As soon as the command register is written, then the Command Ready bit in the Status Register
(SR.CMDRDY) is cleared.
It is released and the end of the card response.
If the command requires a response, it can be read in the Response Registers (RSPRn). The
response size can be from 48 bits up to 136 bits depending on the command. The MCI embeds
an error detection to prevent any corrupted data during the transfer.
The following flowchart shows how to send a command to the card and read the response if
needed. In this example, the status register bits are polled but setting the appropriate bits in the
Interrupt Enable Register (IER) allows using an interrupt method.
828
32072H–AVR32–10/2012
AT32UC3A3
Yes
Check error bits in the
SR register(1) Status error bits?
RETURN ERROR(1)
RETURN OK
Note: 1. If the command is SEND_OP_COND, the CRC error bit is always present (refer to R3
response in the MultiMedia Card specification).
829
32072H–AVR32–10/2012
AT32UC3A3
Consequent to MMC Specification 3.1, two types of multiple block read (or write) transactions
are defined (the host can use either one at any time):
• Open-ended/Infinite Multiple block read (or write):
The number of blocks for the read (or write) multiple block operation is not defined. The card
will continuously transfer (or program) data blocks until a stop transmission command is
received.
• 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 trans-
action. 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 set the BLKR register. Otherwise the card will start an open-
ended multiple block read. The MMC/SDIO Block Count - SDIO Byte Count field in the BLKR register
(BLKR.BCNT) defines the number of blocks to transfer (from 1 to 65535 blocks). Writing zero to
this field corresponds to an infinite block transfer.
830
32072H–AVR32–10/2012
AT32UC3A3
Send SELECT/DESELECT_CARD
Command(1) to select the card
No Yes
Read with DMA
Write a zero in the DMA.DMAEN bit Write a one in the DMA.DMAEN bit
Write the BlockLenght in the MR.BLKLEN field(2) Write the BlockLenght in the MR.BLKLEN field(2)
Write the block count in the BLKR.BCNT field (if
necessary)
Yes
No
No
Yes
SR.RXRDY = 0 ?
RETURN
No
RETURN
Note: 1. It is assumed that this command has been correctly sent (see Figure 31-9 on page 829).
2. This field is also accessible in the BLKR register.
831
32072H–AVR32–10/2012
AT32UC3A3
In write operation, the Padding Value bit in the MR register (MR.PADV) is used to define the
padding value when writing non-multiple block size. When the MR.PADV is zero, then 0x00
value is used when padding data, otherwise 0xFF is used.
Write a one in the DMA Hardware Handshaking Enable bit in the DMA Configuration Register
(DMA.DMAEN) enables DMA transfer.
The following flowchart shows how to write a single block with or without use of DMA facilities
(see Figure 31-11 on page 833). Polling or interrupt method can be used to wait for the end of
write according to the contents of the Interrupt Mask Register (IMR).
832
32072H–AVR32–10/2012
AT32UC3A3
Send SELECT/DESELECT_CARD
Command(1) to select the card
No Yes
Write using DMA
Write a zero in the DMA.DMAEN bit Write a one in the DMA.DMAEN bit
Write the BlockLenght in the MR.BLKLEN field(2) Write the BlockLenght in the MR.BLKLEN field(2)
Write the block count in the BLKR.BCNT field (if
necessary)
Yes
SR.NOTBUSY = 0 ?
Yes
SR.TXRDY = 0 ?
No
No
RETURN
Note: 1. It is assumed that this command has been correctly sent (see Figure 31-9 on page 829).
2. This field is also accessible in BLKR register.
833
32072H–AVR32–10/2012
AT32UC3A3
The following flowchart shows how to manage a multiple write block transfer with the DMA Con-
troller (see Figure 31-12 on page 835). Polling or interrupt method can be used to wait for the
end of write according to the contents of the IMR register.
834
32072H–AVR32–10/2012
AT32UC3A3
Send SELECT/DESELECT_CARD
Command(1) to select the card
Yes
SR.BLKE = 0 ?
No
Yes
SR.NOTBUSY = 0 ?
No
RETURN
Note: 1. It is assumed that this command has been correctly sent (see Figure 31-9 on page 829).
2. This field is also accessible in BLKR register.
835
32072H–AVR32–10/2012
AT32UC3A3
31.6.4.3 WRITE_MULTIPLE_BLOCK
1. Wait until the current command execution has successfully terminated.
a. Check that the SR.XFRDONE bit is set.
2. Write the block length in the card. This value defines the value block_lenght.
3. Write the MR.BLKLEN with block_lenght value.
4. Program the DMA Controller to use a list of descriptors. Each descriptor transfers one
block of data.
5. Program the DMA register with the following fields:
– Write the dma_offset in the DMA.OFFSET field.
– Write the DMA.CHKSIZE field.
– Write a one to the DMA.DMAEN bit to enable DMA hardware handshaking in the
MCI.
6. Write a one to the IER.DMADONE bit.
7. Issue a WRITE_MULTIPLE_BLOCK command.
8. Wait for DMA chained buffer transfer complete interrupt.
836
32072H–AVR32–10/2012
AT32UC3A3
31.6.4.4 READ_MULTIPLE_BLOCK
1. Wait until the current command execution has successfully terminated.
a. Check that the SR.CMDRDY and the SR.NOTBUSY are set.
2. Write the block length in the card. This value defines the value block_lenght.
3. Write the MR.BLKLEN with block_lenght value.
4. Program the DMA Controller to use a list of descriptors.
5. Write the DMA register with the following fields:
– Write zero to the DMA.OFFSET.
– Write the DMA.CHKSIZE.
– Write a one to the DMA.DMAEN bit to enable DMA hardware handshaking in the
MCI.
6. Write a one to the IER.DMADONE bit.
7. Issue a READ_MULTIPLE_BLOCK command.
8. Wait for DMA end of chained buffer transfer interrupt.
837
32072H–AVR32–10/2012
AT32UC3A3
An SDIO Card can have multiple I/O or combined I/O and memory (called Combo Card). Within
a multi-function SDIO or a Combo card, there are multiple devices (I/O and memory) that share
access to the SD bus. In order to allow the sharing of access to the host among multiple devices,
SDIO and combo cards can implement the optional concept of suspend/resume (Refer to the
SDIO Specification for more details). To send a suspend or a resume command, the host must
set the SDIO Special Command field in CMDR register (CMDR.IOSPCMD).
838
32072H–AVR32–10/2012
AT32UC3A3
CMDR register (CMDR.SPCMD) must be set to three to issue the CE-ATA completion Signal
Disable Command.
839
32072H–AVR32–10/2012
AT32UC3A3
6. When Data transfer is completed, host processor shall terminate the boot stream by
writing the MCI_CMDR register with SPCMD field set to BOOTEND.
31.6.8.1 Definition
The SR.XFRDONE bit indicates exactly when the read or write sequence is finished.
The CMDRDY flag is released 8 tbit lafter the end of the card response.
CMDRDY flag
Data
XFRDONE flag
840
32072H–AVR32–10/2012
AT32UC3A3
CMDRDY flag The CMDRDY flag is released 8 tbit lafter the end of the card response.
XFRDONE flag
841
32072H–AVR32–10/2012
AT32UC3A3
842
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
843
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
BLKLEN[15:8]
23 22 21 20 19 18 17 16
BLKLEN[7:0]
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
CLKDIV
844
32072H–AVR32–10/2012
AT32UC3A3
845
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- DTOMUL DTOCYC
These two fields determine the maximum number of CLK_MCI cycles that the MCI waits between two data block transfers.
It is equal to (DTOCYC x Multiplier).
If the data time-out defined by DTOCYC and DTOMUL has been exceeded, the Data Time-out Error bit in the SR register
(SR.DTOE) is set.
• DTOMUL: Data Time-out Multiplier
Multiplier is defined by DTOMUL as shown in the following table
DTOMUL Multiplier
0 1
1 16
2 128
3 256
4 1024
5 4096
6 65536
7 1048576
846
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
SDCBUS – – – – SDCSEL
847
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
ARG[31:24]
23 22 21 20 19 18 17 16
ARG[23:16]
15 14 13 12 11 10 9 8
ARG[15:8]
7 6 5 4 3 2 1 0
ARG[7:0]
848
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
RSPTYP CMDNB
This register is write-protected while SR.CMDRDY is zero. If an interrupt command is sent, this register is only writable by an
interrupt response (SPCMD field). This means that the current command execution cannot be interrupted or modified.
• BOOT_ACK: Boot Operation Acknowledge
The master can choose to receive the boot acknowledge from the slave when a Boot Request command is isssued.
Writing a one to this bit indicates that a Boot acknolwedge is expected within a programmable amount of time defined with
DTOMUL and DTOCYC fields located in the DTOR register. If the acknowledge pattern is not received then an acknowledge
timeout error is raised. If the acknowledge pattern is corrupted then an acknowledge pattern error is set.
• ATACS: ATA with Command Completion Signal
Writing a one to this bit will configure ATA completion signal within a programmed amount of time in Completion Signal Time-out
Register (CSTOR).
Writing a zero to this bit will configure no ATA completion signal.
• IOSPCMD: SDIO Special Command
849
32072H–AVR32–10/2012
AT32UC3A3
SPCMD Command
0 Not a special CMD.
Initialization CMD:
1
74 clock cycles for initialization sequence.
Synchronized CMD:
2
Wait for the end of the current data block transfer before sending the pending command.
CE-ATA Completion Signal disable Command.
The host cancels the ability for the device to return a command completion signal on the
3
command line.
Interrupt command:
4
Corresponds to the Interrupt Mode (CMD40).
Interrupt response:
5
Corresponds to the Interrupt Mode (CMD40).
others Reserved
850
32072H–AVR32–10/2012
AT32UC3A3
851
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
BLKLEN[15:8]
23 22 21 20 19 18 17 16
BLKLEN[7:0]
15 14 13 12 11 10 9 8
BCNT[15:8]
7 6 5 4 3 2 1 0
BCNT[7:0]
Warning: In SDIO Byte and Block modes, writing to the seven last bits of BCNT field is forbidden and may lead to unpredictable
results.
852
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- CSTOMUL CSTOCYC
These two fields determines the maximum number of CLK_MCI cycles that the MCI waits between two data block transfers. Its
value is calculated by (CSTOCYC x Multiplier).
These two fields also determine the maximum number of CLK_MCI cycles that the MCI 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 MCI starts waiting immediately after the end of the response until the completion signal.
If the data time-out defined by CSTOCYC and CSTOMUL has been exceeded, the Completion Signal Time-out Error bit in the
SR register (SR.CSTOE) is set.
• CSTOMUL: Completion Signal Time-out Multiplier
Multiplier is defined by CSTOMUL as shown in the following table:
CSTOMUL Multiplier
0 1
1 16
2 128
3 256
4 1024
5 4096
6 65536
7 1048576
853
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
RSP[31:24]
23 22 21 20 19 18 17 16
RSP[23:16]
15 14 13 12 11 10 9 8
RSP[15:8]
7 6 5 4 3 2 1 0
RSP[7:0]
• RSP[31:0]: Response
The response register can be read by N access(es) at the same RSPRn or at consecutive addresses (0x20 + n*0x04).
N depends on the size of the response.
854
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
DATA[31:24]
23 22 21 20 19 18 17 16
DATA[23:16]
15 14 13 12 11 10 9 8
DATA[15:8]
7 6 5 4 3 2 1 0
DATA[7:0]
855
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
DATA[31:24]
23 22 21 20 19 18 17 16
DATA[23:16]
15 14 13 12 11 10 9 8
DATA[15:8]
7 6 5 4 3 2 1 0
DATA[7:0]
856
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
857
32072H–AVR32–10/2012
AT32UC3A3
858
32072H–AVR32–10/2012
AT32UC3A3
A block write operation uses a simple busy signalling of the write operation duration on the data (DAT[0]) line: during a data
transfer block, if the card does not have a free data receive buffer, the card indicates this condition by pulling down the data line
(DAT[0]) to LOW. The card stops pulling down the data line as soon as at least one receive buffer for the defined data transfer
block length becomes free.
The NOTBUSY bit allows to deal with these different states.
1: MCI is ready for new data transfer.
0: MCI is not ready for new data transfer.
This bit is cleared at the end of the card response.
This bit is set when the busy state on the data line is ended. This corresponds to a free internal data receive buffer of the card.
Refer to the MMC or SD Specification for more details concerning the busy behavior.
• DTIP: Data Transfer in Progress
This bit is set when the current data transfer is in progress.
This bit is cleared at the end of the CRC16 calculation
1: The current data transfer is still in progress.
0: No data transfer in progress.
• BLKE: Data Block Ended
This bit must be used only for Write Operations.
This bit is set when a data block transfer has ended.
This bit is cleared when reading SR.
1: a data block transfer has ended, including the CRC16 Status transmission, the bit is set for each transmitted CRC Status.
0: A data block transfer is not yet finished.
Refer to the MMC or SD Specification for more details concerning the CRC Status.
• TXRDY: Transmit Ready
This bit is set when the last data written in the TDR register has been transferred.
This bit is cleared the last data written in the TDR register has not yet been transferred.
• RXRDY: Receiver Ready
This bit is set when the data has been received since the last read of the RDR register.
This bit is cleared when the data has not yet been received since the last read of the RDR register.
• CMDRDY: Command Ready
This bit is set when the last command has been sent.
This bit is cleared when writing the CMDR register
859
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
860
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
861
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
862
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - DAMEN
7 6 5 4 3 2 1 0
- CHKSIZE - - OFFSET
863
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - LSYNC - - - HSMODE
7 6 5 4 3 2 1 0
- - - FERRCTRL - - - FIFOMODE
864
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
WPKEY[23:16]
23 22 21 20 19 18 17 16
WPKEY[15:8]
15 14 13 12 11 10 9 8
WPKEY[7:0]
7 6 5 4 3 2 1 0
- - - - - - - WPEN
865
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
WPVSRC[15:8]
15 14 13 12 11 10 9 8
WPVSRC[7:0]
7 6 5 4 3 2 1 0
- - - - WPVS
WPVS Definition
No Write Protection Violation occurred since the last read of this
0
register (WPSR)
Write Protection detected unauthorized attempt to write a control
1
register had occurred (since the last read.)
Software reset had been performed while Write Protection was
2
enabled (since the last read).
Both Write Protection violation and software reset with Write
3
Protection enabled had occurred since the last read.
others Reserved
866
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - VARIANT
15 14 13 12 11 10 9 8
- - - - VERSION[11:8]
7 6 5 4 3 2 1 0
VERSION[7:0]
867
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
DATA[31:24]
23 22 21 20 19 18 17 16
DATA[23:16]
15 14 13 12 11 10 9 8
DATA[15:8]
7 6 5 4 3 2 1 0
DATA[7:0]
868
32072H–AVR32–10/2012
AT32UC3A3
869
32072H–AVR32–10/2012
AT32UC3A3
32.1 Features
• Memory Stick ver. 1.x & Memory Stick PRO support
• Memory Stick serial clock (serial mode: 20 MHz max., parallel mode: 40 MHz max.)
• Data transmit/receive FIFO of 64 bits x 4
• 16 bits CRC circuit
• DMACA transfer support
• Card insertion/removal detection
32.2 Overview
The Memory Stick Interface (MSI) is a host controller that supports Memory Stick Version 1.X
and Memory Stick PRO.
The communication protocol with the Memory Stick is started by write from the CPU to the com-
mand register. When the protocol finishes, the CPU is notified that the protocol has ended by an
interrupt request. When the protocol is started and enters the data transfer state, data is
requested by issuing a DMA transfer request (via DMACA) or an interrupt request to the CPU.
The RDY time out time when the handshake state (BS2 in read protocol, BS3 for write protocol)
is established in communication with the Memory Stick can be designated as the number of
Memory Stick transfer clocks. When a time out occurs, the CPU is notified that the protocol has
ended due to a time out error by an interrupt request.
CRC circuit can be set off for test mode purpose. When CRC is off, CRC is not added to the data
transmitted to the Memory Stick.
An interrupt request can also be issued to the CPU when a Memory Stick is inserted or removed.
SCLK
870
32072H–AVR32–10/2012
AT32UC3A3
SCLK
CLK_MSI
PB
÷ Registers
INS
SDIO / DATA0
DATA1
FIFO
DATA2 64 x 4
MS I/F
DATA3
SCLK
BS Data buffer
32.4.1 GPIO
SCLK, DATA[3..0], BS & INS are I/O lines, multiplexed with other I/O lines. The I/O controller
must be configured so that MSI can drive these I/O lines.
871
32072H–AVR32–10/2012
AT32UC3A3
Pin DATA[1] is a power supply for some Memory Stick version, so leaving the pull-
down resistor connected may result in wasteful current consumption. User should leave
the DATA[1] pin pull-down open when Memory Stick Ver. 1.x is inserted.
872
32072H–AVR32–10/2012
AT32UC3A3
When the command register is written, the communication protocol with the Memory Stick starts
and data transmit/receive is performed.
The data transfer direction is determined from TPC[3]. When TPC[3]=0, the read protocol is per-
formed, and when TPC[3]=1, the write protocole is performed. When TPC[3] and FDIR bit differ,
the TPC[3] value is reflected to system register bit FDIR when the protocol starts.
FIFO can be written after protocol start therefore data must be written each time ISR.DRQ=1.
Even when the data is less than 8 bytes, always read and write 8 bytes of data. All interrupt
873
32072H–AVR32–10/2012
AT32UC3A3
sources can be cleared by setting corresponding bit in ISCR but DRQ which is cleared once
FIFO has been read/written.
CPU MSI
PEND=1, MSINT=1
Interrupt enable MSIER register
FDIR=1
FIFO direction setting MSSYS register
CMD
Write to FIFO MSDAT register
TPC = SET_CMD
TPC setting MSCMD register
Communication
with Memory Stick
MSISR.PEND=1
Protocol end
PEND=1
Interrupt clear MSISCR register
INT from
Memory Stick
MSISR.MSINT=1
INT received
MSINT=1
Interrupt clear MSISCR register
874
32072H–AVR32–10/2012
AT32UC3A3
SET_R/W_REG_ADRS TPC
WRITE_REG TPC
system parameter
(PAM bit) Error
OK
Change SCLK
(MSSYS.CLKDIV[7:0]=X)
32.6.5 Interrupts
The interrupt sources of MSI are :
Each interrupt source can be enabled in Interrupt Enable register (IER) and disabled in Interrupt
Disable register (IDR). The enable status is read in Interrupt Mask register (IMR). The status of
875
32072H–AVR32–10/2012
AT32UC3A3
the interrupt source, even if the interrupt is masked, can be read in ISR.
DRQ interrupt request is cleared by reading (reception) or writing (transmission) FIFO, other
interrupt requests are cleared by writing 1 to the corresponding bit in Interrupt Status Clear Reg-
ister (ISCR).
876
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
TPC - DSL DSZ
7 6 5 4 3 2 1 0
DSZ
TPC[3] indicates the transfer direction of data (1:write packet, 0:read packet)
• DSL : Data Select.
0 : Data is transmitted to and received from Memory Stick using the internal FIFO.
877
32072H–AVR32–10/2012
AT32UC3A3
1 : Reserved.
• DSZ : Data size.
Length can be set from 1 byte to 1024 bytes. However, 1024 bytes is set when DSZ=0.
878
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
DATA
23 22 21 20 19 18 17 16
DATA
15 14 13 12 11 10 9 8
DATA
7 6 5 4 3 2 1 0
DATA
879
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - ISTA
15 14 13 12 11 10 9 8
- - - RDY - - - -
7 6 5 4 3 2 1 0
- - EMP FUL CED ERR BRQ CNK
• ISTA : Insertion Status. It reflects the Memory Stick card presence. This is the inverse of INS pin.
0 : No card.
1 : Card is inserted.
• RDY : Ready. RDY goes to 1 when the protocol ends. This bit bit is cleared to 0 by write to the command register.
0 : Command receive disabled due to communication with the Memory Stick.
1 : Command received or protocol ended.
• EMP : FIFO Empty. This bit is set to 1 by writing system register bit FCLR=1.
0 : FIFO contains data.
1 : FIFO is empty.
• FUL : FIFO Full. This bit is cleared to 0 by writing system register bit FCLR=1.
0 : FIFO has empty space.
1 : FIFO is full.
• CED : MS Command End.
In parallel mode, this bit reflects the CED bit in the status register of a Memory Stick (INT). Indicates the end of a
command executed with SET_CMD TPC. In serial mode, this bit is always 0. It is cleared to 0 by writing to the command
register (CMD).
• ERR : Memory Stick Error.
In parallel mode, this bit reflects the ERR bit in the status register of a Memory Stick (INT). It indicates the occurence
of an error. In serial mode, this bit is always 0. It is cleared to 0 by writing to the command register (CMD).
880
32072H–AVR32–10/2012
AT32UC3A3
881
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
CLKDIV
15 14 13 12 11 10 9 8
RST SRAC - NOCRC - - FCLR FDIR
7 6 5 4 3 2 1 0
- - - REI REO BSY
882
32072H–AVR32–10/2012
AT32UC3A3
883
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - CD TOE CRC MSINT DRQ PEND
• CD : Card Detection.
0 : No card detected. This bit is cleared when the correponding bit in ISCR is set to 1.
1 : This bit is set to 1 when a Memory Stick card is inserted or removed.
• TOE : Time Out Error.
0 : This bit is cleared to 0 when the corresponding bit in ISCR it set to 1.
1 : This bit is set to 1 when protol ended with time out error.
• CRC : CRC error.
0 : No CRC error. This bit is cleared when the corresponding bit in ISCR is set to 1.
1 : This bit is set when protocol ends with CRC error.
• MSINT : Memory Stick interruption.
0 : This bit is cleared to 0 when the corresponding bit in ISCR is set to 1.
1 : This bit is set to 1 when an interrupt request INT is received from Memory Stick.
• DRQ : Data request, FIFO is full (reception) or empty (transmission).
0 : This bit is cleared to 0 when data access is no more required.
1 : This bit is set to 1 when data access is required (read or write).
• PEND : Protocol End.
0 : This bit is cleared to 0 when the corresponding bit in ISCR is set to 1.
1 : This bit is set to 1 when protol ended witout error.
884
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - CD TOE CRC MSINT - PEND
885
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - CD TOE CRC MSINT DRQ PEND
886
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - CD TOE CRC MSINT DRQ PEND
887
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - CD TOE CRC MSINT DRQ PEND
888
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - VARIANT
15 14 13 12 11 10 9 8
- - - - VERSION[11:8]
7 6 5 4 3 2 1 0
VERSION[7:0]
889
32072H–AVR32–10/2012
AT32UC3A3
33.1 Features
• Compliant with FIPS Publication 197, Advanced Encryption Standard (AES)
• 128-bit/192-bit/256-bit cryptographic key
• 12/14/16 clock cycles encryption/decryption processing time with a 128-bit/192-bit/256-bit
cryptographic key
• Support of the five standard modes of operation specified in the NIST Special Publication 800-
38A, Recommendation for Block Cipher Modes of Operation - Methods and Techniques:
– Electronic Code Book (ECB)
– Cipher Block Chaining (CBC)
– Cipher Feedback (CFB)
– Output Feedback (OFB)
– Counter (CTR)
• 8-, 16-, 32-, 64- and 128-bit data size possible in CFB mode
• Last output data mode allows optimized Message Authentication Code (MAC) generation
• Hardware counter measures against differential power analysis attacks
• Connection to DMA Controller capabilities optimizes data transfers for all operating modes
33.2 Overview
The Advanced Encryption Standard (AES) is compliant with the American FIPS (Federal Infor-
mation 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. It is compatible with all these modes via DMA Controller, minimizing pro-
cessor intervention for large buffer transfers.
The 128-bit/192-bit/256-bit key is stored in write-only four/six/eight 32-bit KEY Word Registers
(KEYWnR) which are all write-only registers.
The 128-bit input data and initialization vector (for some modes) are each stored in 32-bit Input
Data Registers (IDATAnR) and in Initialization Vector Registers (VnR) which are all write-only
registers.
As soon as the initialization vector, the input data and the key are configured, the encryp-
tion/decryption process may be started. Then the encrypted/decrypted data is ready to be read
out on the four 32-bit Output Data Registers (ODATAnR) or through the DMA Controller.
890
32072H–AVR32–10/2012
AT32UC3A3
33.3.2 Clocks
The clock for the AES bus interface (CLK_AES) is generated by the Power Manager. This clock
is enabled at reset, and can be disabled in the Power Manager. It is recommended to disable the
AES before disabling the clock, to avoid freezing the AES in an undefined state.
33.3.3 Interrupts
The AES interrupt request line is connected to the interrupt controller. Using the AES interrupt
requires the interrupt controller to be programmed first.
891
32072H–AVR32–10/2012
AT32UC3A3
These sizes are selected by writing the Cipher Feedback Data Size field in the MR register
(MR.CFDS).
Note: In 64-bit CFB mode, writing to IDATA3R and IDATA4R registers is not allowed and may lead to
errors in processing.
Note: In 32-bit, 16-bit and 8-bit CFB modes, writing to IDATA2R, IDATA3R and IDATA4R registers is not
allowed and may lead to errors in processing.
• Write the START bit in the Control Register (CR.START) to begin the encryption or the
decryption process.
• When the processing completes, the DATRDY bit in the Interrupt Status Register
(ISR.DATRDY) is set.
• If an interrupt has been enabled by writing the IER.DATRDY bit, the interrupt line of the AES
is activated.
• When the software reads one of the Output Data Registers (ODATAxR), the ISR.DATRDY bit
is cleared.
892
32072H–AVR32–10/2012
AT32UC3A3
Table 33-2. Data Transfer Type for the Different Operation Modes
Operation Mode Data Transfer Type (DMA)
ECB word
CBC word
OFB word
CFB 128-bit word
CFB 64-bit word
CFB 32-bit word
CFB 16-bit halfword
CFB 8-bit byte
CTR word
893
32072H–AVR32–10/2012
AT32UC3A3
ISR.DATRDY
If the user does not want to read the output data registers between each encryption/decryption,
the ISR.DATRDY bit will not be cleared. If the ISR.DATRDY bit is not cleared, the user cannot
know the end of the following encryptions/decryptions.
• When MR.LOD is one
The ISR.DATRDY bit is cleared when at least one IDATAnR register is written, so before the
start of a new transfer. No more ODATAnR register reads are necessary between consecutive
encryptions/decryptions.
ISR.DATRDY
894
32072H–AVR32–10/2012
AT32UC3A3
ISR.DATRDY
Note: 1. Depending on the mode, there are other ways of clearing the DATRDY.ISR bit. See the Interrupt Status Register (ISR)
definition.
Warning: In DMA mode, reading to the ODATAnR registers before the last data transfer may lead to unpredictable results.
895
32072H–AVR32–10/2012
AT32UC3A3
33.4.4.1 Countermeasures
The AES also features hardware countermeasures that can be useful to protect data against Dif-
ferential Power Analysis (DPA) attacks.
These countermeasures can be enabled through the Countermeasure Type field in the MR reg-
ister (MR.CTYPE). This field is write-only, and all changes to it are taken into account if, at the
same time, the Countermeasure Key field in the Mode Register (MR.CKEY) is correctly written
(see the Mode Register (MR) description in Section 33.5.2).
Note: Enabling countermeasures has an impact on the AES encryption/decryption throughput.
By default, all the countermeasures are enabled.
The best throughput is achieved with all the countermeasures disabled. On the other hand, the
best protection is achieved with all of them enabled.
The Random Number Generator Seed Loading bit in the CR register (CR.LOADSEED) allows a
new seed to be loaded in the embedded random number generator used for the different
countermeasures.
896
32072H–AVR32–10/2012
AT32UC3A3
Note: 1. The reset value are device specific. Please refer to the Module Configuration section at the end of this chapter.
897
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - LOADSEED
15 14 13 12 11 10 9 8
- - - - - - - SWRST
7 6 5 4 3 2 1 0
- - - - - - - START
898
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - CTYPE
23 22 21 20 19 18 17 16
CKEY - CFBS
15 14 13 12 11 10 9 8
7 6 5 4 3 2 1 0
PROCDLY - - - CIPHER
CTYPE Description
X X X X 0 Countermeasure type 1 is disabled
Add random spurious power consumption during some configuration
X X X X 1
settings
X X X 0 X Countermeasure type 2 is disabled
X X X 1 X Add randomly 1 cycle to processing.
X X 0 X X Countermeasure type 3 is disabled
X X 1 X X Add randomly 1 cycle to processing (other version)
X 0 X X X Countermeasure type 4 is disabled
X 1 X X X Add randomly up to /13/15 cycles (for /192/256-bit key) to processing
0 X X X X Countermeasure type 5 is disabled
Add random spurious power consumption during processing
1 X X X X
(recommended with DMA access)
899
32072H–AVR32–10/2012
AT32UC3A3
CFBS Description
0 128-bit
1 64-bit
2 32-bit
3 16-bit
4 8-bit
Others Reserved
OPMOD Description
0 ECB: Electronic Code Book mode
1 CBC: Cipher Block Chaining mode
2 OFB: Output Feedback mode
3 CFB: Cipher Feedback mode
4 CTR: Counter mode
Others Reserved
KEYSIZE Description
0 AES Key Size is 128 bits
1 AES Key Size is 192 bits
Others AES Key Size is 256 bits
900
32072H–AVR32–10/2012
AT32UC3A3
SMOD Description
0 Manual mode
1 Automatic mode
DMA mode
• LOD = 0: The encrypted/decrypted data are available at the address specified in the
2
configuration of DMA Controller.
• LOD = 1: The encrypted/decrypted data are available in the ODATAnR registers.
3 Reserved
901
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - URAD
7 6 5 4 3 2 1 0
- - - - - - - DATRDY
902
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - URAD
7 6 5 4 3 2 1 0
- - - - - - - DATRDY
903
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - URAD
7 6 5 4 3 2 1 0
- - - - - - - DATRDY
904
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
URAT - - - URAD
7 6 5 4 3 2 1 0
- - - - - - - DATRDY
URAT Description
0 The IDATAnR register during the data processing in DMA mode.
1 The ODATAnR register read during the data processing.
2 The MR register written during the data processing.
3 The ODATAnR register read during the sub-keys generation.
4 The MR register written during the sub-keys generation.
5 Write-only register read access.
Others Reserved
Only the last Unspecified Register Access Type is available through the URAT field.
This field is reset to 0 when SWRST bit in the Control Register is written to one.
• URAD: Unspecified Register Access Detection Status
This bit is set when at least one unspecified register access has been detected since the last software reset.
This bit is cleared when SWRST bit in the Control Register is set to one.
•
905
32072H–AVR32–10/2012
AT32UC3A3
906
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
KEYWn[31:24]
23 22 21 20 19 18 17 16
KEYWn[23:16]
15 14 13 12 11 10 9 8
KEYWn[15:8]
7 6 5 4 3 2 1 0
KEYWn[7:0]
907
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
IDATAn[31:24]
23 22 21 20 19 18 17 16
IDATAn[23:16]
15 14 13 12 11 10 9 8
IDATAn[15:8]
7 6 5 4 3 2 1 0
IDATAn[7:0]
908
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
ODATAn[31:24]
23 22 21 20 19 18 17 16
ODATAn[23:16]
15 14 13 12 11 10 9 8
ODATAn[15:8]
7 6 5 4 3 2 1 0
ODATAn[7:0]
909
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
IVn[31:24]
23 22 21 20 19 18 17 16
IVn[23:16]
15 14 13 12 11 10 9 8
IVn[15:8]
7 6 5 4 3 2 1 0
IVn[7:0]
MODE(OPMODE. Description
CBC,OFB, CFB initialization vector
CTR counter value
ECB not used, must not be written
IV1 corresponds to the first word of the Initialization Vector, IV4 to the last one.
This field is always read as zero to prevent the Initialization Vector from being read by another application.
910
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - - - - - - -
23 22 21 20 19 18 17 16
- - - - VARIANT
15 14 13 12 11 10 9 8
- - - - VERSION[11:8]
7 6 5 4 3 2 1 0
VERSION[7:0]
911
32072H–AVR32–10/2012
AT32UC3A3
912
32072H–AVR32–10/2012
AT32UC3A3
34.1 Features
• Digital Stereo DAC
• Oversampled D/A conversion architecture
– Oversampling ratio fixed 128x
– FIR equalization filter
– Digital interpolation filter: Comb4
– 3rd Order Sigma-Delta D/A converters
• Digital bitstream outputs
• Parallel interface
• Connected to DMA Controller for background transfer without CPU intervention
34.2 Overview
The Audio Bitstream DAC converts a 16-bit sample value to a digital bitstream with an average
value proportional to the sample value. Two channels are supported, making the Audio Bit-
stream DAC particularly suitable for stereo audio. Each channel has a pair of complementary
digital outputs, DATAn and DATANn, which can be connected to an external high input imped-
ance amplifier.
The output DATAn and DATANn should be as ideal as possible before filtering, to achieve the
best SNR and THD quality. The outputs can be connected to a class D amplifier output stage to
drive a speaker directly, or it can be low pass filtered and connected to a high input impedance
amplifier. A simple 1st order low pass filter that filters all the frequencies above 50kHz should be
adequate when applying the signal to a speaker or a bandlimited amplifier, as the speaker or
amplifier will act as a filter and remove high frequency components from the signal. In some
cases high frequency components might be folded down into the audible range, and in that case
a higher order filter is required. For performance measurements on digital equipment a minimum
of 4th order low pass filter should be used. This is to prevent aliasing in the measurements.
For the best performance when not using a class D amplifier approach, the two outputs DATAn
and DATANn, should be applied to a differential stage amplifier, as this will increase the SNR
and THD.
913
32072H–AVR32–10/2012
AT32UC3A3
914
32072H–AVR32–10/2012
AT32UC3A3
34.5.2 Clocks
The CLK_ABDAC to the Audio Bitstream DAC is generated by the Power Manager (PM). Before
using the Audio Bitstream DAC, the user must ensure that the Audio Bitstream DAC clock is
enabled in the Power Manager.
The ABDAC needs a separate clock for the D/A conversion operation. This clock,
GCLK_ABDAC should be set up in the Generic Clock register in the Power Manager and its fre-
quency must be as follow:
f GCLK = 256 × f S
where fs is the samping rate of the data stream to convert. For fs= 48 kHz this means that the
GCLK_ABDAC clock must have a frequency of 12.288MHz.
The two clocks, CLK_ABDAC and GCLK_ABDAC, must be in phase with each other.
34.5.3 Interrupts
The ABDAC interrupt request line is connected to the interrupt controller. Using the ABDAC
interrupt requires the interrupt controller to be programmed first.
38 38
V OUT ( 0x7FFF ) ≈ ---------- ⋅ VDDIO = ---------- ⋅ 3, 3 ≈ 0, 98V
128 128
90 90
V OUT ( 0x8000 ) ≈ ---------- ⋅ VDDIO = ---------- ⋅ 3, 3 ≈ 2, 32V
128 128
915
32072H–AVR32–10/2012
AT32UC3A3
If one want to get coherence between the sign of the input data and the output voltage one can
use the DATAN signal or invert the sign of the input data by software.
34.6.5 Construction
The Audio Bitstream DAC is constructed of two 3rd order Sigma-Delta D/A converter with an
oversampling ratio of 128. The samples are upsampled with a 4th order Sinc interpolation filter
(Comb4) before being applied to the Sigma-Delta Modulator. In order to compensate for the
pass band frequency response of the interpolation filter and flatten the overall frequency
response, the input to the interpolation filter is first filtered with a simple 3-tap FIR filter.The total
frequency response of the Equalization FIR filter and the interpolation filter is given in Figure 34-
2 on page 917. The digital output bitstreams from the Sigma-Delta Modulators should be low-
pass filtered to remove high frequency noise inserted by the modulation process.
916
32072H–AVR32–10/2012
AT32UC3A3
1 0
[d B ]
-1 0
A m p li t u d e -2 0
-3 0
-4 0
-5 0
-6 0
0 1 2 3 4 5 6 7 8 9 1 0
F re q u e n c y [F s ] 4
x 1 0
917
32072H–AVR32–10/2012
AT32UC3A3
918
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
CHANNEL1[15:8]
23 22 21 20 19 18 17 16
CHANNEL1[7:0]
15 14 13 12 11 10 9 8
CHANNEL0[15:8]
7 6 5 4 3 2 1 0
CHANNEL0[7:0]
919
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
EN SWAP - - - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - -
920
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - TXREADY UNDERRUN - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - -
921
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - TXREADY UNDERRUN - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - -
Writing a one to a bit in this register will set the corresponding bit in IMR.
Writing a zero to a bit in this register has no effect.
922
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - TXREADY UNDERRUN - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - -
Writing a one to a bit in this register will clear the corresponding bit in IMR.
Writing a zero to a bit in this register has no effect.
923
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - TXREADY UNDERRUN - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - -
Writing a one to a bit in this register will clear the corresponding bit in ISR and the corresponding interrupt request.
Writing a zero to a bit in this register has no effect.
924
32072H–AVR32–10/2012
AT32UC3A3
31 30 29 28 27 26 25 24
- - TXREADY UNDERRUN - - - -
23 22 21 20 19 18 17 16
- - - - - - - -
15 14 13 12 11 10 9 8
- - - - - - - -
7 6 5 4 3 2 1 0
- - - - - - - -
925
32072H–AVR32–10/2012
AT32UC3A3
35.1 Overview
General description of programming and debug features, block diagram and introduction of main
concepts.
926
32072H–AVR32–10/2012
AT32UC3A3
Below follows a more in depth description of what locations are accessible when the security
measures are active.
927
32072H–AVR32–10/2012
AT32UC3A3
35.3.1 Features
• Debug interface in compliance with IEEE-ISTO 5001-2003 (Nexus 2.0) Class 2+
• JTAG access to all on-chip debug functions
• Advanced program, data, ownership, and watchpoint trace supported
• NanoTrace JTAG-based trace access
• Auxiliary port for high-speed trace information
• Hardware support for 6 program and 2 data breakpoints
• Unlimited number of software breakpoints supported
• Automatic CRC check of memory regions
35.3.2 Overview
Debugging on the AT32UC3A3 is facilitated by a powerful On-Chip Debug (OCD) system. The
user accesses this through an external debug tool which connects to the JTAG port and the Aux-
iliary (AUX) port. The AUX port is primarily used for trace functions, and a JTAG-based
debugger is sufficient for basic debugging.
The debug system is based on the Nexus 2.0 standard, class 2+, which includes:
• Basic run-time control
• Program breakpoints
• Data breakpoints
• Program trace
• Ownership trace
• Data trace
In addition to the mandatory Nexus debug features, the AT32UC3A3 implements several useful
OCD features, such as:
• Debug Communication Channel between CPU and JTAG
• Run-time PC monitoring
• CRC checking
• NanoTrace
• Software Quality Assurance (SQA) support
The OCD features are controlled by OCD registers, which can be accessed by JTAG when the
NEXUS_ACCESS JTAG instruction is loaded. The CPU can also access OCD registers directly
using mtdr/mfdr instructions in any privileged mode. The OCD registers are implemented based
on the recommendations in the Nexus 2.0 standard, and are detailed in the AVR32UC Technical
Reference Manual.
928
32072H–AVR32–10/2012
AT32UC3A3
JTAG
JTAG AUX
On-Chip Debug
Memory
Service Access Bus Service Transmit Queue Watchpoints
Unit
Debug PC
Program Ownership
Data Trace
Debug Trace Trace
Breakpoints
Instruction
929
32072H–AVR32–10/2012
AT32UC3A3
PC
JTAG-based
debug tool
10-pin IDC
JTAG
AVR32
35.3.4.2 breakpoints
One of the most fundamental debug features is the ability to halt the CPU, to examine registers
and the state of the system. This is accomplished by breakpoints, of which many types are
available:
• Unconditional breakpoints are set by writing OCD registers by JTAG, halting the CPU
immediately.
• Program breakpoints halt the CPU when a specific address in the program is executed.
• Data breakpoints halt the CPU when a specific memory address is read or written, allowing
variables to be watched.
• Software breakpoints halt the CPU when the breakpoint instruction is executed.
When a breakpoint triggers, the CPU enters debug mode, and the D bit in the Status Register is
set. This is a privileged mode with dedicated return address and return status registers. All privi-
leged instructions are permitted. Debug mode can be entered as either OCD mode, running
instructions from JTAG, or monitor mode, running instructions from program memory.
930
32072H–AVR32–10/2012
AT32UC3A3
35.3.5.2 NanoTrace
The MSU additionally supports NanoTrace. This is an AVR32-specific feature, in which trace
data is output to memory instead of the AUX port. This allows the trace data to be extracted by
JTAG MEMORY_ACCESS, enabling trace features for JTAG-based debuggers. The user must
write MSU registers to configure the address and size of the memory block to be used for Nano-
Trace. The NanoTrace buffer can be anywhere in the physical address range, including internal
and external RAM, through an EBI, if present. This area may not be used by the application run-
ning on the CPU.
931
32072H–AVR32–10/2012
AT32UC3A3
Debug tools utilizing the AUX port should connect to the device through a Nexus-compliant Mic-
tor-38 connector, as described in the AVR32UC Technical Reference manual. This connector
includes the JTAG signals and the RESET_N pin, giving full access to the programming and
debug features in the device.
PC
A U X +JTA G
T ra c e b u ffe r
d e b u g to o l
M ic to r 3 8
AUX
JTAG
h ig h s p e e d
AVR32
932
32072H–AVR32–10/2012
AT32UC3A3
The trace features can be configured to be very selective, to reduce the bandwidth on the AUX
port. In case the transmit queue overflows, error messages are produced to indicate loss of
data. The transmit queue module can optionally be configured to halt the CPU when an overflow
occurs, to prevent the loss of messages, at the expense of longer run-time for the program.
933
32072H–AVR32–10/2012
AT32UC3A3
934
32072H–AVR32–10/2012
AT32UC3A3
35.4.1 Features
• IEEE1149.1 compliant JTAG Interface
• Boundary-scan Chain for board-level testing
• Direct memory access and programming capabilities through JTAG Interface
35.4.2 Overview
The JTAG Interface offers a four pin programming and debug solution, including boundary-scan
support for board-level testing.
Figure 35-4 on page 936 shows how the JTAG is connected in an 32-bit AVR device. The TAP
Controller is a state machine controlled by the TCK and TMS signals. The TAP Controller
selects either the JTAG Instruction Register or one of several Data Registers as the scan chain
(shift register) between the TDI-input and TDO-output.
The Instruction Register holds JTAG instructions controlling the behavior of a Data Register. The
Device Identification Register, Bypass Register, and the boundary-scan chain are the Data Reg-
isters used for board-level testing. The Reset Register can be used to keep the device reset
during test or programming.
The Service Access Bus (SAB) interface contains address and data registers for the Service
Access Bus, which gives access to On-Chip Debug, programming, and other functions in the
device. The SAB offers several modes of access to the address and data registers, as described
in Section 35.4.10.
Section 35.5 lists the supported JTAG instructions, with references to the description in this
document.
935
32072H–AVR32–10/2012
AT32UC3A3
Instruction Register
Internal I/O
SAB
lines
936
32072H–AVR32–10/2012
AT32UC3A3
35.4.5.2 Clocks
The JTAG Interface uses the external TCK pin as clock source. This clock must be provided by
the JTAG master.
Instructions that use the SAB bus requires the internal main clock to be running.
937
32072H–AVR32–10/2012
AT32UC3A3
Test-Logic-
1
Reset
0
1
Run-Test/ Select-DR Select-IR
0 1 1
Idle Scan Scan
0 0
Capture-DR Capture-IR
1 1
0 0
Shift-DR 0 Shift-IR 0
1 1
Exit1-DR Exit1-IR
0 0
Pause-DR 0 Pause-IR 0
1 1 1 1
0 Exit2-DR 0 Exit2-IR
1 1
1 Update-DR 1 Update-IR
0 0
938
32072H–AVR32–10/2012
AT32UC3A3
Independent of the initial state of the TAP Controller, the Test-Logic-Reset state can always be
entered by holding TMS high for 5 TCK clock periods. This sequence should always be applied
at the start of a JTAG session to bring the TAP Controller into a defined state before applying
JTAG commands. Applying a 0 on TMS for 1 TCK period brings the TAP Controller to the Run-
Test/Idle state, which is the starting point for JTAG operations.
TAP State TLR RTI SelDR SelIR CapIR ShIR Ex1IR UpdIR RTI
TMS
TDI Instruction
TDO ImplDefined
939
32072H–AVR32–10/2012
AT32UC3A3
Apply the TMS sequence 1, 1, 0 to re-enter the Run-Test/Idle state. If the selected Data Register
has a latched parallel-output, the latching takes place in the Update-DR state. The Exit-DR,
Pause-DR, and Exit2-DR states are only used for navigating the state machine.
As shown in the state diagram, the Run-Test/Idle state need not be entered between selecting
JTAG instruction and using Data Registers.
35.4.9 Boundary-scan
The boundary-scan chain has the capability of driving and observing the logic levels on the digi-
tal I/O pins, as well as the boundary between digital and analog logic for analog circuitry having
off-chip connections. At system level, all ICs having JTAG capabilities are connected serially by
the TDI/TDO signals to form a long shift register. An external controller sets up the devices to
drive values at their output pins, and observe the input values received from other devices. The
controller compares the received data with the expected result. In this way, boundary-scan pro-
vides a mechanism for testing interconnections and integrity of components on Printed Circuits
Boards by using the 4 TAP signals only.
The four IEEE 1149.1 defined mandatory JTAG instructions IDCODE, BYPASS, SAMPLE/PRE-
LOAD, and EXTEST can be used for testing the Printed Circuit Board. Initial scanning of the
data register path will show the ID-code of the device, since IDCODE is the default JTAG
instruction. It may be desirable to have the 32-bit AVR device in reset during test mode. If not
reset, inputs to the device may be determined by the scan operations, and the internal software
may be in an undetermined state when exiting the test mode. If needed, the BYPASS instruction
can be issued to make the shortest possible scan chain through the device. The device can be
set in the reset state either by pulling the external RESETn pin low, or issuing the AVR_RESET
instruction with appropriate setting of the Reset Data Register.
The EXTEST instruction is used for sampling external pins and loading output pins with data.
The data from the output latch will be driven out on the pins as soon as the EXTEST instruction
is loaded into the JTAG IR-register. Therefore, the SAMPLE/PRELOAD should also be used for
setting initial values to the scan ring, to avoid damaging the board when issuing the EXTEST
instruction for the first time. SAMPLE/PRELOAD can also be used for taking a snapshot of the
external pins during normal operation of the part.
When using the JTAG Interface for boundary-scan, the JTAG TCK clock is independent of the
internal chip clock. The internal chip clock is not required to run during boundary-scan
operations.
NOTE: For pins connected to 5V lines care should be taken to not drive the pins to a logic one
using boundary-scan, as this will create a current flowing from the 3,3V driver to the 5V pull-up
on the line. Optionally a series resistor can be added between the line and the pin to reduce the
current.
Details about the boundary-scan chain can be found in the BSDL file for the device. This can be
found on the Atmel website.
940
32072H–AVR32–10/2012
AT32UC3A3
For more information about the SAB and a list of SAB slaves see the Service Access Bus
chapter.
941
32072H–AVR32–10/2012
AT32UC3A3
• During Shift-DR of read data: The read data is invalid. The SAB stays in data mode. Repeat
scanning until the busy bit clears.
• During Shift-DR of write data: The write data is ignored. The SAB stays in data mode. Repeat
scanning until the busy bit clears.
942
32072H–AVR32–10/2012
AT32UC3A3
943
32072H–AVR32–10/2012
AT32UC3A3
Other security mechanisms can also restrict these functions. If such mechanisms are present
they are listed in the SAB address map section.
35.5.1.1 Notation
Table 35-9 on page 944 shows bit patterns to be shifted in a format like "peb01". Each character
corresponds to one bit, and eight bits are grouped together for readability. The least significant-
bit is always shifted first, and the most significant bit shifted last. The symbols used are shown in
Table 35-8.
In many cases, it is not required to shift all bits through the data register. Bit patterns are shown
using the full width of the shift register, but the suggested or required bits are emphasized using
bold text. I.e. given the pattern "aaaaaaar xxxxxxxx xxxxxxxx xxxxxxxx xx", the shift register is
34 bits, but the test or debug unit may choose to shift only 8 bits "aaaaaaar".
The following describes how to interpret the fields in the instruction description tables:
944
32072H–AVR32–10/2012
AT32UC3A3
35.5.2.1 IDCODE
This instruction selects the 32 bit Device Identification register (DID) as Data Register. The DID
register consists of a version number, a device number, and the manufacturer code chosen by
JEDEC. This is the default instruction after a JTAG reset. Details about the DID register can be
found in the module configuration section at the end of this chapter.
Starting in Run-Test/Idle, the Device Identification register is accessed in the following way:
1. Select the IR Scan path.
2. In Capture-IR: The IR output value is latched into the shift register.
3. In Shift-IR: The instruction register is shifted by the TCK input.
4. Return to Run-Test/Idle.
5. Select the DR Scan path.
6. In Capture-DR: The IDCODE value is latched into the shift register.
7. In Shift-DR: The IDCODE scan chain is shifted by the TCK input.
8. Return to Run-Test/Idle.
35.5.2.2 SAMPLE_PRELOAD
This instruction takes a snap-shot of the input/output pins without affecting the system operation,
and pre-loading the scan chain without updating the DR-latch. The boundary-scan chain is
selected as Data Register.
Starting in Run-Test/Idle, the Device Identification register is accessed in the following way:
945
32072H–AVR32–10/2012
AT32UC3A3
35.5.2.3 EXTEST
This instruction selects the boundary-scan chain as Data Register for testing circuitry external to
the 32-bit AVR package. The contents of the latched outputs of the boundary-scan chain is
driven out as soon as the JTAG IR-register is loaded with the EXTEST instruction.
Starting in Run-Test/Idle, the EXTEST instruction is accessed the following way:
1. Select the IR Scan path.
2. In Capture-IR: The IR output value is latched into the shift register.
3. In Shift-IR: The instruction register is shifted by the TCK input.
4. In Update-IR: The data from the boundary-scan chain is applied to the output pins.
5. Return to Run-Test/Idle.
6. Select the DR Scan path.
7. In Capture-DR: The data on the external pins is sampled into the boundary-scan chain.
8. In Shift-DR: The boundary-scan chain is shifted by the TCK input.
9. In Update-DR: The data from the scan chain is applied to the output pins.
10. Return to Run-Test/Idle.
946
32072H–AVR32–10/2012
AT32UC3A3
35.5.2.4 INTEST
This instruction selects the boundary-scan chain as Data Register for testing internal logic in the
device. The logic inputs are determined by the boundary-scan chain, and the logic outputs are
captured by the boundary-scan chain. The device output pins are driven from the boundary-scan
chain.
Starting in Run-Test/Idle, the INTEST instruction is accessed the following way:
1. Select the IR Scan path.
2. In Capture-IR: The IR output value is latched into the shift register.
3. In Shift-IR: The instruction register is shifted by the TCK input.
4. In Update-IR: The data from the boundary-scan chain is applied to the internal logic
inputs.
5. Return to Run-Test/Idle.
6. Select the DR Scan path.
7. In Capture-DR: The data on the internal logic is sampled into the boundary-scan chain.
8. In Shift-DR: The boundary-scan chain is shifted by the TCK input.
9. In Update-DR: The data from the boundary-scan chain is applied to internal logic
inputs.
10. Return to Run-Test/Idle.
35.5.2.5 CLAMP
This instruction selects the Bypass register as Data Register. The device output pins are driven
from the boundary-scan chain.
Starting in Run-Test/Idle, the CLAMP instruction is accessed the following way:
1. Select the IR Scan path.
2. In Capture-IR: The IR output value is latched into the shift register.
3. In Shift-IR: The instruction register is shifted by the TCK input.
4. In Update-IR: The data from the boundary-scan chain is applied to the output pins.
5. Return to Run-Test/Idle.
6. Select the DR Scan path.
7. In Capture-DR: A logic ‘0’ is loaded into the Bypass Register.
8. In Shift-DR: Data is scanned from TDI to TDO through the Bypass register.
947
32072H–AVR32–10/2012
AT32UC3A3
9. Return to Run-Test/Idle.
35.5.2.6 BYPASS
This instruction selects the 1-bit Bypass Register as Data Register.
Starting in Run-Test/Idle, the CLAMP instruction is accessed the following way:
1. Select the IR Scan path.
2. In Capture-IR: The IR output value is latched into the shift register.
3. In Shift-IR: The instruction register is shifted by the TCK input.
4. Return to Run-Test/Idle.
5. Select the DR Scan path.
6. In Capture-DR: A logic ‘0’ is loaded into the Bypass Register.
7. In Shift-DR: Data is scanned from TDI to TDO through the Bypass register.
8. Return to Run-Test/Idle.
35.5.3.1 NEXUS_ACCESS
This instruction allows Nexus-compliant access to the On-Chip Debug registers through the
SAB. The 7-bit register index, a read/write control bit, and the 32-bit data is accessed through
the JTAG port.
The data register is alternately interpreted by the SAB as an address register and a data regis-
ter. The SAB starts in address mode after the NEXUS_ACCESS instruction is selected, and
toggles between address and data mode each time a data scan completes with the busy bit
cleared.
NOTE: The polarity of the direction bit is inverse of the Nexus standard.
948
32072H–AVR32–10/2012
AT32UC3A3
35.5.3.2 MEMORY_SERVICE
This instruction allows access to registers in an optional Memory Service Unit. The 7-bit register
index, a read/write control bit, and the 32-bit data is accessed through the JTAG port.
The data register is alternately interpreted by the SAB as an address register and a data regis-
ter. The SAB starts in address mode after the MEMORY_SERVICE instruction is selected, and
toggles between address and data mode each time a data scan completes with the busy bit
cleared.
Starting in Run-Test/Idle, Memory Service registers are accessed in the following way:
1. Select the IR Scan path.
2. In Capture-IR: The IR output value is latched into the shift register.
3. In Shift-IR: The instruction register is shifted by the TCK input.
4. Return to Run-Test/Idle.
5. Select the DR Scan path.
6. In Shift-DR: Scan in the direction bit (1=read, 0=write) and the 7-bit address for the
Memory Service register.
949
32072H–AVR32–10/2012
AT32UC3A3
35.5.3.3 MEMORY_SIZED_ACCESS
This instruction allows access to the entire Service Access Bus data area. Data is accessed
through a 36-bit byte index, a 2-bit size, a direction bit, and 8, 16, or 32 bits of data. Not all units
mapped on the SAB bus may support all sizes of accesses, e.g., some may only support word
accesses.
The data register is alternately interpreted by the SAB as an address register and a data regis-
ter. The SAB starts in address mode after the MEMORY_SIZED_ACCESS instruction is
selected, and toggles between address and data mode each time a data scan completes with
the busy bit cleared.
950
32072H–AVR32–10/2012
AT32UC3A3
951
32072H–AVR32–10/2012
AT32UC3A3
35.5.3.4 MEMORY_WORD_ACCESS
This instruction allows access to the entire Service Access Bus data area. Data is accessed
through the 34 MSB of the SAB address, a direction bit, and 32 bits of data. This instruction is
identical to MEMORY_SIZED_ACCESS except that it always does word sized accesses. The
size field is implied, and the two lowest address bits are removed and not scanned in.
Note: This instruction was previously known as MEMORY_ACCESS, and is provided for back-
wards compatibility.
The data register is alternately interpreted by the SAB as an address register and a data regis-
ter. The SAB starts in address mode after the MEMORY_WORD_ACCESS instruction is
selected, and toggles between address and data mode each time a data scan completes with
the busy bit cleared.
Starting in Run-Test/Idle, SAB data is accessed in the following way:
1. Select the IR Scan path.
2. In Capture-IR: The IR output value is latched into the shift register.
3. In Shift-IR: The instruction register is shifted by the TCK input.
4. Return to Run-Test/Idle.
5. Select the DR Scan path.
6. In Shift-DR: Scan in the direction bit (1=read, 0=write) and the 34-bit address of the
data to access.
7. Go to Update-DR and re-enter Select-DR Scan.
8. In Shift-DR: For a read operation, scan out the contents of the addressed area. For a
write operation, scan in the new contents of the area.
9. Return to Run-Test/Idle.
For any operation, the full 34 bits of the address must be provided. For write operations, 32 data
bits must be provided, or the result will be undefined. For read operations, shifting may be termi-
nated once the required number of bits have been acquired.
952
32072H–AVR32–10/2012
AT32UC3A3
35.5.3.5 MEMORY_BLOCK_ACCESS
This instruction allows access to the entire SAB data area. Up to 32 bits of data is accessed at a
time, while the address is sequentially incremented from the previously used address.
In this mode, the SAB address, size, and access direction is not provided with each access.
Instead, the previous address is auto-incremented depending on the specified size and the pre-
vious operation repeated. The address must be set up in advance with
MEMORY_SIZE_ACCESS or MEMORY_WORD_ACCESS. It is allowed, but not required, to
shift data after shifting the address.
This instruction is primarily intended to speed up large quantities of sequential word accesses. It
is possible to use it also for byte and halfword accesses, but the overhead in this is case much
larger as 32 bits must still be shifted for each access.
The following sequence should be used:
1. Use the MEMORY_SIZE_ACCESS or MEMORY_WORD_ACCESS to read or write the
first location.
2. Return to Run-Test/Idle.
3. Select the IR Scan path.
4. In Capture-IR: The IR output value is latched into the shift register.
5. In Shift-IR: The instruction register is shifted by the TCK input.
6. Return to Run-Test/Idle.
7. Select the DR Scan path. The address will now have incremented by 1, 2, or 4 (corre-
sponding to the next byte, halfword, or word location).
8. In Shift-DR: For a read operation, scan out the contents of the next addressed location.
For a write operation, scan in the new contents of the next addressed location.
9. Go to Update-DR.
10. If the block access is not complete, return to Select-DR Scan and repeat the access.
11. If the block access is complete, return to Run-Test/Idle.
For write operations, 32 data bits must be provided, or the result will be undefined. For read
operations, shifting may be terminated once the required number of bits have been acquired.
953
32072H–AVR32–10/2012
AT32UC3A3
The overhead using block word access is 4 cycles per 32 bits of data, resulting in an 88% trans-
fer efficiency, or 2.1 MBytes per second with a 20 MHz TCK frequency.
35.5.3.6 CANCEL_ACCESS
If a very slow memory location is accessed during a SAB memory access, it could take a very
long time until the busy bit is cleared, and the SAB becomes ready for the next operation. The
CANCEL_ACCESS instruction provides a possibility to abort an ongoing transfer and report a
timeout to the JTAG master.
When the CANCEL_ACCESS instruction is selected, the current access will be terminated as
soon as possible. There are no guarantees about how long this will take, as the hardware may
not always be able to cancel the access immediately. The SAB is ready to respond to a new
command when the busy bit clears.
Starting in Run-Test/Idle, CANCEL_ACCESS is accessed in the following way:
1. Select the IR Scan path.
2. In Capture-IR: The IR output value is latched into the shift register.
3. In Shift-IR: The instruction register is shifted by the TCK input.
4. Return to Run-Test/Idle.
35.5.3.7 SYNC
This instruction allows external debuggers and testers to measure the ratio between the external
JTAG clock and the internal system clock. The SYNC data register is a 16-bit counter that
counts down to zero using the internal system clock. The busy bit stays high until the counter
reaches zero.
Starting in Run-Test/Idle, SYNC instruction is used in the following way:
1. Select the IR Scan path.
2. In Capture-IR: The IR output value is latched into the shift register.
3. In Shift-IR: The instruction register is shifted by the TCK input.
4. Return to Run-Test/Idle.
5. Select the DR Scan path.
954
32072H–AVR32–10/2012
AT32UC3A3
35.5.3.8 AVR_RESET
This instruction allows a debugger or tester to directly control separate reset domains inside the
chip. The shift register contains one bit for each controllable reset domain. Setting a bit to one
resets that domain and holds it in reset. Setting a bit to zero releases the reset for that domain.
The AVR_RESET instruction can be used in the following way:
1. Select the IR Scan path.
2. In Capture-IR: The IR output value is latched into the shift register.
3. In Shift-IR: The instruction register is shifted by the TCK input.
4. Return to Run-Test/Idle.
5. Select the DR Scan path.
6. In Shift-DR: Scan in the value corresponding to the reset domains the JTAG master
wants to reset into the data register.
7. Return to Run-Test/Idle.
8. Stay in run test idle for at least 10 TCK clock cycles to let the reset propagate to the
system.
See the device specific documentation for the number of reset domains, and what these
domains are.
For any operation, all bits must be provided or the result will be undefined.
955
32072H–AVR32–10/2012
AT32UC3A3
35.5.3.9 CHIP_ERASE
This instruction allows a programmer to completely erase all nonvolatile memories in a chip.
This will also clear any security bits that are set, so the device can be accessed normally. In
devices without non-volatile memories this instruction does nothing, and appears to complete
immediately.
The erasing of non-volatile memories starts as soon as the CHIP_ERASE instruction is selected.
The CHIP_ERASE instruction selects a 1 bit bypass data register.
A chip erase operation should be performed as:
1. Reset the system and stop the CPU from executing.
2. Select the IR Scan path.
3. In Capture-IR: The IR output value is latched into the shift register.
4. In Shift-IR: The instruction register is shifted by the TCK input.
5. Check the busy bit that was scanned out during Shift-IR. If the busy bit was set goto 2.
6. Return to Run-Test/Idle.
35.5.3.10 HALT
This instruction allows a programmer to easily stop the CPU to ensure that it does not execute
invalid code during programming.
This instruction selects a 1-bit halt register. Setting this bit to one resets the device and halts the
CPU. Setting this bit to zero resets the device and releases the CPU to run normally. The value
shifted out from the data register is one if the CPU is halted.
The HALT instruction can be used in the following way:
1. Select the IR Scan path.
2. In Capture-IR: The IR output value is latched into the shift register.
3. In Shift-IR: The instruction register is shifted by the TCK input.
4. Return to Run-Test/Idle.
5. Select the DR Scan path.
956
32072H–AVR32–10/2012
AT32UC3A3
6. In Shift-DR: Scan in the value 1 to halt the CPU, 0 to start CPU execution.
7. Return to Run-Test/Idle.
957
32072H–AVR32–10/2012
AT32UC3A3
Bit 31 28 27 12 11 1 0
The different device configurations have different JTAG ID codes, as shown in Table 35-27.
Note that if the flash controller is statically reset, the ID code will be undefined.
Table 35-27. Device and JTAG ID
Device name JTAG ID code (r is the revision number)
AT32UC3A3256S 0xr202003F
AT32UC3A3128S 0xr202103F
AT32UC3A364S 0xr202203F
AT32UC3A3256 0xr202603F
AT32UC3A3128 0xr202703F
AT32UC3A364 0xr202803F
AT32UC3A4256S 0xr202903F
AT32UC3A4128S 0xr202a03F
AT32UC3A464S 0xr202b03F
AT32UC3A4256 0xr202c03F
AT32UC3A128 0xr202d03F
AT32UC3A64 0xr202e03F
958
32072H–AVR32–10/2012
AT32UC3A3
Bit 4 3 2 1 0
CPU CPU
APP HSB and PB buses
OCD On-Chip Debug logic and registers
RSERVED No effect
Note: This register is primarily intended for compatibility with other 32-bit AVR devices. Certain
operations may not function correctly when parts of the system are reset. It is generally recom-
mended to only write 0x11111 or 0x00000 to these bits to ensure no unintended side effects
occur.
959
32072H–AVR32–10/2012
AT32UC3A3
960
32072H–AVR32–10/2012
AT32UC3A3
36.2 DC Characteristics
The following characteristics are applicable to the operating temperature range: T A = -40°C to 85°C, unless otherwise
specified and are certified for a junction temperature up toTJ = 100°C.
961
32072H–AVR32–10/2012
AT32UC3A3
Figure 36-1. I/O Pin drive x2 Output Low Level Voltage (VOL) vs. Source Current
VddIo = 3.3V
1,8
90
1,6
25
1,4 -45
1,2
Voltage [V
1
0,8
0,6
0,4
0,2
0
0 5 10 15 20
Load current [mA]
Figure 36-2. I/O Pin drive x2 Output High Level Voltage (VOH) vs. Source Current
VddIo = 3.3V
3,5
2,5
Voltage [V
-45
2 25
90
1,5
0,5
0
0 5 10 15 20
Load current [mA]
962
32072H–AVR32–10/2012
AT32UC3A3
963
32072H–AVR32–10/2012
AT32UC3A3
36.5.1 ADC
36.5.2 BOD
964
32072H–AVR32–10/2012
AT32UC3A3
965
32072H–AVR32–10/2012
AT32UC3A3
RESET_N
Internal
BOD33 Reset
TSSU1
Internal
MCU Reset
RESET_N
Internal
BOD33 Reset
TSSU1
Internal
MCU Reset
RESET_N
BOD Reset
WDT Reset
TSSU2
Internal
MCU Reset
966
32072H–AVR32–10/2012
AT32UC3A3
967
32072H–AVR32–10/2012
AT32UC3A3
VDDANA
VDDIO
VDDIN
Amp0
Internal
Voltage
Regulator
VDDCORE
GNDCORE
GNDPLL
These figures represent the power consumption measured on the power supplies
968
32072H–AVR32–10/2012
AT32UC3A3
969
32072H–AVR32–10/2012
AT32UC3A3
970
32072H–AVR32–10/2012
AT32UC3A3
971
32072H–AVR32–10/2012
AT32UC3A3
972
32072H–AVR32–10/2012
AT32UC3A3
973
32072H–AVR32–10/2012
AT32UC3A3
1. Corresponds to 13 clock cycles: 3 clock cycles for track and hold acquisition time and 10 clock cycles for conversion.
2. Corresponds to 15 clock cycles: 5 clock cycles for track and hold acquisition time and 10 clock cycles for conversion.
974
32072H–AVR32–10/2012
AT32UC3A3
975
32072H–AVR32–10/2012
AT32UC3A3
976
32072H–AVR32–10/2012
AT32UC3A3
977
32072H–AVR32–10/2012
AT32UC3A3
Note: 1. hold length = total cycle duration - setup duration - pulse duration. “hold length” is for “ncs wr hold length” or “nwe hold
length"
Table 36-34. SMC Write Signals with No Hold Settings (NWE Controlled only)
Symbol Parameter Min. Unit
SMC37 NWE Rising to A2-A25 Valid 5.4 ns
SMC38 NWE Rising to NBS0/A0 Valid 5 ns
SMC39 NWE Rising to NBS1 Change 5 ns
SMC40 NWE Rising to A1/NBS2 Change 5 ns
SMC41 NWE Rising to NBS3 Change 5 ns
SMC42 NWE Rising to NCS Rising 5.1 ns
978
32072H–AVR32–10/2012
AT32UC3A3
Table 36-34. SMC Write Signals with No Hold Settings (NWE Controlled only)
Symbol Parameter Min. Unit
SMC43 Data Out Valid before NWE Rising (nwe pulse length - 1) * tCPSMC - 1.2 ns
SMC44 Data Out Valid after NWE Rising 5 ns
SMC45 NWE Pulse Width nwe pulse length * tCPSMC - 0.9 ns
A2-A25
A0/A1/NBS[3:0]
NRD
SMC17
SMC17
D0 - D15
SMC36
NWE
979
32072H–AVR32–10/2012
AT32UC3A3
Figure 36-8. SMC Signals for NRD and NRW Controlled Accesses.
SMC7 SMC37 SMC7 SMC31
A2-A25
A0/A1/NBS[3:0]
NCS
SMC8
SMC9 SMC9
NRD
D0 - D15
SMC45 SMC33
NWE
Note: 1. The maximum frequency of the SDRAMC interface is the same as the max frequency for the HSB.
980
32072H–AVR32–10/2012
AT32UC3A3
981
32072H–AVR32–10/2012
AT32UC3A3
SDCK
SDRAMC1 SDRAMC2 SDRAMC3 SDRAMC4
SDCKE
SDRAMC5 SDRAMC6 SDRAMC5 SDRAMC6 SDRAMC5 SDRAMC6
SDCS
SDRAMC7 SDRAMC8
RAS
SDRAMC15 SDRAMC16 SDRAMC15 SDRAMC16
CAS
SDRAMC23 SDRAMC24
SDWE
SDRAMC9 SDRAMC10 SDRAMC9 SDRAMC10 SDRAMC9 SDRAMC10
SDA10
SDRAMC11 SDRAMC12 SDRAMC11 SDRAMC12 SDRAMC11 SDRAMC12
A0 - A9,
A11 - A13
SDRAMC13 SDRAMC14 SDRAMC13 SDRAMC14 SDRAMC13 SDRAMC14
BA0/BA1
SDRAMC17 SDRAMC18 SDRAMC17 SDRAMC18
DQM0 -
DQM3
SDRAMC19 SDRAMC20
D0 - D15
Read
SDRAMC25 SDRAMC26
D0 - D15
to Write
982
32072H–AVR32–10/2012
AT32UC3A3
983
32072H–AVR32–10/2012
AT32UC3A3
JTAG JTAG1
0
TMS/TDI
JTAG3 JTAG4
TDO
JTAG5
JTAG6
Device
Inputs
JTAG7 JTAG8
Device
Outputs
JTAG9
JTAG10
Figure 36-11. SPI Master mode with (CPOL= NCPHA= 0) or (CPOL= NCPHA= 1)
SPCK
SPI0 SPI1
MISO
SPI2
MOSI
984
32072H–AVR32–10/2012
AT32UC3A3
Figure 36-12. SPI Master mode with (CPOL= 0 and NCPHA= 1) or (CPOL= 1 and NCPHA= 0)
SPCK
SPI3 SPI4
MISO
SPI5
MOSI
Figure 36-13. SPI Slave mode with (CPOL= 0 and NCPHA= 1) or (CPOL= 1 and NCPHA= 0)
SPCK
SPI6
MISO
SPI7 SPI8
MOSI
Figure 36-14. SPI Slave mode with (CPOL= NCPHA= 0) or (CPOL= NCPHA= 1)
SPCK
SPI9
MISO
SPI10 SPI11
MOSI
985
32072H–AVR32–10/2012
AT32UC3A3
36.14 MCI
The High Speed MultiMedia Card Interface (MCI) supports the MultiMedia Card (MMC) Specifi-
cation V4.2, the SD Memory Card Specification V2.0, the SDIO V1.1 specification and CE-ATA
V1.1.
986
32072H–AVR32–10/2012
AT32UC3A3
987
32072H–AVR32–10/2012
AT32UC3A3
988
32072H–AVR32–10/2012
AT32UC3A3
989
32072H–AVR32–10/2012
AT32UC3A3
990
32072H–AVR32–10/2012
AT32UC3A3
991
32072H–AVR32–10/2012
AT32UC3A3
992
32072H–AVR32–10/2012
AT32UC3A3
993
32072H–AVR32–10/2012
AT32UC3A3
39. Errata
39.1 Rev. H
39.1.1 General
Devices with Date Code lower than 1233 cannot operate with CPU frequency higher
than 66MHz in 1WS and 36MHz in 0WS in the whole temperature range
Fix/Workaround
None
MPU
Privilege violation when using interrupts in application mode with protected system
stack
If the system stack is protected by the MPU and an interrupt occurs in application mode, an
MPU DTLB exception will occur.
Fix/Workaround
Make a DTLB Protection (Write) exception handler which permits the interrupt request to be
handled in privileged mode.
39.1.3 USB
994
32072H–AVR32–10/2012
AT32UC3A3
For higher polling time, the software must freeze the pipe for the desired period in order to
prevent any "extra" token.
39.1.4 ADC
39.1.5 USART
The LINID interrupt is only available for the header reception and not available for the
header transmission
Fix/Workaround
None.
USART LIN mode is not functional with the PDCA if PDCM bit in LINMR register is set
to 1
If a PDCA transfer is initiated in USART LIN mode with PDCM bit set to 1, the transfer never
starts.
Fix/Workaround
Only use PDCM=0 configuration with the PDCA transfer.
SPI
SPI bad serial clock generation on 2nd chip_select when SCBR=1, CPOL=1, and
NCPHA=0
When multiple chip selects (CS) are in use, if one of the baudrates equal 1 while one
(CSRn.SCBR=1) of the others do not equal 1, and CSRn.CPOL=1 and CSRn.NCPHA=0,
then an additional pulse will be generated on SCK.
Fix/Workaround
When multiple CS are in use, if one of the baudrates equals 1, the others must also equal 1
if CSRn.CPOL=1 and CSRn.NCPHA=0.
995
32072H–AVR32–10/2012
AT32UC3A3
Power Manager
Fix/Workaround
None.
Clock sources will not be stopped in STATIC sleep mode if the difference between
CPU and PBx division factor is too high
If the division factor between the CPU/HSB and PBx frequencies is more than 4 when going
to a sleep mode where the system RC oscillator is turned off, then high speed clock sources
will not be turned off. This will result in a significantly higher power consumption during the
sleep mode.
Fix/Workaround
Before going to sleep modes where the system RC oscillator is stopped, make sure that the
factor between the CPU/HSB and PBx frequencies is less than or equal to 4.
PDCA
PCONTROL.CHxRES is non-functional
PCONTROL.CHxRES is non-functional. Counters are reset at power-on, and cannot be
reset by software.
Fix/Workaround
Software needs to keep history of performance counters.
AES
996
32072H–AVR32–10/2012
AT32UC3A3
URAD (Unspecified Register Access Detection Status) does not detect read accesses
to the write-only KEYW[5..8]R registers
Fix/Workaround
None.
39.1.6 HMATRIX
In the PRAS and PRBS registers, the MxPR fields are only two bits
In the PRAS and PRBS registers, the MxPR fields are only two bits wide, instead of four bits.
The unused bits are undefined when reading the registers.
Fix/Workaround
Mask undefined bits when reading PRAS and PRBS.
39.1.7 TWIM
TWIS
Clearing the NAK bit before the BTF bit is set locks up the TWI bus
When the TWIS is in transmit mode, clearing the NAK Received (NAK) bit of the Status Reg-
ister (SR) before the end of the Acknowledge/Not Acknowledge cycle will cause the TWIS to
attempt to continue transmitting data, thus locking up the bus.
Fix/Workaround
Clear SR.NAK only after the Byte Transfer Finished (BTF) bit of the same register has been
set.
997
32072H–AVR32–10/2012
AT32UC3A3
Fix/Workaround
None.
SSC
Frame Synchro and Frame Synchro Data are delayed by one clock cycle
The frame synchro and the frame synchro data are delayed from 1 SSC_CLOCK when:
- Clock is CKDIV
- The START is selected on either a frame synchro edge or a level
- Frame synchro data is enabled
- Transmit clock is gated on output (through CKO field)
Fix/Workaround
Transmit or receive CLOCK must not be gated (by the mean of CKO field) when START
condition is performed on a generated frame synchro.
39.1.8 FLASHC
Corrupted read in flash may happen after fuses write or erase operations (FLASHC
LP, UP, WGPB, EGPB, SSB, PGPFB, EAGPF commands)
After a flash fuse write or erase operation (FLASHC LP, UP, WGPB, EGPB, SSB, PGPFB,
EAGPF commands), reading (data read or code fetch) in flash may fail. This may lead to an
exception or to other errors derived from this corrupted read access.
Fix/Workaround
Before the flash fuse write or erase operation, enable the flash high speed mode (FLASHC
HSEN command). The flash fuse write or erase operations (FLASHC LP, UP, WGPB,
EGPB, SSB, PGPFB, EAGPF commands) must be issued from RAM or through the EBI.
After these commands, read 3 times one flash page initialized to 00h. Disable the flash high
speed mode (FLASHC HSDIS command). It is then possible to safely read or code fetch the
flash.
39.2 Rev. E
39.2.1 General
Devices cannot operate with CPU frequency higher than 66MHz in 1WS and 36MHz in
0WS
Fix/Workaround
None
Power consumption in static mode The power consumption in static mode can be up
to 330µA on some parts (typical at 25°C)
Fix/Workaround
Set to 1b bit CORRS4 of the ECCHRS mode register (MD). In C-code: *((volatile int*)
(0xFFFE2404))= 0x400.
998
32072H–AVR32–10/2012
AT32UC3A3
MPU
Privilege violation when using interrupts in application mode with protected system
stack
If the system stack is protected by the MPU and an interrupt occurs in application mode, an
MPU DTLB exception will occur.
Fix/Workaround
Make a DTLB Protection (Write) exception handler which permits the interrupt request to be
handled in privileged mode.
39.2.2 USB
999
32072H–AVR32–10/2012
AT32UC3A3
39.2.3 ADC
39.2.4 USART
The LINID interrupt is only available for the header reception and not available for the
header transmission
Fix/Workaround
None.
USART LIN mode is not functional with the PDCA if PDCM bit in LINMR register is set
to 1
If a PDCA transfer is initiated in USART LIN mode with PDCM bit set to 1, the transfer never
starts.
Fix/Workaround
Only use PDCM=0 configuration with the PDCA transfer.
The RTS output does not function correctly in hardware handshaking mode
The RTS signal is not generated properly when the USART receives data in hardware hand-
shaking mode. When the Peripheral DMA receive buffer becomes full, the RTS output
should go high, but it will stay low.
Fix/Workaround
Do not use the hardware handshaking mode of the USART. If it is necessary to drive the
RTS output high when the Peripheral DMA receive buffer becomes full, use the normal
mode of the USART. Configure the Peripheral DMA Controller to signal an interrupt when
the receive buffer is full. In the interrupt handler code, write a one to the RTSDIS bit in the
USART Control Register (CR). This will drive the RTS output high. After the next DMA trans-
fer is started and a receive buffer is available, write a one to the RTSEN bit in the USART
CR so that RTS will be driven low.
SPI
1000
32072H–AVR32–10/2012
AT32UC3A3
SPI bad serial clock generation on 2nd chip_select when SCBR=1, CPOL=1, and
NCPHA=0
When multiple chip selects (CS) are in use, if one of the baudrates equal 1 while one
(CSRn.SCBR=1) of the others do not equal 1, and CSRn.CPOL=1 and CSRn.NCPHA=0,
then an additional pulse will be generated on SCK.
Fix/Workaround
When multiple CS are in use, if one of the baudrates equals 1, the others must also equal 1
if CSRn.CPOL=1 and CSRn.NCPHA=0.
Power Manager
Fix/Workaround
None.
Clock sources will not be stopped in STATIC sleep mode if the difference between
CPU and PBx division factor is too high
If the division factor between the CPU/HSB and PBx frequencies is more than 4 when going
to a sleep mode where the system RC oscillator is turned off, then high speed clock sources
will not be turned off. This will result in a significantly higher power consumption during the
sleep mode.
Fix/Workaround
Before going to sleep modes where the system RC oscillator is stopped, make sure that the
factor between the CPU/HSB and PBx frequencies is less than or equal to 4.
PDCA
1001
32072H–AVR32–10/2012
AT32UC3A3
PCONTROL.CHxRES is non-functional
PCONTROL.CHxRES is non-functional. Counters are reset at power-on, and cannot be
reset by software.
Fix/Workaround
Software needs to keep history of performance counters.
AES
URAD (Unspecified Register Access Detection Status) does not detect read accesses
to the write-only KEYW[5..8]R registers
Fix/Workaround
None.
39.2.5 HMATRIX
In the PRAS and PRBS registers, the MxPR fields are only two bits
In the PRAS and PRBS registers, the MxPR fields are only two bits wide, instead of four bits.
The unused bits are undefined when reading the registers.
Fix/Workaround
Mask undefined bits when reading PRAS and PRBS.
39.2.6 TWIM
1002
32072H–AVR32–10/2012
AT32UC3A3
TWIS
Clearing the NAK bit before the BTF bit is set locks up the TWI bus
When the TWIS is in transmit mode, clearing the NAK Received (NAK) bit of the Status Reg-
ister (SR) before the end of the Acknowledge/Not Acknowledge cycle will cause the TWIS to
attempt to continue transmitting data, thus locking up the bus.
Fix/Workaround
Clear SR.NAK only after the Byte Transfer Finished (BTF) bit of the same register has been
set.
MCI
The busy signal of the responses R1b is not taken in account for CMD12
STOP_TRANSFER
It is not possible to know the busy status of the card during the response (R1b) for the com-
mands CMD12.
Fix/Workaround
The card busy line should be polled through the GPIO Input Value register (IVR) for com-
mands CMD12.
SSC
Frame Synchro and Frame Synchro Data are delayed by one clock cycle
The frame synchro and the frame synchro data are delayed from 1 SSC_CLOCK when:
- Clock is CKDIV
- The START is selected on either a frame synchro edge or a level
- Frame synchro data is enabled
- Transmit clock is gated on output (through CKO field)
Fix/Workaround
Transmit or receive CLOCK must not be gated (by the mean of CKO field) when START
condition is performed on a generated frame synchro.
39.2.7 FLASHC
Corrupted read in flash may happen after fuses write or erase operations (FLASHC
LP, UP, WGPB, EGPB, SSB, PGPFB, EAGPF commands)
After a flash fuse write or erase operation (FLASHC LP, UP, WGPB, EGPB, SSB, PGPFB,
EAGPF commands), reading (data read or code fetch) in flash may fail. This may lead to an
exception or to other errors derived from this corrupted read access.
Fix/Workaround
Before the flash fuse write or erase operation, enable the flash high speed mode (FLASHC
HSEN command). The flash fuse write or erase operations (FLASHC LP, UP, WGPB,
EGPB, SSB, PGPFB, EAGPF commands) must be issued from RAM or through the EBI.
1003
32072H–AVR32–10/2012
AT32UC3A3
After these commands, read 3 times one flash page initialized to 00h. Disable the flash high
speed mode (FLASHC HSDIS command). It is then possible to safely read or code fetch the
flash.
39.3 Rev. D
39.3.1 General
Devices cannot operate with CPU frequency higher than 66MHz in 1WS and 36MHz in
0WS
Fix/Workaround
None
1004
32072H–AVR32–10/2012
AT32UC3A3
In the PRAS and PRBS registers, the MxPR fields are only two bits
In the PRAS and PRBS registers, the MxPR fields are only two bits wide, instead of four bits.
The unused bits are undefined when reading the registers.
Fix/Workaround
Mask undefined bits when reading PRAS and PRBS.
MPU
Privilege violation when using interrupts in application mode with protected system
stack
If the system stack is protected by the MPU and an interrupt occurs in application mode, an
MPU DTLB exception will occur.
Fix/Workaround
Make a DTLB Protection (Write) exception handler which permits the interrupt request to be
handled in privileged mode.
39.3.2 USB
39.3.3 ADC
39.3.4 USART
1005
32072H–AVR32–10/2012
AT32UC3A3
Fix/Workaround
None.
The LINID interrupt is only available for the header reception and not available for the
header transmission
Fix/Workaround
None.
USART LIN mode is not functional with the PDCA if PDCM bit in LINMR register is set
to 1
If a PDCA transfer is initiated in USART LIN mode with PDCM bit set to 1, the transfer never
starts.
Fix/Workaround
Only use PDCM=0 configuration with the PDCA transfer.
The RTS output does not function correctly in hardware handshaking mode
The RTS signal is not generated properly when the USART receives data in hardware hand-
shaking mode. When the Peripheral DMA receive buffer becomes full, the RTS output
should go high, but it will stay low.
Fix/Workaround
Do not use the hardware handshaking mode of the USART. If it is necessary to drive the
RTS output high when the Peripheral DMA receive buffer becomes full, use the normal
mode of the USART. Configure the Peripheral DMA Controller to signal an interrupt when
the receive buffer is full. In the interrupt handler code, write a one to the RTSDIS bit in the
USART Control Register (CR). This will drive the RTS output high. After the next DMA trans-
fer is started and a receive buffer is available, write a one to the RTSEN bit in the USART
CR so that RTS will be driven low.
SPI
SPI bad serial clock generation on 2nd chip_select when SCBR=1, CPOL=1, and
NCPHA=0
When multiple chip selects (CS) are in use, if one of the baudrates equal 1 while one
(CSRn.SCBR=1) of the others do not equal 1, and CSRn.CPOL=1 and CSRn.NCPHA=0,
then an additional pulse will be generated on SCK.
1006
32072H–AVR32–10/2012
AT32UC3A3
Fix/Workaround
When multiple CS are in use, if one of the baudrates equals 1, the others must also equal 1
if CSRn.CPOL=1 and CSRn.NCPHA=0.
Power Manager
Fix/Workaround
None.
Clock sources will not be stopped in STATIC sleep mode if the difference between
CPU and PBx division factor is too high
If the division factor between the CPU/HSB and PBx frequencies is more than 4 when going
to a sleep mode where the system RC oscillator is turned off, then high speed clock sources
will not be turned off. This will result in a significantly higher power consumption during the
sleep mode.
Fix/Workaround
Before going to sleep modes where the system RC oscillator is stopped, make sure that the
factor between the CPU/HSB and PBx frequencies is less than or equal to 4.
PDCA
PCONTROL.CHxRES is non-functional
PCONTROL.CHxRES is non-functional. Counters are reset at power-on, and cannot be
reset by software.
Fix/Workaround
Software needs to keep history of performance counters.
1007
32072H–AVR32–10/2012
AT32UC3A3
Fix/Workaround
Disable and then enable the peripheral after the transfer error.
AES
URAD (Unspecified Register Access Detection Status) does not detect read accesses
to the write-only KEYW[5..8]R registers
Fix/Workaround
None.
39.3.5 HMATRIX
In the PRAS and PRBS registers, the MxPR fields are only two bits
In the PRAS and PRBS registers, the MxPR fields are only two bits wide, instead of four bits.
The unused bits are undefined when reading the registers.
Fix/Workaround
Mask undefined bits when reading PRAS and PRBS.
39.3.6 TWIM
TWIS
39.3.7 MCI
The busy signal of the responses R1b is not taken in account for CMD12
STOP_TRANSFER
It is not possible to know the busy status of the card during the response (R1b) for the com-
mands CMD12.
Fix/Workaround
The card busy line should be polled through the GPIO Input Value register (IVR) for com-
mands CMD12.
1008
32072H–AVR32–10/2012
AT32UC3A3
39.3.8 SSC
Frame Synchro and Frame Synchro Data are delayed by one clock cycle
The frame synchro and the frame synchro data are delayed from 1 SSC_CLOCK when:
- Clock is CKDIV
- The START is selected on either a frame synchro edge or a level
- Frame synchro data is enabled
- Transmit clock is gated on output (through CKO field)
Fix/Workaround
Transmit or receive CLOCK must not be gated (by the mean of CKO field) when START
condition is performed on a generated frame synchro.
39.3.9 FLASHC
Corrupted read in flash may happen after fuses write or erase operations (FLASHC
LP, UP, WGPB, EGPB, SSB, PGPFB, EAGPF commands)
After a flash fuse write or erase operation (FLASHC LP, UP, WGPB, EGPB, SSB, PGPFB,
EAGPF commands), reading (data read or code fetch) in flash may fail. This may lead to an
exception or to other errors derived from this corrupted read access.
Fix/Workaround
Before the flash fuse write or erase operation, enable the flash high speed mode (FLASHC
HSEN command). The flash fuse write or erase operations (FLASHC LP, UP, WGPB,
EGPB, SSB, PGPFB, EAGPF commands) must be issued from RAM or through the EBI.
After these commands, read 3 times one flash page initialized to 00h. Disable the flash high
speed mode (FLASHC HSDIS command). It is then possible to safely read or code fetch the
flash.
1009
32072H–AVR32–10/2012
AT32UC3A3
1. Final version
1010
32072H–AVR32–10/2012
AT32UC3A3
1. Initial revision.
1011
32072H–AVR32–10/2012
AT32UC3A3
Table of Contents
1 Description ............................................................................................... 3
2 Overview ................................................................................................... 4
2.1 Block Diagram ...................................................................................................4
2.2 Configuration Summary .....................................................................................5
5 Memories ................................................................................................ 35
5.1 Embedded Memories ......................................................................................35
5.2 Physical Memory Map .....................................................................................35
5.3 Peripheral Address Map ..................................................................................36
5.4 CPU Local Bus Mapping .................................................................................38
1012
32072HAVR3210/2012
AT32UC3A3
1013
32072HAVR3210/2012
AT32UC3A3
1014
32072HAVR3210/2012
AT32UC3A3
1015
32072HAVR3210/2012
AT32UC3A3
1016
32072HAVR3210/2012
AT32UC3A3
26 ............................................................................................................... 621
26.1 Module Configuration ....................................................................................622
1017
32072HAVR3210/2012
AT32UC3A3
1018
32072HAVR3210/2012
AT32UC3A3
1019
32072HAVR3210/2012
AT32UC3A3
1020
32072HAVR3210/2012
Atmel Corporation Atmel Asia Limited Atmel Munich GmbH Atmel Japan
2325 Orchard Parkway Unit 1-5 & 16, 19/F Business Campus 16F, Shin Osaki Kangyo Bldg.
San Jose, CA 95131 BEA Tower, Millennium City 5 Parkring 4 1-6-4 Osaka Shinagawa-ku
USA 418 Kwun Tong Road D-85748 Garching b. Munich Tokyo 104-0032
Tel: (+1)(408) 441-0311 Kwun Tong, Kowloon GERMANY JAPAN
Fax: (+1)(408) 487-2600 HONG KONG Tel: (+49) 89-31970-0 Tel: (+81) 3-6417-0300
www.atmel.com Tel: (+852) 2245-6100 Fax: (+49) 89-3194621 Fax: (+81) 3-6417-0370
Fax: (+852) 2722-1369
Atmel, Atmel logo and combinations thereof AVR, Qtouch, and others are registered trademarks or trademarks of Atmel Corporation
or its subsidiaries. Other terms and product names may be trademarks of others.
Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to
any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL
TERMS AND CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY
EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS AND PROF-
ITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL
HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or com-
pleteness of the contents of this document and reserves the right to make changes to specifications and product descriptions at any time without notice.
Atmel does not make any commitment to update the information contained herein. Unless specifically provided otherwise, Atmel products are not suit-
able for, and shall not be used in, automotive applications. Atmel products are not intended, authorized, or warranted for use as components in applica-
tions intended to support or sustain life.
32072HAVR3210/2012