SAM3S16C Atmel Corporation, SAM3S16C Datasheet

no-image

SAM3S16C

Manufacturer Part Number
SAM3S16C
Description
Manufacturer
Atmel Corporation
Datasheet

Specifications of SAM3S16C

Flash (kbytes)
1024 Kbytes
Pin Count
100
Max. Operating Frequency
100 MHz
Cpu
Cortex-M3
# Of Touch Channels
39
Hardware Qtouch Acquisition
No
Max I/o Pins
79
Ext Interrupts
79
Usb Transceiver
1
Quadrature Decoder Channels
2
Usb Speed
Full Speed
Usb Interface
Device
Spi
3
Twi (i2c)
2
Uart
4
Ssc
1
Sd / Emmc
1
Graphic Lcd
No
Video Decoder
No
Camera Interface
No
Adc Channels
16
Adc Resolution (bits)
12
Adc Speed (ksps)
1000
Analog Comparators
1
Resistive Touch Screen
No
Dac Channels
2
Dac Resolution (bits)
12
Temp. Sensor
Yes
Crypto Engine
No
Sram (kbytes)
128
Self Program Memory
YES
External Bus Interface
1
Dram Memory
No
Nand Interface
Yes
Picopower
No
Temp. Range (deg C)
-40 to 85
I/o Supply Class
1.8/3.3
Operating Voltage (vcc)
1.62 to 3.6
Fpu
No
Mpu / Mmu
Yes / No
Timers
6
Output Compare Channels
6
Input Capture Channels
6
Pwm Channels
4
32khz Rtc
Yes
Calibrated Rc Oscillator
Yes
Features
Core
Memories
System
Low Power Modes
Peripherals
I/O
Packages
– ARM
– Memory Protection Unit (MPU)
– Thumb
– 1024 Kbytes embedded Flash, 128-bit wide access, memory accelerator, single
– 128 Kbytes embedded SRAM
– 16 Kbytes ROM with embedded bootloader routines (UART, USB) and IAP routines
– 8-bit Static Memory Controller (SMC): SRAM, PSRAM, NOR and NAND Flash
– Memory Protection Unit (MPU)
– Embedded voltage regulator for single supply operation
– Power-on-Reset (POR), Brown-out Detector (BOD) and Watchdog for safe
– Quartz or ceramic resonator oscillators: 3 to 20 MHz main power with Failure
– High precision 8/12 MHz factory trimmed internal RC oscillator with 4 MHz default
– Slow Clock Internal RC oscillator as permanent low-power mode device clock
– Two PLLs up to 240 MHz for device clock and for USB
– Temperature Sensor
– 22 peripheral DMA (PDC) channels
– Sleep and Backup modes
– Ultra low power RTC
– USB 2.0 Device: 12 Mbps, 2668 byte FIFO, up to 8 bidirectional Endpoints. On-Chip
– 2 USARTs with ISO7816, IrDA
– Two 2-wire UARTs
– 2 Two Wire Interfaces (I2C compatible), 1 SPI, 1 Serial Synchronous Controller
– 6 Three-Channel 16-bit Timer/Counter with capture, waveform, compare and PWM
– 4-channel 16-bit PWM with Complementary Output, Fault Input, 12-bit Dead Time
– 32-bit Real-time Timer and RTC with calendar and alarm features
– 15-channel, 1Msps ADC with differential input mode and programmable gain stage
– One 2-channel 12-bit 1Msps DAC
– One Analog Comparator with flexible input selection, Selectable input hysteresis
– 32-bit Cyclic Redundancy Check Calculation Unit (CRCCU)
– 79 I/O lines with external interrupt capability (edge or level sensitivity),
– Three 32-bit Parallel Input/Output Controllers, Peripheral DMA assisted Parallel
– 100-lead LQFP, 14 x 14 mm, pitch 0.5 mm
– 64-pad QFN 9x9 mm, pitch 0.5 mm
plane
support
operation
Detection and optional low power 32.768 kHz for RTC or device clock
frequency for device startup. In-application trimming access for frequency
adjustment
Transceiver
(I2S), 1 High Speed Multimedia Card Interface (SDIO/SD Card/MMC)
mode. Quadrature Decoder Logic and 2-bit Gray Up/Down Counter for Stepper
Motor
Generator Counter for Motor Control
debouncing, glitch filtering and on-die Series Resistor Termination
Capture Mode
®
Cortex
®
-2 instruction set
-M3 revision 2.0 running at up to 100 MHz
®
, RS-485, SPI, Manchester and Modem Mode
AT91SAM
ARM-based
Flash MCU
SAM3S16
11117B–ATARM–18-Oct-11

Related parts for SAM3S16C

SAM3S16C Summary of contents

Page 1

Features • Core ® ™ – ARM Cortex -M3 revision 2.0 running 100 MHz – Memory Protection Unit (MPU) ® – Thumb -2 instruction set • Memories – 1024 Kbytes embedded Flash, 128-bit wide access, memory accelerator, ...

Page 2

... Configuration Summary The SAM3S16 devices differ in package and features. of the devices. Table 1-1. Configuration Summary Device Flash SRAM 1024 128 SAM3S16C Kbytes Kbytes 1024 128 SAM3S16B Kbytes Kbytes Notes: 1. Full Modem support on USART1. 2. One channel is reserved for internal temperature sensor. SAM3S16 ...

Page 3

SAM3S16 Block Diagram Figure 2-1. SAM3S16 100-pin Version Block Diagram System Controller TST PCK0-PCK2 PLLA PLLB RC Osc 12/8/4 MHz XIN 3-20 MHz XOUT Osc SUPC XIN32 Osc 32 kHz XOUT32 RC 32 kHz ERASE 8 GPBREG VDDIO VDDCORE ...

Page 4

Figure 2-2. SAM3S16 64-pin Version Block Diagram System Controller TST PCK0-PCK2 PLLA PLLB RC Osc 12/8/4 MHz XIN 3-20 MHz XOUT SUPC XIN32 Osc 32 kHz XOUT32 RC 32 kHz ERASE 8 GPBREG VDDIO VDDCORE RTT VDDPLL POR RTCOUT0 RTC ...

Page 5

Signal Description Table 3-1 Table 3-1. Signal Description List Signal Name Function Peripherals I/O Lines and USB transceiver VDDIO Power Supply Voltage Regulator Input, ADC, DAC and VDDIN Analog Comparator Power Supply VDDOUT Voltage Regulator Output VDDPLL Oscillator and ...

Page 6

Table 3-1. Signal Description List (Continued) Signal Name Function URXDx UART Receive Data UTXDx UART Transmit Data PA0 - PA31 Parallel IO Controller A PB0 - PB14 Parallel IO Controller B PC0 - PC31 Parallel IO Controller C PIODC0-PIODC7 Parallel ...

Page 7

Table 3-1. Signal Description List (Continued) Signal Name Function TD SSC Transmit Data RD SSC Receive Data TK SSC Transmit Clock RK SSC Receive Clock TF SSC Transmit Frame Sync RF SSC Receive Frame Sync TCLKx TC Channel x External ...

Page 8

Table 3-1. Signal Description List (Continued) Signal Name Function PGMEN0-PGMEN2 Programming Enabling PGMM0-PGMM3 Programming Mode PGMD0-PGMD15 Programming Data PGMRDY Programming Ready PGMNVALID Data Direction PGMNOE Programming Read PGMCK Programming Clock PGMNCMD Programming Command DDM USB Full Speed Data - DDP ...

Page 9

Package and Pinout SAM3S16 4.1 100-lead LQFP Package Outline Figure 4-1. 11117B–ATARM–18-Oct-11 Orientation of the 100-lead LQFP Package 75 76 100 1 SAM3S16 ...

Page 10

LQFP Pinout Table 4-1. 100-lead LQFP SAM3S16 Pinout 1 ADVREF 26 2 GND 27 3 PB0/AD4 28 4 PC29/AD13 29 5 PB1/AD5 30 6 PC30/AD14 31 7 PB2/AD6 32 8 PC31 33 9 PB3/AD7 34 10 VDDIN 35 ...

Page 11

QFN Package Outline Figure 4-2. 4.2.1 64-pad QFN Pinout Table 4-2. 64-pin QFN SAM3S16 Pinout 1 ADVREF 2 GND 3 PB0/AD4 4 PB1/AD5 5 PB2/AD6 6 PB3/AD7 7 VDDIN 8 VDDOUT 9 PA17/PGMD5/AD0 10 PA18/PGMD6/AD1 11 PA21/PGMD9/AD8 12 ...

Page 12

Power Considerations 5.1 Power Supplies The SAM3S16 product has several types of power supply pins: • VDDCORE pins: Power the core, the embedded memories and the peripherals; voltage ranges from 1.08V to 1.32V. • VDDIO pins: Power the Peripherals ...

Page 13

Figure 5-1. Note: Figure 5-2. Note: Figure 5-3 Since the PIO state is preserved when in backup mode, any free PIO line can be used to switch off the external regulator by driving the PIO line at low level (PIO ...

Page 14

Figure 5-3. 5.4 Active Mode Active mode is the normal running mode with the core clock running from the fast RC oscillator, the main crystal oscillator or the PLLA. The power management controller can be used to adapt the frequency ...

Page 15

WKUPEN0-15 pins (level transition, configurable debouncing) • Supply Monitor alarm • RTC alarm • RTT alarm 5.5.2 Wait Mode The purpose of the wait mode is to achieve very low power consumption while maintaining the whole device in a ...

Page 16

Low Power Mode Summary Table The modes detailed above are the main low power modes. Each part can be set off sep- arately and wake up sources can be individually configured. of the configurations of the ...

Page 17

Wake-up Sources The wake-up events allow the device to exit the backup mode. When a wake-up event is detected, the Supply Controller performs a sequence which automatically reenables the core power supply and the SRAM power supply, if they ...

Page 18

Fast Startup The device allows the processor to restart in a few microseconds while the processor is in wait mode. A fast start up can occur upon detection of a low level on one of the 19 wake-up inputs ...

Page 19

Input/Output Lines The SAM3S16 has several kinds of input/output (I/O) lines such as general purpose I/Os (GPIO) and system I/Os. GPIOs can have alternate functionality due to multiplexing capabilities of the PIO controllers. The same PIO line can be ...

Page 20

Table 6-1. System I/O Configuration Pin List. SYSTEM_IO Default function bit number after reset 12 ERASE 10 DDM 11 DDP 7 TCK/SWCLK 6 TMS/SWDIO 5 TDO/TRACESWO 4 TDI - PA7 - PA8 - PB9 - PB8 Notes PB12 ...

Page 21

Test Pin The TST pin is used for JTAG Boundary Scan Manufacturing Test or Fast Flash programming mode of the SAM3S16. The TST pin integrates a permanent pull-down resistor of about 15 kΩ to GND, so that it can ...

Page 22

Processor and Architecture 7.1 ARM Cortex-M3 Processor • Version 2.0 • Thumb-2 (ISA) subset consisting of all base Thumb-2 instructions, 16-bit and 32-bit • Harvard processor architecture enabling simultaneous instruction fetch with data load/store • Three-stage pipeline • Single ...

Page 23

Master to Slave Access All the Masters can normally access all the Slaves. However, some paths do not make sense, for example allowing access from the Cortex-M3 S Bus to the Internal ROM. Thus, these paths are forbidden or ...

Page 24

Table 7-4. Instance Name UART0 USART1 USART0 ADC SPI SSC HSMCI PIOA 7.7 Debug and Test Features • Debug access to all memory and registers in the system, including Cortex-M3 register bank when the core is running, halted, or held ...

Page 25

Product Mapping Figure 8-1. SAM3S16 Product Mapping Code 0x00000000 Boot Memory 0x00400000 Internal Flash 0x00800000 Internal ROM 0x00C00000 Reserved 0x1FFFFFFF External RAM 0x60000000 SMC Chip Select 0 0x61000000 SMC Chip Select 1 0x62000000 SMC Chip Select 2 0x63000000 SMC ...

Page 26

Memories 9.1 Embedded Memories 9.1.1 Internal SRAM The SAM3S16 product (1024-Kbyte internal Flash version) embeds a total of 128 Kbytes high- speed SRAM. The SRAM is accessible over System Cortex-M3 bus at address 0x2000 0000. The SRAM is in ...

Page 27

For sector 0: • The smaller sector 0 has 16 pages of 512Bytes • The smaller sector 1 has 16 pages of 512 Bytes • The larger sector has 96 pages of 512 Bytes From Sector The ...

Page 28

Figure 9-3. Erasing the memory can be performed as follows: • 512-byte page inside a sector of 8 KBytes • 4-Kbyte Block inside a sector of 8 KBytes/48 Kbytes/64 KBytes • sector of 8 ...

Page 29

Lock Regions 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. Table 9- locked-region’s erase ...

Page 30

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 TST and PA0 and PA1 are tied low. ® 9.1.3.11 ...

Page 31

Programmable Wait State Generation – External Wait Request – Programmable Data Float Time • Slow Clock mode supported • Additional Logic for NAND Flash 10. System Controller The System Controller is a set of peripherals, which allow handling of ...

Page 32

Figure 10-1. System Controller Block Diagram VDDIO Zero-Power Power-on Reset (Backup) WKUP0 - WKUP15 SLCK SLCK XIN32 Xtal 32 kHz Oscillator XOUT32 Embedded 32 kHz RC Oscillator Backup Power Supply NRST FSTT0 - FSTT15 XIN XOUT VDDIO FSTT0 - FSTT15 ...

Page 33

Power-on-Reset, Brownout and Supply Monitor The SAM3S16 embeds three features to monitor, warn and/or reset the chip: • Power-on-Reset on VDDIO • Brownout Detector on VDDCORE • Supply Monitor on VDDIO 10.2.1 Power-on-Reset The Power-on-Reset monitors VDDIO ...

Page 34

The Slow Clock generator is based kHz crystal oscillator and an embedded 32 kHz RC oscillator. The Slow Clock defaults to the RC oscillator, but the software can enable the crystal oscillator and select it as the ...

Page 35

Power Management Controller The Power Management Controller provides all the clock signals to the system. It provides: • the Processor Clock, HCLK • the Free running processor clock, FCLK • the Cortex SysTick external clock • the Master Clock, ...

Page 36

The SysTick calibration value is fixed at 12,500 which allows the generation of a time base with SystTick clock at 12.5 MHz (max HCLK/8 = 100 MHz/8). 10.7 Watchdog Timer • 16-bit key-protected only-once-Programmable Counter • Windowed, ...

Page 37

... Chip Identification • Chip Identifier (CHIPID) registers permit recognition of the device and its revision. Table 10-1. ATSAM3S16CA (MRL A) ATSAM3S16BA (MRL A) • JTAG ID: 0x05B2D03F 10.14 UART • Two-pin UART – Implemented features are 100% compatible with the standard Atmel USART – Independent receiver and transmitter with a common programmable Baud Rate – ...

Page 38

Peripherals 11.1 Peripheral Identifiers Table 11-1 for the control of the peripheral interrupt with the Nested Vectored Interrupt Controller and for the control of the peripheral clock with the Power Management Controller. Table 11-1. Peripheral Identifiers Instance ID Instance ...

Page 39

Peripheral Signal Multiplexing on I/O Lines The SAM3S16 product features 2 PIO controllers on 64-pin versions (PIOA, PIOB PIO con- trollers on the 100-pin version (PIOA, PIOB, PIOC), that multiplex the I/O lines of the peripheral set. ...

Page 40

PIO Controller A Multiplexing Table 11-2. Multiplexing on PIO Controller A (PIOA) I/O Line Peripheral A Peripheral B PA0 PWMH0 TIOA0 PA1 PWMH1 TIOB0 PA2 PWMH2 SCK0 PA3 TWD0 NPCS3 PA4 TWCK0 TCLK0 PA5 RXD0 NPCS3 PA6 TXD0 PCK0 ...

Page 41

PIO Controller B Multiplexing Table 11-3. Multiplexing on PIO Controller B (PIOB) I/O Line Peripheral A Peripheral B PB0 PWMH0 PB1 PWMH1 PB2 URXD1 PB3 UTXD1 PB4 TWD1 PB5 TWCK1 PB6 PB7 PB8 PB9 PB10 PB11 PB12 PWML1 PB13 ...

Page 42

PIO Controller C Multiplexing Table 11-4. Multiplexing on PIO Controller C (PIOC) I/O Line Peripheral A Peripheral B PC0 D0 PC1 D1 PC2 D2 PC3 D3 PC4 D4 PC5 D5 PC6 D6 PC7 D7 PC8 NWE PC9 NANDOE PC10 ...

Page 43

ARM Cortex M3 Processor 12.1 About this section This section provides the information required for application and system-level software devel- opment. It does not provide information on debug components, features, or operation. This material is for microcontroller software ...

Page 44

To facilitate the design of cost-sensitive devices, the Cortex-M3 processor implements tightly- coupled system components that reduce processor area while significantly improving interrupt handling and system ...

Page 45

Memory Protection Unit (MPU) for safety-critical applications • extensive debug and trace capabilities: – Serial Wire Debug and Serial Wire Trace reduce the number of pins required for 12.2.4 Cortex-M3 core ...

Page 46

NVIC, or system control block • might have restricted access to memory or peripherals. Unprivileged software executes at the unprivileged level. 12.3.1.4 Privileged The software can use all the instructions and has access to ...

Page 47

Core registers The processor core registers are: Low registers High registers Stack Pointer Link Register Program Counter Table 12-2. Name R0-R12 MSP PSP LR PC PSR ASPR IPSR EPSR PRIMASK 11117B–ATARM–18-Oct- General-purpose ...

Page 48

Table 12-2. Name FAULTMASK BASEPRI CONTROL 1. 2. 12.3.3.1 General-purpose registers R0-R12 are 32-bit general-purpose registers for data operations. 12.3.3.2 Stack Pointer The Stack Pointer (SP) is register R13. In Thread mode, bit[1] of the CONTROL register indi- cates the ...

Page 49

Program Status Register The Program Status Register (PSR) combines: • Application Program Status Register (APSR) • Interrupt Program Status Register (IPSR) • Execution Program Status Register (EPSR). These registers are mutually exclusive bitfields in the 32-bit PSR. The bit ...

Page 50

The PSR bit assignments are Access these registers individually combination of any two or all three registers, using the register name as an argument to the MSR ...

Page 51

C Carry or borrow flag add operation did not result in a carry bit or subtract operation resulted in a borrow bit 1 = add operation resulted in a carry bit or subtract operation did not result ...

Page 52

Execution Program Status Register The EPSR contains the Thumb state bit, and the execution state bits for either the: • If-Then (IT) instruction • Interruptible-Continuable Instruction (ICI) field for an interrupted load multiple or store multiple instruction. See the ...

Page 53

Priority Mask Register The PRIMASK register prevents activation of all exceptions with configurable priority. See the register summary • PRIMASK effect 1 = prevents the activation of ...

Page 54

Base Priority Mask Register The BASEPRI register defines the minimum priority for exception processing. When BASEPRI is set to a nonzero value, it prevents the activation of all exceptions with same or lower priority level as the BASEPRI value. ...

Page 55

CONTROL register The CONTROL register controls the stack used and the privilege level for software execution when the processor is in Thread mode. See the register summary in attributes. The bit assignments are ...

Page 56

Exceptions and interrupts The Cortex-M3 processor supports interrupts and system exceptions. The processor and the Nested Vectored Interrupt Controller (NVIC) prioritize and handle all exceptions. An exception changes the normal flow of software control. The processor uses handler mode ...

Page 57

CMSIS mapping of the Cortex-M3 NVIC registers” on page 113 • “NVIC programming hints” on page 11117B–ATARM–18-Oct-11 125. SAM3S16 15 ...

Page 58

Memory model This section describes the processor memory map, the behavior of memory accesses, and the bit-banding features. The processor has a fixed memory map that provides up to 4GB of addressable memory. The memory map is: The regions ...

Page 59

Normal The processor can re-order transactions for efficiency, or perform speculative reads. 12.4.1.2 Device The processor preserves transaction order relative to other transactions to Device or Strongly- ordered memory. 12.4.1.3 Strongly-ordered The processor preserves transaction order relative to all ...

Page 60

Means that accesses are observed in program order, that is always observed before A2. 12.4.3 Behavior of memory accesses The behavior of accesses to each region in the memory map is: Table 12-4. Address range 0x00000000- 0x1FFFFFFF ...

Page 61

Table 12-5. Address range 0x60000000- 0x7FFFFFFF 0x80000000- 0x9FFFFFFF 0xA0000000- 0xBFFFFFFF 0xC0000000- 0xDFFFFFFF 0xE0000000- 0xE00FFFFF 0xE0100000- 0xFFFFFFFF 1. 2. 12.4.4 Software ordering of memory accesses The order of instructions in the program flow does not always guarantee the order of the ...

Page 62

Use an ISB instruction to ensure the new MPU setting takes effect immediately after • Vector table. If the program changes an entry in the vector table, and then enables the corresponding exception, use a DMB instruction between the ...

Page 63

Table 12-7. Address range 0x40000000- 0x400FFFFF 0x42000000- 0x43FFFFFF A word access to the SRAM or peripheral bit-band alias regions map to a single bit in the SRAM or peripheral bit-band region. The following formula shows how the alias region maps ...

Page 64

Figure 12-2. Bit-band mapping 0x23FFFFFC 0x2200001C 7 7 12.4.5.1 Directly accessing an alias region Writing to a word in the alias region updates a single bit in the bit-band region. Bit[0] of the value written to a word in the ...

Page 65

Little-endian format In little-endian format, the processor stores the least significant byte of a word at the lowest- numbered byte, and the most significant byte at the highest-numbered byte. For example: Address A A+1 A+2 A+3 12.4.7 Synchronization primitives ...

Page 66

No write was performed. This indicates that the value returned the first step might be out of date. The software must retry the read-modify-write sequence, Software can use the synchronization primitives to implement a semaphores as follows: • Use ...

Page 67

Exception model This section describes the exception model. 12.5.1 Exception states Each exception is in one of the following states: 12.5.1.1 Inactive The exception is not active and not pending. 12.5.1.2 Pending The exception is waiting to be serviced ...

Page 68

Memory management fault A memory management fault is an exception that occurs because of a memory protection related fault. The MPU or the fixed memory protection constraints determines this fault, for both instruction and data memory transactions. This fault ...

Page 69

Interrupt (IRQ) A interrupt, or IRQ exception signalled by a peripheral, or generated by a software request. All interrupts are asynchronous to instruction execution. In the system, peripherals use interrupts to communicate with the processor. Table 12-9. ...

Page 70

Clear-enable Registers” on page For more information about hard faults, memory management faults, bus faults, and usage faults, see 12.5.3 Exception handlers The processor handles exceptions using: 12.5.3.1 Interrupt Service Routines (ISRs) Interrupts IRQ0 to IRQ29 are the ...

Page 71

Figure 12-3. Vector table On system reset, the vector table is fixed at address 0x00000000. Privileged software can write to the VTOR to relocate the vector table start address to a different memory location, in the range 0x00000080 to 0x3FFFFF80, ...

Page 72

Configurable priority values are in the range 0-15. This means that the Reset, Hard fault, and NMI exceptions, with fixed negative priority values, always have higher priority than any other exception. For example, assigning a higher priority value to IRQ[0] ...

Page 73

Tail-chaining This mechanism speeds up exception servicing. On completion of an exception handler, if there is a pending exception that meets the requirements for exception entry, the stack pop is skipped and control transfers to the new exception handler. ...

Page 74

If no higher priority exception occurs during exception entry, the processor starts executing the exception handler and automatically changes the status of the corresponding pending interrupt to active. If another higher priority exception occurs during exception entry, the processor starts ...

Page 75

BX instruction • attempting to execute an instruction from a memory region marked as Non-Executable • an MPU fault because of a privilege ...

Page 76

Usually, the exception priority, together with the values of the exception mask registers, deter- mines whether the processor enters the fault handler, and whether a fault handler can preempt another fault handler. as described in In some situations, a fault ...

Page 77

Power management The Cortex-M3 processor sleep modes reduce power consumption: • Backup Mode • Wait Mode • Sleep Mode The SLEEPDEEP bit of the SCR selects which sleep mode is used, see ter” on page Modes” in the PMC ...

Page 78

PRIMASK to zero. For more information about PRIMASK and FAULT- MASK see 12.7.2.2 Wakeup from WFE The processor wakes up if: • it detects an exception with sufficient priority to cause exception entry In addition, if ...

Page 79

Instruction set summary The processor implements a version of the Thumb instruction set. ported instructions. In Table • angle brackets, <>, enclose alternative forms of the operand • braces, {}, enclose optional operands • the Operands column is not ...

Page 80

Table 12-13. Cortex-M3 instructions (Continued) Mnemonic ISB IT LDM LDMDB, LDMEA LDMFD, LDMIA LDR LDRB, LDRBT LDRD LDREX LDREXB LDREXH LDRH, LDRHT LDRSB, LDRSBT LDRSH, LDRSHT LDRT LSL, LSLS LSR, LSRS MLA MLS MOV, MOVS MOVT MOVW, MOV MRS MSR ...

Page 81

Table 12-13. Cortex-M3 instructions (Continued) Mnemonic RBIT REV REV16 REVSH ROR, RORS RRX, RRXS RSB, RSBS SBC, SBCS SBFX SDIV SEV SMLAL SMULL SSAT STM STMDB, STMEA STMFD, STMIA STR STRB, STRBT STRD STREX STREXB STREXH STRH, STRHT STRT SUB, ...

Page 82

Table 12-13. Cortex-M3 instructions (Continued) Mnemonic TEQ TST UBFX UDIV UMLAL UMULL USAT UXTB UXTH WFE WFI 12.9 Intrinsic functions ANSI cannot directly access some Cortex-M3 instructions. This section describes intrinsic func- tions that can generate these instructions, provided by ...

Page 83

The CMSIS also provides a number of functions for accessing the special registers using MRS and MSR instructions: Table 12-15. CMSIS intrinsic functions to access the special registers Special register PRIMASK FAULTMASK BASEPRI CONTROL MSP PSP 12.10 About the instruction ...

Page 84

Bit[0] of any address you write to the PC with a BX, BLX, LDM, LDR, or POP instruction must be 1 for correct execution, because this bit indicates the required instruction set, and the Cortex-M3 processor only supports Thumb instructions. ...

Page 85

LSR #n ROR #n RRX - If you omit the shift, or specify LSL #0, the instruction uses the value in Rm. If you specify a shift, the shift is applied to the value in Rm, and the resulting 32-bit ...

Page 86

LSR Logical shift right by n bits moves the left-hand 32-n bits of the register Rm, to the right by n places, into the right-hand 32-n bits of the result. And it sets the left-hand n bits of the ...

Page 87

ROR Rotate right by n bits moves the left-hand 32-n bits of the register Rm, to the right by n places, into the right-hand 32-n bits of the result. And it moves the right-hand n bits of the register ...

Page 88

All other load and store instructions generate a usage fault exception if they perform an unaligned access, and therefore their accesses must be address aligned. For more information about usage faults see Unaligned accesses are usually slower than aligned accesses. ...

Page 89

This section describes: • “The condition flags” • “Condition code suffixes” 12.10.7.1 The condition flags The APSR contains the following condition flags For more information about the APSR see A carry occurs: • if the result ...

Page 90

Table 12-16. Condition code suffixes (Continued) Suffix 12.10.7.3 Absolute value The example below shows the use of a conditional instruction to find the absolute value of a number ABS(R1). MOVS ...

Page 91

Memory access instructions Table 12-17 Table 12-17. Memory access instructions Mnemonic ADR CLREX LDM{mode} LDR{type} LDR{type} LDR{type}T LDR LDREX{type} POP PUSH STM{mode} STR{type} STR{type} STR{type}T STREX{type} 11117B–ATARM–18-Oct-11 shows the memory access instructions: Brief description Load PC-relative address Clear Exclusive ...

Page 92

ADR Load PC-relative address. 12.11.1.1 Syntax ADR{cond} Rd, label where: cond Rd label 12.11.1.2 Operation ADR determines the address by adding an immediate value to the PC, and writes the result to the destination register. ADR produces position-independent code, ...

Page 93

LDR and STR, immediate offset Load and Store with immediate offset, pre-indexed immediate offset, or post-indexed immediate offset. 12.11.2.1 Syntax op{type}{cond} Rt, [Rn {, #offset}] op{type}{cond} Rt, [Rn, #offset]! op{type}{cond} Rt, [Rn], #offset opD{cond} Rt, Rt2, [Rn {, #offset}] ...

Page 94

Post-indexed addressing The address obtained from the register Rn is used as the address for the memory access. The offset value is added to or subtracted from the address, and written back into the register Rn. The ...

Page 95

Examples LDR R8, [R10] LDRNE R2, [R5, #960]! STR R2, [R9,#const-struc] STRH R3, [R4], #4 LDRD R8, R9, [R3, #0x20] STRD R0, R1, [R8], #-16 11117B–ATARM–18-Oct-11 ; Loads R8 from the address in R10. ; Loads (conditionally) R2 from ...

Page 96

LDR and STR, register offset Load and Store with register offset. 12.11.3.1 Syntax op{type}{cond} Rt, [Rn LSL #n}] where: op LDR STR type cond LSL #n 12.11.3.2 Operation LDR ...

Page 97

Condition flags These instructions do not change the flags. 12.11.3.5 Examples STR R0, [R5, R1] LDRSB R0, [R5, R1, LSL #1] ; Read byte value from an address equal to STR R0, [R1, R2, LSL #2] ; Stores R0 ...

Page 98

LDR and STR, unprivileged Load and Store with unprivileged access. 12.11.4.1 Syntax op{type}T{cond} Rt, [Rn {, #offset}] where: op LDR STR type is one of cond Rt Rn offset 12.11.4.2 Operation These load and ...

Page 99

LDR, PC-relative Load register from memory. 12.11.5.1 Syntax LDR{type}{cond} Rt, label LDRD{cond} Rt, Rt2, label where: type cond Rt Rt2 label 12.11.5.2 Operation LDR loads a register with a value from a PC-relative memory ...

Page 100

IT block. 12.11.5.4 Condition flags These ...

Page 101

LDM and STM Load and Store Multiple registers. 12.11.6.1 Syntax op{addr_mode}{cond} Rn{!}, reglist where: op LDM STM addr_mode IA DB cond present the final address, that is loaded from or stored to, is written ...

Page 102

The accesses happen in order of decreasing register numbers, with the highest numbered regis- ter using the highest memory address and the lowest number register using the lowest memory address. If the writeback suffix is specified, the value of Rn ...

Page 103

PUSH and POP Push registers onto, and pop registers off a full-descending stack. 12.11.7.1 Syntax PUSH{cond} reglist POP{cond} reglist where: cond reglist It must be comma separated if it contains more than one register or register range. PUSH and ...

Page 104

LDREX and STREX Load and Store Register Exclusive. 12.11.8.1 Syntax LDREX{cond} Rt, [Rn {, #offset}] STREX{cond} Rd, Rt, [Rn {, #offset}] LDREXB{cond} Rt, [Rn] STREXB{cond} Rd, Rt, [Rn] LDREXH{cond} Rt, [Rn] STREXH{cond} Rd, Rt, [Rn] where: cond Rd Rt ...

Page 105

Condition flags These instructions do not change the flags. 12.11.8.5 Examples MOV R1, #0x1 try LDREX R0, [LockAddr] CMP R0, #0 ITT EQ STREXEQ R0, R1, [LockAddr] CMPEQ R0, #0 BNE try .... 11117B–ATARM–18-Oct-11 ; Initialize the ‘lock taken’ ...

Page 106

CLREX Clear Exclusive. 12.11.9.1 Syntax CLREX{cond} where: cond 12.11.9.2 Operation Use CLREX to make the next STREX, STREXB, or STREXH instruction write 1 to its destination register and fail to perform the store useful in exception handler ...

Page 107

General data processing instructions Table 12-20 Table 12-20. Data processing instructions Mnemonic ADC ADD ADDW AND ASR BIC CLZ CMN CMP EOR LSL LSR MOV MOVT MOVW MVN ORN ORR RBIT REV REV16 REVSH ROR 11117B–ATARM–18-Oct-11 shows the data ...

Page 108

Table 12-20. Data processing instructions (Continued) Mnemonic RRX RSB SBC SUB SUBW TEQ TST SAM3S16 66 Brief description Rotate Right with Extend Reverse Subtract Subtract with Carry Subtract Subtract Test Equivalence Test See “ASR, LSL, LSR, ROR, and RRX” on ...

Page 109

ADD, ADC, SUB, SBC, and RSB Add, Add with carry, Subtract, Subtract with carry, and Reverse Subtract. 12.12.1.1 Syntax op{S}{cond} {Rd,} Rn, Operand2 op{cond} {Rd,} Rn, #imm12 where: op ADD ADC SUB SBC RSB S result of the operation, ...

Page 110

Rd can be SP only in ADD and SUB, and only with the additional restrictions: – Rn must also be SP – any shift in Operand2 must be limited to a maximum of 3 bits using LSL • Rn ...

Page 111

Multiword arithmetic examples 12.12.1.7 64-bit addition The example below shows two instructions that add a 64-bit integer contained in R2 and R3 to another 64-bit integer con- tained in R0 and R1, and place the result in R4 and ...

Page 112

AND, ORR, EOR, BIC, and ORN Logical AND, OR, Exclusive OR, Bit Clear, and OR NOT. 12.12.2.1 Syntax op{S}{cond} {Rd,} Rn, Operand2 where: op AND ORR EOR BIC ORN S result of the operation, see cond Rd Rn Operand2 ...

Page 113

Examples AND R9, R2, #0xFF00 ORREQ R2, R0, R5 ANDS R9, R8, #0x19 EORS R7, R11, #0x18181818 BIC R0, R1, #0xab ORN R7, R11, R14, ROR #4 ORNS R7, R11, R14, ASR #32 11117B–ATARM–18-Oct-11 SAM3S16 71 ...

Page 114

ASR, LSL, LSR, ROR, and RRX Arithmetic Shift Right, Logical Shift Left, Logical Shift Right, Rotate Right, and Rotate Right with Extend. 12.12.3.1 Syntax op{S}{cond} Rd, Rm, Rs op{S}{cond} Rd, Rm, #n RRX{S}{cond} Rd, Rm where: op ASR LSL ...

Page 115

C flag is updated to the last bit shifted out, except when the shift length is 0, see Operations” on page 12.12.3.5 Examples ASR R7, R8 Arithmetic shift right by 9 bits LSLS R1, R2, #3 ...

Page 116

CLZ Count Leading Zeros. 12.12.4.1 Syntax CLZ{cond} Rd, Rm where: cond Rd Rm 12.12.4.2 Operation The CLZ instruction counts the number of leading zeros in the value in Rm and returns the result in Rd. The result value is ...

Page 117

CMP and CMN Compare and Compare Negative. 12.12.5.1 Syntax CMP{cond} Rn, Operand2 CMN{cond} Rn, Operand2 where: cond Rn Operand2 details of the options. 12.12.5.2 Operation These instructions compare the value in a register with Operand2. They update the condition ...

Page 118

MOV and MVN Move and Move NOT. 12.12.6.1 Syntax MOV{S}{cond} Rd, Operand2 MOV{cond} Rd, #imm16 MVN{S}{cond} Rd, Operand2 where: S result of the operation, see cond Rd Operand2 details of the options. imm16 12.12.6.2 Operation The MOV instruction copies ...

Page 119

PC is ignored • a branch occurs to the address created by forcing bit[0] of that value to 0. Though it is possible to use MOV as a branch instruction, ARM strongly ...

Page 120

MOVT Move Top. 12.12.7.1 Syntax MOVT{cond} Rd, #imm16 where: cond Rd imm16 12.12.7.2 Operation MOVT writes a 16-bit immediate value, imm16, to the top halfword, Rd[31:16], of its destination register. The write does not affect Rd[15:0]. The MOV, MOVT ...

Page 121

REV, REV16, REVSH, and RBIT Reverse bytes and Reverse bits. 12.12.8.1 Syntax op{cond} Rd, Rn where: op REV REV16 Reverse byte order in each halfword independently. REVSH Reverse byte order in the bottom halfword, and sign extend to 32 ...

Page 122

TST and TEQ Test bits and Test Equivalence. 12.12.9.1 Syntax TST{cond} Rn, Operand2 TEQ{cond} Rn, Operand2 where: cond Rn Operand2 details of the options. 12.12.9.2 Operation These instructions test the value in a register against Operand2. They update the ...

Page 123

Multiply and divide instructions Table 12-21 Table 12-21. Multiply and divide instructions Mnemonic MLA MLS MUL SDIV SMLAL SMULL UDIV UMLAL UMULL 11117B–ATARM–18-Oct-11 shows the multiply and divide instructions: Brief description Multiply with Accumulate, 32-bit result Multiply and Subtract, ...

Page 124

MUL, MLA, and MLS Multiply, Multiply with Accumulate, and Multiply with Subtract, using 32-bit operands, and pro- ducing a 32-bit result. 12.13.1.1 Syntax MUL{S}{cond} {Rd,} Rn Multiply MLA{cond} Rd, Rn, Rm, Ra MLS{cond} Rd, Rn, Rm, Ra ...

Page 125

UMULL, UMLAL, SMULL, and SMLAL Signed and Unsigned Long Multiply, with optional Accumulate, using 32-bit operands and pro- ducing a 64-bit result. 12.13.2.1 Syntax op{cond} RdLo, RdHi, Rn, Rm where: op UMULL Unsigned Long Multiply. UMLAL Unsigned Long Multiply, ...

Page 126

SDIV and UDIV Signed Divide and Unsigned Divide. 12.13.3.1 Syntax SDIV{cond} {Rd,} Rn, Rm UDIV{cond} {Rd,} Rn, Rm where: cond 12.13.3.2 Operation SDIV performs a signed integer division of the value the value ...

Page 127

Saturating instructions This section describes the saturating instructions, SSAT and USAT. 12.14.1 SSAT and USAT Signed Saturate and Unsigned Saturate to any bit position, with optional shift before saturating. 12.14.1.1 Syntax op{cond} Rd, # shift #s} where: ...

Page 128

Restrictions Do not use SP and do not use PC 12.14.1.4 Condition flags These instructions do not affect the condition code flags. If saturation occurs, these instructions set the Q flag to 1. 12.14.1.5 Examples SSAT R7, #16, R7, ...

Page 129

Bitfield instructions Table 12-22 Table 12-22. Packing and unpacking instructions Mnemonic BFC BFI SBFX SXTB SXTH UBFX UXTB UXTH 11117B–ATARM–18-Oct-11 shows the instructions that operate on adjacent sets of bits in registers or bitfields: Brief description Bit Field Clear ...

Page 130

BFC and BFI Bit Field Clear and Bit Field Insert. 12.15.1.1 Syntax BFC{cond} Rd, #lsb, #width BFI{cond} Rd, Rn, #lsb, #width where: cond Rd Rn lsb width 12.15.1.2 Operation BFC clears a bitfield in a register. It clears width ...

Page 131

SBFX and UBFX Signed Bit Field Extract and Unsigned Bit Field Extract. 12.15.2.1 Syntax SBFX{cond} Rd, Rn, #lsb, #width UBFX{cond} Rd, Rn, #lsb, #width where: cond Rd Rn lsb width 12.15.2.2 Operation SBFX extracts a bitfield from one register, ...

Page 132

SXT and UXT Sign extend and Zero extend. 12.15.3.1 Syntax SXTextend{cond} {Rd ROR #n} UXTextend{cond} {Rd ROR #n} where: extend B H cond Rd Rm ROR #n ROR #8 Value from Rm is rotated right ...

Page 133

Branch and control instructions Table 12-23 Table 12-23. Branch and control instructions Mnemonic B BL BLX BX CBNZ CBZ IT TBB TBH 11117B–ATARM–18-Oct-11 shows the branch and control instructions: Brief description Branch Branch with Link Branch indirect with Link ...

Page 134

B, BL, BX, and BLX Branch instructions. 12.16.1.1 Syntax B{cond} label BL{cond} label BX{cond} Rm BLX{cond} Rm where BLX cond label but the address to branch to is created by changing bit[0] to ...

Page 135

PC in the BLX instruction • for BX and BLX, bit[ must be 1 for correct execution but a branch occurs to the target address created by changing bit[ • when any ...

Page 136

CBZ and CBNZ Compare and Branch on Zero, Compare and Branch on Non-Zero. 12.16.2.1 Syntax CBZ Rn, label CBNZ Rn, label where: Rn label 12.16.2.2 Operation Use the CBZ or CBNZ instructions to avoid changing the condition code flags ...

Page 137

IT If-Then condition instruction. 12.16.3.1 Syntax IT{x{y{z}}} cond where cond The condition switch for the second, third and fourth instruction in the IT block can be either possible to use AL (the ...

Page 138

PC must either be outside an IT block or must be the last instruction inside the IT block. These are: – ADD PC, PC, Rm – MOV PC, Rm – B, ...

Page 139

TBB and TBH Table Branch Byte and Table Branch Halfword. 12.16.4.1 Syntax TBB [Rn, Rm] TBH [Rn, Rm, LSL #1] where: Rn then the address of the table is the address of the byte immediately following the TBB or ...

Page 140

Examples ADR.W R0, BranchTable_Byte TBB [R0, R1] Case1 ; an instruction sequence follows Case2 ; an instruction sequence follows Case3 ; an instruction sequence follows BranchTable_Byte DCB 0 DCB ((Case2-Case1)/2) DCB ((Case3-Case1)/2) TBH [PC, R1, LSL #1] BranchTable_H DCI ...

Page 141

Miscellaneous instructions Table 12-25 Table 12-25. Miscellaneous instructions Mnemonic BKPT CPSID CPSIE DMB DSB ISB MRS MSR NOP SEV SVC WFE WFI 11117B–ATARM–18-Oct-11 shows the remaining Cortex-M3 instructions: Brief description Breakpoint Change Processor State, Disable Interrupts Change Processor State, ...

Page 142

BKPT Breakpoint. 12.17.1.1 Syntax BKPT #imm where: imm 12.17.1.2 Operation The BKPT instruction causes the processor to enter Debug state. Debug tools can use this to investigate system state when the instruction at a particular address is reached. imm ...

Page 143

CPS Change Processor State. 12.17.2.1 Syntax CPSeffect iflags where: effect IE ID iflags i f 12.17.2.2 Operation CPS changes the PRIMASK and FAULTMASK special register values. See registers” on page 10 12.17.2.3 Restrictions The restrictions are: • use CPS ...

Page 144

DMB Data Memory Barrier. 12.17.3.1 Syntax DMB{cond} where: cond 12.17.3.2 Operation DMB acts as a data memory barrier. It ensures that all explicit memory accesses that appear, in program order, before the DMB instruction are completed before any explicit ...

Page 145

DSB Data Synchronization Barrier. 12.17.4.1 Syntax DSB{cond} where: cond 12.17.4.2 Operation DSB acts as a special data synchronization memory barrier. Instructions that come after the DSB, in program order, do not execute until the DSB instruction completes. The DSB ...

Page 146

ISB Instruction Synchronization Barrier. 12.17.5.1 Syntax ISB{cond} where: cond 12.17.5.2 Operation ISB acts as an instruction synchronization barrier. It flushes the pipeline of the processor, so that all instructions following the ISB are fetched from memory again, after the ...

Page 147

MRS Move the contents of a special register to a general-purpose register. 12.17.6.1 Syntax MRS{cond} Rd, spec_reg where: cond Rd spec_reg PRIMASK, BASEPRI, BASEPRI_MAX, FAULTMASK, or CONTROL. 12.17.6.2 Operation Use MRS in combination with MSR as part of a ...

Page 148

MSR Move the contents of a general-purpose register into the specified special register. 12.17.7.1 Syntax MSR{cond} spec_reg, Rn where: cond Rn spec_reg PRIMASK, BASEPRI, BASEPRI_MAX, FAULTMASK, or CONTROL. 12.17.7.2 Operation The register access operation in MSR depends on the ...

Page 149

NOP No Operation. 12.17.8.1 Syntax NOP{cond} where: cond 12.17.8.2 Operation NOP does nothing. NOP is not necessarily a time-consuming NOP. The processor might remove it from the pipeline before it reaches the execution stage. Use NOP for padding, for ...

Page 150

SEV Send Event. 12.17.9.1 Syntax SEV{cond} where: cond 12.17.9.2 Operation SEV is a hint instruction that causes an event to be signaled to all processors within a multipro- cessor system. It also sets the local event register to 1, ...

Page 151

SVC Supervisor Call. 12.17.10.1 Syntax SVC{cond} #imm where: cond imm 12.17.10.2 Operation The SVC instruction causes the SVC exception. imm is ignored by the processor. If required, it can be retrieved by the exception handler to determine what service ...

Page 152

WFE Wait For Event. 12.17.11.1 Syntax WFE{cond} where: cond 12.17.11.2 Operation WFE is a hint instruction. If the event register is 0, WFE suspends execution until one of the following events occurs: • an exception, unless masked by the ...

Page 153

WFI Wait for Interrupt. 12.17.12.1 Syntax WFI{cond} where: cond 12.17.12.2 Operation WFI is a hint instruction that suspends execution until one of the following events occurs: • an exception • a Debug Entry request, regardless of whether Debug is ...

Page 154

About the Cortex-M3 The address map of the Private peripheral bus (PPB) is: Table 12-26. Core peripheral register regions Address 0xE000E008- 0xE000E00F 0xE000E010- 0xE000E01F 0xE000E100- 0xE000E4EF 0xE000ED00- 0xE000ED3F 0xE000ED90- 0xE000EDB8 0xE000EF00- 0xE000EF03 In register descriptions: • the register type ...

Page 155

Nested Vectored Interrupt Controller This section describes the Nested Vectored Interrupt Controller (NVIC) and the registers it uses. The NVIC supports: • interrupts. • A programmable priority level of 0-15 for each interrupt. A higher level ...

Page 156

Interrupt Priority Registers map to an array of 4-bit integers, so that the array IP[0] to IP[29] corresponds to the registers IPR0-IPR7, and the array entry IP[n] holds the interrupt priority for interrupt n. ...

Page 157

Interrupt Set-enable Registers The ISER0-ISER1 register enables interrupts, and show which interrupts are enabled. See: • the register summary in • Table 12-28 on page 114 The bit assignments are • ...

Page 158

Interrupt Clear-enable Registers The ICER0-ICER1 register disables interrupts, and shows which interrupts are enabled. See: • the register summary in • Table 12-28 on page 114 The bit assignments are • ...

Page 159

Interrupt Set-pending Registers The ISPR0-ISPR1 register forces interrupts into the pending state, and shows which interrupts are pending. See: • the register summary in • Table 12-28 on page 114 The bit assignments are ...

Page 160

Interrupt Clear-pending Registers The ICPR0-ICPR1 register removes the pending state from interrupts, and show which inter- rupts are pending. See: • the register summary in • Table 12-28 on page 114 The bit assignments are ...

Page 161

Interrupt Active Bit Registers The IABR0-IABR1 register indicates which interrupts are active. See: • the register summary in • Table 12-28 on page 114 The bit assignments are • ACTIVE Interrupt ...

Page 162

Interrupt Priority Registers The IPR0-IPR7 registers provide a 4-bit priority field for each interrupt (See the “Peripheral Iden- tifiers” section of the datasheet for more details). These registers are byte-accessible. See the register summary in fields, that map up ...

Page 163

IPR2 12.19.7.5 IPR1 12.19.7.6 IPR0 • Priority, byte offset 3 • Priority, byte offset 2 ...

Page 164

Find the IPR number and byte offset for interrupt N as follows: • the corresponding IPR number given DIV 4 • the byte offset of the required Priority field in this register is N ...

Page 165

Software Trigger Interrupt Register Write to the STIR to generate a Software Generated Interrupt (SGI). See the register summary in Table 12-27 on page 113 When the USERSETMPEND bit in the SCR is set to 1, unprivileged software can ...

Page 166

Level-sensitive interrupts The processor supports level-sensitive interrupts. A level-sensitive interrupt is held asserted until the peripheral deasserts the interrupt signal. Typ- ically this happens because the ISR accesses the peripheral, causing it to clear the interrupt request. When the ...

Page 167

NVIC design hints and tips Ensure software uses correctly aligned register accesses. The processor does not support unaligned accesses to NVIC registers. See the individual register descriptions for the supported access sizes. A interrupt can enter pending state even ...

Page 168

System control block The System control block (SCB) provides system implementation information, and system con- trol. This includes configuration, control, and reporting of the system exceptions. The system control block registers are: Table 12-30. Summary of the system control ...

Page 169

Auxiliary Control Register The ACTLR provides disable bits for the following processor functions: • IT folding • write buffer use for accesses to the default memory map • interruption of multi-cycle instructions. See the register summary in ments are: ...

Page 170

CPUID Base Register The CPUID register contains the processor part number, version, and implementation informa- tion. See the register summary in are Variant PartNo • Implementer Implementer code: 0x41 = ARM ...

Page 171

Interrupt Control and State Register The ICSR: • provides: – set-pending and clear-pending bits for the PendSV and SysTick exceptions • indicates: – the exception number of the exception being processed – whether there are preempted active exceptions – ...

Page 172

PENDSTSET RW SysTick exception set-pending bit. Write effect 1 = changes SysTick exception state to pending. Read SysTick exception is not pending 1 = SysTick exception is pending. • PENDSTCLR WO SysTick exception clear-pending ...

Page 173

RETTOBASE RO Indicates whether there are preempted active exceptions there are preempted active exceptions to execute 1 = there are no active exceptions, or the currently-executing exception is the only active exception. • VECTACTIVE RO Contains the ...

Page 174

Vector Table Offset Register The VTOR indicates the offset of the vector table base address from memory address 0x00000000. See the register summary in The bit assignments are Reserved TBLOFF • ...

Page 175

Application Interrupt and Reset Control Register The AIRCR provides priority grouping control for the exception model, endian status for data accesses, and reset control of the system. See the register summary in 126 and To write to this register, ...

Page 176

VECTCLRACTIVE WO Reserved for Debug use. This bit reads as 0. When writing to the register you must write 0 to this bit, otherwise behavior is Unpredictable. • VECTRESET WO Reserved for Debug use. This bit reads as 0. ...

Page 177

System Control Register The SCR controls features of entry to and exit from low power state. See the register summary in Table 12-30 on page 126 Reserved • SEVONPEND Send Event ...

Page 178

Configuration and Control Register The CCR controls entry to Thread mode and enables: • the handlers for hard fault and faults escalated by FAULTMASK to ignore bus faults • trapping of divide by zero and unaligned accesses • access ...

Page 179

If this bit is set unaligned access generates a usage fault. Unaligned LDM, STM, LDRD, and STRD instructions always fault irrespective of whether UNALIGN_TRP is set to 1. • ...

Page 180

System Handler Priority Registers The SHPR1-SHPR3 registers set the priority level the exception handlers that have configurable priority. SHPR1-SHPR3 are byte accessible. See the register summary in their attributes. The system fault handlers and the ...

Page 181

System Handler Priority Register 1 The bit assignments are • PRI_7 Reserved • PRI_6 Priority of system handler 6, usage fault • PRI_5 Priority of system handler 5, bus fault • ...

Page 182

System Handler Priority Register 2 The bit assignments are • PRI_11 Priority of system handler 11, SVCall 12.20.9.3 System Handler Priority Register 3 The bit assignments are ...

Page 183

System Handler Control and State Register The SHCSR enables the system handlers, and indicates: • the pending status of the bus fault, memory management fault, and SVC exceptions • the active status of the system handlers. See the register ...

Page 184

MONITORACT Debug monitor active bit, reads Debug monitor is active • SVCALLACT SVC call active bit, reads SVC call is active • USGFAULTACT Usage fault exception active bit, reads exception ...

Page 185

Configurable Fault Status Register The CFSR indicates the cause of a memory management fault, bus fault, or usage fault. See the register summary The following subsections describe the subregisters that ...

Page 186

Memory Management Fault Status Register The flags in the MMFSR indicate the cause of memory access faults. The bit assignments are MMARVALID Reserved • MMARVALID Memory Management Fault Address Register (MMAR) valid flag value in ...

Page 187

Bus Fault Status Register The flags in the BFSR indicate the cause of a bus access fault. The bit assignments are BFRVALID Reserved • BFARVALID Bus Fault Address Register (BFAR) valid flag value in BFAR ...

Page 188

PRECISERR Precise data bus error precise data bus error data bus error has occurred, and the PC value stacked for the exception return points to the instruction that caused the fault. When the ...

Page 189

Usage Fault Status Register The UFSR indicates the cause of a usage fault. The bit assignments are Reserved • DIVBYZERO Divide by zero usage fault divide by zero fault, or divide by ...

Page 190

When this bit is set to 1, the PC value stacked for the exception return points to the instruction that attempted the illegal use of the EPSR. This bit is not set undefined instruction uses the ...

Page 191

Hard Fault Status Register The HFSR gives information about events that activate the hard fault handler. See the register summary in This register is read, write to clear. This means that bits in the register read normally, but writing ...

Page 192

Memory Management Fault Address Register The MMFAR contains the address of the location that generated a memory management fault. See the register summary • ADDRESS When the MMARVALID bit of ...

Page 193

Bus Fault Address Register The BFAR contains the address of the location that generated a bus fault. See the register sum- mary • ADDRESS When the BFARVALID bit of the ...

Page 194

System control block design hints and tips Ensure software uses aligned accesses of the correct size to access the system control block registers: • except for the CFSR and SHPR1-SHPR3, it must use aligned word accesses • for the ...

Page 195

System timer, SysTick The processor has a 24-bit system timer, SysTick, that counts down from the reload value to zero, reloads (wraps to) the value in the LOAD register on the next clock edge, then counts down on subsequent ...

Page 196

SysTick Control and Status Register The SysTick CTRL register enables the SysTick features. See the register summary page 153 Reserved • COUNTFLAG Returns 1 if timer counted to ...

Page 197

SysTick Reload Value Register The LOAD register specifies the start value to load into the VAL register. See the register sum- mary • RELOAD Value to load into the VAL ...

Page 198

SysTick Current Value Register The VAL register contains the current value of the SysTick counter. See the register summary in Table 12-33 on page 153 • CURRENT Reads return the current ...

Page 199

SysTick Calibration Value Register The CALIB register indicates the SysTick calibration properties. See the register summary in Table 12-33 on page 153 31 30 NOREF SKEW • NOREF Reads as zero. • SKEW ...

Page 200

Memory protection unit This section describes the Memory protection unit (MPU). The MPU divides the memory map into a number of regions, and defines the location, size, access permissions, and memory attributes of each region. It supports: • independent ...

Related keywords