The Atmel SAM7X512/256/128 is a highly-integrated Flash microcontroller based on
the 32-bit ARM
and 128/64/32 Kbytes of SRAM, a large set of peripherals, including an 802.3 Ethernet
MAC, and a CAN controller. A complete set of system functions minimizes the number
of external components.
The embedded Flash memory can be programmed in-system via the JTAG-ICE
interface or via a parallel interface on a production programmer prior to mounting. Builtin lock bits and a security bit protect the firmware from accidental overwrite and
preserve its confidentiality.
The SAM7X512/256/128 system controller includes a reset controller capable of
managing the power-on sequence of the microcontroller and the complete system.
Correct device operation can be monitored by a built-in brownout detector and a
watchdog running off an integrated RC oscillator.
By combining the ARM7TDMI
range of peripheral functions, including USART, SPI, CAN controller, Ethernet MAC,
Timer Counter, RTT and analog-to-digital converters on a monolithic chip, the
SAM7X512/256/128 is a powerful device that provides a flexible, cost-effective solution
to many embedded control applications requiring communication over Ethernet, wired
CAN and ZigBee
®
RISC processor. It features 512/256/128 Kbytes of high-speed Flash
®
processor with on-chip Flash and SRAM, and a wide
®
wireless networks.
6120K–ATARM–11-Feb-14
Features
Incorporates the ARM7TDMI ARM Thumb
High-performance 32-bit RISC Architecture
High-density 16-bit Instruction Set
Leader in MIPS/Watt
EmbeddedICE
™
In-circuit Emulation, Debug Communication Channel Support
®
Processor
Internal High-speed Flash
512 Kbytes (SAM7X512) Organized in Two Banks of 1024 Pages of
256 Bytes (Dual Plane)
256 Kbytes (SAM7X256) Organized in 1024 Pages of 256 Bytes (Single Plane)
128 Kbytes (SAM7X128) Organized in 512 Pages of 256 Bytes (Single Plane)
Single Cycle Access at Up to 30 MHz in Worst Case Conditions
Prefetch Buffer Optimizing Thumb Instruction Execution at Maximum Speed
Page Programming Time: 6 ms, Including Page Auto-erase,
Full Erase Time: 15 ms
10,000 Write Cycles, 10-year Data Retention Capability,
Sector Lock Capabilities, Flash Security Bit
Fast Flash Programming Interface for High Volume Production
Internal High-speed SRAM, Single-cycle Access at Maximum Speed
Embedded Flash Controller, Abort Status and Misalignment Detection
Reset Controller (RSTC)
Based on Power-on Reset Cells and Low-power Factory-calibrated Brownout Detector
Provides External Reset Signal Shaping and Reset Source Status
Clock Generator (CKGR)
Low-power RC Oscillator, 3 to 20 MHz On-chip Oscillator and one PLL
Power Management Controller (PMC)
Power Optimization Capabilities, Including Slow Clock Mode (Down to 500 Hz) and Idle Mode
Four Programmable External Clock Signals
Advanced Interrupt Controller (AIC)
Individually Maskable, Eight-level Priority, Vectored Interrupt Sources
Two External Interrupt Sources and One Fast Interrupt Source, Spurious Interrupt Protected
Debug Unit (DBGU)
2-wire UART and Support for Debug Communication Channel interrupt, Programmable ICE Access Prevention
Mode for General Purpose 2-wire UART Serial Communication
Periodic Interval Timer (PIT)
20-bit Programmable Counter plus 12-bit Interval Counter
Windowed Watchdog (WDT)
12-bit key-protected Programmable Counter
Provides Reset or Interrupt Signals to the System
Counter May Be Stopped While the Processor is in Debug State or in Idle Mode
Real-time Timer (RTT)
32-bit Free-running Counter with Alarm
Runs Off the Internal RC Oscillator
Two Parallel Input/Output Controllers (PIO)
Sixty-two Programmable I/O Lines Multiplexed with up to Two Peripheral I/Os
Input Change Interrupt Capability on Each I/O Line
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
2
Individually Programmable Open-drain, Pull-up Resistor and Synchronous Output
Thirteen Peripheral DMA Controller (PDC) Channels
One USB 2.0 Full Speed (12 Mbits per second) Device Port
Media Independent Interface (MII) or Reduced Media Independent Interface (RMII)
Integrated 28-byte FIFOs and Dedicated DMA Channels for Transmit and Receive
One Part 2.0A and Part 2.0B Compliant CAN Controller
Eight Fully-programmable Message Object Mailboxes, 16-bit Time Stamp Counter
One Synchronous Serial Controller (SSC)
Independent Clock and Frame Sync Signals for Each Receiver and Transmitter
I²S Analog Interface Support, Time Division Multiplex Support
High-speed Continuous Data Stream Capabilities with 32-bit Data Transfer
Two Universal Synchronous/Asynchronous Receiver Transmitters (USART)
Individual Baud Rate Generator, IrDA
Support for ISO7816 T0/T1 Smart Card, Hardware Handshaking, RS485 Support
Full Modem Line Support on USART1
®
Infrared Modulation/Demodulation
Two Master/Slave Serial Peripheral Interfaces (SPI)
8- to 16-bit Programmable Data Length, Four External Peripheral Chip Selects
One Three-channel 16-bit Timer/Counter (TC)
Three External Clock Inputs, Two Multi-purpose I/O Pins per Channel
Double PWM Generation, Capture/Waveform Mode, Up/Down Capability
One Four-channel 16-bit Power Width Modulation Controller (PWMC)
One Two-wire Interface (TWI)
Master Mode Support Only, All Two-wire Atmel EEPROMs and I
2
C Compatible Devices Supported
One 8-channel 10-bit Analog-to-Digital Converter, Four Channels Multiplexed with Digital I/Os
SAM-BA
IEEE
®
Boot Assistance
Default Boot program
Interface with SAM-BA Graphic User Interface
®
1149.1 JTAG Boundary Scan on All Digital Pins
5V-tolerant I/Os, Including Four High-current Drive I/O lines, Up to 16 mA Each
Power Supplies
Embedded 1.8V Regulator, Drawing up to 100 mA for the Core and External Components
3.3V VDDIO I/O Lines Power Supply, Independent 3.3V VDDFLASH Flash Power Supply
1.8V VDDCORE Core Power Supply with Brownout Detector
Fully Static Operation: Up to 55 MHz at 1.65V and 85°C Worst Case Conditions
Available in 100-lead LQFP Green and 100-ball TFBGA Green Packages
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
3
1.Configuration Summary of the SAM7X512/256/128
The SAM7X512, SAM7X256 and SAM7X128 differ only in memory sizes. Table 1-1 summarizes the configurations of the
three devices.
VDDOUTVoltage Regulator OutputPower1.85V
VDDFLASHFlash and USB Power SupplyPower 3V to 3.6V
VDDIOI/O Lines Power SupplyPower3V to 3.6V
VDDCORECore Power SupplyPower1.65V to 1.95V
VDDPLLPLLPower1.65V to 1.95V
GNDGroundGround
EREFCKReference ClockInputRMII only
ETXCKTransmit ClockInputMII only
ERXCKReceive ClockInputMII only
ETXENTransmit EnableOutput
ETX0 - ETX3Transmit DataOutputETX0 - ETX1 only in RMII
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
7
Table 3-1.Signal Description List (Continued)
Active
Signal NameFunctionType
LevelComments
ETXERTransmit Coding ErrorOutputMII only
ERXDVReceive Data ValidInputMII only
ECRSDVCarrier Sense and Data ValidInputRMII only
ERX0 - ERX3Receive DataInputERX0 - ERX1 only in RMII
ERXERReceive ErrorInput
ECRSCarrier SenseInputMII only
ECOLCollision DetectedInputMII only
EMDCManagement Data ClockOutput
EMDIOManagement Data Input/OutputI/O
EF100Force 100 Mbits/sec.OutputHighRMII only
Note:1. Refer to Section 6. ”I/O Lines Considerations”.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
8
4.Package
125
26
50
5175
76
100
The SAM7X512/256/128 is available in 100-lead LQFP Green and 100-ball TFBGA RoHS-compliant packages.
4.1100-lead LQFP Package Outline
Figure 4-1 shows the orientation of the 100-lead LQFP package. A detailed mechanical description is given in the
The SAM7X512/256/128 has six types of power supply pins and integrates a voltage regulator, allowing the device to be
supplied with only one voltage. The six power supply pin types are:
VDDIN pin. It powers the voltage regulator and the ADC; voltage ranges from 3.0V to 3.6V, 3.3V nominal. In order
to decrease current consumption, if the voltage regulator and the ADC are not used, VDDIN, ADVREF, AD4, AD5,
AD6 and AD7 should be connected to GND. In this case, VDDOUT should be left unconnected.
VDDOUT pin. It is the output of the 1.8V voltage regulator.
VDDIO pin. It powers the I/O lines; voltage ranges from 3.0V to 3.6V, 3.3V nominal.
VDDFLASH pin. It powers the USB transceivers and a part of the Flash and is required for the Flash to operate
correctly; voltage ranges from 3.0V to 3.6V, 3.3V nominal.
VDDCORE pins. They power the logic of the device; voltage ranges from 1.65V to 1.95V, 1.8V typical. It can be
connected to the VDDOUT pin with decoupling capacitor. VDDCORE is required for the device, including its
embedded Flash, to operate correctly.
VDDPLL pin. It powers the oscillator and the PLL. It can be connected directly to the VDDOUT pin.
No separate ground pins are provided for the different power supplies. Only GND pins are provided and should be
connected as shortly as possible to the system ground plane.
5.2Power Consumption
The SAM7X512/256/128 has a static current of less than 60 µA on VDDCORE at 25°C, including the RC oscillator, the
voltage regulator and the power-on reset when the brownout detector is deactivated. Activating the brownout detector
adds 28 µA static current.
The dynamic power consumption on VDDCORE is less than 90 mA at full speed when running out of the Flash. Under
the same conditions, the power consumption on VDDFLASH does not exceed 10 mA.
5.3Voltage Regulator
The SAM7X512/256/128 embeds a voltage regulator that is managed by the System Controller.
In Normal Mode, the voltage regulator consumes less than 100 µA static current and draws 100 mA of output current.
The voltage regulator also has a Low-power Mode. In this mode, it consumes less than 25 µA static current and draws 1
mA of output current.
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: one external 470 pF (or 1 nF) NPO capacitor should be connected
between VDDOUT and GND as close to the chip as possible. One external 2.2 µF (or 3.3 µF) X7R capacitor should be
connected between VDDOUT and GND.
Adequate input supply decoupling is mandatory for VDDIN in order to improve startup stability and reduce source voltage
drop. The input decoupling capacitor should be placed close to the chip. For example, two capacitors can be used in
parallel: 100 nF NPO and 4.7 µF X7R.
5.4Typical Powering Schematics
The SAM7X512/256/128 supports a 3.3V single supply mode. The internal regulator input connected to the 3.3V source
and its output feeds VDDCORE and the VDDPLL. Figure 5-1 shows the power schematics to be used for USB buspowered systems.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
11
Figure 5-1.3.3V System Single Power Supply Schematic
Power Source
ranges
from 4.5V (USB)
to 18V
3.3V
VDDIN
Voltage
Regulator
VDDOUT
VDDIO
DC/DC Converter
VDDCORE
VDDFLASH
VDDPLL
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
12
6.I/O Lines Considerations
6.1JTAG Port Pins
TMS, TDI and TCK are schmitt trigger inputs and are not5-V tolerant. TMS, TDI and TCK do not integrate a pull-up
resistor.
TDO is an output, driven at up to VDDIO, and has no pull-up resistor.
The JTAGSEL pin is used to select the JTAG boundary scan when asserted at a high level. The JTAGSEL pin integrates
a permanent pull-down resistor of about 15 kΩ to GND.
To eliminate any risk of spuriously entering the JTAG boundary scan mode due to noise on JTAGSEL, it should be tied
externally to GND if boundary scan is not used, or pulled down with an external low-value resistor (such as 1 kΩ) .
6.2Test Pin
The TST pin is used for manufacturing test or fast programming mode of the SAM7X512/256/128 when asserted high.
The TST pin integrates a permanent pull-down resistor of about 15 kΩ to GND.
To eliminate any risk of entering the test mode due to noise on the TST pin, it should be tied to GND if the FFPI is not
used, or pulled down with an external low-value resistor (such as 1 kΩ)
To enter fast programming mode, the TST pin and the PA0 and PA1 pins should be tied high and PA2 tied to low.
Driving the TST pin at a high level while PA0 or PA1 is driven at 0 leads to unpredictable results.
6.3Reset Pin
The NRST pin is bidirectional with an open drain output buffer. It is handled by the on-chip reset controller and can be
driven low to provide a reset signal to the external components or asserted low externally to reset the microcontroller.
There is no constraint on the length of the reset pulse, and the reset controller can guarantee a minimum pulse length.
This allows connection of a simple push-button on the NRST pin as system user reset, and the use of the signal NRST to
reset all the components of the system.
The NRST pin integrates a permanent pull-up resistor to VDDIO.
6.4ERASE Pin
The ERASE pin is used to re-initialize the Flash content and some of its NVM bits. It integrates a permanent pull-down
resistor of about 15 kΩ to GND.
To eliminate any risk of erasing the Flash due to noise on the ERASE pin, it shoul be tied externally to GND, which
prevents erasing the Flash from the applicatiion, or pulled down with an external low-value resistor (such as 1 kΩ) .
This pin is debounced by the RC oscillator to improve the glitch tolerance. When the pin is tied to high during less than
100 ms, ERASE pin is not taken into account. The pin must be tied high during more than 220 ms to perform the reinitialization of the Flash.
6.5PIO Controller Lines
All the I/O lines, PA0 to PA30 and PB0 to PB30, are 5V-tolerant and all integrate a programmable pull-up resistor.
Programming of this pull-up resistor is performed independently for each I/O line through the PIO controllers.
5V-tolerant means that the I/O lines can drive voltage level according to VDDIO, but can be driven with a voltage of up to
5.5V. However, driving an I/O line with a voltage over VDDIO while the programmable pull-up resistor is enabled will
create a current path through the pull-up resistor from the I/O line to VDDIO. Care should be taken, in particular at reset,
as all the I/O lines default to input with pull-up resistor enabled at reset.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
13
6.6I/O Lines Current Drawing
The PIO lines PA0 to PA3 are high-drive current capable. Each of these I/O lines can drive up to 16 mA permanently.
The remaining I/O lines can draw only 8 mA.
However, the total current drawn by all the I/O lines cannot exceed 200 mA.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
14
7.Processor and Architecture
7.1ARM7TDMI Processor
RISC processor based on ARMv4T Von Neumann architecture
Runs at up to 55 MHz, providing 0.9 MIPS/MHz
Two instruction sets
ARM high-performance 32-bit instruction set
Thumb high code density 16-bit instruction set
Two watchpoint units
Test access port accessible through a JTAG protocol
Debug communication channel
Debug Unit
Two-pin UART
Debug communication channel interrupt handling
Chip ID Register
IEEE1149.1 JTAG Boundary-scan on all digital pins
7.3Memory Controller
Programmable Bus Arbiter
Handles requests from the ARM7TDMI, the Ethernet MAC and the Peripheral DMA Controller
Address decoder provides selection signals for
Three internal 1 Mbyte memory areas
One 256 Mbyte embedded peripheral area
Abort Status Registers
Source, Type and all parameters of the access leading to an abort are saved
Facilitates debug by detection of bad pointers
Misalignment Detector
Alignment checking of all data accesses
Abort generation in case of misalignment
Remap Command
Remaps the SRAM in place of the embedded non-volatile memory
Allows handling of dynamic exception vectors
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
15
Embedded Flash Controller
Embedded Flash interface, up to three programmable wait states
Prefetch buffer, buffering and anticipating the 16-bit requests, reducing the required wait states
Key-protected program, erase and lock/unlock sequencer
Single command for erasing, programming and locking operations
Interrupt generation in case of forbidden operation
7.4Peripheral DMA Controller
Handles data transfer between peripherals and memories
Thirteen channels
Two for each USART
Two for the Debug Unit
Two for the Serial Synchronous Controller
Two for each Serial Peripheral Interface
One for the Analog-to-digital Converter
Low bus arbitration overhead
One Master Clock cycle needed for a transfer from memory to peripheral
Two Master Clock cycles needed for a transfer from peripheral to memory
Next Pointer management for reducing interrupt latency requirements
Peripheral DMA Controller (PDC) priority is as follows (from the highest priority to the lowest):
2 contiguous banks of 1024 pages of 256 bytes
Fast access time, 30 MHz single-cycle access in Worst Case conditions
Page programming time: 6 ms, including page auto-erase
Page programming without auto-erase: 3 ms
Full chip erase time: 15 ms
10,000 write cycles, 10-year data retention capability
32 lock bits, protecting 32 sectors of 64 pages
Protection Mode to secure contents of the Flash
128 Kbytes of Fast SRAM
Single-cycle access at full speed
8.2SAM7X256
256 Kbytes of Flash Memory
1024 pages of 256 bytes
Fast access time, 30 MHz single-cycle access in Worst Case conditions
Page programming time: 6 ms, including page auto-erase
Page programming without auto-erase: 3 ms
Full chip erase time: 15 ms
10,000 write cycles, 10-year data retention capability
16 lock bits, each protecting 16 sectors of 64 pages
Protection Mode to secure contents of the Flash
64 Kbytes of Fast SRAM
Single-cycle access at full speed
8.3SAM7X128
128 Kbytes of Flash Memory
512 pages of 256 bytes
Fast access time, 30 MHz single-cycle access in Worst Case conditions
Page programming time: 6 ms, including page auto-erase
Page programming without auto-erase: 3 ms
Full chip erase time: 15 ms
10,000 write cycles, 10-year data retention capability
8 lock bits, each protecting 8 sectors of 64 pages
Protection Mode to secure contents of the Flash
32 Kbytes of Fast SRAM
Single-cycle access at full speed
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
17
Figure 8-1.SAM7X512/256/128 Memory Mapping
0x1000 0000
0x0000 0000
0x0FFF FFFF
0xF000 0000
0xEFFF FFFF
0xFFFF FFFF
256 MBytes
256 MBytes
14 x 256 MBytes
3,584 MBytes
0x000F FFF
0x0010 0000
0x001F FFF
0x0020 0000
0x002F FFF
0x0030 0000
0x003F FFF
0x0040 0000
0x0000 0000
1 MBytes
1 MBytes
1 MBytes
1 MBytes
252 MBytes
0xFFFA 0000
0xFFFA 3FFF
0xFFFA 4000
0xF000 0000
0xFFFB 8000
0xFFFC 0000
0xFFFC 3FFF
0xFFFC 4000
0xFFFC 7FFF
0xFFFD 4000
0xFFFD 7FFF
0xFFFD 3FFF
0xFFFD FFFF
0xFFFE 0000
0xFFFE 3FFF
0xFFFF EFFF
0xFFFF FFFF
0xFFFF F000
0xFFFE 4000
0xFFFE 8000
0xFFFE 7FFF
0xFFFB 4000
0xFFFB 7FFF
0xFFF9 FFFF
0xFFFC FFFF
0xFFFD 8000
0xFFFD BFFF
0xFFFC BFFF
0xFFFC C000
0xFFFB FFFF
0xFFFB C000
0xFFFB BFFF
0xFFFA FFFF
0xFFFB 0000
0xFFFB 3FFF
0xFFFD 0000
0xFFFD C000
0xFFFC 8000
16 Kbytes
16 Kbytes
16 Kbytes
16 Kbytes
16 Kbytes
16 Kbytes
16 Kbytes
16 Kbytes
16 Kbytes
16 Kbytes
16 Kbytes
16 Kbytes
0x0FFF FFFF
512 Bytes/128 registers
512 Bytes/128 registers
256 Bytes/64 registers
16 Bytes/4 registers
16 Bytes/4 registers
16 Bytes/4 registers
16 Bytes/4 registers
256 Bytes/64 registers
4 Bytes/1 register
512 Bytes/128 registers
512 Bytes/128 registers
0xFFFF F000
0xFFFF F200
0xFFFF F1FF
0xFFFF F3FF
0xFFFF FBFF
0xFFFF FCFF
0xFFFF FEFF
0xFFFF FFFF
0xFFFF F400
0xFFFF FC00
0xFFFF FD0F
0xFFFF FC2F
0xFFFF FC3F
0xFFFF FD4F
0xFFFF FC6F
0xFFFF F5FF
0xFFFF F600
0xFFFF F7FF
0xFFFF F800
0xFFFF FD00
0xFFFF FF00
0xFFFF FD20
0xFFFF FD30
0xFFFF FD40
0xFFFF FD60
0xFFFF FD70
Internal Memories
Undefined
(Abort)
(1) Can be ROM, Flash or SRAM
depending on GPNVM2 and REMAP
Flash before Remap
SRAM after Remap
Internal Flash
Internal SRAM
Internal ROM
Reserved
Boot Memory (1)
Address Memory Space
Internal Memory Mapping
Note:
TC0, TC1, TC2
USART0
USART1
PWMC
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
CAN
EMAC
Reserved
TWI
SSC
SPI0
SPI1
UDP
ADC
AIC
DBGU
PIOA
Reserved
PMC
MC
WDT
PIT
RTT
RSTC
VREG
PIOB
Peripheral Mapping
System Controller Mapping
Internal Peripherals
Reserved
SYSC
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
18
8.4Memory Mapping
256M Bytes
ROM Before Remap
SRAM After Remap
Undefined Areas
(Abort)
0x000F FFFF
0x001F FFFF
0x002F FFFF
0x0FFF FFFF
1 M Bytes
1 M Bytes
1 M Bytes
252 M Bytes
Internal FLASH
Internal SRAM
0x0000 0000
0x0010 0000
0x0020 0000
0x0030 0000
Internal ROM
0x003F FFFF
0x0040 0000
1 M Bytes
8.4.1Internal SRAM
The SAM7X512 embeds a high-speed 128-Kbyte SRAM bank.
The SAM7X256 embeds a high-speed 64-Kbyte SRAM bank.
The SAM7X128 embeds a high-speed 32-Kbyte SRAM bank.
After reset and until the Remap Command is performed, the SRAM is only accessible at address 0x0020 0000. After
Remap, the SRAM also becomes available at address 0x0.
8.4.2Internal ROM
The SAM7X512/256/128 embeds an Internal ROM. At any time, the ROM is mapped at address 0x30 0000. The ROM
contains the FFPI and the SAM-BA program.
8.4.3Internal Flash
The SAM7X512 features two banks (dual plane) of 256 Kbytes of Flash.
The SAM7X256 features one bank (single plane) of 256 Kbytes of Flash.
The SAM7X128 features one bank (single plane) of 128 Kbytes of Flash.
At any time, the Flash is mapped to address 0x0010 0000. It is also accessible at address 0x0 after the reset, if GPNVM
bit 2 is set and before the Remap Command.
A general purpose NVM (GPNVM) bit is used to boot either on the ROM (default) or from the Flash.
This GPNVM bit can be cleared or set respectively through the commands “Clear General-purpose NVM Bit” and “Set
General-purpose NVM Bit” of the EFC User Interface.
Setting the GPNVM Bit 2 selects the boot from the Flash. Asserting ERASE clears the GPNVM Bit 2 and thus selects the
boot from the ROM by default.
Figure 8-2.Internal Memory Mapping with GPNVM Bit 2 = 0 (default)
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
19
Figure 8-3.Internal Memory Mapping with GPNVM Bit 2 = 1
256M Bytes
Flash Before Remap
SRAM After Remap
Undefined Areas
(Abort)
0x000F FFFF
0x001F FFFF
0x002F FFFF
0x0FFF FFFF
1 M Bytes
1 M Bytes
1 M Bytes
252 M Bytes
Internal FLASH
Internal SRAM
0x0000 0000
0x0010 0000
0x0020 0000
0x0030 0000
Internal ROM
0x003F FFFF
0x0040 0000
1 M Bytes
8.5Embedded Flash
8.5.1Flash Overview
The Flash of the SAM7X512 is organized in two banks (dual plane) of 1024 pages of 256 bytes. The 524,288 bytes
are organized in 32-bit words.
The Flash of the SAM7X256 is organized in 1024 pages of 256 bytes (single plane). It reads as 65,536 32-bit
words.
The Flash of the SAM7X128 is organized in 512 pages of 256 bytes (single plane). It reads as 32,768 32-bit words.
The Flash contains a 256-byte write buffer, accessible through a 32-bit interface.
The Flash benefits from the integration of a power reset cell and from the brownout detector. This prevents code
corruption during power supply changes, even in the worst conditions.
When Flash is not used (read or write access), it is automatically placed into standby mode.
8.5.2Embedded Flash Controller
The Embedded Flash Controller (EFC) manages accesses performed by the masters of the system. It enables reading
the Flash and writing the write buffer. It also contains a User Interface, mapped within the Memory Controller on the APB.
The User Interface allows:
programming of the access parameters of the Flash (number of wait states, timings, etc.)
starting commands such as full erase, page erase, page program, NVM bit set, NVM bit clear, etc.
getting the end status of the last command
getting error status
programming interrupts on the end of the last commands or on errors
The Embedded Flash Controller also provides a dual 32-bit Prefetch Buffer that optimizes 16-bit access to the Flash.
This is particularly efficient when the processor is running in Thumb mode.
Two EFCs are embedded in the SAM7X512 to control each bank of 256 KBytes. Dual-plane organization allows
concurrent read and program functionality. Read from one memory plane may be performed even while program or
erase functions are being executed in the other memory plane.
One EFC is embedded in the SAM7X256/128 to control the single plane of 256/128 KBytes.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
20
8.5.3Lock Regions
8.5.3.1SAM7X512
Two Embedded Flash Controllers each manage 16 lock bits to protect 16 regions of the flash against inadvertent flash
erasing or programming commands. The SAM7X512 contains 32 lock regions and each lock region contains 64 pages of
256 bytes. Each lock region has a size of 16 Kbytes.
If a locked-region’s erase or program command occurs, the command is aborted and the EFC trigs an interrupt.
The 32 NVM bits are software programmable through both of the EFC User Interfaces. The command “Set Lock Bit”
enables the protection. The command “Clear Lock Bit” unlocks the lock region.
Asserting the ERASE pin clears the lock bits, thus unlocking the entire Flash.
8.5.3.2SAM7X256
The Embedded Flash Controller manages 16 lock bits to protect 16 regions of the flash against inadvertent flash erasing
or programming commands. The SAM7X256 contains 16 lock regions and each lock region contains 64 pages of 256
bytes. Each lock region has a size of 16 Kbytes.
If a locked-region’s erase or program command occurs, the command is aborted and the EFC trigs an interrupt.
The 16 NVM bits are software programmable through the EFC User Interface. The command “Set Lock Bit” enables the
protection. The command “Clear Lock Bit” unlocks the lock region.
Asserting the ERASE pin clears the lock bits, thus unlocking the entire Flash.
8.5.3.3SAM7X128
The Embedded Flash Controller manages 8 lock bits to protect 8 regions of the flash against inadvertent flash erasing or
programming commands. The SAM7X128 contains 8 lock regions and each lock region contains 64 pages of 256 bytes.
Each lock region has a size of 16 Kbytes.
If a locked-region’s erase or program command occurs, the command is aborted and the EFC trigs an interrupt.
The 8 NVM bits are software programmable through the EFC User Interface. The command “Set Lock Bit” enables the
protection. The command “Clear Lock Bit” unlocks the lock region.
Asserting the ERASE pin clears the lock bits, thus unlocking the entire Flash.
8.5.4Security Bit Feature
The SAM7X512/256/128 features a security bit, based on a specific NVM-Bit. When the security is enabled, any access
to the Flash, either through the ICE interface or through the Fast Flash Programming Interface, is forbidden. This ensures
the confidentiality of the code programmed in the Flash.
This security bit can only be enabled, through the Command “Set Security Bit” of the EFC User Interface. Disabling the
security bit can only be achieved by asserting the ERASE pin at 1, and after a full flash erase is performed. When the
security bit is deactivated, all accesses to the flash are permitted.
It is important to note that the assertion of the ERASE pin should always be longer than 220 ms.
As the ERASE pin integrates a permanent pull-down, it can be left unconnected during normal operation. However, it is
safer to connect it directly to GND for the final application.
8.5.5Non-volatile Brownout Detector Control
Two general purpose NVM (GPNVM) bits are used for controlling the brownout detector (BOD), so that even after a
power loss, the brownout detector operations remain in their state.
These two GPNVM bits can be cleared or set respectively through the commands “Clear General-purpose NVM Bit” and
“Set General-purpose NVM Bit” of the EFC User Interface.
GPNVM Bit 0 is used as a brownout detector enable bit. Setting the GPNVM Bit 0 enables the BOD, clearing it
disables the BOD. Asserting ERASE clears the GPNVM Bit 0 and thus disables the brownout detector by default.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
21
The GPNVM Bit 1 is used as a brownout reset enable signal for the reset controller. Setting the GPNVM Bit 1
enables the brownout reset when a brownout is detected, Clearing the GPNVM Bit 1 disables the brownout reset.
Asserting ERASE disables the brownout reset by default.
8.5.6Calibration Bits
Eight NVM bits are used to calibrate the brownout detector and the voltage regulator. These bits are factory configured
and cannot be changed by the user. The ERASE pin has no effect on the calibration bits.
8.6Fast Flash Programming Interface
The Fast Flash Programming Interface allows programming the device through either a serial JTAG interface or through
a multiplexed fully-handshaked parallel port. It allows gang-programming with market-standard industrial programmers.
The FFPI supports read, page program, page erase, full erase, lock, unlock and protect commands.
The Fast Flash Programming Interface is enabled and the Fast Programming Mode is entered when the TST pin and the
PA0 and PA1 pins are all tied high.
8.7SAM-BA Boot Assistant
The SAM-BA Boot Assistant is a default Boot Program that provides an easy way to program in-situ the on-chip Flash
memory.
The SAM-BA Boot Assistant supports serial communication via the DBGU or the USB Device Port.
Communication via the DBGU supports a wide range of crystals from 3 to 20 MHz via software auto-detection.
Communication via the USB Device Port is limited to an 18.432 MHz crystal.
The SAM-BA Boot provides an interface with SAM-BA Graphic User Interface (GUI).
The SAM-BA Boot is in ROM and is mapped at address 0x0 when the GPNVM Bit 2 is set to 0.
When GPNVM bit 2 is set to 1, the device boots from the Flash.
When GPNVM bit 2 is set to 0, the device boots from ROM (SAM-BA).
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
22
9.System Controller
The System Controller manages all vital blocks of the microcontroller: interrupts, clocks, power, time, debug and reset.
The System Controller peripherals are all mapped to the highest 4 Kbytes of address space, between addresses 0xFFFF
F000 and 0xFFFF FFFF.
Figure 9-1 on page 24 shows the System Controller Block Diagram.
Figure 8-1 on page 18 shows the mapping of the User Interface of the System Controller peripherals. Note that the
Memory Controller configuration user interface is also mapped within this address space.
Based on one power-on reset cell and one brownout detector
Status of the last reset, either Power-up Reset, Software Reset, User Reset, Watchdog Reset, Brownout Reset
Controls the internal resets and the NRST pin output
Allows to shape a signal on the NRST line, guaranteeing that the length of the pulse meets any requirement.
9.1.1Brownout Detector and Power-on Reset
The SAM7X512/256/128 embeds one brownout detection circuit and a power-on reset cell. The power-on reset is
supplied with and monitors VDDCORE.
Both signals are provided to the Flash to prevent any code corruption during power-up or power-down sequences or if
brownouts occur on the power supplies.
The power-on reset cell has a limited-accuracy threshold at around 1.5V. Its output remains low during power-up until
VDDCORE goes over this voltage level. This signal goes to the reset controller and allows a full re-initialization of the
device.
The brownout detector monitors the VDDCORE and VDDFLASH levels during operation by comparing them to a fixed
trigger level. It secures system operations in the most difficult environments and prevents code corruption in case of
brownout on the VDDCORE or VDDFLASH.
When the brownout detector is enabled and VDDCORE decreases to a value below the trigger level (Vbot18-, defined as
Vbot18 - hyst/2), the brownout output is immediately activated.
When VDDCORE increases above the trigger level (Vbot18+, defined as Vbot18 + hyst/2), the reset is released. The
brownout detector only detects a drop if the voltage on VDDCORE stays below the threshold voltage for longer than
about 1µs.
The VDDCORE threshold voltage has a hysteresis of about 50 mV, to ensure spike free brownout detection. The typical
value of the brownout detector threshold is 1.68V with an accuracy of ± 2% and is factory calibrated.
When the brownout detector is enabled and VDDFLASH decreases to a value below the trigger level (Vbot33-, defined
as Vbot33 - hyst/2), the brownout output is immediately activated.
When VDDFLASH increases above the trigger level (Vbot33+, defined as Vbot33 + hyst/2), the reset is released. The
brownout detector only detects a drop if the voltage on VDDCORE stays below the threshold voltage for longer than
about 1µs.
The VDDFLASH threshold voltage has a hysteresis of about 50 mV, to ensure spike free brownout detection. The typical
value of the brownout detector threshold is 2.80V with an accuracy of ± 3.5% and is factory calibrated.
The brownout detector is low-power, as it consumes less than 28 µA static current. However, it can be deactivated to
save its static current. In this case, it consumes less than 1µA. The deactivation is configured through the GPNVM bit 0 of
the Flash.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
25
9.2Clock Generator
Embedded
RC
Oscillator
Main
Oscillator
PLL and
Divider
Clock Generator
Power
Management
Controller
XIN
XOUT
PLLRC
Slow Clock
SLCK
Main Clock
MAINCK
PLL Clock
PLLCK
Control
Status
The Clock Generator embeds one low-power RC Oscillator, one Main Oscillator and one PLL with the following
characteristics:
RC Oscillator ranges between 22 KHz and 42 KHz
Main Oscillator frequency ranges between 3 and 20 MHz
Main Oscillator can be bypassed
PLL output ranges between 80 and 200 MHz
It provides SLCK, MAINCK and PLLCK.
Figure 9-2.Clock Generator Block Diagram
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
26
9.3Power Management Controller
MCK
periph_clk[2..18]
int
UDPCK
SLCK
MAINCK
PLLCK
Prescaler
/1,/2,/4,...,/64
PCK
Processor
Clock
Controller
Idle Mode
Master Clock Controller
Peripherals
Clock Controller
ON/OFF
USB Clock Controller
ON/OFF
SLCK
MAINCK
PLLCK
Prescaler
/1,/2,/4,...,/64
Programmable Clock Controller
PLLCK
Divider
/1,/2,/4
pck[0..3]
The Power Management Controller uses the Clock Generator outputs to provide:
The Master Clock (MCK) is programmable from a few hundred Hz to the maximum operating frequency of the device.
The Processor Clock (PCK) switches off when entering processor idle mode, thus allowing reduced power consumption
Controls the interrupt lines (nIRQ and nFIQ) of an ARM Processor
Individually maskable and vectored interrupt sources
Source 0 is reserved for the Fast Interrupt Input (FIQ)
Source 1 is reserved for system peripherals (RTT, PIT, EFC, PMC, DBGU, etc.)
Other sources control the peripheral interrupts or external interrupts
Programmable edge-triggered or level-sensitive internal sources
Programmable positive/negative edge-triggered or high/low level-sensitive external sources
8-level Priority Controller
Drives the normal interrupt nIRQ of the processor
Handles priority of the interrupt sources
Higher priority interrupts can be served during service of lower priority interrupt
Vectoring
Optimizes interrupt service routine branch and execution
One 32-bit vector register per interrupt source
Interrupt vector register reads the corresponding current interrupt vector
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
27
Protect Mode
Easy debugging by preventing automatic operations
Fast Forcing
Permits redirecting any interrupt source on the fast interrupt
General Interrupt Mask
Provides processor synchronization on events without triggering an interrupt
9.5Debug Unit
Comprises:
One two-pin UART
One Interface for the Debug Communication Channel (DCC) support
One set of Chip ID Registers
One Interface providing ICE Access Prevention
Two-pin UART
USART-compatible User Interface
Programmable Baud Rate Generator
Parity, Framing and Overrun Error
Automatic Echo, Local Loopback and Remote Loopback Channel Modes
Debug Communication Channel Support
Offers visibility of COMMRX and COMMTX signals from the ARM Processor
Chip ID Registers
Identification of the device revision, sizes of the embedded memories, set of peripherals
Chip ID is 0x275C 0A40 (MRL A) for SAM7X512
Chip ID is 0x275B 0940 (MRL A or B) for SAM7X256
Chip ID is 0x275B 0942 (MRL C) for SAM7X256
Chip ID is 0x275A 0740 (MRL A or B) for SAM7X128
Chip ID is 0x275A 0742 (MRL C) for SAM7X128
9.6Periodic Interval Timer
20-bit programmable counter plus 12-bit interval counter
9.7Watchdog Timer
12-bit key-protected Programmable Counter running on prescaled SLCK
Provides reset or interrupt signals to the system
Counter may be stopped while the processor is in debug state or in idle mode
9.8Real-time Timer
32-bit free-running counter with alarm running on prescaled SLCK
Programmable 16-bit prescaler for SLCK accuracy compensation
9.9PIO Controllers
Two PIO Controllers, each controlling 31 I/O lines
Fully programmable through set/clear registers
Multiplexing of two peripheral functions per I/O line
For each I/O line (whether assigned to a peripheral or used as general-purpose I/O)
Input change interrupt
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
28
Half a clock period glitch filter
Multi-drive option enables driving in open drain
Programmable pull-up on each I/O line
Pin data status register, supplies visibility of the level on the pin at any time
Synchronous output, provides Set and Clear of several I/O lines in a single write
9.10Voltage Regulator Controller
The purpose of this controller is to select the Power Mode of the Voltage Regulator between Normal Mode (bit 0 is
cleared) or Standby Mode (bit 0 is set).
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
29
10.Peripherals
10.1User Interface
The User Peripherals are mapped in the 256 Mbytes of address space between 0xF000 0000 and 0xFFFF EFFF. Each
peripheral is allocated 16 Kbytes of address space.
A complete memory map is provided in Figure 8-1 on page 18.
10.2Peripheral Identifiers
The SAM7X512/256/128 embeds a wide range of peripherals. Table 10-1 defines the Peripheral Identifiers of the
SAM7X512/256/128. Unique peripheral identifiers are defined for both the Advanced Interrupt Controller and the Power
Management Controller.
Table 10-1.Peripheral Identifiers
Peripheral IDPeripheral MnemonicPeripheral Name
0AICAdvanced Interrupt ControllerFIQ
1SYSC
2PIOAParallel I/O Controller A
3PIOBParallel I/O Controller B
4SPI0Serial Peripheral Interface 0
5SPI1Serial Peripheral Interface 1
6US0USART 0
7US1USART 1
8SSCSynchronous Serial Controller
9TWITwo-wire Interface
10PWMCPulse Width Modulation Contro ller
11UDPUSB Device Port
12TC0Timer/Counter 0
13TC1Timer/Counter 1
14TC2Timer/Counter 2
15CANCAN Controller
16EMACEthernet MAC
17ADC
18 - 29Reserved
30AICAdvanced Interrupt ControllerIRQ0
31AICAdvanced Interrupt ControllerIRQ1
(1)
(1)
External
Interrupt
System Controller
Analog-to Digital Converter
Note:1.Setting SYSC and ADC bits in the clock set/clear registers of the PMC has no effect. The System Controller
and ADC are continuously clocked.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
30
10.3Peripheral Multiplexing on PIO Lines
The SAM7X512/256/128 features two PIO controllers, PIOA and PIOB, that multiplex the I/O lines of the peripheral set.
Each PIO Controller controls 31 lines. Each line can be assigned to one of two peripheral functions, A or B. Some of
them can also be multiplexed with the analog inputs of the ADC Controller.
Table 10-2 on page 32 and Table 10-3 on page 33 defines how the I/O lines of the peripherals A, B or the analog inputs
are multiplexed on the PIO Controller A and PIO Controller B. The two columns “Function” and “Comments” have been
inserted for the user’s own comments; they may be used to track how pins are defined in an application.
Note that some peripheral functions that are output only, may be duplicated in the table.
At reset, all I/O lines are automatically configured as input with the programmable pull-up enabled, so that the device is
maintained in a static state as soon as a reset is detected.
DMA Master on Receive and Transmit Channels
Compatible with IEEE Standard 802.3
10 and 100 Mbit/s operation
Full- and half-duplex operation
Statistics Counter Registers
MII/RMII interface to the physical layer
Interrupt generation to signal receive and transmit completion
28-byte transmit FIFO and 28-byte receive FIFO
Automatic pad and CRC generation on transmitted frames
Automatic discard of frames received with errors
Address checking logic supports up to four specific 48-bit addresses
Support Promiscuous Mode where all valid received frames are copied to memory
Hash matching of unicast and multicast destination addresses
Physical layer management through MDIO interface
Half-duplex flow control by forcing collisions on incoming frames
Full-duplex flow control with recognition of incoming pause frames
Support for 802.1Q VLAN tagging with recognition of incoming VLAN and priority tagged frames
Multiple buffers per receive and transmit frame
Jumbo frames up to 10240 bytes supported
10.7Serial Peripheral Interface
Supports communication with external serial devices
Four chip selects with external decoder allow communication with up to 15 peripherals
Serial memories, such as DataFlash
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 per chip select, between consecutive transfers and between clock and data
Programmable delay between consecutive transfers
Selectable mode fault detection
Maximum frequency at up to Master Clock
10.8Two-wire Interface
Master Mode only
Compatibility with I
One, two or three bytes internal address registers for easy Serial Memory access
7-bit or 10-bit slave addressing
Sequential read/write operations
2
C compatible devices (refer to the TWI section of the datasheet)
®
and 3-wire EEPROMs
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
34
10.9USART
Programmable Baud Rate Generator
5- to 9-bit full-duplex synchronous or asynchronous serial communications
RS485 with driver control signal
ISO7816, T = 0 or T = 1 Protocols for interfacing with smart cards
IrDA modulation and demodulation
Test Modes
1, 1.5 or 2 stop bits in Asynchronous Mode
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
Modem Signals Management DTR-DSR-DCD-RI on USART1
Receiver time-out and transmitter timeguard
Multi-drop Mode with address generation and detection
NACK handling, error counter with repetition and iteration limit
Communication at up to 115.2 Kbps
Remote Loopback, Local Loopback, Automatic Echo
10.10 Serial Synchronous Controller
Provides serial synchronous communication links used in audio and telecom applications
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
10.1 1 Timer Counter
Three 16-bit Timer Counter Channels
Two output compare or one input capture per channel
Two multi-purpose input/output signals
Two global registers that act on all three TC channels
10.12 Pulse Width Modulation Controller
Four channels, one 16-bit counter per channel
Common clock generator, providing thirteen different clocks
One 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 selection
Independent period and duty cycle, with double buffering
Programmable selection of the output waveform polarity
Programmable center or left aligned output waveform
10.13 USB Device Port
USB V2.0 full-speed compliant,12 Mbits per second
Embedded USB V2.0 full-speed transceiver
Embedded 1352-byte dual-port RAM for endpoints
Six endpoints
Endpoint 0: 8 bytes
Endpoint 1 and 2: 64 bytes ping-pong
Endpoint 3: 64 bytes
Endpoint 4 and 5: 256 bytes ping-pong
Ping-pong Mode (two memory banks) for bulk endpoints
Suspend/resume logic
10.14 CAN Controller
•Fully compliant with CAN 2.0A and 2.0B
•Bit rates up to 1Mbit/s
•Eight object oriented mailboxes each with the following properties:
CAN Specification 2.0 Part A or 2.0 Part B Programmable for each Message
Object configurable to receive (with overwrite or not) or transmit
Local tag and mask filters up to 29-bit identifier/channel
32-bit access to data registers for each mailbox data object
Uses a 16-bit time stamp on receive and transmit message
Hardware concatenation of ID unmasked bitfields to speedup family ID processing
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
36
16-bit internal timer for time stamping and network synchronization
Programmable reception buffer length up to 8 mailbox objects
Priority management between transmission mailboxes
Autobaud and listening mode
Low power mode and programmable wake-up on bus activity or by the application
Data, remote, error and overload frame handling
10.15 Analog-to-Digital Converter
8-channel ADC
10-bit 384 K samples/sec. Successive Approximation Register ADC
±2 LSB Integral Non Linearity, ±1 LSB Differential Non Linearity
Integrated 8-to-1 multiplexer, offering eight independent 3.3V analog inputs
External voltage reference for better accuracy on low voltage inputs
Individual enable and disable of each channel
Multiple trigger sources
Hardware or software trigger
External trigger pin
Timer Counter 0 to 2 outputs TIOA0 to TIOA2 trigger
Sleep Mode and conversion sequencer
Automatic wakeup on trigger and back to sleep mode after conversions of all enabled channels
Four of eight analog inputs shared with digital signals
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
37
11.ARM7TDMI Processor Overview
11.1Overview
The ARM7TDMI core executes both the 32-bit ARM and 16-bit Thumb instruction sets, allowing the user to trade off
between high performance and high code density.The ARM7TDMI processor implements Von Neuman architecture,
using a three-stage pipeline consisting of Fetch, Decode, and Execute stages.
The main features of the ARM7tDMI processor are:
ARM7TDMI Based on ARMv4T Architecture
Two Instruction Sets
ARM High-performance 32-bit Instruction Set
Thumb High Code Density 16-bit Instruction Set
For further details on ARM7TDMI, refer to the following ARM documents:
ARM Architecture Reference Manual (DDI 0100E)
ARM7TDMI Technical Reference Manual (DDI 0210B)
11.2.1 Instruction Type
Instructions are either 32 bits long (in ARM state) or 16 bits long (in THUMB state).
11.2.2 Data Type
ARM7TDMI supports byte (8-bit), half-word (16-bit) and word (32-bit) data types. Words must be aligned to four-byte
boundaries and half words to two-byte boundaries.
Unaligned data access behavior depends on which instruction is used where.
11.2.3 ARM7TDMI Operating Mode
The ARM7TDMI, based on ARM architecture v4T, supports seven processor modes:
User: The normal ARM program execution state
FIQ: Designed to support high-speed data transfer or channel process
IRQ: Used for general-purpose interrupt handling
Supervisor: Protected mode for the operating system
Abort mode: Implements virtual memory and/or memory protection
System: A privileged user mode for the operating system
Undefined: Supports software emulation of hardware coprocessors
Mode changes may be made under software control, or may be brought about by external interrupts or exception
processing. Most application programs execute in User mode. The non-user modes, or privileged modes, are entered in
order to service interrupts or exceptions, or to access protected resources.
11.2.4 ARM7TDMI Registers
The ARM7TDMI processor has a total of 37registers:
31 general-purpose 32-bit registers
6 status registers
These registers are not accessible at the same time. The processor state and operating mode determine which registers
are available to the programmer.
At any one time 16 registers are visible to the user. The remainder are synonyms used to speed up exception
processing.
Register 15 is the Program Counter (PC) and can be used in all instructions to reference data relative to the current
instruction.
R14 holds the return address after a subroutine call.
R13 is used (by software convention) as a stack pointer.
Registers R0 to R7 are unbanked registers. This means that each of them refers to the same 32-bit physical register in all
processor modes. They are general-purpose registers, with no special uses managed by the architecture, and can be
used wherever an instruction allows a general-purpose register to be specified.
Registers R8 to R14 are banked registers. This means that each of them depends on the current mode of the processor.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
39
Table 11-1.ARM7TDMI ARM Modes and Registers Layout
All exceptions have banked registers for R14 and R13.
After an exception, R14 holds the return address for exception processing. This address is used to return after the
exception is processed, as well as to address the instruction that caused the exception.
R13 is banked across exception modes to provide each exception handler with a private stack pointer.
The fast interrupt mode also banks registers 8 to 12 so that interrupt processing can begin without having to save these
registers.
A seventh processing mode, System Mode, does not have any banked registers. It uses the User Mode registers.
System Mode runs tasks that require a privileged processor mode and allows them to invoke all classes of exceptions.
11.2.4.2Status Registers
All other processor states are held in status registers. The current operating processor status is in the Current Program
Status Register (CPSR). The CPSR holds:
four ALU flags (Negative, Zero, Carry, and Overflow)
two interrupt disable bits (one for each type of interrupt)
one bit to indicate ARM or Thumb execution
five bits to encode the current processor mode
All five exception modes also have a Saved Program Status Register (SPSR) that holds the CPSR of the task
immediately preceding the exception.
Mode-specific banked registers
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
40
11.2.4.3Exception Types
The ARM7TDMI supports five types of exception and a privileged processing mode for each type. The types of exceptions
are:
fast interrupt (FIQ)
normal interrupt (IRQ)
memory aborts (used to implement memory protection or virtual memory)
attempted execution of an undefined instruction
software interrupts (SWIs)
Exceptions are generated by internal and external sources.
More than one exception can occur in the same time.
When an exception occurs, the banked version of R14 and the SPSR for the exception mode are used to save state.
To return after handling the exception, the SPSR is moved to the CPSR, and R14 is moved to the PC. This can be done
in two ways:
by using a data-processing instruction with the S-bit set, and the PC as the destination
by using the Load Multiple with Restore CPSR instruction (LDM)
11.2.5 ARM Instruction Set Overview
The ARM instruction set is divided into:
Branch instructions
Data processing instructions
Status register transfer instructions
Load and Store instructions
Coprocessor instructions
Exception-generating instructions
ARM instructions can be executed conditionally. Every instruction contains a 4-bit condition code field (bit[31:28]).
Table 11-2 gives the ARM instruction mnemonic list.
Table 11-2.ARM Instruction Mnemonic List
MnemonicOperationMnemonicOperation
MOVMoveCDPCoprocessor Data Processing
ADDAddMVNMove Not
SUBSubtractADCAdd with Carry
RSBReverse SubtractSBCSubtract with Carry
CMPCompareRSCReverse Subtract with Carry
TSTTestCMNCompare Negated
ANDLogical ANDTEQTest Equivalence
EORLogical Exclusive ORBICBit Clear
MULMultiplyORRLogical (inclusive) OR
SMULLSign Long MultiplyMLAMultiply Accumulate
SMLALSigned Long Multiply AccumulateUMULLUnsigned Long Multiply
MSRMove to Status RegisterUMLALUnsigned Long Multiply Accumulate
B BranchMRSMove From Status Register
BXBranch and ExchangeBLBranch and Link
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
41
Table 11-2.ARM Instruction Mnemonic List
MnemonicOperationMnemonicOperation
LDRLoad WordSWISoftware Interrupt
LDRSHLoad Signed HalfwordSTRStore Word
LDRSBLoad Signed ByteSTRHStore Half Word
LDRHLoad Half WordSTRBStore Byte
LDRBLoad ByteSTRBTStore Register Byte with Translation
LDRBTLoad Register Byte with TranslationSTRTStore Register with Translation
LDRTLoad Register with TranslationSTMStore Multiple
LDMLoad MultipleSWPBSwap Byte
SWPSwap WordMRCMove From Coprocessor
MCRMove To CoprocessorSTCStore From Coprocessor
LDCLoad To Coprocessor
11.2.6 Thumb Instruction Set Overview
The Thumb instruction set is a re-encoded subset of the ARM instruction set.
The Thumb instruction set is divided into:
Branch instructions
Data processing instructions
Load and Store instructions
Load and Store Multiple instructions
Exception-generating instruction
In Thumb mode, eight general-purpose registers, R0 to R7, are available that are the same physical registers as R0 to
R7 when executing ARM instructions. Some Thumb instructions also access to the Program Counter (ARM Register 15),
the Link Register (ARM Register 14) and the Stack Pointer (ARM Register 13). Further instructions allow limited access
to the ARM registers 8 to 15.
Table 11-3 gives the Thumb instruction mnemonic list.
Table 11-3.Thumb Instruction Mnemonic List
MnemonicOperationMnemonicOperation
MOVMoveMVNMove Not
ADDAddADCAdd with Carry
SUBSubtractSBCSubtract with Carry
CMPCompareCMNCompare Negated
TSTTestNEGNegate
ANDLogical ANDBICBit Clear
EORLog ical Exclusive ORORRLogical (inclusive) OR
LSLLogical Shift LeftLSRLogical Shift Right
ASRArithmetic Shift RightRORRotate Right
MULMultiply
B BranchBLBranch and Link
BXBranch and ExchangeSWISoftware Interrupt
SAM7X Series [DATASHEET]
42
6120K–ATARM–11-Feb-14
Table 11-3.Thumb Instruction Mnemonic List
MnemonicOperationMnemonicOperation
LDRLoad WordSTRStore Word
LDRHLoad Half WordSTRHStore Half Word
LDRBLoad ByteSTRBStore Byte
LDRSHLoad Signed HalfwordLDRSBLoad Signed Byte
LDMIALoad MultipleSTMIAStore Multiple
PUSHPush Register to stackPOPPop Register from stack
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
43
12.Debug and Test Features
ICE
PDC
DBGU
PIO
DRXD
DTXD
TST
TMS
TCK
TDI
JTAGSEL
TDO
Boundary
TAP
ICE/JTAG
TAP
ARM7TDMI
Reset
and
Test
POR
12.1Description
The SAM7X Series features a number of complementary debug and test capabilities. A common JTAG/ICE (In-Circuit
Emulator) port is used for standard debugging functions, such as downloading code and single-stepping through
programs. The Debug Unit provides a two-pin UART that can be used to upload an application into internal SRAM. It
manages the interrupt handling of the internal COMMTX and COMMRX signals that trace the activity of the Debug
Communication Channel.
A set of dedicated debug and test input/output pins gives direct access to these capabilities from a PC-based test
environment.
12.2Block Diagram
Figure 12-1.Debug and Test Block Diagram
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
44
12.3Application Examples
ICE/JTAG
Interface
Host Debugger
ICE/JTAG
Connector
Terminal
RS232
Connector
AT91SAMSxx
AT91SAM7Sxx-based Application Board
12.3.1 Debug Environment
Figure 12-2 shows a complete debug environment example. The ICE/JTAG interface is used for standard debugging
functions, such as downloading code and single-stepping through the program.
Figure 12-2.Application Debug Env iro nment Example
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
45
12.3.2 Test Environment
Tester
JTAG
Interface
ICE/JTAG
Connector
AT91SAM7Xxx-based Application Board In Test
AT91SAM7Xxx
Test Adaptor
Chip 2Chip n
Chip 1
Figure 12-3 shows a test environment example. Test vectors are sent and interpreted by the tester. In this example, the
“board in test” is designed using a number of JTAG-compliant devices. These devices can be connected to form a single
scan chain.
One dedicated pin, TST, is used to define the device operating mode. The user must make sure that this pin is tied at low
level to ensure normal operating conditions. Other values associated with this pin are reserved for manufacturing test.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
46
12.5.2 EmbeddedICE (Embedded In-circuit Emulator)
The ARM7TDMI EmbeddedICE is supported via the ICE/JTAG port. The internal state of the ARM7TDMI is examined
through an ICE/JTAG port.
The ARM7TDMI processor contains hardware extensions for advanced debugging features:
In halt mode, a store-multiple (STM) can be inserted into the instruction pipeline. This exports the contents of the
ARM7TDMI registers. This data can be serially shifted out without affecting the rest of the system.
In monitor mode, the JTAG interface is used to transfer data between the debugger and a simple monitor program
running on the ARM7TDMI processor.
There are three scan chains inside the ARM7TDMI processor that support testing, debugging, and programming of the
EmbeddedICE. The scan chains are controlled by the ICE/JTAG port.
EmbeddedICE mode is selected when JTAGSEL is low. It is not possible to switch directly between ICE and JTAG
operations. A chip reset must be performed after JTAGSEL is changed.
For further details on the EmbeddedICE, see the ARM7TDMI (Rev4) Technical Reference Manual (DDI0210B).
12.5.3 Debug Unit
The Debug Unit provides a two-pin (DXRD and TXRD) USART that can be used for several debug and trace purposes
and offers an ideal means for in-situ programming solutions and debug monitor communication. Moreover, the
association with two peripheral data controller channels permits packet handling of these tasks with processor time
reduced to a minimum.
The Debug Unit also manages the interrupt handling of the COMMTX and COMMRX signals that come from the ICE and
that trace the activity of the Debug Communication Channel. The Debug Unit allows blockage of access to the system
through the ICE interface.
A specific register, the Debug Unit Chip ID Register, gives information about the product version and its internal
configuration.
The SAM7X512 Debug Unit Chip ID value is 0x275C 0A40 on 32-bit width.
The SAM7X256 Debug Unit Chip ID value is 0x275B 0940 on 32-bit width.
The SAM7X128 Debug Unit Chip ID value is 0x275A 0740 on 32-bit width.
For further details on the Debug Unit, see the Debug Unit section.
12.5.4 IEEE 1149.1 JTAG Boundary Scan
IEEE 1149.1 JTAG Boundary Scan allows pin-level access independent of the device packaging technology.
IEEE 1149.1 JTAG Boundary Scan is enabled when JTAGSEL is high. The SAMPLE, EXTEST and BYPASS functions
are implemented. In ICE debug mode, the ARM processor responds with a non-JTAG chip ID that identifies the
processor to the ICE system. This is not IEEE 1149.1 JTAG-compliant.
It is not possible to switch directly between JTAG and ICE operations. A chip reset must be performed after JTAGSEL is
changed.
A Boundary-scan Descriptor Language (BSDL) file is provided to set up test.
12.5.4.1JTAG Boundary-scan Register
The Boundary-scan Register (BSR) contains 187 bits that correspond to active pins and associated control signals.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
47
Each SAM7X input/output pin corresponds to a 3-bit register in the BSR. The OUTPUT bit contains data that can be
forced on the pad. The INPUT bit facilitates the observability of data applied to the pad. The CONTROL bit selects the
direction of the pad.
Set to 0x01F.
Bit[0] Required by IEEE Std. 1149.1.
Set to 0x1.
AT91SAM7X512: JTAG ID Code value is 05B1_803F
AT91SAM7X256: JTAG ID Code value is 05B1_703F
AT91SAM7X128: JTAG ID Code value is 05B1_603F
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
54
13.Reset Controller (RSTC)
NRST
Startup
Counter
proc_nreset
wd_fault
periph_nreset
SLCK
Reset
State
Manager
Reset Controller
brown_out
bod_rst_en
rstc_irq
NRST
Manager
exter_nreset
nrst_out
Main Supply
POR
WDRPROC
user_reset
Brownout
Manager
bod_reset
The Reset Controller (RSTC), based on power-on reset cells, handles all the resets of the system without any external
components. It reports which reset occurred last.
The Reset Controller also drives independently or simultaneously the external reset and the peripheral and processor
resets.
A brownout detection is also available to prevent the processor from falling into an unpredictable state.
13.1Block Diagram
Figure 13-1.Reset Controller Block Diagram
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
55
13.2Functional Description
External Reset Timer
URSTS
URSTEN
ERSTL
exter_nreset
URSTIEN
RSTC_MR
RSTC_MR
RSTC_MR
RSTC_SR
NRSTL
nrst_out
NRST
rstc_irq
Other
interrupt
sources
user_reset
13.2.1 Reset Controller Overview
The Reset Controller is made up of an NRST Manager, a Brownout Manager, a Startup Counter and a Reset State
Manager. It runs at Slow Clock and generates the following reset signals:
proc_nreset: Processor reset line. It also resets the Watchdog Timer.
periph_nreset: Affects the whole set of embedded peripherals.
nrst_out: Drives the NRST pin.
These reset signals are asserted by the Reset Controller, either on external events or on software action. The Reset
State Manager controls the generation of reset signals and provides a signal to the NRST Manager when an assertion of
the NRST pin is required.
The NRST Manager shapes the NRST assertion during a programmable time, thus controlling external device resets.
The startup counter waits for the complete crystal oscillator startup. The wait delay is given by the crystal oscillator
startup time maximum value that can be found in the section Crystal Oscillator Characteristics in the Electrical
Characteristics section of the product documentation.
13.2.2 NRST Manager
The NRST Manager samples the NRST input pin and drives this pin low when required by the Reset State Manager.
Figure 13-2 shows the block diagram of the NRST Manager.
Figure 13-2.NRST Manager
13.2.2.1NRST Signal or Interrupt
The NRST Manager samples the NRST pin at Slow Clock speed. When the line is detected low, a User Reset is reported
to the Reset State Manager.
However, the NRST Manager can be programmed to not trigger a reset when an assertion of NRST occurs. Writing the
bit URSTEN at 0 in RSTC_MR disables the User Reset trigger.
The level of the pin NRST can be read at any time in the bit NRSTL (NRST level) in RSTC_SR. As soon as the pin NRST
is asserted, the bit URSTS in RSTC_SR is set. This bit clears only when RSTC_SR is read.
The Reset Controller can also be programmed to generate an interrupt instead of generating a reset. To do so, the bit
URSTIEN in RSTC_MR must be written at 1.
13.2.2.2NRST External Reset Control
The Reset State Manager asserts the signal ext_nreset to assert the NRST pin. When this occurs, the “nrst_out” signal is
driven low by the NRST Manager for a time programmed by the field ERSTL in RSTC_MR. This assertion duration,
named EXTERNAL_RESET_LENGTH, lasts 2
assertion between 60 µs and 2 seconds. Note that ERSTL at 0 defines a two-cycle duration for the NRST pulse.
(ERSTL+1)
Slow Clock cycles. This gives the approximate duration of an
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
56
This feature allows the Reset Controller to shape the NRST pin level, and thus to guarantee that the NRST line is driven
rstc_irq
brown_out
bod_reset
bod_rst_en
BODIEN
RSTC_MR
BODSTS
RSTC_SR
Other
interrupt
sources
low for a time compliant with potential external devices connected on the system reset.
13.2.3 Brownout Manager
Brownout detection prevents the processor from falling into an unpredictable state if the power supply drops below a
certain level. When VDDCORE drops below the brownout threshold, the brownout manager requests a brownout reset
by asserting the bod_reset signal.
The programmer can disable the brownout reset by setting low the bod_rst_en input signal, i.e.; by locking the
corresponding general-purpose NVM bit in the Flash. When the brownout reset is disabled, no reset is performed.
Instead, the brownout detection is reported in the bit BODSTS of RSTC_SR. BODSTS is set and clears only when
RSTC_SR is read.
The bit BODSTS can trigger an interrupt if the bit BODIEN is set in the RSTC_MR.
At factory, the brownout reset is disabled.
Figure 13-3.Brownout Manager
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
57
13.2.4 Reset States
SLCK
periph_nreset
proc_nreset
Main Supply
POR output
NRST
(nrst_out)
EXTERNAL RESET LENGTH
= 2 cycles
Startup Time
MCK
Processor Startup
= 3 cycles
Any
Freq.
The Reset State Manager handles the different reset sources and generates the internal reset signals. It reports the reset
status in the field RSTTYP of the Status Register (RSTC_SR). The update of the field RSTTYP is performed when the
processor reset is released.
13.2.4.1Power-up Reset
When VDDCORE is powered on, the Main Supply POR cell output is filtered with a start-up counter that operates at Slow
Clock. The purpose of this counter is to ensure that the Slow Clock oscillator is stable before starting up the device.
The startup time, as shown in Figure 13-4, is hardcoded to comply with the Slow Clock Oscillator startup time. After the
startup time, the reset signals are released and the field RSTTYP in RSTC_SR reports a Power-up Reset.
When VDDCORE is detected low by the Main Supply POR Cell, all reset signals are asserted immediately.
Figure 13-4.Power-up Reset
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
58
13.2.4.2User Reset
SLCK
periph_nreset
proc_nreset
NRST
NRST
(nrst_out)
>= EXTERNAL RESET LENGTH
MCK
Processor Startup
= 3 cycles
Any
Freq.
Resynch.
2 cycles
RSTTYP
AnyXXX
Resynch.
2 cycles
0x4 = User Reset
The User Reset is entered when a low level is detected on the NRST pin and the bit URSTEN in RSTC_MR is at 1. The
NRST input signal is resynchronized with SLCK to insure proper behavior of the system.
The User Reset is entered as soon as a low level is detected on NRST. The Processor Reset and the Peripheral Reset
are asserted.
The User Reset is left when NRST rises, after a two-cycle resynchronization time and a three-cycle processor startup.
The processor clock is re-enabled as soon as NRST is confirmed high.
When the processor reset signal is released, the RSTTYP field of the Status Register (RSTC_SR) is loaded with the
value 0x4, indicating a User Reset.
The NRST Manager guarantees that the NRST line is asserted for EXTERNAL_RESET_LENGTH Slow Clock cycles, as
programmed in the field ERSTL. However, if NRST does not rise after EXTERNAL_RESET_LENGTH because it is
driven low externally, the internal reset lines remain asserted until NRST actually rises.
Figure 13-5.User Reset State
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
59
13.2.4.3Brownout Reset
SLCK
periph_nreset
proc_nreset
brown_out
or bod_reset
NRST
(nrst_out)
EXTERNAL RESET LENGTH
8 cycles (ERSTL=2)
MCK
Processor Startup
= 3 cycles
Any
Freq.
RSTTYP
Any
XXX
0x5 = Brownout Reset
Resynch.
2 cycles
When the brown_out/bod_reset signal is asserted, the Reset State Manager immediately enters the Brownout Reset. In
this state, the processor, the peripheral and the external reset lines are asserted.
The Brownout Reset is left 3Slow Clock cycles after the rising edge of brown_out/bod_reset after a two-cycle
resynchronization. An external reset is also triggered.
When the processor reset is released, the field RSTTYP in RSTC_SR is loaded with the value 0x5, thus indicating that
the last reset is a Brownout Reset.
Figure 13-6.Brownout Reset State
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
60
13.2.4.4Software Reset
SLCK
periph_nreset
if PERRST=1
proc_nreset
if PR
OCRST=1
Wr
ite RSTC_CR
NRST
(nrst_out)
if EXTRST=1
EXTERNAL RESET LENGTH
8 cycles (ERSTL=2)
MCK
Processor Startup
= 3 cycles
Any
Freq.
RSTTYP
Any
XXX
0x3 = Software Reset
Resynch.
1 cycle
SRCMP in RSTC_SR
The Reset Controller offers several commands used to assert the different reset signals. These commands are
performed by writing the Control Register (RSTC_CR) with the following bits at 1:
PROCRST: Writing PROCRST at 1 resets the processor and the watchdog timer.
PERRST: Writing PERRST at 1 resets all the embedded peripherals, including the memory system, and, in
particular, the Remap Command. The Peripheral Reset is generally used for debug purposes.
Except for Debug purposes, PERRST must always be used in conjuction with PROCRST (PERRST and
PROCRST set both at 1 simultaneously).
EXTRST: Writing EXTRST at 1 asserts low the NRST pin during a time defined by the field ERSTL in the Mode
Register (RSTC_MR).
The software reset is entered if at least one of these bits is set by the software. All these commands can be performed
independently or simultaneously. The software reset lasts 3 Slow Clock cycles.
The internal reset signals are asserted as soon as the register write is performed. This is detected on the Master Clock
(MCK). They are released when the software reset is left, i.e.; synchronously to SLCK.
If EXTRST is set, the nrst_out signal is asserted depending on the programming of the field ERSTL. However, the
resulting falling edge on NRST does not lead to a User Reset.
If and only if the PROCRST bit is set, the Reset Controller reports the software status in the field RSTTYP of the Status
Register (RSTC_SR). Other Software Resets are not reported in RSTTYP.
As soon as a software operation is detected, the bit SRCMP (Software Reset Command in Progress) is set in the Status
Register (RSTC_SR). It is cleared as soon as the software reset is left. No other software reset can be performed while
the SRCMP bit is set, and writing any value in RSTC_CR has no effect.
Figure 13-7.Software Reset
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
61
13.2.4.5Watchdog Reset
Only if
WDRPROC = 0
SLCK
periph_nreset
proc_nreset
wd_fault
NRST
(nrst_out)
EXTERNAL RESET LENGTH
8 cycles (ERSTL=2)
MCK
Processor Startup
= 3 cycles
Any
Freq.
RSTTYP
AnyXXX
0x2 = Watchdog Reset
The Watchdog Reset is entered when a watchdog fault occurs. This state lasts 3Slow Clock cycles.
When in Watchdog Reset, assertion of the reset signals depends on the WDRPROC bit in WDT_MR:
If WDRPROC is 0, the Processor Reset and the Peripheral Reset are asserted. The NRST line is also asserted,
depending on the programming of the field ERSTL. However, the resulting low level on NRST does not result in a
User Reset state.
If WDRPROC = 1, only the processor reset is asserted.
The Watchdog Timer is reset by the proc_nreset signal. As the watchdog fault always causes a processor reset if
WDRSTEN is set, the Watchdog Timer is always reset after a Watchdog Reset, and the Watchdog is enabled by default
and with a period set to a maximum.
When the WDRSTEN in WDT_MR bit is reset, the watchdog fault has no impact on the reset controller.
Figure 13-8.Watchdog Reset
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
62
13.2.5 Reset State Priorities
The Reset State Manager manages the following priorities between the different reset sources, given in descending
order:
A watchdog event is impossible because the Watchdog Timer is being reset by the proc_nreset signal.
A software reset is impossible, since the processor reset is being activated.
When in Software Reset:
A watchdog event has priority over the current state.
The NRST has no effect.
When in Watchdog Reset:
The processor reset is active and so a Software Reset cannot be programmed.
A User Reset cannot be entered.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
63
13.2.6 Reset Controller Status Register
MCK
NRST
NRSTL
2 cycle
resynchronization
2 cycle
resynchronization
URSTS
read
RSTC_SR
Peripheral Access
rstc_irq
if (URSTEN = 0) and
(URSTIEN = 1)
The Reset Controller status register (RSTC_SR) provides several status fields:
RSTTYP field: This field gives the type of the last reset, as explained in previous sections.
SRCMP bit: This field indicates that a Software Reset Command is in progress and that no further software reset
should be performed until the end of the current one. This bit is automatically cleared at the end of the current
software reset.
NRSTL bit: The NRSTL bit of the Status Register gives the level of the NRST pin sampled on each MCK rising
edge.
URSTS bit: A high-to-low transition of the NRST pin sets the URSTS bit of the RSTC_SR register. This transition is
also detected on the Master Clock (MCK) rising edge (see Figure 13-9). If the User Reset is disabled (URSTEN =
0) and if the interruption is enabled by the URSTIEN bit in the RSTC_MR register, the URSTS bit triggers an
interrupt. Reading the RSTC_SR status register resets the URSTS bit and clears the interrupt.
BODSTS bit: This bit indicates a brownout detection when the brownout reset is disabled (bod_rst_en = 0). It
triggers an interrupt if the bit BODIEN in the RSTC_MR register enables the interrupt. Reading the RSTC_SR
register resets the BODSTS bit and clears the interrupt.
Figure 13-9. Reset Controller Status and Interrupt
0 = No effect.
1 = If KEY is correct, resets the processor.
• PERRST: Peripheral Reset
0 = No effect.
1 = If KEY is correct, resets the peripherals.
• EXTRST: External Reset
0 = No effect.
1 = If KEY is correct, asserts the NRST pin.
•KEY: Password
Should be written at value 0xA5. Writing any other value in this field aborts the write operation.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
66
13.3.2 Reset Controller Status Register
Register Name:RSTC_SR
Access Type:Read-only
3130292827262524
––––––––
2322212019181716
––––––SRCMPNRSTL
15141312111098
–––––RSTTYP
76543210
––––––BODSTSURSTS
• URSTS: User Reset Status
0 = No high-to-low edge on NRST happened since the last read of RSTC_SR.
1 = At least one high-to-low transition of NRST has been detected since the last read of RSTC_SR.
• BODSTS: Brownout Detection Status
0 = No brownout high-to-low transition happened since the last read of RSTC_SR.
1 = A brownout high-to-low transition has been detected since the last read of RSTC_SR.
• RSTTYP: Reset Type
Reports the cause of the last processor reset. Reading this RSTC_SR does not reset this field.
Registers the NRST Pin Level at Master Clock (MCK).
• SRCMP: Software Reset Command in Progress
0 = No software command is being performed by the reset controller. The reset controller is ready for a software command.
1 = A software reset command is being performed by the reset controller. The reset controller is busy.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
67
13.3.3 Reset Controller Mode Register
Register Name:RSTC_MR
Access Type:Read-write
3130292827262524
KEY
2322212019181716
–––––––BODIEN
15141312111098
––––ERSTL
76543210
––URSTIEN–––URSTEN
• URSTEN: User Reset Enable
0 = The detection of a low level on the pin NRST does not generate a User Reset.
1 = The detection of a low level on the pin NRST triggers a User Reset.
• URSTIEN: User Reset Interrupt Enable
0 = USRTS bit in RSTC_SR at 1 has no effect on rstc_irq.
1 = USRTS bit in RSTC_SR at 1 asserts rstc_irq if URSTEN = 0.
• BODIEN: Brownout Detection Interrupt Enable
0 = BODSTS bit in RSTC_SR at 1 has no effect on rstc_irq.
1 = BODSTS bit in RSTC_SR at 1 asserts rstc_irq.
• ERSTL: External Reset Length
This field defines the external reset length. The external reset is asserted during a time of 2
(ERSTL+1)
allows assertion duration to be programmed between 60 µs and 2 seconds.
•KEY: Password
Should be written at value 0xA5. Writing any other value in this field aborts the write operation.
Slow Clock cycles. This
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
68
14.Real-time Timer (RTT)
SLCK
RTPRES
RTTINC
ALMS
16-bit
Divider
32-bit
Counter
ALMV
=
CRTV
RTT_MR
RTT_VR
RTT_AR
RTT_SR
RTTINCIEN
RTT_MR
0
10
ALMIEN
rtt_int
RTT_MR
set
set
RTT_SR
read
RTT_SR
reset
reset
RTT_MR
reload
rtt_alarm
RTTRST
RTT_MR
RTTRST
14.1Overview
The Real-time Timer is built around a 32-bit counter and used to count elapsed seconds. It generates a periodic interrupt
or/and triggers an alarm on a programmed value.
14.2Block Diagram
Figure 14-1.Real-time Timer
14.3Functional Description
The Real-time Timer is used to count elapsed seconds. It is built around a 32-bit counter fed by Slow Clock divided by a
programmable 16-bit value. The value can be programmed in the field RTPRES of the Real-time Mode Register
(RTT_MR).
ProgrammingRTPRESat 0x00008000 corresponds to feeding the real-time counter with a 1 Hz signal (if the Slow Clock
is 32.768 Hz). The 32-bit counter can count up to 2
The Real-time Timer can also be used as a free-running timer with a lower time-base. The best accuracy is achieved by
writing RTPRES to 3. Programming RTPRES to 1 or 2 is possible, but may result in losing status events because the
status register is cleared two Slow Clock cycles after read. Thus if the RTT is configured to trigger an interrupt, the
interrupt occurs during 2 Slow Clock cycles after reading RTT_SR. To prevent several executions of the interrupt
handler, the interrupt must be disabled in the interrupt handler and re-enabled when the status register is clear.
The Real-time Timer value (CRTV) can be read at any time in the register RTT_VR (Real-time Value Register). As this
value can be updated asynchronously from the Master Clock, it is advisable to read this register twice at the same value
to improve accuracy of the returned value.
32
seconds, corresponding to more than 136 years, then roll over to 0.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
69
The current value of the counter is compared with the value written in the alarm register RTT_AR (Real-time Alarm
Prescaler
ALMVALMV-10ALMV+1
0
RTPRES - 1
RTT
APB cycle
read RTT_SR
ALMS (RTT_SR)
APB Interface
MCK
RTTINC (RTT_SR)
ALMV+2ALMV+3
...
APB cycle
Register). If the counter value matches the alarm, the bit ALMS in RTT_SR is set. The alarm register is set to its
maximum value, corresponding to 0xFFFF_FFFF, after a reset.
The bit RTTINC in RTT_SR is set each time the Real-time Timer counter is incremented. This bit can be used to start a
periodic interrupt, the period being one second when the RTPRES is programmed with 0x8000 and Slow Clock equal to
32.768 Hz.
Reading the RTT_SR status register resets the RTTINC and ALMS fields.
Writing the bit RTTRST in RTT_MR immediately reloads and restarts the clock divider with the new programmed value.
This also resets the 32-bit counter.
Note:Because of the asynchronism between the Slow Clock (SCLK) and the System Clock (MCK):
1) The restart of the counter and the reset of the RTT_VR current value register is effective only 2 slow clock
cycles after the write of the RTTRST bit in the RTT_MR register.
2) The status register flags reset is taken into account only 2 slow clock cycles after the read of the RTT_SR
(Status Register).
Figure 14-2.RTT Counting
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
70
14.4Real-time Timer (RTT) User Interface
T able 14-1. Register Mapping
OffsetRegister NameAccess Reset Value
0x00Mode RegisterRTT_MRRead-write0x0000_8000
0x04Alarm RegisterRTT_ARRead-write0xFFFF_FFFF
0x08V a lue RegisterRTT_VRRead-only0x0000_0000
0x0CStatus RegisterRTT_SRRead-only0x0000_0000
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
71
14.4.1 Real-time Timer Mode Register
Register Name: RTT_MR
Access Type: Read-write
3130292827262524
––––––––
2322212019181716
–––––RTTRSTRTTINCIENALMIEN
15141312111098
RTPRES
76543210
RTPRES
• RTPRES: Real-time Timer Prescaler Value
Defines the number of SLCK periods required to increment the real-time timer. RTPRES is defined as follows:
RTPRES = 0: The Prescaler Period is equal to 2
16
RTPRES ≠ 0: The Prescaler Period is equal to RTPRES.
• ALMIEN: Alarm Interrupt Enable
0 = The bit ALMS in RTT_SR has no effect on interrupt.
1 = The bit ALMS in RTT_SR asserts interrupt.
0 = The bit RTTINC in RTT_SR has no effect on interrupt.
1 = The bit RTTINC in RTT_SR asserts interrupt.
• RTTRST: Real-time Timer Restart
1 = Reloads and restarts the clock divider with the new programmed value. This also resets the 32-bit counter.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
72
14.4.2 Real-time Timer Alarm Register
Register Name: RTT_AR
Access Type: Read-write
3130292827262524
ALMV
2322212019181716
ALMV
15141312111098
ALMV
76543210
ALMV
• ALMV: Alarm Value
Defines the alarm value (ALMV+1) compared with the Real-time Timer.
14.4.3 Real-time Timer Value Register
Register Name: RTT_VR
Access Type: Read-only
3130292827262524
CRTV
2322212019181716
CRTV
15141312111098
CRTV
76543210
CRTV
• CRTV: Current Real-time Value
Returns the current value of the Real-time Timer.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
73
14.4.4 Real-time Timer Status Register
Register Name: RTT_SR
Access Type: Read-only
3130292827262524
––––––––
2322212019181716
––––––––
15141312111098
––––––––
76543210
––––––RTTINCALMS
• ALMS: Real-time Alarm Status
0 = The Real-time Alarm has not occurred since the last read of RTT_SR.
1 = The Real-time Alarm occurred since the last read of RTT_SR.
• RTTINC: Real-time Timer Increment
0 = The Real-time Timer has not been incremented since the last read of the RTT_SR.
1 = The Real-time Timer has been incremented since the last read of the RTT_SR.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
74
15.Periodic Interval Timer (PIT)
20-bit
Counter
MCK/16
PIV
PIT_MR
CPIV
PIT_PIVR
PICNT
12-bit
Adder
0
0
read PIT_PIVR
CPIVPICNT
PIT_PIIR
PITS
PIT_SR
set
reset
PITIEN
PIT_MR
pit_irq
1
0
10
MCK
Prescaler
= ?
15.1Overview
The Periodic Interval Timer (PIT) provides the operating system’s scheduler interrupt. It is designed to offer maximum
accuracy and efficient management, even for systems with long response time.
15.2Block Diagram
Figure 15-1.Periodic Interval Timer
SAM7X Series [DATASHEET]
75
6120K–ATARM–11-Feb-14
15.3Functional Description
MCK Prescaler
PIVPIV - 10
PITEN
10
0
15
CPIV
1
restarts MCK Prescaler
0
1
APB cycle
read PIT_PIVR
0
PICNT
PITS (PIT_SR)
MCK
APB Interface
APB cycle
The Periodic Interval Timer aims at providing periodic interrupts for use by operating systems.
The PIT provides a programmable overflow counter and a reset-on-read feature. It is built around two counters: a 20-bit
CPIV counter and a 12-bit PICNT counter. Both counters work at Master Clock /16.
The first 20-bit CPIV counter increments from 0 up to a programmable overflow value set in the field PIV of the Mode
Register (PIT_MR). When the counter CPIV reaches this value, it resets to 0 and increments the Periodic Interval
Counter, PICNT. The status bit PITS in the Status Register (PIT_SR) rises and triggers an interrupt, provided the
interrupt is enabled (PITIEN in PIT_MR).
Writing a new PIV value in PIT_MR does not reset/restart the counters.
When CPIV and PICNT values are obtained by reading the Periodic Interval Value Register (PIT_PIVR), the overflow
counter (PICNT) is reset and the PITS is cleared, thus acknowledging the interrupt. The value of PICNT gives the
number of periodic intervals elapsed since the last read of PIT_PIVR.
When CPIV and PICNT values are obtained by reading the Periodic Interval Image Register (PIT_PIIR), there is no effect
on the counters CPIV and PICNT, nor on the bit PITS. For example, a profiler can read PIT_PIIR without clearing any
pending interrupt, whereas a timer interrupt clears the interrupt by reading PIT_PIVR.
The PIT may be enabled/disabled using the PITEN bit in the PIT_MR register (disabled on reset). The PITEN bit only
becomes effective when the CPIV value is 0. Figure 15-2 illustrates the PIT counting. After the PIT Enable bit is reset
(PITEN= 0), the CPIV goes on counting until the PIV value is reached, and is then reset. PIT restarts counting, only if the
PITEN is set again.
The PIT is stopped when the core enters debug state.
0 = The bit PITS in PIT_SR has no effect on interrupt.
1 = The bit PITS in PIT_SR asserts interrupt.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
78
15.4.2 Periodic Interval Timer Status Register
Register Name: PIT_SR
Access Type: Read-only
3130292827262524
––––––––
2322212019181716
––––––––
15141312111098
––––––––
76543210
–––––––PITS
• PITS: Periodic Interval Timer Status
0 = The Periodic Interval timer has not reached PIV since the last read of PIT_PIVR.
1 = The Periodic Interval timer has reached PIV since the last read of PIT_PIVR.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
79
15.4.3 Periodic Interval Timer Value Register
Register Name: PIT_PIVR
Access Type: Read-only
3130292827262524
PICNT
2322212019181716
PICNTCPIV
15141312111098
CPIV
76543210
CPIV
Reading this register clears PITS in PIT_SR.
• CPIV: Current Periodic Interval Value
Returns the current value of the periodic interval timer.
• PICNT: Periodic Interval Counter
Returns the number of occurrences of periodic intervals since the last read of PIT_PIVR.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
80
15.4.4 Periodic Interval Timer Image Register
Register Name: PIT_PIIR
Access Type: Read-only
3130292827262524
PICNT
2322212019181716
PICNTCPIV
15141312111098
CPIV
76543210
CPIV
• CPIV: Current Periodic Interval Value
Returns the current value of the periodic interval timer.
• PICNT: Periodic Interval Counter
Returns the number of occurrences of periodic intervals since the last read of PIT_PIVR.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
81
16.Watchdog Timer (WDT)
=
0
10
set
reset
read WDT_SR
or
reset
wdt_fault
(to Reset Controller)
set
reset
WDFIEN
wdt_int
WDT_MR
SLCK
1/128
12-bit Down
Counter
Current
Value
WDD
WDT_MR
<= WDD
WDV
WDRSTT
WDT_MR
WDT_CR
reload
WDUNF
WDERR
reload
write WDT_MR
WDT_MR
WDRSTEN
16.1Overview
The Watchdog Timer can be used to prevent system lock-up if the software becomes trapped in a deadlock. It features a
12-bit down counter that allows a watchdog period of up to 16 seconds (slow clock at 32.768 kHz). It can generate a
general reset or a processor reset only. In addition, it can be stopped while the processor is in debug mode or idle mode.
16.2Block Diagram
Figure 16-1.Watchdog Timer Block Diagram
SAM7X Series [DATASHEET]
82
6120K–ATARM–11-Feb-14
16.3Functional Description
The Watchdog Timer can be used to prevent system lock-up if the software becomes trapped in a deadlock. It is supplied
with VDDCORE. It restarts with initial values on processor reset.
The Watchdog is built around a 12-bit down counter, which is loaded with the value defined in the field WV of the Mode
Register (WDT_MR). The Watchdog Timer uses the Slow Clock divided by 128 to establish the maximum Watchdog
period to be 16 seconds (with a typical Slow Clock of 32.768 kHz).
After a Processor Reset, the value of WV is 0xFFF, corresponding to the maximum value of the counter with the external
reset generation enabled (field WDRSTEN at 1 after a Backup Reset). This means that a default Watchdog is running at
reset, i.e., at power-up. The user must either disable it (by setting the WDDIS bit in WDT_MR) if he does not expect to
use it or must reprogram it to meet the maximum Watchdog period the application requires.
The Watchdog Mode Register (WDT_MR) can be written only once. Only a processor reset resets it. Writing the
WDT_MR register reloads the timer with the newly programmed mode parameters.
If the watchdog is restarted by writing into the WDT_CR register, the WDT_MR register must not be programmed
during a period of time of 3 slow clock period following the WDT_CR write access. In any case, programming a
new value in WDT_MR automatically initiates a restart instruction.
In normal operation, the user reloads the Watchdog at regular intervals before the timer underflow occurs, by writing the
Control Register (WDT_CR) with the bit WDRSTT to 1. The Watchdog counter is then immediately reloaded from
WDT_MR and restarted, and the Slow Clock 128 divider is reset and restarted. The WDT_CR register is write-protected.
As a result, writing WDT_CR without the correct hard-coded key has no effect. If an underflow does occur, the “wdt_fault”
signal to the Reset Controller is asserted if the bit WDRSTEN is set in the Mode Register (WDT_MR). Moreover, the bit
WDUNF is set in the Watchdog Status Register (WDT_SR).
To prevent a software deadlock that continuously triggers the Watchdog, the reload of the Watchdog must occur while
the Watchdog counter is within a window between 0 and WDD, WDD is defined in the WatchDog Mode Register
WDT_MR.
Any attempt to restart the Watchdog while the Watchdog counter is between WDV and WDD results in a Watchdog error,
even if the Watchdog is disabled. The bit WDERR is updated in the WDT_SR and the “wdt_fault” signal to the Reset
Controller is asserted.
Note that this feature can be disabled by programming a WDD value greater than or equal to the WDV value. In such a
configuration, restarting the Watchdog Timer is permitted in the whole range [0; WDV] and does not generate an error.
This is the default configuration on reset (the WDD and WDV values are equal).
The status bits WDUNF (Watchdog Underflow) and WDERR (Watchdog Error) trigger an interrupt, provided the bit
WDFIEN is set in the mode register. The signal “wdt_fault” to the reset controller causes a Watchdog reset if the
WDRSTEN bit is set as already explained in the reset controller programmer Datasheet. In that case, the processor and
the Watchdog Timer are reset, and the WDERR and WDUNF flags are reset.
If a reset is generated or if WDT_SR is read, the status bits are reset, the interrupt is cleared, and the “wdt_fault” signal to
the reset controller is deasserted.
Writing the WDT_MR reloads and restarts the down counter.
While the processor is in debug state or in idle mode, the counter may be stopped depending on the value programmed
for the bits WDIDLEHLT and WDDBGHLT in the WDT_MR.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
83
Figure 16-2.Watchdog Behavior
0
WDV
WDD
WDT_CR = WDRSTT
Watchdog
Fault
Normal behavior
Watchdog Error
Watchdog Underflow
FFF
if WDRSTEN is 1
if WDRSTEN is 0
Forbidden
Window
Permitted
Window
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
84
16.4Watchdog Timer (WDT) User Interface
T able 16-1. Register Mapping
OffsetRegister NameAccess Reset Value
0x00 Control RegisterWDT_CRWrit e-only0x04 Mode RegisterWDT_MRRead-write Once0x3FFF_2FFF
0x08 Status RegisterWDT_SRRead-only0x0000_0000
16.4.1 Watchdog Timer Control Register
Register Name:WDT_CR
Access Type: Write-only
3130292827262524
2322212019181716
––––––––
15141312111098
––––––––
KEY
76543210
–––––––WDRSTT
• WDRSTT: Watchdog Restart
0: No effect.
1: Restarts the Watchdog.
•KEY: Password
Should be written at value 0xA5. Writing any other value in this field aborts the write operation.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
85
16.4.2 Watchdog Timer Mode Register
Register Name: WDT_MR
Access Type: Read-write Once
3130292827262524
––WDIDLEHLTWDDBGHLTWDD
2322212019181716
WDD
15141312111098
WDDIS
76543210
WDRPROCWDRSTENWDFIENWDV
WDV
• WDV: Watchdog Counter Value
Defines the value loaded in the 12-bit Watchdog Counter.
• WDFIEN: Watchdog Fault Interrupt Enable
0: A Watchdog fault (underflow or error) has no effect on interrupt.
1: A Watchdog fault (underflow or error) asserts interrupt.
• WDRSTEN: Watchdog Reset Enable
0: A Watchdog fault (underflow or error) has no effect on the resets.
1: A Watchdog fault (underflow or error) triggers a Watchdog reset.
• WDRPROC: Watchdog Reset Processor
0: If WDRSTEN is 1, a Watchdog fault (underflow or error) activates all resets.
1: If WDRSTEN is 1, a Watchdog fault (underflow or error) activates the processor reset.
• WDD: Watchdog Delta Value
Defines the permitted range for reloading the Watchdog Timer.
If the Watchdog Timer value is less than or equal to WDD, writing WDT_CR with WDRSTT = 1 restarts the timer.
If the Watchdog Timer value is greater than WDD, writing WDT_CR with WDRSTT = 1 causes a Watchdog error.
• WDDBGHLT: Watchdog Debug Halt
0: The Watchdog runs when the processor is in debug state.
1: The Watchdog stops when the processor is in debug state.
• WDIDLEHLT: Watchdog Idle Halt
0: The Watchdog runs when the system is in idle mode.
1: The Watchdog stops when the system is in idle state.
• WDDIS: Watchdog Dis able
0: Enables the Watchdog Timer.
1: Disables the Watchdog Timer.
Note:The WDD and WDV values m ust not be modified within three slow clock periods after a restart of the watchdog performed by a
write access in WDT_CR; otherwise, the watchdog may trigger an end of period earlier than expected.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
86
16.4.3 Watchdog Timer Status Register
Register Name: WDT_SR
Access Type: Read-only
3130292827262524
––––––––
2322212019181716
––––––––
15141312111098
––––––––
76543210
––––––WDERRWDUNF
• WDUNF: Watchdog Underflow
0: No Watchdog underflow occurred since the last read of WDT_SR.
1: At least one Watchdog underflow occurred since the last read of WDT_SR.
• WDERR: Watchdog Error
0: No Watchdog error occurred since the last read of WDT_SR.
1: At least one Watchdog error occurred since the last read of WDT_SR.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
87
17.Voltage Regulator Mode Controller (VREG)
17.1Overview
The Voltage Regulator Mode Controller contains one Read-write register, the Voltage Regulator Mode Register. Its offset
is 0x60 with respect to the System Controller offset.
This register controls the Voltage Regulator Mode. Setting PSTDBY (bit 0) puts the Voltage Regulator in Standby Mode
or Low-power Mode. On reset, the PSTDBY is reset, so as to wake up the Voltage Regulator in Normal Mode.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
88
17.2V oltage Regulator Power Controller (VREG) User Interface
0 = Voltage regulator in normal mode.
1 = Voltage regulator in standby mode (low-power mode).
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
89
18.Memory Controller (MC)
ARM7TDMI
Processor
Bus
Arbiter
Peripheral
DMA
Controller
Memory Controller
Abort
ASB
Abort
Status
Address
Decoder
User
Interface
Peripheral 0
Peripheral 1
Internal
RAM
APB
APB
Bridge
Misalignment
Detector
From Master
to Slave
Peripheral N
Embedded
Flash
Controller
Internal
Flash
EMAC
DMA
18.1Overview
The Memory Controller (MC) manages the ASB bus and controls accesses requested by the masters, typically the ARM7TDMI
processor and the Peripheral DMA Controller. It features a bus arbiter, an address decoder, an abort status, a misalignment
detector and an Embedded Flash Controller.
18.2Block Diagram
Figure 18-1.Memory Controller Block Diagram
18.3Functional Description
The Memory Controller handles the internal ASB bus and arbitrates the accesses of up to three masters.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
90
It is made up of:
0x0000 0000
0x0FFF FFFF
0x1000 0000
0xEFFF FFFF
0xF000 0000
0xFFFF FFFF
256M Bytes
256M Bytes
14 x 256MBytes
3,584 Mbytes
Internal Memories
Undefined
(Abort)
Peripherals
A bus arbiter
An address decoder
An abort status
A misalignment detector
An Embedded Flash Controller
The MC handles only little-endian mode accesses. The masters work in little-endian mode only.
18.3.1 Bus Arbiter
The Memory Controller has a simple, hard-wired priority bus arbiter that gives the control of the bus to one of the three
masters. The EMAC has the highest priority; the Peripheral DMA Controller has the medium priority; the ARM processor
has the lowest one.
18.3.2 Address Decoder
The Memory Controller features an Address Decoder that first decodes the four highest bits of the 32-bit address bus
and defines three separate areas:
One 256-Mbyte address space for the internal memories
One 256-Mbyte address space reserved for the embedded peripherals
An undefined address space of 3584M bytes representing fourteen 256-Mbyte areas that return an Abort if
accessed
Figure 18-2 shows the assignment of the 256-Mbyte memory areas.
18.3.2.1Internal Memory Mapping
Figure 18-2.Memory Areas
Within the Internal Memory address space, the Address Decoder of the Memory Controller decodes eight more address
bits to allocate 1-Mbyte address spaces for the embedded memories.
The allocated memories are accessed all along the 1-Mbyte address space and so are repeated n times within this
address space, n equaling 1M bytes divided by the size of the memory.
When the address of the access is undefined within the internal memory area, the Address Decoder returns an Abort to
the master.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
91
Figure 18-3.Internal Memory Mapping
256M Bytes
Internal Memory Area 0
Undefined Areas
(Abort)
0x000F FFFF
0x001F FFFF
0x002F FFFF
0x0FFF FFFF
1 M Bytes
1 M Bytes
1 M Bytes
252 M Bytes
Internal Memory Area 1
Internal Flash
Internal Memory Area 2
Internal SRAM
0x0000 0000
0x0010 0000
0x0020 0000
0x0030 0000
Internal Memory Area 3
Internal ROM
0x003F FFFF
0x0040 0000
1 M Bytes
18.3.2.2Internal Memory Area 0
The first 32 bytes of Internal Memory Area 0 contain the ARM processor exception vectors, in particular, the Reset
Vector at address 0x0.
Before execution of the remap command, the on-chip Flash is mapped into Internal Memory Area 0, so that the
ARM7TDMI reaches an executable instruction contained in Flash. After the remap command, the internal SRAM at
address 0x0020 0000 is mapped into Internal Memory Area 0. The memory mapped into Internal Memory Area 0 is
accessible in both its original location and at address 0x0.
18.3.3 Remap Command
After execution, the Remap Command causes the Internal SRAM to be accessed through the Internal Memory Area 0.
As the ARM vectors (Reset, Abort, Data Abort, Prefetch Abort, Undefined Instruction, Interrupt, and Fast Interrupt) are
mapped from address 0x0 to address 0x20, the Remap Command allows the user to redefine dynamically these vectors
under software control.
The Remap Command is accessible through the Memory Controller User Interface by writing the MC_RCR (Remap
Control Register) RCB field to one.
The Remap Command can be cancelled by writing the MC_RCR RCB field to one, which acts as a toggling command.
This allows easy debug of the user-defined boot sequence by offering a simple way to put the chip in the same
configuration as after a reset.
18.3.4 Abort Status
There are two reasons for an abort to occur:
access to an undefined address
an access to a misaligned address.
When an abort occurs, a signal is sent back to all the masters, regardless of which one has generated the access.
However, only the ARM7TDMI can take an abort signal into account, and only under the condition that it was generating
an access. The Peripheral DMA Controller and the EMAC do not handle the abort input signal. Note that the connections
are not represented in Figure 18-1.
To facilitate debug or for fault analysis by an operating system, the Memory Controller integrates an Abort Status register
set.
The full 32-bit wide abort address is saved in MC_AASR. Parameters of the access are saved in MC_ASR and include:
the size of the request (field ABTSZ)
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
92
the type of the access, whether it is a data read or write, or a code fetch (field ABTTYP)
whether the access is due to accessing an undefined address (bit UNDADD) or a misaligned address (bit
MISADD)
the source of the access leading to the last abort (bits MST_EMAC, MST_PDC and MST_ARM)
whether or not an abort occurred for each master since the last read of the register (bits SVMST_EMAC,
SVMST_PDC and SVMST_ARM) unless this information is loaded in MST bits
In the case of a Data Abort from the processor, the address of the data access is stored. This is useful, as searching for
which address generated the abort would require disassembling the instructions and full knowledge of the processor
context.
In the case of a Prefetch Abort, the address may have changed, as the prefetch abort is pipelined in the ARM processor.
The ARM processor takes the prefetch abort into account only if the read instruction is executed and it is probable that
several aborts have occurred during this time. Thus, in this case, it is preferable to use the content of the Abort Link
register of the ARM processor.
18.3.5 Embedded Flash Controller
The Embedded Flash Controller is added to the Memory Controller and ensures the interface of the flash block with the
32-bit internal bus. It allows an increase of performance in Thumb Mode for Code Fetch with its system of 32-bit buffers.
It also manages with the programming, erasing, locking and unlocking sequences thanks to a full set of commands.
18.3.6 Misalignment Detector
The Memory Controller features a Misalignment Detector that checks the consistency of the accesses.
For each access, regardless of the master, the size of the access and the bits 0 and 1 of the address bus are checked. If
the type of access is a word (32-bit) and the bits 0 and 1 are not 0, or if the type of the access is a half-word (16-bit) and
the bit 0 is not 0, an abort is returned to the master and the access is cancelled. Note that the accesses of the ARM
processor when it is fetching instructions are not checked.
The misalignments are generally due to software bugs leading to wrong pointer handling. These bugs are particularly
difficult to detect in the debug phase.
As the requested address is saved in the Abort Status Register and the address of the instruction generating the
misalignment is saved in the Abort Link Register of the processor, detection and fix of this kind of software bugs is
simplified.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
93
18.4Memory Controller (MC) User Interface
Base Address: 0xFFFFFF00
Table 18-1.Register Mapping
OffsetRegisterNameAccessReset State
0x00MC Remap Control RegisterMC_RCRWrite-only
0x04MC Abort Status RegisterMC_ASRRead-only0x0
0x08MC Abort Address Status RegisterMC_AASRRead-only0x0
0x10-0x5CReserved
0x60EFC0 Configuration Registers
0: The last abort was not due to the access of an undefined address in the address space.
1: The last abort was due to the access of an undefined address in the address space.
• MISADD: Misaligned Address Abort Status
0: The last aborted access was not due to an address misalignment.
1: The last aborted access was due to an address misalignment.
• ABTSZ: Abort Size Status
ABTSZ Abort Size
00 Byte
01 Half-word
10 Word
11 Reserved
• ABTTYP: Abort Type Status
ABTTYP Abort Type
00 Data Read
01 Data Write
10 Code Fetch
11 Reserved
• MST_EMAC: EMAC Abort Source
0: The last aborted access was not due to the EMAC.
1: The last aborted access was due to the EMAC.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
96
• MST_PDC: PDC Abort Source
0: The last aborted access was not due to the PDC.
1: The last aborted access was due to the PDC.
• MST_ARM: ARM Abort Source
0: The last aborted access was not due to the ARM.
1: The last aborted access was due to the ARM.
• SVMST_EMAC: Saved EMAC Abort Source
0: No abort due to the EMAC occurred since the last read of MC_ASR or it is notified in the bit MST_EMAC.
1: At least one abort due to the EMAC occurred since the last read of MC_ASR.
• SVMST_PDC: Saved PDC Abort Source
0: No abort due to the PDC occurred since the last read of MC_ASR or it is notified in the bit MST_PDC.
1: At least one abort due to the PDC occurred since the last read of MC_ASR.
• SVMST_ARM: Saved ARM Abort Source
0: No abort due to the ARM occurred since the last read of MC_ASR or it is notified in the bit MST_ARM.
1: At least one abort due to the ARM occurred since the last read of MC_ASR.
This field contains the address of the last aborted access.
ABTADD
ABTADD
ABTADD
ABTADD
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
98
19.Embedded Flash Controller (EFC)
19.1Overview
The Embedded Flash Controller (EFC ) is a part of the Memory Controller and ensures the interface of the Flash block
with the 32-bit internal bus. It increases performance in Thumb Mode for Code Fetch with its system of 32-bit buffers. It
also manages the programming, erasing, locking and unlocking sequences using a full set of commands.
The AT91SAM7X512 is equipped with two EFCs, EFC0 and EFC1. EFC1 does not feature the Security bit and GPNVM
bits. The Security and GPNVM bits embedded only on EFC0 apply to the two blocks in the AT91SAM7X512.
19.2Functional Description
19.2.1 Embedded Flash Organization
The Embedded Flash interfaces directly to the 32-bit internal bus. It is composed of several interfaces:
One memory plane organized in several pages of the same size
Two 32-bit read buffers used for code read optimization (see “Read Operations” on page 100).
One write buffer that manages page programming. The write buffer size is equal to the page size. This buffer is
write-only and accessible all along the 1 MByte address space, so that each word can be written to its final
address (see “Write Operations” on page 102).
Several lock bits used to protect write and erase operations on lock regions. A lock region is composed of several
consecutive pages, and each lock region has its associated lock bit.
Several general-purpose NVM bits. Each bit controls a specific feature in the device. Refer to the product definition
section to get the GPNVM assignment.
The Embedded Flash size, the page size and the lock region organization are described in the product definition section.
Table 19-1.Product Specific Lock and General-purpose NVM Bits
SAM7X512SAM7X256SAM7X128Denomination
333Number of General-purpose NVM bits
3216 8Number of Lock Bits
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
99
Figure 19-1.Embedded Flash Memory Mapping
Lock Region 0
Lock Region
(n-1)
Page 0
Page (m-1)
Start Address
32-bit wide
Flash Memory
Page ( (n-1)*m )
Page (n*m-1)
Lock Bit 0
Lock Region 1
Lock Bit 1
Lock Bit n-1
19.2.2 Read Operations
An optimized controller manages embedded Flash reads. A system of 2 x 32-bit buffers is added in order to start access
at following address during the second read, thus increasing performance when the processor is running in Thumb mode
(16-bit instruction set). See Figure 19-2, Figure 19-3 and Figure 19-4.
This optimization concerns only Code Fetch and not Data.
The read operations can be performed with or without wait state. Up to 3 wait states can be programmed in the field FWS
(Flash Wait State) in the Flash Mode Register MC_FMR (see “MC Flash Mode Register” on page 108). Defining FWS to
be 0 enables the single-cycle access of the embedded Flash.
The Flash memory is accessible through 8-, 16- and 32-bit reads.
As the Flash block size is smaller than the address space reserved for the internal memory area, the embedded Flash
wraps around the address space and appears to be repeated within it.
SAM7X Series [DATASHEET]
6120K–ATARM–11-Feb-14
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.