– 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
status register. Upon entry into Debug mode, hardware sets the SR[D] bit and jumps to the
32058K
AVR32-01/12
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.
9.4.5Entry points for events
Several different event handler entry points exists. In AVR32 UC, the reset address is
0x8000_0000. This places the reset address in the boot flash memory area.
TLB miss exceptions and scall have a dedicated space relative to EVBA where their event handler can be placed. This speeds up execution by removing the need for a jump instruction placed
at the program address jumped to by the event hardware. All other exceptions have a dedicated
event routine entry point located relative to EVBA. The handler routine address identifies the
exception source directly.
AVR32UC uses the ITLB and DTLB protection exceptions to signal a MPU protection violation.
ITLB and DTLB miss exceptions are used to signal that an access address did not map to any of
the entries in the MPU. TLB multiple hit exception indicates that an access address did map to
multiple TLB entries, signalling an error.
AT32UC3A
All external interrupt requests have entry points located at an offset relative to EVBA. This
autovector offset is specified by an external Interrupt Controller. The programmer must make
sure that none of the autovector offsets interfere with the placement of other code. The autovector offset has 14 address bits, giving an offset of maximum 16384 bytes.
Special considerations should be made when loading EVBA with a pointer. Due to security considerations, the event handlers should be located in non-writeable flash memory, or optionally in
a privileged memory protection region if an MPU is present.
If several events occur on the same instruction, they are handled in a prioritized way. The priority
ordering is presented in Table 9-4. If events occur on several instructions at different locations in
the pipeline, the events on the oldest instruction are always handled before any events on any
younger instruction, even if the younger instruction has events of higher priority than the oldest
instruction. An instruction B is younger than an instruction A if it was sent down the pipeline later
than A.
The addresses and priority of simultaneous events are shown in Table 9-4. Some of the exceptions are unused in AVR32 UC since it has no MMU, coprocessor interface or floating-point unit.
31
AT32UC3A
32058K
AVR32-01/12
Table 9-4.Priority and handler addresses for events
The system bus is implemented as a bus matrix. All system bus addresses are fixed, and they
are never remapped in any way, not even in boot. Note that AVR32 UC CPU uses unsegmented
translation, as described in the AVR32 Architecture Manual. The 32-bit physical address space
is mapped as follows:
Accesses to unused areas returns an error result to the master requesting such an access.
The bus matrix has the several masters and slaves. Each master has its own bus and its own
decoder, thus allowing a different memory mapping per master. The master number in the table
below can be used to index the HMATRIX control registers. For example, MCFG0 is associated
with the CPU Data master interface.
AT32UC3A
Fuse bits
(FLASH_F)
Table 10-3.High Speed Bus masters
Master 0CPU Data
Master 1CPU Instruction
Master 2CPU SAB
Master 3PDCA
Master 4MACB DMA
Master 5USBB DMA
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, SCFG3 is
associated with the Internal SRAM Slave Interface.
The flash block contains a number of general purpose fuses. Some of these fuses have defined
meanings outside the flash controller and are described in this section.
The general purpose fuses are erase by a JTAG chip erase.
11.1Flash General Purpose Fuse Register (FGPFRLO)
Table 11-1.FGPFR Register Description
31 30292827262524
GPF31GPF30GPF29BODENBODHYSTBODLEVEL[5:4]
2322212019181716
BODLEVEL[3:0]BOOTPROTEPFL
15141312111098
LOCK[15:8]
76543210
LOCK[7:0]
BODEN: Brown Out Detector Enable
Table 11-2.BODEN Field Description
BODENDescription
0x0BOD disabled
0x1BOD enabled, BOD reset enabled
0x2BOD enabled, BOD reset disabled
0x3BOD disabled
BODHYST: Brown Out Detector Hysteresis
Table 11-3.BODEN Field Description
BODHYST
0b
1bhe Brown out detector hysteresis is enabled.
Description
The Brown out detector hysteresis is disabled
BODLEVEL: Brown Out Detector Trigger Level
This controls the voltage trigger level for the Brown out detector. Refer to sectionTable 38-6 on
page 765 for values description. If the BODLEVEL is set higher than VDDCORE and enabled by
fuses, the part will be in constant reset. To recover from this situation, apply an external voltage
on VDDCORE that is higher than the BOD level and disable the BOD.
36
LOCK, EPFL, BOOTPROT
32058K
AVR32-01/12
These are Flash controller fuses and are described in the FLASHC section.
11.2Default Fuse Value
The devices are shipped with the FGPFRLO register value: 0xFC07FFFF:
• GPF31 fuse set to 1b. This fuse is used by the pre-programmed USB bootloader.
• GPF30 fuse set to 1b. This fuse is used by the pre-programmed USB bootloader.
• GPF29 fuse set to 1b. This fuse is used by the pre-programmed USB bootloader.
• BODEN fuses set to 11b. BOD is disabled.
• BODHYST fuse set to 1b. The BOD hysteresis is enabled.
• BODLEVEL fuses set to 000000b. This is the minimum voltage trigger level for BOD.
• BOOTPROT fuses set to 011b. The bootloader protected size is 8 Ko.
• EPFL fuse set to 1b. External privileged fetch is not locked.
• LOCK fuses set to 1111111111111111b. No region locked.
See also the AT32UC3A Bootloader user guide document.
AT32UC3A
After the JTAG chip erase command, the FGPFRLO register value is 0xFFFFFFFF.
Some of the registers in the GPIO module are mapped onto the CPU local bus, in addition to
being mapped on the Peripheral Bus. These registers can therefore be reached both by
accesses on the Peripheral Bus, and by accesses on the local bus.
Mapping these registers on the local bus allows cycle-deterministic toggling of GPIO pins since
the CPU and GPIO are the only modules connected to this bus. Also, since the local bus runs at
CPU speed, one write or read operation can be performed per clock cycle to the local busmapped GPIO registers.
39
AT32UC3A
32058K
AVR32-01/12
The following GPIO registers are mapped on the local bus:
Output Value Register (OVR)WRITE0x4000_0350Write-only
Pin Value Register (PVR)-0x4000_0360Read-only
12.3Interrupt Request Signal Map
The various modules may output Interrupt request signals. These signals are routed to the Interrupt Controller (INTC), described in a later chapter. The Interrupt Controller supports up to 64
groups of interrupt requests. Each group can have up to 32 interrupt request signals. All interrupt
signals in the same group share the same autovector address and priority level. Refer to the
documentation for the individual submodules for a description of the semantics of the different
interrupt requests.
Each USART can be connected to an internally divided clock:
Table 12-5.USART clock connections
USARTSourceNameConnection
0InternalCLK_DIVPBA clock / 8
1
2
3
43
12.4.3SPIs
32058K
AVR32-01/12
Each SPI can be connected to an internally divided clock:
Table 12-6.SPI clock connections
SPISourceNameConnection
0InternalCLK_DIVPBA clock or
1
12.5Nexus OCD AUX port connections
If the OCD trace system is enabled, the trace system will take control over a number of pins, irrespectively of the PIO configuration. Two different OCD trace pin mappings are possible,
depending on the configuration of the OCD AXS register. For details, see the AVR32 UC Technical Reference Manual.
The PDC and the peripheral modules communicate through a set of handshake signals. The following table defines the valid settings for the Peripheral Identifier (PID) in the PDC Peripheral
Select Register (PSR).
Each GPIO line can be assigned to one of 3 peripheral functions; A, B or C. The following table
define how the I/O lines on the peripherals A, B and C are multiplexed by the GPIO.
Table 12-9.GPIO Controller Function Multiplexing
TQFP100VQFP144PINGPIO PinFunction AFunction BFunction C
The oscillators are not mapped to the normal A,B or C functions and their muxings are controlled
by registers in the Power Manager (PM). Please refer to the power manager chapter for more
information about this.
The GPIO open drain feature (GPIO ODMER register (Open Drain Mode Enable Register)) is
not available for this device.
12.11 Peripheral overview
12.11.1External Bus Interface
• Optimized for Application Memory Space support
• Integrates Two External Memory Controllers:
– Static Memory Controller
– SDRAM Controller
• Optimized External Bus:
–16-bit Data Bus
– 24-bit Address Bus, Up to 16-Mbytes Addressable
– Optimized pin multiplexing to reduce latencies on External Memories
• 4 SRAM Chip Selects, 1SDRAM Chip Select:
– Static Memory Controller on NCS0
– SDRAM Controller or Static Memory Controller on NCS1
– Static Memory Controller on NCS2
– Static Memory Controller on NCS3
12.11.2Static Memory Controller
AT32UC3A
• 4 Chip Selects Available
• 64-Mbyte Address Space per Chip Select
• 8-, 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
12.11.3SDRAM Controller
• Numerous Configurations Supported
• Programming Facilities
• Energy-saving Capabilities
– 2K, 4K, 8K Row Address Memory Parts
– SDRAM with Two or Four Internal Banks
– SDRAM with 16-bit Data Path
– Word, Half-word, 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
– Self-refresh, Power-down and Deep Power Modes Supported
49
– Supports Mobile SDRAM Devices
32058K
AVR32-01/12
• Error Detection
– Refresh Error Interrupt
• SDRAM Power-up Initialization by Software
• CAS Latency of 1, 2, 3 Supported
• Auto Precharge Command Not Used
12.11.4USB Controller
• USB 2.0 Compliant, Full-/Low-Speed (FS/LS) and On-The-Go (OTG), 12 Mbit/s
• 7 Pipes/Endpoints
• 960 bytes 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 Transceivers Including Pull-Ups
12.11.5Serial Peripheral Interface
• 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
– 8- 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
• Very fast transfers supported
– Transfers with baud rates up to Peripheral Bus A (PBA) max frequency
– The chip select line may be left active to speed up transfers on the same device
12.11.6Two-wire Interface
AT32UC3A
• High speed up to 400kbit/s
• Compatibility with standard two-wire serial memory
• One, two or three bytes for slave address
• Sequential read/write operations
12.11.7USART
• Programmable Baud Rate Generator
• 5- to 9-bit full-duplex synchronous or asynchronous serial communications
– 1, 1.5 or 2 stop bits in Asynchronous Mode or 1 or 2 stop bits in Synchronous Mode
– Parity generation and error detection
– Framing error detection, overrun error detection
– MSB- or LSB-first
– Optional break generation and detection
– By 8 or by-16 over-sampling receiver frequency
– Hardware handshaking RTS-CTS
– Receiver time-out and transmitter timeguard
– Optional Multi-drop Mode with address generation and detection
50
– Optional Manchester Encoding
32058K
AVR32-01/12
• RS485 with driver control signal
• ISO7816, T = 0 or T = 1 Protocols for interfacing with smart cards
– NACK handling, error counter with repetition and iteration limit
• IrDA modulation and demodulation
– Communication at up to 115.2 Kbps
• Test Modes
– Remote Loopback, Local Loopback, Automatic Echo
• SPI Mode
– Master or Slave
– Serial Clock Programmable Phase and Polarity
– SPI Serial Clock (SCK) Frequency up to Internal Clock Frequency PBA/4
• Supports Connection of Two Peripheral DMA Controller Channels (PDC)
– Offers Buffer Transfer without Processor Intervention
12.11.8Serial Synchronous Controller
• Provides serial synchronous communication links used in audio and telecom applications (with
CODECs in Master or Slave Modes, I2S, TDM Buses, Magnetic Card Reader, etc.)
• Contains an independent receiver and transmitter and a common clock divider
• Offers a configurable frame sync and data length
• Receiver and transmitter can be programmed to start automatically or on detection of different
event on the frame sync signal
• Receiver and transmitter include a data signal, a clock signal and a frame synchronization signal
– Three external clock inputs
– Five internal clock inputs
– Two multi-purpose input/output signals
• Two global registers that act on all three TC Channels
12.11.10 Pulse Width Modulation Controller
• 7 channels, one 20-bit counter per channel
• Common clock generator, providing Thirteen Different Clocks
– A Modulo n counter providing eleven clocks
– Two independent Linear Dividers working on modulo n counter outputs
• Independent channel programming
– Independent Enable Disable Commands
– Independent Clock
– Independent Period and Duty Cycle, with Double Bufferization
– Programmable selection of the output waveform polarity
– Programmable center or left aligned output waveform
51
12.11.11 Ethernet 10/100 MAC
32058K
AVR32-01/12
• Compatibility with IEEE Standard 802.3
• 10 and 100 Mbits per second data throughput capability
• Full- and half-duplex operations
• MII or RMII interface to the physical layer
• Register Interface to address, data, status and control registers
• DMA Interface, operating as a master on the Memory Controller
• Interrupt generation to signal receive and transmit completion
• 28-byte transmit and 28-byte receive FIFOs
• Automatic pad and CRC generation on transmitted frames
• Address checking logic to recognize four 48-bit addresses
• Support promiscuous mode where all valid frames are copied to memory
• Support physical layer management through MDIO interface control of alarm and update
time/calendar data
12.11.12 Audio Bitstream DAC
• 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 Peripheral DMA Controller for background transfer without CPU intervention
AT32UC3A
52
13. Power Manager (PM)
32058K
AVR32-01/12
Rev: 2.0.0.1
13.1Features
• Controls integrated oscillators and PLLs
• Generates clocks and resets for digital logic
• Supports 2 crystal oscillators 450 kHz-16 MHz
• Supports 2 PLLs 80-240 MHz
• Supports 32 KHz 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), RC oscillator, and bandgap voltage reference through control
and calibration registers
13.2Description
AT32UC3A
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
32 KHz oscillator is used to generate the real-time counter clock for high accuracy real-time
measurements. 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 peripherals 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.
53
13.3Block Diagram
Sleep Controller
Oscillator and
PLL Control
PLL0
PLL1
Synchronous
Clock Generator
Generic Clock
Generator
Reset Controller
Oscillator 0
Oscillator 1
RC
Oscillator
Startup
Counter
Slow clock
Sleep
instruction
Power-On
Detector
Other reset
sources
resets
Generic clocks
Synchronous
clocks
CPU, HSB,
PBA, PBB
OSC/PLL
Control signals
RCOSC
32 KHz
Oscillator
32 KHz clock
for RTC
Interrupts
External Reset Pad
Calibration
Registers
Brown-Out
Detector
Voltage Regulator
fuses
32058K
AVR32-01/12
AT32UC3A
Figure 13-1. Power Manager block diagram
54
13.4Product Dependencies
32058K
AVR32-01/12
13.4.1I/O Lines
The PM provides a number of generic clock outputs, which can be connected to output pins,
multiplexed with GPIO lines. The programmer must first program the GPIO controller to assign
these pins to their peripheral function. If the I/O pins of the PM are not used by the application,
they can be used for other purposes by the GPIO controller.
13.4.2Interrupt
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.
13.4.3Clock implementation
In AT32UC3A, the HSB shares the source clock with the CPU. This means that writing to the
HSBDIV and HSBSEL bits in CKSEL has no effect. These bits will always read the same as
CPUDIV and CPUSEL.
13.5Functional Description
13.5.1Slow clock
AT32UC3A
The slow clock is generated from an internal RC oscillator which is always running, except in
Static mode. The slow clock can be used for the main clock in the device, as described in ”Syn-
chronous clocks” on page 58. The slow clock is also used for the Watchdog Timer and
measuring various delays in the Power Manager.
The RC oscillator has a 3 cycles startup time, and is always available when the CPU is running.
The RC oscillator operates at approximately 115 kHz, and can be calibrated to a narrow range
by the RCOSCCAL fuses. Software can also change RC oscillator calibration through the use of
the RCCR register. Please see the Electrical Characteristics section for details.
RC oscillator can also be used as the RTC clock when crystal accuracy is not required.
13.5.2Oscillator 0 and 1 operation
The two main oscillators are designed to be used with an external 450 kHz to 16 MHz crystal
and two biasing capacitors, as shown in Figure 13-2. Oscillator 0 can be used for the main clock
in the device, as described in ”Synchronous clocks” on page 58. Both oscillators can be used as
source for the generic clocks, as described in ”Generic clocks” on page 61.
The oscillators are disabled by default after reset. When the oscillators are disabled, the XIN and
XOUT pins can be used as general purpose I/Os. When the oscillators are configured to use an
external clock, the clock must be applied to the XIN pin while the XOUT pin can be used as a
general purpose I/O.
The oscillators can be enabled by writing to the OSCnEN bits in MCCTRL. Operation mode
(external clock or crystal) is chosen by writing to the MODE field in OSCCTRLn. Oscillators are
automatically switched off in certain sleep modes to reduce power consumption, as described in
Section 13.5.7 on page 60.
After a hard reset, or when waking up from a sleep mode that disabled the oscillators, the oscillators may need a certain amount of time to stabilize on the correct frequency. This start-up time
can be set in the OSCCTRLn register.
55
AT32UC3A
XIN
XOUT
C
2
C
1
32058K
AVR32-01/12
The PM masks the oscillator outputs during the start-up time, to ensure that no unstable clocks
propagate to the digital logic. The OSCnRDY bits in POSCSR are automatically set and cleared
according to the status of the oscillators. A zero to one transition on these bits can also be configured to generate an interrupt, as described in ”Interrupt Enable/Disable/Mask/Status/Clear” on
page 76.
Figure 13-2. Oscillator connections
13.5.332 KHz oscillator operation
The 32 KHz oscillator operates as described for Oscillator 0 and 1 above. The 32 KHz oscillator
is used as source clock for the Real-Time Counter.
The oscillator is disabled by default, but can be enabled by writing OSC32EN in OSCCTRL32.
The oscillator is an ultra-low power design and remains enabled in all sleep modes except Static
mode.
While the 32 KHz oscillator is disabled, the XIN32 and XOUT32 pins are available as general
purpose I/Os. When the oscillator is configured to work with an external clock (MODE field in
OSCCTRL32 register), the external clock must be connected to XIN32 while the XOUT32 pin
can be used as a general purpose I/O.
The startup time of the 32 KHz oscillator can be set in the OSCCTRL32, after which OSC32RDY
in POSCSR is set. An interrupt can be generated on a zero to one transition of OSC32RDY.
As a crystal oscillator usually requires a very long startup time (up to 1 second), the 32 KHz
oscillator will keep running across resets, except Power-On-Reset.
13.5.4PLL operation
The device contains two PLLs, PLL0 and PLL1. These are disabled by default, but can be
enabled to provide high frequency source clocks for synchronous or generic clocks. The PLLs
can take either Oscillator 0 or 1 as reference clock. The PLL output is divided by a multiplication
factor, and the PLL compares the resulting clock to the reference clock. The PLL will adjust its
output frequency until the two compared clocks are equal, thus locking the output frequency to a
multiple of the reference clock frequency.
The Voltage Controlled Oscillator inside the PLL can generate frequencies from 80 to 240 MHz.
To make the PLL output frequencies under 80 MHz the OTP[1] bitfield could be set. This will
56
AT32UC3A
Phase
Detector
Output
Divider
0
1
Osc0
clock
Osc1
clock
PLLOSC
PLLOPT
PLLMU L
Lock bit
Mask
PLL clock
In p ut
D ivider
PLLDIV
1/2
PLLOPT[1]
0
1
VC O
f
vco
f
PLL
Lock
Detector
32058K
AVR32-01/12
divide the output of the PLL by two and bring the clock in range of the max frequency of the
CPU.
When the PLL is switched on, or when changing the clock source or multiplication factor for the
PLL, the PLL is unlocked and the output frequency is undefined. The PLL clock for the digital
logic is automatically masked when the PLL is unlocked, to prevent connected digital logic from
receiving a too high frequency and thus become unstable.
Figure 13-3. PLL with control logic and filters
13.5.4.1Enabling the PLL
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 f
frequency f
If PLLOPT[1] field is set to 0:
If PLLOPT[1] field is set to 1:
The PLLn:PLLOPT field should be set to proper values according to the PLL operating frequency. 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 generated on a 0 to 1 transition of these bits.
:
PLL
f
= (PLLMUL+1)/(PLLDIV) • f
VCO
f
= 2*(PLLMUL+1) • f
VCO
= f
f
PLL
= f
f
PLL
VCO.
VCO
/ 2
.
OSC
if PLLDIV = 0.
OSC
if PLLDIV > 0.
and the PLL
VCO
57
13.5.5Synchronous clocks
Mask
Prescaler
Osc0 clock
PLL0 clock
MCSEL
0
1
CPUSEL
CPUDIV
Main clock
Sleep
Controller
CPUMASK
CPU clocks
HSB clocks
PBAclocks
PBB clocks
Sleep
instruction
Slow clock
32058K
AVR32-01/12
The slow clock (default), Oscillator 0, or PLL0 provide the source for the main clock, which is the
common root for the synchronous clocks for the CPU/HSB, PBA, and PBB modules. The main
clock is divided by an 8-bit prescaler, and each of these four synchronous clocks can run from
any tapping of this prescaler, or the undivided main clock, as long as f
nous clock source can be changed on-the fly, responding to varying load in the application. The
clock domains can be shut down in sleep mode, as described in ”Sleep modes” on page 60.
Additionally, the clocks for each module in the four domains can be individually masked, to avoid
power consumption in inactive modules.
AT32UC3A
CPU
f
. The synchro-
PBA,B,
Figure 13-4. Synchronous clock generation
13.5.5.1Selecting PLL or oscillator for the main clock
The common main clock can be connected to the slow clock, Oscillator 0, or PLL0. By default,
the main clock will be connected to the slow clock. The user can connect the main clock to Oscillator 0 or PLL0 by writing the MCSEL bitfield in the Main Clock Control Register (MCCTRL). This
must only be done after that unit has been enabled, otherwise a deadlock will occur. Care
should also be taken that the new frequency of the synchronous clocks does not exceed the
maximum frequency for each clock domain.
13.5.5.2Selecting synchronous clock division ratio
The main clock feeds an 8-bit prescaler, which can be used to generate the synchronous clocks.
By default, the synchronous clocks run on the undivided main clock. The user can select a pres-
58
caler division for the CPU clock by writing CKSEL:CPUDIV to 1 and CPUSEL to the prescaling
32058K
AVR32-01/12
value, resulting in a CPU clock frequency:
f
CPU
Similarly, the clock for the PBA, and PBB can be divided by writing their respective bitfields. To
ensure correct operation, frequencies must be selected so that f
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 bitfields. This way, it is possible to e.g. scale CPU and HSB speed according to the required
performance, while keeping the PBA and PBB frequency constant.
13.5.5.3Clock Ready flag
There is a slight delay from CKSEL is written and the new clock setting becomes effective. During this interval, the Clock Ready (CKRDY) flag in ISR will read as 0. If IER:CKRDY is written to
1, the Power Manager interrupt can be triggered when the new clock setting is effective. CKSEL
must not be re-written while CKRDY is 0, or the system may become unstable or hang.
13.5.6Peripheral clock masking
= f
main
(CPUSEL+1)
/ 2
CPU
AT32UC3A
f
. Also, frequencies
PBA,B
By default, the clock for all modules are enabled, regardless of which modules are actually being
used. It is possible to disable the clock for a module in the CPU, HSB, PBA, or PBB clock
domain by writing the corresponding bit in the Clock Mask register (CPU/HSB/PBA/PBB) to 0.
When a module is not clocked, it will cease operation, and its registers cannot be read or written.
The module can be re-enabled later by writing the corresponding mask bit to 1.
A module may be connected to several clock domains, in which case it will have several mask
bits.
Table 13-5 contains a list of implemented maskable clocks.
13.5.6.1Cautionary note
Note that clocks should only be switched off if it is certain that the module will not be used.
Switching off the clock for the internal RAM will cause a problem if the stack is mapped there.
Switching off the clock to the Power Manager (PM), which contains the mask registers, or the
corresponding PBx bridge, will make it impossible to write the mask registers again. In this case,
they can only be re-enabled by a system reset.
13.5.6.2Mask Ready flag
Due to synchronization in the clock generator, there is a slight delay from a mask register is written until the new mask setting goes into effect. When clearing mask bits, this delay can usually
be ignored. However, when setting mask bits, the registers in the corresponding module must
not be written until the clock has actually be re-enabled. The status flag MSKRDY in ISR provides the required mask status information. When writing either mask register with any value,
this bit is cleared. The bit is set when the clocks have been enabled and disabled according to
the new mask setting. Optionally, the Power Manager interrupt can be enabled by writing the
MSKRDY bit in IER.
59
13.5.7Sleep modes
32058K
AVR32-01/12
In normal operation, all clock domains are active, allowing software execution and peripheral
operation. When the CPU is idle, it is possible to switch off the CPU clock and optionally other
clock domains to save power. This is activated by the sleep instruction, which takes the sleep
mode index number as argument.
13.5.7.1Entering and exiting sleep modes
The sleep instruction will halt the CPU and all modules belonging to the stopped clock domains.
The modules will be halted regardless of the bit settings of the mask registers.
Oscillators and PLLs can also be switched off to save power. Some of these modules have a relatively long start-up time, and are only switched off when very low power consumption is
required.
The CPU and affected modules are restarted when the sleep mode is exited. This occurs when
an interrupt triggers. Note that even if an interrupt is enabled in sleep mode, it may not trigger if
the source module is not clocked.
13.5.7.2Supported sleep modes
The following sleep modes are supported. These are detailed in Table 13-1.
AT32UC3A
•Idle: The CPU is stopped, the rest of the chip is operating. Wake-up sources are any interrupt.
•Frozen: The CPU and HSB modules are stopped, peripherals are operating. Wake-up sources
are any interrupt from PB modules.
•Standby: All synchronous clocks are stopped, but oscillators and PLLs are running, allowing
quick wake-up to normal mode. Wake-up sources are RTC or external interrupt (EIC).
•Stop: As Standby, but Oscillator 0 and 1, and the PLLs are stopped. 32 KHz (if enabled) and
RC oscillators and RTC/WDT still operate. Wake-up sources are RTC, external interrupt (EIC),
or external reset pin.
•DeepStop: All synchronous clocks, Oscillator 0 and 1 and PLL 0 and 1 are stopped. 32 KHz
oscillator can run if enabled. RC oscillator still operates. Bandgap voltage reference and BOD is
turned off. Wake-up sources are RTC, external interrupt (EIC) or external reset pin.
•Static: All oscillators, including 32 KHz and RC oscillator are stopped. Bandgap voltage reference BOD detector is turned off. Wake-up sources are external interrupt (EIC) in asynchronous
mode only or external reset pin.
Table 13-1.Sleep modes
PBA,B
IndexSleep ModeCPUHSB
0IdleStopRunRunRunRunRunOnFull power
1FrozenStopStopRunRunRunRunOnFull power
GCLK
Osc0,1
PLL0,1Osc32RCOsc
BOD &
Bandgap
Voltage
Regulator
2StandbyStopStopStopRunRunRunOnFull power
3StopStopStopStopStopRunRunOnLow power
4DeepStopStopStopStopStopRunRunOffLow power
5StaticStopStopStopStopStopStopOffLow power
60
The power level of the internal voltage regulator is also adjusted according to the sleep mode to
32058K
AVR32-01/12
reduce the internal regulator power consumption.
13.5.7.3Precautions when entering sleep mode
Modules communicating with external circuits should normally be disabled before entering a
sleep mode that will stop the module operation. This prevents erratic behavior when entering or
exiting sleep mode. Please refer to the relevant module documentation for recommended
actions.
Communication between the synchronous clock domains is disturbed when entering and exiting
sleep modes. This means that bus transactions are not allowed between clock domains affected
by the sleep mode. The system may hang if the bus clocks are stopped in the middle of a bus
transaction.
The CPU is automatically stopped in a safe state to ensure that all CPU bus operations are complete when the sleep mode goes into effect. Thus, when entering Idle mode, no further action is
necessary.
When entering a sleep mode (except Idle mode), all HSB masters must be stopped before
entering the sleep mode. Also, if there is a chance that any PB write operations are incomplete,
the CPU should perform a read operation from any register on the PB bus before executing the
sleep instruction. This will stall the CPU while waiting for any pending PB operations to
complete.
AT32UC3A
13.5.7.4Wake up
13.5.8Generic clocks
The USB can be used to wake up the part from sleep modes through register PM_AWEN of the
Power Manager.
Timers, communication modules, and other modules connected to external circuitry may require
specific clock frequencies to operate correctly. The Power Manager contains an implementation
defined number of generic clocks that can provide a wide range of accurate clock frequencies.
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.
61
Figure 13-5. Generic clock generation
Divider
0
1
Osc0 clock
PLL0 clock
PLLSEL
OSCSEL
Osc1 clock
PLL1 clock
Generic Clock
DIV
0
1
DIVEN
Mask
CEN
Sleep
Controller
32058K
AVR32-01/12
AT32UC3A
13.5.8.1Enabling a generic clock
A generic clock is enabled by writing the CEN bit in GCCTRL to 1. Each generic clock can use
either Oscillator 0 or 1 or PLL0 or 1 as source, as selected by the PLLSEL and OSCSEL bits.
The source clock can optionally be divided by writing DIVEN to 1 and the division factor to DIV,
resulting in the output frequency:
f
GCLK
13.5.8.2Disabling a generic clock
The generic clock can be disabled by writing CEN to 0 or entering a sleep mode that disables
the PB clocks. In either case, the generic clock will be switched off on the first falling edge after
the disabling event, to ensure that no glitches occur. If CEN is written to 0, the bit will still read as
1 until the next falling edge occurs, and the clock is actually switched off. When writing CEN to 0,
the other bits in GCCTRL should not be changed until CEN reads as 0, to avoid glitches on the
generic clock.
When the clock is disabled, both the prescaler and output are reset.
13.5.8.3Changing clock frequency
When changing generic clock frequency by writing GCCTRL, the clock should be switched off by
the procedure above, before being re-enabled with the new clock source or division setting. This
prevents glitches during the transition.
= f
SRC
/ (2*(DIV+1))
62
13.5.8.4Generic clock implementation
32058K
AVR32-01/12
In AT32UC3A, there are 6 generic clocks. These are allocated to different functions as shown in
The clock generator in the Power Manager provides divided PBA and PBB clocks for use by
peripherals that require a prescaled PBx clock. This is described in the documentation for the
relevant modules.
AT32UC3A
The divided clocks are not directly maskable, but are stopped in sleep modes where the PBx
clocks are stopped.
13.5.10Debug operation
During a debug session, the user may need to halt the system to inspect memory and CPU registers. The clocks normally keep running during this debug operation, but some peripherals may
require the clocks to be stopped, e.g. to prevent timer overflow, which would cause the program
to fail. For this reason, peripherals on the PBA and PBB buses may use “debug qualified” PBx
clocks. This is described in the documentation for the relevant modules. The divided PBx clocks
are always debug qualified clocks.
Debug qualified PB clocks are stopped during debug operation. The debug system can optionally keep these clocks running during the debug operation. This is described in the
documentation for the On-Chip Debug system.
13.5.11Reset Controller
The Reset Controller collects the various reset sources in the system and generates hard and
soft resets for the digital logic.
The device contains a Power-On Detector, which keeps the system reset until power is stable.
This eliminates the need for external reset circuitry to guarantee stable operation when powering
up the device.
63
AT32UC3A
JTAG
Reset
Controller
RESET_N
Power-O n
Detector
OCD
W atchdog Reset
RC_RCAUSE
CPU, HSB,
PBA, PBB
OCD, RTC/W DT
Clock Generato
Brownout
Detector
32058K
AVR32-01/12
It is also possible to reset the device by asserting the RESET_N pin. This pin has an internal pullup, and does not need to be driven externally when negated. Table 13-4 lists these and other
reset sources supported by the Reset Controller.
Figure 13-6. Reset Controller block diagram
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.
Table 13-3.Reset description
Reset sourceDescription
Power-on ResetSupply voltage below the power-on reset detector threshold
voltage
External ResetRESET_N pin asserted
Brownout ResetSupply voltage below the brownout reset detector threshold
voltage
CPU ErrorCaused by an illegal CPU access to external memory while
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.
64
Table 13-4 lists parts of the device that are reset, depending on the reset source.
32058K
AVR32-01/12
Table 13-4.Effect of the different reset events
AT32UC3A
Power-On
Reset
CPU/HSB/PBA/PBB
(excluding Power Manager)
32 KHz oscillatorYNNNNN
RTC control registerYNNNNN
GPLP registersYNNNNN
Watchdog control registerYYNYYY
YYYYYY
External
Reset
Watchdog
Reset
BOD
Reset
CPU Error
Reset
OCD
Reset
Voltage Calibration registerYNNNNN
RC Oscillator Calibration registerYNNNNN
BOD control registerYYNNNN
Bandgap control registerYYNNNN
Clock control registersYYYYYY
Osc0/Osc1 and control registersYYYYYY
PLL0/PLL1 and control registersYYYYYY
OCD system and OCD registersYYNYYN
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.
13.5.11.1Power-On Detector
The Power-On Detector monitors the VDDCORE supply pin and generates a reset when the
device is powered on. The reset is active until the supply voltage from the linear regulator is
above the power-on threshold level. The reset will be re-activated if the voltage drops below the
power-on threshold level. See Electrical Characteristics for parametric details.
13.5.11.2Brown-Out Detector
The Brown-Out Detector (BOD) monitors the VDDCORE supply pin and compares the supply
voltage to the brown-out detection level, as set in BOD:LEVEL. The BOD is disabled by default,
but can be enabled either by software or by flash fuses. The Brown-Out Detector can either generate an interrupt or a reset when the supply voltage is below the brown-out detection level. In
any case, the BOD output is available in bit POSCR:BODET bit.
Note that any change to the BOD:LEVEL field of the BOD register should be done with the BOD
deactivated to avoid spurious reset or interrupt.
See Electrical Characteristics for parametric details.
65
13.5.11.3External Reset
32058K
AVR32-01/12
The external reset detector monitors the state of the RESET_N pin. By default, a low level on
this pin will generate a reset.
13.5.12Calibration registers
The Power Manager controls the calibration of the RC oscillator, voltage regulator, bandgap
voltage reference through several calibrations registers.
Those calibration registers are loaded after a Power On Reset with default values stored in factory-programmed flash fuses.
Although it is not recommended to override default factory settings, it is still possible to override
these default values by writing to those registers. To prevent unexpected writes due to software
bugs, write access to these registers is protected by a “key”. First, a write to the register must be
made with the field “KEY” equal to 0x55 then a second write must be issued with the “KEY” field
equal to 0xAA
PBBDIV = 0: PBB clock equals main clock.
PBBDIV = 1: PBB clock equals main clock divided by 2
(PBBSEL+1)
.
• PBADIV, PBASEL: PBA Division and Clock Select
PBADIV = 0: PBA clock equals main clock.
PBADIV = 1: PBA clock equals main clock divided by 2
(PBASEL+1)
.
• HSBDIV, HSBSEL: HSB Division and Clock Select
For the AT32UC3A, HSBDIV always equals CPUDIV, and HSBSEL always equals CPUSEL, as the HSB clock is always equal to
the CPU clock.
• CPUDIV, CPUSEL: CPU Division and Clock Select
CPUDIV = 0: CPU clock equals main clock.
CPUDIV = 1: CPU clock equals main clock divided by 2
(CPUSEL+1)
.
Note that if xxxDIV is written to 0, xxxSEL should also be written to 0 to ensure correct operation.
Also note that writing this register clears POSCSR:CKRDY. The register must not be re-written until CKRDY goes high.
69
13.6.3Clock Mask
32058K
AVR32-01/12
Name: CPU/HSB/PBA/PBBMASK
Access Type:Read/Write
3130292827262524
MASK[31:24]
2322212019181716
MASK[23:16]
15141312111098
MASK[15:8]
76543210
AT32UC3A
MASK[7:0]
• MASK: Clock Mask
If bit n is cleared, the clock for module n is stopped. If bit n is set, the clock for module n is enabled according to the current
power mode. The number of implemented bits in each mask register, as well as which module clock is controlled by each bit, is
shown in Table 13-5.
Specifies the number of slow clock cycles before ISR:LOCKn will be set after PLLn has been written, or after PLLn has been
automatically re-enabled after exiting a sleep mode.
• PLLMUL: PLL Multiply Factor
• PLLDIV: PLL Division Factor
These bitfields determine the ratio of the PLL output frequency (voltage controlled oscillator frequency f
oscillator frequency:
f
= (PLLMUL+1)/(PLLDIV) • f
VCO
f
= 2*(PLLMUL+1) • f
VCO
OSC
If PLLOPT[1] field is set to 0:
= f
VCO.
f
PLL
If PLLOPT[1] field is set to 1:
f
= f
VCO
/ 2
.
PLL
Note that the MUL field cannot be equal to 0 or 1, or the behavior of the PLL will be undefined.
• PLLOPT: PLL Option
Select the operating range for the PLL.
PLLOPT[0]: Select the VCO frequency range.
PLLOPT[1]: Enable the extra output divider.
PLLOPT[2]: Disable the Wide-Bandwidth mode (Wide-Bandwidth mode allows a faster startup time and out-of-lock time).
0: Oscillator 0 is the source for the PLL.
1: Oscillator 1 is the source for the PLL.
• PLLEN: PLL Enable
0: PLL is disabled.
1: PLL is enabled.
PLL
PLL
= f
= f
vco
vco
vco
/2
<240MHz
vco
<180MHz
73
13.6.5PM Oscillator 0/1 Control
32058K
AVR32-01/12
Register nameOSCCTRL0,1
Register accessRead/Write
3130292827262524
--------
2322212019181716
--------
15141312111098
-----STARTUP
76543210
-----MODE
AT32UC3A
• MODE: Oscillator Mode
Choose between crystal, or external clock
0: External clock connected on XIN, XOUT can be used as an I/O (no crystal)
1 to 3: reserved
4: Crystal is connected to XIN/XOUT - Oscillator is used with gain G0 ( XIN from
5: Crystal is connected to XIN/XOUT - Oscillator is used with gain G1 ( XIN from 0.9 MHz to 3.0 MHz ).
6: Crystal is connected to XIN/XOUT - Oscillator is used with gain G2 ( XIN from 3.0 MHz to 8.0 MHz ).
7: Crystal is connected to XIN/XOUT - Oscillator is used with gain G3 ( XIN from 8.0 Mhz).
• STARTUP: Oscillator Startup Time
Select startup time for the oscillator.
Table 13-7.Startup time for oscillators 0 and 1
Number of RC oscillator
STARTUP
000
164560 us
21281.1 ms
3204818 ms
4409636 ms
5819271 ms
clock cycle
0.4 MHz to 0.9 MHz ).
Approximative Equivalent time
(RCOsc = 115 kHz)
616384142 ms
7ReservedReserved
74
13.6.6PM 32 KHz Oscillator Control Register
32058K
AVR32-01/12
Register nameOSCCTRL32
Register accessRead/Write
3130292827262524
--------
2322212019181716
-----STARTUP
15141312111098
-----MODE
76543210
-------OSC32EN
AT32UC3A
Note: This register is only reset by Power-On Reset
• OSC32EN: Enable the 32 KHz oscillator
0: 32 KHz Oscillator is disabled
1: 32 KHz Oscillator is enabled
• MODE: Oscillator Mode
Choose between crystal, or external clock
0: External clock connected on XIN32, XOUT32 can be used as a I/O (no crystal)
1: Crystal is connected to XIN32/XOUT32
2 to 7: reserved
• STARTUP: Oscillator Startup Time
Select startup time for 32 KHz oscillator
Table 13-8.Startup time for 32 KHz oscillator
Number of RC oscillator
STARTUP
000
11281.1 ms
2819272.3 ms
316384143 ms
clock cycle
Approximative Equivalent time
(RCOsc = 115 kHz)
465536570 ms
51310721.1 s
62621442.3 s
75242884.6 s
Set to 1 when 0 to 1 transition on POSCSR:BODDET bit is detected: BOD has detected that power supply is going below
BOD reference value.
• OSC32RDY: 32 KHz oscillator Ready
Set to 1 when 0 to 1 transition on the POSCSR:OSC32RDY bit is detected: The 32 KHz oscillator is stable and ready to be
used as clock source.
• OSC1RDY: Oscillator 1 Ready
Set to 1 when 0 to 1 transition on the POSCSR:OSC1RDY bit is detected: Oscillator 1 is stable and ready to be used as
clock source.
• OSC0RDY: Oscillator 0 Ready
Set to 1 when 0 to 1 transition on the POSCSR:OSC1RDY bit is detected: Oscillator 1 is stable and ready to be used as
clock source.
• MSKRDY: Mask Ready
Set to 1 when 0 to 1 transition on the POSCSR:MSKRDY bit is detected: Clocks are now masked according to the
(CPU/HSB/PBA/PBB)_MASK registers.
• CKRDY: Clock Ready
0: The CKSEL register has been written, and the new clock setting is not yet effective.
1: The synchronous clocks have frequencies as indicated in the CKSEL register.
Note: Writing ICR:CKRDY to 1 has no effect.
• LOCK1: PLL1 locked
Set to 1 when 0 to 1 transition on the POSCSR:LOCK1 bit is detected: PLL 1 is locked and ready to be selected as clock
source.
• LOCK0: PLL0 locked
Set to 1 when 0 to 1 transition on the POSCSR:LOCK0 bit is detected: PLL 0 is locked and ready to be selected as clock
source.
76
The effect of writing or reading the bits listed above depends on which register is being accessed:
32058K
AVR32-01/12
• IER (Write-only)
0: No effect
1: Enable Interrupt
• IDR (Write-only)
0: No effect
1: Disable Interrupt
• IMR (Read-only)
0: Interrupt is disabled
1: Interrupt is enabled
• ISR (Read-only)
0: An interrupt event has not occurred or has been previously cleared
1: An interrupt event has not occurred
• ICR (Write-only)
0: No effect
1: Clear corresponding event
AT32UC3A
77
AT32UC3A
32058K
AVR32-01/12
13.6.8Power and Oscillators Status
Name: POSCSR
Access Type:Read-only
3130292827262524
--------
2322212019181716
-------BODDET
15141312111098
------OSC32RDYOSC1RDY
76543210
OSC0RDYMSKRDYCKRDY---LOCK1LOCK0
BODDET: Brown out detection
•
0: No BOD event
1: BOD has detected that power supply is going below BOD reference value.
• OSC32RDY: 32 KHz oscillator Ready
0: The 32 KHz oscillator is not enabled or not ready.
1: The 32 KHz oscillator is stable and ready to be used as clock source.
•
OSC1RDY: OSC1 ready
0: Oscillator 1 not enabled or not ready.
1: Oscillator 1 is stable and ready to be used as clock source.
• OSC0RDY: OSC0 ready
0: Oscillator 0 not enabled or not ready.
1: Oscillator 0 is stable and ready to be used as clock source.
• MSKRDY: Mask ready
0: Mask register has been changed, masking in progress.
1: Clock are masked according to xxx_MASK
• CKRDY:
0: The CKSEL register has been written, and the new clock setting is not yet effective.
1: The synchronous clocks have frequencies as indicated in the CKSEL register.
• LOCK1: PLL 1 locked
0:PLL 1 is unlocked
1:PLL 1 is locked, and ready to be selected as clock source.
• LOCK0: PLL 0 locked
0: PLL 0 is unlocked
1: PLL 0 is locked, and ready to be selected as clock source.
78
13.6.9Generic Clock Control
32058K
AVR32-01/12
Name: GCCTRL
Access Type:Read/Write
3130292827262524
--------
2322212019181716
--------
15141312111098
DIV[7:0]
76543210
AT32UC3A
---DIVEN-CENPLLSELOSCSEL
There is one GCCTRL register per generic clock in the design.
DIV: Division Factor
•
• DIVEN: Divide Enable
0: The generic clock equals the undivided source clock.
1: The generic clock equals the source clock divided by 2*(DIV+1).
• CEN: Clock Enable
0: Clock is stopped.
1: Clock is running.
• PLLSEL: PLL Select
0: Oscillator is source for the generic clock.
1: PLL is source for the generic clock.
• OSCSEL: Oscillator Select
0: Oscillator (or PLL) 0 is source for the generic clock.
1: Oscillator (or PLL) 1 is source for the generic clock.
79
AT32UC3A
32058K
AVR32-01/12
13.6.10Reset Cause
Name: RCAUSE
Access Type:Read-only
3130292827262524
--------
2322212019181716
--------
15141312111098
------JTAGHARDOCDRST
76543210
CPUERR--JTAGWDTEXTBODPOR
• POR Power-on Reset
The CPU was reset due to the supply voltage being lower than the power-on threshold level.
• BOD: Brown-out Reset
The CPU was reset due to the supply voltage being lower than the brown-out threshold level.
• EXT: External Reset Pin
The CPU was reset due to the RESET pin being asserted.
• WDT: Watchdog Reset
The CPU was reset because of a watchdog timeout.
• JTAG: JTAG reset
The CPU was reset by setting the bit RC_CPU in the JTAG reset register.
• CPUERR: CPU Error
The CPU was reset because it had detected an illegal access.
• OCDRST: OCD Reset
The CPU was reset because the RES strobe in the OCD Development Control register has been written to one.
• JTAGHARD: JTAG Hard Reset
The chip was reset by setting the bit RC_OCD in the JTAG reset register or by using the JTAG HALT instruction.
80
13.6.11BOD Control
32058K
AVR32-01/12
BOD Level register
Register nameBOD
Register accessRead/Write
3130292827262524
2322212019181716
-------FCD
15141312111098
------CTRL
76543210
-HYSTLEVEL
AT32UC3A
KEY
• KEY: Register Write protection
This field must be written twice, first with key value 0x55, then 0xAA, for a write operation to have an effect.
• FCD: BOD Fuse calibration done
Set to 1 when CTRL, HYST and LEVEL fields has been updated by the Flash fuses after power-on reset or Flash fuses update
If one, the CTRL, HYST and LEVEL values will not be updated again by Flash fuses
Can be cleared to allow subsequent overwriting of the value by Flash fuses
• CTRL: BOD Control
0: BOD is off
1: BOD is enabled and can reset the chip
2: BOD is enabled and but cannot reset the chip. Only interrupt will be sent to interrupt controller, if enabled in the IMR register.
3: BOD is off
• HYST: BOD Hysteresis
0: No hysteresis
1: Hysteresis On
• LEVEL: BOD Level
This field sets the triggering threshold of the BOD. See Electrical Characteristics for actual voltage levels.
Note that any change to the LEVEL field of the BOD register should be done with the BOD deactivated to avoid spurious reset
or interrupt.
81
13.6.12RC Oscillator Calibration
32058K
AVR32-01/12
Register nameRCCR
Register accessRead/Write
3130292827262524
2322212019181716
-------FCD
15141312111098
------CALIB
76543210
AT32UC3A
KEY
CALIB
• CALIB: Calibration Value
Calibration Value for the RC oscillator.
• FCD: Flash Calibration Done
Set to 1 when CTRL, HYST, and LEVEL fields have been updated by the Flash fuses after power-on reset, or after Flash fuses
are reprogrammed. The CTRL, HYST and LEVEL values will not be updated again by the Flash fuses until a new power-on
reset or the FCD field is written to zero.
• KEY: Register Write protection
This field must be written twice, first with key value 0x55, then 0xAA, for a write operation to have an effect.
82
13.6.13Bandgap Calibration
32058K
AVR32-01/12
Register nameBGCR
Register accessRead/Write
3130292827262524
2322212019181716
-------FCD
15141312111098
--------
76543210
-----CALIB
AT32UC3A
KEY
• KEY: Register Write protection
This field must be written twice, first with key value 0x55, then 0xAA, for a write operation to have an effect.
• CALIB: Calibration value
Calibration value for Bandgap. See Electrical Characteristics for voltage values.
• FCD: Flash Calibration Done
Set to 1 when the CALIB field has been updated by the Flash fuses after power-on reset or when the Flash fuses are
reprogrammed. The CALIB field will not be updated again by the Flash fuses until a new power-on reset or the FCD field is
written to zero.
83
13.6.14PM Voltage Regulator Calibration Register
32058K
AVR32-01/12
Register nameVREGCR
Register accessRead/Write
3130292827262524
2322212019181716
-------FCD
15141312111098
--------
76543210
-----CALIB
AT32UC3A
KEY
• KEY: Register Write protection
This field must be written twice, first with key value 0x55, then 0xAA, for a write operation to have an effect.
• CALIB: Calibration value
Calibration value for Voltage Regulator. See Electrical Characteristics for voltage values.
• FCD: Flash Calibration Done
Set to 1 when the CALIB field has been updated by the Flash fuses after power-on reset or when the Flash fuses are
reprogrammed. The CALIB field will not be updated again by the Flash fuses until a new power-on reset or the FCD field is
written to zero.
84
13.6.15General Purpose Low-power register 0/1
32058K
AVR32-01/12
Register nameGPLP0,1
Register accessRead/Write
3130292827262524
2322212019181716
15141312111098
76543210
AT32UC3A
GPLP
GPLP
GPLP
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.
85
14. Real Time Counter (RTC)
32058K
AVR32-01/12
Rev: 2.3.0.1
14.1Features
• 32-bit real-time counter with 16-bit prescaler
• Clocked from RC oscillator or 32 KHz oscillator
• High resolution: Max count frequency 16 KHz
• Long delays
– Max timeout 272 years
• Extremely low power consumption
• Available in all sleep modes except Static
• Interrupt on wrap
14.2Description
The Real Time Counter (RTC) enables periodic interrupts at long intervals, or accurate measurement of real-time sequences. The RTC is fed from a 16-bit prescaler, which is clocked from
the RC oscillator or the 32 KHz oscillator. Any tapping of the prescaler can be selected as clock
source for the RTC, enabling both high resolution and long timeouts. The prescaler cannot be
written directly, but can be cleared by the user.
AT32UC3A
The RTC can generate an interrupt when the counter wraps around the value stored in the top
register, producing accurate periodic interrupts.
86
14.3Block Diagram
16-bit Prescaler
RC OSC
32-bit counter
RTC_VAL
RTC_TOP
TOPI
IRQ
32 kHz
RTC_CTRL
EN
CLK32
PCLR
1
0
32058K
AVR32-01/12
Figure 14-1. Real Time Counter module block diagram
AT32UC3A
14.4Product Dependencies
14.4.1Power Management
The RTC is continuously clocked, and remains operating in all sleep modes except Static. Interrupts are not available in DeepStop mode.
14.4.2Interrupt
The RTC interrupt line is connected to one of the internal sources of the interrupt controller.
Using the RTC interrupt requires the interrupt controller to be programmed first.
14.4.3Debug Operation
The RTC prescaler is frozen during debug operation, unless the OCD system keeps peripherals
running in debug operation.
14.4.4Clocks
The RTC can use the internal RC oscillator as clock source. This oscillator is always enabled
whenever these modules are active. Please refer to the Electrical Characteristics chapter for the
characteristic frequency of this oscillator (f
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.
14.5Functional Description
RC
).
14.5.1RTC operation
14.5.1.1Source clock
The RTC is enabled by writing the EN bit in the CTRL register to 1. The 16-bit prescaler will then
increment on the selected clock. The prescaler cannot be read or written, but it can be reset by
writing the PCLR strobe.
87
The CLK32 bit selects either the RC oscillator or the 32 KHz oscillator as clock source for the
32058K
AVR32-01/12
prescaler.
The PSEL bitfield selects the prescaler tapping, selecting the source clock for the RTC:
14.5.1.2Counter operation
When enabled, the RTC will increment until it reaches TOP, and then wrap to 0x0. The status bit
TOPI in ISR is set when this occurs. From 0x0 the counter will count TOP+1 cycles of the source
clock before it wraps back to 0x0.
The RTC count value can be read from or written to the register VAL. Due to synchronization,
continuous reading of the VAL with the lowest prescaler setting will skip every other value.
14.5.1.3RTC Interrupt
Writing the TOPI bit in IER enables the RTC interrupt, while writing the corresponding bit in IDR
disables the RTC interrupt. IMR can be read to see whether or not the interrupt is enabled. If
enabled, an interrupt will be generated if the TOPI flag in ISR is set. The flag can be cleared by
writing TOPI in ICR to one.
The RTC interrupt can wake the CPU from all sleep modes except DeepStop and Static mode.
f
RTC
= 2
-(PSEL+1)
AT32UC3A
* (fRC or 32 KHz)
14.5.1.4RTC wakeup
14.5.1.5Busy bit
The RTC can also wake up the CPU directly without triggering an interrupt when the TOPI flag in
ISR is set. In this case, the CPU will continue executing from the instruction following the sleep
instruction.
This direct RTC wakeup is enabled by writing the WAKE_EN bit in the CTRL register to one.
When the CPU wakes from sleep, the WAKE_EN bit must be written to zero to clear the internal
wake signal to the sleep controller, otherwise a new sleep instruction will have no effect.
The RTC wakeup is available in all sleep modes except Static mode. The RTC wakeup can be
configured independently of the RTC interrupt.
Due to the crossing of clock domains, the RTC uses a few clock cycles to propagate the values
stored in CTRL, TOP, and VAL to the RTC. The BUSY bit in CTRL indicates that a register write
is still going on and all writes to TOP, CTRL, and VAL will be discarded until BUSY goes low
again.
The effect of writing or reading this bit depends on which register is being accessed:
• IER (Write-only)
0: No effect
1: Enable Interrupt
• IDR (Write-only)
0: No effect
1: Disable Interrupt
• IMR (Read-only)
0: Interrupt is disabled
1: Interrupt is enabled
• ISR (Read-only)
0: An interrupt event has occurred
1: An interrupt even has not occurred
• ICR (Write-only)
0: No effect
1: Clear interrupt even
93
15. Watchdog Timer (WDT)
RCOSC
WDT_CLR
Watchdog
Detector
WDT_CTRL
32-bit
Prescaler
Watchdog Reset
EN
32058K
AVR32-01/12
Rev: 2.3.0.1
15.1Features
• Watchdog Timer counter with 16-bit prescaler
• Clocked from RC oscillator
15.2Description
The Watchdog Timer (WDT) has a prescaler generating a timeout period. This prescaler is
clocked from the RC oscillator. The watchdog timer must be periodically reset by software within
the timeout 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.
15.3Block Diagram
Figure 15-1. Watchdog Timer module block diagram
AT32UC3A
15.4Product Dependencies
15.4.1Power Management
When the WDT is enabled, the WDT remains clocked in all sleep modes, and it is not possible to
enter Static mode.
15.4.2Debug Operation
The WDT prescaler is frozen during debug operation, unless the OCD system keeps peripherals
running in debug operation.
15.4.3Clocks
The WDT can use the internal RC oscillator as clock source. This oscillator is always enabled
whenever these modules are active. Please refer to the Electrical Characteristics chapter for the
characteristic frequency of this oscillator (fRC).
94
15.5Functional Description
32058K
AVR32-01/12
The WDT is enabled by writing the EN bit in the CTRL register to one. This also enables the RC
clock for the prescaler. The PSEL bitfield in the same register selects the watchdog timeout
period:
T
WDT
The next timeout period will begin as soon as the watchdog reset has occured and count down
during the reset sequence. Care must be taken when selecting the PSEL value so that the timeout period is greater than the startup time of the chip, otherwise a watchdog reset can reset the
chip before any code has been run.
To avoid accidental disabling of the watchdog, the CTRL register must be written twice, first with
the KEY field set to 0x55, then 0xAA without changing the other bitfields. Failure to do so will
cause the write operation to be ignored, and CTRL does not change value.
The CLR register must be written with any value with regular intervals shorter than the watchdog
timeout period. Otherwise, the device will receive a soft reset, and the code will start executing
from the boot vector.
When the WDT is enabled, it is not possible to enter Static mode. Attempting to do so will result
in entering Shutdown mode, leaving the WDT operational.
This bitfield must be written twice, first with key value 0x55, then 0xAA, for a write operation to be effective. This bitfield always
reads as zero.
• PSEL: Prescale Select
Prescaler bit PSEL is used as watchdog timeout period.
• EN: WDT Enable
0: WDT is disabled.
1: WDT is enabled.
97
AT32UC3A
32058K
AVR32-01/12
15.6.2WDT Clear
Name: CLR
Access Type:Write-only
When the watchdog timer is enabled, this register must be periodically written, with any value, within the watchdog timeout
period, to prevent a watchdog reset.
98
16. Interrupt Controller (INTC)
Request
masking
OR
IREQ0
IREQ1
IREQ2
IREQ31
GrpReq0
Masks
SREG
masks
I[3-0]M
GM
INTLEVEL
AUTOVECTOR
Prioritizer
CPUInterrupt Controller
OR
GrpReqN
NMIREQ
OR
IREQ32
IREQ33
IREQ34
IREQ63
GrpReq1
IRR registers
IPR registersICR registers
INT_level, offset
INT_level, offset
INT_level, offset
IPR0
IPR1
IPRn
IRR0
IRR1
IRRn
ValReq0
ValReq1
ValReqN
32058K
AVR32-01/12
Rev: 1.0.1.1
16.1Description
The INTC collects interrupt requests from the peripherals, prioritizes them, and delivers an interrupt 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 an
pending interrupt of the same level, the group with the lowest number takes priority.
16.2Block Diagram
AT32UC3A
16.3Operation
Figure 16-1 on page 99 gives an overview of the INTC. The grey boxes represent registers that
can be accessed via the Peripheral Bus (PB). The interrupt requests from the peripherals
(IREQn) and the NMI are input on the left side of the figure. Signals to and from the CPU are on
the right side of the figure.
Figure 16-1. Overview of the Interrupt Controller
All of the incoming interrupt requests (IREQs) are sampled into the corresponding Interrupt
Request Register (IRR). The IRRs must be accessed to identify which IREQ within a group that
is active. If several IREQs within the same group is active, the interrupt service routine must pri-
99
AT32UC3A
32058K
AVR32-01/12
oritize between them. All of the input lines in each group are logically-ORed together to form the
GrpReqN lines, indicating if there is a pending interrupt in the corresponding group.
The Request Masking hardware maps each of the GrpReq lines to a priority level from INT0 to
INT3 by associating each group with the INTLEVEL field in the corresponding IPR register. The
GrpReq inputs are then masked by the I0M, I1M, I2M, I3M and GM 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.
The Prioritizer hardware uses the ValReq lines and the INTLEVEL field in the IPRs to select the
pending interrupt of the highest priority. If a NMI interrupt is pending, it automatically gets highest priority of any pending interrupt. If several interrupt groups of the highest pending interrupt
level have pending interrupts, the interrupt group with the highest number is selected.
Interrupt level (INTLEVEL) and handler autovector offset (AUTOVECTOR) of the selected interrupt are transmitted to the CPU for interrupt handling and context switching. The CPU doesn't
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 PB for checking which interrupts of the group are actually active.
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 interrupt
mask (GM). An interrupt request is masked if either the Global interrupt mask or the corresponding interrupt level mask bit is set.
16.3.1Non maskable interrupts
A NMI request has priority over all other interrupt requests. NMI has a dedicated exception vector address defined by the AVR32 architecture, so AUTOVECTOR is undefined when
INTLEVEL indicates that an NMI is pending.
16.3.2CPU response
When the CPU receives an interrupt request it checks if any other exceptions are pending. If no
exceptions of higher priority are pending, interrupt handling is initiated. When initiating interrupt
handling, the corresponding interrupt mask bit is set automatically for this and lower levels in status register. E.g, if interrupt on level 3 is approved for handling the interrupt mask bits I3M, I2M,
I1M, and I0M are set in status register. If interrupt on level 1 is approved the masking bits I1M,
and I0M are set in status register. The handler offset is calculated from AUTOVECTOR and
EVBA and a change-of-flow to this address is performed.
Setting of the interrupt mask bits prevents the interrupts from the same and lower levels to be
passed trough the interrupt controller. Setting of the same level mask bit prevents also multiple
request of the same interrupt to happen.
It is the responsibility of the handler software to clear the interrupt request that caused the interrupt before returning from the interrupt handler. If the conditions that caused the interrupt are not
cleared, the interrupt request remains active.
16.3.3Clearing an interrupt request
Clearing of the interrupt request is done by writing to registers in the corresponding peripheral
module, which then clears the corresponding NMIREQ/IREQ signal.
The recommended way of clearing an interrupt request is a store operation to the controlling
peripheral register, followed by a dummy load operation from the same register. This causes a
100
Loading...
+ 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.