– Compact Single-cycle RISC Instruction Set Including DSP Instruction Set
– Read-Modify-Write Instructions and Atomic Bit Manipulation
– Performing 1.49 DMIPS / MHz
Up to 91 DMIPS Running at 66 MHz from Flash (1 Wait-State)
Up to 49 DMIPS Running at 33MHz from Flash (0 Wait-State)
– Memory Protection Unit
• Multi-hierarchy Bus System
– High-Performance Data Transfers on Separate Buses for Increased Performance
– 15 Peripheral DMA Channels Improves Speed for Peripheral Communication
• Internal High-Speed Flash
– 512K Bytes, 256K Bytes, 128K Bytes Versions
– Single Cycle Access up to 33 MHz
– Prefetch Buffer Optimizing Instruction Execution at Maximum Speed
– 4ms Page Programming Time and 8ms Full-Chip Erase Time
– 100,000 Write Cycles, 15-year Data Retention Capability
– Flash Security Locks and User Defined Configuration Area
• Internal High-Speed SRAM, Single-Cycle Access at Full Speed
• External Memory Interface on AT32UC3A0 Derivatives
– SDRAM / SRAM Compatible Memory Bus (16-bit Data and 24-bit Address Buses)
• Interrupt Controller
– Autovectored Low Latency Interrupt Service with Programmable Priority
• System Functions
– Power and Clock Manager Including Internal RC Clock and One 32KHz Oscillator
– Two Multipurpose Oscillators and Two Phase-Lock-Loop (PLL) allowing
Independant CPU Frequency from USB Frequency
– Watchdog Timer, Real-Time Clock Timer
• Universal Serial Bus (USB)
– Device 2.0 Full Speed and On-The-Go (OTG) Low Speed and Full Speed
– Flexible End-Point Configuration and Management with Dedicated DMA Channels
– On-chip Transceivers Including Pull-Ups
• Ethernet MAC 10/100 Mbps interface
– 802.3 Ethernet Media Access Controller
– Supports Media Independent Interface (MII) and Reduced MII (RMII)
• One Three-Channel 16-bit Timer/Counter (TC)
– Three External Clock Inputs, PWM, Capture and Various Counting Capabilities
• One 7-Channel 16-bit Pulse Width Modulation Controller (PWM)
• Four Universal Synchronous/Asynchronous Receiver/Transmitters (USART)
– Independant Baudrate Generator, Support for SPI, IrDA and ISO7816 interfaces
– Support for Hardware Handshaking, RS485 Interfaces and Modem Line
• Two Master/Slave Serial Peripheral Interfaces (SPI) with Chip Select Signals
• One Synchronous Serial Protocol Controller
– Supports I2S and Generic Frame-Based Protocols
• One Master/Slave Two-Wire Interface (TWI), 400kbit/s I2C-compatible
• One 8-channel 10-bit Analog-To-Digital Converter
• Single 3.3V Power Supply or Dual 1.8V-3.3V Power Supply
AT32UC3A
2
1.Description
32058K
AVR32-01/12
AT32UC3A
The AT32UC3A is a complete System-On-Chip microcontroller based on the AVR32 UC RISC
processor running at frequencies up to 66 MHz. 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 controller for supporting modern operating systems and real-time operating systems. Higher
computation capabilities are achievable using a rich set of DSP instructions.
The AT32UC3A incorporates on-chip Flash and SRAM memories for secure and fast access.
For applications requiring additional memory, an external memory interface is provided on
AT32UC3A0 derivatives.
The Peripheral Direct Memory Access controller (PDCA) enables data transfers between peripherals and memories without processor involvement. PDCA drastically reduces processing
overhead when transferring continuous and large data streams between modules within the
MCU.
The PowerManager 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 Timer/Counter includes three identical 16-bit timer/counter channels. Each channel can be
independently programmed to perform frequency measurement, event counting, interval measurement, pulse generation, delay timing and pulse width modulation.
The PWM modules provides seven independent channels with many configuration options
including polarity, edge alignment and waveform non overlap control. One PWM channel can
trigger ADC conversions for more accurate close loop control implementations.
The AT32UC3A also features many communication interfaces for communication intensive
applications. In addition to standard serial interfaces like UART, SPI or TWI, other interfaces like
flexible Synchronous Serial Controller, USB and Ethernet MAC are available.
The Synchronous Serial Controller provides easy access to serial communication protocols and
audio standards like I2S.
The Full-Speed USB 2.0 Device interface supports several USB Classes at the same time
thanks to the rich End-Point configuration. The On-The-GO (OTG) Host interface allows device
like a USB Flash disk or a USB printer to be directly connected to the processor.
The media-independent interface (MII) and reduced MII (RMII) 10/100 Ethernet MAC module
provides on-chip solutions for network-connected devices.
AT32UC3A integrates a class 2+ Nexus 2.0 On-Chip Debug (OCD) System, with non-intrusive
real-time trace, full-speed read/write memory access in addition to basic runtime control.
3
2.Configuration Summary
32058K
AVR32-01/12
The table below lists all AT32UC3A memory and package configurations:
DeviceFlashSRAMExt. Bus Interface
AT32UC3A0512512 Kbytes64 Kbytesyesyes144 pin LQFP
• PDCA: Peripheral Direct Memory Access Controller (PDC) version A
• USBB: USB On-The-GO Controller version B
4
4.Blockdiagram
UC CPU
NEXUS
CLASS 2+
OCD
INSTR
INTERFACE
DATA
INTERFACE
TIMER/COUNTER
INTERRUPT
CONTROLLER
REAL TIME
COUNTER
PERIPHERAL
DMA
CONTROLLER
512 KB
FLASH
HSB-PB
BRIDGE B
HSB-PB
BRIDGE A
MEMORY INTERFACE
S
MMM
M
M
S
S
S
S
S
M
EXTERNAL
INTERRUPT
CONTROLLER
HIGH SPEED
BUS MATRIX
FAST GPIO
GENERAL PURPOSE IOs
64 KB
SRAM
GENERAL PURPOSE IOs
PA
PB
PC
PX
A[2..0]
B[2..0]
CLK[2..0]
EXTINT[7..0]
KPS[7..0]
NMI_N
GCLK[3..0]
XIN32
XOUT32
XIN0
XOUT0
PA
PB
PC
PX
RESET_N
EXTERNAL BUS INTERFACE
(SDRAM & STATIC MEMORY
CONTROLLER)
CAS
RAS
SDA10
SDCK
SDCKE
SDCS0
SDWE
NCS[3..0]
NRD
NWAIT
NWE0
DATA[15..0]
USB
INTERFACE
DMA
ID
VBOF
VBUS
D-
D+
ETHERNET
MAC
DMA
32 KHz
OSC
115 kHz
RCOSC
OSC0
PLL0
PULSE WIDTH
MODULATION
CONTROLLER
SERIAL
PERIPHERAL
INTERFACE 0/1
TWO-WIRE
INTERFACE
PDCPDCPDC
MISO, MOSI
NPCS[3..1]
PWM[6..0]
SCL
SDA
USART1
PDC
RXD
TXD
CLK
RTS, CTS
DSR, DTR, DCD, RI
USART0
USART2
USART3
PDC
RXD
TXD
CLK
RTS, CTS
SYNCHRONOUS
SERIAL
CONTROLLER
PDC
TX_CLOCK, TX_FRAME_SYNC
RX_DATA
TX_DATA
RX_CLOCK, RX_FRAME_SYNC
ANALOG TO
DIGITAL
CONVERTER
PDC
AD[7..0]
ADVREF
WATCHDOG
TIMER
XIN1
XOUT1
OSC1
PLL1
SCK
JTAG
INTERFACE
MCKO
MDO[5..0]
MSEO[1..0]
EVTI_N
EVTO_N
TCK
TDO
TDI
TMS
POWER
MANAGER
RESET
CONTROLLER
ADDR[23..0]
SLEEP
CONTROLLER
CLOCK
CONTROLLER
CLOCK
GENERATOR
COL,
CRS,
RXD[3..0],
RX_CLK,
RX_DV,
RX_ER
MDC,
TXD[3..0],
TX_CLK,
TX_EN,
TX_ER,
SPEED
MDIO
FLASH
CONTROLLER
CONFIGURATION REGISTERS BUS
MEMORY PROTECTION UNIT
PB
PB
HSB
HS
B
NWE1
NWE3
PBA
PBB
NPCS0
LOCAL BUS
INTERFACE
AUDIO
BITSTREAM
DAC
PDC
DATA[1..0]
DATAN[1..0]
32058K
AVR32-01/12
Figure 4-1.Blockdiagram
AT32UC3A
5
4.1Processor and architecture
32058K
AVR32-01/12
4.1.1AVR32 UC CPU
• 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, half-word, word and double word memory access.
– Multiple interrupt priority levels.
• MPU allows for operating systems with memory protection.
4.1.2Debug and Test system
• IEEE1149.1 compliant JTAG and boundary scan
• Direct memory access and programming capabilities through JTAG interface
• Extensive On-Chip Debug features in compliance with IEEE-ISTO 5001-2003 (Nexus 2.0) Class 2+
– Low-cost NanoTrace supported.
• Auxiliary port for high-speed trace information
• Hardware support for 6 Program and 2 data breakpoints
• Unlimited number of software breakpoints supported
• Advanced Program, Data, Ownership, and Watchpoint trace supported
AT32UC3A
4.1.3Peripheral DMA Controller
• Transfers from/to peripheral to/from any memory space without intervention of the processor.
• Next Pointer Support, forbids strong real-time constraints on buffer management.
• Fifteen channels
– Two for each USART
– Two for each Serial Synchronous Controller
– Two for each Serial Peripheral Interface
– One for each ADC
– Two for each TWI Interface
4.1.4Bus system
• High Speed Bus (HSB) matrix with 6 Masters and 6 Slaves handled
– Handles Requests from the CPU Data Fetch, CPU Instruction Fetch, PDCA, USBB, Ethernet
Controller, CPU SAB, and to internal Flash, internal SRAM, Peripheral Bus A, Peripheral Bus
B, EBI.
– Round-Robin Arbitration (three modes supported: no default master, last
master, fixed default master)
– Burst Breaking with Slot Cycle Limit
– One Address Decoder Provided per Master
accessed default
6
AT32UC3A
32058K
AVR32-01/12
• Peripheral Bus A able to run on at divided bus speeds compared to the High Speed Bus
Figure 4-1 gives an overview of the bus system. All modules connected to the same bus use the
same clock, but the clock to each module can be individually shut off by the Power Manager.
The figure identifies the number of master and slave interfaces of each module connected to the
High Speed Bus, and which DMA controller is connected to which peripheral.
7
5.Signals Description
32058K
AVR32-01/12
The following table gives details on the signal name classified by peripheral
The signals are multiplexed with GPIO pins as described in ”Peripheral Multiplexing on I/O lines”
on page 45.
Table 5-1.Signal Description List
Signal NameFunctionType
Power
AT32UC3A
Active
LevelComments
VDDPLLPower supply for PLL
VDDCORECore Power Supply
VDDIOI/O Power Supply
VDDANAAnalog Power Supply
VDDINVoltage Regulator Input Supply
VDDOUTVoltage Regulator Output
GNDANAAnalog GroundGround
GNDGroundGround
Clocks, Oscillators, and PLL’s
XIN0, XIN1, XIN32Crystal 0, 1, 32 InputAnalog
XOUT0, XOUT1,
XOUT32
Crystal 0, 1, 32 OutputAnalog
Power
Input
Power
Input
Power
Input
Power
Input
Power
Input
Power
Output
1.65V to 1.95 V
1.65V to 1.95 V
3.0V to 3.6V
3.0V to 3.6V
3.0V to 3.6V
1.65V to 1.95 V
JTAG
TCKTest ClockInput
TDITest Data InInput
TDOTest Data OutOutput
TMSTest Mode SelectInput
Auxiliary Port - AUX
MCKOTrace Data Output ClockOutput
MDO0 - MDO5Trace Data OutputOutput
8
Table 5-1.Signal Description List
32058K
AVR32-01/12
Active
Signal NameFunctionType
MSEO0 - MSEO1Trace Frame ControlOutput
EVTI_NEvent InOutputLow
EVTO_NEvent OutOutputLow
Power Manager - PM
GCLK0 - GCLK3Generic Clock PinsOutput
RESET_NReset PinInputLow
Real Time Counter - RTC
RTC_CLOCKRTC clockOutput
Watchdog Timer - WDT
WDTEXTExternal Watchdog PinOutput
LevelComments
AT32UC3A
External Interrupt Controller - EIC
EXTINT0 - EXTINT7External Interrupt PinsInput
KPS0 - KPS7Keypad Scan PinsOutput
NMI_NNon-Maskable Interrupt PinInputLow
Ethernet MAC - MACB
COLCollision DetectInput
CRSCarrier Sense and Data ValidInput
MDCManagement Data ClockOutput
MDIOManagement Data Input/OutputI/O
RXD0 - RXD3Receive DataInput
RX_CLKReceive ClockInput
RX_DVReceive Data ValidInput
RX_ERReceive Coding ErrorInput
SPEEDSpeed
TXD0 - TXD3Transmit DataOutput
TX_CLKTransmit Clock or Reference ClockOutput
TX_ENTransmit EnableOutput
TX_ERTransmit Coding ErrorOutput
9
Table 5-1.Signal Description List
32058K
AVR32-01/12
Active
Signal NameFunctionType
External Bus Interface - HEBI
ADDR0 - ADDR23Address BusOutput
CASColumn SignalOutputLow
DATA0 - DATA15Data BusI/O
NCS0 - NCS3Chip SelectOutputLow
NRDRead SignalOutputLow
NWAITExternal Wait SignalInputLow
NWE0Write Enable 0OutputLow
NWE1Write Enable 1OutputLow
NWE3Write Enable 3OutputLow
LevelComments
AT32UC3A
RASRow SignalOutputLow
SDA10SDRAM Address 10 LineOutput
SDCKSDRAM ClockOutput
SDCKESDRAM Clock EnableOutput
SDCS0SDRAM Chip SelectOutputLow
SDWESDRAM Write EnableOutputLow
General Purpose Input/Output 2 - GPIOA, GPIOB, GPIOC
USB_VBOFUSB VBUS On/off: bus power control portoutput
Audio Bitstream DAC (ABDAC)
DATA0-DATA1D/A Data outOutpu
DATAN0-DATAN1D/A Data inverted outOutpu
Analog
input
Analog
input
Analog
Input
2.6 to 3.6V
12
6.Power Considerations
3.3V
VDDANA
VDDIO
VDDIN
VDDCORE
VDDOUT
VDDPLL
ADVREF
3.3V
1.8V
VDDANA
VDDIO
VDDIN
VDDCORE
VDDOUT
VDDPLL
ADVREF
Single Power Supply
Dual Power Supply
1.8V
Regulator
1.8V
Regulator
32058K
AVR32-01/12
6.1Power Supplies
The AT32UC3A has several types of power supply pins:
• VDDIO: Powers I/O lines. Voltage is 3.3V nominal.
• VDDANA: Powers the ADC Voltage is 3.3V nominal.
• VDDIN: Input voltage for the voltage regulator. Voltage is 3.3V nominal.
• VDDCORE: Powers the core, memories, and peripherals. Voltage is 1.8V nominal.
• VDDPLL: Powers the PLL. Voltage is 1.8V nominal.
The ground pins GND are common to VDDCORE, VDDIO, VDDPLL. The ground pin for
VDDANA is GNDANA.
Refer to ”Power Consumption” on page 767 for power consumption on the various supply pins.
AT32UC3A
13
6.2Voltage Regulator
3.3V
1.8V
VDDIN
VDDOUT
1.8V
Regulator
C
IN1
C
OUT1
C
OUT2
C
IN2
VDDIN
VDDOUT
32058K
AVR32-01/12
6.2.1Single Power Supply
The AT32UC3A embeds a voltage regulator that converts from 3.3V to 1.8V. The regulator takes
its input voltage from VDDIN, and supplies the output voltage on VDDOUT. VDDOUT should be
externally connected to the 1.8V domains.
Adequate input supply decoupling is mandatory for VDDIN in order to improve startup stability
and reduce source voltage drop. Two input decoupling capacitors must be placed close to the
chip.
Adequate output supply decoupling is mandatory for VDDOUT to reduce ripple and avoid oscillations. The best way to achieve this is to use two capacitors in parallel between VDDOUT and
GND as close to the chip as possible
AT32UC3A
Refer to Section 38.3 on page 765 for decoupling capacitors values and regulator characteristics
6.2.2Dual Power Supply
In case of dual power supply, VDDIN and VDDOUT should be connected to ground to prevent
from leakage current.
14
6.3Analog-to-Digital Converter (A.D.C) reference.
ADVREF
CC
VREF1VREF2
3.3V
32058K
AVR32-01/12
The ADC reference (ADVREF) must be provided from an external source. Two decoupling
capacitors must be used to insure proper decoupling.
Refer to Section 38.4 on page 765 for decoupling capacitors values and electrical
characteristics.
In case ADC is not used, the ADVREF pin should be connected to GND to avoid extra
consumption.
AT32UC3A
15
AT32UC3A
125
26
50
5175
76
100
32058K
AVR32-01/12
7.Package and Pinout
The device pins are multiplexed with peripheral functions as described in ”Peripheral Multiplexing on I/O lines” on page 45.
TMS, TDI and TCK have pull-up resistors. TDO is an output, driven at up to VDDIO, and has no
pull-up resistor.
8.2RESET_N pin
The RESET_N pin is a schmitt input and integrates a permanent pull-up resistor to VDDIO. As
the product integrates a power-on reset cell, the RESET_N pin can be left unconnected in case
no reset from the system needs to be applied to the product.
8.3TWI pins
When these pins are used for TWI, the pins are open-drain outputs with slew-rate limitation and
inputs with inputs with spike-filtering. When used as GPIO-pins or used for other peripherals, the
pins have the same characteristics as PIO pins.
8.4GPIO pins
All the I/O lines integrate a programmable pull-up resistor. Programming of this pull-up resistor is
performed independently for each I/O line through the GPIO Controllers. After reset, I/O lines
default as inputs with pull-up resistors disabled, except when indicated otherwise in the column
“Reset State” of the GPIO Controller multiplexing tables.
AT32UC3A
20
9.Processor and Architecture
32058K
AVR32-01/12
This chapter gives an overview of the AVR32UC CPU. AVR32UC is an implementation of the
AVR32 architecture. A summary of the programming model, instruction set and MPU is presented. For further details, see the AVR32 Architecture Manual and the AVR32UC TechnicalReference Manual.
9.1AVR32 Architecture
AVR32 is a new, high-performance 32-bit RISC microprocessor architecture, designed for costsensitive embedded applications, with particular emphasis on low power consumption and high
code density. In addition, the instruction set architecture has been tuned to allow a variety of
microarchitectures, enabling the AVR32 to be implemented as low-, mid- or high-performance
processors. AVR32 extends the AVR family into the world of 32- and 64-bit applications.
Through a quantitative approach, a large set of industry recognized benchmarks has been compiled and analyzed to achieve the best code density in its class. In addition to lowering the
memory requirements, a compact code size also contributes to the core’s low power characteristics. The processor supports byte and half-word data types without penalty in code size and
performance.
Memory load and store operations are provided for byte, half-word, word and double word data
with automatic sign- or zero extension of half-word and byte data. The C-compiler is closely
linked to the architecture and is able to exploit code optimization features, both for size and
speed.
AT32UC3A
In order to reduce code size to a minimum, some instructions have multiple addressing modes.
As an example, instructions with immediates often have a compact format with a smaller immediate, and an extended format with a larger immediate. In this way, the compiler is able to use
the format giving the smallest code size.
Another feature of the instruction set is that frequently used instructions, like add, have a compact format with two operands as well as an extended format with three operands. The larger
format increases performance, allowing an addition and a data move in the same instruction in a
single cycle. Load and store instructions have several different formats in order to reduce code
size and speed up execution.
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.
9.2The AVR32UC CPU
The AVR32 UC CPU targets low- and medium-performance applications, and provides an
advanced OCD system, no caches, and a Memory Protection Unit (MPU). Java acceleration
hardware is not implemented.
AVR32 UC provides three memory interfaces, one High Speed Bus master for instruction fetch,
one High Speed Bus master for data access, and one High Speed Bus slave interface allowing
other bus masters to access data RAMs internal to the CPU. Keeping data RAMs internal to the
CPU allows fast access to the RAMs, reduces latency and guarantees deterministic timing. Also,
power consumption is reduced by not needing a full High Speed Bus access for memory
accesses. A dedicated data RAM interface is provided for communicating with the internal data
RAMs.
21
AT32UC3A
AVR32UC CPU pipeline
Instruction memory controller
High
Speed
Bus
master
MPU
High Speed Bus
High Speed Bus
OCD
system
OCD interface
Interrupt controller interface
High
Speed
Bus slave
High Speed Bus
Data RAM interface
High Speed Bus master
Power/
Reset
control
Reset interface
CPU Local
Bus
master
CPU Local Bus
Data memory controller
32058K
AVR32-01/12
A local bus interface is provided for connecting the CPU to device-specific high-speed systems,
such as floating-point units and fast GPIO ports. This local bus has to be enabled by writing the
LOCEN bit in the CPUCR system register. The local bus is able to transfer data between the
CPU and the local bus slave in a single clock cycle. The local bus has a dedicated memory
range allocated to it, and data transfers are performed using regular load and store instructions.
Details on which devices that are mapped into the local bus space is given in the device-specific
“Peripherals” chapter of this data sheet.
Figure 9-1 on page 22 displays the contents of AVR32UC.
Figure 9-1.Overview of the AVR32UC CPU
9.2.1Pipeline Overview
AVR32 UC is a pipelined processor with three pipeline stages. There are three pipeline stages,
Instruction Fetch (IF), Instruction Decode (ID) and Instruction Execute (EX). The EX stage is
split into three parallel subsections, one arithmetic/logic (ALU) section, one multiply (MUL) section and one load/store (LS) section.
Instructions are issued and complete in order. Certain operations require several clock cycles to
complete, and in this case, the instruction resides in the ID and EX stages for the required number of clock cycles. Since there is only three pipeline stages, no internal data forwarding is
required, and no data dependencies can arise in the pipeline.
Figure 9-2 on page 23 shows an overview of the AVR32 UC pipeline stages.
22
Figure 9-2.The AVR32UC Pipeline
IFIDALU
MUL
Regfile
write
Prefetch unitDecode unit
ALU unit
Multiply unit
Load-store
unit
LS
Regfile
Read
32058K
AVR32-01/12
9.2.2AVR32A Microarchitecture Compliance
AVR32UC implements an AVR32A microarchitecture. The AVR32A microarchitecture is targeted at cost-sensitive, lower-end applications like smaller microcontrollers. This
microarchitecture does not provide dedicated hardware registers for shadowing of register file
registers in interrupt contexts. Additionally, it does not provide hardware registers for the return
address registers and return status registers. Instead, all this information is stored on the system
stack. This saves chip area at the expense of slower interrupt handling.
AT32UC3A
Upon interrupt initiation, registers R8-R12 are automatically pushed to the system stack. These
registers are pushed regardless of the priority level of the pending interrupt. The return address
and status register are also automatically pushed to stack. The interrupt handler can therefore
use R8-R12 freely. Upon interrupt completion, the old R8-R12 registers and status register are
restored, and execution continues at the return address stored popped from stack.
The stack is also used to store the status register and return address for exceptions and scall.
Executing the rete or rets instruction at the completion of an exception or system call will pop
this status register and continue execution at the popped return address.
9.2.3Java Support
AVR32UC does not provide Java hardware acceleration.
9.2.4Memory protection
The MPU allows the user to check all memory accesses for privilege violations. If an access is
attempted to an illegal memory address, the access is aborted and an exception is taken. The
MPU in AVR32UC is specified in the AVR32UC Technical Reference manual.
9.2.5Unaligned reference handling
AVR32UC does not support unaligned accesses, except for doubleword accesses. AVR32UC is
able to perform word-aligned st.d and ld.d. Any other unaligned memory access will cause an
address exception. Doubleword-sized accesses with word-aligned pointers will automatically be
performed as two word-sized accesses.
23
The following table shows the instructions with support for unaligned addresses. All other
32058K
AVR32-01/12
instructions require aligned addresses.
Table 9-1.Instructions with unaligned reference support
InstructionSupported alignment
ld.dWord
st.dWord
9.2.6Unimplemented instructions
The following instructions are unimplemented in AVR32UC, and will cause an Unimplemented
Instruction Exception if executed:
• All SIMD instructions
• All coprocessor instructions
• retj, incjosp, popjc, pushjc
• tlbr, tlbs, tlbw
• cache
9.2.7CPU and Architecture revision
Two major revisions of the AVR32UC CPU currently exist. The device described in this
datasheet uses CPU revision 2.
AT32UC3A
The Architecture Revision field in the CONFIG0 system register identifies which architecture
revision is implemented in a specific device.
AVR32UC CPU revision 2 is fully backward-compatible with revision 1, ie. code compiled for
revision 1 is binary-compatible with revision 2 CPUs.
24
9.3Programming Model
Application
Bit 0
Supe rv isor
Bit 31
PC
SR
INT0PC
FINTPC
INT1PC
SMPC
R7
R5
R6
R4
R3
R1
R2
R0
Bit 0Bit 31
PC
SR
R12
INT0PC
FINTPC
INT1PC
SMPC
R7
R5
R6
R4
R11
R9
R10
R8
R3
R1
R2
R0
INT0
SP_APPSP_SYS
R12
R11
R9
R10
R8
Exce ptionNMIINT1INT2INT3
LRLR
Bit 0Bit 31
PC
SR
R12
INT0PC
FINTPC
INT1PC
SMPC
R7
R5
R6
R4
R11
R9
R10
R8
R3
R1
R2
R0
SP_SYS
LR
Bit 0Bit 31
PC
SR
R12
INT0PC
FINTPC
INT1PC
SMPC
R7
R5
R6
R4
R11
R9
R10
R8
R3
R1
R2
R0
SP_SYS
LR
Bit 0Bit 31
PC
SR
R12
INT0PC
FINTPC
INT1PC
SMPC
R7
R5
R6
R4
R11
R9
R10
R8
R3
R1
R2
R0
SP_SYS
LR
Bit 0Bit 31
PC
SR
R12
INT0PC
FINTPC
INT1PC
SMPC
R7
R5
R6
R4
R11
R9
R10
R8
R3
R1
R2
R0
SP_SYS
LR
Bit 0Bit 31
PC
SR
R12
INT0PC
FINTPC
INT1PC
SMPC
R7
R5
R6
R4
R11
R9
R10
R8
R3
R1
R2
R0
SP_SYS
LR
Bit 0Bit 31
PC
SR
R12
INT0PC
FINTPC
INT1PC
SMPC
R7
R5
R6
R4
R11
R9
R10
R8
R3
R1
R2
R0
SP_SYS
LR
Bit 31
000
Bit 16
Interrupt Level 0 Mask
Interrupt Level 1 Mask
Interrupt Level 3 Mask
Interrupt Level 2 Mask
1000011000000
FEI0M GMM1-DM0EMI2MDM-M2
LC
1
-
Initial value
Bit name
I1M
Mode Bit 0
Mode Bit 1
-
Mode Bit 2
Reserved
Debug State
-I3M
Reserved
Exception Mask
Global Interrupt Mask
Debug State Mask
32058K
AVR32-01/12
9.3.1Register file configuration
The AVR32UC register file is shown below.
Figure 9-3.The AVR32UC Register File
AT32UC3A
9.3.2Status register configuration
The Status Register (SR) is split into two halfwords, one upper and one lower, see Figure 9-4 on
page 25 and Figure 9-5 on page 26. The lower word contains the C, Z, N, V and Q condition
code flags and the R, T and L bits, while the upper halfword contains information about the
mode and state the processor executes in. Refer to the AVR32 Architecture Manual for details.
Figure 9-4.The Status Register High Halfword
25
Figure 9-5.The Status Register Low Halfword
Bit 15Bit 0
Reserved
Carry
Zero
Sign
00000000000000
----TRBit name
Initial value
00
LQVNZC-
Overflow
Saturation
---
Lock
Register Remap Enable
Scratch
32058K
AVR32-01/12
9.3.3Processor States
9.3.3.1Normal RISC State
The AVR32 processor supports several different execution contexts as shown in Table 9-2 on
page 26.
Table 9-2.Overview of execution modes, their priorities and privilege levels.
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 privileged and unprivileged resources. After a reset, the processor will be in supervisor mode.
9.3.3.2Debug State
The AVR32 can be set in a debug state, which allows implementation of software monitor routines that can read out and alter system information for use during application development. This
implies that all system and application registers, including the status registers and program
counters, are accessible in debug state. The privileged instructions are also available.
26
All interrupt levels are by default disabled when debug state is entered, but they can individually
32058K
AVR32-01/12
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.
9.3.4System registers
The system registers are placed outside of the virtual memory space, and are only accessible
using the privileged mfsr and mtsr instructions. The table below lists the system registers specified in the AVR32 architecture, some of which are unused in AVR32UC. The programmer is
responsible for maintaining correct sequencing of any instructions following a mtsr instruction.
For detail on the system registers, refer to the AVR32UC Technical Reference Manual.
Table 9-3.System Registers
AT32UC3A
Reg #AddressNameFunction
00SRStatus Register
14EVBAException Vector Base Address
28ACBAApplication Call Base Address
312CPUCRCPU Control Register
416ECRException Cause Register
520RSR_SUPUnused in AVR32UC
624RSR_INT0Unused in AVR32UC
728RSR_INT1Unused in AVR32UC
832RSR_INT2Unused in AVR32UC
936RSR_INT3Unused in AVR32UC
1040RSR_EXUnused in AVR32UC
1144RSR_NMIUnused in AVR32UC
1248RSR_DBGReturn Status Register for Debug Mode
1352RAR_SUPUnused in AVR32UC
1456RAR_INT0Unused in AVR32UC
1560RAR_INT1Unused in AVR32UC
1664RAR_INT2Unused in AVR32UC
1768RAR_INT3Unused in AVR32UC
1872RAR_EXUnused in AVR32UC
1976RAR_NMIUnused in AVR32UC
2080RAR_DBGReturn Address Register for Debug Mode
2184JECRUnused in AVR32UC
2288JOSPUnused in AVR32UC
2392JAVA_LV0Unused in AVR32UC
2496JAVA_LV1Unused in AVR32UC
25100JAVA_LV2Unused in AVR32UC
27
Table 9-3.System Registers (Continued)
32058K
AVR32-01/12
Reg #AddressNameFunction
26104JAVA_LV3Unused in AVR32UC
27108JAVA_LV4Unused in AVR32UC
28112JAVA_LV5Unused in AVR32UC
29116JAVA_LV6Unused in AVR32UC
30120JAVA_LV7Unused in AVR32UC
31124JTBAUnused in AVR32UC
32128JBCRUnused in AVR32UC
33-63132-252ReservedReserved for future use
64256CONFIG0Configuration register 0
65260CONFIG1Configuration register 1
66264COUNTCycle Counter register
67268COMPARECompare register
68272TLBEHIUnused in AVR32UC
AT32UC3A
69276TLBELOUnused in AVR32UC
70280PTBRUnused in AVR32UC
71284TLBEARUnused in AVR32UC
72288MMUCRUnused in AVR32UC
73292TLBARLOUnused in AVR32UC
74296TLBARHIUnused in AVR32UC
75300PCCNTUnused in AVR32UC
76304PCNT0Unused in AVR32UC
77308PCNT1Unused in AVR32UC
78312PCCRUnused in AVR32UC
79316BEARBus Error Address Register
80320MPUAR0MPU Address Register region 0
81324MPUAR1MPU Address Register region 1
82328MPUAR2MPU Address Register region 2
83332MPUAR3MPU Address Register region 3
84336MPUAR4MPU Address Register region 4
85340MPUAR5MPU Address Register region 5
86344MPUAR6MPU Address Register region 6
87348MPUAR7MPU Address Register region 7
88352MPUPSR0MPU Privilege Select Register region 0
89356MPUPSR1MPU Privilege Select Register region 1
90360MPUPSR2MPU Privilege Select Register region 2
91364MPUPSR3MPU Privilege Select Register region 3
28
Table 9-3.System Registers (Continued)
32058K
AVR32-01/12
Reg #AddressNameFunction
92368MPUPSR4MPU Privilege Select Register region 4
93372MPUPSR5MPU Privilege Select Register region 5
94376MPUPSR6MPU Privilege Select Register region 6
95380MPUPSR7MPU Privilege Select Register region 7
96384MPUCRAUnused in this version of AVR32UC
97388MPUCRBUnused in this version of AVR32UC
98392MPUBRAUnused in this version of AVR32UC
99396MPUBRBUnused in this version of AVR32UC
100400MPUAPRAMPU Access Permission Register A
101404MPUAPRBMPU Access Permission Register B
102408MPUCRMPU Control Register
103-191412-764ReservedReserved for future use
192-255768-1020IMPLIMPLEMENTATION DEFINED
AT32UC3A
9.4Exceptions and Interrupts
AVR32UC incorporates a powerful exception handling scheme. The different exception sources,
like Illegal Op-code and external interrupt requests, have different priority levels, ensuring a welldefined behavior when multiple exceptions are received simultaneously. Additionally, pending
exceptions of a higher priority class may preempt handling of ongoing exceptions of a lower priority class.
When an event occurs, the execution of the instruction stream is halted, and execution control is
passed to an event handler at an address specified in Table 9-4 on page 32. Most of the handlers are placed sequentially in the code space starting at the address specified by EVBA, with
four bytes between each handler. This gives ample space for a jump instruction to be placed
there, jumping to the event routine itself. A few critical handlers have larger spacing between
them, allowing the entire event routine to be placed directly at the address specified by the
EVBA-relative offset generated by hardware. All external interrupt sources have autovectored
interrupt service routine (ISR) addresses. This allows the interrupt controller to directly specify
the ISR address as an address relative to EVBA. The autovector offset has 14 address bits, giving an offset of maximum 16384 bytes. The target address of the event handler is calculated as
(EVBA | event_handler_offset), not (EVBA + event_handler_offset), so EVBA and exception
code segments must be set up appropriately. The same mechanisms are used to service all different types of events, including external interrupt requests, yielding a uniform event handling
scheme.
An interrupt controller does the priority handling of the external interrupts and provides the
autovector offset to the CPU.
9.4.1System stack issues
Event handling in AVR32 UC uses the system stack pointed to by the system stack pointer,
SP_SYS, for pushing and popping R8-R12, LR, status register and return address. Since event
code may be timing-critical, SP_SYS should point to memory addresses in the IRAM section,
since the timing of accesses to this memory section is both fast and deterministic.
29
The user must also make sure that the system stack is large enough so that any event is able to
32058K
AVR32-01/12
push the required registers to stack. If the system stack is full, and an event occurs, the system
will enter an UNDEFINED state.
9.4.2Exceptions and interrupt requests
When an event other than scall or debug request is received by the core, the following actions
are performed atomically:
1. The pending event will not be accepted if it is masked. The I3M, I2M, I1M, I0M, EM and
GM bits in the Status Register are used to mask different events. Not all events can be
masked. A few critical events (NMI, Unrecoverable Exception, TLB Multiple Hit and Bus
Error) can not be masked. When an event is accepted, hardware automatically sets the
mask bits corresponding to all sources with equal or lower priority. This inhibits acceptance of other events of the same or lower priority, except for the critical events listed
above. Software may choose to clear some or all of these bits after saving the necessary state if other priority schemes are desired. It is the event source’s responsability to
ensure that their events are left pending until accepted by the CPU.
2. When a request is accepted, the Status Register and Program Counter of the current
context is stored to the system stack. If the event is an INT0, INT1, INT2 or INT3, registers R8-R12 and LR are also automatically stored to stack. Storing the Status Register
ensures that the core is returned to the previous execution mode when the current
event handling is completed. When exceptions occur, both the EM and GM bits are set,
and the application may manually enable nested exceptions if desired by clearing the
appropriate bit. Each exception handler has a dedicated handler address, and this
address uniquely identifies the exception source.
3. The Mode bits are set to reflect the priority of the accepted event, and the correct register file bank is selected. The address of the event handler, as shown in Table 9-4, is
loaded into the Program Counter.
The execution of the event handler routine then continues from the effective address calculated.
AT32UC3A
9.4.3Supervisor calls
9.4.4Debug requests
The rete instruction signals the end of the event. When encountered, the Return Status Register
and Return Address Register are popped from the system stack and restored to the Status Register and Program Counter. If the rete instruction returns from INT0, INT1, INT2 or INT3,
registers R8-R12 and LR are also popped from the system stack. The restored Status Register
contains information allowing the core to resume operation in the previous execution mode. This
concludes the event handling.
The AVR32 instruction set provides a supervisor mode call instruction. The scall instruction is
designed so that privileged routines can be called from any context. This facilitates sharing of
code between different execution modes. The scall mechanism is designed so that a minimal
execution cycle overhead is experienced when performing supervisor routine calls from timecritical event handlers.
The scall instruction behaves differently depending on which mode it is called from. The behaviour is detailed in the instruction set reference. In order to allow the scall routine to return to the
correct context, a return from supervisor call instruction, rets, is implemented. In the AVR32UC
CPU, scall and rets uses the system stack to store the return address and the status register.
The AVR32 architecture defines a dedicated debug mode. When a debug request is received by
the core, Debug mode is entered. Entry into Debug mode can be masked by the DM bit in the
30
Loading...
+ 796 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.