SAM D21 DA1 Family DataSheet DS40001882F
SAM D21 DA1 Family DataSheet DS40001882F
SAM D21 DA1 Family DataSheet DS40001882F
Features
• Processor
® ®
– Arm Cortex -M0+ CPU running at up to 48 MHz
• Single-cycle hardware multiplier
• Micro Trace Buffer (MTB)
• Memories
– 4/2/1/0.5 KB Read-While-Write (RWW) Flash section (not available on 256KB devices)
– 256/128/64/32/16 KB in-system self-programmable Flash
– 32/16/8/4 KB SRAM Memory
• System
– Power-on Reset (POR) and Brown-out Detection (BOD)
– Internal and external clock options with 48 MHz Digital Frequency-Locked Loop (DFLL48M) and 48 MHz to
96 MHz Fractional Digital Phase-Locked Loop (FDPLL96M)
– External Interrupt Controller (EIC)
– 16 external interrupts
– One Non-maskable Interrupt (NMI)
– Two-pin Serial Wire Debug (SWD) programming, test and debugging interface
• Low Power
– Idle and Stand-by Sleep modes
– SleepWalking peripherals
• Peripherals
– 12-channel Direct Memory Access Controller (DMAC)
– 12-channel Event System
– Up to five 16-bit Timer/Counters (TC), configurable as either:
• One 16-bit TC with two compare/capture channels
• One 8-bit TC with two compare/capture channels
• One 32-bit TC with two compare/capture channels, by using two TCs
– Up to four 24-bit Timer/Counters for Control (TCC), with extended functions:
• Up to four compare channels with optional complementary output
• Generation of synchronized pulse width modulation (PWM) pattern across port pins
• Deterministic fault protection, fast decay and configurable dead-time between complementary output
• Dithering that increase resolution with up to 5 bit and reduce quantization error
– 32-bit Real Time Counter (RTC) with clock/calendar function
– Watchdog Timer (WDT)
– CRC-32 generator
– One full-speed (12 Mbps) Universal Serial Bus (USB) 2.0 interface
• Embedded host and device function
• Eight endpoints
– Up to six Serial Communication Interfaces (SERCOM), each configurable to operate as either:
Table of Contents
Features......................................................................................................................................................... 1
1. Description............................................................................................................................................ 13
2. Configuration Summary........................................................................................................................ 14
4. Block Diagram.......................................................................................................................................19
5. Pinout.................................................................................................................................................... 20
5.1. SAM D21J and SAM DA1J.........................................................................................................20
5.2. SAM D21GxxA/B/D and SAM DA1GxxA/B................................................................................ 22
5.3. SAM D21GxxA........................................................................................................................... 23
5.4. SAM D21GxxL............................................................................................................................24
5.5. SAM D21ExxA/B/D and SAM DA1ExxA/B................................................................................. 25
5.6. SAM D21ExxB/C/D.................................................................................................................... 26
5.7. SAM D21ExxL............................................................................................................................ 27
9. Product Mapping................................................................................................................................... 40
10. Memories.............................................................................................................................................. 42
10.1. Embedded Memories................................................................................................................. 42
10.2. Physical Memory Map................................................................................................................ 42
10.3. NVM Calibration and Auxiliary Space........................................................................................ 43
30. TC – Timer/Counter.............................................................................................................................556
30.1. Overview.................................................................................................................................. 556
30.2. Features................................................................................................................................... 556
30.3. Block Diagram.......................................................................................................................... 557
30.4. Signal Description.................................................................................................................... 557
30.5. Product Dependencies............................................................................................................. 558
30.6. Functional Description..............................................................................................................559
30.7. Register Summary for 8-bit Registers...................................................................................... 571
30.8. Register Description for 8-bit Registers....................................................................................571
30.9. Register Summary for 16-bit Registers.................................................................................... 587
30.10. Register Description for 16-bit Registers................................................................................. 587
30.11. Register Summary for 32-bit Registers.................................................................................... 602
30.12. Register Description for 32-bit Registers................................................................................. 602
Customer Support.....................................................................................................................................1112
Trademarks...............................................................................................................................................1114
1. Description
The SAM D21/DA1 is a series of low-power microcontrollers using the 32-bit ARM® Cortex®-M0+ processor, and
ranging from 32-pins to 64-pins with up to 256 KB Flash and 32 KB of SRAM. The SAM D21/DA1 operates at a
maximum frequency of 48 MHz and reach 2.46 CoreMark/MHz. They are designed for simple and intuitive migration
with identical peripheral modules, hex compatible code, identical linear address map, and pin compatible migration
paths between all devices in the product series. All devices include intelligent and flexible peripherals, Event System
for inter-peripheral signaling, and support for capacitive touch button, slider, and wheel user interfaces.
The SAM D21/DA1 provides the following features: In-system programmable Flash, 12-channel Direct Memory
Access Controller (DMAC), 12-channel Event System, programmable Interrupt Controller, up to 52 programmable I/O
pins, 32-bit Real-Time Clock and Calendar (RTC), up to five 16-bit Timer/Counters (TC) and up to four 24-bit Timer/
Counters for Control (TCC), where each TC can be configured to perform frequency and waveform generation,
accurate program execution timing or input capture with time and frequency measurement of digital signals. The TCs
can operate in 8- or 16-bit mode, selected TCs can be cascaded to form a 32-bit TC, and three timer/counters have
extended functions optimized for motor, lighting, and other control applications. The series provide one full-speed
USB 2.0 embedded host and device interface; up to six Serial Communication Modules (SERCOM) that each can be
configured to act as an USART, UART, SPI, I2C up to 3.4MHz, SMBus, PMBus, and LIN slave; two-channel I2S
interface; up to twenty-channel 350 ksps 12-bit ADC with programmable gain and optional oversampling and
decimation supporting up to 16-bit resolution, one 10-bit 350 ksps DAC, up to four analog comparators with Window
mode, Peripheral Touch Controller (PTG) supporting up to 256 buttons, sliders, wheels, and proximity sensing;
programmable Watchdog Timer (WDT), brown-out detector and power-on Reset and two-pin Serial Wire Debug
(SWD) program and debug interface.
All devices have accurate and low-power external and internal oscillators. All oscillators can be used as a source for
the system clock. Different clock domains can be independently configured to run at different frequencies, enabling
power saving by running each peripheral at its optimal clock frequency, and thus maintaining a high CPU frequency
while reducing power consumption.
The SAM D21/DA1 have two software-selectable sleep modes, Idle and Stand-by. In Idle mode, the CPU is stopped
while all other functions can be kept running. In Stand-by mode, all clocks and functions are stopped, expect those
selected to continue running. The device supports SleepWalking. This feature allows the peripheral to wake up from
sleep based on predefined conditions, and thus allows the CPU to wake up only when needed, e.g., when a
threshold is crossed or a result is ready. The Event System supports synchronous and asynchronous events,
allowing peripherals to receive, react to and send events even in Stand-by mode.
The Flash program memory can be reprogrammed in-system through the SWD interface. The same interface can be
used for non-intrusive on-chip debug of application code. A boot loader running in the device can use any
communication interface to download and upgrade the application program in the Flash memory.
The SAM D21/DA1 microcontrollers are supported with a full suite of program and system development tools,
including C compilers, macro assemblers, program debugger/simulators, programmers, and evaluation kits.
2. Configuration Summary
Table 2-1. SAM D21 E/G/J and SAM D21 EL/GL Product Family Features
Oscillators Peripherals Analog
Analog Comparator
Packages
DMA Channels
ADC Channels
Pins
SERCOM
External
Device
I/O Pins
Internal
WDT
DAC
USB
TCC
RTC
I2S
ATSAMD21E15A 32 4
ATSAMD21E16A 64 8
OSC32K,
ATSAMD21E17A 128 16 TQFP, OSCULP32K,
32
ATSAMD21E18A 256 32 QFN OSC8M, 3 12 Y
4 8/4/2 26 10 60/6
DFLL48M,
ATSAMD21E15B 32 4
FDPLL96M
ATSAMD21E16B 64 8
ATSAMD21E15C 32 4
35 WLCSP
ATSAMD21E16C 64 8
3/2 Y 12 16
ATSAMD21G15A 32 4
ATSAMD21G16A 64 8
OSC32K,
ATSAMD21G15B 32 4 Y
6 8/4/2
ATSAMD21G16B 64 8
ATSAMD21J15A 32 4
ATSAMD21J16A 64 8 TQFP,
ATSAMD21J15B 32 4 OSC8M, 3
TQFP,QFN,UFBGA
DFLL48M,
ATSAMD21J16B 64 8
FDPLL96M 12 Y Y 12 16
ATSAMD21E15L 32 4 32 TQFP,
N 4 3/2 6/4/2 26 14
ATSAMD21E16L 64 8 32 QFN XOSC N 4 N
128 16 OSC32K,
TQFP,
OSCULP32K, XOSC32K,
ATSAMD21E17D 32 QFN Y 4 3/2 4 6/4/2/6 Y 26 10 2 30/6
OSC8M, XOSC
WLCSP
DFLL48M,
...........continued
Analog Comparator
Packages
DMA Channels
ADC Channels
Pins
SERCOM
External
Device
I/O Pins
Internal
WDT
DAC
USB
TCC
RTC
I2S
128 16 OSC32K,
OSCULP32K,
QFN, XOSC32K,
ATSAMD21G17D 48 OSC8M, Y 6 3/2 4 8/4/2/8 Y 12 Y Y 12 16 38 14 2 Y 120/10
TQFP XOSC,
DFLL48M,
FDPLL96M
128 16 OSC32K,
QFN, OSCULP32K,
XOSC32K,
ATSAMD21J17D 64 TQFP OSC8M, Y 6 5/2 4 8/4/2/8 Y 12 Y Y 12 16 52 20 2 Y 256/16
XOSC,
UFBGA DFLL48M,
FDPLL96M
128 16 OSC32K,
OSCULP32K,
QFN,
ATSAMD21E17L 32 OSC8M, XOSC N 4 3/2 4 6/4/2/6 N 12 Y Y 12 16 26 14 4 Y N
TQFP
DFLL48M,
FDPLL96M
128 16 OSC32K,
OSCULP32K,
DFLL48M,
FDPLL96M
Note:
1. This part number is also available in a 45-Ball WLCSP package with a total of five TC instances and 15 ADC
Channels.
capacitance Channels)
Program Memory (KB)
Analog Comparator
Data Memory (KB)
PTC (Mutual/Self-
per TCC Instance
per TC Instance
DMA Channels
ADC Channels
Packages
SERCOM
External
I/O Pins
Internal
WDT
DAC
Pins
USB
TCC
RTC
I2S
Device
ATSAMDA1E14B 16
4
ATSAMDA1E15B 32 32 4 6/4/2 26 10 60/6
ATSAMDA1E16B 64 8
TQFP,
3/2
QFN
ATSAMDA1G14B 16 OSC32K,
4
OSCULP32K, XOSC32K,
ATSAMDA1G15B 32 48 1 3 1 12 Y Y 12 16 38 14 2 1 120/10
OSC8M, DFLL48M, XOSC
ATSAMDA1G16B 64 8 FDPLL96M
6 8/4/2
ATSAMDA1J14B 16
4
ATSAMDA1J15B 32 64 TQFP 5/2 52 20 256/16
ATSAMDA1J16B 64 8
Product Family
SAMD = General Purpose Microcontroller Package Carrier
No character = Tray (Default)
Product Series T = Tape and Reel
21 = Cortex M0 + CPU, Basic Feature Set
+ DMA + USB Package Grade
Pin Count U = -40 - 85°C Matte Sn Plating
E = 32 Pins (35 Pins for WLCSP) N = -40 - 105°C Matte Sn Plating
G = 48 Pins (45 Pins for WLCSP) F = -40 - 125°C Matte Sn Plating
J = 64 Pins Z = -40 - 125°C Matte Sn Plating
Flash Memory Density (AEC-Q100 Qualified)
18 = 256 KB Package Type
17 = 128 KB A = TQFP(4)
16 = 64 KB M = QFN(4)
15 = 32 KB U = WLCSP (2,3)
Device Variant C = UFBGA
A = Default Variant
B = Added RWW support for 32 KB and 64 KB memory options
C = Silicon revision F for WLCSP45 package option
L = Pinout optimized for Analog and PWM
D = Silicon Revision G with RWW Support in 128KB memory options
Note:
1. Not all combinations are valid. The available ordering numbers are listed in the Configuration Summary.
2. WLCSP package is available in -40C to 85C operating temperature range.
3. WLCSP parts are programmed with a specific SPI/I2C bootloader. Refer to "Application Note AT09002" for
additional information. Contact Microchip sales office for additional information on availability.
4. The AEC-Q100 grade 1 qualified version is only offered in the TQFP and QFN packages. The QFN will have
wettable flanks, and both packages will be assembled with gold bond wires.
E = 32 Pins
G = 48 Pins
J = 64 Pins Package Type
Flash Memory Density A = TQFP
16 = 64KB M = QFN Wettable Flanks
15 = 32KB
14 = 16KB
Device Variant
A = Silicon revision E (Initial revision)
B = Silicon revision F
Note:
1. Not all combinations are valid. The available ordering numbers are listed in the Configuration Summary.
4. Block Diagram
IOBUS
256/128/64/32KB 32/16/8/4KB
TRACE BUFFER
CORTEX-M0+ NVM RAM
MICRO
SWCLK SERIAL PROCESSOR
Fmax 48 MHz NVM
SWDIO WIRE SRAM
CONTROLLER
CONTROLLER
Cache
DEVICE
SERVICE
UNIT
M M S S
HIGH-SPEED
M DMA
BUS MATRIX
PERIPHERAL
DP
ACCESS CONTROLLER USB FS
S S S DM
DEVICE
MINI-HOST SOF 1KHZ
PERIPHERAL PERIPHERAL
ACCESS CONTROLLER ACCESS CONTROLLER
PAD1
66xxSERCOM
SERCOM
VREF PAD2
PAD3
BOD33 OSCULP32K
OSC32K DMA
XIN32
WO0
XOUT32 XOSC32K OSC8M 5 x TIMER / COUNTER
8 x Timer Counter WO1
DFLL48M
XIN
XOUT XOSC FDPLL96M
PORT
DMA WO0
WO1
4x TIMER / COUNTER
EVENT SYSTEM
CLOCK
DMA AIN[19..0]
CONTROLLER
20-CHANNEL VREFA
RESET SLEEP 12-bit ADC 350KSPS
VREFB
RESETN
CONTROLLER CONTROLLER
CMP[1..0]
GENERIC CLOCK Up to 4 ANALOG AIN[3..0]
GCLK_IO[7..0]
CONTROLLER COMPARATORS
REAL TIME
DMA
COUNTER VOUT
10-bit DAC
WATCHDOG VREFA
TIMER
EXTINT[15..0] EXTERNAL INTERRUPT X[15..0]
NMI
CONTROLLER PERIPHERAL
TOUCH
Y[15..0]
CONTROLLER
DMA
MCK[1..0]
INTER-IC SCK[1..0]
SOUND SD[1..0]
CONTROLLER FS[1..0]
1. Some products have different number of SERCOM instances, Timer/Counter instances, PTC signals and ADC
signals. Refer to the Configuration Summary for details.
2. The TCC instances have different configurations, including the number of Waveform Output (WO) lines. Refer
to the TCC Configuration for details.
Related Links
2. Configuration Summary
7.2.5 TCC Configurations
5. Pinout
VDDCORE
RESET
VDDIN
PB01
PB31
PA31
PB02
PB22
PB00
PB30
PA30
PB03
PA27
PB23
PA28
GND
61
51
49
62
52
64
60
63
54
50
56
57
53
59
58
55
PA00 1 48 VDDIO
PA01 2 47 GND
PA02 3 46 PA25
PA03 4 45 PA24
PB04 5 44 PA23
PB05 6 43 PA22
GNDANA 7 42 PA21
VDDANA 8 41 PA20
PB06 9 40 PB17
PB07 10 39 PB16
PB08 11 38 PA19
PB09 12 37 PA18
PA04 13 36 PA17
PA05 14 35 PA16
PA06 15 34 VDDIO
PA07 16 33 GND
21
31
22
24
20
23
26
27
28
29
25
32
30
17
18
19
VDDIO
PB11
GND
PB12
PB10
PB14
PB13
PB15
PA11
PA12
PA10
PA14
PA13
PA08
PA09
PA15
DIGITAL PIN
ANALOG PIN
OSCILLATOR
GROUND
INPUT SUPPLY
REGULATED OUTPUT SUPPLY
RESET PIN
5.1.2 UFBGA64
VDDCORE
RESET
VDDIN
PA31
PB02
PB22
PA30
PB03
PA27
PB23
PA28
GND
41
42
44
40
46
47
43
48
45
37
39
38
PA00 1 36 VDDIO
PA01 2 35 GND
PA02 3 34 PA25
PA03 4 33 PA24
GNDANA 5 32 PA23
VDDANA 6 31 PA22
PB08 7 30 PA21
PB09 8 29 PA20
PA04 9 28 PA19
PA05 10 27 PA18
PA06 11 26 PA17
PA07 12 25 PA16
21
22
20
24
23
14
13
16
17
18
19
15
VDDIO
PB11
GND
PB10
PA11
PA12
PA14
PA10
PA13
PA08
PA09
PA15
DIGITAL PIN
ANALOG PIN
OSCILLATOR
GROUND
INPUT SUPPLY
REGULATED OUTPUT SUPPLY
RESET PIN
5.3.1 WLCSP45
5.4.1 QFN48
VDDCORE
RESETN
VDDIN
PA27
PA28
PB02
PB01
PB00
PA31
PA30
PB03
GND
41
42
40
44
43
46
47
45
37
48
38
39
PA02 1 36 VDDIO
PA03 2 35 GND
PB04 3 34 PA25
PB05 4 33 PA24
GNDANA 5 32 PA23
VDDANA 6 31 PA22
PB08 7 30 PA21
PB09 8 29 PA20
PA04 9 28 PA19
PA05 10 27 PA18
PA06 11 26 PA17
PA07 12 25 PA16
21
24
22
23
20
19
18
17
16
14
13
15
VDDIO
PB11
GND
PB10
PA11
PA12
PA14
PA13
PA15
PA10
PA09
PA08
DIGITAL PIN
ANALOG PIN
OSCILLATOR
GROUND
INPUT SUPPLY
REGULATED OUTPUT SUPPLY
RESET PIN
VDDCORE
RESET
VDDIN
PA31
PA30
PA27
PA28
GND
31
26
27
29
28
32
25
30
PA00 1 24 PA25
PA01 2 23 PA24
PA02 3 22 PA23
PA03 4 21 PA22
PA04 5 20 PA19
PA05 6 19 PA18
PA06 7 18 PA17
PA07 8 17 PA16
11
12
10
14
16
13
9
15
GND
VDDANA
PA11
PA10
PA14
PA08
PA09
PA15
DIGITAL PIN
ANALOG PIN
OSCILLATOR
GROUND
INPUT SUPPLY
REGULATED OUTPUT SUPPLY
RESET PIN
5.6.1 WLCSP35
A B C D E F
RE
1 PA
0 0
PA
30
VD
DC
O
GN
D
RE
SE
T
PA
25
2 PA
0 1
PA
31
VD
DI
N
PA
28
PA
27
PA
24
A
3 GN
D AN
PA
02
PA
03
GN
D
PA
2 2
PA
23
NA
4 VD
DA PA
0 4
PA
0 5
PA
11
PA
17
PA
19
5 PA
0 6
PA
0 7
PA
08
PA
09
PA
16
PA
18
6 VD
DI
O
PA
1 0
GN
D
PA
1 4
PA
15
VDDCORE
RESETN
VDDIO
PA31
PB02
PB03
PA30
GND
31
27
26
29
28
32
25
30
PA02 1 24 PA25
PA03 2 23 PA24
PB04 3 22 PA23
PB05 4 21 PA22
PA04 5 20 PA19
PA05 6 19 PA18
PA06 7 18 PA17
PA07 8 17 PA16
11
12
10
14
13
16
15
9
GND
PA11
VDDIO/ANA
PA10
PA14
PA08
PA09
PA15
Digital Pin
Analog Pin
Oscillator Pin
Ground
Input Supply
Regulated Output Supply
Reset Pin
...........continued
Signal Name Function Type Active Level
Peripheral Touch Controller - PTC
X[15:0] PTC Input Analog
Y[15:0] PTC Input Analog
General Purpose I/O - PORT
PA25 - PA00 Parallel I/O Controller I/O Port A I/O
PA28 - PA27 Parallel I/O Controller I/O Port A I/O
PA31 - PA30 Parallel I/O Controller I/O Port A I/O
PB17 - PB00 Parallel I/O Controller I/O Port B I/O
PB23 - PB22 Parallel I/O Controller I/O Port B I/O
PB31 - PB30 Parallel I/O Controller I/O Port B I/O
Universal Serial Bus - USB
DP DP for USB I/O
DM DM for USB I/O
SOF 1kHz USB Start of Frame I/O
SAMD2xE SAMD2xG SAMD2xJ EIC REF ADC AC PTC DAC SERCOM(2)(3) SERCOM-ALT TC(4) TCC COM AC/
/TCC GCLK
WO[0]
5 9 13 PA04 VDDANA EXTINT[4] ADC/VREFB AIN[4] AIN[0] Y[2] SERCOM0/ TCC0/WO[0] TCC3/
PAD[0]
WO[2]
8 12 16 PA07 VDDANA EXTINT[7] AIN[7] AIN[3] Y[5] SERCOM0/ TCC1/WO[1] TCC3/ I2S/SD[0]
PAD[3]
WO[5]
11 13 17 PA08 VDDIO NMI AIN[16] X[0] SERCOM0/ SERCOM2/ TCC0/WO[0] TCC1/ I2S/SD[1]
PAD[0] PAD[0] WO[2]
12 14 18 PA09 VDDIO EXTINT[9] AIN[17] X[1] SERCOM0/ SERCOM2/ TCC0/WO[1] TCC1/ I2S/
PAD[1] PAD[1] WO[3] MCK[0]
13 15 19 PA10 VDDIO EXTINT[10] AIN[18] X[2] SERCOM0/ SERCOM2/ TCC1/WO[0] TCC0/ I2S/ GCLK_IO[4]
PAD[2] PAD[2] WO[2] SCK[0]
14 16 20 PA11 VDDIO EXTINT[11] AIN[19] X[3] SERCOM0/ SERCOM2/ TCC1/WO[1] TCC0/ I2S/FS[0] GCLK_IO[5]
PAD[3] PAD[3] WO[3]
...........continued
SAMD2xE SAMD2xG SAMD2xJ EIC REF ADC AC PTC DAC SERCOM(2)(3) SERCOM-ALT TC(4) TCC COM AC/
/TCC GCLK
20 28 38 PA19 VDDIO EXTINT[3] X[7] SERCOM1/ SERCOM3/ TC3/WO[1] TCC0/ I2S/SD[0] AC/CMP[1]
PAD[3] PAD[3] WO[3]
29 41 PA20 VDDIO EXTINT[4] X[8] SERCOM5/ SERCOM3/ TC7/WO[0] TCC0/ I2S/ GCLK_IO[4]
PAD[2] PAD[2] WO[6] SCK[0]
30 42 PA21 VDDIO EXTINT[5] X[9] SERCOM5/ SERCOM3/ TC7/WO[1] TCC0/ I2S/FS[0] GCLK_IO[5]
PAD[3] PAD[3] WO[7]
22 32 44 PA23 VDDIO EXTINT[7] X[11] SERCOM3/ SERCOM5/ TC4/WO[1] TCC0/ USB/SOF 1kHz GCLK_IO[7]
PAD[1] PAD[1] WO[5]
WO[6]
WO[7]
SAMD21ExL SAMD21GxL EIC REF ADC AC AC1 DAC SERCOM(1)(2) SERCOM-ALT(7) TC(3) TCC COM AC/
/TCC GCLK
WO[0]
WO[1]
...........continued
SAMD21ExL SAMD21GxL EIC REF ADC AC AC1 DAC SERCOM(1)(2) SERCOM-ALT(7) TC(3) TCC COM AC/
/TCC GCLK
WO[6]
WO[7]
45 PB00 AIN[8]
46 PB01 AIN[9]
1. All analog pin functions are on peripheral function B. Peripheral function B must be selected to disable the
digital control of the pin.
2. Only some pins can be used in SERCOM I2C mode.
3. Note that TC6 and TC7 are not supported on the SAM D21ExL and SAM D21GxL devices. Refer to 2.
Configuration Summary for details.
4. This function is only activated in the presence of a debugger.
5. If the PA24 and PA25 pins are not connected, it is recommended to enable a pull-up on PA24 and PA25
through input GPIO mode. The aim is to avoid an eventually extract power consumption (<1mA) due to a not
stable level on pad. The port PA24 and PA25 doesn't have Drive Strength option.
6. TC6 is only available on the SAM D21GxL and not the SAM D21ExL.
7. SERCOM4 and SERCOM5 are not supported on the SAM D21E devices. Refer to 2. Configuration Summary
for details.
Related Links
37. Electrical Characteristics
3 PA25 PA24 PA23 PA22 PA21 PA20 PB17 PB16 PA19 PA18 PA17 PA16 VDDIO pin 48/GND pin47 and VDDIO
pin34/GND pin33
4 PA15 PA14 PA13 PA12 PB15 PB14 PB13 PB12 PB11 PB10 VDDIO pin 34/GND pin33 and VDDIO
pin21/GND pin22
6 PA07 PA06 PA05 PA04 PB09 PB08 PB07 PB06 VDDANA pin 8/GNDANA pin7
7 PB05 PB04 PA03 PA02 PA01 PA00 PB03 PB02 PB01 PB00 VDDANA pin 8/GNDANA pin7
...........continued
PACKAGE CLUSTER GPIO SUPPLIES PINS CONNECTED TO
THE CLUSTER
3 PA25 PA24 PA23 PA22 PA21 PA20 PA19 PA18 PA17 PA16 PA15 PA14 PA13 PA12 PB11 PB10 VDDIO pin36/GND pin35 and VDDIO
pin17/GND pin18
6 PA03 PA02 PA01 PA00 PB03 PB02 PB05 PB04 PB01 PB00 VDDANA pin6/GNDANA pin5
2 PA28 PA27 PA25 PA24 PA23 PA22 PA19 PA18 PA17 PA16 PA15 PA14 PA11 PA10 PA09 PA08 VDDIN pin30/GND pin 28 and
VDDANA pin9/GND pin10
3 PA07 PA06 PA05 PA04 PA03 PA02 PA01 PA00 PB05 PB04 PB03 PB02 VDDANA pin9/GND pin10
TCC# Channels Waveform Counter Size Fault Dithering Output Dead Time SWAP Pattern
(CC_NUM) Output Matrix Insertion Generation
(WO_NUM) (DTI)
2 2 2 16-bit Yes
Note: The number of CC registers (CC_NUM) for each TCC corresponds to the number of compare/capture
channels, so that a TCC can have more Waveform Outputs (WO_NUM) than CC registers.
VDDCORE
GNDANA
VDDANA
VDDIO
VDDIN
GND
ADC VOLTAGE PB[31:10]
OSC8M
REGULATOR
AC BOD12 PA[13:8]
PB[9:0] PA[31:16]
DAC
PTC
Digital Logic
(CPU, peripherals)
PA[1:0] XOSC32K POR
OSC32K DFLL48M
DEVICE
VDDANA
VDDIN
VDDCORE
GND
GNDANA
8.3 Power-Up
This section summarizes the power-up sequence of the device. The behavior after power-up is controlled by the
Power Manager. Refer to PM – Power Manager for details.
Related Links
16. PM – Power Manager
9. Product Mapping
Figure 9-1. SAM D21 Product Mapping
0x00000000
0x00000000
Device Variant A
Code Device Variant B/C/D/L AHB-APB Bridge C
0x00000000 0x00000000
Global Memory Space Internal Flash
Internal Flash 0x42000000
0x00040000 PAC2
0x00000000 0x00040000 Reserved 0x42000400
Reserved 0x00400000 EVSYS
Code Internal
0x1FFFFFFF 0x42000800
RWW section SERCOM0
0x20000000 0x1FFFFFFF
0x42000C00
SRAM SRAM SERCOM1
0x20000000
0x42001000
Internal SRAM
0x20008000 0x20007FFF
SERCOM2
0x42001400
Undefined AHB-APB SERCOM3
0x40000000
AHB-APB 0x42001800
0x40000000 SERCOM4
Bridge A
Peripherals 0x42001C00
0x41000000 SERCOM5
AHB-APB
0x42002000
0x43000000 Bridge B
TCC0
Reserved 0x42000000
0x42002400
AHB-APB TCC1
0x60000000
Bridge C
0x42FFFFFF 0x42002800
TCC2
IOBUS System 0x42002C00
0xE0000000
TC3
0x60000200 Reserved
0x42003000
Reserved 0xE000E000
TC4
0xE0000000 SCS
0x42003400
0xE000F000
System TC5
Reserved
0x42003800
0xFFFFFFFF 0xE00FF000
TC6
ROMTable
0x42003C00
0xE0100000
TC7
Reserved
0xFFFFFFFF 0x42004000
AHB-APB Bridge A ADC
AHB-APB Bridge B 0x42004400
0x40000000 0x41000000
AC
PAC0 PAC1
0x42004800
0x40000400 0x41002000
DAC
PM DSU
0x42004C00
0x40000800 0x41004000
PTC
SYSCTRL NVMCTRL
0x42005000
0x40000C00 0x41004400
I2S
GCLK PORT
0x42005400
0x40001000 0x41004800
AC1
WDT DMAC
0x42005800
0x40001400 0x41005000 Reserved
0x42
USB 0x42006000
RTC TCC3
0x40001800 0x41006000 0x42006090
EIC MTB 0x4200FFFF
Reserved
0x40001C00 0x41007000
Reserved Reserved
0x40FFFFFF 0x41FFFFFF
This figure represents the full configuration of the SAM D21 with maximum Flash and SRAM capabilities and a full set
of peripherals. Refer to the 2. Configuration Summary for details.
10. Memories
Internal Flash 0x00000000 256 Kbytes 128 Kbytes 64 Kbytes 32 Kbytes 64 Kbytes 32 Kbytes
IOBUS 0x60000000 0.5 Kbytes 0.5 Kbytes 0.5 Kbytes 0.5 Kbytes 0.5 Kbytes 0.5 Kbytes
Notes:
1. x = G, J or E.
2. Only applicable for device variants B, C, D,and L.
Table 10-3. SAM D21 Flash Memory Parameters(1,2)
...........continued
Device Flash size Number of pages Page size
SAMD21x16 64 Kbytes 1024 64 bytes
SAMD21x15 32 Kbytes 512 64 bytes
Notes:
1. x = G, J or E.
2. The number of pages (NVMP) and page size (PSZ) can be read from the NVM Pages and Page Size bits in the
NVM Parameter register in the NVMCTRL (PARAM.NVMP and PARAM.PSZ, respectively). Refer to NVM Parameter
(PARAM) register for details.
Table 10-5. SAM D21 RWW Section Parameters (Device Variants B, C, D,and L)
Note:
1. x = G, J, or E.
Related Links
22.8.3 PARAM
3. SAM D21 Ordering Information(1)
Calibration and
auxiliary space Area 4: Software
0x00800000 calibration area (256bits)
NVM base address +
0x00800000
0x00806020 Area 4 offset address
AUX1
0x00806000 AUX1 offset address
Automatic calibration
0x00800000 row Calibration and auxiliary
space address offset
The values from the automatic calibration row are loaded into their respective registers at startup.
14 BOD33 Enable BOD33 Enable at power on . Refer to SYSCTRL BOD33 register. Default value =
1.
...........continued
Bit Position Name Usage
16:15 BOD33 Action BOD33 Action at power on. Refer to SYSCTRL BOD33 register. Default value =
1.
24:17 Reserved Voltage Regulator Internal BOD (BOD12) configuration. These bits are written in
production and must not be changed. Default value = 0x70.
25 WDT Enable WDT Enable at power on. Refer to WDT CTRL register.
Default value = 0.
26 WDT Always-On WDT Always-On at power on. Refer to WDT CTRL register.
Default value = 0.
30:27 WDT Period WDT Period at power on. Refer to WDT CONFIG register.
Default value = 0x0B.
34:31 WDT Window WDT Window mode time-out at power on. Refer to WDT CONFIG register.
Default value = 0x05.
38:35 WDT EWOFFSET WDT Early Warning Interrupt Time Offset at power on. Refer to WDT EWCTRL
register. Default value = 0x0B.
39 WDT WEN WDT Timer Window Mode Enable at power on. Refer to WDT CTRL register.
Default value = 0.
40 BOD33 Hysteresis BOD33 Hysteresis configuration at power on. Refer to SYSCTRL BOD33
register.
Default value = 0.
41 Reserved Voltage Regulator Internal BOD(BOD12) configuration. This bit is written in
production and must not be changed. Default value = 0.
47:42 Reserved
63:48 LOCK NVM Region Lock Bits. Refer to NVMCTRL – Non-Volatile Memory Controller.
Default value = 0xFFFF.
Related Links
22. NVMCTRL – Nonvolatile Memory Controller
17.8.14 BOD33
18.8.1 CTRL
...........continued
Bit Position Name Description
44:38 OSC32K CAL OSC32KCalibration. Should be written to SYSCTRL OSC32K register.
49:45 USB TRANSN USB TRANSN calibration value. Should be written to USB PADCAL
register.
54:50 USB TRANSP USB TRANSP calibration value. Should be written to USB PADCAL
register.
57:55 USB TRIM USB TRIM calibration value. Should be written to the USB PADCAL
register.
63:58 DFLL48M COARSE CAL DFLL48M Coarse calibration value. Should be written to SYSCTRL
DFLLVAL register.
73:64 Reserved
127:74 Reserved
Note:
1. All software run in Privileged mode only.
The ARM Cortex-M0+ core has the following two bus interfaces:
• Single 32-bit AMBA-3 AHB-Lite system interface that provides connections to peripherals and all system
memory, which includes Flash and RAM.
• Single 32-bit I/O port bus interfacing to the PORT with 1-cycle loads and stores.
latency interrupt processing and efficient processing of late arriving interrupts. Refer to 11.2 Nested Vector
Interrupt Controller and the Cortex-M0+ Technical Reference Manual for details (www.arm.com).
• System Control Block (SCB)
– The System Control Block provides system implementation information, and system control. This includes
configuration, control, and reporting of the system exceptions. Refer to the Cortex-M0+ Devices Generic
User Guide for details (www.arm.com).
• Micro Trace Buffer (MTB)
– The CoreSight MTB-M0+ (MTB) provides a simple execution trace capability to the Cortex-M0+ processor.
Refer to section 11.3 Micro Trace Buffer and the CoreSight MTB-M0+ Technical Reference Manual for
details (www.arm.com).
Address Peripheral
0xE000E000 System Control Space (SCS)
0xE000E010 System Timer (SysTick)
0xE000E100 Nested Vectored Interrupt Controller (NVIC)
0xE000ED00 System Control Block (SCB)
0x41006000 (see also Product Mapping) Micro Trace Buffer (MTB)
11.1.4.1 Overview
Because accesses to the AMBA® AHB-Lite™ and the single cycle I/O interface can be made concurrently, the
Cortex-M0+ processor can fetch the next instructions while accessing the I/Os. This enables single cycle I/O
accesses to be sustained for as long as needed. Refer to CPU Local Bus for more information.
Related Links
23.5.10 CPU Local Bus
11.1.4.2 Description
Direct access to PORT registers.
11.2.1 Overview
The Nested Vectored Interrupt Controller (NVIC) in the SAM D21 supports 32 interrupt lines with four different priority
levels. For more details, refer to the Cortex-M0+ Technical Reference Manual (www.arm.com).
11.3.1 Features
• Program flow tracing for the Cortex-M0+ processor
• MTB SRAM can be used for both trace and general purpose storage by the processor
• The position and size of the trace buffer in SRAM is configurable by software
• CoreSight compliant
11.3.2 Overview
When enabled, the MTB records changes in program flow, reported by the Cortex-M0+ processor over the execution
trace interface shared between the Cortex-M0+ processor and the CoreSight MTB-M0+. This information is stored as
trace packets in the SRAM by the MTB. An off-chip debugger can extract the trace information using the Debug
Access Port to read the trace information from the SRAM. The debugger can then reconstruct the program flow from
this information.
The MTB simultaneously stores trace information into the SRAM, and gives the processor access to the SRAM. The
MTB ensures that trace write accesses have priority over processor accesses.
The execution trace packet consists of a pair of 32-bit words that the MTB generates when it detects the processor
PC value changes non-sequentially. A non-sequential PC change can occur during branch instructions or during
exception entry. See the CoreSight MTB-M0+ Technical Reference Manual for more details on the MTB execution
trace packet format.
Tracing is enabled when the MASTER.EN bit in the Master Trace Control Register is 1. There are various ways to set
the bit to 1 to start tracing, or to 0 to stop tracing. See the CoreSight Cortex-M0+ Technical Reference Manual for
more details on the Trace start and stop and for a detailed description of the MTB’s MASTER register. The MTB can
be programmed to stop tracing automatically when the memory fills to a specified watermark level or to start or stop
tracing by writing directly to the MASTER.EN bit. If the watermark mechanism is not being used and the trace buffer
overflows, then the buffer wraps around overwriting previous trace packets.
The base address of the MTB registers is 0x41006000; this address is also written in the CoreSight ROM Table. The
offset of each register from the base address is fixed and as defined by the CoreSight MTB-M0+ Technical Reference
Manual. The MTB has 4 programmable registers to control the behavior of the trace features:
• POSITION: Contains the trace write pointer and the wrap bit,
• MASTER: Contains the main trace enable bit and other trace control fields,
• FLOW: Contains the WATERMARK address and the AUTOSTOP and AUTOHALT control bits,
• BASE: Indicates where the SRAM is located in the processor memory map. This register is provided to enable
auto discovery of the MTB SRAM location, by a debug agent.
See the CoreSight MTB-M0+ Technical Reference Manual for a detailed description of these registers.
11.4.1 Features
High-Speed Bus Matrix has the following features:
• Symmetric crossbar bus switch implementation
• Allows concurrent accesses from different masters to different slaves
• 32-bit data bus
• Operation at a one-to-one clock frequency with the bus masters
11.4.2 Configuration
SRAM
AHB-APB Bridge C
AHB-APB Bridge A
AHB-APB Bridge B
Internal Flash
DMAC Fetch
DMAC Data
DMAC WB
CM0+
MTB
DSU
USB
0 1 2 3 4 5 6 SLAVE ID
0 1 2 3 4 5 6 SRAM PORT ID
MASTER ID
CM0+ 0
Multi-Slave
MASTERS
DSU DSU 1
DMACDSU
Data 2
MTB
Priviledged SRAM-access
USB
MASTERS
DMAC WB
DMAC Fetch
If a master is configured with QoS level 0x00 or 0x01 there will be minimum one cycle latency for the RAM access.
The priority order for concurrent accesses are decided by two factors. First the QoS level for the master and then a
static priority given by table nn-mm (table: SRAM port connection) where the lowest port ID has the highest static
priority.
The MTB has fixed QoS level 3 and the DSU has fixed QoS level 1.
The CPU QoS level can be written/read at address 0x41007110, bits [1:0]. Its reset value is 0x0.
Refer to different master QOSCTRL registers for configuring QoS for the other masters (USB, DMAC).
to operate the AHB-APB bridge, the clock (CLK_HPBx_AHB) must be enabled. See PM – Power Manager for details.
Figure 11-1. APB Write Access.
T0 T1 T2 T3 T0 T1 T2 T3 T4 T5
PCLK PCLK
PWRITE PWRITE
PSEL PSEL
PENABLE PENABLE
PREADY PREADY
PCLK PCLK
PWRITE PWRITE
PSEL PSEL
PENABLE PENABLE
PREADY PREADY
11.6.1 Overview
One PAC is associated with each AHB-APB bridge and the PAC can provide write protection for registers of each
peripheral connected on the same bridge.
The PAC peripheral bus clock (CLK_PACx_APB) can be enabled and disabled in the Power Manager.
CLK_PAC0_APB and CLK_PAC1_APB are enabled are reset. CLK_PAC2_APB is disabled at reset. Refer to PM –
Power Manager for details. The PAC will continue to operate in any Sleep mode where the selected clock source is
running. Write-protection does not apply for debugger access. When the debugger makes an access to a peripheral,
write-protection is ignored so that the debugger can update the register.
Write-protect registers allow the user to disable a selected peripheral’s write-protection without doing a read-modify-
write operation. These registers are mapped into two I/O memory locations, one for clearing and one for setting the
register bits. Writing a one to a bit in the Write Protect Clear register (WPCLR) will clear the corresponding bit in both
registers (WPCLR and WPSET) and disable the write-protection for the corresponding peripheral, while writing a one
to a bit in the Write Protect Set (WPSET) register will set the corresponding bit in both registers (WPCLR and
WPSET) and enable the write-protection for the corresponding peripheral. Both registers (WPCLR and WPSET) will
return the same value when read.
If a peripheral is write-protected, and if a write access is performed, data will not be written, and the peripheral will
return an access error (CPU exception).
The PAC also offers a safety feature for correct program execution, with a CPU exception generated on double write-
protection or double unprotection of a peripheral. If a peripheral n is write-protected and a write to one in WPSET[n] is
detected, the PAC returns an error. This can be used to ensure that the application follows the intended program flow
by always following a write-protect with an unprotect, and vice versa. However, in applications where a write-
protected peripheral is used in several contexts, for example, interrupts, care should be taken so that either the
interrupt can not happen while the main application or other interrupt levels manipulate the write-protection status, or
when the interrupt handler needs to unprotect the peripheral, based on the current protection status, by reading
WPSET.
Related Links
16. PM – Power Manager
Name: WPCLR
Offset: 0x00
Reset: 0x000000
Property: –
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
EIC RTC WDT GCLK SYSCTRL PM
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 6 – EIC
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 5 – RTC
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 4 – WDT
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 3 – GCLK
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 2 – SYSCTRL
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 1 – PM
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Name: WPSET
Offset: 0x04
Reset: 0x000000
Property: –
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
EIC RTC WDT GCLK SYSCTRL PM
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 6 – EIC
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 5 – RTC
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 4 – WDT
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 3 – GCLK
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 2 – SYSCTRL
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 1 – PM
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Name: WPCLR
Offset: 0x00
Reset: 0x000002
Property: –
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
MTB USB DMAC PORT NVMCTRL DSU
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 1
Bit 6 – MTB
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 5 – USB
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 4 – DMAC
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 3 – PORT
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 2 – NVMCTRL
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 1 – DSU
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Name: WPSET
Offset: 0x04
Reset: 0x000002
Property: –
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
MTB USB DMAC PORT NVMCTRL DSU
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 1
Bit 6 – MTB
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 5 – USB
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 4 – DMAC
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 3 – PORT
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 2 – NVMCTRL
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Bit 1 – DSU
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write Protect bit for the corresponding peripherals.
Value Description
0 Write-protection is disabled.
1 Write-protection is enabled.
Name: WPCLR
Offset: 0x00
Reset: 0x00800000
Property: –
Bit 31 30 29 28 27 26 25 24
TCC3
Access R/W
Reset 0
Bit 23 22 21 20 19 18 17 16
AC1 I2S PTC DAC AC ADC
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
TC7 TC6 TC5 TC4 TC3 TCC2 TCC1 TCC0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
SERCOM[5:0] EVSYS
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Bit 24 – TCC3
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write-Protect bit for the corresponding peripherals.
Value Description
0 Write protection is disabled
1 Write protection is enabled
Bit 21 – AC1
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write-Protect bit for the corresponding peripherals.
Value Description
0 Write protection is disabled
1 Write protection is enabled
Bit 20 – I2S
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write-Protect bit for the corresponding peripherals.
Value Description
0 Write protection is disabled
1 Write protection is enabled
Bit 19 – PTC
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write-Protect bit for the corresponding peripherals.
Value Description
0 Write protection is disabled
1 Write protection is enabled
Bit 18 – DAC
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write-Protect bit for the corresponding peripherals.
Value Description
0 Write protection is disabled
1 Write protection is enabled
Bit 17 – AC
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write-Protect bit for the corresponding peripherals.
Value Description
0 Write protection is disabled
1 Write protection is enabled
Bit 16 – ADC
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write-Protect bit for the corresponding peripherals.
Value Description
0 Write protection is disabled
1 Write protection is enabled
Bits 8, 9, 10 – TCC
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write-Protect bit for the corresponding peripherals.
Value Description
0 Write protection is disabled
1 Write protection is enabled
Bit 1 – EVSYS
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write-Protect bit for the corresponding peripherals.
Value Description
0 Write protection is disabled
1 Write protection is enabled
Name: WPSET
Offset: 0x04
Reset: 0x00800000
Property: –
Bit 31 30 29 28 27 26 25 24
TCC3
Access R/W
Reset 0
Bit 23 22 21 20 19 18 17 16
AC1 I2S PTC DAC AC ADC
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
TC7 TC6 TC5 TC4 TC3 TCC2 TCC1 TCC0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
SERCOM5 SERCOM4 SERCOM3 SERCOM2 SERCOM1 SERCOM0 EVSYS
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Bit 24 – TCC3
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write-Protect bit for the corresponding peripherals.
Value Description
0 Write protection is disabled
1 Write protection is enabled
Bit 21 – AC1
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write-Protect bit for the corresponding peripherals.
Value Description
0 Write protection is disabled
1 Write protection is enabled
Bit 20 – I2S
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write-Protect bit for the corresponding peripherals.
Value Description
0 Write protection is disabled
1 Write protection is enabled
Bit 19 – PTC
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write-Protect bit for the corresponding peripherals.
Value Description
0 Write protection is disabled
1 Write protection is enabled
Bit 18 – DAC
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write-Protect bit for the corresponding peripherals.
Value Description
0 Write protection is disabled
1 Write protection is enabled
Bit 17 – AC
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write-Protect bit for the corresponding peripherals.
Value Description
0 Write protection is disabled
1 Write protection is enabled
Bit 16 – ADC
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write-Protect bit for the corresponding peripherals.
Value Description
0 Write protection is disabled
1 Write protection is enabled
Bits 8, 9, 10 – TCC
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write-Protect bit for the corresponding peripherals.
Value Description
0 Write protection is disabled
1 Write protection is enabled
Bits 2, 3, 4, 5, 6, 7 – SERCOM
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write-Protect bit for the corresponding peripherals.
Value Description
0 Write protection is disabled
1 Write protection is enabled
Bit 1 – EVSYS
Writing a zero to these bits has no effect.
Writing a one to these bits will clear the Write-Protect bit for the corresponding peripherals.
Value Description
0 Write protection is disabled
1 Write protection is enabled
Name Address Line Index Enabled Index Enabled Index Index Prot. User Generator Index Sleep
AHB-APB 0x40000000 0 Y
Bridge A
PAC0 0x40000000 0 Y
PM 0x40000400 0 1 Y 1 N Y
SYSCTRL 0x40000800 1 2 Y 0: DFLL48M 2 N Y
reference
2: FDPLL96M 32kHz
GCLK 0x40000C00 3 Y 3 N Y
WDT 0x40001000 2 4 Y 3 4 N
RTC 0x40001400 3 5 Y 4 5 N 1: CMP0/ALARM0 Y
2: CMP1
3: OVF
4-11: PER0-7
EIC 0x40001800 NMI, 6 Y 5 6 N 12-27: EXTINT0-15 Y
4
AHB-APB 0x41000000 1 Y
Bridge B
PAC1 0x41000000 0 Y
DSU 0x41002000 3 Y 1 Y 1 Y
NVMCTRL 0x41004000 5 4 Y 2 Y 2 N
PORT 0x41004400 3 Y 3 N
DMAC 0x41004800 6 5 Y 4 Y 4 N 0-3: CH0-3 30-33: CH0-3
USB 0x41005000 7 6 Y 5 Y 6 5 N Y
MTB 0x41006000 6 N
AHB-APB 0x42000000 2 Y
Bridge C
PAC2 0x42000000 0 N
EVSYS 0x42000400 8 1 N 7-18: one per CHANNEL 1 N Y
SERCOM0 0x42000800 9 2 N 20: CORE 2 N 1: RX Y
19: SLOW 2: TX
36: CNT
37-40: MC0-3
43: CNT
44-45: MC0-1
48: CNT
49-50: MC0-1
...........continued
Periph. Base IRQ AHB Clock APB Clock Generic Clock PAC Events DMA
Name Address Line Index Enabled Index Enabled Index Index Prot. User Generator Index Sleep
TCC3 0x42006000 29 22 N 37 24 N 31-32: EV0-1, 33-36: MC0-3 77: OVF, 78: TRG, 79 CNT, 80-83 MC 0x2D:OVF Y
0x2E: MC0
0x2F: MC1
0x30: MC2
0x31: MC3
13.1 Overview
The Device Service Unit (DSU) provides a means of detecting debugger probes. It enables the ARM Debug Access
Port (DAP) to have control over multiplexed debug pads and CPU reset. The DSU also provides system-level
services to debug adapters in an ARM debug system. It implements a CoreSight Debug ROM that provides device
identification as well as identification of other debug components within the system. Hence, it complies with the ARM
Peripheral Identification specification. The DSU also provides system services to applications that need memory
testing, as required for IEC60730 Class B compliance, for example. The DSU can be accessed simultaneously by a
debugger and the CPU, as it is connected on the High-Speed Bus Matrix. For security reasons, some of the DSU
features will be limited or unavailable when the device is protected by the NVMCTRL security bit.
Related Links
13.11.6 System Services Availability when Accessed Externally and Device is Protected
22. NVMCTRL – Nonvolatile Memory Controller
22.6.6 Security Bit
13.2 Features
• CPU reset extension
• Debugger probe detection (Cold- and Hot-Plugging)
• Chip-Erase command and status
• 32-bit cyclic redundancy check (CRC32) of any memory accessible through the bus matrix
• ARM® CoreSight™ compliant device identification
• Two debug communications channels
• Debug access port security filter
• Onboard memory built-in self-test (MBIST)
DSU
debugger_present
RESET
DEBUGGER PROBE
SWCLK INTERFACE cpu_reset_extension
DAP CPU
DAP SECURITY FILTER NVMCTRL
AHB-AP DBG
CORESIGHT ROM
PORT
M S
CRC-32
SWDIO HIGH-SPEED
MBIST M
BUS MATRIX
CHIP ERASE
Related Links
7. I/O Multiplexing and Considerations
Related Links
16. PM – Power Manager
13.5.3 Clocks
The DSU bus clocks (CLK_DSU_APB and CLK_DSU_AHB) can be enabled and disabled by the Power Manager.
Refer to PM – Power Manager
Related Links
16. PM – Power Manager
13.5.4 DMA
Not applicable.
13.5.5 Interrupts
Not applicable.
13.5.6 Events
Not applicable.
Related Links
11.6 Peripheral Access Controller (PAC)
RESET
DSU CRSTEXT
Clear
CPU reset
extension
Related Links
22. NVMCTRL – Nonvolatile Memory Controller
22.6.6 Security Bit
RESET
Hot-Plugging
The presence of a debugger probe is detected when either Hot-Plugging or Cold-Plugging is detected. Once
detected, the Debugger Present bit of the Status B register (STATUSB.DBGPRES) is set. For security reasons, Hot-
Plugging is not available when the device is protected by the NVMCTRL security bit.
This detection requires that pads are correctly powered. Thus, at cold startup, this detection cannot be done until
POR is released. If the device is protected, Cold-Plugging is the only way to detect a debugger probe, and so the
external reset timing must be longer than the POR timing. If external reset is deasserted before POR release, the
user must retry the procedure above until it gets connected to the device.
Related Links
22. NVMCTRL – Nonvolatile Memory Controller
22.6.6 Security Bit
13.8 Programming
Programming the Flash or RAM memories is only possible when the device is not protected by the NVMCTRL
security bit. The programming procedure is as follows:
1. At power up, RESET is driven low by a debugger. The on-chip regulator holds the system in a POR state until
the input supply is above the POR threshold (refer to Powe-On Reset (POR) characteristics). The system
continues to be held in this static state until the internally regulated supplies have reached a safe operating
state.
2. The PM starts, clocks are switched to the slow clock (Core Clock, System Clock, Flash Clock and any Bus
Clocks that do not have clock gate control). Internal resets are maintained due to the external reset.
3. The debugger maintains a low level on SWCLK. RESET is released, resulting in a debugger Cold-Plugging
procedure.
4. The debugger generates a clock signal on the SWCLK pin, the Debug Access Port (DAP) receives a clock.
5. The CPU remains in Reset due to the Cold-Plugging procedure; meanwhile, the rest of the system is released.
6. A Chip-Erase is issued to ensure that the Flash is fully erased prior to programming.
7. Programming is available through the AHB-AP.
8. After the operation is completed, the chip can be restarted either by asserting RESET or toggling power. Make
sure that the SWCLK pin is high when releasing RESET to prevent extending the CPU reset.
Related Links
37. Electrical Characteristics
22. NVMCTRL – Nonvolatile Memory Controller
22.6.6 Security Bit
Mirrored
DSU operating
registers
0x01FF
DSU CoreSight
ROM
0x1FFF
Some features not activated by APB transactions are not available when the device is protected:
Table 13-1. Feature Availability Under Protection
Related Links
22. NVMCTRL – Nonvolatile Memory Controller
22.6.6 Security Bit
For more information, refer to the ARM Debug Interface Version 5 Architecture Specification.
The algorithm employed is the industry standard CRC32 algorithm using the generator polynomial 0xEDB88320
(reversed representation).
In this mode, the algorithm terminates either when a fault is detected or on successful completion. In both
cases, STATUSA.DONE is set. If an error was detected, STATUSA.FAIL will be set. User then can read
the DATA and ADDR registers to locate the fault.
– ADDR.AMOD=1: pause-on-error
In this mode, the MBIST algorithm is paused when an error is detected. In such a situation, only
STATUSA.FAIL is asserted. The state machine waits for user to clear STATUSA.FAIL by writing a '1' in
STATUSA.FAIL to resume. Prior to resuming, user can read the DATA and ADDR registers to locate the
fault.
4. Locating Faults
If the test stops with STATUSA.FAIL set, one or more bits failed the test. The test stops at the first detected
error. The position of the failing bit can be found by reading the following registers:
– ADDR: Address of the word containing the failing bit
– DATA: contains data to identify which bit failed, and during which phase of the test it failed. The DATA
register will in this case contains the following bit groups:
Figure 13-6. DATA bits Description When MBIST Operation Returns an Error
Bit 31 30 29 28 27 26 25 24
Bit 23 22 21 20 19 18 17 16
Bit 15 14 13 12 11 10 9 8
phase
Bit 7 6 5 4 3 2 1 0
bit_index
• bit_index: contains the bit number of the failing bit
• phase: indicates which phase of the test failed and the cause of the error, as listed in the following table.
Table 13-4. MBIST Operation Phases
AMOD[1:0] Description
0x0 Exit on Error
0x1 Pause on Error
...........continued
AMOD[1:0] Description
0x2, 0x3 Reserved
Related Links
22. NVMCTRL – Nonvolatile Memory Controller
22.6.6 Security Bit
9. Product Mapping
13.11.6 System Services Availability when Accessed Externally and Device is Protected
External access: Access performed in the DSU address offset 0x200-0x1FFF range.
Internal access: Access performed in the DSU address offset 0x000-0x100 range.
Table 13-6. Available Features when Operated From The External Address Range and Device is Protected
...........continued
0x1FD4
... Reserved
0x1FDF
7:0 PARTNBL[7:0]
15:8
0x1FE0 PID0
23:16
31:24
7:0 JEPIDCL[3:0] PARTNBH[3:0]
15:8
0x1FE4 PID1
23:16
31:24
7:0 REVISION[3:0] JEPU JEPIDCH[2:0]
15:8
0x1FE8 PID2
23:16
31:24
7:0 REVAND[3:0] CUSMOD[3:0]
15:8
0x1FEC PID3
23:16
31:24
7:0 PREAMBLEB0[7:0]
15:8
0x1FF0 CID0
23:16
31:24
7:0 CCLASS[3:0] PREAMBLE[3:0]
15:8
0x1FF4 CID1
23:16
31:24
7:0 PREAMBLEB2[7:0]
15:8
0x1FF8 CID2
23:16
31:24
7:0 PREAMBLEB3[7:0]
15:8
0x1FFC CID3
23:16
31:24
13.13.1 Control
Name: CTRL
Offset: 0x0000
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
CE MBIST CRC SWRST
Access W W W W
Reset 0 0 0 0
Bit 4 – CE Chip-Erase
Writing a '0' to this bit has no effect.
Writing a '1' to this bit starts the Chip-Erase operation.
13.13.2 Status A
Name: STATUSA
Offset: 0x0001
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
PERR FAIL BERR CRSTEXT DONE
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Bit 3 – FAIL Failure
Writing a '0' to this bit has no effect.
Writing a '1' to this bit clears the Failure bit.
This bit is set when a DSU operation failure is detected.
Bit 0 – DONE Done
Writing a '0' to this bit has no effect.
Writing a '1' to this bit clears the Done bit.
This bit is set when a DSU operation is completed.
13.13.3 Status B
Name: STATUSB
Offset: 0x0002
Reset: 0x1X
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
HPE DCCD1 DCCD0 DBGPRES PROT
Access R R R R R
Reset 1 0 0 0 0
Bit 0 – PROT Protected
Writing a '0' to this bit has no effect.
Writing a '1' to this bit has no effect.
This bit is set at power-up when the device is protected.
This bit is never cleared.
13.13.4 Address
Name: ADDR
Offset: 0x0004
Reset: 0x00000000
Property: PAC Write-Protection
Bit 31 30 29 28 27 26 25 24
ADDR[29:22]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
ADDR[21:14]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
ADDR[13:6]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
ADDR[5:0] AMOD[1:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
13.13.5 Length
Name: LENGTH
Offset: 0x0008
Reset: 0x00000000
Property: PAC Write-Protection
Bit 31 30 29 28 27 26 25 24
LENGTH[29:22]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
LENGTH[21:14]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
LENGTH[13:6]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
LENGTH[5:0]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
13.13.6 Data
Name: DATA
Offset: 0x000C
Reset: 0x00000000
Property: PAC Write-Protection
Bit 31 30 29 28 27 26 25 24
DATA[31:24]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
DATA[23:16]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
DATA[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
DATA[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: DCC0
Offset: 0x0010
Reset: 0x00000000
Property: -
Bit 31 30 29 28 27 26 25 24
DATA[31:24]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
DATA[23:16]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
DATA[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
DATA[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: DCC1
Offset: 0x0014
Reset: 0x00000000
Property: -
Bit 31 30 29 28 27 26 25 24
DATA[31:24]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
DATA[23:16]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
DATA[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
DATA[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: DID
Offset: 0x0018
Property: PAC Write Protection
Bit 31 30 29 28 27 26 25 24
PROCESSOR[3:0] FAMILY[4:1]
Access R R R R R R R R
Reset p p p p f f f f
Bit 23 22 21 20 19 18 17 16
FAMILY[0] SERIES[5:0]
Access R R R R R R R
Reset f s s s s s s
Bit 15 14 13 12 11 10 9 8
DIE[3:0] REVISION[3:0]
Access R R R R R R R R
Reset d d d d r r r r
Bit 7 6 5 4 3 2 1 0
DEVSEL[7:0]
Access R R R R R R R R
Reset x x x x x x x x
Name: ENTRY0
Offset: 0x1000
Reset: 0xXXXXX00X
Property: PAC Write-Protection
Bit 31 30 29 28 27 26 25 24
ADDOFF[19:12]
Access R R R R R R R R
Reset x x x x x x x x
Bit 23 22 21 20 19 18 17 16
ADDOFF[11:4]
Access R R R R R R R R
Reset x x x x x x x x
Bit 15 14 13 12 11 10 9 8
ADDOFF[3:0]
Access R R R R
Reset x x x x
Bit 7 6 5 4 3 2 1 0
FMT EPRES
Access R R
Reset 1 x
Bit 1 – FMT Format
Always reads as '1', indicating a 32-bit ROM table.
Name: ENTRY1
Offset: 0x1004
Reset: 0xXXXXX00X
Property: PAC Write-Protection
Bit 31 30 29 28 27 26 25 24
ADDOFF[19:12]
Access R R R R R R R R
Reset x x x x x x x x
Bit 23 22 21 20 19 18 17 16
ADDOFF[11:4]
Access R R R R R R R R
Reset x x x x x x x x
Bit 15 14 13 12 11 10 9 8
ADDOFF[3:0]
Access R R R R
Reset x x x x
Bit 7 6 5 4 3 2 1 0
FMT EPRES
Access R R
Reset 1 x
Bit 1 – FMT Format
Always read as '1', indicating a 32-bit ROM table.
Name: END
Offset: 0x1008
Reset: 0x00000000
Property: -
Bit 31 30 29 28 27 26 25 24
END[31:24]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
END[23:16]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
END[15:8]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
END[7:0]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Name: MEMTYPE
Offset: 0x1FCC
Reset: 0x0000000x
Property: -
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
SMEMP
Access R
Reset x
Name: PID4
Offset: 0x1FD0
Reset: 0x00000000
Property: -
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
FKBC[3:0] JEPCC[3:0]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Name: PID0
Offset: 0x1FE0
Reset: 0x00000000
Property: -
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
PARTNBL[7:0]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Name: PID1
Offset: 0x1FE4
Reset: 0x000000FC
Property: -
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
JEPIDCL[3:0] PARTNBH[3:0]
Access R R R R R R R R
Reset 1 1 1 1 1 1 0 0
Name: PID2
Offset: 0x1FE8
Reset: 0x00000009
Property: -
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
REVISION[3:0] JEPU JEPIDCH[2:0]
Access R R R R R R R R
Reset 0 0 0 0 1 0 0 1
Name: PID3
Offset: 0x1FEC
Reset: 0x00000000
Property: -
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
REVAND[3:0] CUSMOD[3:0]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Name: CID0
Offset: 0x1FF0
Reset: 0x0000000D
Property: -
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
PREAMBLEB0[7:0]
Access R R R R R R R R
Reset 0 0 0 0 1 1 0 1
Name: CID1
Offset: 0x1FF4
Reset: 0x00000010
Property: -
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
CCLASS[3:0] PREAMBLE[3:0]
Access R R R R R R R R
Reset 0 0 0 1 0 0 0 0
Name: CID2
Offset: 0x1FF8
Reset: 0x00000005
Property: -
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
PREAMBLEB2[7:0]
Access R R R R R R R R
Reset 0 0 0 0 0 1 0 1
Name: CID3
Offset: 0x1FFC
Reset: 0x000000B1
Property: -
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
PREAMBLEB3[7:0]
Access R R R R R R R R
Reset 1 0 1 1 0 0 0 1
OSC32K
GCLK Generator 1 GCLK Multiplexer 1 Peripheral 0
XOSC32K
Generic
OSC8M Clocks
GCLK Generator x GCLK Multiplexer y Peripheral z
DFLL48M
FDPLL96M
AHB/APB System Clocks
PM
Synchronous Clock
Controller
CLK_SERCOM0_APB
GCLK
SYSCTRL
Generic Clock Generic Clock GCLK_SERCOM0_CORE
DFLL48M SERCOM 0
Generator 1 Multiplexer 20
14.3.1.1 Overview
All peripherals are composed of one digital bus interface connected to the APB or AHB bus and running from a
corresponding clock in the Main Clock domain, and one peripheral core running from the peripheral Generic Clock
(GCLK).
Communication between these clock domains must be synchronized. This mechanism is implemented in hardware,
so the synchronization process takes place even if the peripheral generic clock is running from the same clock source
and on the same frequency as the bus interface.
All registers in the bus interface are accessible without synchronization. All registers in the peripheral core are
synchronized when written. Some registers in the peripheral core are synchronized when read. Each individual
register description will have the properties "Read-Synchronized" and/or "Write-Synchronized" if a register is
synchronized.
As shown in the figure below, the common synchronizer is used for all registers in one peripheral. Therefore, status
register (STATUS) of each peripheral can be synchronized at a time.
Figure 14-3. Synchronization
Sync
INTFLAG Write-Synced reg
SYNCBUSY
Peripheral bus
STATUS
Write-Synced reg
Synchronizer
READREQ
R/W-Synced reg
14.3.1.2 Write-Synchronization
Write-Synchronization is triggered by writing to a register in the peripheral clock domain. The Synchronization Busy
bit in the Status register (STATUS.SYNCBUSY) will be set when the write-synchronization starts and cleared when
the write-synchronization is complete. Refer to 14.3.1.8 Synchronization Delay for details on the synchronization
delay.
When the write-synchronization is ongoing (STATUS.SYNCBUSY is one), any of the following actions will cause the
peripheral bus to stall until the synchronization is complete:
• Writing a generic clock peripheral core register
• Reading a read-synchronized peripheral core register
• Reading the register that is being written (and thus triggered the synchronization)
Peripheral core registers without read-synchronization will remain static once they have been written and
synchronized, and can be read while the synchronization is ongoing without causing the peripheral bus to stall. APB
registers can also be read while the synchronization is ongoing without causing the peripheral bus to stall.
14.3.1.3 Read-Synchronization
Reading a read-synchronized peripheral core register will cause the peripheral bus to stall immediately until the read-
synchronization is complete. STATUS.SYNCBUSY will not be set. Refer to 14.3.1.8 Synchronization Delay for details
on the synchronization delay. Note that reading a read-synchronized peripheral core register while
STATUS.SYNCBUSY is one will cause the peripheral bus to stall twice; first because of the ongoing synchronization,
and then again because reading a read-synchronized core register will cause the peripheral bus to stall immediately.
When the software reset is in progress (STATUS.SYNCBUSY and CTRL.SWRST are '1'), attempt to do any of the
following will cause the peripheral bus to stall until the Software Reset synchronization and the reset is complete:
• Writing a peripheral core register
• Writing an APB register
• Reading a read-synchronized register
APB registers can be read while the software reset is being write-synchronized without causing the peripheral bus to
stall.
Where �GCLK is the period of the generic clock and �APB is the period of the peripheral bus clock. A normal peripheral
bus register access duration is 2 × �APB.
14.3.2.1 Overview
All peripherals are composed of one digital bus interface connected to the APB or AHB bus and running from a
corresponding clock in the Main Clock domain, and one peripheral core running from the peripheral Generic Clock
(GCLK).
Communication between these clock domains must be synchronized. This mechanism is implemented in hardware,
so the synchronization process takes place even if the peripheral generic clock is running from the same clock source
and on the same frequency as the bus interface.
All registers in the bus interface are accessible without synchronization. All registers in the peripheral core are
synchronized when written. Some registers in the peripheral core are synchronized when read. Registers that need
synchronization has this denoted in each individual register description.
Offset Register
0x00 REGA
0x01 REGB
0x02 REGC
0x03
Synchronization is per register, so multiple registers can be synchronized in parallel. Consequently, after REGA (8-bit
access) was written, REGB (8-bit access) can be written immediately without error.
REGC (16-bit access) can be written without affecting REGA or REGB. If REGC is written to in two consecutive 8-bit
accesses without waiting for synchronization, the second write attempt will be discarded and an error is generated.
A 32-bit access to offset 0x00 will write all three registers. Note that REGA, REGB and REGC can be updated at
different times because of independent write synchronization.
Where �GCLK is the period of the generic clock and �APB is the period of the peripheral bus clock. A normal peripheral
bus register access duration is 2 × �APB.
ONDEMAND
All clock sources in the system can be run in an on-demand mode: the clock source is in a stopped state unless a
peripheral is requesting the clock source. Clock requests propagate from the peripheral, via the GCLK, to the clock
source. If one or more peripheral is using a clock source, the clock source will be started/kept running. As soon as
the clock source is no longer needed and no peripheral has an active request, the clock source will be stopped until
requested again.
The clock request can reach the clock source only if the peripheral, the generic clock and the clock from the Generic
Clock Generator in-between are enabled. The time taken from a clock request being asserted to the clock source
being ready is dependent on the clock source startup time, clock source frequency as well as the divider used in the
Generic Clock Generator. The total startup time Tstart from a clock request until the clock is available for the
peripheral is between:
Tstart_max = Clock source startup time + 2 × clock source periods + 2 × divided clock source periods
Tstart_min = Clock source startup time + 1 × clock source period + 1 × divided clock source period
The time between the last active clock request stopped and the clock is shut down, Tstop, is between:
Tstop_min = 1 × divided clock source period + 1 × clock source period
Tstop_max = 2 × divided clock source periods + 2 × clock source periods
The On-Demand function can be disabled individually for each clock source by clearing the ONDEMAND bit located
in each clock source controller. Consequently, the clock will always run whatever the clock request status is. This has
the effect of removing the clock source startup time at the cost of power consumption.
The clock request mechanism can be configured to work in standby mode by setting the RUNSDTBY bits of the
modules, see Figure 14-4.
15.1 Overview
Depending on the application, peripherals may require specific clock frequencies to operate correctly. The Generic
Clock controller GCLK provides nine Generic Clock Generators that can provide a wide range of clock frequencies.
Generators can be set to use different external and internal oscillators as source. The clock of each Generator can be
divided. The outputs from the Generators are used as sources for the Generic Clock Multiplexers, which provide the
Generic Clock (GCLK_PERIPHERAL) to the peripheral modules, as shown in Generic Clock Controller Block
Diagram. The number of Peripheral Clocks depends on how many peripherals the device has.
Note: The Generator 0 is always the direct source of the GCLK_MAIN signal.
15.2 Features
• Provides Generic Clocks
• Wide frequency range
• Clock source for the generator can be changed on the fly
XOSC
OSCULP32K
Generic Clock Multiplexer
OSC32K
XOSC32K
GCLK_PERIPHERAL
GCLK_IO
GCLK_MAIN
PM
GCLKGEN[n:0]
Note: 1. If GENCTRL.SRC=0x01(GCLKIN), the GCLK_IO is set as an input.
Refer to PORT Function Multiplexing table in I/O Multiplexing and Considerations for details on the pin mapping for
this peripheral.
Note: One signal can be mapped on several pins.
Related Links
7. I/O Multiplexing and Considerations
15.5.3 Clocks
The GCLK bus clock (CLK_GCLK_APB) can be enabled and disabled in the Power Manager, and the default state of
CLK_GCLK_APB can be found in the Peripheral Clock Masking section of PM – Power Manager.
Related Links
16. PM – Power Manager
15.5.4 DMA
Not applicable.
15.5.5 Interrupts
Not applicable.
15.5.6 Events
Not applicable.
Related Links
11.6 Peripheral Access Controller (PAC)
15.6.2.1 Initialization
Before a Generator is enabled, the corresponding clock source should be enabled. The Peripheral clock must be
configured as outlined by the following steps:
1. The Generic Clock Generator division factor must be set by performing a single 32-bit write to the Generic
Clock Generator Division register (GENDIV):
– The Generic Clock Generator that will be selected as the source of the generic clock by setting the ID bit
group (GENDIV.ID).
– The division factor must be selected by the DIV bit group (GENDIV.DIV)
Note: Refer to Generic Clock Generator Division register (GENDIV) for details.
2. The generic clock generator must be enabled by performing a single 32-bit write to the Generic Clock
Generator Control register (GENCTRL):
– The Generic Clock Generator will be selected as the source of the generic clock by the ID bit group
(GENCTRL.ID)
– The Generic Clock generator must be enabled (GENCTRL.GENEN=1)
Note: Refer to Generic Clock Generator Control register (GENCTRL) for details.
3. The generic clock must be configured by performing a single 16-bit write to the Generic Clock Control register
(CLKCTRL):
– The Generic Clock that will be configured via the ID bit group (CLKCTRL.ID)
– The Generic Clock Generator used as the source of the generic clock by writing the GEN bit group
(CLKCTRL.GEN)
Note: Refer to Generic Clock Control register (CLKCTRL) for details.
Related Links
15.8.5 GENDIV
15.8.4 GENCTRL
15.8.3 CLKCTRL
GCLK_IO[x] GENCTRL.GENEN
GENCTRL.DIVSEL
GENCTRL.SRC
GENDIV.DIV
Related Links
16. PM – Power Manager
GCLKGEN[0]
GCLKGEN[1]
GCLKGEN[2]
Clock GCLK_PERIPHERAL
Gate
GCLKGEN[n] CLKCTRL.CLKEN
CLKCTRL.GEN
Writing these registers is done by setting the corresponding ID bit group. To read a register, the user must write the
ID of the channel, i, in the corresponding register. The value of the register for the corresponding ID is available in the
user interface by a read access.
For example, the sequence to read the GENCTRL register of generic clock generator i is:
1. Do an 8-bit write of the i value to GENCTRL.ID
2. Read the value of GENCTRL
15.6.6 Synchronization
Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be
synchronized when written or read.
When executing an operation that requires synchronization, the Synchronization Busy bit in the Status register
(STATUS.SYNCBUSY) will be set immediately, and cleared when synchronization is complete.
If an operation that requires synchronization is executed while STATUS.SYNCBUSY=1, the bus will be stalled. All
operations will complete successfully, but the CPU will be stalled and interrupts will be pending as long as the bus is
stalled.
The following registers are synchronized when written:
• Generic Clock Generator Control register (GENCTRL)
• Generic Clock Generator Division register (GENDIV)
• Control register (CTRL)
Required write-synchronization is denoted by the "Write-Synchronized" property in the register description.
Related Links
14.3 Register Synchronization
15.8.1 Control
Name: CTRL
Offset: 0x0
Reset: 0x00
Property: Write-Protected, Write-Synchronized
Bit 7 6 5 4 3 2 1 0
SWRST
Access R/W
Reset 0
15.8.2 Status
Name: STATUS
Offset: 0x1
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
SYNCBUSY
Access R
Reset 0
Name: CLKCTRL
Offset: 0x2
Reset: 0x0000
Property: Write-Protected
Bit 15 14 13 12 11 10 9 8
WRTLOCK CLKEN GEN[3:0]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
ID[5:0]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Table 15-3. Generic Clock Selection ID and CLKCTRL Value after Power Reset
After a user Reset, the Reset value of the CLKCTRL register versus module instance is as shown in the table below.
Table 15-4. Generic Clock Selection ID and CLKCTRL Value after User Reset
Name: GENCTRL
Offset: 0x4
Reset: 0x00000000
Property: Write-Protected, Write-Synchronized
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
RUNSTDBY DIVSEL OE OOV IDC GENEN
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
SRC[4:0]
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
ID[3:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Value Description
0 The GCLK_IO will be zero when the generic clock generator is turned off or when the OE bit is zero.
1 The GCLK_IO will be one when the generic clock generator is turned off or when the OE bit is zero.
After a user reset, the reset value of the GENCTRL register is as shown in the table below.
...........continued
GCLK Generator Reset Value after a User Reset
ID
0x01 0x00000001 if the generator is not used by the RTC and not a source of a 'locked' generic clock
No change if the generator is used by the RTC or used by a GCLK with a WRTLOCK as one
0x02 0x00010302 if the generator is not used by the RTC and not a source of a 'locked' generic clock
No change if the generator is used by the RTC or used by a GCLK with a WRTLOCK as one
0x03 0x00000003 if the generator is not used by the RTC and not a source of a 'locked' generic clock
No change if the generator is used by the RTC or used by a GCLK with a WRTLOCK as one
0x04 0x00000004 if the generator is not used by the RTC and not a source of a 'locked' generic clock
No change if the generator is used by the RTC or used by a GCLK with a WRTLOCK as one
0x05 0x00000005 if the generator is not used by the RTC and not a source of a 'locked' generic clock
No change if the generator is used by the RTC or used by a GCLK with a WRTLOCK as one
0x06 0x00000006 if the generator is not used by the RTC and not a source of a 'locked' generic clock
No change if the generator is used by the RTC or used by a GCLK with a WRTLOCK as one
0x07 0x00000007 if the generator is not used by the RTC and not a source of a 'locked' generic clock
No change if the generator is used by the RTC or used by a GCLK with a WRTLOCK as one
0x08 0x00000008 if the generator is not used by the RTC and not a source of a 'locked' generic clock
No change if the generator is used by the RTC or used by a GCLK with a WRTLOCK as one
Name: GENDIV
Offset: 0x8
Reset: 0x00000000
Property: -
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
DIV[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
DIV[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
ID[3:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Values Description
0x0 Generic clock generator 0
0x1 Generic clock generator 1
0x2 Generic clock generator 2
0x3 Generic clock generator 3
0x4 Generic clock generator 4
0x5 Generic clock generator 5
0x6 Generic clock generator 6
0x7 Generic clock generator 7
0x8 Generic clock generator 8
0x9-0xF Reserved
A power reset will reset the GENDIV register for all IDs, including the generic clock generator used by the RTC. If a
generic clock generator ID other than generic clock generator 0 is not a source of a ‚“locked” generic clock or a
source of the RTC generic clock, a user reset will reset the GENDIV for this ID.
After a power reset, the reset value of the GENDIV register is as shown in the next table.
After a user reset, the reset value of the GENDIV register is as shown in next table.
16.1 Overview
The Power Manager (PM) controls the reset, clock generation and sleep modes of the device.
Utilizing a main clock chosen from a large number of clock sources from the GCLK, the clock controller provides
synchronous system clocks to the CPU and the modules connected to the AHB and the APBx bus. The synchronous
system clocks are divided into a number of clock domains; one for the CPU and AHB and one for each APBx. Any
synchronous system clock can be changed at run-time during normal operation. The clock domains can run at
different speeds, enabling the user to save power by running peripherals at a relatively low clock frequency, while
maintaining high CPU performance. In addition, the clock can be masked for individual modules, enabling the user to
minimize power consumption.
Before entering the Stand-by Sleep mode the user must make sure that a significant amount of clocks and
peripherals are disabled, so that the voltage regulator is not overloaded. This is because during Stand-by Sleep
mode the internal voltage regulator will be in Low-Power mode.
Various sleep modes are provided in order to fit power consumption requirements. This enables the PM to stop
unused modules in order to save power. In active mode, the CPU is executing application code. When the device
enters a Sleep mode, program execution is stopped and some modules and clock domains are automatically
switched off by the PM according to the Sleep mode. The application code decides which Sleep mode to enter and
when. Interrupts from enabled peripherals and all enabled reset sources can restore the device from a Sleep mode to
Active mode.
The PM also contains a reset controller to collect all possible reset sources. It issues a device reset and sets the
device to its initial state, and allows the reset source to be identified by software.
16.2 Features
• Reset control
– Reset the microcontroller and set it to an initial state according to the reset source
– Multiple reset sources
• Power reset sources: POR, BOD12, BOD33
• User reset sources: External reset (RESET), Watchdog Timer reset, software reset
– Reset status register for reading the reset source from the application code
• Clock control
– Controls CPU, AHB and APB system clocks
• Multiple clock sources and division factor from GCLK
• Clock prescaler with 1x to 128x division
– Safe run-time clock switching from GCLK
– Module-level clock gating through maskable peripheral clocks
• Power management control
– Sleep modes: IDLE, STANDBY
– SleepWalking support on GCLK clocks
POWER MANAGER
CLK_APB
CLK_AHB
SYNCHRONOUS PERIPHERALS
CLOCK CONTROLLER
GCLK CLK_CPU
CPU
SLEEP MODE
CONTROLLER
POR
RESET
CONTROLLER
WDT
CPU
RESET
RESET SOURCES
Refer to I/O Multiplexing and Considerations for details on the pin mapping for this peripheral. One signal can be
mapped on several pins.
Related Links
7. I/O Multiplexing and Considerations
16.5.3 Clocks
The PM bus clock (CLK_PM_APB) can be enabled and disabled in the Power Manager, and the default state of
CLK_PM_APB can be found in Peripheral Clock Default State table in the Peripheral Clock Masking section. If this
clock is disabled in the Power Manager, it can only be re-enabled by a reset.
A generic clock (GCLK_MAIN) is required to generate the main clock. The clock source for GCLK_MAIN is
configured by default in the Generic Clock Controller, and can be reconfigured by the user if needed. Refer to GCLK
– Generic Clock Controller for details.
Related Links
16.6.2.6 Peripheral Clock Masking
15. GCLK - Generic Clock Controller
16.5.4 DMA
Not applicable.
16.5.5 Interrupts
The interrupt request line is connected to the Interrupt Controller. Using the PM interrupt requires the Interrupt
Controller to be configured first. Refer to Nested Vector Interrupt Controller for details.
Related Links
11.2 Nested Vector Interrupt Controller
16.5.6 Events
Not applicable.
Related Links
11.6 Peripheral Access Controller (PAC)
Clock
gate
Clock
gate CLK_PERIPHERAL_APBC_n
Clock CLK_APBC Clock
gate CLK_PERIPHERAL_APBC_1
gate CLK_PERIPHERAL_APBC_0
APBCDIV
APBBMASK
Clock
gate CLK_PERIPHERAL_APBB_n
Clock CLK_APBB Clock
gate
Clock CLK_PERIPHERAL_APBB_1
gate gate CLK_PERIPHERAL_APBB_0
APBBDIV
APBAMASK
Clock
gate CLK_PERIPHERAL_APBA_n
Clock CLK_APBA Clock
gate
Clock CLK_PERIPHERAL_APBA_1
GCLK_MAIN gate gate CLK_PERIPHERAL_APBA_0
GCLK CLK_MAIN
APBADIV
AHBMASK
CLK_PERIPHERAL_AHB_n
Clock CLK_AHB Clock
gate
Clock
gate
Clock CLK_PERIPHERAL_AHB_1
gate gate CLK_PERIPHERAL_AHB_0
Clock CLK_CPU
Prescaler gate
CPUDIV
...........continued
Peripheral Clock Default State
CLK_RTC_APB Enabled
CLK_EIC_APB Enabled
CLK_PAC1_APB Enabled
CLK_DSU_APB Enabled
CLK_NVMCTRL_APB Enabled
CLK_PORT_APB Enabled
CLK_HMATRIX_APB Enabled
CLK_PAC2_APB Disabled
CLK_SERCOMx_APB Disabled
CLK_TCx_APB Disabled
CLK_ADC_APB Enabled
CLK_ACx_APB Disabled
CLK_DAC_APB Disabled
CLK_PTC_APB Disabled
CLK_USB_APB Enabled
CLK_DMAC_APB Enabled
CLK_TCCx_APB Disabled
CLK_I2S_APB Disabled
When the APB clock for a module is not provided its registers cannot be read or written. The module can be re-
enabled later by writing the corresponding mask bit to one.
A module may be connected to several clock domains (for instance, AHB and APB), in which case it will have several
mask bits.
Note: Clocks should only be switched off if it is certain that the module will not be used. Switching off the clock for
the NVM Controller (NVMCTRL) will cause a problem if the CPU needs to read from the flash memory. Switching off
the clock to the Power Manager (PM), which contains the mask registers, or the corresponding APBx bridge, will
make it impossible to write the mask registers again. In this case, they can only be re-enabled by a system reset.
The external reset is generated when pulling the RESET pin low. This pin has an internal pull-up, and does not need
to be driven externally during normal operation.
The POR, BOD12 and BOD33 reset sources are generated by their corresponding module in the System Controller
Interface (SYSCTRL).
The WDT reset is generated by the Watchdog Timer.
The System Reset Request (SysResetReq) is a software reset generated by the CPU when asserting the
SYSRESETREQ bit located in the Reset Control register of the CPU (See the ARM® Cortex® Technical Reference
Manual on http://www.arm.com).
Figure 16-3. Reset Controller
Debug Logic
RESET
WDT
Others
CPU
RCAUSE
RESET SOURCES
• STANDBY mode: All clock sources are stopped, except those where the RUNSTDBY bit is set. Regulator
operates in low-power mode. Before entering standby mode the user must make sure that a significant amount
of clocks and peripherals are disabled, so that the voltage regulator is not overloaded.
Table 16-3. Sleep Mode Entry and Exit Table
Note:
1. Asynchronous: interrupt generated on generic clock or external clock or external event.
2. Synchronous: interrupt generated on the APB clock.
Table 16-4. Sleep Mode Overview
Idle 0 Stop Run Run Run Run Run if requested Run if requested Run Normal Normal
Idle 1 Stop Stop Run Run Run Run if requested Run if requested Run Normal Normal
Idle 2 Stop Stop Stop Run Run Run if requested Run if requested Run Normal Normal
Standby Stop Stop Stop Stop Run Stop Run if requested Stop Low power Low power
• Exiting STANDBY mode: Any peripheral able to generate an asynchronous interrupt can wake up the system.
For example, a module running on a Generic clock can trigger an interrupt. When the enabled asynchronous
wake-up event occurs and the system is woken up, the device will either execute the interrupt service routine or
continue the normal program execution according to the Priority Mask Register (PRIMASK) configuration of the
CPU.
16.6.3 SleepWalking
SleepWalking is the capability for a device to temporarily wake-up clocks for the peripheral to perform a task without
waking-up the CPU in STANDBY sleep mode. At the end of the sleepwalking task, the device can either be
awakened by an interrupt (from a peripheral involved in SleepWalking) or enter into STANDBY sleep mode again.
In this device, SleepWalking is supported only on GCLK clocks by using the on-demand clock principle of the clock
sources. Refer to On-demand, Clock Requests for more details.
Related Links
14.6 On-demand, Clock Requests
16.6.5 Interrupts
The peripheral has the following interrupt sources:
• Clock Ready flag
Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status and Clear
(INTFLAG) register is set when the interrupt condition occurs. Each interrupt can be individually enabled by writing a
one to the corresponding bit in the Interrupt Enable Set (INTENSET) register, and disabled by writing a one to the
corresponding bit in the Interrupt Enable Clear (INTENCLR) register. An interrupt request is generated when the
interrupt flag is set and the corresponding interrupt is enabled. The interrupt request remains active until the interrupt
flag is cleared, the interrupt is disabled or the peripheral is reset. An interrupt flag is cleared by writing a one to the
corresponding bit in the INTFLAG register. Each peripheral can have one interrupt request line per interrupt source or
one common interrupt request line for all the interrupt sources. Refer to Nested Vector Interrupt Controller for details.
If the peripheral has one common interrupt request line for all the interrupt sources, the user must read the INTFLAG
register to determine which interrupt condition is present.
Related Links
11.2 Nested Vector Interrupt Controller
16.6.6 Events
Not applicable.
16.8.1 Control
Name: CTRL
Offset: 0x00
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
Access
Reset
Name: SLEEP
Offset: 0x01
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
IDLE[1:0]
Access R/W R/W
Reset 0 0
Name: CPUSEL
Offset: 0x08
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
CPUDIV[2:0]
Access R/W R/W R/W
Reset 0 0 0
Name: APBASEL
Offset: 0x09
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
APBADIV[2:0]
Access R/W R/W R/W
Reset 0 0 0
Name: APBBSEL
Offset: 0x0A
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
APBBDIV[2:0]
Access R/W R/W R/W
Reset 0 0 0
Name: APBCSEL
Offset: 0x0B
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
APBCDIV[2:0]
Access R/W R/W R/W
Reset 0 0 0
Name: AHBMASK
Offset: 0x14
Reset: 0x0000007F
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
USB DMAC NVMCTRL DSU HPB2 HPB1 HPB0
Access R/W R/W R/W R/W R/W R/W R/W
Reset 1 1 1 1 1 1 1
Name: APBAMASK
Offset: 0x18
Reset: 0x0000007F
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
EIC RTC WDT GCLK SYSCTRL PM PAC0
Access R/W R/W R/W R/W R/W R/W R/W
Reset 1 1 1 1 1 1 1
Name: APBBMASK
Offset: 0x1C
Reset: 0x0000007F
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
USB DMAC PORT NVMCTRL DSU PAC1
Access R/W R/W R/W R/W R/W R/W
Reset 1 1 1 1 1 1
Name: APBCMASK
Offset: 0x20
Reset: 0x00010000
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
TCC3
Access R R R R R R R R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
AC1 I2S PTC DAC AC ADC
Access R R R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 1
Bit 15 14 13 12 11 10 9 8
TC7 TC6 TC5 TC4 TC3 TCC2 TCC1 TCC0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
SERCOM5 SERCOM4 SERCOM3 SERCOM2 SERCOM1 SERCOM0 EVSYS PAC2
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Value Description
1 The APBC clock for the AC is enabled
Value Description
1 The APBC clock for the SERCOM4 is enabled
Name: INTENCLR
Offset: 0x34
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
CKRDY
Access R/W
Reset 0
Name: INTENSET
Offset: 0x35
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
CKRDY
Access R/W
Reset 0
Name: INTFLAG
Offset: 0x36
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
CKRDY
Access R/W
Reset 0
Name: RCAUSE
Offset: 0x38
Reset: 0x01
Property: -
Bit 7 6 5 4 3 2 1 0
SYST WDT EXT BOD33 BOD12 POR
Access R R R R R R
Reset 0 0 0 0 0 1
17.1 Overview
The System Controller (SYSCTRL) provides a user interface to the clock sources, brown out detectors, on-chip
voltage regulator and voltage reference of the device.
Through the interface registers, it is possible to enable, disable, calibrate and monitor the SYSCTRL sub-peripherals.
All sub-peripheral statuses are collected in the Power and Clocks Status register (PCLKSR). They can additionally
trigger interrupts upon status changes through the INTENSET (INTENSET), INTENCLR (INTENCLR) and INTFLAG
(INTFLAG) registers.
Additionally, BOD33 interrupts can be used to wake up the device from Stand-by mode upon a programmed brown-
out detection.
17.2 Features
• 0.4-32 MHz Crystal Oscillator (XOSC)
– Tunable gain control
– Programmable start-up time
– Crystal or external input clock on XIN I/O
• 32.768 kHz Crystal Oscillator (XOSC32K)
– Automatic or manual gain control
– Programmable start-up time
– Crystal or external input clock on XIN32 I/O
• 32.768 kHz High Accuracy Internal Oscillator (OSC32K)
– Frequency fine tuning
– Programmable start-up time
• 32.768 kHz Ultra Low-Power Internal Oscillator (OSCULP32K)
– Ultra low-power, always-on oscillator
– Frequency fine tuning
– Calibration value loaded from Flash Factory Calibration at Reset
• 8 MHz Internal Oscillator (OSC8M)
– Fast start-up
– Output frequency fine tuning
– 4/2/1 MHz divided output frequencies available
– Calibration value loaded from Flash Factory Calibration at Reset
• Digital Frequency Locked Loop (DFLL48M)
– Internal oscillator with no external components
– 48 MHz output frequency
– Operates standalone as a high-frequency programmable oscillator in Open-Loop mode
– Operates as an accurate frequency multiplier against a known frequency in Closed-Loop mode
• Fractional Digital Phase-Locked Loop (FDPLL96M)
– 48 MHz to 96 MHz output clock frequency
– 32 kHz to 2 MHz input reference clock frequency range
– Three possible sources for the reference clock
– Adjustable proportional integral controller
– Fractional part used to achieve 1/16th of reference clock step
• 3.3V Brown-Out Detector (BOD33)
– Programmable threshold
XOSC
XOSC32K
OSC32K
OSCILLATORS
OSCULP32K
CONTROL
OSC8M
DFLL48M
FDPLL96M
POWER
MONITOR BOD33
CONTROL
VOLTAGE VOLTAGE
REFERENCE REFERENCE
CONTROL SYSTEM
STATUS
(PCLKSR register)
INTERRUPTS Interrupts
GENERATOR
...........continued
Signal Name Types Description
XOUT32 Analog Output 32kHz Crystal Oscillator output
The I/O lines are automatically selected when XOSC or XOSC32K are enabled. Refer to Oscillator Pinout.
Related Links
7. I/O Multiplexing and Considerations
17.5.3 Clocks
The SYSCTRL gathers controls for all device oscillators and provides clock sources to the Generic Clock Controller
(GCLK). The available clock sources are: XOSC, XOSC32K, OSC32K, OSCULP32K, OSC8M, DFLL48M and
FDPLL96M.
The SYSCTRL bus clock (CLK_SYSCTRL_APB) can be enabled and disabled in the Power Manager, and the default
state of CLK_SYSCTRL_APB can be found in the Peripheral Clock Masking section in the PM – Power Manager.
The clock used by BOD33 in Sampled mode is asynchronous to the user interface clock (CLK_SYSCTRL_APB).
Likewise, the DFLL48M control logic uses the DFLL oscillator output, which is also asynchronous to the user
interface clock (CLK_SYSCTRL_APB). Due to this asynchronicity, writes to certain registers will require
synchronization between the clock domains. Refer to 17.6.14 Synchronization for further details.
Related Links
16.6.2.6 Peripheral Clock Masking
17.5.4 Interrupts
The interrupt request line is connected to the Interrupt Controller. Using the SYSCTRL interrupts requires the
Interrupt Controller to be configured first. Refer to Nested Vector Interrupt Controller for details.
Related Links
11.2 Nested Vector Interrupt Controller
To force an oscillator to always run in Idle mode, and not only when requested by a peripheral, the oscillator
ONDEMAND bit must be written to zero. The default value of this bit is one, and thus the default operation in Idle
mode is to run only when requested by a peripheral.
To force the oscillator to run in Standby mode, the RUNSTDBY bit must be written to one. The oscillator will then run
in Standby mode when requested by a peripheral (ONDEMAND is one). To force an oscillator to always run in
Standby mode, and not only when requested by a peripheral, the ONDEMAND bit must be written to zero and
RUNSTDBY must be written to one.
The next table shows the behavior in the different sleep modes, depending on the settings of ONDEMAND and
RUNSTDBY.
Note: This does not apply to the OSCULP32K oscillator, which is always running and cannot be disabled.
After a hard reset, or when waking up from a sleep mode where the XOSC was disabled, the XOSC will need a
certain amount of time to stabilize on the correct frequency. This start-up time can be configured by changing the
Oscillator Start-Up Time bit group (XOSC.STARTUP) in the External Multipurpose Crystal Oscillator Control register.
During the start-up time, the oscillator output is masked to ensure that no unstable clock propagates to the digital
logic. The External Multipurpose Crystal Oscillator Ready bit in the Power and Clock Status register
(PCLKSR.XOSCRDY) is set when the user-selected start-up time is over. An interrupt is generated on a zero-to-one
transition on PCLKSR.XOSCRDY if the External Multipurpose Crystal Oscillator Ready bit in the Interrupt Enable Set
register (INTENSET.XOSCRDY) is set.
Note: Do not enter standby mode when an oscillator is in start-up:
Wait for the OSCxRDY bit in SYSCTRL.PCLKSR register to be set before going into standby mode.
Related Links
15. GCLK - Generic Clock Controller
The frequency of the OSC32K oscillator is controlled by the value in the 32kHz Internal Oscillator Calibration bits
(OSC32K.CALIB) in the 32kHz Internal Oscillator Control register. The OSC32K.CALIB value must be written by the
user. Flash Factory Calibration values are stored in the NVM Software Calibration Area (refer to NVM Software
Calibration Area Mapping). When writing to the Calibration bits, the user must wait for the PCLKSR.OSC32KRDY bit
to go high before the value is committed to the oscillator.
Related Links
15. GCLK - Generic Clock Controller
10.3.2 NVM Software Calibration Area Mapping
where Fclkdfll48mref is the frequency of the reference clock (CLK_DFLL48M_REF). DFLLVAL.COARSE and
DFLLVAL.FINE are read-only in closed-loop mode, and are controlled by the frequency tuner to meet user specified
frequency. In closed-loop mode, the value in DFLLVAL.COARSE is used by the frequency tuner as a starting point for
Coarse. Writing DFLLVAL.COARSE to a value close to the final value before entering closed-loop mode will reduce
the time needed to get a lock on Coarse.
Using "DFLL48M COARSE CAL" from NVM Software Calibration Area Mapping for DFLL.COARSE will start DFLL
with a frequency close to 48 MHz.
Following Software sequence should be followed while using the same.
1. load "DFLL48M COARSE CAL" from NVM User Row Mapping in DFLL.COARSE register
2. Set DFLLCTRL.BPLCKC bit
CLK_DFLL48M frequency is not measured, can be enabled. The chill cycle is enabled by default, but can be disabled
by writing a one to the DFLL Chill Cycle Disable bit (DFLLCTRL.CCDIS) in the DFLL Control register. Enabling chill
cycles might double the lock time.
Another solution to this problem consists of using less strict lock requirements. This is called Quick Lock (QL), which
is also enabled by default, but it can be disabled by writing a one to the Quick Lock Disable bit (DFLLCTRL.QLDIS) in
the DFLL Control register. The Quick Lock might lead to a larger spread in the output frequency than chill cycles, but
the average output frequency is the same.
17.6.7.2.4 Accuracy
There are three main factors that determine the accuracy of Fclkdfll48m. These can be tuned to obtain maximum
accuracy when fine lock is achieved.
• Fine resolution: The frequency step between two Fine values. This is relatively smaller for high output
frequencies.
• Resolution of the measurement: If the resolution of the measured Fclkdfll48m is low, i.e., the ratio between the
CLK_DFLL48M frequency and the CLK_DFLL48M_REF frequency is small, then the DFLL48M might lock at a
frequency that is lower than the targeted frequency. It is recommended to use a reference clock frequency of
32kHz or lower to avoid this issue for low target frequencies.
• The accuracy of the reference clock.
17.6.8.1 Overview
The FDPLL96M controller allows flexible interface to the core digital function of the Digital Phase Locked Loop
(DPLL). The FDPLL96M integrates a digital filter with a proportional integral controller, a Time-to-Digital Converter
(TDC), a test mode controller, a Digitally Controlled Oscillator (DCO) and a PLL controller. It also provides a fractional
multiplier of frequency N between the input and output frequency.
The CLK_FDPLL96M_REF is the DPLL input clock reference. The selectable sources for the reference clock are
XOSC32K, XOSC and GCLK_DPLL. The path between XOSC and input multiplexer integrates a clock divider. The
selected clock must be configured and enabled before using the FDPLL96M. If the GCLK is selected as reference
clock, it must be configured and enabled in the Generic Clock Controller before using the FDPLL96M. Refer to GCLK
– Generic Clock Controller for details. If the GCLK_DPLL is selected as the source for the CLK_FDPLL96M_REF,
care must be taken to make sure the source for this GCLK is within the valid frequency range for the FDPLL96M.
The XOSC source can be divided inside the FDPLL96M. The user must make sure that the programmable clock
divider and XOSC frequency provides a valid CLK_FDPLL96M_REF clock frequency that meets the FDPLL96M input
frequency range.
The output clock of the FDPLL96M is CLK_FDPLL96M. The state of the CLK_FDPLL96M clock only depends on the
FDPLL96M internal control of the final clock gater CG.
The FDPLL96M requires a 32kHz clock from the GCLK when the FDPLL96M internal lock timer is used. This clock
must be configured and enabled in the Generic Clock Controller before using the FDPLL96M. Refer to GCLK –
Generic Clock Controller for details.
Table 17-3. Generic Clock Input for FDPLL96M
Related Links
15. GCLK - Generic Clock Controller
GCLK_DPLL_32K User
Interface
XOSC32K
CLK_FDPLL96M_REF
CK CLK_FDPLL96M
Digital
Divider
CG
TDC DCO
XOSC Filter
GCLK_DPLL
÷N
CKRx
ENABLE
CK
CLK_FDPLL96M
LOCK
Figure 17-4. CK and CLK_FDPLL96M Off Mode to Running Mode when Wake-Up Fast is Activated
CKRx
ENABLE
CK
CLK_FDPLL96M
LOCK
CKRx
ENABLE
CK
CLK_FDPLL96M
LOCK
CKRx
LDR
mult0 mult1
LDRFRAC
CK
CLK_FDPLL96M
LOCK
LOCKL
As the Sampling mode clock is different from the APB clock domain, synchronization among the clocks is necessary.
The next figure shows a block diagram of the Sampling mode. The BOD33Synchronization Ready bit
(PCLKSR.B33SRDY) in the Power and Clocks Status register show the synchronization ready status of the
synchronizer. Writing attempts to the BOD33 register are ignored while PCLKSR.B33SRDY is zero.
Figure 17-7. Sampling Mode Block Diagram
USER INTERFACE
REGISTERS
(APB clock domain)
PSEL
CEN
SYNCHRONIZER PRESCALER
(clk_prescaler
MODE CLK_SAMPLING
domain)
ENABLE
CLK_APB CLK_PRESCALER
The BOD33 Clock Enable bit (BOD33.CEN) in the BOD33 register should always be disabled before changing the
prescaler value. To change the prescaler value for the BOD33 during Sampling mode, the following steps need to be
taken:
1. Wait until the PCLKSR.B33SRDY bit is set.
2. Write the selected value to the BOD33.PSEL bit group.
17.6.9.4 Hysteresis
The hysteresis functionality can be used in both continuous and sampling mode. Writing a one to the BOD33
Hysteresis bit (BOD33.HYST) in the BOD33 register will add hysteresis to the BOD33 threshold level.
17.6.13 Interrupts
The SYSCTRL has the following interrupt sources:
• XOSCRDY - Multipurpose Crystal Oscillator Ready: A “0-to-1” transition on the PCLKSR.XOSCRDY bit is
detected
• XOSC32KRDY - 32kHz Crystal Oscillator Ready: A “0-to-1” transition on the PCLKSR.XOSC32KRDY bit is
detected
• OSC32KRDY - 32kHz Internal Oscillator Ready: A “0-to-1” transition on the PCLKSR.OSC32KRDY bit is
detected
• OSC8MRDY - 8MHz Internal Oscillator Ready: A “0-to-1” transition on the PCLKSR.OSC8MRDY bit is detected
• DFLLRDY - DFLL48M Ready: A “0-to-1” transition on the PCLKSR.DFLLRDY bit is detected
• DFLLOOB - DFLL48M Out Of Boundaries: A “0-to-1” transition on the PCLKSR.DFLLOOB bit is detected
• DFLLLOCKF - DFLL48M Fine Lock: A “0-to-1” transition on the PCLKSR.DFLLLOCKF bit is detected
• DFLLLOCKC - DFLL48M Coarse Lock: A “0-to-1” transition on the PCLKSR.DFLLLOCKC bit is detected
• DFLLRCS - DFLL48M Reference Clock has Stopped: A “0-to-1” transition on the PCLKSR.DFLLRCS bit is
detected
• BOD33RDY - BOD33 Ready: A “0-to-1” transition on the PCLKSR.BOD33RDY bit is detected
• BOD33DET - BOD33 Detection: A “0-to-1” transition on the PCLKSR.BOD33DET bit is detected. This is an
asynchronous interrupt and can be used to wake-up the device from any sleep mode.
• B33SRDY - BOD33 Synchronization Ready: A “0-to-1” transition on the PCLKSR.B33SRDY bit is detected
• PLL Lock (LOCK): Indicates that the DPLL Lock bit is asserted.
• PLL Lock Lost (LOCKL): Indicates that a falling edge has been detected on the Lock bit during normal operation
mode.
• PLL Lock Timer Timeout (LTTO): This interrupt flag indicates that the software defined time DPLLCTRLB.LTIME
has elapsed since the start of the FDPLL96M.
Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status and Clear
(INTFLAG) register is set when the interrupt condition occurs. Each interrupt can be individually enabled by writing a
one to the corresponding bit in the Interrupt Enable Set (INTENSET) register, and disabled by writing a one to the
corresponding bit in the Interrupt Enable Clear (INTENCLR) register. An interrupt request is generated when the
interrupt flag is set and the corresponding interrupt is enabled. The interrupt request remains active until the interrupt
flag is cleared, the interrupt is disabled, or the SYSCTRL is reset. See Interrupt Flag Status and Clear (INTFLAG)
register for details on how to clear interrupt flags.
All interrupt requests from the peripheral are ORed together on system level to generate one combined interrupt
request to the NVIC. Refer to Nested Vector Interrupt Controller for details. The user must read the INTFLAG register
to determine which interrupt condition is present.
Note: Interrupts must be globally enabled for interrupt requests to be generated. Refer to Nested Vector Interrupt
Controller for details.
Related Links
11.2 Nested Vector Interrupt Controller
17.6.14 Synchronization
Due to the multiple clock domains, values in the DFLL48M Control registers need to be synchronized to other clock
domains. The status of this synchronization can be read from the Power and Clocks Status register (PCLKSR).
Before writing to any of the DFLL48M Control registers, the user must check that the DFLL Ready bit
(PCLKSR.DFLLRDY) in PCLKSR is set to one. When this bit is set, the DFLL48M can be configured and
CLK_DFLL48M is ready to be used. Any write to any of the DFLL48M Control registers while DFLLRDY is zero will
XOSC32KRD
7:0 DFLLLCKC DFLLLCKF DFLLOOB DFLLRDY OSC8MRDY OSC32KRDY XOSCRDY
Y
0x00 INTENCLR 15:8 DPLLLCKR B33SRDY BOD33DET BOD33RDY DFLLRCS
23:16 DPLLLTO DPLLLCKF
31:24
XOSC32KRD
7:0 DFLLLCKC DFLLLCKF DFLLOOB DFLLRDY OSC8MRDY OSC32KRDY XOSCRDY
Y
0x04 INTENSET 15:8 DPLLLCKR B33SRDY BOD33DET BOD33RDY DFLLRCS
23:16 DPLLLTO DPLLLCKF
31:24
XOSC32KRD
7:0 DFLLLCKC DFLLLCKF DFLLOOB DFLLRDY OSC8MRDY OSC32KRDY XOSCRDY
Y
0x08 INTFLAG 15:8 DPLLLCKR B33SRDY BOD33DET BOD33RDY DFLLRCS
23:16 DPLLLTO DPLLLCKF
31:24
XOSC32KRD
7:0 DFLLLCKC DFLLLCKF DFLLOOB DFLLRDY OSC8MRDY OSC32KRDY XOSCRDY
Y
0x0C PCLKSR 15:8 DPLLLCKR B33SRDY BOD33DET BOD33RDY DFLLRCS
23:16 DPLLLTO DPLLLCKF
31:24
7:0 ONDEMAND RUNSTDBY XTALEN ENABLE
0x10 XOSC
15:8 STARTUP[3:0] AMPGC GAIN[2:0]
0x12
... Reserved
0x13
7:0 ONDEMAND RUNSTDBY AAMPEN EN32K XTALEN ENABLE
0x14 XOSC32K
15:8 WRTLOCK STARTUP[2:0]
0x16
... Reserved
0x17
7:0 ONDEMAND RUNSTDBY EN32K ENABLE
15:8 WRTLOCK STARTUP[2:0]
0x18 OSC32K
23:16 CALIB[6:0]
31:24
0x1C OSCULP32K 7:0 WRTLOCK CALIB[4:0]
0x1D
... Reserved
0x1F
7:0 ONDEMAND RUNSTDBY ENABLE
15:8 PRESC[1:0]
0x20 OSC8M
23:16 CALIB[7:0]
31:24 FRANGE[1:0] CALIB[11:8]
7:0 ONDEMAND RUNSTDBY USBCRM LLAW STABLE MODE ENABLE
0x24 DFLLCTRL
15:8 WAITLOCK BPLCKC QLDIS CCDIS
0x26
... Reserved
0x27
7:0 FINE[7:0]
15:8 COARSE[5:0] FINE[9:8]
0x28 DFLLVAL
23:16 DIFF[7:0]
31:24 DIFF[15:8]
7:0 MUL[7:0]
15:8 MUL[15:8]
0x2C DFLLMUL
23:16 FSTEP[7:0]
31:24 CSTEP[5:0] FSTEP[9:8]
0x30 DFLLSYNC 7:0 READREQ
...........continued
0x31
... Reserved
0x33
7:0 RUNSTDBY ACTION[1:0] HYST ENABLE
15:8 PSEL[3:0] CEN MODE
0x34 BOD33
23:16 LEVEL[5:0]
31:24
0x38
... Reserved
0x3B
7:0 RUNSTDBY ENABLE
0x3C VREG
15:8 FORCELDO
0x3E
... Reserved
0x3F
7:0 BGOUTEN TSEN
15:8
0x40 VREF
23:16 CALIB[7:0]
31:24 CALIB[10:8]
0x44 DPLLCTRLA 7:0 ONDEMAND RUNSTDBY ENABLE
0x45
... Reserved
0x47
7:0 LDR[7:0]
15:8 LDR[11:8]
0x48 DPLLRATIO
23:16 LDRFRAC[3:0]
31:24
7:0 REFCLK[1:0] WUF LPEN FILTER[1:0]
15:8 LBYPASS LTIME[2:0]
0x4C DPLLCTRLB
23:16 DIV[7:0]
31:24 DIV[10:8]
0x50 DPLLSTATUS 7:0 DIV ENABLE CLKRDY LOCK
Name: INTENCLR
Offset: 0x00
Reset: 0x00000000
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
DPLLLTO DPLLLCKF
Access R R R R R R R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
DPLLLCKR B33SRDY BOD33DET BOD33RDY DFLLRCS
Access R/W R R R R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
DFLLLCKC DFLLLCKF DFLLOOB DFLLRDY OSC8MRDY OSC32KRDY XOSC32KRDY XOSCRDY
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Writing a one to this bit will clear the BOD33 Synchronization Ready Interrupt Enable bit, which disables the BOD33
Synchronization Ready interrupt.
Value Description
0 The BOD33 Synchronization Ready interrupt is disabled.
1 The BOD33 Synchronization Ready interrupt is enabled, and an interrupt request will be generated
when the BOD33 Synchronization Ready Interrupt flag is set.
Value Description
1 The DFLL Out Of Bounds interrupt is enabled, and an interrupt request will be generated when the
DFLL Out Of Bounds Interrupt flag is set.
Name: INTENSET
Offset: 0x04
Reset: 0x00000000
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
DPLLLTO DPLLLCKF
Access R R R R R R R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
DPLLLCKR B33SRDY BOD33DET BOD33RDY DFLLRCS
Access R/W R R R R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
DFLLLCKC DFLLLCKF DFLLOOB DFLLRDY OSC8MRDY OSC32KRDY XOSC32KRDY XOSCRDY
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Value Description
0 The BOD33 Synchronization Ready interrupt is disabled.
1 The BOD33 Synchronization Ready interrupt is enabled, and an interrupt request will be generated
when the BOD33 Synchronization Ready Interrupt flag is set.
Name: INTFLAG
Offset: 0x08
Reset: 0x00000000
Property: -
Note: Depending on the fuse settings, various bits of the INTFLAG register can be set to one at startup. Therefore
the user should clear those bits before using the corresponding interrupts.
Bit 31 30 29 28 27 26 25 24
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
DPLLLTO DPLLLCKF
Access R R R R R R R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
DPLLLCKR B33SRDY BOD33DET BOD33RDY DFLLRCS
Access R/W R R R R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
DFLLLCKC DFLLLCKF DFLLOOB DFLLRDY OSC8MRDY OSC32KRDY XOSC32KRDY XOSCRDY
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
This flag is set on a zero-to-one transition of the OSC32K Ready bit in the Status register (PCLKSR.OSC32KRDY)
and will generate an interrupt request if INTENSET.OSC32KRDY is one.
Writing a zero to this bit has no effect.
Writing a one to this bit clears the OSC32K Ready interrupt flag.
Name: PCLKSR
Offset: 0x0C
Reset: 0x00000000
Property: -
Bit 31 30 29 28 27 26 25 24
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
DPLLLTO DPLLLCKF
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
DPLLLCKR B33SRDY BOD33DET BOD33RDY DFLLRCS
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
DFLLLCKC DFLLLCKF DFLLOOB DFLLRDY OSC8MRDY OSC32KRDY XOSC32KRDY XOSCRDY
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Value Description
1 BOD33 is ready.
Name: XOSC
Offset: 0x10
Reset: 0x0080
Property: Write-Protected
Bit 15 14 13 12 11 10 9 8
STARTUP[3:0] AMPGC GAIN[2:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
ONDEMAND RUNSTDBY XTALEN ENABLE
Access R/W R/W R/W R/W
Reset 1 0 0 0
Note:
1. Number of cycles for the start-up counter
2. Number of cycles for the synchronization delay, before PCLKSR.XOSCRDY is set.
3. Actual start-up time is n OSCULP32K cycles + 3 XOSC cycles, but given the time neglects the 3 XOSC cycles.
Name: XOSC32K
Offset: 0x14
Reset: 0x0080
Property: Write-Protected
Bit 15 14 13 12 11 10 9 8
WRTLOCK STARTUP[2:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
ONDEMAND RUNSTDBY AAMPEN EN32K XTALEN ENABLE
Access R/W R/W R/W R/W R/W R/W
Reset 1 0 0 0 0 0
STARTUP[2:0] Number of OSCULP32K Clock Number of XOSC32K Clock Approximate Equivalent Time
Cycles Cycles (OSCULP = 32kHz)(1)(2)(3)
0x0 1 3 122μs
0x1 32 3 1068μs
0x2 2048 3 62592μs
0x3 4096 3 125092μs
0x4 16384 3 500092μs
0x5 32768 3 1000092μs
0x6 65536 3 2000092μs
0x7 131072 3 4000092μs
Name: OSC32K
Offset: 0x18
Reset: 0x003F0080
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
CALIB[6:0]
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 1 1 1 1 1 1
Bit 15 14 13 12 11 10 9 8
WRTLOCK STARTUP[2:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
ONDEMAND RUNSTDBY EN32K ENABLE
Access R/W R/W R/W R/W
Reset 1 0 0 0
Name: OSCULP32K
Offset: 0x1C
Reset: 0xXX
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
WRTLOCK CALIB[4:0]
Access R/W R/W R/W R/W R/W R/W
Reset 0 x x x x x
Name: OSC8M
Offset: 0x20
Reset: 0xXXXX0382
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
FRANGE[1:0] CALIB[11:8]
Access R/W R/W R/W R/W R/W R/W
Reset x x 0 0 0 0
Bit 23 22 21 20 19 18 17 16
CALIB[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 x
Bit 15 14 13 12 11 10 9 8
PRESC[1:0]
Access R/W R/W
Reset 1 1
Bit 7 6 5 4 3 2 1 0
ONDEMAND RUNSTDBY ENABLE
Access R/W R/W R/W
Reset 1 0 1
FRANGE[1:0] Description
0x0 4 to 6MHz
0x1 6 to 8MHz
0x2 8 to 11MHz
0x3 11 to 15MHz
PRESC[1:0] Description
0x0 1
0x1 2
0x2 4
0x3 8
In On Demand operation mode, i.e., if the ONDEMAND bit has been previously written to one, the oscillator will only
be running when requested by a peripheral. If there is no peripheral requesting the oscillator's clock source, the
oscillator will be in a disabled state.
If On Demand is disabled the oscillator will always be running when enabled.
In standby sleep mode, the On Demand operation is still active if the OSC8M.RUNSTDBY bit is one. If
OSC8M.RUNSTDBY is zero, the oscillator is disabled.
Value Description
0 The oscillator is always on, if enabled.
1 The oscillator is enabled when a peripheral is requesting the oscillator to be used as a clock source.
The oscillator is disabled if no peripheral is requesting the clock source.
Name: DFLLCTRL
Offset: 0x24
Reset: 0x0080
Property: Write-Protected, Write-Synchronized
Bit 15 14 13 12 11 10 9 8
WAITLOCK BPLCKC QLDIS CCDIS
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
ONDEMAND RUNSTDBY USBCRM LLAW STABLE MODE ENABLE
Access R/W R/W R/W R/W R/W R/W R/W
Reset 1 0 0 0 0 0 0
Value Description
0 The oscillator is disabled in standby sleep mode.
1 The oscillator is not stopped in standby sleep mode. If DFLLCTRL.ONDEMAND is one, the clock
source will be running when a peripheral is requesting the clock. If DFLLCTRL.ONDEMAND is zero,
the clock source will always be running in standby sleep mode.
Name: DFLLVAL
Offset: 0x28
Reset: 0x00000000
Property: Read-Synchronized, Write-Protected
Bit 31 30 29 28 27 26 25 24
DIFF[15:8]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
DIFF[7:0]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
COARSE[5:0] FINE[9:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
FINE[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: DFLLMUL
Offset: 0x2C
Reset: 0x00000000
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
CSTEP[5:0] FSTEP[9:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
FSTEP[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
MUL[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
MUL[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: DFLLSYNC
Offset: 0x30
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
READREQ
Access W
Reset 0
Name: BOD33
Offset: 0x34
Reset: 0x00XX00XX
Property: Write-Protected, Write-Synchronized
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
LEVEL[5:0]
Access R/W R/W R/W R/W R/W R/W
Reset x x x x x x
Bit 15 14 13 12 11 10 9 8
PSEL[3:0] CEN MODE
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
RUNSTDBY ACTION[1:0] HYST ENABLE
Access R/W R/W R/W R/W R/W
Reset 0 x x x x
Bit 2 – HYST Hysteresis
This bit indicates whether hysteresis is enabled for the BOD33 threshold voltage:
This bit is loaded from Flash User Row at start-up. Refer to NVM User Row Mapping for more details.
Value Description
0 No hysteresis.
1 Hysteresis enabled.
Bit 1 – ENABLE Enable
This bit is loaded from Flash User Row at startup. Refer to NVM User Row Mapping for more details.
Value Description
0 BOD33 is disabled.
1 BOD33 is enabled.
Related Links
37. Electrical Characteristics
10.3.1 NVM User Row Mapping
Name: VREG
Offset: 0x3C
Reset: 0x0X02
Property: Write-Protected
Bit 15 14 13 12 11 10 9 8
FORCELDO
Access R/W
Reset 0
Bit 7 6 5 4 3 2 1 0
RUNSTDBY ENABLE
Access R/W R/W
Reset 0 1
Bit 1 – ENABLE
Must be set to 1.
Name: VREF
Offset: 0x40
Reset: 0x0XXX0000
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
CALIB[10:8]
Access R/W R/W R/W
Reset x x x
Bit 23 22 21 20 19 18 17 16
CALIB[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset x x x x x x x x
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
BGOUTEN TSEN
Access R/W R/W
Reset 0 0
Name: DPLLCTRLA
Offset: 0x44
Reset: 0x80
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
ONDEMAND RUNSTDBY ENABLE
Access R/W R/W R/W
Reset 1 0 0
Name: DPLLRATIO
Offset: 0x48
Reset: 0x00000000
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
LDRFRAC[3:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 15 14 13 12 11 10 9 8
LDR[11:8]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
LDR[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: DPLLCTRLB
Offset: 0x4C
Reset: 0x00000000
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
DIV[10:8]
Access R/W R/W R/W
Reset 0 0 0
Bit 23 22 21 20 19 18 17 16
DIV[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
LBYPASS LTIME[2:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
REFCLK[1:0] WUF LPEN FILTER[1:0]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Name: DPLLSTATUS
Offset: 0x50
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
DIV ENABLE CLKRDY LOCK
Access R R R R
Reset 0 0 0 0
18.1 Overview
The Watchdog Timer (WDT) is a system function for monitoring correct program operation. It makes it possible to
recover from error situations such as runaway or deadlocked code. The WDT is configured to a predefined time-out
period, and is constantly running when enabled. If the WDT is not cleared within the time-out period, it will issue a
system reset. An early-warning interrupt is available to indicate an upcoming watchdog time-out condition.
The window mode makes it possible to define a time slot (or window) inside the total time-out period during which the
WDT must be cleared. If the WDT is cleared outside this window, either too early or too late, a system reset will be
issued. Compared to the normal mode, this can also catch situations where a code error causes the WDT to be
cleared frequently.
When enabled, the WDT will run in active mode and all sleep modes. It is asynchronous and runs from a CPU-
independent clock source. The WDT will continue operation and issue a system reset or interrupt even if the main
clocks fail.
18.2 Features
• Issues a system reset if the Watchdog Timer is not cleared before its time-out period
• Early Warning interrupt generation
• Asynchronous operation from dedicated oscillator
• Two types of operation:
– Normal mode
– Window mode
• Selectable time-out periods
– From 8 cycles to 16,000 cycles in normal mode
– From 16 cycles to 32,000 cycles in window mode
• Always-on capability
0
CLEAR
GCLK_WDT
COUNT
PER/WINDOW/EWOFFSET
18.5.3 Clocks
The WDT bus clock (CLK_WDT_APB) is enabled by default, and can be enabled and disabled in the Power
Manager. Refer to PM – Power Manager for details.
A generic clock (GCLK_WDT) is required to clock the WDT. This clock must be configured and enabled in the
Generic Clock Controller before using the WDT. Refer to GCLK – Generic Clock Controller for details. This generic
clock is asynchronous to the user interface clock (CLK_WDT_APB). Due to this asynchronicity, accessing certain
registers will require synchronization between the clock domains. Refer to Synchronization for further details.
GCLK_WDT is intended to be sourced from the clock of the internal ultra-low-power (ULP) oscillator. Due to the
ultralow- power design, the oscillator is not very accurate, and so the exact time-out period may vary from device to
device. This variation must be kept in mind when designing software that uses the WDT to ensure that the time-out
periods used are valid for all devices. For more information on ULP oscillator accuracy, consult the Ultra Low Power
Internal 32kHz RC Oscillator (OSCULP32K) Characteristics.
GCLK_WDT can also be clocked from other sources if a more accurate clock is needed, but at the cost of higher
power consumption.
Related Links
16. PM – Power Manager
15. GCLK - Generic Clock Controller
17.6.5 32kHz Ultra Low Power Internal Oscillator (OSCULP32K) Operation
18.6.5 Synchronization
18.5.4 DMA
Not applicable.
18.5.5 Interrupts
The interrupt request line is connected to the interrupt controller. Using the WDT interrupt(s) requires the interrupt
controller to be configured first.
Related Links
11.2 Nested Vector Interrupt Controller
18.5.6 Events
Not applicable.
18.6.2.1 Initialization
The following bits are enable-protected:
• Window Mode Enable in the Control register (CTRL.WEN)
• Always-On in the Control register (CTRL-ALWAYSON)
The following registers are enable-protected:
• Configuration register (CONFIG)
• Early Warning Interrupt Control register (EWCTRL)
Any writes to these bits or registers when the WDT is enabled or is being enabled (CTRL.ENABLE=1) will be
discarded. Writes to these registers while the WDT is being disabled will be completed after the disabling is complete.
Enable-protection is denoted by the Enable-Protected property in the register description.
Initialization of the WDT can be done only while the WDT is disabled. The WDT is configured by defining the required
Time-Out Period bits in the Configuration register (CONFIG.PER). If window-mode operation is required, the Window
Enable bit in the Control register (CTRL.WEN) must be written to one and the Window Period bits in the
Configuration register (CONFIG.WINDOW) must be defined.
Normal Mode
• Defining the required Time-Out Period bits in the Configuration register (CONFIG.PER).
Window Mode
• Defining Time-Out Period bits in the Configuration register (CONFIG.PER).
• Defining Window Mode Time-Out Period bits in the Configuration register (CONFIG.WINDOW).
• Setting Window Enable bit in the Control register (CTRL.WEN).
By default, the early warning interrupt is disabled. If it is desired, the Early Warning Interrupt Enable bit in the Interrupt
Enable register (INTENSET.EW) must be written to '1'. The Early Warning Interrupt is disabled again by writing a '1'
to the Early Warning Interrupt bit in the Interrupt Enable Clear register (INTENCLR.EW). If the Early Warning Interrupt
is enabled, an interrupt is generated prior to a WDT time-out condition. In Normal mode, the Early Warning Offset bits
in the Early Warning Interrupt Control register, EWCTRL.EWOFFSET, define the time when the early warning
interrupt occurs. The Normal mode operation is illustrated in the figure Normal-Mode Operation.
Figure 18-2. Normal-Mode Operation
WDT Count
System Reset
EWOFFSET[3:0] = 0
Early Warning Interrupt
t[ms]
5 10 15 20 25 30 35
TOWDT
WDT Count
System Reset
t[ms]
5 10 15 20 25 30 35
TOWDTW TOWDT
The CTRL.ALWAYSON bit must never be set to one by software if any of the following conditions is true:
1. The GCLK_WDT is disabled
2. The clock generator for the GCLK_WDT is disabled
3. The source clock of the clock generator for the GCLK_WDT is disabled or off
The Interrupt Clear and Interrupt Set registers are accessible in the Always-On mode. The Early Warning interrupt
can still be enabled or disabled while in the Always-On mode, but note that EWCTRL.EWOFFSET cannot be
changed.
Table 18-2. WDT Operating Modes With Always-On
18.6.4 Interrupts
The WDT has the following interrupt source:
• Early Warning (EW)
Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status and Clear
(INTFLAG) register is set when the interrupt condition occurs. Each interrupt can be individually enabled by writing a
'1' to the corresponding bit in the Interrupt Enable Set (INTENSET) register, and disabled by writing a '1' to the
corresponding bit in the Interrupt Enable Clear (INTENCLR) register.
An interrupt request is generated when the interrupt flag is set and the corresponding interrupt is enabled. The
interrupt request remains active until the interrupt flag is cleared, the interrupt is disabled, or the WDT is reset. See
the INTFLAG register description for details on how to clear interrupt flags.
The WDT has one common interrupt request line for all the interrupt sources. The user must read the INTFLAG
register to determine which interrupt condition is present.
Note: Interrupts must be globally enabled for interrupt requests to be generated.
The Early Warning interrupt behaves differently in normal mode and in window mode. In normal mode, the Early
Warning interrupt generation is defined by the Early Warning Offset in the Early Warning Control register
(EWCTRL.EWOFFSET). The Early Warning Offset bits define the number of GCLK_WDT clocks before the interrupt
is generated, relative to the start of the watchdog time-out period. For example, if the WDT is operating in normal
mode with CONFIG.PER = 0x2 and EWCTRL.EWOFFSET = 0x1, the Early Warning interrupt is generated 16
GCLK_WDT clock cycles from the start of the watchdog time-out period, and the watchdog time-out system reset is
generated 32 GCLK_WDT clock cycles from the start of the watchdog time-out period. The user must take caution
when programming the Early Warning Offset bits. If these bits define an Early Warning interrupt generation time
greater than the watchdog time-out period, the watchdog time-out system reset is generated prior to the Early
Warning interrupt. Thus, the Early Warning interrupt will never be generated.
In window mode, the Early Warning interrupt is generated at the start of the open window period. In a typical
application where the system is in sleep mode, it can use this interrupt to wake up and clear the Watchdog Timer,
after which the system can perform other tasks or return to sleep mode.
18.6.5 Synchronization
Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be
synchronized when written or read.
When executing an operation that requires synchronization, the Synchronization Busy bit in the Status register
(STATUS.SYNCBUSY) will be set immediately, and cleared when synchronization is complete.
If an operation that requires synchronization is executed while STATUS.SYNCBUSY='1', the bus will be stalled. All
operations will complete successfully, but the CPU will be stalled and interrupts will be pending as long as the bus is
stalled.
18.8.1 Control
Name: CTRL
Offset: 0x0
Reset: N/A - Loaded from NVM User Row at start-up
Property: Write-Protected, Enable-Protected, Write-Synchronized
Bit 7 6 5 4 3 2 1 0
ALWAYSON WEN ENABLE
Access R/W R/W R/W
Reset x x x
Bit 7 – ALWAYSON Always-On
This bit allows the WDT to run continuously. After being written to one, this bit cannot be written to zero, and the WDT
will remain enabled until a power-on reset is received. When this bit is one, the Control register (CTRL), the
Configuration register (CONFIG) and the Early Warning Control register (EWCTRL) will be read-only, and any writes
to these registers are not allowed. Writing a zero to this bit has no effect.
This bit is not enable-protected.
These bits are loaded from NVM User Row at start-up. Refer to NVM User Row Mapping for more details.
Value Description
0 The WDT is enabled and disabled through the ENABLE bit.
1 The WDT is enabled and can only be disabled by a power-on reset (POR).
Bit 1 – ENABLE Enable
This bit enables or disables the WDT. Can only be written while CTRL.ALWAYSON is zero.
Due to synchronization, there is delay from writing CTRL.ENABLE until the peripheral is enabled/disabled. The value
written to CTRL.ENABLE will read back immediately, and the Synchronization Busy bit in the Status register
(STATUS.SYNCBUSY) will be set. STATUS.SYNCBUSY will be cleared when the operation is complete.
This bit is not enable-protected.
This bit is loaded from NVM User Row at start-up. Refer to NVM User Row Mapping for more details.
Value Description
0 The WDT is disabled.
1 The WDT is enabled.
Related Links
10.3.1 NVM User Row Mapping
18.8.2 Configuration
Name: CONFIG
Offset: 0x1
Reset: N/A - Loaded from NVM User Row at startup
Property: Write-Protected, Enable-Protected, Write-Synchronized
Bit 7 6 5 4 3 2 1 0
WINDOW[3:0] PER[3:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset x x x x x x x x
Related Links
10.3.1 NVM User Row Mapping
Name: EWCTRL
Offset: 0x2
Reset: N/A - Loaded from NVM User Row at start-up
Property: Write-Protected, Enable-Protected
Bit 7 6 5 4 3 2 1 0
EWOFFSET[3:0]
Access R/W R/W R/W R/W
Reset x x x x
Related Links
10.3.1 NVM User Row Mapping
Name: INTENCLR
Offset: 0x4
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
EW
Access R/W
Reset 0
Name: INTENSET
Offset: 0x5
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
EW
Access R/W
Reset 0
Name: INTFLAG
Offset: 0x6
Reset: 0x00
Property: –
Bit 7 6 5 4 3 2 1 0
EW
Access R/W
Reset 0
18.8.7 Status
Name: STATUS
Offset: 0x7
Reset: 0x00
Property: –
Bit 7 6 5 4 3 2 1 0
SYNCBUSY
Access R
Reset 0
18.8.8 Clear
Name: CLEAR
Offset: 0x8
Reset: 0x00
Property: Write-Protected, Write-Synchronized
Bit 7 6 5 4 3 2 1 0
CLEAR[7:0]
Access W W W W W W W W
Reset 0 0 0 0 0 0 0 0
19.1 Overview
The Real-Time Counter (RTC) is a 32-bit counter with a 10-bit programmable prescaler that typically runs
continuously to keep track of time. The RTC can wake up the device from sleep modes using the alarm/compare
wake up, periodic wake up, or overflow wake up mechanisms
The RTC is typically clocked by the 1.024kHz output from the 32.768kHz High-Accuracy Internal Crystal
Oscillator(OSC32K) and this is the configuration optimized for the lowest power consumption. The faster 32.768kHz
output can be selected if the RTC needs a resolution higher than 1ms. The RTC can also be clocked from other
sources, selectable through the Generic Clock module (GCLK).
The RTC can generate periodic peripheral events from outputs of the prescaler, as well as alarm/compare interrupts
and peripheral events, which can trigger at any counter value. Additionally, the timer can trigger an overflow interrupt
and peripheral event, and can be reset on the occurrence of an alarm/compare match. This allows periodic interrupts
and peripheral events at very long and accurate intervals.
The 10-bit programmable prescaler can scale down the clock source. By this, a wide range of resolutions and time-
out periods can be configured. With a 32.768kHz clock source, the minimum counter tick interval is 30.5µs, and time-
out periods can range up to 36 hours. For a counter tick interval of 1s, the maximum time-out period is more than 136
years.
19.2 Features
• 32-bit counter with 10-bit prescaler
• Multiple clock sources
• 32-bit or 16-bit Counter mode
– One 32-bit or two 16-bit compare values
• Clock/Calendar mode
– Time in seconds, minutes and hours (12/24)
– Date in day of month, month and year
– Leap year correction
• Digital prescaler correction/tuning for increased accuracy
• Overflow, alarm/compare match and prescaler interrupts and events
– Optional clear on alarm/compare match
CLK_RTC_CNT
GCLK_RTC 10-bit
COUNT Overflow
Prescaler
32
= Compare n
Periodic 32
Events
COMPn
GCLK_RTC CLK_RTC_CNT
10-bit
COUNT
Prescaler
= Overflow
16 16
Periodic PER
Events
= Compare n
16
COMPn
MASKn = Alarm n
32 Y/M/D H:M:S
Periodic
Events
ALARMn
19.5.3 Clocks
The RTC bus clock (CLK_RTC_APB) can be enabled and disabled in the Power Manager, and the default state of
CLK_RTC_APB can be found in the Peripheral Clock Masking section.
A generic clock (GCLK_RTC) is required to clock the RTC. This clock must be configured and enabled in the Generic
Clock Controller before using the RTC. Refer to GCLK – Generic Clock Controller for details.
This generic clock is asynchronous to the user interface clock (CLK_RTC_APB). Due to this asynchronicity,
accessing certain registers will require synchronization between the clock domains. Refer to 19.6.8 Synchronization
for further details.
The RTC should not work with the Generic Clock Generator 0.
Related Links
16.6.2.6 Peripheral Clock Masking
15. GCLK - Generic Clock Controller
19.5.4 DMA
Not applicable.
19.5.5 Interrupts
The interrupt request line is connected to the Interrupt Controller. Using the RTC interrupts requires the Interrupt
Controller to be configured first. Refer to Nested Vector Interrupt Controller for details.
Related Links
11.2 Nested Vector Interrupt Controller
19.5.6 Events
The events are connected to the Event System.
Related Links
24. EVSYS – Event System
19.6.2.1 Initialization
The following bits are enable-protected, meaning that they can only be written when the RTC is disabled
(CTRL.ENABLE=0):
• Operating Mode bits in the Control register (CTRL.MODE)
• Prescaler bits in the Control register (CTRL.PRESCALER)
• Clear on Match bit in the Control register (CTRL.MATCHCLR)
• Clock Representation bit in the Control register (CTRL.CLKREP)
The following register is enable-protected:
• Event Control register (EVCTRL)
Any writes to these bits or registers when the RTC is enabled or being enabled (CTRL.ENABLE=1) will be discarded.
Writes to these bits or registers while the RTC is being disabled will be completed after the disabling is complete.
Enable-protection is denoted by the "Enable-Protected" property in the register description.
Before the RTC is enabled, it must be configured, as outlined by the following steps:
1. RTC operation mode must be selected by writing the Operating Mode bit group in the Control register
(CTRL.MODE)
2. Clock representation must be selected by writing the Clock Representation bit in the Control register
(CTRL.CLKREP)
3. Prescaler value must be selected by writing the Prescaler bit group in the Control register
(CTRL.PRESCALER)
The RTC prescaler divides the source clock for the RTC counter.
Note: In Clock/Calendar mode, the prescaler must be configured to provide a 1Hz clock to the counter for correct
operation.
The frequency of the RTC clock (CLK_RTC_CNT) is given by the following formula:
�GCLK_RTC
�CLK_RTC_CNT = PRESCALER
2
The frequency of the generic clock, GCLK_RTC, is given by fGCLK_RTC, and fCLK_RTC_CNT is the frequency of the
internal prescaled RTC clock, CLK_RTC_CNT.
of 1s after the occurrence of alarm match. A valid alarm match depends on the setting of the Alarm Mask Selection
bits in the Alarm
A valid alarm match depends on the setting of the Alarm Mask Selection bits in the Alarm 0 Mask register
(MASK0.SEL). These bits determine which time/date fields of the clock and alarm values are valid for comparison
and which are ignored.
If the Clear on Match bit in the Control register (CTRL.MATCHCLR) is one, the counter is cleared on the next counter
cycle when an alarm match with ALARM0 occurs. This allows the RTC to generate periodic interrupts or events with
longer periods than are possible with the prescaler events (see 19.6.9.1 Periodic Events). Note that when
CTRL.MATCHCLR is '1', INTFLAG.ALARM0 and INTFLAG.OVF will both be set simultaneously on an alarm match
with ALARM0.
19.6.5 Interrupts
The RTC has the following interrupt sources which are asynchronous interrupts and can wake-up the device from any
sleep mode.:
• Overflow (INTFLAG.OVF): Indicates that the counter has reached its top value and wrapped to zero.
• Compare n (INTFLAG.CMPn): Indicates a match between the counter value and the compare register.
• Alarm n (INTFLAG.ALARMn): Indicates a match between the clock value and the alarm register.
• Synchronization Ready (INTFLAG.SYNCRDY): Indicates an operation requires synchronization.
Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status and Clear
(INTFLAG) register is set when the interrupt condition occurs. Each interrupt can be individually enabled by setting
the corresponding bit in the Interrupt Enable Set register (INTENSET=1), and disabled by setting the corresponding
bit in the Interrupt Enable Clear register (INTENCLR=1). An interrupt request is generated when the interrupt flag is
raised and the corresponding interrupt is enabled. The interrupt request remains active until either the interrupt flag is
cleared, the interrupt is disabled or the RTC is reset. See the description of the INTFLAG registers for details on how
to clear interrupt flags. All interrupt requests from the peripheral are ORed together on system level to generate one
combined interrupt request to the NVIC. Refer to the Nested Vector Interrupt Controller for details. The user must
read the INTFLAG register to determine which interrupt condition is present.
Note: Interrupts must be globally enabled for interrupt requests to be generated. Refer to the Nested Vector
Interrupt Controller for details.
Related Links
11.2 Nested Vector Interrupt Controller
19.6.6 Events
The RTC can generate the following output events, which are generated in the same way as the corresponding
interrupts:
• Overflow (OVF): Indicates that the counter has reached its top value and wrapped to zero.
• Period n (PERn): The corresponding bit in the prescaler has toggled. Refer to 19.6.9.1 Periodic Events for
details.
• Compare n (CMPn): Indicates a match between the counter value and the compare register.
• Alarm n (ALARMn): Indicates a match between the clock value and the alarm register.
Setting the Event Output bit in the Event Control Register (EVCTRL.xxxEO=1) enables the corresponding output
event. Writing a zero to this bit disables the corresponding output event. Refer to the EVSYS - Event System for
details on configuring the event system.
Related Links
24. EVSYS – Event System
19.6.8 Synchronization
Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be
synchronized when written or read.
When executing an operation that requires synchronization, the Synchronization Busy bit in the Status register
(STATUS.SYNCBUSY) will be set immediately, and cleared when synchronization is complete. The Synchronization
Ready interrupt can be used to signal when synchronization is complete. This can be accessed via the
Synchronization Ready Interrupt Flag in the Interrupt Flag Status and Clear register (INTFLAG.SYNCRDY). If an
operation that requires synchronization is executed while STATUS.SYNCBUSY is one, the bus will be stalled. All
operations will complete successfully, but the CPU will be stalled and interrupts will be pending as long as the bus is
stalled.
The following bits are synchronized when written:
• Software Reset bit in the Control register (CTRL.SWRST)
• Enable bit in the Control register (CTRL.ENABLE)
The following registers are synchronized when written:
• Counter Value register (COUNT)
• Clock Value register (CLOCK)
• Counter Period register (PER)
• Compare n Value registers (COMPn)
• Alarm n Value registers (ALARMn)
• Frequency Correction register (FREQCORR)
• Alarm n Mask register (MASKn)
Required write-synchronization is denoted by the "Write-Synchronized" property in the register description.
The following registers are synchronized when read:
• The Counter Value register (COUNT)
• The Clock Value register (CLOCK)
Required read-synchronization is denoted by the "Read-Synchronized" property in the register description.
Related Links
14.3 Register Synchronization
�GCLK_RTC
��������� =
2� + 3
fGCLK_RTC is the frequency of the internal prescaler clock, GCLK_RTC, and n is the position of the EVCTRL.PEREOn
bit. For example, PER0 will generate an event every eight CLK_RTC_OSC cycles, PER1 every 16 cycles, etc. This is
shown in the figure below. Periodic events are independent of the prescaler setting used by the RTC counter, except
if CTRL.PRESCALER is zero. Then, no periodic events will be generated.
Figure 19-4. Example Periodic Events
GCLK_RTC
PEREO0
PEREO1
PEREO2
PEREO3
PEREO4
...........continued
0x09 Reserved
0x0A STATUS 7:0 SYNCBUSY
0x0B DBGCTRL 7:0 DBGRUN
0x0C FREQCORR 7:0 SIGN VALUE[6:0]
0x0D
... Reserved
0x0F
0x10 7:0 COUNT[7:0]
0x11 15:8 COUNT[15:8]
COUNT
0x12 23:16 COUNT[23:16]
0x13 31:24 COUNT[31:24]
0x14
... Reserved
0x17
0x18 7:0 COMP[7:0]
0x19 15:8 COMP[15:8]
COMP0
0x1A 23:16 COMP[23:16]
0x1B 31:24 COMP[31:24]
Name: CTRL
Offset: 0x00
Reset: 0x0000
Property: Enable-Protected, Write-Protected, Write-Synchronized
Bit 15 14 13 12 11 10 9 8
PRESCALER[3:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
MATCHCLR MODE[1:0] ENABLE SWRST
Access R/W R/W R/W R/W W
Reset 0 0 0 0 0
Bit 1 – ENABLE Enable
Due to synchronization, there is delay from writing CTRL.ENABLE until the peripheral is enabled/disabled. The value
written to CTRL.ENABLE will read back immediately, and the Synchronization Busy bit in the Status register
(STATUS.SYNCBUSY) will be set. STATUS.SYNCBUSY will be cleared when the operation is complete.
This bit is not enable-protected.
Value Description
0 The peripheral is disabled or being disabled.
1 The peripheral is enabled or being enabled.
Name: CTRL
Offset: 0x00
Reset: 0x0000
Property: Enable-Protected, Write-Protected, Write-Synchronized
Bit 15 14 13 12 11 10 9 8
PRESCALER[3:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
MODE[1:0] ENABLE SWRST
Access R/W R/W R/W W
Reset 0 0 0 0
Bit 1 – ENABLE Enable
Due to synchronization, there is delay from writing CTRL.ENABLE until the peripheral is enabled/disabled. The value
written to CTRL.ENABLE will read back immediately, and the Synchronization Busy bit in the Status register
(STATUS.SYNCBUSY) will be set. STATUS.SYNCBUSY will be cleared when the operation is complete.
This bit is not enable-protected.
Value Description
0 The peripheral is disabled or being disabled.
1 The peripheral is enabled or being enabled.
Name: CTRL
Offset: 0x00
Reset: 0x0000
Property: Enable-Protected, Write-Protected, Write-Synchronized
Bit 15 14 13 12 11 10 9 8
PRESCALER[3:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
MATCHCLR CLKREP MODE[1:0] ENABLE SWRST
Access R/W R/W R/W R/W R/W W
Reset 0 0 0 0 0 0
Bit 1 – ENABLE Enable
Due to synchronization, there is delay from writing CTRL.ENABLE until the peripheral is enabled/disabled. The value
written to CTRL.ENABLE will read back immediately, and the Synchronization Busy bit in the Status register
(STATUS.SYNCBUSY) will be set. STATUS.SYNCBUSY will be cleared when the operation is complete.
This bit is not enable-protected.
Value Description
0 The peripheral is disabled or being disabled.
1 The peripheral is enabled or being enabled.
Name: READREQ
Offset: 0x02
Reset: 0x0010
Property: -
Bit 15 14 13 12 11 10 9 8
RREQ RCONT
Access W R/W
Reset 0 0
Bit 7 6 5 4 3 2 1 0
ADDR[5:0]
Access R R R R R R
Reset 0 1 0 0 0 0
Name: EVCTRL
Offset: 0x04
Reset: 0x0000
Property: Enable-Protected, Write-Protected
Bit 15 14 13 12 11 10 9 8
OVFEO CMPEO0
Access R/W R/W
Reset 0 0
Bit 7 6 5 4 3 2 1 0
PEREOx PEREOx PEREOx PEREOx PEREOx PEREOx PEREOx PEREOx
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: EVCTRL
Offset: 0x04
Reset: 0x0000
Property: Enable-Protected, Write-Protected
Bit 15 14 13 12 11 10 9 8
OVFEO CMPEOx CMPEOx
Access R/W R/W R/W
Reset 0 0 0
Bit 7 6 5 4 3 2 1 0
PEREOx PEREOx PEREOx PEREOx PEREOx PEREOx PEREOx PEREOx
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: EVCTRL
Offset: 0x04
Reset: 0x0000
Property: Enable-Protected, Write-Protected
Bit 15 14 13 12 11 10 9 8
OVFEO ALARMEO0
Access R/W R/W
Reset 0 0
Bit 7 6 5 4 3 2 1 0
PEREOx PEREOx PEREOx PEREOx PEREOx PEREOx PEREOx PEREOx
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: INTENCLR
Offset: 0x06
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
OVF SYNCRDY CMP0
Access R/W R/W R/W
Reset 0 0 0
Name: INTENCLR
Offset: 0x06
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
OVF SYNCRDY CMPx CMPx
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: INTENCLR
Offset: 0x06
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
OVF SYNCRDY ALARM0
Access R/W R/W R/W
Reset 0 0 0
Name: INTENSET
Offset: 0x07
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
OVF SYNCRDY CMP0
Access R/W R/W R/W
Reset 0 0 0
Name: INTENSET
Offset: 0x07
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
OVF SYNCRDY CMPx CMPx
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: INTENSET
Offset: 0x07
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
OVF SYNCRDY ALARM0
Access R/W R/W R/W
Reset 0 0 0
Name: INTFLAG
Offset: 0x08
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
OVF SYNCRDY CMP0
Access R/W R/W R/W
Reset 0 0 0
Bit 7 – OVF Overflow
This flag is cleared by writing a one to the flag.
This flag is set on the next CLK_RTC_CNT cycle after an overflow condition occurs, and an interrupt request will be
generated if INTENCLR/SET.OVF is one.
Writing a zero to this bit has no effect.
Writing a one to this bit clears the Overflow interrupt flag.
Bit 0 – CMP0 Compare 0
This flag is cleared by writing a one to the flag.
This flag is set on the next CLK_RTC_CNT cycle after a match with the compare condition, and an interrupt request
will be generated if INTENCLR/SET.CMP0 is one.
Writing a zero to this bit has no effect.
Writing a one to this bit clears the Compare 0 interrupt flag.
Name: INTFLAG
Offset: 0x08
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
OVF SYNCRDY CMPx CMPx
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 – OVF Overflow
This flag is cleared by writing a one to the flag.
This flag is set on the next CLK_RTC_CNT cycle after an overflow condition occurs, and an interrupt request will be
generated if INTENCLR/SET.OVF is one.
Writing a zero to this bit has no effect.
Writing a one to this bit clears the Overflow interrupt flag.
Name: INTFLAG
Offset: 0x08
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
OVF SYNCRDY ALARM0
Access R/W R/W R/W
Reset 0 0 0
Bit 7 – OVF Overflow
This flag is cleared by writing a one to the flag.
This flag is set on the next CLK_RTC_CNT cycle after an overflow condition occurs, and an interrupt request will be
generated if INTENCLR/SET.OVF is one.
Writing a zero to this bit has no effect.
Writing a one to this bit clears the Overflow interrupt flag.
Bit 0 – ALARM0 Alarm 0
This flag is cleared by writing a one to the flag.
This flag is set on the next CLK_RTC_CNT cycle after a match with ALARM0 condition occurs, and an interrupt
request will be generated if INTENCLR/SET.ALARM0 is also one.
Writing a zero to this bit has no effect.
Writing a one to this bit clears the Alarm 0 interrupt flag.
19.8.17 Status
Name: STATUS
Offset: 0x0A
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
SYNCBUSY
Access R
Reset 0
Name: DBGCTRL
Offset: 0x0B
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
DBGRUN
Access R/W
Reset 0
Name: FREQCORR
Offset: 0x0C
Reset: 0x00
Property: Write-Protected, Write-Synchronized
Bit 7 6 5 4 3 2 1 0
SIGN VALUE[6:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: COUNT
Offset: 0x10
Reset: 0x00000000
Property: Read-Synchronized, Write-Protected, Write-Synchronized
Bit 31 30 29 28 27 26 25 24
COUNT[31:24]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
COUNT[23:16]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
COUNT[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
COUNT[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: COUNT
Offset: 0x10
Reset: 0x0000
Property: Read-Synchronized, Write-Protected, Write-Synchronized
Bit 15 14 13 12 11 10 9 8
COUNT[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
COUNT[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: CLOCK
Offset: 0x10
Reset: 0x00000000
Property: Read-Synchronized, Write-Protected, Write-Synchronized
Bit 31 30 29 28 27 26 25 24
YEAR[5:0] MONTH[3:2]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
MONTH[1:0] DAY[4:0] HOUR[4]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
HOUR[3:0] MINUTE[5:2]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
MINUTE[1:0] SECOND[5:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: PER
Offset: 0x14
Reset: 0x0000
Property: Write-Protected, Write-Synchronized
Bit 15 14 13 12 11 10 9 8
PER[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
PER[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: COMP
Offset: 0x18
Reset: 0x00000000
Property: Write-Protected, Write-Synchronized
Bit 31 30 29 28 27 26 25 24
COMP[31:24]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
COMP[23:16]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
COMP[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
COMP[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: COMPn
Offset: 0x18+n*0x2 [n=0..1]
Reset: 0x0000
Property: Write-Protected, Write-Synchronized
Bit 15 14 13 12 11 10 9 8
COMP[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
COMP[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: ALARM0
Offset: 0x18
Reset: 0x00000000
Property: Write-Protected, Write-Synchronized
The 32-bit value of ALARM0 is continuously compared with the 32-bit CLOCK value, based on the masking set by
MASKn.SEL. When a match occurs, the Alarm 0 interrupt flag in the Interrupt Flag Status and Clear register
(INTFLAG.ALARMn) is set on the next counter cycle, and the counter is cleared if CTRL.MATCHCLR is one.
Bit 31 30 29 28 27 26 25 24
YEAR[5:0] MONTH[3:2]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
MONTH[1:0] DAY[4:0] HOUR[4]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
HOUR[3:0] MINUTE[5:2]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
MINUTE[1:0] SECOND[5:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: MASK
Offset: 0x1C
Reset: 0x00
Property: Write-Protected, Write-Synchronized
Bit 7 6 5 4 3 2 1 0
SEL[2:0]
Access R/W R/W R/W
Reset 0 0 0
20.1 Overview
The Direct Memory Access Controller (DMAC) contains both a Direct Memory Access (DMA) engine and a Cyclic
Redundancy Check (CRC) engine. The DMAC can transfer data between memories and peripherals and thus off-
load these tasks from the CPU. It enables high data transfer rates with minimum CPU intervention, and frees up CPU
time. With access to all peripherals, the DMAC can handle automatic transfer of data between communication
modules.
The DMA part of the DMAC has several DMA channels, which can receive different types of transfer triggers to
generate transfer requests from the DMA channels to the arbiter, as shown in the Block Diagram. The arbiter will
grant one DMA channel at a time to act as the active channel. When an active channel has been granted, the fetch
engine of the DMAC will fetch a transfer descriptor from the SRAM and store it in the internal memory of the active
channel, which will execute the data transmission.
An ongoing data transfer of an active channel can be interrupted by a higher prioritized DMA channel. The DMAC will
write back the updated transfer descriptor from the internal memory of the active channel to SRAM, and grant the
higher prioritized channel a start transfer as the new active channel. Once a DMA channel is done with its transfer,
interrupts and events can be generated optionally.
The DMAC has four bus interfaces:
• The data transfer bus is used for performing the actual DMA transfer.
• The AHB/APB Bridge bus is used when writing and reading the I/O registers of the DMAC.
• The descriptor fetch bus is used by the fetch engine to fetch transfer descriptors before data transfer can be
started or continued.
• The write-back bus is used to write the transfer descriptor back to SRAM.
All buses are AHB master interfaces but the AHB/APB Bridge bus, which is an APB slave interface.
The CRC engine can be used by software to detect an accidental error in the transferred data and to take corrective
action, such as requesting the data to be sent again or simply not using the incorrect data.
20.2 Features
• Data Transfer From:
– Peripheral-to-peripheral
– Peripheral-to-memory
– Memory-to-peripheral
– Memory-to-memory
• Transfer Trigger Sources:
– Software
– Events from Event System
– Dedicated requests from peripherals
• SRAM-based Transfer Descriptors:
– Single transfer using one descriptor
– Multi-buffer or Circular Buffer modes by linking multiple descriptors
• Up to 12 Channels:
– Enable 12 independent transfers
– Automatic descriptor fetch for each channel
– Suspend/resume operation support for each channel
• Flexible Arbitration Scheme:
– 4 configurable priority levels for each channel
HIGH SPEED
BUS MATRIX
S SRAM
S M
Descriptor Fetch
Write-back
Data Transfer
AHB/APB
Bridge
DMAC
MASTER
Fetch
DMA Channels Engine
Channel n
Interrupts
Channel 1
Transfer Active
Channel 0 Arbiter Interrupt /
Triggers n Channel
n Events Events
CRC
Engine
20.5.3 Clocks
The DMAC bus clock (CLK_DMAC_APB) must be configured and enabled in the Power Manager before using the
DMAC.
An AHB clock (CLK_DMAC_AHB) is required to clock the DMAC. This clock must be configured and enabled in the
power manager before using the DMAC, and the default state of CLK_DMAC_AHB can be found in Peripheral Clock
Masking.
This bus clock (CLK_DMAC_APB) is always synchronous to the module clock (CLK_DMAC_AHB), but can be
divided by a prescaler and may run even when the module clock is turned off.
Related Links
16.6.2.6 Peripheral Clock Masking
20.5.4 DMA
Not applicable.
20.5.5 Interrupts
The interrupt request line is connected to the interrupt controller. Using the DMAC interrupt requires the interrupt
controller to be configured first.
Related Links
11.2 Nested Vector Interrupt Controller
20.5.6 Events
Not applicable.
Related Links
24. EVSYS – Event System
20.6.1.1 DMA
The DMAC can transfer data between memories and peripherals without interaction from the CPU. The data
transferred by the DMAC are called transactions, and these transactions can be split into smaller data transfers. The
following figure shows the relationship between the different transfer sizes:
Figure 20-2. DMA Transfer Sizes
Link Enabled Link Enabled Link Enabled
DMA transaction
• Beat transfer: The size of one data transfer bus access, and the size is selected by writing the Beat Size bit
group in the Block Transfer Control register (BTCTRL.BEATSIZE)
• Burst transfer: Defined as n beat transfers, where n will differ from one device family to another. A burst transfer
is atomic, cannot be interrupted and the length of the burst is selected by writing the Burst Length bit group in
each Channel n Control A register (CHCTRLA.BURSTLEN).
• Block transfer: The amount of data one transfer descriptor can transfer, and the amount can range from 1 to 64k
beats. A block transfer can be interrupted, in contrast to the burst transfer.
• Transaction: The DMAC can link several transfer descriptors by having the first descriptor pointing to the second
and so forth, as shown in the figure above. A DMA transaction is the complete transfer of all blocks within a
linked list.
A transfer descriptor describes how a block transfer should be carried out by the DMAC, and it must remain in SRAM.
For further details on the transfer descriptor refer to 20.6.2.3 Transfer Descriptors.
The figure above shows several block transfers linked together, which are called linked descriptors. For further
information about linked descriptors, refer to 20.6.3.1 Linked Descriptors.
A DMA transfer is initiated by an incoming transfer trigger on one of the DMA channels. This trigger can be
configured to be either a software trigger, an event trigger, or one of the dedicated peripheral triggers. The transfer
trigger will result in a DMA transfer request from the specific channel to the arbiter. If there are several DMA channels
with pending transfer requests, the arbiter chooses which channel is granted access to become the active channel.
The DMA channel granted access as the active channel will carry out the transaction as configured in the transfer
descriptor. A current transaction can be interrupted by a higher prioritized channel after each burst transfer, but will
resume the block transfer when the according DMA channel is granted access as the active channel again.
For each beat transfer, an optional output event can be generated. For each block transfer, optional interrupts and an
optional output event can be generated. When a transaction is completed, dependent of the configuration, the DMA
channel will either be suspended or disabled.
20.6.1.2 CRC
The internal CRC engine supports two commonly used CRC polynomials: CRC-16 (CRC-CCITT) and CRC-32 (IEEE
802.3). It can be used on a selectable DMA channel, or on the I/O interface. Refer to 20.6.3.7 CRC Operation for
details.
20.6.2.1 Initialization
The following DMAC registers are enable-protected, meaning that they can only be written when the DMAC is
disabled (CTRL.DMAENABLE=0):
• Descriptor Base Memory Address register (BASEADDR)
• Write-Back Memory Base Address register (WRBADDR)
The following DMAC bit is enable-protected, meaning that it can only be written when both the DMAC and CRC are
disabled (CTRL.DMAENABLE=0 and CTRL.CRCENABLE=0):
• Software Reset bit in Control register (CTRL.SWRST)
The following DMA channel register is enable-protected, meaning that it can only be written when the corresponding
DMA channel is disabled (CHCTRLA.ENABLE=0):
• Channel Control B (CHCTRLB) register, except the Command bit (CHCTRLB.CMD) and the Channel Arbitration
Level bit (CHCTRLB.LVL)
The following DMA channel bit is enable-protected, meaning that it can only be written when the corresponding DMA
channel is disabled:
• Channel Software Reset bit in Channel Control A register (CHCTRLA.SWRST)
The following CRC registers are enable-protected, meaning that they can only be written when the CRC is disabled
(CTRL.CRCENABLE=0):
• CRC Control register (CRCCTRL)
• CRC Checksum register (CRCCHKSUM)
Enable-protection is denoted by the "Enable-Protected" property in the register description.
Before the DMAC is enabled it must be configured, as outlined by the following steps:
• The SRAM address of where the descriptor memory section is located must be written to the Description Base
Address (BASEADDR) register
• The SRAM address of where the write-back section should be located must be written to the Write-Back
Memory Base Address (WRBADDR) register
• Priority level x of the arbiter can be enabled by setting the Priority Level x Enable bit in the Control register
(CTRL.LVLENx=1)
Before a DMA channel is enabled, the DMA channel and the corresponding first transfer descriptor must be
configured, as outlined by the following steps:
• DMA channel configurations
– The channel number of the DMA channel to configure must be written to the Channel ID (CHID) register
– Trigger action must be selected by writing the Trigger Action bit group in the Channel Control B register
(CHCTRLB.TRIGACT)
– Trigger source must be selected by writing the Trigger Source bit group in the Channel Control B register
(CHCTRLB.TRIGSRC)
• Transfer Descriptor
– The size of each access of the data transfer bus must be selected by writing the Beat Size bit group in the
Block Transfer Control register (BTCTRL.BEATSIZE)
– The transfer descriptor must be made valid by writing a one to the Valid bit in the Block Transfer Control
register (BTCTRL.VALID)
– Number of beats in the block transfer must be selected by writing the Block Transfer Count (BTCNT)
register
– Source address for the block transfer must be selected by writing the Block Transfer Source Address
(SRCADDR) register
– Destination address for the block transfer must be selected by writing the Block Transfer Destination
Address (DSTADDR) register
If CRC calculation is needed, the CRC engine must be configured before it is enabled, as outlined by the following
steps:
• The CRC input source must selected by writing the CRC Input Source bit group in the CRC Control register
(CRCCTRL.CRCSRC)
• The type of CRC calculation must be selected by writing the CRC Polynomial Type bit group in the CRC Control
register (CRCCTRL.CRCPOLY)
• If I/O is selected as input source, the beat size must be selected by writing the CRC Beat Size bit group in the
CRC Control register (CRCCTRL.CRCBEATSIZE)
0x00000000
DSTADDR
DESCADDR Channel 0 – Last Descriptor
SRCADDR
BTCNT
BTCTRL
DESCADDR
DSTADDR
DESCADDR Channel 0 – Descriptor n-1
SRCADDR
BTCNT
BTCTRL
Descriptor Section
Channel n – First Descriptor
DESCADDR
Channel 2 – First Descriptor
Channel 1 – First Descriptor DSTADDR
BASEADDR Channel 0 – First Descriptor
SRCADDR
BTCNT
BTCTRL
Write-Back Section
Undefined
Channel n Ongoing Descriptor
Undefined
Channel 2 Ongoing Descriptor
Channel 1 Ongoing Descriptor
Undefined
WRBADDR Channel 0 Ongoing Descriptor
Undefined
Undefined
Device Memory Space
The size of the descriptor and write-back memory sections is dependent on the number of the most significant
enabled DMA channel m, as shown below:
���� = 128bits ⋅ � + 1
For memory optimization, it is recommended to always use the less significant DMA channels if not all channels are
required.
The descriptor and write-back memory sections can either be two separate memory sections, or they can share
memory section (BASEADDR=WRBADDR). The benefit of having them in two separate sections, is that the same
transaction for a channel can be repeated without having to modify the first transfer descriptor. The benefit of having
descriptor memory and write-back memory in the same section is that it requires less SRAM. In addition, the latency
from fetching the first descriptor of a transaction to the first burst transfer is executed, is reduced.
20.6.2.4 Arbitration
If a DMA channel is enabled and not suspended when it receives a transfer trigger, it will send a transfer request to
the arbiter. When the arbiter receives the transfer request it will include the DMA channel in the queue of channels
having pending transfers, and the corresponding Pending Channel x bit in the Pending Channels registers
(PENDCH.PENDCHx) will be set. Depending on the arbitration scheme, the arbiter will choose which DMA channel
will be the next active channel. The active channel is the DMA channel being granted access to perform its next burst
transfer. When the arbiter has granted a DMA channel access to the DMAC, the corresponding bit
PENDCH.PENDCHx will be cleared. See also the following figure.
If the upcoming burst transfer is the first for the transfer request, the corresponding Busy Channel x bit in the Busy
Channels register will be set (BUSYCH.BUSYCHx=1), and it will remain '1' for the subsequent granted burst
transfers.
When the channel has performed its granted burst transfer(s) it will be either fed into the queue of channels with
pending transfers, set to be waiting for a new transfer trigger, suspended, or disabled. This depends on the channel
and block transfer configuration. If the DMA channel is fed into the queue of channels with pending transfers, the
corresponding BUSYCH.BUSYCHx will remain '1'. If the DMA channel is set to wait for a new transfer trigger,
suspended, or disabled, the corresponding BUSYCH.BUSYCHx will be cleared.
If a DMA channel is suspended while it has a pending transfer, it will be removed from the queue of pending
channels, but the corresponding PENDCH.PENDCHx will remain set. When the same DMA channel is resumed, it
will be added to the queue of pending channels again.
If a DMA channel gets disabled (CHCTRLA.ENABLE=0) while it has a pending transfer, it will be removed from the
queue of pending channels, and the corresponding PENDCH.PENDCHx will be cleared.
Figure 20-4. Arbiter Overview
Arbiter
Channel Pending
Burst Done
Channel Pending Transfer Request Active
Channel Suspend
Channel Number Channel
Channel N
Channel Priority Level
Channel Burst Done
Active.LVLEXx
Level Enable
PRICTRLx.LVLPRI
CTRL.LVLENx
Priority Levels
When a channel level is pending or the channel is transferring data, the corresponding Level Executing bit is set in
the Active Channel and Levels register (ACTIVE.LVLEXx).
Each DMA channel supports a 4-level priority scheme. The priority level for a channel is configured by writing to the
Channel Arbitration Level bit group in the Channel Control B register (CHCTRLB.LVL). As long as all priority levels
are enabled, a channel with a higher priority level number will have priority over a channel with a lower priority level
number. Each priority level x is enabled by setting the corresponding Priority Level x Enable bit in the Control register
(CTRL.LVLENx=1).
Within each priority level the DMAC's arbiter can be configured to prioritize statically or dynamically:
Static Arbitration within a priority level is selected by writing a '0' to the Level x Round-Robin Scheduling Enable bit in
the Priority Control 0 register (PRICTRL0.RRLVLENx).
When static arbitration is selected, the arbiter will prioritize a low channel number over a high channel number as
shown in the figure below. When using the static arbitration there is a risk of high channel numbers never being
granted access as the active channel. This can be avoided using a dynamic arbitration scheme.
.
.
.
Channel x
Channel x+1
.
.
.
Channel 0 Channel 0
.
.
.
Channel x Lowest Priority Channel x
Channel x+1 Highest Priority Channel x+1 Lowest Priority
Channel x+2 Highest Priority
.
.
.
Channel N Channel N
memory section (WRBADDR). By using the data transfer bus, the DMAC will read the data from the current source
address and write it to the current destination address. For further details on how the current source and destination
addresses are calculated, refer to the section on Addressing.
The arbitration procedure is performed after each burst transfer. If the current DMA channel is granted access again,
the block transfer counter (BTCNT) of the internal transfer descriptor will be decremented by the number of beats in a
burst transfer, the optional output event Beat will be generated if configured and enabled, and the active channel will
perform a new burst transfer. If a different DMA channel than the current active channel is granted access, the block
transfer counter value will be written to the write-back section before the transfer descriptor of the newly granted DMA
channel is fetched into the internal memory of the active channel.
When a block transfer has come to its end (BTCNT is zero), the Valid bit in the Block Transfer Control register will be
cleared (BTCTRL.VALID=0) before the entire transfer descriptor is written to the write-back memory. The optional
interrupts, Channel Transfer Complete and Channel Suspend, and the optional output event Block, will be generated
if configured and enabled. After the last block transfer in a transaction, the Next Descriptor Address register
(DESCADDR) will hold the value 0x00000000, and the DMA channel will either be suspended or disabled, depending
on the configuration in the Block Action bit group in the Block Transfer Control register (BTCTRL.BLOCKACT). If the
transaction has further block transfers pending, DESCADDR will hold the SRAM address to the next transfer
descriptor to be fetched. The DMAC will fetch the next descriptor into the internal memory of the active channel and
write its content to the write-back section for the channel, before the arbiter gets to choose the next active channel.
CHENn
Trigger Lost
Trigger
PENDCHn
BUSYCHn
CHENn
Trigger Lost
Trigger
PENDCHn
BUSYCHn
CHENn
Trigger Lost
Trigger
PENDCHn
BUSYCHn
If the trigger source generates a transfer request for a channel during an ongoing transfer, the new transfer request
will be kept pending (CHSTATUS.PEND=1), and the new transfer can start after the ongoing one is done. Only one
pending transfer can be kept per channel. If the trigger source generates more transfer requests while one is already
pending, the additional ones will be lost. All channels pending status flags are also available in the Pending Channels
register (PENDCH).
When the transfer starts, the corresponding Channel Busy status flag is set in Channel Status register
(CHSTATUS.BUSY). When the trigger action is complete, the Channel Busy status flag is cleared. All channel busy
status flags are also available in the Busy Channels register (BUSYCH) in DMAC.
20.6.2.7 Addressing
Each block transfer needs to have both a source address and a destination address defined. The source address is
set by writing the Transfer Source Address (SRCADDR) register, the destination address is set by writing the
Transfer Destination Address (SRCADDR) register.
The addressing of this DMAC module can be static or incremental, for either source or destination of a block transfer,
or both.
Incrementation for the source address of a block transfer is enabled by writing the Source Address Incrementation
Enable bit in the Block Transfer Control register (BTCTRL.SRCINC=1). The step size of the incrementation is
configurable and can be chosen by writing the Step Selection bit in the Block Transfer Control register
(BTCTRL.STEPSEL=1) and writing the desired step size in the Address Increment Step Size bit group in the Block
Transfer Control register (BTCTRL.STEPSIZE). If BTCTRL.STEPSEL=0, the step size for the source incrementation
will be the size of one beat.
If BTCTRL.STEPSEL=0:
SRCADDR = SRCADDR����� + ����� ⋅ �������� + 1
• SRCADDRSTART is the source address of the first beat transfer in the block transfer
• BTCNT is the initial number of beats remaining in the block transfer
• BEATSIZE is the configured number of bytes in a beat
• STEPSIZE is the configured number of beats for each incrementation
The following figure shows an example where DMA channel 0 is configured to increment the source address by one
beat after each beat transfer (BTCTRL.SRCINC=1), and DMA channel 1 is configured to increment the source
address by two beats (BTCTRL.SRCINC=1, BTCTRL.STEPSEL=1, and BTCTRL.STEPSIZE=0x1). As the
destination address for both channels are peripherals, destination incrementation is disabled (BTCTRL.DSTINC=0).
Figure 20-8. Source Address Increment
Incrementation for the destination address of a block transfer is enabled by setting the Destination Address
Incrementation Enable bit in the Block Transfer Control register (BTCTRL.DSTINC=1). The step size of the
incrementation is configurable by clearing BTCTRL.STEPSEL=0 and writing BTCTRL.STEPSIZE to the desired step
size. If BTCTRL.STEPSEL=1, the step size for the destination incrementation will be the size of one beat.
When the destination address incrementation is configured (BTCTRL.DSTINC=1), DSTADDR must be set and
calculated as follows:
• DSTADDRSTART is the destination address of the first beat transfer in the block transfer
• BTCNT is the initial number of beats remaining in the block transfer
• BEATSIZE is the configured number of bytes in a beat
• STEPSIZE is the configured number of beats for each incrementation
The followiong figure shows an example where DMA channel 0 is configured to increment destination address by one
beat (BTCTRL.DSTINC=1) and DMA channel 1 is configured to increment destination address by two beats
(BTCTRL.DSTINC=1, BTCTRL.STEPSEL=0, and BTCTRL.STEPSIZE=0x1). As the source address for both
channels are peripherals, source incrementation is disabled (BTCTRL.SRCINC=0).
before the channel is suspended, the next suspend action is skipped and the channel continues the normal
operation.
Figure 20-10. Channel Suspend/Resume Operation
CHENn
Resume Command
Suspend skipped
Normal Transfer
The event input is used to trigger a beat or burst transfer on peripherals.
The event is acknowledged as soon as the event is received. When received, both the Channel Pending status bit in
the Channel Status register (CHSTATUS.PEND) and the corresponding Channel n bit in the Pending Channels
register (20.8.13 PENDCH.PENDCHn) are set. If the event is received while the channel is pending, the event
trigger is lost.
The figure below shows an example where beat transfers are enabled by internal events.
Peripheral Trigger
Trigger Lost
Event
PENDCHn
BUSYCHn
Event
Peripheral Trigger
PENDCHn
Block Transfer
Data Transfer
BEAT
Conditional Transfer
The event input is used to trigger a conditional transfer on peripherals with pending transfer requests. For example,
this type of event can be used for peripheral-to-peripheral transfers, where one peripheral is the source of event and
the second peripheral is the source of the trigger.
Each peripheral trigger is stored internally when the event is received. When the peripheral trigger is stored internally,
the Channel Pending status bit is set (CHSTATUS.PEND), the respective Pending Channel n Bit in the Pending
Channels register is set (20.8.13 PENDCH.PENDCHn), and the event is acknowledged. A software trigger will now
trigger a transfer.
The figure below shows an example where conditional event is enabled with peripheral beat trigger requests.
Event
Peripheral Trigger
PENDCHn
Block Transfer
Data Transfer
BEAT BEAT
Peripheral Trigger
PENDCHn
Channel Suspend
The event input is used to suspend an ongoing channel operation. The event is acknowledged when the current AHB
access is completed. For further details on Channel Suspend, refer to 20.6.3.2 Channel Suspend.
Channel Resume
The event input is used to resume a suspended channel operation. The event is acknowledged as soon as the event
is received and the Channel Suspend Interrupt Flag (CHINTFLAG.SUSP) is cleared. For further details refer to
20.6.3.2 Channel Suspend.
The output of channel events is enabled by writing a '1' to the Channel Event Output Enable bit in the Control B
register (CHCTRLB.EVOE). The event output cause is selected by writing to the Event Output Selection bits in the
Block Transfer Control register (BTCTRL.EVOSEL). It is possible to generate events after each block transfer
(BTCTRL.EVOSEL=0x1) or beat transfer (BTCTRL.EVOSEL=0x3). To enable an event being generated when a
transaction is complete, the block event selection must be set in the last transfer descriptor only.
Figure 20-15 shows an example where the event output generation is enabled in the first block transfer, and disabled
in the second block.
Figure 20-15. Event Output Generation
Beat Event Output
Event Output
Event Output
The CRC engine in DMAC supports two commonly used CRC polynomials: CRC-16 (CRC-CCITT) and CRC-32
(IEEE 802.3). Typically, applying CRC-n (CRC-16 or CRC-32) to a data block of arbitrary length will detect any single
alteration that is ≤n bits in length, and will detect the fraction 1-2-n of all longer error bursts.
• CRC-16:
– Polynomial: x16+ x12+ x5+ 1
– Hex value: 0x1021
• CRC-32:
– Polynomial: x32+x26+ x23+ x22+x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x + 1
– Hex value: 0x04C11DB7
The data source for the CRC engine can either be one of the DMA channels or the APB bus interface, and must be
selected by writing to the CRC Input Source bits in the CRC Control register (CRCCTRL.CRCSRC). The CRC engine
then takes data input from the selected source and generates a checksum based on these data. The checksum is
available in the CRC Checksum register (CRCCHKSUM). When CRC-32 polynomial is used, the final checksum read
is bit reversed and complemented, as shown in Figure 20-16.
The CRC polynomial is selected by writing to the CRC Polynomial Type bit in the CRC Control register
(CRCCTRL.CRCPOLY), the default is CRC-16. The CRC engine operates on byte only. When the DMA is used as
data source for the CRC engine, the DMA channel beat size setting will be used. When used with APB bus interface,
the application must select the CRC Beat Size bit field of CRC Control register (CRCCTRL.CRCBEATSIZE). 8-, 16-,
or 32-bit bus transfer access type is supported. The corresponding number of bytes will be written in the CRCDATAIN
register and the CRC engine will operate on the input data in a byte by byte manner.
Figure 20-16. CRC Generator Block Diagram
DMAC
Channels
CRCDATAIN
CRCCTRL
8 16 8 32
CRC-16 CRC-32
crc32
CHECKSUM
bit-reverse +
complement
Checksum
read
CRC on CRC-16 or CRC-32 calculations can be performed on data passing through any DMA channel. Once a
DMA DMA channel is selected as the source, the CRC engine will continuously generate the CRC on the data
data passing through the DMA channel. The checksum is available for readout once the DMA transaction is
completed or aborted. A CRC can also be generated on SRAM, Flash, or I/O memory by passing these
data through a DMA channel. If the latter is done, the destination register for the DMA data can be the
data input (CRCDATAIN) register in the CRC engine.
CRC using the I/O Before using the CRC engine with the I/O interface, the application must set the CRC Beat
interface Size bits in the CRC Control register (CRCCTRL.CRCBEATSIZE). 8/16/32-bit bus transfer
type can be selected.
CRC can be performed on any data by loading them into the CRC engine using the CPU and writing the data to the
CRCDATAIN register. Using this method, an arbitrary number of bytes can be written to the register by the CPU, and
CRC is done continuously for each byte. This means if a 32-bit data is written to the CRCDATAIN register the CRC
engine takes four cycles to calculate the CRC. The CRC complete is signaled by a set CRCBUSY bit in the
CRCSTATUS register. New data can be written only when CRCBUSY flag is not set.
20.6.5 Interrupts
The DMAC channels have the following interrupt sources:
• Transfer Complete (TCMPL): Indicates that a block transfer is completed on the corresponding channel. Refer to
20.6.2.5 Data Transmission for details.
• Transfer Error (TERR): Indicates that a bus error has occurred during a burst transfer, or that an invalid
descriptor has been fetched. Refer to 20.6.2.8 Error Handling for details.
• Channel Suspend (SUSP): Indicates that the corresponding channel has been suspended. Refer to 20.6.3.2
Channel Suspend and 20.6.2.5 Data Transmission for details.
Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Channel Interrupt Flag Status
and Clear (CHINTFLAG) register is set when the interrupt condition occurs. Each interrupt can be individually
enabled by setting the corresponding bit in the Channel Interrupt Enable Set register (CHINTENSET=1), and
disabled by setting the corresponding bit in the Channel Interrupt Enable Clear register (CHINTENCLR=1).
An interrupt request is generated when the interrupt flag is set and the corresponding interrupt is enabled. The
interrupt request remains active until the interrupt flag is cleared, the interrupt is disabled, the DMAC is reset or the
corresponding DMA channel is reset. See CHINTFLAG for details on how to clear interrupt flags. All interrupt
requests are ORed together on system level to generate one combined interrupt request to the NVIC.
The user must read the Channel Interrupt Status (INTSTATUS) register to identify the channels with pending
interrupts and must read the Channel Interrupt Flag Status and Clear (CHINTFLAG) register to determine which
interrupt condition is present for the corresponding channel. It is also possible to read the Interrupt Pending register
(INTPEND), which provides the lowest channel number with pending interrupt and the respective interrupt flags.
Note: Interrupts must be globally enabled for interrupt requests to be generated.
Related Links
11.2 Nested Vector Interrupt Controller
20.6.6 Events
The DMAC can generate the following output events:
• Channel (CH): Generated when a block transfer for a given channel has been completed, or when a beat
transfer within a block transfer for a given channel has been completed. Refer to Event Output Selection for
details.
Setting the Channel Event Output Enable bit (CHEVCTRLx.EVOE = 1) enables the corresponding output event
configured in the Event Output Selection bit group in the Block Transfer Control register (BTCTRL.EVOSEL).
Clearing CHEVCTRLx.EVOE = 0 disables the corresponding output event.
The DMAC can take the following actions on an input event:
• Transfer and Periodic Transfer Trigger (TRIG): normal transfer or periodic transfers on peripherals are enabled
• Conditional Transfer Trigger (CTRIG): conditional transfers on peripherals are enabled
• Conditional Block Transfer Trigger (CBLOCK): conditional block transfers on peripherals are enabled
• Channel Suspend Operation (SUSPEND): suspend a channel operation
• Channel Resume Operation (RESUME): resume a suspended channel operation
• Skip Next Block Suspend Action (SSKIP): skip the next block suspend transfer condition
• Increase Priority (INCPRI): increase channel priority
Setting the Channel Event Input Enable bit (CHEVCTRLx.EVIE = 1) enables the corresponding action on input event.
Clearing this bit disables the corresponding action on input event. Note that several actions can be enabled for
incoming events. If several events are connected to the peripheral, any enabled action will be taken for any of the
incoming events. For further details on event input actions, refer to Event Input Actions.
Note: Event input and outputs are not available for every channel. Refer to the Features section for more
information.
Related Links
24. EVSYS – Event System
20.6.8 Synchronization
Not applicable.
...........continued
0x3C
... Reserved
0x3E
0x3F CHID 7:0 ID[3:0]
0x40 CHCTRLA 7:0 ENABLE SWRST
0x41
... Reserved
0x43
7:0 LVL[1:0] EVOE EVIE EVACT[2:0]
15:8 TRIGSRC[5:0]
0x44 CHCTRLB
23:16 TRIGACT[1:0]
31:24 CMD[1:0]
0x48
... Reserved
0x4B
0x4C CHINTENCLR 7:0 SUSP TCMPL TERR
0x4D CHINTENSET 7:0 SUSP TCMPL TERR
0x4E CHINTFLAG 7:0 SUSP TCMPL TERR
0x4F CHSTATUS 7:0 FERR BUSY PEND
20.8.1 Control
Name: CTRL
Offset: 0x00
Reset: 0x00X0
Property: PAC Write-Protection, Enable-Protected
Bit 15 14 13 12 11 10 9 8
LVLENx3 LVLENx2 LVLENx1 LVLENx0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
CRCENABLE DMAENABLE SWRST
Access R/W R/W R/W
Reset 0 0 0
Name: CRCCTRL
Offset: 0x02
Reset: 0x0000
Property: PAC Write-Protection, Enable-Protected
Bit 15 14 13 12 11 10 9 8
CRCSRC[5:0]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
CRCPOLY[1:0] CRCBEATSIZE[1:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: CRCDATAIN
Offset: 0x04
Reset: 0x00000000
Property: PAC Write-Protection
Bit 31 30 29 28 27 26 25 24
CRCDATAIN[31:24]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
CRCDATAIN[23:16]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
CRCDATAIN[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
CRCDATAIN[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: CRCCHKSUM
Offset: 0x08
Reset: 0x00000000
Property: PAC Write-Protection, Enable-Protected
The CRCCHKSUM represents the 16- or 32-bit checksum value and the generated CRC. The register is reset to zero
by default, but it is possible to reset all bits to one by writing the CRCCHKSUM register directly. It is possible to write
this register only when the CRC module is disabled. If CRC-32 is selected and the CRC Status Busy flag is cleared
(i.e., CRC generation is completed or aborted), the bit reversed (bit 31 is swapped with bit 0, bit 30 with bit 1, etc.)
and complemented result will be read from CRCCHKSUM. If CRC-16 is selected or the CRC Status Busy flag is set
(i.e., CRC generation is ongoing), CRCCHKSUM will contain the actual content.
Bit 31 30 29 28 27 26 25 24
CRCCHKSUM[31:24]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
CRCCHKSUM[23:16]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
CRCCHKSUM[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
CRCCHKSUM[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: CRCSTATUS
Offset: 0x0C
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
CRCZERO CRCBUSY
Access R R/W
Reset 0 0
Name: DBGCTRL
Offset: 0x0D
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
DBGRUN
Access R/W
Reset 0
Name: QOSCTRL
Offset: 0x0E
Reset: 0x2A
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
DQOS[1:0] FQOS[1:0] WRBQOS[1:0]
Access R/W R/W R/W R/W R/W R/W
Reset 1 0 1 0 1 0
Related Links
11.4.3 SRAM Quality of Service
Name: SWTRIGCTRL
Offset: 0x10
Reset: 0x00000000
Property: PAC Write-Protection
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
SWTRIGn[11:8]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
SWTRIGn[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: PRICTRL0
Offset: 0x14
Reset: 0x00000000
Property: PAC Write-Protection
Bit 31 30 29 28 27 26 25 24
RRLVLEN3 LVLPRI3[3:0]
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
RRLVLEN2 LVLPRI2[3:0]
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
RRLVLEN1 LVLPRI1[3:0]
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
RRLVLEN0 LVLPRI0[3:0]
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Name: INTPEND
Offset: 0x20
Reset: 0x0000
Property: -
This register allows the user to identify the lowest DMA channel with pending interrupt.
Bit 15 14 13 12 11 10 9 8
PEND BUSY FERR SUSP TCMPL TERR
Access R R R R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
ID[3:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 15 – PEND Pending
This bit will read '1' when the channel selected by Channel ID field (ID) is pending.
Bit 14 – BUSY Busy
This bit will read '1' when the channel selected by Channel ID field (ID) is busy.
Name: INTSTATUS
Offset: 0x24
Reset: 0x00000000
Property: -
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
CHINTn[11:8]
Access R R R R
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
CHINTn[7:0]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Name: BUSYCH
Offset: 0x28
Reset: 0x00000000
Property: -
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
BUSYCHn[11:8]
Access R R R R
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
BUSYCHn[7:0]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Name: PENDCH
Offset: 0x2C
Reset: 0x00000000
Property: -
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
PENDCH11 PENDCH10 PENDCH9 PENDCH8
Access R R R R
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
PENDCH7 PENDCH6 PENDCH5 PENDCH4 PENDCH3 PENDCH2 PENDCH1 PENDCH0
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Name: ACTIVE
Offset: 0x30
Reset: 0x00000000
Property: -
Bit 31 30 29 28 27 26 25 24
BTCNT[15:8]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
BTCNT[7:0]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
ABUSY ID[4:0]
Access R R R R R R
Reset 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
LVLEXx LVLEXx LVLEXx LVLEXx
Access R R R R
Reset 0 0 0 0
Name: BASEADDR
Offset: 0x34
Reset: 0x00000000
Property: PAC Write-Protection, Enable-Protected
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
Access
Reset
Name: WRBADDR
Offset: 0x38
Reset: 0x00000000
Property: PAC Write-Protection, Enable-Protected
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
Access
Reset
20.8.17 Channel ID
Name: CHID
Offset: 0x3F
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
ID[3:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: CHCTRLA
Offset: 0x40
Reset: 0x00
Property: PAC Write-Protection, Enable-Protected
This register affects the DMA channel that is selected in the Channel ID register (CHID.ID).
Bit 7 6 5 4 3 2 1 0
ENABLE SWRST
Access R R R R R R/W R/W
Reset 0 0 0 0 0 0 0
Name: CHCTRLB
Offset: 0x44
Reset: 0x00000000
Property: PAC Write Protection, Enable-Protected
This register affects the DMA channel that is selected in the Channel ID register (CHID.ID).
Bit 31 30 29 28 27 26 25 24
CMD[1:0]
Access R/W R/W
Reset 0 0
Bit 23 22 21 20 19 18 17 16
TRIGACT[1:0]
Access R/W R/W
Reset 0 0
Bit 15 14 13 12 11 10 9 8
TRIGSRC[5:0]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
LVL[1:0] EVOE EVIE EVACT[2:0]
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
...........continued
TRIGACT[1:0] Name Description
0x2 LVL2 Channel Priority Level 2
0x3 LVL3 Channel Priority Level 3
Related Links
24.8.3 USER
24.8.2 CHANNEL
Name: CHINTENCLR
Offset: 0x4C
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Channel Interrupt Enable Set (CHINTENSET) register.
This register affects the DMA channel that is selected in the Channel ID register (CHID.ID).
Bit 7 6 5 4 3 2 1 0
SUSP TCMPL TERR
Access R/W R/W R/W
Reset 0 0 0
Name: CHINTENSET
Offset: 0x4D
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Channel Interrupt Enable Clear (CHINTENCLR) register.
This register affects the DMA channel that is selected in the Channel ID register (CHID.ID).
Bit 7 6 5 4 3 2 1 0
SUSP TCMPL TERR
Access R/W R/W R/W
Reset 0 0 0
Name: CHINTFLAG
Offset: 0x4E
Reset: 0x00
Property: -
This register affects the DMA channel that is selected in the Channel ID register (CHID.ID).
Bit 7 6 5 4 3 2 1 0
SUSP TCMPL TERR
Access R/W R/W R/W
Reset 0 0 0
Name: CHSTATUS
Offset: 0x4F
Reset: 0x00
Property: -
This register affects the DMA channel that is selected in the Channel ID register (CHID.ID).
Bit 7 6 5 4 3 2 1 0
FERR BUSY PEND
Access R R R
Reset 0 0 0
Name: BTCTRL
Offset: 0x00
Property: -
The BTCTRL register offset is relative to (BASEADDR or WRBADDR) + Channel Number * 0x10
Bit 15 14 13 12 11 10 9 8
STEPSIZE[2:0] STEPSEL DSTINC SRCINC BEATSIZE[1:0]
Access
Reset
Bit 7 6 5 4 3 2 1 0
BLOCKACT[1:0] EVOSEL[1:0] VALID
Access
Reset
Name: BTCNT
Offset: 0x02
Property: -
The BTCNT register offset is relative to (BASEADDR or WRBADDR) + Channel Number * 0x10
Bit 15 14 13 12 11 10 9 8
BTCNT[15:8]
Access
Reset
Bit 7 6 5 4 3 2 1 0
BTCNT[7:0]
Access
Reset
Name: SRCADDR
Offset: 0x04
Property: -
The SRCADDR register offset is relative to (BASEADDR or WRBADDR) + Channel Number * 0x10
Bit 31 30 29 28 27 26 25 24
SRCADDR[31:24]
Access
Reset
Bit 23 22 21 20 19 18 17 16
SRCADDR[23:16]
Access
Reset
Bit 15 14 13 12 11 10 9 8
SRCADDR[15:8]
Access
Reset
Bit 7 6 5 4 3 2 1 0
SRCADDR[7:0]
Access
Reset
Name: DSTADDR
Offset: 0x08
Property: -
The DSTADDR register offset is relative to (BASEADDR or WRBADDR) + Channel Number * 0x10
Bit 31 30 29 28 27 26 25 24
DSTADDR[31:24]
Access
Reset
Bit 23 22 21 20 19 18 17 16
DSTADDR[23:16]
Access
Reset
Bit 15 14 13 12 11 10 9 8
DSTADDR[15:8]
Access
Reset
Bit 7 6 5 4 3 2 1 0
DSTADDR[7:0]
Access
Reset
Name: DESCADDR
Offset: 0x0C
Property: -
The DESCADDR register offset is relative to (BASEADDR or WRBADDR) + Channel Number * 0x10
Bit 31 30 29 28 27 26 25 24
DESCADDR[31:24]
Access
Reset
Bit 23 22 21 20 19 18 17 16
DESCADDR[23:16]
Access
Reset
Bit 15 14 13 12 11 10 9 8
DESCADDR[15:8]
Access
Reset
Bit 7 6 5 4 3 2 1 0
DESCADDR[7:0]
Access
Reset
21.1 Overview
The External Interrupt Controller (EIC) allows external pins to be configured as interrupt lines. Each interrupt line can
be individually masked and can generate an interrupt on rising, falling, or both edges, or on high or low levels. Each
external pin has a configurable filter to remove spikes. Each external pin can also be configured to be asynchronous
in order to wake up the device from sleep modes where all clocks have been disabled. External pins can also
generate an event.
A separate non-maskable interrupt (NMI) is also supported. It has properties similar to the other external interrupts,
but is connected to the NMI request of the CPU, enabling it to interrupt any other interrupt mode.
21.2 Features
• Up to 16 external pins (EXTINTx), plus one non-maskable pin (NMI)
• Dedicated, individually maskable interrupt for each pin
• Interrupt on rising, falling, or both edges
• Interrupt on high or low levels
• Asynchronous interrupts for sleep modes without clock
• Filtering of external pins
• Event generation from EXTINTx
FILTENx SENSEx[2:0]
intreq_extint
Interrupt
EXTINTx
inwake_extint
Edge/Level
Filter Wake
Detection
evt_extint
Event
NMIFILTEN NMISENSE[2:0]
intreq_nmi
Interrupt
NMI
Edge/Level
Filter
Detection
inwake_nmi
Wake
Related Links
7. I/O Multiplexing and Considerations
21.5.3 Clocks
The EIC bus clock (CLK_EIC_APB) can be enabled and disabled in the Power Manager, and the default state of
CLK_EIC_APB can be found in the Peripheral Clock Masking section in PM – Power Manager.
A generic clock (GCLK_EIC) is required to clock the peripheral. This clock must be configured and enabled in the
Generic Clock Controller before using the peripheral. Refer to GCLK – Generic Clock Controller.
This generic clock is asynchronous to the user interface clock (CLK_EIC_APB). Due to this asynchronicity, writes to
certain registers will require synchronization between the clock domains. Refer to 21.6.9 Synchronization for further
details.
Related Links
16.6.2.6 Peripheral Clock Masking
15. GCLK - Generic Clock Controller
21.5.4 DMA
Not applicable.
21.5.5 Interrupts
There are several interrupt request lines, at least one for the external interrupts (EXTINT) and one for non-maskable
interrupt (NMI).
The EXTINT interrupt request line is connected to the interrupt controller. Using the EIC interrupt requires the
interrupt controller to be configured first.
The NMI interrupt request line is also connected to the interrupt controller, but does not require the interrupt to be
configured.
Related Links
11.2 Nested Vector Interrupt Controller
21.5.6 Events
The events are connected to the Event System. Using the events requires the Event System to be configured first.
Related Links
24. EVSYS – Event System
21.6.2.1 Initialization
The EIC must be initialized in the following order:
1. Enable CLK_EIC_APB
2. If edge detection or filtering is required, GCLK_EIC must be enabled
3. Write the EIC configuration registers (EVCTRL, WAKEUP, CONFIGy)
4. Enable the EIC
To use NMI, GCLK_EIC must be enabled after EIC configuration (NMICTRL).
Each external pin can be filtered by a majority vote filtering, clocked by GCLK_EIC. Filtering is enabled if bit Filter
Enable x in the Configuration n register (CONFIGn.FILTENx) is written to '1'. The majority vote filter samples the
external pin three times with GCLK_EIC and outputs the value when two or more samples are equal.
Table 21-1. Majority Vote Filter
When an external interrupt is configured for level detection, or if filtering is disabled, detection is made
asynchronously, and GCLK_EIC is not required.
If filtering or edge detection is enabled, the EIC automatically requests the GCLK_EIC to operate (GCLK_EIC must
be enabled in the GCLK module, see GCLK – Generic Clock Controller for details). If level detection is enabled,
GCLK_EIC is not required, but interrupt and events can still be generated.
When an external interrupt is configured for level detection and when filtering is disabled, detection is done
asynchronously. Asynchronuous detection does not require GCLK_EIC, but interrupt and events can still be
generated. If filtering or edge detection is enabled, the EIC automatically requests GCLK_EIC to operate. GCLK_EIC
must be enabled in the GCLK module.
Figure 21-2. Interrupt Detections
GCLK_EIC
CLK_EIC_APB
EXTINTx
intreq_extint[x]
(level detection / no filter)
intreq_extint[x] No interrupt
(level detection / filter)
intreq_extint[x]
(edge detection / no filter)
intreq_extint[x] No interrupt
(edge detection / filter)
clear INTFLAG.EXTINT[x]
Related Links
15. GCLK - Generic Clock Controller
21.6.6 Interrupts
The EIC has the following interrupt sources:
• External interrupt pins (EXTINTx). See 21.6.2 Basic Operation.
• Non-maskable interrupt pin (NMI). See 21.6.4 Additional Features.
Each interrupt source has an associated interrupt flag. The interrupt flag in the Interrupt Flag Status and Clear
register (INTFLAG) is set when an interrupt condition occurs (NMIFLAG for NMI). Each interrupt, except NMI, can be
individually enabled by setting the corresponding bit in the Interrupt Enable Set register (INTENSET=1), and disabled
by setting the corresponding bit in the Interrupt Enable Clear register (INTENCLR=1).
An interrupt request is generated when the interrupt flag is set and the corresponding interrupt is enabled. The
interrupt request remains active until the interrupt flag is cleared, the interrupt is disabled, or the EIC is reset. See the
INTFLAG register for details on how to clear interrupt flags. The EIC has one interrupt request line for each external
interrupt (EXTINTx) and one line for NMI. The user must read the INTFLAG (or NMIFLAG) register to determine
which interrupt condition is present.
Note:
1. Interrupts must be globally enabled for interrupt requests to be generated.
2. If an external interrupts (EXTINT) is common on two or more I/O pins, only one will be active (the first one
programmed).
Related Links
7.1 Multiplexed Signals
11. Processor And Architecture
21.6.7 Events
The EIC can generate the following output events:
• External event from pin (EXTINTx).
Setting an Event Output Control register (EVCTRL.EXTINTEO) enables the corresponding output event. Clearing this
bit disables the corresponding output event. Refer to Event System for details on configuring the Event System.
When the condition on pin EXTINTx matches the configuration in the CONFIGn register, the corresponding event is
generated, if enabled.
Related Links
24. EVSYS – Event System
CLK_EIC_APB
EXTINTx
intwake_extint[x]
intreq_extint[x]
21.6.9 Synchronization
Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be
synchronized when written or read.
When executing an operation that requires synchronization, the Synchronization Busy bit in the Status register
(STATUS.SYNCBUSY) will be set immediately, and cleared when synchronization is complete.
If an operation that requires synchronization is executed while STATUS.SYNCBUSY is one, the bus will be stalled. All
operations will complete successfully, but the CPU will be stalled, and interrupts will be pending as long as the bus is
stalled.
The following bits are synchronized when written:
• Software Reset bit in the Control register (CTRL.SWRST)
• Enable bit in the Control register (CTRL.ENABLE)
Related Links
14.3 Register Synchronization
21.8.1 Control
Name: CTRL
Offset: 0x00
Reset: 0x00
Property: Write-Protected, Write-Synchronized
Bit 7 6 5 4 3 2 1 0
ENABLE SWRST
Access R/W R/W
Reset 0 0
Bit 1 – ENABLE Enable
Due to synchronization, there is delay from writing CTRL.ENABLE until the peripheral is enabled/disabled. The value
written to CTRL.ENABLE will read back immediately, and the Synchronization Busy bit in the Status register
(STATUS.SYNCBUSY) will be set. STATUS.SYNCBUSY will be cleared when the operation is complete.
Value Description
0 The EIC is disabled.
1 The EIC is enabled.
21.8.2 Status
Name: STATUS
Offset: 0x01
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
SYNCBUSY
Access R
Reset 0
Name: NMICTRL
Offset: 0x02
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
NMIFILTEN NMISENSE[2:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: NMIFLAG
Offset: 0x03
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
NMI
Access R/W
Reset 0
Name: EVCTRL
Offset: 0x04
Reset: 0x00000000
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
EXTINTEO15 EXTINTEO14 EXTINTEO13 EXTINTEO12 EXTINTEO11 EXTINTEO10 EXTINTEO9 EXTINTEO8
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
EXTINTEO7 EXTINTEO6 EXTINTEO5 EXTINTEO4 EXTINTEO3 EXTINTEO2 EXTINTEO1 EXTINTEO0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 – EXTINTEOx External Interrupt x Event Output Enable
[x=15..0]
These bits indicate whether the event associated with the EXTINTx pin is enabled or not to generated for every
detection.
Value Description
0 Event from pin EXTINTx is disabled.
1 Event from pin EXTINTx is enabled.
Name: INTENCLR
Offset: 0x08
Reset: 0x00000000
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
EXTINT15 EXTINT14 EXTINT13 EXTINT12 EXTINT11 EXTINT10 EXTINT9 EXTINT8
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
EXTINT7 EXTINT6 EXTINT5 EXTINT4 EXTINT3 EXTINT2 EXTINT1 EXTINT0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 – EXTINTx External Interrupt x Enable [x=15..0]
Writing a zero to this bit has no effect.
Writing a one to this bit will clear the External Interrupt x Enable bit, which enables the external interrupt.
Value Description
0 The external interrupt x is disabled.
1 The external interrupt x is enabled.
Name: INTENSET
Offset: 0x0C
Reset: 0x00000000
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
EXTINT15 EXTINT14 EXTINT13 EXTINT12 EXTINT11 EXTINT10 EXTINT9 EXTINT8
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
EXTINT7 EXTINT6 EXTINT5 EXTINT4 EXTINT3 EXTINT2 EXTINT1 EXTINT0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 – EXTINTx External Interrupt x Enable [x=15..0]
Writing a zero to this bit has no effect.
Writing a one to this bit will set the External Interrupt x Enable bit, which enables the external interrupt.
Value Description
0 The external interrupt x is disabled.
1 The external interrupt x is enabled.
Name: INTFLAG
Offset: 0x10
Reset: 0x00000000
Property: -
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
EXTINT15 EXTINT14 EXTINT13 EXTINT12 EXTINT11 EXTINT10 EXTINT9 EXTINT8
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
EXTINT7 EXTINT6 EXTINT5 EXTINT4 EXTINT3 EXTINT2 EXTINT1 EXTINT0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 – EXTINTx External Interrupt x [x=15..0]
This flag is cleared by writing a one to it.
This flag is set when EXTINTx pin matches the external interrupt sense configuration and will generate an interrupt
request if INTENCLR/SET.EXTINT[x] is one.
Writing a zero to this bit has no effect.
Writing a one to this bit clears the External Interrupt x flag.
Name: WAKEUP
Offset: 0x14
Reset: 0x00000000
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
WAKEUPEN15 WAKEUPEN14 WAKEUPEN13 WAKEUPEN12 WAKEUPEN11 WAKEUPEN10 WAKEUPEN9 WAKEUPEN8
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
WAKEUPEN7 WAKEUPEN6 WAKEUPEN5 WAKEUPEN4 WAKEUPEN3 WAKEUPEN2 WAKEUPEN1 WAKEUPEN0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 – WAKEUPENx External Interrupt x Wake-up Enable [x=15..0]
This bit enables or disables wake-up from Sleep modes when the EXTINTx pin matches the external interrupt sense
configuration.
Value Description
0 Wake-up from the EXTINTx pin is disabled.
1 Wake-up from the EXTINTx pin is enabled.
21.8.10 Configuration n
Name: CONFIGn
Offset: 0x18 + n*0x04 [n=0..1]
Reset: 0x00000000
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
FILTEN7 SENSE7[2:0] FILTEN6 SENSE6[2:0]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
FILTEN5 SENSE5[2:0] FILTEN4 SENSE4[2:0]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
FILTEN3 SENSE3[2:0] FILTEN2 SENSE2[2:0]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
FILTEN1 SENSE1[2:0] FILTEN0 SENSE0[2:0]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bits 0:2, 4:6, 8:10, 12:14, 16:18, 20:22, 24:26, 28:30 – SENSEx Input Sense x Configuration [x=7..0]
Note:
1. FILTEN7-FILTEN0 bits and SENSE7[2:0]-SENSE0[2:0] bitfields in CONFIG0 register belong to External
Interrupt 7 to 0.
2. FILTEN7-FILTEN0 bits and SENSE7[2:0]-SENSE0[2:0] bitfields in CONFIG1 register belong to External
Interrupt 15 to 8.
22.1 Overview
Nonvolatile Memory (NVM) is a reprogrammable Flash memory that retains program and data storage even with
power off. It embeds a main array and a separate smaller array intended for Read While Write EEPROM emulation
(RWWEE) that can be programmed while reading the main array. The NVM Controller (NVMCTRL) connects to the
AHB and APB bus interfaces for system access to the NVM block. The AHB interface is used for reads and writes to
the NVM block, while the APB interface is used for commands and configuration.
22.2 Features
• 32-bit AHB interface for reads and writes
• Read-While-Write DATA Flash
• All NVM sections are memory mapped to the AHB, including calibration and system configuration
• 32-bit APB interface for commands and control
• Programmable wait states for read optimization
• 16 regions can be individually protected or unprotected
• Additional protection for bootloader
• Supports device protection through a security bit
• Interface to Power Manager for power-down of Flash blocks in sleep modes
• Can optionally wake up on exit from sleep or on first access
• Direct-mapped cache
Note: A register with property "Enable-Protected" may contain bits that are not enable-protected.
AHB
Cache
main array
NVM Interface
22.5.2 Clocks
Two synchronous clocks are used by the NVMCTRL. One is provided by the AHB bus (CLK_NVMCTRL_AHB) and
the other is provided by the APB bus (CLK_NVMCTRL_APB). For higher system frequencies, a programmable
number of wait states can be used to optimize performance. When changing the AHB bus frequency, the user must
ensure that the NVM Controller is configured with the proper number of wait states. Refer to the Electrical
Characteristics for the exact number of wait states to be used for a particular frequency range.
Related Links
37. Electrical Characteristics
22.5.3 Interrupts
The NVM Controller interrupt request line is connected to the interrupt controller. Using the NVMCTRL interrupt
requires the interrupt controller to be programmed first.
Related Links
11.6 Peripheral Access Controller (PAC)
22.6.1.1 Initialization
After power up, the NVM Controller goes through a power-up sequence. During this time, access to the NVM
Controller from the AHB bus is halted. Upon power-up completion, the NVM Controller is operational without any
need for user configuration.
The NVM block contains a calibration and auxiliary space plus a dedicated EEPROM emulation space that are
memory mapped. Refer to the NVM Organization figure below for details.
The calibration and auxiliary space contains factory calibration and system configuration information. These spaces
can be read from the AHB bus in the same way as the main NVM main address space.
In addition, a boot loader section can be allocated at the beginning of the main array, and an EEPROM section can
be allocated at the end of the NVM main address space.
Figure 22-3. NVM Memory Organization
Calibration and
Auxillary Space NVM Base Address + 0x00800000
RWWEE
Address Space NVM Base Address + 0x00400000
NVM Main
Address Space
The lower rows in the NVM main address space can be allocated as a boot loader section by using the BOOTPROT
fuses, and the upper rows can be allocated to EEPROM, as shown in the figure below.
The boot loader section is protected by the lock bit(s) corresponding to this address space and by the
BOOTPROT[2:0] fuse. The EEPROM rows can be written regardless of the region lock status.
The number of rows protected by BOOTPROT is given in Boot Loader Size, the number of rows allocated to the
EEPROM are given in EEPROM Size.
Figure 22-4. EEPROM and Boot Loader Allocation
Related Links
10.2 Physical Memory Map
To lock or unlock a region, the Lock Region and Unlock Region commands are provided. Writing one of these
commands will temporarily lock/unlock the region containing the address loaded in the ADDR register. ADDR can be
written by software, or the automatically loaded value from a write operation can be used. The new setting will stay in
effect until the next Reset, or until the setting is changed again using the Lock and Unlock commands. The current
status of the lock can be determined by reading the LOCK register.
To change the default lock/unlock setting for a region, the user configuration section of the auxiliary space must be
written using the Write Auxiliary Page command. Writing to the auxiliary space will take effect after the next Reset.
Therefore, a boot of the device is needed for changes in the lock/unlock setting to take effect. Refer to the Physical
Memory Map for calibration and auxiliary space address mapping.
Related Links
10.2 Physical Memory Map
The CTRLB register must be used to control the power reduction mode, read wait states, and the write mode.
1 Wait States
Read timings are similar to regular NVM read timings when access size is Byte or half-Word. The AHB data phase is
twice as long in case of full-Word-size access.
It is not possible to read the RWWEE area while the NVM main array is being written or erased, whereas the
RWWEE area can be written or erased while the main array is being read.
The RWWEE address space is not cached, therefore it is recommended to limit access to this area for performance
and power consumption considerations.
Related Links
10.2 Physical Memory Map
22.6.7 Cache
The NVM Controller cache reduces the device power consumption and improves system performance when wait
states are required. Only the NVM main array address space is cached. It is a direct-mapped cache that implements
8 lines of 64 bits (i.e., 64 Bytes). NVM Controller cache can be enabled by writing a '0' to the Cache Disable bit in the
Control B register (CTRLB.CACHEDIS).
The cache can be configured to three different modes using the Read Mode bit group in the Control B register
(CTRLB.READMODE).
The INVALL command can be issued using the Command bits in the Control A register to invalidate all cache lines
(CTRLA.CMD=INVALL). Commands affecting NVM content automatically invalidate cache lines.
7:0 CMD[6:0]
0x00 CTRLA
15:8 CMDEX[7:0]
0x02
... Reserved
0x03
7:0 MANW RWS[3:0]
15:8 SLEEPPRM[1:0]
0x04 CTRLB
23:16 CACHEDIS READMODE[1:0]
31:24
7:0 NVMP[7:0]
15:8 NVMP[15:8]
0x08 PARAM
23:16 RWWEEP[3:0] PSZ[2:0]
31:24 RWWEEP[11:4]
0x0C INTENCLR 7:0 ERROR READY
0x0D
... Reserved
0x0F
0x10 INTENSET 7:0 ERROR READY
0x11
... Reserved
0x13
0x14 INTFLAG 7:0 ERROR READY
0x15
... Reserved
0x17
7:0 NVME LOCKE PROGE LOAD PRM
0x18 STATUS
15:8 SB
0x1A
... Reserved
0x1B
7:0 ADDR[7:0]
15:8 ADDR[15:8]
0x1C ADDR
23:16 ADDR[21:16]
31:24
7:0 LOCK[7:0]
0x20 LOCK
15:8 LOCK[15:8]
22.8.1 Control A
Name: CTRLA
Offset: 0x00
Reset: 0x0000
Property: PAC Write-Protection
Bit 15 14 13 12 11 10 9 8
CMDEX[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
CMD[6:0]
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
...........continued
CMD[6:0] Group Description
Configuration
0x41 UR Unlock Region - Unlocks the region containing the address location in the ADDR
register.
0x42 SPRM Sets the Power Reduction mode.
0x43 CPRM Clears the Power Reduction mode.
0x44 PBC Page Buffer Clear - Clears the page buffer.
0x45 SSB Set Security Bit - Sets the Security bit by writing 0x00 to the first byte in the
lockbit row.
0x46 INVALL Invalidates all cache lines.
0x47 LDR Lock Data Region - Locks the data region containing the address location in the
ADDR register.
When the security extension is enabled, only secure access can lock secure
regions.
0x48 UDR Unlock Data Region - Unlocks the data region containing the address location in
the ADDR register.
When the security extension is enabled, only secure access can unlock secure
regions.
0x47-0x7F - Reserved
22.8.2 Control B
Name: CTRLB
Offset: 0x04
Reset: 0x00000080
Property: PAC Write-Protection
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
CACHEDIS READMODE[1:0]
Access R/W R/W R/W
Reset 0 0 0
Bit 15 14 13 12 11 10 9 8
SLEEPPRM[1:0]
Access R/W R/W
Reset 0 0
Bit 7 6 5 4 3 2 1 0
MANW RWS[3:0]
Access R/W R/W R/W R/W R/W
Reset 1 0 0 0 0
Name: PARAM
Offset: 0x08
Reset: 0x000XXXXX
Property: PAC Write-Protection
Bit 31 30 29 28 27 26 25 24
RWWEEP[11:4]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
RWWEEP[3:0] PSZ[2:0]
Access R R R R R R R
Reset 0 0 0 0 x x x
Bit 15 14 13 12 11 10 9 8
NVMP[15:8]
Access R R R R R R R R
Reset x x x x x x x x
Bit 7 6 5 4 3 2 1 0
NVMP[7:0]
Access R R R R R R R R
Reset x x x x x x x x
Name: INTENCLR
Offset: 0x0C
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Set register (INTENSET).
Bit 7 6 5 4 3 2 1 0
ERROR READY
Access R/W R/W
Reset 0 0
Name: INTENSET
Offset: 0x10
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Clear register (INTENCLR).
Bit 7 6 5 4 3 2 1 0
ERROR READY
Access R/W R/W
Reset 0 0
Name: INTFLAG
Offset: 0x14
Reset: 0x00
Property: –
Bit 7 6 5 4 3 2 1 0
ERROR READY
Access R/W R
Reset 0 0
Bit 1 – ERROR Error
This flag is set on the occurrence of an NVME, LOCKE or PROGE error.
This bit can be cleared by writing a '1' to its bit location.
Value Description
0 No errors have been received since the last clear.
1 At least one error has occurred since the last clear.
22.8.7 Status
Name: STATUS
Offset: 0x18
Reset: 0x0X00
Property: –
Bit 15 14 13 12 11 10 9 8
SB
Access R
Reset x
Bit 7 6 5 4 3 2 1 0
NVME LOCKE PROGE LOAD PRM
Access R/W R/W R/W R/W R
Reset 0 0 0 0 0
Value Description
1 NVM is in power reduction mode.
22.8.8 Address
Name: ADDR
Offset: 0x1C
Reset: 0x00000000
Property: PAC Write-Protection
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
ADDR[21:16]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
ADDR[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
ADDR[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: LOCK
Offset: 0x20
Reset: 0xXXXX
Property: –
Bit 15 14 13 12 11 10 9 8
LOCK[15:8]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
LOCK[7:0]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 x
23.1 Overview
The IO Pin Controller (PORT) controls the I/O pins of the device. The I/O pins are organized in a series of groups,
collectively referred to as a PORT group. Each PORT group can have up to 32 pins that can be configured and
controlled individually or as a group. The number of PORT groups on a device may depend on the package/number
of pins. Each pin may either be used for general-purpose I/O under direct application control or be assigned to an
embedded device peripheral. When used for general-purpose I/O, each pin can be configured as input or output, with
highly configurable driver and pull settings.
All I/O pins have true read-modify-write functionality when used for general-purpose I/O; the direction or the output
value of one or more pins may be changed (set, reset or toggled) explicitly without unintentionally changing the state
of any other pins in the same port group by a single, atomic 8-, 16- or 32-bit write.
The PORT is connected to the high-speed bus matrix through an AHB/APB bridge. The Pin Direction, Data Output
Value and Data Input Value registers may also be accessed using the low-latency CPU local bus (IOBUS; ARM®
single-cycle I/O port) .
23.2 Features
• Selectable input and output configuration for each individual pin
• Software-controlled multiplexing of peripheral functions on I/O pins
• Flexible pin configuration through a dedicated Pin Configuration register
• Configurable output driver and pull settings:
– Totem-pole (push-pull)
– Pull configuration
– Driver strength
• Configurable input buffer and pull settings:
– Internal pull-up or pull-down
– Input sampling criteria
– Input buffer can be disabled if not needed for lower power consumption
– Read-Modify-Write support for output value (OUTCLR/OUTSET/OUTGL) and pin direction (DIRCLR/
DIRSET/DIRTGL)
PORT
Control
and Port Line
Bundles
Status
Pad Line
Bundles
PORTMUX
IP Line Bundles I/O
PADS
Refer to the I/O Multiplexing and Considerations for details on the pin mapping for this peripheral. One signal can be
mapped on several pins.
Related Links
7. I/O Multiplexing and Considerations
23.5.3 Clocks
The PORT bus clock (CLK_PORT_APB) can be enabled and disabled in the Power Manager, and the default state of
CLK_PORT_APB can be found in the Peripheral Clock Masking section in PM – Power Manager.
The PORT requires an APB clock, which may be divided from the CPU main clock and allows the CPU to access the
registers of PORT through the high-speed matrix and the AHB/APB bridge.
The PORT also requires an AHB clock for CPU IOBUS accesses to the PORT. That AHB clock is the internal PORT
clock.
The priority of IOBUS accesses is higher than APB accesses. One clock cycle latency can be observed on the APB
access in case of concurrent PORT accesses.
Related Links
16.6.2.6 Peripheral Clock Masking
23.5.4 DMA
Not applicable.
23.5.5 Interrupts
Not applicable.
23.5.6 Events
Not applicable.
PORT PAD
PULLEN
PULLENx
DRIVE
DRIVEx
Pull
Resistor
OUT PG
OUTx PAD
VDD
APB Bus
OE NG
DIRx
INEN
INENx
INx IN
Q D Q D
R R
Synchronizer
Line Bundle
Periph Signal 0 0
Periph Signal 1 1
1
Peripheral Signals to
be muxed to Pad y
Periph Signal 15 15
The I/O pins of the device are controlled by PORT peripheral registers. Each port pin has a corresponding bit in the
Data Direction (DIR) and Data Output Value (OUT) registers to enable that pin as an output and to define the Output
state.
The direction of each pin in a PORT group is configured by the DIR register. If a bit in DIR is set to '1', the
corresponding pin is configured as an output pin. If a bit in DIR is set to '0', the corresponding pin is configured as an
input pin.
When the direction is set as output, the corresponding bit in the OUT register will set the level of the pin. If bit y in
OUT is written to '1', pin y is driven HIGH. If bit y in OUT is written to '0', pin y is driven LOW. Pin configuration can be
set by Pin Configuration (PINCFGy) registers, with y=00, 01, ..31 representing the pin number within the group.
The Data Input Value (IN) is set as the input value of a port pin with resynchronization to the PORT clock. To reduce
power consumption, these input synchronizers can be clocked only when system requires reading the input value, as
specified in the SAMPLING field of the Control register (CTRL). The value of the pin can always be read, whether the
pin is configured as input or output. If the Input Enable bit in the Pin Configuration registers (PINCFGy.INEN) is '0',
the input value will not be sampled.
In PORT, the Peripheral Multiplexer Enable bit in the PINCFGy register (PINCFGy.PMUXEN) can be written to '1' to
enable the connection between peripheral functions and individual I/O pins. The Peripheral Multiplexing n (PMUXn)
registers select the peripheral function for the corresponding pin. This will override the connection between the PORT
and that I/O pin, and connect the selected peripheral signal to the particular I/O pin instead of the PORT line bundle.
23.6.2.1 Initialization
After reset, all standard function device I/O pads are connected to the PORT with outputs tri-stated and input buffers
disabled, even if there is no clock running.
However, specific pins, such as those used for connection to a debugger, may be configured differently, as required
by their special function.
23.6.2.2 Operation
Each I/O pin Pxy can be controlled by the registers in PORT. Each PORT group x has its own set of PORT registers,
with a base address at byte address (PORT + 0x80 * group index) (A corresponds to group index 0, B to 1, etc...).
Within that set of registers, the pin index is y, from 0 to 31.
Refer to I/O Multiplexing and Considerations for details on available pin configuration and PORT groups.
The peripheral function can be selected by setting the PMUXO or PMUXE in the PMUXn register. The PMUXO/
PMUXE is at byte offset PMUX0 + (y/2). The chosen peripheral must also be configured and enabled.
Related Links
7. I/O Multiplexing and Considerations
DIR
OUT
IN
INEN
DIR
OUT
IN
INEN
Note: When pull is enabled, the pull value is defined by the OUT value.
DIR
OUT
IN
INEN
DIR
OUT
IN
INEN
DIR
OUT
IN
INEN
DIR
OUT
IN
INEN
7:0 DIR[7:0]
15:8 DIR[15:8]
0x00 DIR
23:16 DIR[23:16]
31:24 DIR[31:24]
7:0 DIRCLR[7:0]
15:8 DIRCLR[15:8]
0x04 DIRCLR
23:16 DIRCLR[23:16]
31:24 DIRCLR[31:24]
7:0 DIRSET[7:0]
15:8 DIRSET[15:8]
0x08 DIRSET
23:16 DIRSET[23:16]
31:24 DIRSET[31:24]
7:0 DIRTGL[7:0]
15:8 DIRTGL[15:8]
0x0C DIRTGL
23:16 DIRTGL[23:16]
31:24 DIRTGL[31:24]
7:0 OUT[7:0]
15:8 OUT[15:8]
0x10 OUT
23:16 OUT[23:16]
31:24 OUT[31:24]
7:0 OUTCLR[7:0]
15:8 OUTCLR[15:8]
0x14 OUTCLR
23:16 OUTCLR[23:16]
31:24 OUTCLR[31:24]
7:0 OUTSET[7:0]
15:8 OUTSET[15:8]
0x18 OUTSET
23:16 OUTSET[23:16]
31:24 OUTSET[31:24]
7:0 OUTTGL[7:0]
15:8 OUTTGL[15:8]
0x1C OUTTGL
23:16 OUTTGL[23:16]
31:24 OUTTGL[31:24]
7:0 IN[7:0]
15:8 IN[15:8]
0x20 IN
23:16 IN[23:16]
31:24 IN[31:24]
7:0 SAMPLING[7:0]
15:8 SAMPLING[15:8]
0x24 CTRL
23:16 SAMPLING[23:16]
31:24 SAMPLING[31:24]
7:0 PINMASK[7:0]
15:8 PINMASK[15:8]
0x28 WRCONFIG
23:16 DRVSTR PULLEN INEN PMUXEN
31:24 HWSEL WRPINCFG WRPMUX PMUX[3:0]
0x2C
... Reserved
0x2F
0x30 PMUX0 7:0 PMUXO[3:0] PMUXE[3:0]
...
0x3F PMUX15 7:0 PMUXO[3:0] PMUXE[3:0]
0x40 PINCFG0 7:0 DRVSTR PULLEN INEN PMUXEN
...
...........continued
Name: DIR
Offset: 0x00
Reset: 0x00000000
Property: PAC Write-Protection
This register allows the user to configure one or more I/O pins as an input or output. This register can be manipulated
without doing a read-modify-write operation by using the Data Direction Toggle (DIRTGL), Data Direction Clear
(DIRCLR) and Data Direction Set (DIRSET) registers.
Tip: The I/O pins are assembled in pin groups (”PORT groups”) with up to 32 pins. Group 0 consists of
the PA pins, group 1 is for the PB pins, etc. Each pin group has its own PORT registers, with a 0x80
address spacing. For example, the register address offset for the Data Direction (DIR) register for group 0
(PA00 to PA31) is 0x00, and the register address offset for the DIR register for group 1 (PB00 to PB31) is
0x80.
Bit 31 30 29 28 27 26 25 24
DIR[31:24]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
DIR[23:16]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
DIR[15:8]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
DIR[7:0]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Name: DIRCLR
Offset: 0x04
Reset: 0x00000000
Property: PAC Write-Protection
This register allows the user to set one or more I/O pins as an input, without doing a read-modify-write operation.
Changes in this register will also be reflected in the Data Direction (DIR), Data Direction Toggle (DIRTGL) and Data
Direction Set (DIRSET) registers.
Tip: The I/O pins are assembled in pin groups (”PORT groups”) with up to 32 pins. Group 0 consists of
the PA pins, group 1 is for the PB pins, etc. Each pin group has its own PORT registers, with a 0x80
address spacing. For example, the register address offset for the Data Direction (DIR) register for group 0
(PA00 to PA31) is 0x00, and the register address offset for the DIR register for group 1 (PB00 to PB31) is
0x80.
Bit 31 30 29 28 27 26 25 24
DIRCLR[31:24]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
DIRCLR[23:16]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
DIRCLR[15:8]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
DIRCLR[7:0]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Name: DIRSET
Offset: 0x08
Reset: 0x00000000
Property: PAC Write-Protection
This register allows the user to set one or more I/O pins as an output, without doing a read-modify-write operation.
Changes in this register will also be reflected in the Data Direction (DIR), Data Direction Toggle (DIRTGL) and Data
Direction Clear (DIRCLR) registers.
Tip: The I/O pins are assembled in pin groups (”PORT groups”) with up to 32 pins. Group 0 consists of
the PA pins, group 1 is for the PB pins, etc. Each pin group has its own PORT registers, with a 0x80
address spacing. For example, the register address offset for the Data Direction (DIR) register for group 0
(PA00 to PA31) is 0x00, and the register address offset for the DIR register for group 1 (PB00 to PB31) is
0x80.
Bit 31 30 29 28 27 26 25 24
DIRSET[31:24]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
DIRSET[23:16]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
DIRSET[15:8]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
DIRSET[7:0]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Name: DIRTGL
Offset: 0x0C
Reset: 0x00000000
Property: PAC Write-Protection
This register allows the user to toggle the direction of one or more I/O pins, without doing a read-modify-write
operation. Changes in this register will also be reflected in the Data Direction (DIR), Data Direction Set (DIRSET) and
Data Direction Clear (DIRCLR) registers.
Tip: The I/O pins are assembled in pin groups (”PORT groups”) with up to 32 pins. Group 0 consists of
the PA pins, group 1 is for the PB pins, etc. Each pin group has its own PORT registers, with a 0x80
address spacing. For example, the register address offset for the Data Direction (DIR) register for group 0
(PA00 to PA31) is 0x00, and the register address offset for the DIR register for group 1 (PB00 to PB31) is
0x80.
Bit 31 30 29 28 27 26 25 24
DIRTGL[31:24]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
DIRTGL[23:16]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
DIRTGL[15:8]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
DIRTGL[7:0]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Name: OUT
Offset: 0x10
Reset: 0x00000000
Property: PAC Write-Protection
This register sets the data output drive value for the individual I/O pins in the PORT.
This register can be manipulated without doing a read-modify-write operation by using the Data Output Value Clear
(OUTCLR), Data Output Value Set (OUTSET), and Data Output Value Toggle (OUTTGL) registers.
Tip: The I/O pins are assembled in pin groups (”PORT groups”) with up to 32 pins. Group 0 consists of
the PA pins, group 1 is for the PB pins, etc. Each pin group has its own PORT registers, with a 0x80
address spacing. For example, the register address offset for the Data Direction (DIR) register for group 0
(PA00 to PA31) is 0x00, and the register address offset for the DIR register for group 1 (PB00 to PB31) is
0x80.
Bit 31 30 29 28 27 26 25 24
OUT[31:24]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
OUT[23:16]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
OUT[15:8]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
OUT[7:0]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Name: OUTCLR
Offset: 0x14
Reset: 0x00000000
Property: PAC Write-Protection
This register allows the user to set one or more output I/O pin drive levels low, without doing a read-modify-write
operation. Changes in this register will also be reflected in the Data Output Value (OUT), Data Output Value Toggle
(OUTTGL) and Data Output Value Set (OUTSET) registers.
Tip: The I/O pins are assembled in pin groups (”PORT groups”) with up to 32 pins. Group 0 consists of
the PA pins, group 1 is for the PB pins, etc. Each pin group has its own PORT registers, with a 0x80
address spacing. For example, the register address offset for the Data Direction (DIR) register for group 0
(PA00 to PA31) is 0x00, and the register address offset for the DIR register for group 1 (PB00 to PB31) is
0x80.
Bit 31 30 29 28 27 26 25 24
OUTCLR[31:24]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
OUTCLR[23:16]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
OUTCLR[15:8]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
OUTCLR[7:0]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Name: OUTSET
Offset: 0x18
Reset: 0x00000000
Property: PAC Write-Protection
This register allows the user to set one or more output I/O pin drive levels high, without doing a read-modify-write
operation. Changes in this register will also be reflected in the Data Output Value (OUT), Data Output Value Toggle
(OUTTGL) and Data Output Value Clear (OUTCLR) registers.
Tip: The I/O pins are assembled in pin groups (”PORT groups”) with up to 32 pins. Group 0 consists of
the PA pins, group 1 is for the PB pins, etc. Each pin group has its own PORT registers, with a 0x80
address spacing. For example, the register address offset for the Data Direction (DIR) register for group 0
(PA00 to PA31) is 0x00, and the register address offset for the DIR register for group 1 (PB00 to PB31) is
0x80.
Bit 31 30 29 28 27 26 25 24
OUTSET[31:24]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
OUTSET[23:16]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
OUTSET[15:8]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
OUTSET[7:0]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Name: OUTTGL
Offset: 0x1C
Reset: 0x00000000
Property: PAC Write-Protection
This register allows the user to toggle the drive level of one or more output I/O pins, without doing a read-modify-write
operation. Changes in this register will also be reflected in the Data Output Value (OUT), Data Output Value Set
(OUTSET) and Data Output Value Clear (OUTCLR) registers.
Tip: The I/O pins are assembled in pin groups (”PORT groups”) with up to 32 pins. Group 0 consists of
the PA pins, group 1 is for the PB pins, etc. Each pin group has its own PORT registers, with a 0x80
address spacing. For example, the register address offset for the Data Direction (DIR) register for group 0
(PA00 to PA31) is 0x00, and the register address offset for the DIR register for group 1 (PB00 to PB31) is
0x80.
Bit 31 30 29 28 27 26 25 24
OUTTGL[31:24]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
OUTTGL[23:16]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
OUTTGL[15:8]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
OUTTGL[7:0]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Name: IN
Offset: 0x20
Reset: 0x00000000
Property: -
Tip: The I/O pins are assembled in pin groups (”PORT groups”) with up to 32 pins. Group 0 consists of
the PA pins, group 1 is for the PB pins, etc. Each pin group has its own PORT registers, with a 0x80
address spacing. For example, the register address offset for the Data Direction (DIR) register for group 0
(PA00 to PA31) is 0x00, and the register address offset for the DIR register for group 1 (PB00 to PB31) is
0x80.
Bit 31 30 29 28 27 26 25 24
IN[31:24]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
IN[23:16]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
IN[15:8]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
IN[7:0]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
23.8.10 Control
Name: CTRL
Offset: 0x24
Reset: 0x00000000
Property: PAC Write-Protection
Tip: The I/O pins are assembled in pin groups (”PORT groups”) with up to 32 pins. Group 0 consists of
the PA pins, group 1 is for the PB pins, etc. Each pin group has its own PORT registers, with a 0x80
address spacing. For example, the register address offset for the Data Direction (DIR) register for group 0
(PA00 to PA31) is 0x00, and the register address offset for the DIR register for group 1 (PB00 to PB31) is
0x80.
Bit 31 30 29 28 27 26 25 24
SAMPLING[31:24]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
SAMPLING[23:16]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
SAMPLING[15:8]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
SAMPLING[7:0]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Name: WRCONFIG
Offset: 0x28
Reset: 0x00000000
Property: PAC Write-Protection, Write-Only
Tip: The I/O pins are assembled in pin groups (”PORT groups”) with up to 32 pins. Group 0 consists of
the PA pins, group 1 is for the PB pins, etc. Each pin group has its own PORT registers, with a 0x80
address spacing. For example, the register address offset for the Data Direction (DIR) register for group 0
(PA00 to PA31) is 0x00, and the register address offset for the DIR register for group 1 (PB00 to PB31) is
0x80.
This Write-only register is used to configure several pins simultaneously with the same configuration and peripheral
multiplexing.
To avoid side effect of non-atomic access, 8-bit or 16-bit writes to this register will have no effect. Reading this
register always returns zero.
Bit 31 30 29 28 27 26 25 24
HWSEL WRPINCFG WRPMUX PMUX[3:0]
Access W W W W W W W
Reset 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
DRVSTR PULLEN INEN PMUXEN
Access W W W W
Reset 0 0 0 0
Bit 15 14 13 12 11 10 9 8
PINMASK[15:8]
Access W W W W W W W W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
PINMASK[7:0]
Access W W W W W W W W
Reset 0 0 0 0 0 0 0 0
Name: PMUX
Offset: 0x30 + n*0x01 [n=0..15]
Reset: 0x00
Property: PAC Write-Protection
Tip: The I/O pins are assembled in pin groups (”PORT groups”) with up to 32 pins. Group 0 consists of
the PA pins, group 1 is for the PB pins, etc. Each pin group has its own PORT registers, with a 0x80
address spacing. For example, the register address offset for the Data Direction (DIR) register for group 0
(PA00 to PA31) is 0x00, and the register address offset for the DIR register for group 1 (PB00 to PB31) is
0x80.
There are up to 16 Peripheral Multiplexing registers in each group, one for every set of two subsequent I/O lines. The
n denotes the number of the set of I/O lines.
Bit 7 6 5 4 3 2 1 0
PMUXO[3:0] PMUXE[3:0]
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
...........continued
PMUXE[3:0] Name Description
0x9-0xF - Reserved
Related Links
7. I/O Multiplexing and Considerations
Name: PINCFG
Offset: 0x40 + n*0x01 [n=0..31]
Reset: 0x00
Property: PAC Write-Protection
Tip: The I/O pins are assembled in pin groups (”PORT groups”) with up to 32 pins. Group 0 consists of
the PA pins, group 1 is for the PB pins, etc. Each pin group has its own PORT registers, with a 0x80
address spacing. For example, the register address offset for the Data Direction (DIR) register for group 0
(PA00 to PA31) is 0x00, and the register address offset for the DIR register for group 1 (PB00 to PB31) is
0x80.
There are up to 32 Pin Configuration registers in each PORT group, one for each I/O line.
Bit 7 6 5 4 3 2 1 0
DRVSTR PULLEN INEN PMUXEN
Access RW RW RW RW
Reset 0 0 0 0
24.1 Overview
The Event System (EVSYS) allows autonomous, low-latency and configurable communication between peripherals.
Several peripherals can be configured to generate and/or respond to signals known as events. The exact condition to
generate an event, or the action taken upon receiving an event, is specific to each peripheral. Peripherals that
respond to events are called event users. Peripherals that generate events are called event generators. A peripheral
can have one or more event generators and can have one or more event users.
Communication is made without CPU intervention and without consuming system resources such as bus or RAM
bandwidth. This reduces the load on the CPU and other system resources, compared to a traditional interrupt-based
system.
24.2 Features
• 12 configurable event channels, where each channel can:
– Be connected to any event generator.
– Provide a pure asynchronous, resynchronized or synchronous path
• 74 event generators.
• 29 event users.
• Configurable edge detector.
• Peripherals can be event generators, event users, or both.
• SleepWalking and interrupt for operation in sleep modes.
• Software event generation.
• Each event user can choose which channel to respond to.
EVSYS
EVENT USER
PERIPHERALS CHANNELS MUX PERIPHERALS
GENERATOR
USERS EVENTS
EVENTS
CLOCK REQUESTS
GCLK
24.5.3 Clocks
The EVSYS bus clock (CLK_EVSYS_APB) can be enabled and disabled in the Main Clock module, and the default
state of CLK_EVSYS_APB can be found in Peripheral Clock Masking.
Each EVSYS channel has a dedicated generic clock (GCLK_EVSYS_CHANNEL_n). These are used for event
detection and propagation for each channel. These clocks must be configured and enabled in the generic clock
controller before using the EVSYS. Refer to GCLK - Generic Clock Controller for details.
Related Links
16.6.2.6 Peripheral Clock Masking
15. GCLK - Generic Clock Controller
24.5.4 DMA
Not applicable.
24.5.5 Interrupts
The interrupt request line is connected to the Interrupt Controller. Using the EVSYS interrupts requires the interrupt
controller to be configured first. Refer to Nested Vector Interrupt Controller for details.
Related Links
11.2 Nested Vector Interrupt Controller
24.5.6 Events
Not applicable.
24.6.2.1 Initialization
Before enabling events routing within the system, the User Multiplexer (USER) and Channel (CHANNEL) register
must be configured. The User Multiplexer (USER) must be configured first.
Configure the User Multiplexer (USER) register:
1. The channel to be connected to a user is written to the Channel bit group (USER.CHANNEL)
2. The user to connect the channel is written to the User bit group (USER.USER)
Configure the Channel (CHANNEL) register:
1. The channel to be configured is written to the Channel Selection bit group (CHANNEL.CHANNEL)
2. The path to be used is written to the Path Selection bit group (CHANNEL.PATH)
3. The type of edge detection to use on the channel is written to the Edge Selection bit group
(CHANNEL.EDGSEL)
4. The event generator to be used is written to the Event Generator bit group (CHANNEL.EVGEN)
CHANNEL_EVT_1
CHANNEL_EVT_m
USER
MUX
USER.CHANNEL
PERIPHERAL A PERIPHERAL B
Figure 24-3. Channel
The path is selected by writing to the Path Selection bit group in the Channel register (CHANNEL.PATH).
If the Generic Clocks Request bit in the Control register is zero (CTRL.GCLKREQ=0), the channel operates in
SleepWalking mode and requests the configured generic clock only when an event is to be propagated through the
channel. If CTRL.GCLKREQ=1 , the generic clock will always be on for the configured channel.
Related Links
15. GCLK - Generic Clock Controller
24.6.3 Interrupts
The EVSYS has the following interrupt sources:
• Overrun Channel n (OVRn): for details, refer to The Overrun Channel n Interrupt section.
• Event Detected Channel n (EVDn): for details, refer to The Event Detected Channel n Interrupt section.
These interrupts events are asynchronous wake-up sources. See Sleep Mode Controller.
Each interrupt source has an interrupt flag which is in the Interrupt Flag Status and Clear (INTFLAG) register. The
flag is set when the interrupt is issued. Each interrupt event can be individually enabled by setting a ‘1’ to the
corresponding bit in the Interrupt Enable Set (INTENSET) register, and disabled by setting a ‘1’ to the corresponding
bit in the Interrupt Enable Clear (INTENCLR) register. An interrupt event is generated when the interrupt flag is set
and the corresponding interrupt is enabled. The interrupt event works until the interrupt flag is cleared, the interrupt is
disabled, or the Event System is reset. See INTFLAG for details on how to clear interrupt flags.
All interrupt events from the peripheral are ORed together on system level to generate one combined interrupt
request to the NVIC. Refer to the Nested Vector Interrupt Controller for details. The event user must read the
INTFLAG register to determine what the interrupt condition is.
Note that interrupts must be globally enabled for interrupt requests to be generated. Refer to Nested Vector Interrupt
Controller for details.
Related Links
11.2 Nested Vector Interrupt Controller
16.6.1.3 Sleep Mode Controller
...........continued
0x0B Reserved
0x0C 7:0 USRRDY7 USRRDY6 USRRDY5 USRRDY4 USRRDY3 USRRDY2 USRRDY1 USRRDY0
0x0D 15:8 CHBUSY7 CHBUSY6 CHBUSY5 CHBUSY4 CHBUSY3 CHBUSY2 CHBUSY1 CHBUSY0
CHSTATUS
0x0E 23:16 USRRDY11 USRRDY10 USRRDY9 USRRDY8
0x0F 31:24 CHBUSY11 CHBUSY10 CHBUSY9 CHBUSY8
0x10 7:0 OVR7 OVR6 OVR5 OVR4 OVR3 OVR2 OVR1 OVR0
0x11 15:8 EVD7 EVD6 EVD5 EVD4 EVD3 EVD2 EVD1 EVD0
INTENCLR
0x12 23:16 OVR11 OVR10 OVR9 OVR8
0x13 31:24 EVD11 EVD10 EVD9 EVD8
0x14 7:0 OVR7 OVR6 OVR5 OVR4 OVR3 OVR2 OVR1 OVR0
0x15 15:8 EVD7 EVD6 EVD5 EVD4 EVD3 EVD2 EVD1 EVD0
INTENSET
0x16 23:16 OVR11 OVR10 OVR9 OVR8
0x17 31:24 EVD11 EVD10 EVD9 EVD8
0x18 7:0 OVR7 OVR6 OVR5 OVR4 OVR3 OVR2 OVR1 OVR0
0x19 15:8 EVD7 EVD6 EVD5 EVD4 EVD3 EVD2 EVD1 EVD0
INTFLAG
0x1A 23:16 OVR11 OVR10 OVR9 OVR8
0x1B 31:24 EVD11 EVD10 EVD9 EVD8
24.8.1 Control
Name: CTRL
Offset: 0x00
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
GCLKREQ SWRST
Access R/W W
Reset 0 0
24.8.2 Channel
Name: CHANNEL
Offset: 0x04
Reset: 0x00000000
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
EDGSEL[1:0] PATH[1:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 23 22 21 20 19 18 17 16
EVGEN[6:0]
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
SWEVT
Access R/W
Reset 0
Bit 7 6 5 4 3 2 1 0
CHANNEL[3:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
...........continued
Value Event Generator Description
0x02 RTC CMP1 Compare 1
0x03 RTC OVF Overflow
0x04 RTC PER0 Period 0
0x05 RTC PER1 Period 1
0x06 RTC PER2 Period 2
0x07 RTC PER3 Period 3
0x08 RTC PER4 Period 4
0x09 RTC PER5 Period 5
0x0A RTC PER6 Period 6
0x0B RTC PER7 Period 7
0x0C EIC EXTINT0 External Interrupt 0
0x0D EIC EXTINT1 External Interrupt 1
0x0E EIC EXTINT2 External Interrupt 2
0x0F EIC EXTINT3 External Interrupt 3
0x10 EIC EXTINT4 External Interrupt 4
0x11 EIC EXTINT5 External Interrupt 5
0x12 EIC EXTINT6 External Interrupt 6
0x13 EIC EXTINT7 External Interrupt 7
0x14 EIC EXTINT8 External Interrupt 8
0x15 EIC EXTINT9 External Interrupt 9
0x16 EIC EXTINT10 External Interrupt 10
0x17 EIC EXTINT11 External Interrupt 11
0x18 EIC EXTINT12 External Interrupt 12
0x19 EIC EXTINT13 External Interrupt 13
0x1A EIC EXTINT14 External Interrupt 14
0x1B EIC EXTINT15 External Interrupt 15
0x1C Reserved
0x1D Reserved
0x1E DMAC CH0 Channel 0
0x1F DMAC CH1 Channel 1
0x20 DMAC CH2 Channel 2
0x21 DMAC CH3 Channel 3
0x22 TCC0 OVF Overflow
0x23 TCC0 TRG Trig
0x24 TCC0 CNT Counter
0x25 TCC0_MCX0 Match/Capture 0
0x26 TCC0_MCX1 Match/Capture 1
0x27 TCC0_MCX2 Match/Capture 2
0x28 TCC0_MCX3 Match/Capture 3
0x29 TCC1 OVF Overflow
0x2A TCC1 TRG Trig
0x2B TCC1 CNT Counter
0x2C TCC1_MCX0 Match/Capture 0
0x2D TCC1_MCX1 Match/Capture 1
0x2E TCC2 OVF Overflow
0x2F TCC2 TRG Trig
0x30 TCC2 CNT Counter
0x31 TCC2_MCX0 Match/Capture 0
0x32 TCC2_MCX1 Match/Capture 1
0x33 TC3 OVF Overflow/Underflow
0x34 TC3 MC0 Match/Capture 0
0x35 TC3 MC1 Match/Capture 1
0x36 TC4 OVF Overflow/Underflow
...........continued
Value Event Generator Description
0x37 TC4 MC0 Match/Capture 0
0x38 TC4 MC1 Match/Capture 1
0x39 TC5 OVF Overflow/Underflow
0x3A TC5 MC0 Match/Capture 0
0x3B TC5 MC1 Match/Capture 1
0x3C TC6 OVF Overflow/Underflow
0x3D TC6 MC0 Match/Capture 0
0x3E TC6 MC1 Match/Capture 1
0x3F TC7 OVF Overflow/Underflow
0x40 TC7 MC0 Match/Capture 0
0x41 TC7 MC1 Match/Capture 1
0x42 ADC RESRDY Result Ready
0x43 ADC WINMON Window Monitor
0x44 AC COMP0 Comparator 0
0x45 AC COMP1 Comparator 1
0x46 AC WIN0 Window 0
0x47 DAC EMPTY Data Buffer Empty
0x48 PTC EOC End of Conversion
0x49 PTC WCOMP Window Comparator
0x4A AC COMP2 Comparator 2
0x4B AC COMP3 Comparator 3
0x4C AC WIN1 Window 1
0x4D TCC3 OVF Overflow
0x4E TCC3 TRG Trigger
0x4F TCC3 CNT Counter
0x50 TCC3_MCX0 Match/Capture 0
0x51 TCC3_MCX1 Match/Capture 1
0x52 TCC3_MCX2 Match/Capture 2
0x53 TCC3_MCX3 Match/Capture 3
0x54-0x7F Reserved Reserved
Name: USER
Offset: 0x08
Reset: 0x0000
Property: Write-Protected
Bit 15 14 13 12 11 10 9 8
CHANNEL[4:0]
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
USER[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
...........continued
USER[7:0] User Multiplexer Description Path Type
0x18 ADC SYNC Flush ADC Asynchronous path only
0x19 AC COMP0 Start comparator 0 Asynchronous path only
0x1A AC COMP1 Start comparator 1 Asynchronous path only
0x1B DAC START DAC start conversion Asynchronous path only
0x1C PTC STCONV PTC start conversion Asynchronous path only
0x1D AC COMP2 Start Comparator 2 Asynchronous path only
0x1E AC COMP3 Start Comparator 3 Asynchronous path only
0x1F TCC3 EV0 Match/Capture 1 Asynchronous, synchronous and resynchronized paths
0x20 TCC3 EV1 Match/Capture 2 Asynchronous, synchronous and resynchronized paths
0x21 TCC3 MC0 Match/Capture 0 Asynchronous, synchronous and resynchronized paths
0x22 TCC3 MC1 Match/Capture 1 Asynchronous, synchronous and resynchronized paths
0x23 TCC3 MC2 Match/Capture 2 Asynchronous, synchronous and resynchronized paths
0x24 TCC3 MC3 Match/Capture 3 Asynchronous, synchronous and resynchronized paths
0x25- 0x3F Reserved Reserved
Name: CHSTATUS
Offset: 0x0C
Reset: 0x000F00FF
Property: -
Bit 31 30 29 28 27 26 25 24
CHBUSY11 CHBUSY10 CHBUSY9 CHBUSY8
Access R R R R
Reset 0 0 0 0
Bit 23 22 21 20 19 18 17 16
USRRDY11 USRRDY10 USRRDY9 USRRDY8
Access R R R R
Reset 0 0 0 0
Bit 15 14 13 12 11 10 9 8
CHBUSY7 CHBUSY6 CHBUSY5 CHBUSY4 CHBUSY3 CHBUSY2 CHBUSY1 CHBUSY0
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
USRRDY7 USRRDY6 USRRDY5 USRRDY4 USRRDY3 USRRDY2 USRRDY1 USRRDY0
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Name: INTENCLR
Offset: 0x10
Reset: 0x00000000
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
EVD11 EVD10 EVD9 EVD8
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 23 22 21 20 19 18 17 16
OVR11 OVR10 OVR9 OVR8
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 15 14 13 12 11 10 9 8
EVD7 EVD6 EVD5 EVD4 EVD3 EVD2 EVD1 EVD0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
OVR7 OVR6 OVR5 OVR4 OVR3 OVR2 OVR1 OVR0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bits 24, 25, 26, 27 – EVDn Channel n Event Detection Interrupt Enable [n=11..8]
Writing a zero to this bit has no effect.
Writing a one to this bit will clear the Event Detected Channel n Interrupt Enable bit, which disables the Event
Detected Channel n interrupt.
Value Description
0 The Event Detected Channel n interrupt is disabled.
1 The Event Detected Channel n interrupt is enabled.
Bits 16, 17, 18, 19 – OVRn Channel n Overrun Interrupt Enable [n=11..8]
Writing a zero to this bit has no effect.
Writing a one to this bit will clear the Overrun Channel n Interrupt Enable bit, which disables the Overrun Channel n
interrupt.
Value Description
0 The Overrun Channel n interrupt is disabled.
1 The Overrun Channel n interrupt is enabled.
Bits 8, 9, 10, 11, 12, 13, 14, 15 – EVDn Channel n Event Detection Interrupt Enable [n=7..0]
Writing a zero to this bit has no effect.
Writing a one to this bit will clear the Event Detected Channel n Interrupt Enable bit, which disables the Event
Detected Channel n interrupt.
Value Description
0 The Event Detected Channel n interrupt is disabled.
1 The Event Detected Channel n interrupt is enabled.
Value Description
0 The Overrun Channel n interrupt is disabled.
1 The Overrun Channel n interrupt is enabled.
Name: INTENSET
Offset: 0x14
Reset: 0x00000000
Property: Write-Protected
Bit 31 30 29 28 27 26 25 24
EVD11 EVD10 EVD9 EVD8
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 23 22 21 20 19 18 17 16
OVR11 OVR10 OVR9 OVR8
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 15 14 13 12 11 10 9 8
EVD7 EVD6 EVD5 EVD4 EVD3 EVD2 EVD1 EVD0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
OVR7 OVR6 OVR5 OVR4 OVR3 OVR2 OVR1 OVR0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bits 24, 25, 26, 27 – EVDn Channel n Event Detection Interrupt Enable [n=11..8]
Writing a zero to this bit has no effect.
Writing a one to this bit will set the Event Detected Channel n Interrupt Enable bit, which enables the Event Detected
Channel n interrupt.
Value Description
0 The Event Detected Channel n interrupt is disabled.
1 The Event Detected Channel n interrupt is enabled.
Bits 8, 9, 10, 11, 12, 13, 14, 15 – EVDn Channel n Event Detection Interrupt Enable [n=7..0]
Writing a zero to this bit has no effect.
Writing a one to this bit will set the Event Detected Channel n Interrupt Enable bit, which enables the Event Detected
Channel n interrupt.
Value Description
0 The Event Detected Channel n interrupt is disabled.
1 The Event Detected Channel n interrupt is enabled.
Value Description
0 The Overrun Channel n interrupt is disabled.
1 The Overrun Channel n interrupt is enabled.
Name: INTFLAG
Offset: 0x18
Reset: 0x00000000
Property: -
Bit 31 30 29 28 27 26 25 24
EVD11 EVD10 EVD9 EVD8
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 23 22 21 20 19 18 17 16
OVR11 OVR10 OVR9 OVR8
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 15 14 13 12 11 10 9 8
EVD7 EVD6 EVD5 EVD4 EVD3 EVD2 EVD1 EVD0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
OVR7 OVR6 OVR5 OVR4 OVR3 OVR2 OVR1 OVR0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bits 8, 9, 10, 11, 12, 13, 14, 15 – EVDn Channel n Event Detection [n=7..0]
This flag is set on the next CLK_EVSYS_APB cycle when an event is being propagated through the channel, and an
interrupt request will be generated if INTENCLR/SET.EVDn is one.
When the event channel path is asynchronous, the EVDn Interrupt flag will not be set.
Writing a zero to this bit has no effect.
Writing a one to this bit will clear the Event Detected Channel n interrupt flag.
25.1 Overview
There are up to six instances of the serial communication interface (SERCOM) peripheral.
A SERCOM can be configured to support a number of modes: I2C, SPI, and USART. When an instance of SERCOM
is configured and enabled, all of the resources of that SERCOM instance will be dedicated to the selected mode.
The SERCOM serial engine consists of a transmitter and receiver, baud-rate generator and address matching
functionality. It can use the internal generic clock or an external clock. Using an external clock allows the SERCOM to
be operated in all Sleep modes.
Related Links
26. SERCOM USART
27. SERCOM SPI – SERCOM Serial Peripheral Interface
28. SERCOM I2C – Inter-Integrated Circuit
25.2 Features
• Interface for Configuring into one of the Following:
– Inter-Integrated Circuit (I2C) two-wire serial interface
– System Management Bus (SMBus™) compatible
– Serial Peripheral Interface (SPI)
– Universal Synchronous/Asynchronous Receiver/Transmitter (USART)
• Single Transmit Buffer and Double Receive Buffer
• Baud-rate Generator
• Address Match/mask Logic
• Operational in all Sleep modes with an External Clock Source
• Can be used with DMA
• Up to 16-bytes Internal FIFO
See the Related Links for full feature lists of the interface configurations.
Related Links
26. SERCOM USART
27. SERCOM SPI – SERCOM Serial Peripheral Interface
28. SERCOM I2C – Inter-Integrated Circuit
SERCOM
Register Interface
Mode n
Baud Rate
Mode 1 Transmitter Generator
PAD[3:0]
Mode 0
Receiver Address
Match
25.5.3 Clocks
The SERCOM bus clock (CLK_SERCOMx_APB) can be enabled and disabled in the Power Manager. Refer to
Peripheral Clock Masking for details and default status of this clock.
The SERCOM uses two generic clocks: GCLK_SERCOMx_CORE and GCLK_SERCOMx_SLOW. The core clock
(GCLK_SERCOMx_CORE) is required to clock the SERCOM while working as a master. The slow clock
(GCLK_SERCOMx_SLOW) is only required for certain functions. See specific mode chapters for details.
These clocks must be configured and enabled in the Generic Clock Controller (GCLK) before using the SERCOM.
The generic clocks are asynchronous to the user interface clock (CLK_SERCOMx_APB). Due to this asynchronicity,
writing to certain registers will require synchronization between the clock domains. Refer to 25.6.8 Synchronization
for details.
Related Links
15. GCLK - Generic Clock Controller
16.6.2.6 Peripheral Clock Masking
25.5.4 DMA
The DMA request lines are connected to the DMA Controller (DMAC). The DMAC must be configured before the
SERCOM DMA requests are used.
Related Links
20. DMAC – Direct Memory Access Controller
25.5.5 Interrupts
The interrupt request line is connected to the Interrupt Controller (NVIC). The NVIC must be configured before the
SERCOM interrupts are used.
Related Links
11.2 Nested Vector Interrupt Controller
25.5.6 Events
Not applicable.
TX Shift Register
Receiver
RX Shift Register
Equal
Status RX Buffer
CTRLA.MODE Description
0x0 USART with external clock
0x1 USART with internal clock
0x2 SPI in slave operation
0x3 SPI in master operation
0x4 I2C slave operation
0x5 I2C master operation
0x6-0x7 Reserved
For further initialization information, see the respective SERCOM mode chapters:
Related Links
26. SERCOM USART
27. SERCOM SPI – SERCOM Serial Peripheral Interface
28. SERCOM I2C – Inter-Integrated Circuit
CTRLA.MODE[0] /1 /2 /16
0 Tx Clk
1 CTRLA.MODE
1 Rx Clk
Clock
0
Recovery
Table 25-2 contains equations for the baud rate (in bits per second) and the BAUD register value for each operating
mode.
For asynchronous operation, there is one mode: arithmetic mode, the BAUD register value is 16 bits (0 to 65,535).
For synchronous operation, the BAUD register value is 8 bits (0 to 255).
Table 25-2. Baud Rate Equations
Operating Mode Condition Baud Rate (Bits Per Second) BAUD Register Value Calculation
Asynchronous ���� ���� ���� �����
����� ≤ ����� = 1− ���� = 65536 ⋅ 1 − � ⋅
Arithmetic 16 16 65536 ����
...........continued
Operating Mode Condition Baud Rate (Bits Per Second) BAUD Register Value Calculation
Synchronous ���� ���� ����
����� ≤ ����� = ���� = −1
2 2 ⋅ ���� + 1 2 ⋅ �����
BAUD Register Value Serial Engine CPF fBAUD at 48MHz Serial Engine Frequency (fREF)
0 – 406 160 3MHz
407 – 808 161 2.981MHz
809 – 1205 162 2.963MHz
... ... ...
65206 31775 15.11kHz
65207 31871 15.06kHz
65208 31969 15.01kHz
ADDR
Match
ADDRMASK ==
rx shift register
ADDR
==
==
ADDRMASK
25.6.5 Interrupts
Interrupt sources are mode-specific. See the respective SERCOM mode chapters for details.
Each interrupt source has its own interrupt flag.
The interrupt flag in the Interrupt Flag Status and Clear register (INTFLAG) will be set when the interrupt condition is
met.
Each interrupt can be individually enabled by writing '1' to the corresponding bit in the Interrupt Enable Set register
(INTENSET), and disabled by writing '1' to the corresponding bit in the Interrupt Enable Clear register (INTENCLR).
An interrupt request is generated when the interrupt flag is set and the corresponding interrupt is enabled. The
interrupt request remains active until either the interrupt flag is cleared, the interrupt is disabled, or the SERCOM is
reset. For details on clearing interrupt flags, refer to the INTFLAG register description.
The value of INTFLAG indicates which interrupt condition occurred. The user must read the INTFLAG register to
determine which interrupt condition is present.
Note: Interrupts must be globally enabled for interrupt requests.
Related Links
11.2 Nested Vector Interrupt Controller
25.6.6 Events
Not applicable.
25.6.8 Synchronization
Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be
synchronized when written or read.
Required write-synchronization is denoted by the "Write-Synchronized" property in the register description.
Required read-synchronization is denoted by the "Read-Synchronized" property in the register description.
Related Links
14.3 Register Synchronization
26.1 Overview
The Universal Synchronous and Asynchronous Receiver and Transmitter (USART) is one of the available modes in
the Serial Communication Interface (SERCOM).
The USART uses the SERCOM transmitter and receiver, see 26.3 Block Diagram. Labels in uppercase letters are
synchronous to CLK_SERCOMx_APB and accessible for CPU. Labels in lowercase letters can be programmed to
run on the internal generic clock or an external clock.
The transmitter consists of a single write buffer, a shift register, and control logic for different frame formats. The write
buffer support data transmission without any delay between frames. The receiver consists of a two-level receive
buffer and a shift register. Status information of the received data is available for error checking. Data and clock
recovery units ensure robust synchronization and noise filtering during asynchronous data reception.
Related Links
25. SERCOM – Serial Communication Interface
CTRLA.MODE /1 - /2 - /16
XCK
CTRLA.MODE RX Shift Register RxD
Status RX Buffer
STATUS RX DATA
The combined configuration of PORT and the Transmit Data Pinout and Receive Data Pinout bit fields in the Control
A register (CTRLA.TXPO and CTRLA.RXPO, respectively) will define the physical position of the USART signals in
Table 26-2.
Related Links
23. PORT - I/O Pin Controller
26.5.3 Clocks
The SERCOM bus clock (CLK_SERCOMx_APB) can be enabled and disabled in the Power Manager. Refer to
Peripheral Clock Masking for details and default status of this clock.
A generic clock (GCLK_SERCOMx_CORE) is required to clock the SERCOMx_CORE. This clock must be
configured and enabled in the Generic Clock Controller before using the SERCOMx_CORE. Refer to GCLK - Generic
Clock Controller for details.
This generic clock is asynchronous to the bus clock (CLK_SERCOMx_APB). Therefore, writing to certain registers
will require synchronization to the clock domains. Refer to Synchronization for further details.
Related Links
26.6.6 Synchronization
15. GCLK - Generic Clock Controller
16.6.2.6 Peripheral Clock Masking
26.5.4 DMA
The DMA request lines are connected to the DMA Controller (DMAC). In order to use DMA requests with this
peripheral the DMAC must be configured first. Refer to DMAC – Direct Memory Access Controller for details.
Related Links
20. DMAC – Direct Memory Access Controller
26.5.5 Interrupts
The interrupt request line is connected to the Interrupt Controller. In order to use interrupt requests of this peripheral,
the Interrupt Controller (NVIC) must be configured first. Refer to Nested Vector Interrupt Controller for details.
Related Links
11.2 Nested Vector Interrupt Controller
26.5.6 Events
Not applicable.
Frame
IDLE No frame is transferred on the communication line. Signal is always high in this state.
26.6.2.1 Initialization
The following registers are enable-protected, meaning they can only be written when the USART is disabled
(CTRL.ENABLE=0):
• Control A register (CTRLA), except the Enable (ENABLE) and Software Reset (SWRST) bits.
• Control B register (CTRLB), except the Receiver Enable (RXEN) and Transmitter Enable (TXEN) bits.
• Baud register (BAUD)
When the USART is enabled or is being enabled (CTRLA.ENABLE=1), any writing attempt to these registers will be
discarded. If the peripheral is being disabled, writing to these registers will be executed after disabling is completed.
Enable-protection is denoted by the "Enable-Protection" property in the register description.
Before the USART is enabled, it must be configured by these steps:
1. Select either external (0x0) or internal clock (0x1) by writing the Operating Mode value in the CTRLA register
(CTRLA.MODE).
2. Select either asynchronous (0) or or synchronous (1) communication mode by writing the Communication
Mode bit in the CTRLA register (CTRLA.CMODE).
3. Select pin for receive data by writing the Receive Data Pinout value in the CTRLA register (CTRLA.RXPO).
4. Select pads for the transmitter and external clock by writing the Transmit Data Pinout bit in the CTRLA register
(CTRLA.TXPO).
5. Configure the Character Size field in the CTRLB register (CTRLB.CHSIZE) for character size.
6. Set the Data Order bit in the CTRLA register (CTRLA.DORD) to determine MSB- or LSB-first data
transmission.
7. To use parity mode:
7.1. Enable parity mode by writing 0x1 to the Frame Format field in the CTRLA register (CTRLA.FORM).
7.2. Configure the Parity Mode bit in the CTRLB register (CTRLB.PMODE) for even or odd parity.
8. Configure the number of stop bits in the Stop Bit Mode bit in the CTRLB register (CTRLB.SBMODE).
9. When using an internal clock, write the Baud register (BAUD) to generate the desired baud rate.
10. Enable the transmitter and receiver by writing '1' to the Receiver Enable and Transmitter Enable bits in the
CTRLB register (CTRLB.RXEN and CTRLB.TXEN).
0 Tx Clk
1
1 CTRLA.CMODE
XCK 0
1 Rx Clk
0
Related Links
25.6.2.3 Clock Generation – Baud-Rate Generator
25.6.2.3.1 Asynchronous Arithmetic Mode BAUD Value Selection
XCK
CTRLA.CPOL=1
RxD / TxD
Change Sample
XCK
CTRLA.CPOL=0
RxD / TxD
Sample
When the clock is provided through XCK (CTRLA.MODE=0x0), the shift registers operate directly on the XCK clock.
This means that XCK is not synchronized with the system clock and, therefore, can operate at frequencies up to the
system frequency.
get the baud rate desired. In this case, the BAUD register value should be set to give the lowest possible error. Refer
to Clock Generation – Baud-Rate Generator for details.
Recommended maximum receiver baud-rate errors for various character sizes are shown in the table below.
Table 26-3. Asynchronous Receiver Error for 16-fold Oversampling
D RSLOW [%] RFAST [%] Max. total error [%] Recommended max. Rx error [%]
(Data bits+Parity)
5 94.12 107.69 +5.88/-7.69 ±2.5
6 94.92 106.67 +5.08/-6.67 ±2.0
7 95.52 105.88 +4.48/-5.88 ±2.0
8 96.00 105.26 +4.00/-5.26 ±2.0
9 96.39 104.76 +3.61/-4.76 ±1.5
10 96.70 104.35 +3.30/-4.35 ±1.5
The following equations calculate the ratio of the incoming data rate and internal receiver baud rate:
�+ 1 � �+ 2 �
�SLOW = , �FAST =
� − 1 + � ⋅ � + �� � + 1 � + ��
• RSLOW is the ratio of the slowest incoming data rate that can be accepted in relation to the receiver baud rate
• RFAST is the ratio of the fastest incoming data rate that can be accepted in relation to the receiver baud rate
• D is the sum of character size and parity size (D = 5 to 10 bits)
• S is the number of samples per bit (S = 16, 8 or 3)
• SF is the first sample number used for majority voting (SF = 7, 3, or 2) when CTRLA.SAMPA=0.
• SM is the middle sample number used for majority voting (SM = 8, 4, or 2) when CTRLA.SAMPA=0.
The recommended maximum Rx Error assumes that the receiver and transmitter equally divide the maximum total
error. Its connection to the SERCOM Receiver error acceptance is depicted in this figure:
Figure 26-5. USART Rx Error Calculation
SERCOM Receiver error acceptance
from RSLOW and RFAST formulas +
+ offset error
Baud Generator +
Clock source error
Error Max (%) depends on BAUD register value Recommended max. Rx Error (%)
Baud Rate
Related Links
25.6.2.3 Clock Generation – Baud-Rate Generator
25.6.2.3.1 Asynchronous Arithmetic Mode BAUD Value Selection
26.6.3.1 Parity
Even or odd parity can be selected for error checking by writing 0x1 to the Frame Format bit field in the Control A
register (CTRLA.FORM).
If even parity is selected (CTRLB.PMODE=0), the parity bit of an outgoing frame is '1' if the data contains an odd
number of bits that are '1', making the total number of '1' even.
If odd parity is selected (CTRLB.PMODE=1), the parity bit of an outgoing frame is '1' if the data contains an even
number of bits that are '0', making the total number of '1' odd.
When parity checking is enabled, the parity checker calculates the parity of the data bits in incoming frames and
compares the result with the parity bit of the corresponding frame. If a parity error is detected, the Parity Error bit in
the Status register (STATUS.PERR) is set.
When the receiver is disabled or the receive FIFO is full, the receiver will drive the RTS pin high. This notifies the
remote device to stop transfer after the ongoing transmission. Enabling and disabling the receiver by writing to
CTRLB.RXEN will set/clear the RTS pin after a synchronization delay. When the receive FIFO goes full, RTS will be
set immediately and the frame being received will be stored in the shift register until the receive FIFO is no longer full.
RXD
RXEN
RTS
Rx FIFO Full
The current CTS Status is in the STATUS register (STATUS.CTS). Character transmission will start only if
STATUS.CTS=0. When CTS is set, the transmitter will complete the ongoing transmission and stop transmitting.
Figure 26-9. Transmitter Behavior when Operating with Hardware Handshaking
CTS
TXD
TXD
Example: The figure below illustrates reception where RXPL.RXPL is set to 19. This indicates that
the pulse width should be at least 20 SE clock cycles. When using BAUD=0xE666 or 160 SE
cycles per bit, this corresponds to 2/16 baud clock as minimum pulse width required. In this case
the first bit is accepted as a '0', the second bit is a '1', and the third bit is also a '1'. A low pulse is
rejected since it does not meet the minimum requirement of 2/16 baud clock.
Figure 26-11. IrDA Receive Decoding
Baud clock 0 0.5 1 1.5 2 2.5
RXD
20 SE clock cycles
TXD
RXD
Collision checked
The next figure shows the conditions for a collision detection. In this case, the start bit and the first data bit are
received with the same value as transmitted. The second received data bit is found to be different than the
transmitted bit at the detection point, which indicates a collision.
Figure 26-13. Collision Detected
Collision checked and ok
Tri-state
TXD
RXD
TXEN
Collision detected
When a collision is detected, the USART follows this sequence:
1. Abort the current transfer.
2. Flush the transmit buffer.
3. Disable transmitter (CTRLB.TXEN=0)
– This is done after a synchronization delay. The CTRLB Synchronization Busy bit (SYNCBUSY.CTRLB)
will be set until this is complete.
Condition Request
DMA Interrupt Event
Data Register Empty (DRE) Yes Yes NA
(request cleared when data is written)
26.6.4.2 Interrupts
The USART has the following interrupt sources. These are asynchronous interrupts, and can wake up the device
from any sleep mode:
• Data Register Empty (DRE)
• Receive Complete (RXC)
• Transmit Complete (TXC)
• Receive Start (RXS)
• Clear to Send Input Change (CTSIC)
• Received Break (RXBRK)
• Error (ERROR)
Each interrupt source has its own interrupt flag. The interrupt flag in the Interrupt Flag Status and Clear register
(INTFLAG) will be set when the interrupt condition is met. Each interrupt can be individually enabled by writing '1' to
the corresponding bit in the Interrupt Enable Set register (INTENSET), and disabled by writing '1' to the
corresponding bit in the Interrupt Enable Clear register (INTENCLR).
An interrupt request is generated when the interrupt flag is set and if the corresponding interrupt is enabled. The
interrupt request remains active until either the interrupt flag is cleared, the interrupt is disabled, or the USART is
reset. For details on clearing interrupt flags, refer to the INTFLAG register description.
The value of INTFLAG indicates which interrupt is executed. Note that interrupts must be globally enabled for
interrupt requests. Refer to Nested Vector Interrupt Controller for details.
Related Links
11.2 Nested Vector Interrupt Controller
26.6.4.3 Events
Not applicable.
26.6.6 Synchronization
Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be
synchronized when written or read.
The following bits are synchronized when written:
• Software Reset bit in the CTRLA register (CTRLA.SWRST)
• Enable bit in the CTRLA register (CTRLA.ENABLE)
• Receiver Enable bit in the CTRLB register (CTRLB.RXEN)
26.8.1 Control A
Name: CTRLA
Offset: 0x00
Reset: 0x00000000
Property: PAC Write-Protection, Enable-Protected
Bit 31 30 29 28 27 26 25 24
DORD CPOL CMODE FORM[3:0]
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
SAMPA[1:0] RXPO[1:0] TXPO[1:0]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
SAMPR[2:0] IBON
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
RUNSTDBY MODE[2:0] ENABLE SWRST
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
FORM[3:0] Description
0x0 USART frame
0x1 USART frame with parity
...........continued
FORM[3:0] Description
0x2-0x3 Reserved
0x4 Auto-baud - break detection and auto-baud.
0x5 Auto-baud - break detection and auto-baud with parity
0x6-0xF Reserved
TXPO TxD Pin Location XCK Pin Location (When Applicable) RTS CTS
0x0 SERCOM PAD[0] SERCOM PAD[1] N/A N/A
0x1 SERCOM PAD[2] SERCOM PAD[3] N/A N/A
0x2 SERCOM PAD[0] N/A SERCOM PAD[2] SERCOM PAD[3]
0x3 Reserved
SAMPR[2:0] Description
0x0 16x over-sampling using arithmetic baud rate generation.
0x1 16x over-sampling using fractional baud rate generation.
0x2 8x over-sampling using arithmetic baud rate generation.
0x3 8x over-sampling using fractional baud rate generation.
0x4 3x over-sampling using arithmetic baud rate generation.
0x5-0x7 Reserved
Bit 1 – ENABLE Enable
Due to synchronization, there is delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The
value written to CTRLA.ENABLE will read back immediately and the Enable Synchronization Busy bit in the
Synchronization Busy register (SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE is cleared when the operation
is complete.
This bit is not enable-protected.
Value Description
0 The peripheral is disabled or being disabled.
1 The peripheral is enabled or being enabled.
26.8.2 Control B
Name: CTRLB
Offset: 0x04
Reset: 0x00000000
Property: PAC Write-Protection, Enable-Protected, Write-Synchronized
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
RXEN TXEN
Access R/W R/W
Reset 0 0
Bit 15 14 13 12 11 10 9 8
PMODE ENC SFDE COLDEN
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
SBMODE CHSIZE[2:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
for the incoming data and parity bit, compare it to the parity mode and, if a mismatch is detected, STATUS.PERR will
be set.
This bit is not synchronized.
Value Description
0 Even parity.
1 Odd parity.
CHSIZE[2:0] Description
0x0 8 bits
0x1 9 bits
0x2-0x4 Reserved
0x5 5 bits
0x6 6 bits
0x7 7 bits
26.8.3 Baud
Name: BAUD
Offset: 0x0C
Reset: 0x0000
Property: Enable-Protected, PAC Write-Protection
Bit 15 14 13 12 11 10 9 8
BAUD[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
BAUD[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: RXPL
Offset: 0x0E
Reset: 0x00
Property: Enable-Protected, PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
RXPL[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: INTENCLR
Offset: 0x14
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Set register (INTENSET).
Bit 7 6 5 4 3 2 1 0
ERROR RXBRK CTSIC RXS RXC TXC DRE
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Value Description
0 Transmit Complete interrupt is disabled.
1 Transmit Complete interrupt is enabled.
Name: INTENSET
Offset: 0x16
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Clear register (INTENCLR).
Bit 7 6 5 4 3 2 1 0
ERROR RXBRK CTSIC RXS RXC TXC DRE
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Value Description
0 Transmit Complete interrupt is disabled.
1 Transmit Complete interrupt is enabled.
Name: INTFLAG
Offset: 0x18
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
ERROR RXBRK CTSIC RXS RXC TXC DRE
Access R/W R/W R/W R/W R R/W R
Reset 0 0 0 0 0 0 0
Bit 7 – ERROR Error
This flag is cleared by writing '1' to it.
This bit is set when any error is detected. Errors that will set this flag have corresponding status flags in the STATUS
register. Errors that will set this flag are COLL, ISF, BUFOVF, FERR, and PERR.Writing '0' to this bit has no effect.
Writing '1' to this bit will clear the flag.
26.8.8 Status
Name: STATUS
Offset: 0x1A
Reset: 0x0000
Property: -
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
TXE COLL ISF CTS BUFOVF FERR PERR
Access R/W R/W R/W R R/W R/W R/W
Reset 0 0 0 0 0 0 0
Name: SYNCBUSY
Offset: 0x1C
Reset: 0x00000000
Property: -
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
CTRLB ENABLE SWRST
Access R R R
Reset 0 0 0
26.8.10 Data
Name: DATA
Offset: 0x28
Reset: 0x0000
Property: -
Bit 15 14 13 12 11 10 9 8
DATA[8]
Access R/W
Reset 0
Bit 7 6 5 4 3 2 1 0
DATA[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: DBGCTRL
Offset: 0x30
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
DBGSTOP
Access R/W
Reset 0
27.1 Overview
The serial peripheral interface (SPI) is one of the available modes in the Serial Communication Interface (SERCOM).
The SPI uses the SERCOM transmitter and receiver configured as shown in 27.3 Block Diagram. Each side, master
and slave, depicts a separate SPI containing a shift register, a transmit buffer and a two-level receive buffer. In
addition, the SPI master uses the SERCOM baud-rate generator, while the SPI slave can use the SERCOM address
match logic. Labels in capital letters are synchronous to CLK_SERCOMx_APB and accessible by the CPU, while
labels in lowercase letters are synchronous to the SCK clock.
Related Links
25. SERCOM – Serial Communication Interface
27.2 Features
SERCOM SPI includes the following features:
• Full-duplex, four-wire interface (MISO, MOSI, SCK, SS)
• One-level transmit buffer, two-level receive buffer
• Supports all four SPI modes of operation
• Single data direction operation allows alternate function on MISO or MOSI pin
• Selectable LSB- or MSB-first data transfer
• Can be used with DMA
• Master operation:
– Serial clock speed, fSCK=1/tSCK(1)
– 8-bit clock generator
– Hardware controlled SS
• Slave Operation:
– Serial clock speed, fSCK=1/tSSCK(1)
– Optional 8-bit address match operation
– Operation in all sleep modes
– Wake on SS transition
1. For tSCK and tSSCK values, refer to SPI Timing Characteristics.
Related Links
37.16.2 SERCOM in SPI Mode Timing
25. SERCOM – Serial Communication Interface
25.2 Features
MISO
baud rate generator shift register shift register
MOSI
rx buffer rx buffer ==
Rx DATA Rx DATA Address Match
The combined configuration of PORT, the Data In Pinout and the Data Out Pinout bit groups in the Control A register
(CTRLA.DIPO and CTRLA.DOPO) define the physical position of the SPI signals in the table above.
Related Links
23. PORT - I/O Pin Controller
27.5.3 Clocks
The SERCOM bus clock (CLK_SERCOMx_APB) can be enabled and disabled in the Power Manager. Refer to
Peripheral Clock Masking for details and default status of this clock.
A generic clock (GCLK_SERCOMx_CORE) is required to clock the SPI. This clock must be configured and enabled
in the Generic Clock Controller before using the SPI.
This generic clock is asynchronous to the bus clock (CLK_SERCOMx_APB). Therefore, writes to certain registers will
require synchronization to the clock domains.
Related Links
15. GCLK - Generic Clock Controller
16.6.2.6 Peripheral Clock Masking
27.6.6 Synchronization
27.5.4 DMA
The DMA request lines are connected to the DMA Controller (DMAC). In order to use DMA requests with this
peripheral the DMAC must be configured first. Refer to DMAC – Direct Memory Access Controller for details.
Related Links
20. DMAC – Direct Memory Access Controller
27.5.5 Interrupts
The interrupt request line is connected to the Interrupt Controller. In order to use interrupt requests of this peripheral,
the Interrupt Controller (NVIC) must be configured first. Refer to Nested Vector Interrupt Controller for details.
Related Links
11.2 Nested Vector Interrupt Controller
27.5.6 Events
Not applicable.
_SS
The SPI master must pull the slave select line (SS) of the desired slave low to initiate a transaction if multiple slaves
are connected to the bus. The slave select line can be wired low if there is only one SPI slave on the bus. The master
and slave prepare data to send via their respective Shift registers, and the master generates the serial clock on the
SCK line.
Data is always shifted from master to slave on the Master Output Slave Input line (MOSI); data is shifted from slave
to master on the Master Input Slave Output line (MISO).
Each time character is shifted out from the master, a character will be shifted out from the slave simultaneously. To
signal the end of a transaction, the master will pull the SS line high.
2. Select transfer mode for the Clock Polarity bit and the Clock Phase bit in the CTRLA register (CTRLA.CPOL
and CTRLA.CPHA) if desired.
3. Select the Frame Format value in the CTRLA register (CTRLA.FORM).
4. Configure the Data In Pinout field in the Control A register (CTRLA.DIPO) for SERCOM pads of the receiver.
5. Configure the Data Out Pinout bit group in the Control A register (CTRLA.DOPO) for SERCOM pads of the
transmitter.
6. Select the Character Size value in the CTRLB register (CTRLB.CHSIZE).
7. Write the Data Order bit in the CTRLA register (CTRLA.DORD) for data direction.
8. If the SPI is used in master mode:
8.1. Select the desired baud rate by writing to the Baud register (BAUD).
8.2. If Hardware SS control is required, write '1' to the Master Slave Select Enable bit in CTRLB register
(CTRLB.MSSEN).
9. Enable the receiver by writing the Receiver Enable bit in the CTRLB register (CTRLB.RXEN=1).
Note:
Leading edge is the first clock edge in a clock cycle.
Trailing edge is the second clock edge in a clock cycle.
Figure 27-3. SPI Transfer Modes
Mode 0
Mode 2
SAMPLE I
MOSI/MISO
CHANGE 0
MOSI PIN
CHANGE 0
MISO PIN
SS
MSB first (DORD = 0) MSB Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 LSB
LSB first (DORD = 1) LSB Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 MSB
Mode 1
Mode 3
SAMPLE I
MOSI/MISO
CHANGE 0
MOSI PIN
CHANGE 0
MISO PIN
SS
MSB first (DORD = 0) MSB Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 LSB
LSB first (DORD = 1) LSB Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 MSB
Each time one character is shifted out from the master, another character will be shifted in from the slave
simultaneously. If the receiver is enabled (CTRLA.RXEN=1), the contents of the shift register will be transferred to the
two-level receive buffer. The transfer takes place in the same clock cycle as the last data bit is shifted in. And the
Receive Complete Interrupt flag in the Interrupt Flag Status and Clear register (INTFLAG.RXC) will be set. The
received data can be retrieved by reading DATA.
When the last character has been transmitted and there is no valid data in DATA, the Transmit Complete Interrupt
flag in the Interrupt Flag Status and Clear register (INTFLAG.TXC) will be set. When the transaction is finished, the
master must pull the SS line high to notify the slave. If Master Slave Select Enable (CTRLB.MSSEN) is set to '0', the
software must pull the SS line high.
27.6.2.6.2 Slave
In slave mode (CTRLA.MODE=0x2), the SPI interface will remain inactive with the MISO line tri-stated as long as the
SS pin is pulled high. Software may update the contents of DATA at any time as long as the Data Register Empty flag
in the Interrupt Status and Clear register (INTFLAG.DRE) is set.
When SS is pulled low and SCK is running, the slave will sample and shift out data according to the transaction mode
set. When the content of TxDATA has been loaded into the shift register, INTFLAG.DRE will be set, and new data can
be written to DATA.
Similar to the master, the slave will receive one character for each character transmitted. A character will be
transferred into the two-level receive buffer within the same clock cycle its last data bit is received. The received
character can be retrieved from DATA when the Receive Complete interrupt flag (INTFLAG.RXC) is set.
When the master pulls the SS line high, the transaction is done and the Transmit Complete Interrupt flag in the
Interrupt Flag Status and Clear register (INTFLAG.TXC) will be set.
After DATA is written it takes up to three SCK clock cycles until the content of DATA is ready to be loaded into the
shift register on the next character boundary. As a consequence, the first character transferred in a SPI transaction
will not be the content of DATA. This can be avoided by using the preloading feature. Refer to 27.6.3.2 Preloading of
the Slave Shift Register.
When transmitting several characters in one SPI transaction, the data has to be written into DATA register with at
least three SCK clock cycles left in the current character transmission. If this criteria is not met, the previously
received character will be transmitted.
Once the DATA register is empty, it takes three CLK_SERCOM_APB cycles for INTFLAG.DRE to be set.
If a 9-bit frame format is selected, only the lower 8 bits of the shift register are checked against the Address register
(ADDR).
Preload must be disabled (CTRLB.PLOADEN=0) in order to use this mode.
Related Links
25.6.3.1 Address Match and Mask
_SS synchronized
to system domain
SCK
Synchronization MISO to SCK
to system domain setup time
Related Links
37. Electrical Characteristics
MOSI MOSI
shift register shift register
MISO MISO
SCK SCK
_SS[0] _SS SPI Slave 0
SPI Master
_SS[n-1] MOSI
shift register
MISO
SCK
_SS SPI Slave n-1
Another configuration is multiple slaves in series, as in Multiple Slaves in Series. In this configuration, all n attached
slaves are connected in series. A common SS line is provided to all slaves, enabling them simultaneously. The
master must shift n characters for a complete transaction. Depending on the Master Slave Select Enable bit
(CTRLB.MSSEN), the SS line can be controlled either by hardware or user software and normal GPIO.
Figure 27-6. Multiple Slaves in Series
T T T T T
_SS
SCK
T = 1 to 2 baud cycles
When CTRLB.MSSEN=0, the SS pin(s) is/are controlled by user software and normal GPIO.
Condition Request
DMA Interrupt Event
Data Register Empty (DRE) Yes Yes NA
(request cleared when data is written)
27.6.4.2 Interrupts
The SPI has the following interrupt sources. These are asynchronous interrupts, and can wake-up the device from
any Sleep mode:
• Data Register Empty (DRE)
• Receive Complete (RXC)
• Transmit Complete (TXC)
• Slave Select Low (SSL)
• Error (ERROR)
Each interrupt source has its own Interrupt flag. The Interrupt flag in the Interrupt Flag Status and Clear register
(INTFLAG) will be set when the Interrupt condition is met. Each interrupt can be individually enabled by writing '1' to
the corresponding bit in the Interrupt Enable Set register (INTENSET), and disabled by writing '1' to the
corresponding bit in the Interrupt Enable Clear register (INTENCLR). The current state of enabled interrupts can be
read from INTENSET or INTENCLR.
An interrupt request is generated when the Interrupt flag is set and if the corresponding interrupt is enabled. The
interrupt request remains active until either the Interrupt flag is cleared, the interrupt is disabled, or the SPI is reset.
For details on clearing Interrupt flags, refer to the INTFLAG register description.
The value of INTFLAG indicates which interrupt is executed. Note that interrupts must be globally enabled for
interrupt requests. Refer to Nested Vector Interrupt Controller for details.
Related Links
11.2 Nested Vector Interrupt Controller
27.6.4.3 Events
Not applicable.
27.6.6 Synchronization
Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be
synchronized when written or read.
The following bits are synchronized when written:
• Software Reset bit in the CTRLA register (CTRLA.SWRST)
• Enable bit in the CTRLA register (CTRLA.ENABLE)
• Receiver Enable bit in the CTRLB register (CTRLB.RXEN)
Note: CTRLB.RXEN is write-synchronized somewhat differently. See also CTRLB register for details.
Required write-synchronization is denoted by the "Write-Synchronized" property in the register description.
Related Links
14.3 Register Synchronization
27.8.1 Control A
Name: CTRLA
Offset: 0x00
Reset: 0x00000000
Property: PAC Write-Protection, Enable-Protected, Write-Synchronized
Bit 31 30 29 28 27 26 25 24
DORD CPOL CPHA FORM[3:0]
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
DIPO[1:0] DOPO[1:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 15 14 13 12 11 10 9 8
IBON
Access R/W
Reset 0
Bit 7 6 5 4 3 2 1 0
RUNSTDBY MODE[2:0] ENABLE SWRST
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Value Description
0 The data is sampled on a leading SCK edge and changed on a trailing SCK edge.
1 The data is sampled on a trailing SCK edge and changed on a leading SCK edge.
Bit 1 – ENABLE Enable
Due to synchronization, there is delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The
value written to CTRL.ENABLE will read back immediately and the Synchronization Enable Busy bit in the
Synchronization Busy register (SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE is cleared when the operation
is complete.
This bit is not enable-protected.
Value Description
0 The peripheral is disabled or being disabled.
1 The peripheral is enabled or being enabled.
27.8.2 Control B
Name: CTRLB
Offset: 0x04
Reset: 0x00000000
Property: PAC Write-Protection, Enable-Protected, Write-Synchronized
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
RXEN
Access R/W
Reset 0
Bit 15 14 13 12 11 10 9 8
AMODE[1:0] MSSEN SSDE
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
PLOADEN CHSIZE[2:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Value Description
0 Hardware SS control is disabled.
1 Hardware SS control is enabled.
Name: BAUD
Offset: 0x0C
Reset: 0x00
Property: PAC Write-Protection, Enable-Protected
Bit 7 6 5 4 3 2 1 0
BAUD[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: INTENCLR
Offset: 0x14
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to disable an interrupt without read-modify-write operation. Changes in this register will
also be reflected in the Interrupt Enable Set register (INTENSET).
Bit 7 6 5 4 3 2 1 0
ERROR SSL RXC TXC DRE
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Name: INTENSET
Offset: 0x16
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to disable an interrupt without read-modify-write operation. Changes in this register will
also be reflected in the Interrupt Enable Clear register (INTENCLR).
Bit 7 6 5 4 3 2 1 0
ERROR SSL RXC TXC DRE
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Name: INTFLAG
Offset: 0x18
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
ERROR SSL RXC TXC DRE
Access R/W R/W R R/W R
Reset 0 0 0 0 0
Bit 7 – ERROR Error
This flag is cleared by writing '1' to it.
This bit is set when any error is detected. Errors that will set this flag have corresponding status flags in the STATUS
register. The BUFOVF error will set this interrupt flag.
Writing '0' to this bit has no effect.
Writing '1' to this bit will clear the flag.
27.8.7 Status
Name: STATUS
Offset: 0x1A
Reset: 0x0000
Property: –
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
BUFOVF
Access R/W
Reset 0
Name: SYNCBUSY
Offset: 0x1C
Reset: 0x00000000
Property: -
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
CTRLB ENABLE SWRST
Access R R R
Reset 0 0 0
27.8.9 Address
Name: ADDR
Offset: 0x24
Reset: 0x00000000
Property: PAC Write-Protection, Enable-Protected
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
ADDRMASK[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
ADDR[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
27.8.10 Data
Name: DATA
Offset: 0x28
Reset: 0x0000
Property: –
Bit 15 14 13 12 11 10 9 8
DATA[8]
Access R/W
Reset 0
Bit 7 6 5 4 3 2 1 0
DATA[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: DBGCTRL
Offset: 0x30
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
DBGSTOP
Access R/W
Reset 0
28.1 Overview
The inter-integrated circuit ( I2C) interface is one of the available modes in the serial communication interface
(SERCOM).
The I2C interface uses the SERCOM transmitter and receiver configured as shown in Figure 28-1. Labels in capital
letters are registers accessible by the CPU, while lowercase labels are internal to the SERCOM.
A SERCOM instance can be configured to be either an I2C master or an I2C slave. Both master and slave have an
interface containing a shift register, a transmit buffer and a receive buffer. In addition, the I2C master uses the
SERCOM baud-rate generator, while the I2C slave uses the SERCOM address match logic.
Related Links
25. SERCOM – Serial Communication Interface
28.2 Features
SERCOM I2C includes the following features:
• Master or Slave Operation
• Can be used with DMA
• Philips I2C Compatible
• SMBus Compatible
• PMBus™ Compatible
• Support of 100 kHz and 400 kHz, 1 MHz and 3.4 MHz I2C mode
• 4-Wire Operation Supported
• Physical interface includes:
– Slew-rate limited outputs
– Filtered inputs
• Slave Operation:
– Operation in all Sleep modes
– Wake-up on address match
– 7-bit and 10-bit Address match in hardware for:
– • Unique address and/or 7-bit general call address
• Address range
• Two unique addresses can be used with DMA
Related Links
25.2 Features
RxDATA RxDATA ==
28.5.3 Clocks
The SERCOM bus clock (CLK_SERCOMx_APB) can be enabled and disabled in the Power Manager. Refer to
Peripheral Clock Masking for details and default status of this clock.
Two generic clocks are used by SERCOM, GCLK_SERCOMx_CORE and GCLK_SERCOM_SLOW. The core clock
(GCLK_SERCOMx_CORE) can clock the I2C when working as a master. The slow clock (GCLK_SERCOM_SLOW)
is required only for certain functions, e.g. SMBus timing. These two clocks must be configured and enabled in the
Generic Clock Controller (GCLK) before using the I2C.
These generic clocks are asynchronous to the bus clock (CLK_SERCOMx_APB). Due to this asynchronicity, writes to
certain registers will require synchronization between the clock domains. Refer to 28.6.6 Synchronization for further
details.
Related Links
15. GCLK - Generic Clock Controller
16. PM – Power Manager
16.6.2.6 Peripheral Clock Masking
28.5.4 DMA
The DMA request lines are connected to the DMA Controller (DMAC). In order to use DMA requests with this
peripheral the DMAC must be configured first. Refer to DMAC – Direct Memory Access Controller for details.
Related Links
20. DMAC – Direct Memory Access Controller
28.5.5 Interrupts
The interrupt request line is connected to the Interrupt Controller. In order to use interrupt requests of this peripheral,
the Interrupt Controller (NVIC) must be configured first. Refer to Nested Vector Interrupt Controller for details.
Related Links
11.2 Nested Vector Interrupt Controller
28.5.6 Events
Not applicable.
'1' '0'
'0' '1'
SDA
SCL
6..0 7..0 7..0
Direction
Transaction
28.6.2.1 Initialization
The following registers are enable-protected, meaning they can be written only when the I2C interface is disabled
(CTRLA.ENABLE is ‘0’):
• Control A register (CTRLA), except Enable (CTRLA.ENABLE) and Software Reset (CTRLA.SWRST) bits
• Control B register (CTRLB), except Acknowledge Action (CTRLB.ACKACT) and Command (CTRLB.CMD) bits
• Baud register (BAUD)
• Address register (ADDR) in slave operation.
When the I2C is enabled or is being enabled (CTRLA.ENABLE=1), writing to these registers will be discarded. If the
I2C is being disabled, writing to these registers will be completed after the disabling.
Enable-protection is denoted by the "Enable-Protection" property in the register description.
Before the I2C is enabled it must be configured as outlined by the following steps:
1. Select I2C Master or Slave mode by writing 0x4 (Slave mode) or 0x5 (Master mode) to the Operating Mode
bits in the CTRLA register (CTRLA.MODE).
2. If desired, select the SDA Hold Time value in the CTRLA register (CTRLA.SDAHOLD).
3. If desired, enable smart operation by setting the Smart Mode Enable bit in the CTRLB register
(CTRLB.SMEN).
4. If desired, enable SCL low time-out by setting the SCL Low Time-Out bit in the Control A register
(CTRLA.LOWTOUT).
5. In Master mode:
5.1. Select the inactive bus time-out in the Inactive Time-Out bit group in the CTRLA register
(CTRLA.INACTOUT).
5.2. Write the Baud Rate register (BAUD) to generate the desired baud rate.
In Slave mode:
5.1. Configure the address match configuration by writing the Address Mode value in the CTRLB register
(CTRLB.AMODE).
5.2. Set the Address and Address Mask value in the Address register (ADDR.ADDR and
ADDR.ADDRMASK) according to the address configuration.
RESET
UNKNOWN
(0b00)
Start Condition
IDLE BUSY
(0b01) Timeout or Stop Condition (0b11)
Start Condition
Repeated
Stop Condition
M1 M2 M3 M4
Wait for
SW R/W A SW P IDLE M2
IDLE
W A SW Sr M3 BUSY M4
SW DATA A/A
A/A
R A DATA
In the second strategy (CTRLA.SCLSM=1), interrupts only occur after the ACK bit, as in Master Behavioral Diagram
(SCLSM=1). This strategy can be used when it is not necessary to check DATA before acknowledging.
Note: I2C High-speed (Hs) mode requires CTRLA.SCLSM=1.
M1 M2 M3 M4
Wait for
SW R/W A SW P IDLE M2
IDLE
W A SW Sr M3 BUSY M4
SW DATA A/A
SW Software interaction
SW BUSY M4
The master provides data on the bus
P IDLE M2
Addressed slave provides data on the bus
Sr M3
R A DATA A/A
TRISE
P S TLOW Sr
SCL
THIGH
TBUF TFALL
SDA
When BAUD.BAUDLOW is zero, the BAUD.BAUD value is used to time both SCL high and SCL low. In this case the
following formula will give the SCL frequency:
�GCLK
�SCL =
10 + 2���� + �GCLK ⋅ �RISE
When BAUD.BAUDLOW is non-zero, the following formula determines the SCL frequency:
�GCLK
�SCL =
10 + ���� + ������� + �GCLK ⋅ �RISE
The following formulas can determine the SCL TLOW and THIGH times:
������� + 5
�LOW =
�GCLK
���� + 5
�HIGH =
�GCLK
Note: The I2C standard Fm+ (Fast-mode plus) requires a nominal high to low SCL ratio of 1:2, and BAUD should be
set accordingly. At a minimum, BAUD.BAUD and/or BAUD.BAUDLOW must be non-zero.
Startup Timing The minimum time between SDA transition and SCL rising edge is 6 APB cycles when the DATA
register is written in smart mode. If a greater startup time is required due to long rise times, the time between DATA
write and IF clear must be controlled by software.
Note: When timing is controlled by user, the Smart Mode cannot be enabled.
Related Links
If the I2C master receives an ACK from the I2C slave, the I2C master proceeds to receive the next byte of data from
the I2C slave. When the first data byte is received, the Slave on Bus bit in the Interrupt Flag register (INTFLAG.SB)
will be set and STATUS.RXNACK will be cleared. The clock hold is active at this point, preventing further activity on
the bus.
In this case, the software implementation becomes highly protocol dependent. Three possible actions can enable the
I2C operation to continue:
• Let the I2C master continue to read data by acknowledging the data received. ACK can be sent by software, or
automatically in smart mode.
• Transmit a new address packet.
• Terminate the transaction by issuing a stop condition.
Note: An ACK or NACK will be automatically transmitted if smart mode is enabled. The Acknowledge Action bit in
the Control B register (CTRLB.ACKACT) determines whether ACK or NACK should be sent.
Sr ADDRESS
Transmitting in High-speed mode requires the I2C master to be configured in High-speed mode
(CTRLA.SPEED=0x2) and the SCL clock stretch mode (CTRLA.SCLSM) bit set to '1'.
1
S
S 11110 addr[9:8] W A addr[7:0] A Sr 11110 addr[9:8] R A
W
This implies the following procedure for a 10-bit read operation:
1. Write the 10-bit address to ADDR.ADDR[10:1]. ADDR.TENBITEN must be '1', the direction bit
(ADDR.ADDR[0]) must be '0' (can be written simultaneously with ADDR).
2. Once the Master on Bus interrupt is asserted, Write ADDR[7:0] register to '11110 address[9:8] 1'.
ADDR.TENBITEN must be cleared (can be written simultaneously with ADDR).
3. Proceed to transmit data.
P S2
S1 S3 A S1 Sr S3
S S
S2 S ADDRESS R
W
A
W
DATA A/A
P S2
A S1 Sr S3
PREC INTERRUPT
S S
W A DATA A/A
W W
Interrupt on STOP S
Condition Enabled W
S
Software interaction
W
In the second strategy (CTRLA.SCLSM=1), interrupts only occur after the ACK bit is sent as shown in Slave
Behavioral Diagram (SCLSM=1). This strategy can be used when it is not necessary to check DATA before
acknowledging. For master reads, an address and data interrupt will be issued simultaneously after the address
acknowledge. However, for master writes, the first data interrupt will be seen after the first data byte has been
received by the slave and the acknowledge bit has been sent to the master.
Note: For I2C High-speed mode (Hs), SCLSM=1 is required.
Figure 28-11. I2C Slave Behavioral Diagram (SCLSM=1)
AMATCH INTERRUPT (+ DRDY INTERRUPT in Master Read mode) DRDY INTERRUPT
P S2
S1 S3 Sr S3
S
S2 S ADDRESS R A/A
W
DATA A/A
P S2
Sr S3
PREC INTERRUPT
S S
W A/A DATA A/A
W W
Interrupt on STOP S
Condition Enabled W
S
Software interaction
W
After the address packet has been received from the I2C master, INTFLAG.AMATCH be set to ‘1’ to clear it.
S S
S 11110 addr[9:8] W A addr[7:0] A Sr 11110 addr[9:8] R
W W
Command/Data
S ADDRESS 0 W A n Bytes A
ADDRESS 1 S S
Sr W A n Bytes A
(this slave) W W
PREC INTERRUPT
Command/Data
S
Sr ADDRESS 2 W A n Bytes A P
W
28.6.3.1 SMBus
The I2C includes three hardware SCL low time-outs which allow a time-out to occur for SMBus SCL low time-out,
master extend time-out, and slave extend time-out. This allows for SMBus functionality These time-outs are driven by
the GCLK_SERCOM_SLOW clock. The GCLK_SERCOM_SLOW clock is used to accurately time the time-out and
must be configured to use a 32KHz oscillator. The I2C interface also allows for a SMBus compatible SDA hold time.
• TTIMEOUT: SCL low time of 25..35ms – Measured for a single SCL low period. It is enabled by
CTRLA.LOWTOUTEN.
• TLOW:SEXT: Cumulative clock low extend time of 25 ms – Measured as the cumulative SCL low extend time by a
slave device in a single message from the initial START to the STOP. It is enabled by CTRLA.SEXTTOEN.
• TLOW:MEXT: Cumulative clock low extend time of 10 ms – Measured as the cumulative SCL low extend time by
the master device within a single byte from START-to-ACK, ACK-to-ACK, or ACK-to-STOP. It is enabled by
CTRLA.MEXTTOEN.
I2C SCL/SDA
Driver pad
SCL_IN/
SDA_IN
PINOUT
Condition Request
DMA Interrupt Event
Data needed for transmit (TX) (Slave Yes NA
Transmit mode) (request cleared
when data is
written)
Condition Request
DMA Interrupt Event
Data needed for transmit (TX) (Master Yes NA
Transmit mode) (request cleared
when data is
written)
28.6.4.2 Interrupts
The I2C slave has the following interrupt sources. These are asynchronous interrupts. They can wake-up the device
from any sleep mode:
• Error (ERROR)
• RX FIFO Full (RXFF)
• TX FIFO Empty (TXFE)
28.6.4.3 Events
Not applicable.
28.6.6 Synchronization
Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be
synchronized when written or read.
The following bits are synchronized when written:
• Software Reset bit in the CTRLA register (CTRLA.SWRST)
• Enable bit in the CTRLA register (CTRLA.ENABLE)
• Command bits in CTRLB register (CTRLB.CMD)
• Write to Bus State bits in the Status register (STATUS.BUSSTATE)
• Address bits in the Address register (ADDR.ADDR) when in master operation.
The following registers are synchronized when written:
• Data (DATA) when in master operation
Required write-synchronization is denoted by the "Write-Synchronized" property in the register description.
Related Links
14.3 Register Synchronization
28.8.1 Control A
Name: CTRLA
Offset: 0x00
Reset: 0x00000000
Property: PAC Write-Protection, Enable-Protected, Write-Synchronized
Bit 31 30 29 28 27 26 25 24
LOWTOUT SCLSM SPEED[1:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 23 22 21 20 19 18 17 16
SEXTTOEN SDAHOLD[1:0] PINOUT
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
RUNSTDBY MODE[2:0] ENABLE SWRST
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Value Description
0 Time-out disabled
1 Time-out enabled
Bit 1 – ENABLE Enable
Due to synchronization, there is delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The
value written to CTRL.ENABLE will read back immediately and the Enable Synchronization Busy bit in the
Synchronization Busy register (SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE will be cleared when the
operation is complete.
This bit is not enable-protected.
Value Description
0 The peripheral is disabled or being disabled.
1 The peripheral is enabled.
28.8.2 Control B
Name: CTRLB
Offset: 0x04
Reset: 0x00000000
Property: PAC Write-Protection, Enable-Protected
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
ACKACT CMD[1:0]
Access R/W W W
Reset 0 0 0
Bit 15 14 13 12 11 10 9 8
AMODE[1:0] AACKEN GCMD SMEN
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
Access
Reset
...........continued
CMD[1:0] DIR Action
0x3 Used in response to an address interrupt (AMATCH)
0 (Master write) Execute acknowledge action succeeded by reception of next byte
1 (Master read) Execute acknowledge action succeeded by slave data interrupt
Used in response to a data interrupt (DRDY)
0 (Master write) Execute acknowledge action succeeded by reception of next byte
1 (Master read) Execute a byte read operation followed by ACK/NACK reception
Related Links
25. SERCOM – Serial Communication Interface
Name: INTENCLR
Offset: 0x14
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Set register (INTENSET).
Bit 7 6 5 4 3 2 1 0
ERROR DRDY AMATCH PREC
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: INTENSET
Offset: 0x16
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Clear register (INTENCLR).
Bit 7 6 5 4 3 2 1 0
ERROR DRDY AMATCH PREC
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: INTFLAG
Offset: 0x18
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
ERROR DRDY AMATCH PREC
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 – ERROR Error
This bit is set when any error is detected. Errors that will set this flag have corresponding status flags in the STATUS
register. The corresponding bits in STATUS are SEXTTOUT, LOWTOUT, COLL, and BUSERR.
Writing '0' to this bit has no effect.
Writing '1' to this bit will clear the flag.
28.8.6 Status
Name: STATUS
Offset: 0x1A
Reset: 0x0000
Property: -
Bit 15 14 13 12 11 10 9 8
HS SEXTTOUT
Access R/W R/W
Reset 0 0
Bit 7 6 5 4 3 2 1 0
CLKHOLD LOWTOUT SR DIR RXNACK COLL BUSERR
Access R R/W R R R R/W R/W
Reset 0 0 0 0 0 0 0
Bit 10 – HS High-speed
This bit is set if the slave detects a START followed by a Master Code transmission.
Writing a '0' to this bit has no effect.
Writing a '1' to this bit will clear the status. However, this flag is automatically cleared when a STOP is received.
Name: SYNCBUSY
Offset: 0x1C
Reset: 0x00000000
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
SYSOP ENABLE SWRST
Access R R R
Reset 0 0 0
28.8.8 Address
Name: ADDR
Offset: 0x24
Reset: 0x00000000
Property: PAC Write-Protection, Enable-Protected
Bit 31 30 29 28 27 26 25 24
ADDRMASK[9:7]
Access R/W R/W R/W
Reset 0 0 0
Bit 23 22 21 20 19 18 17 16
ADDRMASK[6:0]
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
TENBITEN ADDR[9:7]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
ADDR[6:0] GENCEN
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
28.8.9 Data
Name: DATA
Offset: 0x28
Reset: 0x0000
Property: Write-Synchronized, Read-Synchronized
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
DATA[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Some registers are enable-protected, meaning they can only be written when the peripheral is disabled. Enable-
protection is denoted by the "Enable-Protected" property in each individual register description.
28.10.1 Control A
Name: CTRLA
Offset: 0x00
Reset: 0x00000000
Property: PAC Write-Protection, Enable-Protected, Write-Synchronized
Bit 31 30 29 28 27 26 25 24
LOWTOUT INACTOUT[1:0] SCLSM SPEED[1:0]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
SEXTTOEN MEXTTOEN SDAHOLD[1:0] PINOUT
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
RUNSTDBY MODE[2:0] ENABLE SWRST
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 1 – ENABLE Enable
Due to synchronization, there is delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The
value written to CTRL.ENABLE will read back immediately and the Synchronization Enable Busy bit in the
Synchronization Busy register (SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE will be cleared when the
operation is complete.
This bit is not enable-protected.
Value Description
0 The peripheral is disabled or being disabled.
1 The peripheral is enabled.
28.10.2 Control B
Name: CTRLB
Offset: 0x04
Reset: 0x00000000
Property: PAC Write-Protection, Enable-Protected, Write-Synchronized
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
ACKACT CMD[1:0]
Access R/W W W
Reset 0 0 0
Bit 15 14 13 12 11 10 9 8
QCEN SMEN
Access R/W R/W
Reset 0 0
Bit 7 6 5 4 3 2 1 0
Access
Reset
Name: BAUD
Offset: 0x0C
Reset: 0x0000
Property: PAC Write-Protection, Enable-Protected
Bit 31 30 29 28 27 26 25 24
HSBAUDLOW[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
HSBAUD[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
BAUDLOW[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
BAUD[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: INTENCLR
Offset: 0x14
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Set register (INTENSET).
Bit 7 6 5 4 3 2 1 0
ERROR SB MB
Access R/W R/W R/W
Reset 0 0 0
Name: INTENSET
Offset: 0x16
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Clear register (INTENCLR).
Bit 7 6 5 4 3 2 1 0
ERROR SB MB
Access R/W R/W R/W
Reset 0 0 0
Name: INTFLAG
Offset: 0x18
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
ERROR SB MB
Access R/W R/W R/W
Reset 0 0 0
Bit 7 – ERROR Error
This flag is cleared by writing '1' to it.
This bit is set when any error is detected. Errors that will set this flag have corresponding status bits in the STATUS
register. These status bits are LENERR, SEXTTOUT, MEXTTOUT, LOWTOUT, ARBLOST, and BUSERR.
Writing '0' to this bit has no effect.
Writing '1' to this bit will clear the flag.
28.10.7 Status
Name: STATUS
Offset: 0x1A
Reset: 0x0000
Property: Write-Synchronized
Bit 15 14 13 12 11 10 9 8
LENERR SEXTTOUT MEXTTOUT
Access R/W R/W R/W
Reset 0 0 0
Bit 7 6 5 4 3 2 1 0
CLKHOLD LOWTOUT BUSSTATE[1:0] RXNACK ARBLOST BUSERR
Access R R/W R/W R/W R R/W R/W
Reset 0 0 0 0 0 0 0
When in UNKNOWN state, writing 0x1 to BUSSTATE forces the bus state into the IDLE state. The bus state cannot
be forced into any other state.
Writing BUSSTATE to idle will set SYNCBUSY.SYSOP.
Value Name Description
0x0 UNKNOWN The bus state is unknown to the I2C master and will wait for a stop condition to be
detected or wait to be forced into an idle state by software
0x1 IDLE The bus state is waiting for a transaction to be initialized
0x2 OWNER The I2C master is the current owner of the bus
0x3 BUSY Some other I2C master owns the bus
Name: SYNCBUSY
Offset: 0x1C
Reset: 0x00000000
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
SYSOP ENABLE SWRST
Access R R R
Reset 0 0 0
28.10.9 Address
Name: ADDR
Offset: 0x24
Reset: 0x0000
Property: Write-Synchronized
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
LEN[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
TENBITEN HS LENEN ADDR[10:8]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
ADDR[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
OWNER: A repeated start sequence will be performed. If the previous transaction was a read, the acknowledge
action is sent before the repeated start bus condition is issued on the bus. Writing ADDR to issue a repeated start is
performed while INTFLAG.MB or INTFLAG.SB is set.
STATUS.BUSERR, STATUS.ARBLOST, INTFLAG.MB and INTFLAG.SB will be cleared when ADDR is written.
The ADDR register can be read at any time without interfering with ongoing bus activity, as a read access does not
trigger the master logic to perform any bus protocol related operations.
The I2C master control logic uses bit 0 of ADDR as the bus protocol’s read/write flag (R/W); 0 for write and 1 for read.
28.10.10 Data
Name: DATA
Offset: 0x28
Reset: 0x0000
Property: -
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
DATA[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: DBGCTRL
Offset: 0x30
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
DBGSTOP
Access R/W
Reset 0
29.1 Overview
The Inter-IC Sound Controller (I2S) provides bidirectional, synchronous and digital audio link with external audio
devices.
This controller is compliant with the Inter-IC Sound (I2S) bus specification. It supports TDM interface with external
multi-slot audio codecs. It also supports Pulse Density Modulation (PDM) interface with external MEMS microphones.
The I2S consists of two Clock Units and two Serializers, that can be enabled separately, to provide Master, Slave, or
controller modes, and operate as Receiver or Transmitter.
The pins associated with I2S peripheral are SDm, FSn, SCKn, and MCKn pins, where n=[0,1] denotes the Clock Unit
and m=[0,1] is the Serializers instance.
FSn is referred to as Word Select in standard I2S mode operation and as Frame Sync in TDM mode. Peripheral
DMAC channels, separate for each Serializer, allow a continuous high bitrate data transfer without processor
intervention to the following:
• Audio codecs in Master, Slave, or Controller mode
• Stereo DAC or ADC through dedicated I2S serial interface
• Multi-slot or multiple stereo DACs or ADCs, using the TDM format
• Mono or stereo MEMS microphones, using the PDM interface
• 1-channel burst transfer with non-periodic Frame Sync
Each Serializer supports using either a single DMAC channel for all data channels, or two separate DMAC channels
for different data channels.
The I2S supports 8-bit and 16-bit compact stereo format. This helps in reducing the required DMA bandwidth by
transferring the left and right samples within the same data word.
Usually, an external audio codec or digital signal processor (DSP) requires a clock which is a multiple of the sampling
frequency fs (for example, 384×fs). The I2S peripheral in Master Mode and Controller mode is capable of outputting
an output clock ranging from 16×fs to 1024×fs on the Master Clock pin (MCKn).
29.2 Features
• Compliant with Inter-IC Sound (I2S) bus specification
• 2 independent Serializers configurable as receiver or as transmitter
• Supported data formats:
– 32-, 24-, 20-, 18-, 16-, and 8-bit mono or stereo format
– 16- and 8-bit compact stereo format, with left and right samples packed in the same word to reduce data
transfers
• Supported data frame formats:
– 2-channel I2S with Word Select
– 1- to 8-slot Time Division Multiplexed (TDM) with Frame Sync and individually enabled slots
– 1- or 2-channel Pulse Density Modulation (PDM) reception for MEMS microphones
– 1-channel burst transfer with non-periodic Frame Sync
• 2 independent Clock Units handling either the same clock or separate clocks for the Serializers:
– Suitable for a wide range of sample frequencies fs, including 32kHz, 44.1kHz, 48kHz, 88.2kHz, 96kHz, and
192kHz
– 16×fs to 1024×fs Master Clock generated for external audio CODECs
• Master, slave, and controller modes:
– Master: Data received/transmitted based on internally-generated clocks. Output Serial Clock on SCKn pin,
Master Clock on MCKn pin, and Frame Sync Clock on FSn pin
– Slave: Data received/transmitted based on external clocks on Serial Clock pin (SCKn) or Master Clock pin
(MCKn)
– Controller: Only output internally generated Master clock (MCKn), Serial Clock (SCKn), and Frame Sync
Clock (FSn)
• Individual enabling and disabling of Clock Units and Serializers
• DMA interfaces for each Serializer receiver or transmitter to reduce processor overhead:
– Either one DMA channel for all data slots or
– One DMA channel per data channel in stereo
• Smart Data Holding register management to avoid data slots mix after overrun or underrun
29.5.3 Clocks
The clock for the I2S bus interface (CLK_I2S_APB) is generated by the Power Manager. This clock is disabled at
reset, and can be enabled in the Power Manager. It is recommended to disable the I2S before disabling the clock, to
avoid freezing the I2S in an undefined state.
There are two generic clocks, GCLK_I2S_0 and GCLK_I2S_1, connected to the I2S peripheral, one for each I2S
clock unit. The generic clocks (GCLK_I2S_n, n=0..1) can be set to a wide range of frequencies and clock sources.
The GCLK_I2S_n must be enabled and configured before use.
The GCLK_I2S_n clocks must be enabled and configured before triggering Software Reset, so that the logic in all
clock domains can be reset.
The generic clocks are only used in Master mode and Controller mode. In Master mode, the clock from a single clock
unit can be used for both Serializers to handle synchronous transfers, or a separate clock from different clock units
can be used for each Serializer to handle transfers on non-related clocks.
Related Links
29.5.4 DMA
The DMA request lines are connected to the DMA Controller (DMAC). Using the I2S DMA requests requires the DMA
Controller to be configured first.
Related Links
20. DMAC – Direct Memory Access Controller
29.5.5 Interrupts
The interrupt request line is connected to the interrupt controller. Using I2S interrupts requires the interrupt controller
to be configured first.
Related Links
11.2 Nested Vector Interrupt Controller
29.5.6 Events
Not applicable.
1-channel burst transfer with non-periodic Frame Sync mode is useful typically for passing control non-auto data as in
case of DSP. In Burst mode, a single Data transfer starts at each Frame Sync pulse, and these pulses are 1-bit wide
and occur only when a Data transfer is requested.
Sections 29.6.4 I2S Format - Reception and Transmission Sequence with Word Select, 29.6.5 TDM Format -
Reception and Transmission Sequence and 29.7 I2S Application Examples describe more about frame/data formats
and register settings required for different I2S applications.
Figure 29-3. I2S Functional Block Diagram
29.6.1.1 Initialization
The I2S features two Clock Units, and two Serializers configurable as Receiver or Transmitter. The two Serializers
can either share the same Clock Unit or use separate Clock Units.
Before enabling the I2S, the following registers must be configured:
• Clock Control registers (CLKCTRLn)
• Serializer Control registers (SERCTRLm)
In Master mode, one of the generic clocks for the I2S must also be configured to operate at the required frequency, as
described in 29.6.1 Principle of Operation.
• fs is the sampling frequency that defines the frame period
• CLKCTRLn.NBSLOTS defines the number of slots in each frame
• CLKCTRLn.SLOTSIZE defines the number of bits in each slot
• SCKn frequency must be fSCKn = fs × number_of_slots × number_of_bits_per_slot)
Once the configuration has been written, the I2S Clock Units and Serializers can be enabled by writing a '1' to the
CKENn and SERENm bits and to the ENABLE bit in the Control register (CTRLA). The Clock Unit n can be enabled
alone, in Controller Mode, to output clocks to the MCKn, SCKn, and FSn pins. The Clock Units must be enabled if
Serializers are enabled.
The Clock Units and the Serializers can be disabled independently by writing a '0' to CTRLA.CKENn or
CTRLA.SERENm, respectively. Once requested to stop, they will only stop when the pending transmit frames will be
completed, if any. When requested to stop, the ongoing reception of the current slot will be completed and then the
Serializer will be stopped.
The clock frequencies �SCKn and �MCKn are derived from the generic clock frequency �GCLK_I2S_n :
�GCLK_I2S_n = �SCKn × CLKCTRLn.MCKDIV + 1
•
= 8 × �� × NBSLOTS + 1 × SLOTSIZE + 1 × MCKDIV + 1
, and
• �GCLK_I2S_n = �MCKn × MCKOUTDIV + 1 .
Substituting the right hand sides of the two last equations yields:
�GCLK_I2S_n
�MCKn =
MCKOUTDIV+1
8 ⋅ SLOTSIZE+1 ⋅ NBSLOTS+1 ⋅ MCKDIV+1
�MCKn =
MCKOUTDIV+1
If a Master Clock output is not required, the GCLK_I2S generic clock can be configured as SCKn by writing a '0'to
CLKCTRLn.MCKDIV. Alternatively, if the frequency of the generic clock is a multiple of the required SCKn frequency,
the MCKn-to-SCKn divider can be used with the ratio defined by writing the CLKCTRLn.MCKDIV field.
The FSn pin is used as Word Select in I2S format and as Frame Synchronization in TDM format, as described in
29.6.4 I2S Format - Reception and Transmission Sequence with Word Select and 29.6.5 TDM Format - Reception
and Transmission Sequence, respectively.
A receive overrun condition occurs if a new data word becomes available before the previous data word has been
read from the DATAm register. Then, the Receive Overrun bit in INTFLAG will be set (INTFLAG.RXORm). This
interrupt can be cleared by writing a '1' to it.
29.6.4 I2S Format - Reception and Transmission Sequence with Word Select
As specified in the I2S protocol, data bits are left-adjusted in the Word Select slot, with the MSB transmitted first,
starting one clock period after the transition on the Word Select line.
Figure 29-5. I2S Reception and Transmission Sequence
Data bits are sent on the falling edge of the Serial Clock and sampled on the rising edge of the Serial Clock. The
Word Select line indicates the channel in transmission, a low level for the left channel and a high level for the right
channel.
In I2S format, typical configurations are described below. These configurations do not list all necessary settings, but
only basic ones. Other configuration settings are to be done as per requirement such as clock and DMA
configurations.
Data bits are sent on the falling edge of the Serial Clock and sampled on the rising edge of the Serial Clock. The FSn
pin provides a frame synchronization signal, at the beginning of slot 0. The delay between the frame start and the first
data bit is defined by writing the CLKCTRLn.BITDELAY field.
The Frame Sync pulse can be either one SCKn period (BIT), one slot (SLOT), or one half frame (HALF). This
selection is done by writing the CLKCTRLn.FSWIDTH field.
The number of slots is selected by writing the CLKCTRLn.NBSLOTS field.
The number of bits in each slot is selected by writing the CLKCTRLn.SLOTSIZE field.
The length of transmitted words can be chosen among 8, 16, 18, 20, 24, and 32 bits by writing the DATASIZE field in
the Serializer Control register (SERCTRLm).
If the slot allows more data bits than the number of bits specified in the SERCTRLmDATASIZE bit field, additional bits
are appended to the transmitted or received data word as specified in the SERCTRLmEXTEND bit field. If the slot
allows less data bits than programmed, the extra bits are not transmitted, or received data word is extended based on
the EXTEND field value.
Based on oversampling frequency requirement from PDM microphone, the SCKn frequency must be configured in
the I2S controller.
After selecting a proper frequency for GCLK_I2S_n and according Master Clock Division Factor in the Clock Unit n
Control register (CLKCTRLn.MCKDIV), SCKn must be selected as per required frequency.
In PDM mode, only the clock and data line (SCKn and SDIn) pins are used.
To configure PDM2 mode, set SLOTSIZE = 0x01 (16-bits), NBSLOTS = 0x00 (1 slots) and SERCTRL0.DATASIZE =
0x00 (32-bit).
The DMAC reads from the DATAm register and writes to the DATAm register for all data slots, successively.
The DMAC transfers may use 32-, 16- or or 8-bit transactions according to the value of the SERCTRLm.DATASIZE
field. 8-bit compact stereo uses 16-bit and 16-bit compact stereo uses 32-bit transactions.
29.6.8.2 Interrupts
The I2S has the following interrupt sources:
• Receive Ready (RXRDYm): this is an asynchronous interrupt and can be used to wake-up the device from any
sleep mode.
• Receive Overrun (RXORm): this is an asynchronous interrupt and can be used to wake-up the device from any
sleep mode.
• Transmit Ready (TXRDYm): this is an asynchronous interrupt and can be used to wake-up the device from any
sleep mode.
• Transmit Underrun (TXURm): this is an asynchronous interrupt and can be used to wake-up the device from any
sleep mode.
Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status and Clear
(INTFLAG) register is set when the interrupt condition occurs. Each interrupt can be individually enabled by writing a
one to the corresponding bit in the Interrupt Enable Set (INTENSET) register, and disabled by writing a one to the
corresponding bit in the Interrupt Enable Clear (INTENCLR) register. An interrupt request is generated when the
interrupt flag is set and the corresponding interrupt is enabled. The interrupt request remains active until the interrupt
flag is cleared, the interrupt is disabled, or the I2S is reset. See INTFLAG register for details on how to clear interrupt
flags. All interrupt requests from the peripheral are ORed together on system level to generate one combined
interrupt request to the NVIC. Refer to Nested Vector Interrupt Controller for details. The user must read the
INTFLAG register to determine which interrupt condition is present.
Note: Interrupts must be globally enabled for interrupt requests to be generated. Refer to Nested Vector Interrupt
Controller for details.
Related Links
11.2 Nested Vector Interrupt Controller
29.6.8.3 Events
Not applicable.
29.6.10 Synchronization
Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be
synchronized when written or read.
When executing an operation that requires synchronization, the corresponding Synchronization Busy bit in the
Synchronization Busy register (SYNCBUSY) will be set immediately, and cleared when synchronization is complete.
If an operation that requires synchronization is executed while the corresponding SYNCBUSY bit is '1', a peripheral
bus error is generated.
The following bits are synchronized when written:
• Software Reset bit in the Control A register (CTRLA.SWRST). SYNCBUSY.SWRST is set to '1' while
synchronization is in progress.
• Enable bit in the Control A register (CTRLA.ENABLE). SYNCBUSY.ENABLE is set to '1' while synchronization is
in progress.
• Clock Unit x Enable bits in the Control A register (CTRLA.CKENx). SYNCBUSY.CKENx is set to '1' while
synchronization is in progress.
• Serializer x Enable bits in the Control A register (CTRLA.SERENx). SYNCBUSY.SERENx is set to '1' while
synchronization is in progress.
The following registers require synchronization when read or written:
• Data n registers (DATAn), Read-Synchronized when Serializer n is in Rx mode or Write-Synchronized when in
Tx mode. SYNCBUSY.DATAn is set to '1' while synchronization is in progress.
Synchronization is denoted by the Read-Synchronized or Write-Synchronized property in the register description.
Related Links
Serial Clock
Word Select
Master Clock
MCKn
Serial Clock
SCKn EXTERNAL
AUDIO
Frame Sync
I2S FSn CODEC
for First
Serial Data Out Time Slot
SDO
Serial Data In
SDI
EXTERNAL
AUDIO
CODEC
for Second
Time Slot
Serial Clock
Dstart Dend
Serial Data Out
Serial Data In
Serial Clock
SCKn
Serial Data In
SDI
Serial Clock
Serial Data In
MCKn
64 fs Serial Clock
SCKn
2
IS EXTERNAL PDM
MICROPHONE
FSn
for Left
Serial Data In Channel
SDI
L/RSEL VDD
EXTERNAL PDM
MICROPHONE
for Right
Channel
L/RSEL GND
Serial Clock
Serial Data In Right Left Right Left Right Left Right Left Right
29.9.1 Control A
Name: CTRLA
Offset: 0x00
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
SEREN1 SEREN0 CKEN1 CKEN0 ENABLE SWRST
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 1 – ENABLE Enable
Writing a '0' to this bit will disable the module.
Writing a '1' to this bit will enable the module.
Value Description
0 The peripheral is disabled.
1 The peripheral is enabled.
Name: CLKCTRLn
Offset: 0x04 + n*0x04 [n=0..1]
Reset: 0x00000000
Property: Enable-Protected, PAC Write-Protection
Bit 31 30 29 28 27 26 25 24
MCKOUTINV SCKOUTINV FSOUTINV MCKOUTDIV[4:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
MCKDIV[4:0] MCKEN MCKSEL
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
SCKSEL FSINV FSSEL
Access R/W R/W R/W
Reset 0 0 0
Bit 7 6 5 4 3 2 1 0
BITDELAY FSWIDTH[1:0] NBSLOTS[2:0] SLOTSIZE[1:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: INTENCLR
Offset: 0x0C
Reset: 0x0000
Property: PAC Write-Protection
Bit 15 14 13 12 11 10 9 8
TXUR1 TXUR0 TXRDY1 TXRDY0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
RXOR1 RXOR0 RXRDY1 RXRDY0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: INTENSET
Offset: 0x10
Reset: 0x0000
Property: PAC Write-Protection
Bit 15 14 13 12 11 10 9 8
TXUR1 TXUR0 TXRDY1 TXRDY0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
RXOR1 RXOR0 RXRDY1 RXRDY0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: INTFLAG
Offset: 0x14
Reset: 0x0000
Property: -
Bit 15 14 13 12 11 10 9 8
TXUR1 TXUR0 TXRDY1 TXRDY0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
RXOR1 RXOR0 RXRDY1 RXRDY0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: SYNCBUSY
Offset: 0x18
Reset: 0x0000
Property: -
Bit 15 14 13 12 11 10 9 8
DATA1 DATA0
Access R R
Reset 0 0
Bit 7 6 5 4 3 2 1 0
SEREN1 SEREN0 CKEN1 CKEN0 ENABLE SWRST
Access R R R R R R
Reset 0 0 0 0 0 0
Name: SERCTRLn
Offset: 0x20 + n*0x04 [n=0..1]
Reset: 0x00000000
Property: Enable-Protected, PAC Write-Protection
Bit 31 30 29 28 27 26 25 24
RXLOOP DMA MONO
Access R/W R/W R/W
Reset 0 0 0
Bit 23 22 21 20 19 18 17 16
SLOTDIS7 SLOTDIS6 SLOTDIS5 SLOTDIS4 SLOTDIS3 SLOTDIS2 SLOTDIS1 SLOTDIS0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
BITREV EXTEND[1:0] WORDADJ DATASIZE[2:0]
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
SLOTADJ CLKSEL TXSAME TXDEFAULT[1:0] SERMODE[1:0]
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Bits 16, 17, 18, 19, 20, 21, 22, 23 – SLOTDISx Slot x Disabled for this Serializer [x=7..0]
This field allows disabling some slots in each transmit frame:
Value Description
0 Slot x is used for data transfer.
1 Slot x is not used for data transfer and will be output as specified in the TXDEFAULT field.
Name: DATAm
Offset: 0x30 + m*0x04 [m=0..1]
Reset: 0x00000000
Property: Read-Synchronized, Write-Synchronized
Bit 31 30 29 28 27 26 25 24
DATA[31:24]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
DATA[23:16]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
DATA[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
DATA[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
29.9.9 Rx Data
Name: RXDATA
Offset: 0x34
Reset: 0x00000000
Property: Read-Synchronized
Bit 31 30 29 28 27 26 25 24
DATA[31:24]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
DATA[23:16]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
DATA[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
DATA[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
30. TC – Timer/Counter
30.1 Overview
The TC consists of a counter, a prescaler, compare/capture channels and control logic. The counter can be set to
count events, or it can be configured to count clock pulses. The counter, together with the compare/capture channels,
can be configured to timestamp input events, allowing capture of frequency and pulse width. It can also perform
waveform generation, such as frequency generation and pulse-width modulation (PWM).
30.2 Features
• Selectable configuration
– Up to five 16-bit Timer/Counters (TC), each configurable as:
• 8-bit TC with two compare/capture channels
• 16-bit TC with two compare/capture channels
• 32-bit TC with two compare/capture channels, by using two TCs
• Waveform generation
– Frequency generation
– Single-slope pulse-width modulation
• Input capture
– Event capture
– Frequency capture
– Pulse-width capture
• One input event
• Interrupts/output events on:
– Counter overflow/underflow
– Compare match or capture
• Internal prescaler
• Can be used with DMA and to trigger DMA transactions
BASE COUNTER
PER
PRESCALER
count
COUNTER OVF/UNF
clear (INT Req.)
load CONTROL
COUNT LOGIC
direction
ERR
(INT Req.)
Top
=
Update
Zero
event
=0
Compare / Capture
CONTROL
LOGIC
WOx Out
CC0 WAVEFORM
GENERATION
match MCx
= (INT Req.)
Refer to I/O Multiplexing and Considerations for details on the pin mapping for this peripheral. One signal can be
mapped on several pins.
Related Links
30.5.3 Clocks
The TC bus clock (CLK_TCx_APB, where x represents the specific TC instance number) can be enabled and
disabled in the Power Manager, and the default state of CLK_TCx_APB can be found in the Peripheral Clock
Masking section in “PM – Power Manager”.
The different TC instances are paired, even and odd, starting from TC3, and use the same generic clock,
GCLK_TCx. This means that the TC instances in a TC pair cannot be set up to use different GCLK_TCx clocks.
This generic clock is asynchronous to the user interface clock (CLK_TCx_APB). Due to this asynchronicity, accessing
certain registers will require synchronization between the clock domains. Refer to 30.6.6 Synchronization for further
details.
Related Links
16.6.2.6 Peripheral Clock Masking
30.5.4 DMA
The DMA request lines are connected to the DMA Controller (DMAC). In order to use DMA requests with this
peripheral the DMAC must be configured first. Refer to DMAC – Direct Memory Access Controller for details.
Related Links
20. DMAC – Direct Memory Access Controller
30.5.5 Interrupts
The interrupt request line is connected to the Interrupt Controller. In order to use interrupt requests of this peripheral,
the Interrupt Controller (NVIC) must be configured first. Refer to Nested Vector Interrupt Controller for details.
Related Links
11.2 Nested Vector Interrupt Controller
30.5.6 Events
The events of this peripheral are connected to the Event System.
Related Links
24. EVSYS – Event System
Name Description
TOP The counter reaches TOP when it becomes equal to the highest value in the
count sequence. The TOP value can be the same as Period (PER) or the
Compare Channel 0 (CC0) register value depending on the waveform generator
mode in Waveform Output Operations.
ZERO The counter is ZERO when it contains all zeroes
MAX The counter reaches MAX when it contains all ones
UPDATE The timer/counter signals an update when it reaches ZERO or TOP, depending
on the direction settings.
Timer The timer/counter clock control is handled by an internal source
Counter The clock control is handled externally (e.g. counting external events)
CC For compare operations, the CC are referred to as “compare channels”
For capture operations, the CC are referred to as “capture channels.”
The counter in the TC can either count events from the Event System, or clock ticks of the GCLK_TCx clock, which
may be divided by the prescaler.
The counter value is passed to the CCx where it can be either compared to user-defined values or captured.
The compare and capture registers (CCx) and counter register (COUNT) can be configured as 8-, 16- or 32-bit
registers, with according MAX values. Mode settings determine the maximum range of the counter.
In 8-bit mode, Period Value (PER) is also available. The counter range and the operating frequency determine the
maximum time resolution achievable with the TC peripheral.
The TC can be set to count up or down. Under normal operation, the counter value is continuously compared to the
TOP or ZERO value to determine whether the counter has reached that value. On a comparison match the TC can
request DMA transactions, or generate interrupts or events for the Event System. On a comparison match the TC can
request DMA transactions, or generate interrupts or events for the Event System.
In compare operation, the counter value is continuously compared to the values in the CCx registers. In case of a
match the TC can request DMA transactions, or generate interrupts or events for the Event System. In waveform
generator mode, these comparisons are used to set the waveform period or pulse width.
Capture operation can be enabled to perform input signal period and pulse width measurements, or to capture
selectable edges from an internal event from Event System.
30.6.2.1 Initialization
The following registers are enable-protected, meaning that they can only be written when the TC is disabled
(CTRLA.ENABLE =0):
• Control A register (CTRLA), except the Run Standby (RUNSTDBY), Enable (ENABLE) and Software Reset
(SWRST) bits
Enable-protected bits in the CTRLA register can be written at the same time as CTRLA.ENABLE is written to '1', but
not at the same time as CTRLA.ENABLE is written to '0'. Enable-protection is denoted by the "Enable-Protected"
property in the register description. The following bits are enable-protected:
• Event Action bits in the Event Control register (EVCTRL.EVACT)
Before enabling the TC, the peripheral must be configured by the following steps:
1. Enable the TC bus clock (CLK_TCx_APB).
2. Select 8-, 16- or 32-bit counter mode via the TC Mode bit group in the Control A register (CTRLA.MODE). The
default mode is 16-bit.
3. Select one wave generation operation in the Waveform Generation Operation bit group in the Control A
register (CTRLA.WAVEGEN).
4. If desired, the GCLK_TCx clock can be prescaled via the Prescaler bit group in the Control A register
(CTRLA.PRESCALER).
– If the prescaler is used, select a prescaler synchronization operation via the Prescaler and Counter
Synchronization bit group in the Control A register (CTRLA.PRESYNC).
5. Select one-shot operation by writing a '1' to the One-Shot bit in the Control B Set register
(CTRLBSET.ONESHOT).
6. If desired, configure the counting direction 'down' (starting from the TOP value) by writing a '1' to the Counter
Direction bit in the Control B register (CTRLBSET.DIR).
7. For capture operation, enable the individual channels to capture in the Capture Channel x Enable bit group in
the Control C register (CTRLC.CPTEN).
8. If desired, enable inversion of the waveform output or IO pin input signal for individual channels via the
Waveform Output Invert Enable bit group in the Control C register (CTRLC.INVEN).
GCLK_TC /
GCLK_TC Prescaler {1,2,4,8,64,256,1024}
CLK_TC_CNT COUNT
EVENT
MAX
"reload" update
"clear" update
TOP
COUNT
ZERO
DIR
3. Configure the pins with the I/O Pin Controller. Refer to PORT - I/O Pin Controller for details.
The counter value is continuously compared with each CCx value. On a comparison match, the Match or Capture
Channel x bit in the Interrupt Flag Status and Clear register (INTFLAG.MCx) will be set on the next zero-to-one
transition of CLK_TC_CNT (see the next figure). An interrupt/and or event can be generated on comparison match
when INTENSET.MCx=1 and/or EVCTRL.MCEOx=1.
There are four waveform configurations for the Waveform Generation Operation bit group in the Control A register
(CTRLA.WAVEGEN) . This will influence how the waveform is generated and impose restrictions on the top value.
The configurations are:
• Normal frequency (NFRQ)
• Match frequency (MFRQ)
• Normal pulse-width modulation (NPWM)
• Match pulse-width modulation (MPWM)
When using NPWM or NFRQ configuration, the TOP will be determined by the counter resolution. In 8-bit counter
mode, the Period register (PER) is used as TOP, and the TOP can be changed by writing to the PER register. In 16-
and 32-bit counter mode, TOP is fixed to the maximum (MAX) value of the counter.
Related Links
23. PORT - I/O Pin Controller
CCx
ZERO
WO[x]
Match Frequency Generation (MFRQ)
For Match Frequency Generation, the period time (T) is controlled by the CC0 register instead of PER or MAX. WO[0]
toggles on each update condition.
MAX
"reload" update
"clear" update
CC0
COUNT
ZERO
WO[0]
COUNT
CC1
ZERO
WO[1]
The table below shows the update counter and overflow event/interrupt generation conditions in different operation
modes.
Counter Wraparound
MAX
"clear" update
"write"
COUNT
ZERO
MAX
"reload" update
"write"
COUNT
ZERO
events
TOP
COUNT
ZERO
The TC can detect capture overflow of the input capture channels: When a new capture event is detected while the
Capture Interrupt flag (INTFLAG.MCx) is still set, the new timestamp will not be stored and INTFLAG.ERR will be set.
1 ��
�= dutyCycle =
� �
Selecting PWP (pulse-width, period) in the Event Action bit group in the Event Control register (EVCTRL.EVACT)
enables the TC to perform one capture action on the rising edge and the other one on the falling edge. The period T
will be captured into CC1 and the pulse width tp in CC0. EVCTRL.EVACT=PPW (period and pulse-width)offers
identical functionality, but will capture T into CC0 and tp into CC1.
The TC Event Input Invert Enable bit in the Event Control register (EVCTRL.TCINV) is used to select whether the
wraparound should occur on the rising edge or the falling edge. If EVCTRL.TCINV=1, the wraparound will happen on
the falling edge.
To fully characterize the frequency and duty cycle of the input signal, activate capture on CC0 and CC1 by writing 0x3
to the Capture Channel x Enable bit group in the Control C register (CTRLC.CPTEN). When only one of these
measurements is required, the second channel can be used for other purposes.
The TC can detect capture overflow of the input capture channels: When a new capture event is detected while the
Capture Interrupt flag (INTFLAG.MCx) is still set, the new timestamp will not be stored and INTFLAG.ERR will be set.
Period (T)
events
MAX
"capture"
COUNT
ZERO
CC0 CC1 CC0 CC1
Condition Interrupt Event output Event input DMA request DMA request is
request cleared
Overflow / YES YES YES Cleared on next
Underflow clock cycle
Channel YES YES YES1 For compare
Compare Match channel –
or Capture Cleared on next
clock cycle.
For capture
channel – cleared
when CCx
register is read
...........continued
Condition Interrupt Event output Event input DMA request DMA request is
request cleared
Start Counter YES
Retrigger YES
Counter
Increment / YES
Decrement
counter
Simple Capture YES
Period Capture YES
Pulse Width YES
Capture
Note: 1. Two DMA requests lines are available, one for each compare/capture channel.
30.6.4.2 Interrupts
The TC has the following interrupt sources:
• Overflow/Underflow (OVF)
• Match or Capture Channel x (MCx)
• Capture Overflow Error (ERR)
• Synchronization Ready (SYNCRDY)
Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status and Clear
register (INTFLAG) is set when the interrupt condition occurs.
Each interrupt can be individually enabled by writing a '1' to the corresponding bit in the Interrupt Enable Set register
(INTENSET), and disabled by writing a '1' to the corresponding bit in the Interrupt Enable Clear register (INTENCLR).
An interrupt request is generated when the interrupt flag is set and the corresponding interrupt is enabled. The
interrupt request remains active until either the interrupt flag is cleared, the interrupt is disabled, or the TC is reset. on
how to clear interrupt flags.
The TC has one common interrupt request line for all the interrupt sources. The user must read the INTFLAG register
to determine which interrupt condition is present.
Note that interrupts must be globally enabled for interrupt requests to be generated. Refer to Nested Vector Interrupt
Controller for details.
Related Links
11.2 Nested Vector Interrupt Controller
30.6.4.3 Events
The TC can generate the following output events:
• Overflow/Underflow (OVF)
• Match or Capture (MC)
Writing a '1' to an Event Output bit in the Event Control register (EVCTRL.MCEOx) enables the corresponding output
event. The output event is disabled by writing EVCTRL.MCEOx=0.
One of the following event actions can be selected by the Event Action bit group in the Event Control register
(EVCTRL.EVACT):
• Start TC (START)
• Re-trigger TC (RETRIGGER)
• Increment or decrement counter (depends on counter direction)
• Count on event (COUNT)
• Capture Period (PPW and PWP)
Writing a '1' to the TC Event Input bit in the Event Control register (EVCTRL.TCEI) enables input events to the TC.
Writing a '0' to this bit disables input events to the TC. The TC requires only asynchronous event inputs. For further
details on how configuring the asynchronous events, refer to EVSYS - Event System.
Related Links
24. EVSYS – Event System
30.6.6 Synchronization
Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be
synchronized when written or read.
The following bits are synchronized when written:
• Software Reset bit in the Control A register (CTRLA.SWRST)
• Enable bit in the Control A register (CTRLA.ENABLE)
Required write-synchronization is denoted by the "Write-Synchronized" property in the register description.
The following registers are synchronized when written:
• Control B Clear register (CTRLBCLR)
• Control B Set register (CTRLBSET)
• Control C register (CTRLC)
• Count Value register (COUNT)
• Period Value register (PER)
• Compare/Capture Value registers (CCx)
Required write-synchronization is denoted by the "Write-Synchronized" property in the register description.
The following registers are synchronized when read:
• Control B Clear register (CTRLBCLR)
• Control B Set register (CTRLBSET)
• Control C register (CTRLC)
• Count Value register (COUNT)
• Period Value register (PER)
• Compare/Capture Value registers (CCx)
Required read-synchronization is denoted by the "Read-Synchronized" property in the register description.
Related Links
14.3 Register Synchronization
30.8.1 Control A
Name: CTRLA
Offset: 0x00
Reset: 0x00000000
Property: PAC Write-Protection, Write-Synchronized, Enable-Protected
Bit 15 14 13 12 11 10 9 8
PRESCSYNC[1:0] RUNSTDBY PRESCALER[2:0]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
WAVEGEN[1:0] MODE[1:0] ENABLE SWRST
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Note:
1. This depends on the TC mode. In 8-bit mode, the top value is the Period Value register (PER). In 16- and 32-
bit mode it is the maximum value.
Bit 1 – ENABLE Enable
Due to synchronization, there is delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The
value written to CTRLA.ENABLE will read back immediately, and the ENABLE Synchronization Busy bit in the
SYNCBUSY register (SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE will be cleared when the operation is
complete.
This bit is not enable protected.
Value Description
0 The peripheral is disabled.
1 The peripheral is enabled.
Name: READREQ
Offset: 0x02
Reset: 0x0000
Bit 15 14 13 12 11 10 9 8
RREQ RCONT
Access W R/W
Reset 0 0
Bit 7 6 5 4 3 2 1 0
ADDR[4:0]
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Name: CTRLBCLR
Offset: 0x04
Reset: 0x00
Property: PAC Write-Protection, Read-Synchronized, Write-Synchronized
This register allows the user to clear bits in the CTRLB register without doing a read-modify-write operation. Changes
in this register will also be reflected in the Control B Set register (CTRLBSET).
Bit 7 6 5 4 3 2 1 0
CMD[1:0] ONESHOT DIR
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: CTRLBSET
Offset: 0x05
Reset: 0x00
Property: PAC Write-Protection, Read-synchronized, Write-Synchronized
This register allows the user to set bits in the CTRLB register without doing a read-modify-write operation. Changes
in this register will also be reflected in the Control B Clear register (CTRLBCLR).
Bit 7 6 5 4 3 2 1 0
CMD[1:0] ONESHOT DIR
Access R/W R/W R/W R/W
Reset 0 0 0 0
30.8.5 Control C
Name: CTRLC
Offset: 0x06
Reset: 0x00
Property: PAC Write-Protection, Read-synchronized, Write-Synchronized
Bit 7 6 5 4 3 2 1 0
CPTEN1 CPTEN0 INVEN1 INVEN0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: DBGCTRL
Offset: 0x08
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
DBGRUN
Access R/W
Reset 0
Name: EVCTRL
Offset: 0x0A
Reset: 0x0000
Property: PAC Write-Protection, Enable-Protected
Bit 15 14 13 12 11 10 9 8
MCEO1 MCEO0 OVFEO
Access R/W R/W R/W
Reset 0 0 0
Bit 7 6 5 4 3 2 1 0
TCEI TCINV EVACT[2:0]
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Name: INTENCLR
Offset: 0x0C
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Set register (INTENSET).
Bit 7 6 5 4 3 2 1 0
MC1 MC0 SYNCRDY ERR OVF
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Name: INTENSET
Offset: 0x0D
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Clear register (INTENCLR).
Bit 7 6 5 4 3 2 1 0
MC1 MC0 SYNCRDY ERR OVF
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Name: INTFLAG
Offset: 0x0E
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
MC1 MC0 SYNCRDY ERR OVF
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
30.8.11 Status
Name: STATUS
Offset: 0x0F
Reset: 0x08
Property: -
Bit 7 6 5 4 3 2 1 0
SYNCBUSY STOP
Access R R
Reset 0 1
Name: COUNT
Offset: 0x10
Reset: 0x00
Property: PAC Write-Protection, Write-Synchronized, Read-Synchronized
Bit 7 6 5 4 3 2 1 0
COUNT[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: PER
Offset: 0x14
Reset: 0xFF
Property: Write-Synchronized
Bit 7 6 5 4 3 2 1 0
PER[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 1
Name: CCx
Offset: 0x18 + x*0x01 [x=0..1]
Reset: 0x00
Property: Write-Synchronized
Bit 7 6 5 4 3 2 1 0
CC[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
30.10.1 Control A
Name: CTRLA
Offset: 0x00
Reset: 0x00000000
Property: PAC Write-Protection, Write-Synchronized, Enable-Protected
Bit 15 14 13 12 11 10 9 8
PRESCSYNC[1:0] RUNSTDBY PRESCALER[2:0]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
WAVEGEN[1:0] MODE[1:0] ENABLE SWRST
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Note:
1. This depends on the TC mode. In 8-bit mode, the top value is the Period Value register (PER). In 16- and 32-
bit mode it is the maximum value.
Bit 1 – ENABLE Enable
Due to synchronization, there is delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The
value written to CTRLA.ENABLE will read back immediately, and the ENABLE Synchronization Busy bit in the
SYNCBUSY register (SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE will be cleared when the operation is
complete.
This bit is not enable protected.
Value Description
0 The peripheral is disabled.
1 The peripheral is enabled.
Name: READREQ
Offset: 0x02
Reset: 0x0000
Bit 15 14 13 12 11 10 9 8
RREQ RCONT
Access W R/W
Reset 0 0
Bit 7 6 5 4 3 2 1 0
ADDR[4:0]
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Name: CTRLBCLR
Offset: 0x04
Reset: 0x00
Property: PAC Write-Protection, Read-Synchronized, Write-Synchronized
This register allows the user to clear bits in the CTRLB register without doing a read-modify-write operation. Changes
in this register will also be reflected in the Control B Set register (CTRLBSET).
Bit 7 6 5 4 3 2 1 0
CMD[1:0] ONESHOT DIR
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: CTRLBSET
Offset: 0x05
Reset: 0x00
Property: PAC Write-Protection, Read-synchronized, Write-Synchronized
This register allows the user to set bits in the CTRLB register without doing a read-modify-write operation. Changes
in this register will also be reflected in the Control B Clear register (CTRLBCLR).
Bit 7 6 5 4 3 2 1 0
CMD[1:0] ONESHOT DIR
Access R/W R/W R/W R/W
Reset 0 0 0 0
30.10.5 Control C
Name: CTRLC
Offset: 0x06
Reset: 0x00
Property: PAC Write-Protection, Read-synchronized, Write-Synchronized
Bit 7 6 5 4 3 2 1 0
CPTEN1 CPTEN0 INVEN1 INVEN0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: DBGCTRL
Offset: 0x08
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
DBGRUN
Access R/W
Reset 0
Name: EVCTRL
Offset: 0x0A
Reset: 0x0000
Property: PAC Write-Protection, Enable-Protected
Bit 15 14 13 12 11 10 9 8
MCEO1 MCEO0 OVFEO
Access R/W R/W R/W
Reset 0 0 0
Bit 7 6 5 4 3 2 1 0
TCEI TCINV EVACT[2:0]
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Name: INTENCLR
Offset: 0x0C
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Set register (INTENSET).
Bit 7 6 5 4 3 2 1 0
MC1 MC0 SYNCRDY ERR OVF
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Name: INTENSET
Offset: 0x0D
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Clear register (INTENCLR).
Bit 7 6 5 4 3 2 1 0
MC1 MC0 SYNCRDY ERR OVF
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Name: INTFLAG
Offset: 0x0E
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
MC1 MC0 SYNCRDY ERR OVF
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
30.10.11 Status
Name: STATUS
Offset: 0x0F
Reset: 0x08
Property: -
Bit 7 6 5 4 3 2 1 0
SYNCBUSY STOP
Access R R
Reset 0 1
Name: COUNT
Offset: 0x10
Reset: 0x00
Property: PAC Write-Protection, Write-Synchronized, Read-Synchronized
Bit 15 14 13 12 11 10 9 8
COUNT[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
COUNT[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: CCx
Offset: 0x18 + x*0x02 [x=0..1]
Reset: 0x0000
Property: Write-Synchronized
Bit 15 14 13 12 11 10 9 8
CC[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
CC[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
30.12.1 Control A
Name: CTRLA
Offset: 0x00
Reset: 0x00000000
Property: PAC Write-Protection, Write-Synchronized, Enable-Protected
Bit 15 14 13 12 11 10 9 8
PRESCSYNC[1:0] RUNSTDBY PRESCALER[2:0]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
WAVEGEN[1:0] MODE[1:0] ENABLE SWRST
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Note:
1. This depends on the TC mode. In 8-bit mode, the top value is the Period Value register (PER). In 16- and 32-
bit mode it is the maximum value.
Bit 1 – ENABLE Enable
Due to synchronization, there is delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The
value written to CTRLA.ENABLE will read back immediately, and the ENABLE Synchronization Busy bit in the
SYNCBUSY register (SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE will be cleared when the operation is
complete.
This bit is not enable protected.
Value Description
0 The peripheral is disabled.
1 The peripheral is enabled.
Name: READREQ
Offset: 0x02
Reset: 0x0000
Bit 15 14 13 12 11 10 9 8
RREQ RCONT
Access W R/W
Reset 0 0
Bit 7 6 5 4 3 2 1 0
ADDR[4:0]
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Name: CTRLBCLR
Offset: 0x04
Reset: 0x00
Property: PAC Write-Protection, Read-Synchronized, Write-Synchronized
This register allows the user to clear bits in the CTRLB register without doing a read-modify-write operation. Changes
in this register will also be reflected in the Control B Set register (CTRLBSET).
Bit 7 6 5 4 3 2 1 0
CMD[1:0] ONESHOT DIR
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: CTRLBSET
Offset: 0x05
Reset: 0x00
Property: PAC Write-Protection, Read-synchronized, Write-Synchronized
This register allows the user to set bits in the CTRLB register without doing a read-modify-write operation. Changes
in this register will also be reflected in the Control B Clear register (CTRLBCLR).
Bit 7 6 5 4 3 2 1 0
CMD[1:0] ONESHOT DIR
Access R/W R/W R/W R/W
Reset 0 0 0 0
30.12.5 Control C
Name: CTRLC
Offset: 0x06
Reset: 0x00
Property: PAC Write-Protection, Read-synchronized, Write-Synchronized
Bit 7 6 5 4 3 2 1 0
CPTEN1 CPTEN0 INVEN1 INVEN0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: DBGCTRL
Offset: 0x08
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
DBGRUN
Access R/W
Reset 0
Name: EVCTRL
Offset: 0x0A
Reset: 0x0000
Property: PAC Write-Protection, Enable-Protected
Bit 15 14 13 12 11 10 9 8
MCEO1 MCEO0 OVFEO
Access R/W R/W R/W
Reset 0 0 0
Bit 7 6 5 4 3 2 1 0
TCEI TCINV EVACT[2:0]
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Name: INTENCLR
Offset: 0x0C
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Set register (INTENSET).
Bit 7 6 5 4 3 2 1 0
MC1 MC0 SYNCRDY ERR OVF
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Name: INTENSET
Offset: 0x0D
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Clear register (INTENCLR).
Bit 7 6 5 4 3 2 1 0
MC1 MC0 SYNCRDY ERR OVF
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Name: INTFLAG
Offset: 0x0E
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
MC1 MC0 SYNCRDY ERR OVF
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
30.12.11 Status
Name: STATUS
Offset: 0x0F
Reset: 0x08
Property: -
Bit 7 6 5 4 3 2 1 0
SYNCBUSY SLAVE STOP
Access R R R
Reset 0 0 1
Name: COUNT
Offset: 0x10
Reset: 0x00
Property: PAC Write-Protection, Write-Synchronized, Read-Synchronized
Bit 31 30 29 28 27 26 25 24
COUNT[31:24]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
COUNT[23:16]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
COUNT[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
COUNT[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: CCx
Offset: 0x18 + x*0x04 [x=0..1]
Reset: 0x00000000
Property: Write-Synchronized
Bit 31 30 29 28 27 26 25 24
CC[31:24]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
CC[23:16]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
CC[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
CC[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
31.1 Overview
The device provides three instances of the Timer/Counter for Control applications (TCC) peripheral, TCC[2:0].
Each TCC instance consists of a counter, a prescaler, compare/capture channels and control logic. The counter can
be set to count events or clock pulses. The counter together with the compare/capture channels can be configured to
time stamp input events, allowing capture of frequency and pulse-width. It can also perform waveform generation
such as frequency generation and pulse-width modulation.
Waveform extensions are featured for motor control, ballast, LED, H-bridge, power converters, and other types of
power control applications. They allow for low- and high-side output with optional dead-time insertion. Waveform
extensions can also generate a synchronized bit pattern across the waveform output pins. The fault options enable
fault protection for safe and deterministic handling, disabling and/or shut down of external drivers.
Figure 31-1 shows all features in TCC.
Note: The TCC configurations, such as channel numbers and features, may be reduced for some of the TCC
instances.
Related Links
7.2.5 TCC Configurations
31.2 Features
• Up to four compare/capture channels (CC) with:
– Double buffered period setting
– Double buffered compare or capture channel
– Circular buffer on period and compare channel registers
• Waveform generation:
– Frequency generation
– Single-slope pulse-width modulation (PWM)
– Dual-slope pulse-width modulation with half-cycle reload capability
• Input capture:
– Event capture
– Frequency capture
– Pulse-width capture
• Waveform extensions:
– Configurable distribution of compare channels outputs across port pins
– Low- and high-side output with programmable dead-time insertion
– Waveform swap option with double buffer support
– Pattern generation with double buffer support
– Dithering support
• Fault protection for safe disabling of drivers:
– Two recoverable fault sources
– Two non-recoverable fault sources
– Debugger can be source of non-recoverable fault
• Input events:
– Two input events (EVx) for counter
– One input event (MCx) for each channel
• Output events:
– Three output events (Count, Re-Trigger and Overflow) available for counter
BV PERB
PER Prescaler
"count"
Counter OVF (INT/Event/DMA Req.)
"clear"
ERR (INT Req.)
"load"
COUNT Control Logic
"direction"
"TCCx_EV0" (TCE0)
"TCCx_EV1" (TCE1)
TOP
UPDATE
= "TCCx_MCx" Event
"event"
System
BOTTOM
=0
WO[7]
WO[6]
Compare/Capture
(Unit x = {0,1,…,3})
WO[5]
Non-recoverable
Generation
WO[4]
Pattern
Faults
SWAP
Output
Matrix
"capture" WO[3]
BV CCBx Control Logic
WO[2]
Dead-Time
Insertion
Recoverable
WO[1]
CCx
Faults
Waveform
Generation
WO[0]
"match"
= MCx (INT/Event/DMA Req.)
Refer to I/O Multiplexing and Considerations for details on the pin mapping for this peripheral. One signal can be
mapped on several pins.
Related Links
7. I/O Multiplexing and Considerations
31.5.3 Clocks
The TCC bus clocks (CLK_TCCx_APB) can be enabled and disabled in the Power Manager module. The default
state of CLK_TCCx_APB can be found in the Peripheral Clock Masking section (see the Related Links below).
A generic clock (GCLK_TCCx) is required to clock the TCC. This clock must be configured and enabled in the
generic clock controller before using the TCC. Note that TCC0 and TCC1 share a peripheral clock generator.
The generic clocks (GCLK_TCCx) are asynchronous to the bus clock (CLK_TCCx_APB). Due to this asynchronicity,
writing certain registers will require synchronization between the clock domains. Refer to 31.6.6 Synchronization for
further details.
Related Links
15. GCLK - Generic Clock Controller
16.6.2.6 Peripheral Clock Masking
31.5.4 DMA
The DMA request lines are connected to the DMA Controller (DMAC). In order to use DMA requests with this
peripheral the DMAC must be configured first. Refer to DMAC – Direct Memory Access Controller for details.
Related Links
20. DMAC – Direct Memory Access Controller
31.5.5 Interrupts
The interrupt request line is connected to the Interrupt Controller. In order to use interrupt requests of this peripheral,
the Interrupt Controller (NVIC) must be configured first. Refer to Nested Vector Interrupt Controller for details.
Related Links
11.2 Nested Vector Interrupt Controller
31.5.6 Events
The events of this peripheral are connected to the Event System.
Related Links
24. EVSYS – Event System
Name Description
TOP The counter reaches TOP when it becomes equal to the highest value in the
count sequence. The TOP value can be the same as Period (PER) or the
Compare Channel 0 (CC0) register value depending on the waveform generator
mode in 31.6.2.5.1 Waveform Output Generation Operations.
ZERO The counter reaches ZERO when it contains all zeroes.
MAX The counter reaches maximum when it contains all ones.
UPDATE The timer/counter signals an update when it reaches ZERO or TOP, depending
on the direction settings.
Timer The timer/counter clock control is handled by an internal source.
Counter The clock control is handled externally (e.g., counting external events).
CC For compare operations, the CC are referred to as "compare channels."
For capture operations, the CC are referred to as "capture channels."
The MCE0 and MCE1 asynchronous event sources are shared with the Recoverable Fault Unit. Only asynchronous
events are used internally when fault unit extension is enabled. For further details on how to configure asynchronous
events routing, refer to EVSYS – Event System.
Recoverable fault sources can be filtered and/or windowed to avoid false triggering, for example from I/O pin glitches,
by using digital filtering, input blanking, and qualification options. See also 31.6.3.5 Recoverable Faults.
In order to support applications with different types of motor control, ballast, LED, H-bridge, power converter, and
other types of power switching applications, the following independent units are implemented in some of the TCC
instances as optional and successive units:
• Recoverable faults and non-recoverable faults
• Output matrix
• Dead-time insertion
• Swap
• Pattern generation
See also Figure 31-1.
The output matrix (OTMX) can distribute and route out the TCC waveform outputs across the port pins in different
configurations, each optimized for different application types. The Dead-Time Insertion (DTI) unit splits the four lower
OTMX outputs into two non-overlapping signals: the non-inverted low side (LS) and inverted high side (HS) of the
waveform output with optional dead-time insertion between LS and HS switching. The SWAP unit can swap the LS
and HS pin outputs, and can be used for fast decay motor control.
The pattern generation unit can be used to generate synchronized waveforms with constant logic level on TCC
UPDATE conditions. This is useful for easy stepper motor and full bridge control.
The non-recoverable fault module enables event controlled fault protection by acting directly on the generated
waveforms of the timer/counter compare channel outputs. When a non-recoverable fault condition is detected, the
output waveforms are forced to a preconfigured value that is safe for the application. This is typically used for instant
and predictable shut down and disabling high current or voltage drives.
The count event sources (TCE0 and TCE1) are shared with the non-recoverable fault extension. The events can be
optionally filtered. If the filter options are not used, the non-recoverable faults provide an immediate asynchronous
action on waveform output, even for cases where the clock is not present. For further details on how to configure
asynchronous events routing, refer to section EVSYS – Event System.
Related Links
24. EVSYS – Event System
31.6.2.1 Initialization
The following registers are enable-protected, meaning that they can only be written when the TCC is
disabled(CTRLA.ENABLE=0):
• Control A (CTRLA) register, except Run Standby (RUNSTDBY), Enable (ENABLE) and Software Reset
(SWRST) bits
• Recoverable Fault n Control registers (FCTRLA and FCTRLB)
• Waveform Extension Control register (WEXCTRL)
• Drive Control register (DRVCTRL)
• Event Control register (EVCTRL)
Enable-protected bits in the CTRLA register can be written at the same time as CTRLA.ENABLE is written to '1', but
not at the same time as CTRLA.ENABLE is written to '0'. Enable-protection is denoted by the “Enable-Protected”
property in the register description.
Before the TCC is enabled, it must be configured as outlined by the following steps:
1. Enable the TCC bus clock (CLK_TCCx_APB).
2. If Capture mode is required, enable the channel in capture mode by writing a '1' to the Capture Enable bit in
the Control A register (CTRLA.CPTEN).
Optionally, the following configurations can be set before enabling TCC:
GCLK_TCC PRESCALER
GCLK_TCC / COUNT
{1,2,4,8,64,256,1024 } TCCx EV0/1 CLK_TCC_COUNT
MAX
"reload" update
"clear" update
TOP
COUNT
ZERO
DIR
It is possible to change the counter value (by writing directly in the COUNT register) even when the counter is
running. The COUNT value will always be ZERO or TOP, depending on direction set by CTRLBSET.DIR or
CTRLBCLR.DIR, when starting the TCC, unless a different value has been written to it, or the TCC has been stopped
at a value other than ZERO. The write access has higher priority than count, clear, or reload. The direction of the
counter can also be changed during normal operation. See also Figure 31-3.
Stop Command
A stop command can be issued from software by using TCC Command bits in Control B Set register
(CTRLBSET.CMD=0x2, STOP).
When a stop is detected while the counter is running, the counter will maintain its current value. If the waveform
generation (WG) is used, all waveforms are set to a state defined in Non-Recoverable State x Output Enable bit and
Non- Recoverable State x Output Value bit in the Driver Control register (DRVCTRL.NREx and DRVCTRL.NRVx),
and the Stop bit in the Status register is set (STATUS.STOP).
Pause Event Action
A pause command can be issued when the stop event action is configured in the Input Event Action 1 bits in Event
Control register (EVCTRL.EVACT1=0x3, STOP).
When a pause is detected, the counter can stop immediatly maintaining its current value and all waveforms keep
their current state, as long as a start event action is detected: Input Event Action 0 bits in Event Control register
(EVCTRL.EVACT0=0x3, START).
Re-Trigger Command and Event Action
A re-trigger command can be issued from software by using TCC Command bits in Control B Set register
(CTRLBSET.CMD=0x1, RETRIGGER), or from event when the re-trigger event action is configured in the Input Event
0/1 Action bits in Event Control register (EVCTRL.EVACTn=0x1, RETRIGGER).
When the command is detected during counting operation, the counter will be reloaded or cleared, depending on the
counting direction (CTRLBSET.DIR or CTRLBCLR.DIR). The Re-Trigger bit in the Interrupt Flag Status and Clear
register will be set (INTFLAG.TRG). It is also possible to generate an event by writing a '1' to the Re-Trigger Event
Output Enable bit in the Event Control register (EVCTRL.TRGEO). If the re-trigger command is detected when the
counter is stopped, the counter will resume counting operation from the value in COUNT.
Note:
When a re-trigger event action is configured in the Event Action bits in the Event Control register
(EVCTRL.EVACTn=0x1, RETRIGGER), enabling the counter will not start the counter. The counter will start on the
next incoming event and restart on corresponding following event.
Start Event Action
The start action can be selected in the Event Control register (EVCTRL.EVACT0=0x3, START) and can start the
counting operation when previously stopped. The event has no effect if the counter is already counting. When the
module is enabled, the counter operation starts when the event is received or when a re-trigger software command is
applied.
Note:
When a start event action is configured in the Event Action bits in the Event Control register (EVCTRL.EVACT0=0x3,
START), enabling the counter will not start the counter. The counter will start on the next incoming event, but it will
not restart on subsequent events.
Count Event Action
The TCC can count events. When an event is received, the counter increases or decreases the value, depending on
direction settings (CTRLBSET.DIR or CTRLBCLR.DIR).
The count event action is selected by the Event Action 0 bit group in the Event Control register
(EVCTRL.EVACT0=0x5, COUNT).
Direction Event Action
The direction event action can be selected in the Event Control register (EVCTRL.EVACT1=0x2, DIR). When this
event is used, the asynchronous event path specified in the event system must be configured or selected. The
direction event action can be used to control the direction of the counter operation, depending on external events
level. When received, the event level overrides the Direction settings (CTRLBSET.DIR or CTRLBCLR.DIR) and the
direction bit value is updated accordingly.
Increment Event Action
The increment event action can be selected in the Event Control register (EVCTRL.EVACT0=0x4, INC) and can
change the counter state when an event is received. When the TCE0 event (TCCx_EV0) is received, the counter
increments, whatever the direction setting (CTRLBSET.DIR or CTRLBCLR.DIR) is.
Decrement Event Action
The decrement event action can be selected in the Event Control register (EVCTRL.EVACT1=0x4, DEC) and can
change the counter state when an event is received. When the TCE1 (TCCx_EV1) event is received, the counter
decrements, whatever the direction setting (CTRLBSET.DIR or CTRLBCLR.DIR) is.
Non-recoverable Fault Event Action
Non-recoverable fault actions can be selected in the Event Control register (EVCTRL.EVACTn=0x7, FAULT). When
received, the counter will be stopped and the output of the compare channels is overridden according to the Driver
Control register settings (DRVCTRL.NREx and DRVCTRL.NRVx). TCE0 and TCE1 must be configured as
asynchronous events.
Event Action Off
If the event action is disabled (EVCTRL.EVACTn=0x0, OFF), enabling the counter will also start the counter.
Related Links
31.6.3.1 One-Shot Operation
3. Configure the pins with the I/O Pin Controller. Refer to PORT - I/O Pin Controller for details.
The counter value is continuously compared with each CCx value. On a comparison match, the Match or Capture
Channel x bit in the Interrupt Flag Status and Clear register (INTFLAG.MCx) will be set on the next zero-to-one
transition of CLK_TCC_COUNT (see Normal Frequency Operation). An interrupt and/or event can be generated on
the same condition if Match/Capture occurs, i.e. INTENSET.MCx and/or EVCTRL.MCEOx is '1'. Both interrupt and
event can be generated simultaneously. The same condition generates a DMA request.
There are seven waveform configurations for the Waveform Generation Operation bit group in the Waveform register
(WAVE.WAVEGEN). This will influence how the waveform is generated and impose restrictions on the top value. The
configurations are:
• Normal Frequency (NFRQ)
• Match Frequency (MFRQ)
• Normal Pulse-Width Modulation (NPWM)
• Dual-slope, interrupt/event at TOP (DSTOP)
• Dual-slope, interrupt/event at ZERO (DSBOTTOM)
• Dual-slope, interrupt/event at Top and ZERO (DSBOTH)
• Dual-slope, critical interrupt/event at ZERO (DSCRITICAL)
When using MFRQ configuration, the TOP value is defined by the CC0 register value. For the other waveform
operations, the TOP value is defined by the Period (PER) register value.
For dual-slope waveform operations, the update time occurs when the counter reaches ZERO. For the other
waveforms generation modes, the update time occurs on counter wraparound, on overflow, underflow, or re-trigger.
The table below shows the update counter and overflow event/interrupt generation conditions in different operation
modes.
Table 31-2. Counter Update and Overflow Event/interrupt Conditions
1. The UPDATE condition on TOP only will occur when circular buffer is enabled for the channel.
Related Links
31.6.3.2 Circular Buffer
23. PORT - I/O Pin Controller
CCx
ZERO
WO[x]
MAX
"reload" update
"clear" update
CC0
COUNT
ZERO
WO[0]
31.6.2.5.4 Normal Pulse-Width Modulation (NPWM)
NPWM uses single-slope PWM generation.
COUNT
CCx
ZERO
WO[x]
The following equation calculates the exact resolution for a single-slope PWM (RPWM_SS) waveform:
log(TOP+1)
�PWM_SS =
log(2)
The PWM frequency depends on the Period register value (PER) and the peripheral clock frequency (fGCLK_TCC), and
can be calculated by the following equation:
�GCLK_TCC
�PWM_SS =
N(TOP+1)
Where N represents the prescaler divider used (1, 2, 4, 8, 16, 64, 256, 1024).
CCx
TOP
COUNT
ZERO
WO[x]
Using dual-slope PWM results in a lower maximum operation frequency compared to single-slope PWM generation.
The period (TOP) defines the PWM resolution. The minimum resolution is 1 bit (TOP=0x00000001).
The following equation calculates the exact resolution for dual-slope PWM (RPWM_DS):
log(PER+1)
�PWM_DS = .
log(2)
The PWM frequency fPWM_DS depends on the period setting (TOP) and the peripheral clock frequency fGCLK_TCC, and
can be calculated by the following equation:
�GCLK_TCC
�PWM_DS =
2� ⋅ PER
N represents the prescaler divider used. The waveform generated will have a maximum frequency of half of the TCC
clock frequency (fGCLK_TCC) when TOP is set to 0x00000001 and no prescaling is used.
The pulse width (PPWM_DS) depends on the compare channel (CCx) register value and the peripheral clock frequency
(fGCLK_TCC), and can be calculated by the following equation:
2� ⋅ TOP − CCx
�PWM_DS =
�GCLK_TCC
TOP
COUNT
ZERO
WO[x]
In Normal and Match Frequency, the WAVE.POLx value represents the initial state of the waveform output.
BV EN CCBx
EN CCx
UPDATE
COUNT
"match"
=
Both the registers (PATT/WAVE/PER/CCx) and corresponding buffer registers (PATTB/WAVEBV/PERB/CCBx) are
available in the I/O register map, and the double buffering feature is not mandatory. The double buffering is disabled
by writing a '1' to CTRLSET.LUPD.
Note: In NFRQ, MFRQ or PWM down-counting counter mode (CTRLBSET.DIR=1), when double buffering is
enabled (CTRLBCLR.LUPD=1), PERB register is continuously copied into the PER independently of update
conditions.
MAX
"clear" update
"write"
COUNT
ZERO
MAX
"reload" update
"write"
COUNT
ZERO
MAX
"reload" update
"write"
COUNT
ZERO
MAX
"reload" update
"write"
COUNT
ZERO
events
MAX
COUNT
ZERO
For input capture, the buffer register and the corresponding CCx act like a FIFO. When CCx is empty or read, any
content in CCBx is transferred to CCx. The buffer valid flag is passed to set the CCx interrupt flag (IF) and generate
the optional interrupt, event or DMA request. CCBx register value can't be read, all captured data must be read from
CCx register.
BV EN CCBx
IF EN CCx
"INT/DMA
request" data read
The TCC can detect capture overflow of the input capture channels: When a new capture event is detected while the
Capture Buffer Valid flag (STATUS.CCBV) is still set, the new timestamp will not be stored and INTFLAG.ERR will be
set.
Period and Pulse-Width (PPW) Capture Action
The TCC can perform two input captures and restart the counter on one of the edges. This enables the TCC to
measure the pulse-width and period and to characterize the frequency f and dutyCycle of an input signal:
1 ��
�= , ��������� =
� �
Figure 31-16. PWP Capture
Period (T)
external
signal /event
capture times
MAX
"capture"
COUNT
ZERO
CC0 CC1 CC0 CC1
Selecting PWP or PPW in the Timer/Counter Event Input 1 Action bit group in the Event Control register
(EVCTRL.EVACT1) enables the TCC to perform one capture action on the rising edge and the other one on the
falling edge. When using PPW (period and pulse-width) event action, period T will be captured into CC0 and the
pulse-width tp into CC1. The PWP (Pulse-width and Period) event action offers the same functionality, but T will be
captured into CC1 and tp into CC0.
The Timer/Counter Event x Invert Enable bit in Event Control register (EVCTRL.TCEINVx) is used for event source x
to select whether the wraparound should occur on the rising edge or the falling edge. If EVCTRL.TCEINVx=1, the
wraparound will happen on the falling edge.
The corresponding capture is done only if the channel is enabled in capture mode (CTRLA.CPTENx=1). If not, the
capture action will be ignored and the channel will be enabled in compare mode of operation. When only one of these
channel is required, the other channel can be used for other purposes.
The TCC can detect capture overflow of the input capture channels: When a new capture event is detected while the
INTFLAG.MCx is still set, the new timestamp will not be stored and INTFLAG.ERR will be set.
Note: When up-counting (CTRLBSET.DIR=0), counter values lower than 1 cannot be captured in Capture Minimum
mode (FCTRLn.CAPTURE=CAPTMIN). To capture the full range including value 0, the TCC must be configured in
down-counting mode (CTRLBSET.DIR=0).
Note: In dual-slope PWM operation, and when TOP is lower than MAX/2, the CCx MSB captures the CTRLB.DIR
state to identify the ramp on which the capture has been done. For rising ramps CCx[MSB] is zero, for falling ramps
CCx[MSB]=1.
UPDATE
BV EN CCB0
CIRCC0EN
EN CC0
UPDATE
COUNT
"ma tch"
=
The DITHERCY bits of COUNT, PER and CCx define the number of extra cycles to add into the frame (DITHERCY
bits from the respective COUNT, PER or CCx registers). The remaining bits of COUNT, PER, CCx define the
compare value itself.
The pseudo code, giving the extra cycles insertion regarding the cycle is:
Dithering on Period
Writing DITHERCY in PER will lead to an average PWM period configured by the following formulas.
DITH4 mode:
DITHERCY 1
��������� = + PER
16 �GCLK_TCC
Note: If DITH4 mode is enabled, the last 4 significant bits from PER/CCx or COUNT register correspond to the
DITHERCY value, rest of the bits corresponds to PER/CCx or COUNT value.
DITH5 mode:
DITHERCY 1
��������� = + PER
32 �GCLK_TCC
DITH6 mode:
DITHERCY 1
��������� = + PER
64 �GCLK_TCC
DITH5 mode:
DITHERCY 1
������������ℎ = + CCx
32 �GCLK_TCC
DITH6 mode:
DITHERCY 1
������������ℎ = + CCx
64 �GCLK_TCC
RAMP1 Operation
This is the default PWM operation, described in Single-Slope PWM Generation.
RAMP2 Operation
These operation modes are dedicated for power factor correction (PFC), Half-Bridge and Push-Pull SMPS
topologies, where two consecutive timer/counter cycles are interleaved, see Figure 31-18. In cycle A, odd channel
output is disabled, and in cycle B, even channel output is disabled. The ramp index changes after each update, but
can be software modified using the Ramp index command bits in Control B Set register (CTRLBSET.IDXCMD).
ZERO
WO[0] POL0 = 1
FaultA input
FaultB input
ZERO
WO[0]
Keep on FaultB POL0 = 1
WO[1]
FaultA input
FaultB input
ZERO
WO[0] POL2 = 1
FaultA input
FaultB input
ZERO
WO[0] POL0 = 0
FaultA input
FaultB input
Fault Inputs
The first two channel input events (TCCxMC0 and TCCxMC1) can be used as Fault A and Fault B inputs,
respectively. Event system channels connected to these fault inputs must be configured as asynchronous. The TCC
must work in a PWM mode.
Fault Filtering
There are three filters available for each input Fault A and Fault B. They are configured by the corresponding
Recoverable Fault n Configuration registers (FCTRLA and FCTRLB). The three filters can either be used
independently or in any combination.
Input By default, the event detection is asynchronous. When the event occurs, the fault system will
Filtering immediately and asynchronously perform the selected fault action on the compare channel output, also
in device power modes where the clock is not available. To avoid false fault detection on external
events (e.g. due to a glitch on an I/O port) a digital filter can be enabled and configured by the Fault B
Filter Value bits in the Fault n Configuration registers (FCTRLn.FILTERVAL). If the event width is less
than FILTERVAL (in clock cycles), the event will be discarded. A valid event will be delayed by
FILTERVAL clock cycles.
Fault This ignores any fault input for a certain time just after a selected waveform output edge. This can be
Blanking used to prevent false fault triggering due to signal bouncing, as shown in the figure below. Blanking can
be enabled by writing an edge triggering configuration to the Fault n Blanking Mode bits in the
Recoverable Fault n Configuration register (FCTRLn.BLANK). The desired duration of the blanking
must be written to the Fault n Blanking Time bits (FCTRLn.BLANKVAL).
The blanking time tbis calculated by
1 + BLANKVAL
�� =
�GCLK_TCCx_PRESC
Here, fGCLK_TCCx_PRESC is the frequency of the prescaled peripheral clock frequency fGCLK_TCCx.
ZERO
CMP0
FaultA Blanking - -
x xxx
FaultA Input
WO[0]
Fault This is enabled by writing a '1' to the Fault n Qualification bit in the Recoverable Fault n
Qualification Configuration register (FCTRLn.QUAL). When the recoverable fault qualification is enabled
(FCTRLn.QUAL=1), the fault input is disabled all the time the corresponding channel output has
an inactive level, as shown in the figures below.
"Fault discarded"
ZERO
Fault Input A
Fault Input B
ZERO
Fault Input A
Fault Input B
Fault Actions
Different fault actions can be configured individually for Fault A and Fault B. Most fault actions are not mutually
exclusive; hence two or more actions can be enabled at the same time to achieve a result that is a combination of
fault actions.
Keep This is enabled by writing the Fault n Keeper bit in the Recoverable Fault n Configuration register
Action (FCTRLn.KEEP) to '1'. When enabled, the corresponding channel output will be clamped to zero as
long as the fault condition is present. The clamp will be released on the start of the first cycle after the
fault condition is no longer present, see next Figure.
"Fault discarded"
ZERO
Fault Input A
Restart This is enabled by writing the Fault n Restart bit in Recoverable Fault n Configuration register
Action (FCTRLn.RESTART) to '1'. When enabled, the timer/counter will be restarted as soon as the
corresponding fault condition is present. The ongoing cycle is stopped and the timer/counter starts a new
cycle, see Figure 31-26. In Ramp 1 mode, when the new cycle starts, the compare outputs will be
clamped to inactive level as long as the fault condition is present.
Note: For RAMP2 operation, when a new timer/counter cycle starts the cycle index will change
automatically, see Figure 31-27. Fault A and Fault B are qualified only during the cycle A and cycle B
respectively: Fault A is disabled during cycle B, and Fault B is disabled during cycle A.
CC0
COUNT
CC1
ZERO
Restart Restart
Fault Input A
WO[0]
WO[1]
Figure 31-27. Waveform Generation in RAMP2 mode with Restart Action
Cycle
"clear" update
CCx=ZERO CCx=TOP "match"
MAX
TOP
COUNT
CC0/CC1
ZERO
No fault A action
in cycle B Restart
Fault Input A
WO[0]
WO[1]
Capture Several capture actions can be selected by writing the Fault n Capture Action bits in the Fault n Control
Action register (FCTRLn.CAPTURE). When one of the capture operations is selected, the counter value is
captured when the fault occurs. These capture operations are available:
• CAPT - the equivalent to a standard capture operation, for further details refer to 31.6.2.7 Capture
Operations
• CAPTMIN - gets the minimum time stamped value: on each new local minimum captured value, an
event or interrupt is issued.
• CAPTMAX - gets the maximum time stamped value: on each new local maximum captured value,
an event or interrupt (IT) is issued, see Figure 31-28.
• LOCMIN - notifies by event or interrupt when a local minimum captured value is detected.
• LOCMAX - notifies by event or interrupt when a local maximum captured value is detected.
• DERIV0 - notifies by event or interrupt when a local extreme captured value is detected, see Figure
31-29.
CCx Content:
In CAPTMIN and CAPTMAX operations, CCx keeps the respective extremum captured values, see
Figure 31-28. In LOCMIN, LOCMAX or DERIV0 operation, CCx follows the counter value at fault time,
see Figure 31-29.
Before enabling CAPTMIN or CAPTMAX mode of capture, the user must initialize the corresponding
CCx register value to a value different from zero (for CAPTMIN) top (for CAPTMAX). If the CCx register
initial value is zero (for CAPTMIN) top (for CAPTMAX), no captures will be performed using the
corresponding channel.
MCx Behaviour:
In LOCMIN and LOCMAX operation, capture is performed on each capture event. The MCx interrupt
flag is set only when the captured value is above or equal (for LOCMIN) or below or equal (for
LOCMAX) to the previous captured value. So interrupt flag is set when a new relative local Minimum (for
CAPTMIN) or Maximum (for CAPTMAX) value has been detected. DERIV0 is equivalent to an OR
function of (LOCMIN, LOCMAX).
In CAPT operation, capture is performed on each capture event. The MCx interrupt flag is set on each
new capture.
In CAPTMIN and CAPTMAX operation, capture is performed only when on capture event time, the
counter value is lower (for CAPTMIN) or higher (for CAPMAX) than the last captured value. The MCx
interrupt flag is set only when on capture event time, the counter value is higher or equal (for CAPTMIN)
or lower or equal (for CAPTMAX) to the value captured on the previous event. So interrupt flag is set
when a new absolute local Minimum (for CAPTMIN) or Maximum (for CAPTMAX) value has been
detected.
Interrupt Generation
In CAPT mode, an interrupt is generated on each filtered Fault n and each dedicated CCx channel
capture counter value. In other modes, an interrupt is only generated on an extreme captured value.
TOP
"clear" update
COUNT CC0
ZERO
FaultA Input
CC0 Event/
Interrupt
Figure 31-29. Capture Action “DERIV0”
TOP
"update"
COUNT CC0 "match"
ZERO
WO[0]
FaultA Input
CC0 Event/
Interrupt
Hardware This is configured by writing 0x1 to the Fault n Halt mode bits in the Recoverable Fault n
Halt Action Configuration register (FCTRLn.HALT). When enabled, the timer/counter is halted and the cycle is
extended as long as the corresponding fault is present.
The next figure ('Waveform Generation with Halt and Restart Actions') shows an example where both
restart action and hardware halt action are enabled for Fault A. The compare channel 0 output is
clamped to inactive level as long as the timer/counter is halted. The timer/counter resumes the
counting operation as soon as the fault condition is no longer present. As the restart action is enabled
in this example, the timer/counter is restarted after the fault condition is no longer present.
The figure after that ('Waveform Generation with Fault Qualification, Halt, and Restart Actions') shows
a similar example, but with additionally enabled fault qualification. Here, counting is resumed after the
fault condition is no longer present.
Note that in RAMP2 and RAMP2A operations, when a new timer/counter cycle starts, the cycle index
will automatically change.
Figure 31-30. Waveform Generation with Halt and Restart Actions
MAX
"clear" update
TOP
"match"
CC0
COUNT
HALT
ZERO
Restart Restart
Fault Input A
WO[0]
Figure 31-31. Waveform Generation with Fault Qualification, Halt, and Restart Actions
MAX
"update"
TOP
"match"
COUNT CC0
HALT
ZERO
Resume
Fault Input A
WO[0] KEEP
Software This is configured by writing 0x2 to the Fault n Halt mode bits in the Recoverable Fault n
Halt Action configuration register (FCTRLn.HALT). Software halt action is similar to hardware halt action, but in
order to restart the timer/counter, the corresponding fault condition must not be present anymore,
and the corresponding FAULT n bit in the STATUS register must be cleared by software.
Figure 31-32. Waveform Generation with Software Halt, Fault Qualification, Keep and Restart Actions
MAX
"update"
TOP
"match"
COUNT CC0
HALT
ZERO
Restart Restart
Fault Input A
Software Clear
NO
WO[0] KEEP
KEEP
FCTRLA.KEEP = 1 FCTRLA.KEEP = 0
OTMX[x+WO_NUM/2] PGV[x+WO_NUM/2]
P[x+WO_NUM/2]
LS
PGO[x+WO_NUM/2] INV[x+WO_NUM/2]
OTMX DTIx DTIxEN SWAPx
PGO[x] INV[x]
HS
P[x]
OTMX[x] PGV[x]
The output matrix (OTMX) unit distributes compare channels, according to the selectable configurations in Table
31-4.
Table 31-4. Output Matrix Channel Pin Routing Configuration
Value OTMX[x]
0x0 CC3 CC2 CC1 CC0 CC3 CC2 CC1 CC0
0x1 CC1 CC0 CC1 CC0 CC1 CC0 CC1 CC0
0x2 CC0 CC0 CC0 CC0 CC0 CC0 CC0 CC0
0x3 CC1 CC1 CC1 CC1 CC1 CC1 CC1 CC0
The dead-time insertion (DTI) unit generates OFF time with the non-inverted low side (LS) and inverted high side
(HS) of the wave generator output forced at low level. This OFF time is called dead time. Dead-time insertion ensures
that the LS and HS will never switch simultaneously.
The DTI stage consists of four equal dead-time insertion generators; one for each of the first four compare channels.
Figure 31-34 shows the block diagram of one DTI generator. The four channels have a common register which
controls the dead time, which is independent of high side and low side setting.
Figure 31-34. Dead-Time Generator Block Diagram
DTLS DTHS
LOAD
Counter
EN
=0
"DTLS"
OTMX output D Q (To PORT)
"DTHS"
Edge Detect (To PORT)
As shown in Figure 31-35, the 8-bit dead-time counter is decremented by one for each peripheral clock cycle until it
reaches zero. A non-zero counter value will force both the low side and high side outputs into their OFF state. When
the output matrix (OTMX) output changes, the dead-time counter is reloaded according to the edge of the input.
When the output changes from low to high (positive edge) it initiates a counter reload of the DTLS register. When the
output changes from high to low (negative edge) it reloads the DTHS register.
Figure 31-35. Dead-Time Generator Timing Diagram
"dti_cnt"
T
tP
tDTILS t DTIHS
"OTMX output"
"DTLS"
"DTHS"
The pattern generator unit produces a synchronized bit pattern across the port pins it is connected to. The pattern
generation features are primarily intended for handling the commutation sequence in brushless DC motors (BLDC),
stepper motors, and full bridge control. See also Figure 31-36.
EN PGE[7:0] EN PGV[7:0]
WOx[7:0]
As with other double-buffered timer/counter registers, the register update is synchronized to the UPDATE condition
set by the timer/counter waveform generation operation. If synchronization is not required by the application, the
software can simply access directly the PATT.PGE, PATT.PGV bits registers.
Notes:
1. DMA request set on overflow, underflow or re-trigger conditions.
2. Can perform capture or generate recoverable fault on an event input.
3. In capture or circular modes.
4. On event input, either action can be executed:
– re-trigger counter
– control counter direction
– stop the counter
– decrement the counter
– perform period and pulse width capture
– generate non-recoverable fault
5. On event input, either action can be executed:
– re-trigger counter
– increment or decrement counter depending on direction
– start the counter
– increment or decrement counter based on direction
– increment counter regardless of direction
– generate non-recoverable fault
Counter If the Ones-shot Trigger mode in the control A register (CTRLA.DMAOS) is written to '0', the TCC
overflow generates a DMA request on each cycle when an update condition (overflow, underflow or re-
(OVF) trigger) is detected.
When an update condition (overflow, underflow or re-trigger) is detected while CTRLA.DMAOS=1,
the TCC generates a DMA trigger on the cycle following the DMA One-Shot Command written to
the Control B register (CTRLBSET.CMD=DMAOS).
In both cases, the request is cleared by hardware on DMA acknowledge.
Channel A DMA request is set only on a compare match if CTRLA.DMAOS=0. The request is cleared by
Match (MCx) hardware on DMA acknowledge.
When CTRLA.DMAOS=1, the DMA requests are not generated.
Channel For a capture channel, the request is set when valid data is present in the CCx register, and cleared
Capture once the CCx register is read.
(MCx) In this operation mode, the CTRLA.DMAOS bit value is ignored.
Figure 31-37. DMA Triggers in RAMP and RAMP2 Operation Mode and Circular Buffer Enabled
Ramp A B A B A B
"update"
COUNT
ZERO
STATUS.IDX
DMA_CCx_req
DMA Channel i
Update ramp A
DMA_OVF_req DMA Channel j
Update ramp B
DMA Operation with Circular Buffer in DSBOTH Mode
When a CC channel is selected as a circular buffer, the related DMA request is not set on a compare match
detection, but on start of down-counting phase.
If at least one circular buffer is enabled, the DMA overflow request is conditioned to the start of up-counting phase
with an effective DMA transfer on previous down-counting phase (DMA acknowledge).
When up-counting, all circular buffer values can be updated through a DMA channel triggered by MC trigger. When
down-counting, all circular buffer values can be updated through a second DMA channel, triggered by the OVF DMA
request.
Figure 31-38. DMA Triggers in DSBOTH Operation Mode and Circular Buffer Enabled
Cycle
N-2 N-1 N
Old Parameter Set New Parameter Set
"update"
COUNT
ZERO
CTRLB.DIR
Update Rising
DMA_OVF_req
DMA Channel j
Update Rising
31.6.4.2 Interrupts
The TCC has the following interrupt sources:
• Overflow/Underflow (OVF)
• Retrigger (TRG)
• Count (CNT) - refer also to description of EVCTRL.CNTSEL.
• Capture Overflow Error (ERR)
• Non-Recoverable Update Fault (UFS)
31.6.4.3 Events
The TCC can generate the following output events:
• Overflow/Underflow (OVF)
• Trigger (TRG)
• Counter (CNT) For further details, refer to EVCTRL.CNTSEL description.
• Compare Match or Capture on compare/capture channels: MCx
Writing a '1' ('0') to an Event Output bit in the Event Control Register (EVCTRL.xxEO) enables (disables) the
corresponding output event. Refer also to EVSYS – Event System.
The TCC can take the following actions on a channel input event (MCx):
• Capture event
• Generate a recoverable or non-recoverable fault
The TCC can take the following actions on counter Event 1 (TCCx EV1):
• Counter re-trigger
• Counter direction control
• Stop the counter
• Decrement the counter on event
• Period and pulse width capture
• Non-recoverable fault
The TCC can take the following actions on counter Event 0 (TCCx EV0):
• Counter re-trigger
• Count on event (increment or decrement, depending on counter direction)
• Counter start - start counting on the event rising edge. Further events will not restart the counter; the counter will
keep on counting using prescaled GCLK_TCCx, until it reaches TOP or ZERO, depending on the direction.
• Counter increment on event. This will increment the counter, irrespective of the counter direction.
• Count during active state of an asynchronous event (increment or decrement, depending on counter direction).
In this case, the counter will be incremented or decremented on each cycle of the prescaled clock, as long as
the event is active.
• Non-recoverable fault
The counter Event Actions are available in the Event Control registers (EVCTRL.EVACT0 and EVCTRL.EVACT1).
For further details, refer to EVCTRL.
Writing a '1' ('0') to an Event Input bit in the Event Control register (EVCTRL.MCEIx or EVCTRL.TCEIx) enables
(disables) the corresponding action on input event.
Note: When several events are connected to the TCC, the enabled action will apply for each of the incoming events.
Refer to EVSYS – Event System for details on how to configure the event system.
Related Links
24. EVSYS – Event System
31.6.6 Synchronization
Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be
synchronized when written or read.
The following bits are synchronized when written:
• Software Reset and Enable bits in Control A register (CTRLA.SWRST and CTRLA.ENABLE)
The following registers are synchronized when written:
• Control B Clear and Control B Set registers (CTRLBCLR and CTRLBSET)
• Status register (STATUS)
• Pattern and Pattern Buffer registers (PATT and PATTB)
• Waveform register (WAVE)
• Count Value register (COUNT)
• Period Value and Period Buffer Value registers (PER and PERB)
• Compare/Capture Channel x and Channel x Compare/Capture Buffer Value registers (CCx and CCBx)
The following registers are synchronized when read:
• Control B Clear and Control B Set registers (CTRLBCLR and CTRLBSET)
• Count Value register (COUNT): synchronization is done on demand through READSYNC command
(CTRLBSET.CMD)
• Pattern and Pattern Buffer registers (PATT and PATTB)
• Waveform register (WAVE)
• Period Value and Period Buffer Value registers (PER and PERB)
• Compare/Capture Channel x and Channel x Compare/Capture Buffer Value registers (CCx and CCBx)
Required write-synchronization is denoted by the "Write-Synchronized" property in the register description.
Required read-synchronization is denoted by the "Read-Synchronized" property in the register description.
Related Links
14.3 Register Synchronization
...........continued
7:0 COUNT[7:0]
15:8 COUNT[15:8]
0x34 COUNT
23:16 COUNT[23:16]
31:24
7:0 PGE7 PGE6 PGE5 PGE4 PGE3 PGE2 PGE1 PGE0
0x38 PATT
15:8 PGV7 PGV6 PGV5 PGV4 PGV3 PGV2 PGV1 PGV0
0x3A
... Reserved
0x3B
7:0 CIPEREN RAMP[1:0] WAVEGEN[2:0]
15:8 CICCEN3 CICCEN2 CICCEN1 CICCEN0
0x3C WAVE
23:16 POL3 POL2 POL1 POL0
31:24 SWAP3 SWAP2 SWAP1 SWAP0
7:0 PER[1:0] DITHER[5:0]
15:8 PER[9:2]
0x40 PER
23:16 PER[17:10]
31:24
7:0 CC[1:0] DITHER[5:0]
15:8 CC[9:2]
0x44 CC0
23:16 CC[17:10]
31:24
7:0 CC[1:0] DITHER[5:0]
15:8 CC[9:2]
0x48 CC1
23:16 CC[17:10]
31:24
7:0 CC[1:0] DITHER[5:0]
15:8 CC[9:2]
0x4C CC2
23:16 CC[17:10]
31:24
7:0 CC[1:0] DITHER[5:0]
15:8 CC[9:2]
0x50 CC3
23:16 CC[17:10]
31:24
0x54
... Reserved
0x63
7:0 PGEB7 PGEB6 PGEB5 PGEB4 PGEB3 PGEB2 PGEB1 PGEB0
0x64 PATTB
15:8 PGVB7 PGVB6 PGVB5 PGVB4 PGVB3 PGVB2 PGVB1 PGVB0
0x66
... Reserved
0x67
7:0 CIPERENB RAMPB[1:0] WAVEGENB[2:0]
15:8 CICCENB3 CICCENB2 CICCENB1 CICCENB0
0x68 WAVEB
23:16 POLB3 POLB2 POLB1 POLB0
31:24 SWAPB 3 SWAPB 2 SWAPB 1 SWAPB 0
7:0 PERB[1:0] DITHERB[5:0]
15:8 PERB[9:2]
0x6C PERB
23:16 PERB[17:10]
31:24
7:0 CCB[1:0] DITHERB[5:0]
15:8 CCB[9:2]
0x70 CCB0
23:16 CCB[17:10]
31:24
7:0 CCB[1:0] DITHERB[5:0]
15:8 CCB[9:2]
0x74 CCB1
23:16 CCB[17:10]
31:24
...........continued
31.8.1 Control A
Name: CTRLA
Offset: 0x00
Reset: 0x00000000
Property: PAC Write-Protection, Enable-Protected, Write-Synchronized (ENABLE, SWRST)
Bit 31 30 29 28 27 26 25 24
CPTEN3 CPTEN2 CPTEN1 CPTEN0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 23 22 21 20 19 18 17 16
Access
Reset
Bit 15 14 13 12 11 10 9 8
ALOCK PRESCYNC[1:0] RUNSTDBY PRESCALER[2:0]
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
RESOLUTION[1:0] ENABLE SWRST
Access R/W R/W R/W R/W
Reset 0 0 0 0
Value Description
0 The TCC is halted in standby.
1 The TCC continues to run in standby.
Bit 1 – ENABLE Enable
Due to synchronization there is delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The value
written to CTRLA.ENABLE will read back immediately and the ENABLE bit in the SYNCBUSY register
(SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE will be cleared when the operation is complete.
Value Description
0 The peripheral is disabled.
1 The peripheral is enabled.
Name: CTRLBCLR
Offset: 0x04
Reset: 0x00
Property: PAC Write-Protection, Write-Synchronized, Read-Synchronized
This register allows the user to change this register without doing a read-modify-write operation. Changes in this
register will also be reflected in the Control B Set (CTRLBSET) register.
Bit 7 6 5 4 3 2 1 0
CMD[2:0] IDXCMD[1:0] ONESHOT LUPD DIR
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 2 – ONESHOT One-Shot
This bit controls one-shot operation of the TCC. When one-shot operation is enabled, the TCC will stop counting on
the next overflow/underflow condition or on a stop command.
Writing a '0' to this bit has no effect
Writing a '1' to this bit will disable the one-shot operation.
Value Description
0 The TCC will update the counter value on overflow/underflow condition and continue operation.
1 The TCC will stop counting on the next underflow/overflow condition.
Value Description
0 The CCBx, PERB, PGVB, PGOB, and SWAPBx buffer registers values are copied into the
corresponding CCx, PER, PGV, PGO and SWAPx registers on hardware update condition.
1 The CCBx, PERB, PGVB, PGOB, and SWAPBx buffer registers values are not copied into the
corresponding CCx, PER, PGV, PGO and SWAPx registers on hardware update condition.
Name: CTRLBSET
Offset: 0x05
Reset: 0x00
Property: PAC Write-Protection, Write-Synchronized, Read-Synchronized
This register allows the user to change this register without doing a read-modify-write operation. Changes in this
register will also be reflected in the Control B Set (CTRLBCLR) register.
Bit 7 6 5 4 3 2 1 0
CMD[2:0] IDXCMD[1:0] ONESHOT LUPD DIR
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 2 – ONESHOT One-Shot
This bit controls one-shot operation of the TCC. When in one-shot operation, the TCC will stop counting on the next
overflow/underflow condition or a stop command.
Writing a '0' to this bit has no effect.
Writing a '1' to this bit will enable the one-shot operation.
Value Description
0 The TCC will count continuously.
1 The TCC will stop counting on the next underflow/overflow condition.
Writing a '1' to this bit will disable the registers updates on hardware UPDATE condition.
Value Description
0 The CCBx, PERB, PGVB, PGOB, and SWAPBx buffer registers values are copied into the
corresponding CCx, PER, PGV, PGO and SWAPx registers on hardware update condition.
1 The CCBx, PERB, PGVB, PGOB, and SWAPBx buffer registers values are not copied into CCx, PER,
PGV, PGO and SWAPx registers on hardware update condition.
Name: SYNCBUSY
Offset: 0x08
Reset: 0x00000000
Property: -
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
CCB3 CCB2 CCB1 CCB0 PERB WAVEB PATTB
Access R R R R R R R
Reset 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
CC3 CC2 CC1 CC0
Access R R R R
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
PER WAVE PATT COUNT STATUS CTRLB ENABLE SWRST
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Name: FCTRLn
Offset: 0x0C + n*0x04 [n=0..1]
Reset: 0x00000000
Property: PAC Write-Protection, Enable-Protected
Bit 31 30 29 28 27 26 25 24
FILTERVAL[3:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 23 22 21 20 19 18 17 16
BLANKVAL[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
CAPTURE[2:0] CHSEL[1:0] HALT[1:0]
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
RESTART BLANK[1:0] QUAL KEEP SRC[1:0]
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
...........continued
Value Name Description
0x6 DERIV0 On rising edge of a valid recoverable Fault n, capture counter value on channel selected by
CHSEL[1:0]. INTFLAG.FAULTn flag rises on each local maximun or minimum detection.
0x7 CAPTMARK Capture with ramp index as MSB value.
Name: WEXCTRL
Offset: 0x14
Reset: 0x00000000
Property: PAC Write-Protection, Enable-Protected
Bit 31 30 29 28 27 26 25 24
DTHS[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
DTLS[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
DTIEN3 DTIEN2 DTIEN1 DTIEN0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
OTMX[1:0]
Access R/W R/W
Reset 0 0
Name: DRVCTRL
Offset: 0x18
Reset: 0x00000000
Property: PAC Write-Protection, Enable-Protected
Bit 31 30 29 28 27 26 25 24
FILTERVAL1[3:0] FILTERVAL0[3:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
INVEN7 INVEN6 INVEN5 INVEN4 INVEN3 INVEN2 INVEN1 INVEN0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
NRV7 NRV6 NRV5 NRV4 NRV3 NRV2 NRV1 NRV0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
NRE7 NRE6 NRE5 NRE4 NRE3 NRE2 NRE1 NRE0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bits 16, 17, 18, 19, 20, 21, 22, 23 – INVENx Waveform Output x Inversion
These bits are used to select inversion on the output of channel x.
Writing a '1' to INVENx inverts output from WO[x].
Writing a '0' to INVENx disables inversion of output from WO[x].
Bits 8, 9, 10, 11, 12, 13, 14, 15 – NRVx NRVx Non-Recoverable State x Output Value
These bits define the value of the enabled override outputs, under non-recoverable fault condition.
Name: DBGCTRL
Offset: 0x1E
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
FDDBD DBGRUN
Access R/W R/W
Reset 0 0
Name: EVCTRL
Offset: 0x20
Reset: 0x00000000
Property: PAC Write-Protection, Enable-Protected
Bit 31 30 29 28 27 26 25 24
MCEO3 MCEO2 MCEO1 MCEO0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 23 22 21 20 19 18 17 16
MCEI3 MCEI2 MCEI1 MCEI0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 15 14 13 12 11 10 9 8
TCEI1 TCEI0 TCINV1 TCINV0 CNTEO TRGEO OVFEO
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
CNTSEL[1:0] EVACT1[2:0] EVACT0[2:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bits 24, 25, 26, 27 – MCEOx Match or Capture Channel x Event Output Enable
These bits control if the match/capture event on channel x is enabled and will be generated for every match or
capture.
Value Description
0 Match/capture x event is disabled and will not be generated.
1 Match/capture x event is enabled and will be generated for every compare/capture on channel x.
Bits 16, 17, 18, 19 – MCEIx Match or Capture Channel x Event Input Enable
These bits indicate if the match/capture x incoming event is enabled
These bits are used to enable match or capture input events to the CCx channel of TCC.
Value Description
0 Incoming events are disabled.
1 Incoming events are enabled.
Value Description
0 Counter cycle output event is disabled and will not be generated.
1 Counter cycle output event is enabled and will be generated depend of CNTSEL[1:0] value.
Name: INTENCLR
Offset: 0x24
Reset: 0x00000000
Property: PAC Write-Protection
This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Set (INTENSET) register.
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
MC3 MC2 MC1 MC0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 15 14 13 12 11 10 9 8
FAULT1 FAULT0 FAULTB FAULTA DFS UFS
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
ERR CNT TRG OVF
Access R/W R/W R/W R/W
Reset 0 0 0 0
Writing a '1' to this bit will clear the Recoverable Fault B Interrupt Disable/Enable bit, which disables the Recoverable
Fault B interrupt.
Value Description
0 The Recoverable Fault B interrupt is disabled.
1 The Recoverable Fault B interrupt is enabled.
Value Description
0 The Overflow interrupt is disabled.
1 The Overflow interrupt is enabled.
Name: INTENSET
Offset: 0x28
Reset: 0x00000000
Property: PAC Write-Protection
This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Clear (INTENCLR) register.
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
MC3 MC2 MC1 MC0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 15 14 13 12 11 10 9 8
FAULT1 FAULT0 FAULTB FAULTA DFS UFS
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
ERR CNT TRG OVF
Access R/W R/W R/W R/W
Reset 0 0 0 0
Writing a '1' to this bit will set the Recoverable Fault B Interrupt Disable/Enable bit, which enables the Recoverable
Fault B interrupt.
Value Description
0 The Recoverable Fault B interrupt is disabled.
1 The Recoverable Fault B interrupt is enabled.
Value Description
1 The Overflow interrupt is enabled.
Name: INTFLAG
Offset: 0x2C
Reset: 0x00000000
Property: -
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
MC3 MC2 MC1 MC0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 15 14 13 12 11 10 9 8
FAULT1 FAULT0 FAULTB FAULTA DFS UFS
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
ERR CNT TRG OVF
Access R/W R/W R/W R/W
Reset 0 0 0 0
31.8.13 Status
Name: STATUS
Offset: 0x30
Reset: 0x00000001
Property: -
Bit 31 30 29 28 27 26 25 24
CMP3 CMP2 CMP1 CMP0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 23 22 21 20 19 18 17 16
CCBV3 CCBV2 CCBV1 CCBV0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 15 14 13 12 11 10 9 8
FAULT1 FAULT0 FAULTB FAULTA FAULT1IN FAULT0IN FAULTBIN FAULTAIN
Access R/W R/W R/W R/W R R R R
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
PERBV WAVEBV PATTBV DFS UFS IDX STOP
Access R/W R/W R/W R/W R/W R R
Reset 0 0 0 0 0 0 1
This bit can be clear by hardware when Fault A action is resumed, or by writing a '1' to this bit when the
corresponding FAULTAIN bit is low. If software halt command is enabled (FAULTA.HALT=SW), clearing this bit will
release the timer/counter.
Bit 0 – STOP Stop
This bit is set when the TCC is disabled either on a STOP command or on an UPDATE condition when One-Shot
operation mode is enabled (CTRLBSET.ONESHOT=1).
This bit is clear on the next incoming counter increment or decrement.
Value Description
0 Counter is running.
1 Counter is stopped.
Name: COUNT
Offset: 0x34
Reset: 0x00000000
Property: PAC Write-Protection, Write-Synchronized, Read-Synchronized
Note: Prior to any read access, this register must be synchronized by user by writing the according TCC Command
value to the Control B Set register (CTRLBSET.CMD=READSYNC).
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
COUNT[23:16]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
COUNT[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
COUNT[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
31.8.15 Pattern
Name: PATT
Offset: 0x38
Reset: 0x0000
Property: Write-Synchronized
Bit 15 14 13 12 11 10 9 8
PGV7 PGV6 PGV5 PGV4 PGV3 PGV2 PGV1 PGV0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
PGE7 PGE6 PGE5 PGE4 PGE3 PGE2 PGE1 PGE0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bits 8, 9, 10, 11, 12, 13, 14, 15 – PGV Pattern Generation Output Value
This register holds the values of pattern for each waveform output.
31.8.16 Waveform
Name: WAVE
Offset: 0x3C
Reset: 0x00000000
Property: Write-Synchronized
Bit 31 30 29 28 27 26 25 24
SWAP3 SWAP2 SWAP1 SWAP0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 23 22 21 20 19 18 17 16
POL3 POL2 POL1 POL0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 15 14 13 12 11 10 9 8
CICCEN3 CICCEN2 CICCEN1 CICCEN0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
CIPEREN RAMP[1:0] WAVEGEN[2:0]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
0x0 NFRQ Normal Frequency PER TOP/Zero Toggle Stable TOP Zero
0x1 MFRQ Match Frequency CC0 TOP/Zero Toggle Stable TOP Zero
0x2 NPWM Normal PWM PER TOP/Zero Set Clear TOP Zero
0x3 Reserved - - - - - - -
0x4 DSCRITICAL Dual-slope PWM PER Zero ~DIR Stable – Zero
0x5 DSBOTTOM Dual-slope PWM PER Zero ~DIR Stable – Zero
0x6 DSBOTH Dual-slope PWM PER TOP & Zero ~DIR Stable TOP Zero
0x7 DSTOP Dual-slope PWM PER Zero ~DIR Stable TOP –
Name: PER
Offset: 0x40
Reset: 0xFFFFFFFF
Property: Write-Synchronized
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
PER[17:10]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 1 1 1 1 1 1 1 1
Bit 15 14 13 12 11 10 9 8
PER[9:2]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 1 1 1 1 1 1 1 1
Bit 7 6 5 4 3 2 1 0
PER[1:0] DITHER[5:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 1 1 1 1 1 1 1 1
Name: CC
Offset: 0x44 + n*0x04 [n=0..3]
Reset: 0x00000000
Property: Write-Synchronized, Read-Synchronized
The CCx register represents the 16-, 24- bit value, CCx. The register has two functions, depending of the mode of
operation.
For capture operation, this register represents the second buffer level and access point for the CPU and DMA.
For compare operation, this register is continuously compared to the counter value. Normally, the output form the
comparator is then used for generating waveforms.
CCx register is updated with the buffer value from their corresponding CCBx register when an UPDATE condition
occurs.
In addition, in match frequency operation, the CC0 register controls the counter period.
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
CC[17:10]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
CC[9:2]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
CC[1:0] DITHER[5:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Note: This bit field consists of the n LSB of the register. n is dependent on the value of the Resolution bits in the
Control A register (CTRLA.RESOLUTION):
Name: PATTB
Offset: 0x64
Reset: 0x0000
Property: Write-Synchronized, Read-Synchronized
Bit 15 14 13 12 11 10 9 8
PGVB7 PGVB6 PGVB5 PGVB4 PGVB3 PGVB2 PGVB1 PGVB0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
PGEB7 PGEB6 PGEB5 PGEB4 PGEB3 PGEB2 PGEB1 PGEB0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bits 8, 9, 10, 11, 12, 13, 14, 15 – PGVB Pattern Generation Output Value Buffer
This register is the buffer for the PGV register. If double buffering is used, valid content in this register is copied to the
PGV register on an UPDATE condition.
Name: WAVEB
Offset: 0x68
Reset: 0x00000000
Property: Write-Synchronized, Read-Synchronized
Bit 31 30 29 28 27 26 25 24
SWAPB 3 SWAPB 2 SWAPB 1 SWAPB 0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 23 22 21 20 19 18 17 16
POLB3 POLB2 POLB1 POLB0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 15 14 13 12 11 10 9 8
CICCENB3 CICCENB2 CICCENB1 CICCENB0
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
CIPERENB RAMPB[1:0] WAVEGENB[2:0]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bits 24, 25, 26, 27 – SWAPB Swap DTI output pair x Buffer
These register bits are the buffer bits for the SWAP register bits. If double buffering is used, valid content in these bits
is copied to the corresponding SWAPx bits on an UPDATE condition.
0x0 NFRQ Normal Frequency PER TOP/Zero Toggle Stable TOP Zero
0x1 MFRQ Match Frequency CC0 TOP/Zero Toggle Stable TOP Zero
0x2 NPWM Normal PWM PER TOP/Zero Set Clear TOP Zero
0x3 Reserved - - - - - - -
0x4 DSCRITICAL Dual-slope PWM PER Zero ~DIR Stable – Zero
0x5 DSBOTTOM Dual-slope PWM PER Zero ~DIR Stable – Zero
0x6 DSBOTH Dual-slope PWM PER TOP & Zero ~DIR Stable TOP Zero
0x7 DSTOP Dual-slope PWM PER Zero ~DIR Stable TOP –
Name: PERB
Offset: 0x6C
Reset: 0xFFFFFFFF
Property: Write-Synchronized, Read-Synchronized
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
PERB[17:10]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 1 1 1 1 1 1 1 1
Bit 15 14 13 12 11 10 9 8
PERB[9:2]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 1 1 1 1 1 1 1 1
Bit 7 6 5 4 3 2 1 0
PERB[1:0] DITHERB[5:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 1 1 1 1 1 1 1 1
Name: CCB
Offset: 0x70 + n*0x04 [n=0..3]
Reset: 0x00000000
Property: Write-Synchronized, Read-Synchronized
Bit 31 30 29 28 27 26 25 24
Access
Reset
Bit 23 22 21 20 19 18 17 16
CCB[17:10]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
CCB[9:2]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
CCB[1:0] DITHERB[5:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
32.1 Overview
The Universal Serial Bus interface (USB) module complies with the Universal Serial Bus (USB) 2.1 specification
supporting both device and embedded host modes.
The USB device mode supports 8 endpoint addresses. All endpoint addresses have one input and one output
endpoint, for a total of 16 endpoints. Each endpoint is fully configurable in any of the four transfer types: control,
interrupt, bulk or isochronous. The USB host mode supports up to 8 pipes. The maximum data payload size is
selectable up to 1023 bytes.
Internal SRAM is used to keep the configuration and data buffer for each endpoint. The memory locations used for
the endpoint configurations and data buffers is fully configurable. The amount of memory allocated is dynamic
according to the number of endpoints in use, and the configuration of these. The USB module has a built-in Direct
Memory Access (DMA) and will read/write data from/to the system RAM when a USB transaction takes place. No
CPU or DMA Controller resources are required.
To maximize throughput, an endpoint can be configured for ping-pong operation. When this is done the input and
output endpoint with the same address are used in the same direction. The CPU or DMA Controller can then read/
write one data buffer while the USB module writes/reads from the other buffer. This gives double buffered
communication.
Multi-packet transfer enables a data payload exceeding the maximum packet size of an endpoint to be transferred as
multiple packets without any software intervention. This reduces the number of interrupts and software intervention
needed for USB transfers.
For low power operation the USB module can put the microcontroller in any sleep mode when the USB bus is idle
and a suspend condition is given. Upon bus resume, the USB module can wake the microcontroller from any sleep
mode.
32.2 Features
• Compatible with the USB 2.1 specification
• USB Embedded Host and Device mode
• Supports full (12Mbit/s) and low (1.5Mbit/s) speed communication
• Supports Link Power Management (LPM-L1) protocol
• On-chip transceivers with built-in pull-ups and pull-downs
• On-Chip USB serial resistors
• 1kHz SOF clock available on external pin
• Device mode
– Supports 8 IN endpoints and 8 OUT endpoints
– No endpoint size limitations
– Built-in DMA with multi-packet and dual bank for all endpoints
– Supports feedback endpoint
– Supports crystal less clock
• Host mode
– Supports 8 physical pipes
– No pipe size limitations
– Supports multiplexed virtual pipe on one physical pipe to allow an unlimited USB tree
– Built-in DMA with multi-packet support and dual bank for all pipes
– Supports feedback endpoint
– Supports the USB 2.0 Phase-locked SOFs feature
USB
SRAM Controller
User
APB device-wide bus
Interface USB 2.0 DM
Core DP
USB interrupts SOF 1kHz
NVIC
GCLK_USB
GCLK
Refer to I/O Multiplexing and Considerations for details on the pin mapping for this peripheral. One signal can be
mapped on several pins.
Related Links
7. I/O Multiplexing and Considerations
Related Links
16. PM – Power Manager
32.5.3 Clocks
The USB bus clock (CLK_USB_AHB) can be enabled and disabled in the Main Clock module, MCLK, and the default
state of CLK_USB_AHB can be found in the Peripheral Clock Masking.
A generic clock (GCLK_USB) is required to clock the USB. This clock must be configured and enabled in the Generic
Clock Controller before using the USB.
This generic clock is asynchronous to the bus clock (CLK_USB_AHB). Due to this asynchronicity, writes to certain
registers will require synchronization between the clock domains.
The USB module requires a GCLK_USB of 48 MHz ± 0.25% clock for low speed and full speed operation. To follow
the USB data rate at 12 Mbit/s in full-speed mode, the CLK_USB_AHB clock should be at minimum 8 MHz.
Clock recovery is achieved by a digital phase-locked loop in the USB module, which complies with the USB jitter
specifications. If crystal-less operation is used in USB device mode, refer to USB Clock Recovery Module.
Related Links
15. GCLK - Generic Clock Controller
16.6.2.6 Peripheral Clock Masking
15.6.6 Synchronization
32.5.4 DMA
The USB has a built-in Direct Memory Access (DMA) and will read/write data to/from the system RAM when a USB
transaction takes place. No CPU or DMA Controller resources are required.
32.5.5 Interrupts
The interrupt request line is connected to the Interrupt Controller. In order to use interrupt requests of this peripheral,
the Interrupt Controller (NVIC) must be configured first. Refer to Nested Vector Interrupt Controller for details.
Related Links
11.2 Nested Vector Interrupt Controller
32.5.6 Events
Not applicable.
32.5.10 Calibration
The output drivers for the DP/DM USB line interface can be fine tuned with calibration values from production tests.
The calibration values must be loaded from the NVM Software Calibration Area into the USB Pad Calibration register
(PADCAL) by software, before enabling the USB, to achieve the specified accuracy. Refer to NVM Software
Calibration Area Mapping for further details.
For additional information on Pad Calibration, refer to the Pad Calibration (PADCAL) register.
Related Links
10.3.2 NVM Software Calibration Area Mapping
32.6.1.1 Initialization
After a hardware reset, the USB is disabled. The user should first enable the USB (CTRLA.ENABLE) in either device
mode or host mode (CTRLA.MODE).
Figure 32-2. General States
HW RESET | CTRLA.SWRST
Any state
Idle
CTRLA.ENABLE = 1
CTRLA.MODE =0
Device Host
After a hardware reset, the USB is in the idle state. In this state:
• The module is disabled. The USB Enable bit in the Control A register (CTRLA.ENABLE) is reset.
• The module clock is stopped in order to minimize power consumption.
• The USB pad is in suspend mode.
• The internal states and registers of the device and host are reset.
Before using the USB, the Pad Calibration register (PADCAL) must be loaded with production calibration values from
the NVM Software Calibration Area.
The USB is enabled by writing a '1' to CTRLA.ENABLE. The USB is disabled by writing a '0' to CTRLA.ENABLE.
The USB is reset by writing a '1' to the Software Reset bit in CTRLA (CTRLA.SWRST). All registers in the USB will
be reset to their initial state, and the USB will be disabled. Refer to the CTRLA register for details.
The user can configure pads and speed before enabling the USB by writing to the Operating Mode bit in the Control
A register (CTRLA.MODE) and the Speed Configuration field in the Control B register (CTRLB.SPDCONF). These
values are taken into account once the USB has been enabled by writing a '1' to CTRLA.ENABLE.
After writing a '1' to CTRLA.ENABLE, the USB enters device mode or host mode (according to CTRLA.MODE).
The USB can be disabled at any time by writing a '0' to CTRLA.ENABLE.
Refer to 32.6.2 USB Device Operations for the basic operation of the device mode.
Refer to 32.6.3 Host Operations for the basic operation of the host mode.
Related Links
10.3.2 NVM Software Calibration Area Mapping
32.6.2.1 Initialization
To attach the USB device to start the USB communications from the USB host, a zero should be written to the Detach
bit in the Device Control B register (CTRLB.DETACH). To detach the device from the USB host, a one must be
written to the CTRLB.DETACH.
After the device is attached, the host will request the USB device descriptor using the default device address zero.
On successful transmission, it will send a USB reset. After that, it sends an address to be configured for the device.
All further transactions will be directed to this device address. This address should be configured in the Device
Address field in the Device Address register (DADD.DADD) and the Address Enable bit in DADD (DADD.ADDEN)
should be written to one to accept communications directed to this address. DADD.ADDEN is automatically cleared
on receiving a USB reset.
Data Payload
Without Multi-packet support
Transfer Complete Interrupt
&
Data Processing
Maximum Endpoint size
32.6.2.5 Start-of-Frame
When a Start-of-Frame (SOF) token is detected, the frame number from the token is stored in the Frame Number
field in the Device Frame Number register (FNUM.FNUM), and the Start-of-Frame interrupt bit in the Device Interrupt
Flag register (INTFLAG.SOF) is set. If there is a CRC or bit-stuff error, the Frame Number Error status flag
(FNUM.FNCERR) in the FNUM register is set.
When the data PID matches and if the Received Setup Complete interrupt bit in the Device Endpoint Interrupt Flag
register (EPINTFLAG.RXSTP) is equal to zero, ignoring the Bank 0 Ready bit in the Device Endpoint Status register
(EPSTATUS.BK0RDY), the incoming data is written to the data buffer pointed to by the Data Buffer Address (ADDR).
If the number of received data bytes exceeds the endpoint's maximum data payload size as specified by the
PCKSIZE.SIZE, the remainders of the received data bytes are discarded. The packet will still be checked for bit-stuff
and CRC errors. Software must never report a endpoint size to the host that is greater than the value configured in
PCKSIZE.SIZE. If a bit-stuff or CRC error is detected in the packet, the USB module returns to idle and waits for the
next token packet.
If data is successfully received, an ACK handshake is returned to the host, and the number of received data bytes,
excluding the CRC, is written to the Byte Count (PCKSIZE.BYTE_COUNT). If the number of received data bytes is
the maximum data payload specified by PCKSIZE.SIZE, no CRC data is written to the data buffer. If the number of
received data bytes is the maximum data payload specified by PCKSIZE.SIZE minus one, only the first CRC data is
written to the data buffer. If the number of received data is equal or less than the data payload specified by
PCKSIZE.SIZE minus two, both CRC data bytes are written to the data buffer.
Finally the EPSTATUS is updated. Data Toggle OUT bit (EPSTATUS.DTGLOUT), the Data Toggle IN bit
(EPSTATUS.DTGLIN), the current bank bit (EPSTATUS.CURRBK) and the Bank Ready 0 bit (EPSTATUS.BK0RDY)
are set. Bank Ready 1 bit (EPSTATUS.BK1RDY) and the Stall Bank 0/1 bit (EPSTATUS.STALLQR0/1) are cleared on
receiving the SETUP request. The RXSTP bit is set and triggers an interrupt if the Received Setup Interrupt Enable
bit is set in Endpoint Interrupt Enable Set/Clear register (EPINTENSET/CLR.RXSTP).
When an OUT token is detected, and the device address of the token packet does not match DADD.DADD, the
packet is discarded and the USB module returns to idle and waits for the next token packet.
If the address matches, the USB module checks if the endpoint number received is enabled in the EPCFG of the
addressed endpoint. If the addressed endpoint is disabled, the packet is discarded and the USB module returns to
idle and waits for the next token packet.
When the endpoint is enabled, the USB module then checks the Endpoint Configuration register (EPCFG) of the
addressed output endpoint. If the type of the endpoint (EPCFG.EPTYPE0) is not set to OUT, the USB module returns
to idle and waits for the next token packet.
The USB module then fetches the Data Buffer Address (ADDR) from the addressed endpoint's descriptor, and waits
for a DATA0 or DATA1 packet. If a PID error or any other PID than DATA0 or DATA1 is detected, the USB module
returns to idle and waits for the next token packet.
If EPSTATUS.STALLRQ0 in EPSTATUS is set, the incoming data is discarded. If the endpoint is not isochronous, a
STALL handshake is returned to the host and the Transmit Stall Bank 0 interrupt bit in EPINTFLAG
(EPINTFLAG.STALL0) is set.
For isochronous endpoints, data from both a DATA0 and DATA1 packet will be accepted. For other endpoint types
the PID is checked against EPSTATUS.DTGLOUT. If a PID mismatch occurs, the incoming data is discarded, and an
ACK handshake is returned to the host.
If EPSTATUS.BK0RDY is set, the incoming data is discarded, the bit Transmit Fail 0 interrupt bit in EPINTFLAG
(EPINTFLAG.TRFAIL0) and the status bit STATUS_BK.ERRORFLOW are set. If the endpoint is not isochronous, a
NAK handshake is returned to the host.
The incoming data is written to the data buffer pointed to by the Data Buffer Address (ADDR). If the number of
received data bytes exceeds the maximum data payload specified as PCKSIZE.SIZE, the remainders of the received
data bytes are discarded. The packet will still be checked for bit-stuff and CRC errors. If a bit-stuff or CRC error is
detected in the packet, the USB module returns to idle and waits for the next token packet.
If the endpoint is isochronous and a bit-stuff or CRC error in the incoming data, the number of received data bytes,
excluding CRC, is written to PCKSIZE.BYTE_COUNT. Finally the EPINTFLAG.TRFAIL0 and CRC Error bit in the
Device Bank Status register (STATUS_BK.CRCERR) is set for the addressed endpoint.
If data was successfully received, an ACK handshake is returned to the host if the endpoint is not isochronous, and
the number of received data bytes, excluding CRC, is written to PCKSIZE.BYTE_COUNT. If the number of received
data bytes is the maximum data payload specified by PCKSIZE.SIZE no CRC data bytes are written to the data
buffer. If the number of received data bytes is the maximum data payload specified by PCKSIZE.SIZE minus one,
only the first CRC data byte is written to the data buffer If the number of received data is equal or less than the data
payload specified by PCKSIZE.SIZE minus two, both CRC data bytes are written to the data buffer.
Finally in EPSTATUS for the addressed output endpoint, EPSTATUS.BK0RDY is set and EPSTATUS.DTGLOUT is
toggled if the endpoint is not isochronous. The flag Transmit Complete 0 interrupt bit in EPINTFLAG
(EPINTFLAG.TRCPT0) is set for the addressed endpoint.
Memory Map
Internal RAM
ENDPOINT 2 DATA
USB Module
EPT 2 EPT 3 EPT 1 DESCADD
USB Endpoints
D D D D D D D D D D D Descriptor Table
A A A A A A A A A A A
T T T T T T T T T T T
A A A A A A A A A A A
0 1 0 0 1 0 1 0 0 1 0 ENDPOINT 3 DATA
DP USB Buffers
DM
I I I
N N N
EPT 2 T EPT 3 T EPT 1 T
O O O ENDPOINT 1 DATA
K K K
E E E
N N N
time
When an IN token is detected, and if the device address of the token packet does not match DADD.DADD, the
packet is discarded and the USB module returns to idle and waits for the next token packet.
When the address matches, the USB module checks if the endpoint received is enabled in the EPCFG of the
addressed endpoint and if not, the packet is discarded and the USB module returns to idle and waits for the next
token packet.
When the endpoint is enabled, the USB module then checks on the EPCFG of the addressed input endpoint. If the
EPCFG.EPTYPE1 is not set to IN, the USB module returns to idle and waits for the next token packet.
If EPSTATUS.STALLRQ1 in EPSTATUS is set, and the endpoint is not isochronous, a STALL handshake is returned
to the host and EPINTFLAG.STALL1 is set.
If EPSTATUS.BK1RDY is cleared, the flag EPINTFLAG.TRFAIL1 is set. If the endpoint is not isochronous, a NAK
handshake is returned to the host.
The USB module then fetches the Data Buffer Address (ADDR) from the addressed endpoint's descriptor. The data
pointed to by the Data Buffer Address (ADDR) is sent to the host in a DATA0 packet if the endpoint is isochronous.
For non-isochronous endpoints a DATA0 or DATA1 packet is sent depending on the state of EPSTATUS.DTGLIN.
When the number of data bytes specified in endpoint PCKSIZE.BYTE_COUNT is sent, the CRC is appended and
sent to the host.
For isochronous endpoints, EPSTATUS.BK1RDY is cleared and EPINTFLAG.TRCPT1 is set.
For all non-isochronous endpoints the USB module waits for an ACK handshake from the host. If an ACK handshake
is not received within 16 bit times, the USB module returns to idle and waits for the next token packet. If an ACK
handshake is successfully received EPSTATUS.BK1RDY is cleared, EPINTFLAG.TRCPT1 is set and
EPSTATUS.DTGLIN is toggled.
Endpoint
single bank
Without Ping Pong
t
Endpoint
dual bank
Bank0
The Bank Select flag in EPSTATUS.CURBK indicates which bank data will be used in the next transaction, and is
updated after each transaction. According to EPSTATUS.CURBK, EPINTFLAG.TRCPT0 or EPINTFLAG.TRFAIL0 or
EPINTFLAG.TRCPT1 or EPINTFLAG.TRFAIL1 in EPINTFLAG and Data Buffer 0/1 ready (EPSTATUS.BK0RDY and
EPSTATUS.BK1RDY) are set. The EPSTATUS.DTGLOUT and EPSTATUS.DTGLIN are updated for the enabled
endpoint direction only.
CTRLA.ENABLE = 1
Idle | CTRLB.DETACH = 0
| INTFLAG.SUSPEND = 0
CTRLA.ENABLE = 0
| CTRLB.DETACH = 1
| INTFLAG.SUSPEND = 1
Active
The Suspend Interrupt bit in the Device Interrupt Flag register (INTFLAG.SUSPEND) is set when a USB Suspend
state has been detected on the USB bus. The USB pad is then automatically put in the Idle state. The detection of a
non-idle state sets the Wake Up Interrupt bit (INTFLAG.WAKEUP) and wakes the USB pad.
The pad goes to the Idle state if the USB module is disabled or if CTRLB.DETACH is written to one. It returns to the
Active state when CTRLA.ENABLE is written to one and CTRLB.DETACH is written to zero.
32.6.2.14 Remote Wakeup
The remote wakeup request (also known as upstream resume) is the only request the device may send on its own
initiative. This should be preceded by a DEVICE_REMOTE_WAKEUP request from the host.
First, the USB must have detected a “Suspend” state on the bus, i.e. the remote wakeup request can only be sent
after INTFLAG.SUSPEND has been set.
The user may then write a one to the Remote Wakeup bit (CTRLB.UPRSM) to send an Upstream Resume to the host
initiating the wakeup. This will automatically be done by the controller after 5 ms of inactivity on the USB bus.
When the controller sends the Upstream Resume INTFLAG.WAKEUP is set and INTFLAG.SUSPEND is cleared.
The CTRLB.UPRSM is cleared at the end of the transmitting Upstream Resume.
In case of a rebroadcast resume initiated by the host, the End of Resume bit (INTFLAG.EORSM) flag is set when the
rebroadcast resume is completed.
In the case where the CTRLB.UPRSM bit is set while a host initiated downstream resume is already started, the
CTRLB.UPRSM is cleared and the upstream resume request is ignored.
32.6.2.15 Link Power Management L1 (LPM-L1) Suspend State Entry and Exit as Device
The LPM Handshake bit in CTRLB.LPMHDSK should be configured to accept the LPM transaction.
When a LPM transaction is received on any enabled endpoint n and a handshake has been sent in response by the
controller according to CTRLB.LPMHDSK, the Device Link Power Manager (EXTREG) register is updated in the
bank 0 of the addressed endpoint's descriptor. It contains information such as the Best Effort Service Latency
(BESL), the Remote Wake bit (bRemoteWake), and the Link State parameter (bLinkState). Usually, the LPM
transaction uses only the endpoint number 0.
If the LPM transaction was positively acknowledged (ACK handshake), USB sets the Link Power Management
Interrupt bit (INTFLAG.LPMSUSP) bit which indicates that the USB transceiver is suspended, reducing power
consumption. This suspend occurs 9 microseconds after the LPM transaction according to the specification.
To further reduce consumption, it is recommended to stop the USB clock while the device is suspended.
The MCU can also enter in one of the available sleep modes if the wakeup time latency of the selected sleep mode
complies with the host latency constraint, refer to the BESL parameter in EXTREG register.
Recovering from this LPM-L1 suspend state is exactly the same as the Suspend state (see Section 32.6.2.13
Suspend State and Pad Behavior) except that the remote wakeup duration initiated by USB is shorter to comply with
the Link Power Management specification.
If the LPM transaction is responded with a NYET, the Link Power Management Not Yet Interrupt Flag
(INTFLAG.LPMNYET) is set. This generates an interrupt if the Link Power Management Not Yet Interrupt Enable bit
(INTENCLR/SET.LPMNYET) is set.
If the LPM transaction is responded with a STALL or no handshake, no flag is set, and the transaction is ignored.
EPINTENSET7.STALL0/STALL1
EPINTFLAG7.TRFAIL1
EPINTENSET7.TRFAIL1
EPINTFLAG7.TRFAIL0
EPINTSMRY
EPINTENSET7.TRFAIL0
EPINTENSET7.RXSTP EPINT6
EPINTFLAG7.TRCPT1
EPINTENSET7.TRCPT1
EPINTFLAG7.TRCPT0
EPINTENSET7.TRCPT0
USB EndPoint
Interrupt
EPINTFLAG0.STALL
EPINTENSET0.STALL0/STALL1
EPINTFLAG0.TRFAIL1
EPINTENSET0.TRFAIL1
EPINTFLAG0.TRFAIL0
EPINTENSET0.TRFAIL0 EPINT1
EPINTFLAG0.RXSTP EPINT0
ENDPOINT0 EPINTENSET0.RXSTP
EPINTFLAG0.TRCPT1
EPINTENSET0.TRCPT1
EPINTFLAG0.TRCPT0
USB
EPINTENSET0.TRCPT0 Interrupt
INTFLAG.LPMSUSP
INTENSET.LPMSUSP
INTFLAG.LPMNYET
INTENSET.DDISC
INTFLAG.RAMACER
INTENSET.RAMACER
INTFLAG.UPRSM
INTFLAG INTENSET.UPRSM
INTFLAG.EORSM
USB Device Interrupt
INTENSET.EORSM
INTFLAG.WAKEUP *
INTENSET.WAKEUP
INTFLAG.EORST
INTENSET.EORST
INTFLAG.SOF
INTENSET.SOF
INTFLAGA.MSOF
INTENSET.MSOF
INTFLAG.SUSPEND
INTENSET.SUSPEND
* Asynchronous interrupt
The WAKEUP is an asynchronous interrupt and can be used to wake-up the device from any sleep mode.
The Ram Access Interrupt bit in Host Interrupt Flag register (INTFLAG.RAMACER) is set when a RAM access
underflow error occurs during an OUT stage.
When a pipe is disabled, the following registers are cleared for that pipe:
• Interval for the Bulk-Out/Ping transaction register (BINTERVAL)
• Pipe Interrupt Enable Clear/Set register (PINTENCLR/SET)
• Pipe Interrupt Flag register (PINTFLAG)
• Pipe Freeze bit in Pipe Status register (PSTATUS.FREEZE)
For control pipes only, the token is assigned a specific initial data toggle sequence:
• SETUP: Data0
• IN: Data1
• OUT: Data1
Pipe Bank Status register (STATUS_BK) for each bank. If the Error Flow bit in the STATUS_BK
(STATUS_BK.ERRORFLOW) is set then the user is able to determine the origin of the data flow error. As the user
knows that the endpoint is an IN or OUT the error flow can be deduced as OUT underflow or as an IN overflow.
An underflow can occur during an OUT stage if the host attempts to send data from an empty bank. If a new
transaction is successful, the relevant bank descriptor STATUS_BK.ERRORFLOW will be cleared.
An overflow can occur during an IN stage if the device tries to send a packet while the bank is full. Typically this
occurs when a CPU is not fast enough. The packet data is not written to the bank and is lost. If a new transaction is
successful, the relevant bank descriptor STATUS_BK.ERRORFLOW will be cleared.
32.6.3.16 Link Power Management L1 (LPM-L1) Suspend State Entry and Exit as Host.
An EXTENDED LPM transaction can be transmitted by any enabled pipe. The PCFGn.PTYPE should be set to
EXTENDED. Other fields as PCFG.PTOKEN, PCFG.BK and PCKSIZE.SIZE are irrelevant in this configuration. The
user should also set the EXTREG.VARIABLE in the descriptor as described in the EXTREG Register.
When the pipe is configured and enabled, an EXTENDED TOKEN followed by a LPM TOKEN are transmitted. The
device responds with a valid HANDSHAKE, corrupted HANDSHAKE or no HANDSHAKE (TIME-OUT).
If the valid HANDSHAKE is an ACK, the host will immediately proceed to L1 SLEEP and the PINTFLAG.TRCT0 is
set. The minimum duration of the L1 SLEEP state will be the TL1RetryAndResidency as defined in the reference
document "ENGINEERING CHANGE NOTICE, USB 2.0 Link Power Management Addendum". When entering the L1
SLEEP state, the CTRLB.SOFE is cleared, avoiding Start-of-Frame generation.
If the valid HANDSHAKE is a NYET PINTFLAG.TRFAIL is set.
If the valid HANDSHAKE is a STALL the PINTFLAG.STALL is set.
If there is no HANDSHAKE or corrupted HANDSHAKE, the EXTENDED/LPM pair of TOKENS will be transmitted
again until reaching the maximum number of retries as defined by the CTRL_PIPE.PERMAX in the pipe descriptor.
If the last retry returns no valid HANDSHAKE, the PINTFLAGn.PERR is set, and the STATUS_BK is updated in the
pipe descriptor.
All LPM transactions, should they end up with a ACK, a NYET, a STALL or a PERR, will set the PSTATUS.PFREEZE
bit, freezing the pipe before a succeeding operation. The user should unfreeze the pipe to start a new LPM
transaction.
To exit the L1 STATE, the user initiate a DOWNSTREAM RESUME by setting the bit CTRLB.RESUME or a L1
RESUME by setting the Send L1 Resume bit in CTRLB (CTRLB.L1RESUME). In the case of a L1 RESUME, the K
STATE duration is given by the BESL bit field in the EXTREG.VARIABLE field. Refer to the EXTREG Register.
When the host is in the L1 SLEEP state after a successful LPM transmitted, the device can initiate an UPSTREAM
RESUME. This will set the Upstream Resume Interrupt bit in INTFLAG (INTFLAG.UPRSM). The host should proceed
then to a L1 RESUME as described above.
After resuming from the L1 SLEEP state, the bit CTRLB.SOFE is set, allowing Start-of-Frame generation.
PINTENSET.STALL
PINTFLAG7.PERR
PINTENSET.PERR
PINTFLAG7.TRFAIL
PINTSMRY
PINTENSET.TRFAIL
PINTENSET.TXSTP PINT6
PINTFLAG7.TRCPT1
PINTENSET.TRCPT1
PINTFLAG7.TRCPT0
PINTENSET.TRCPT0
USB PIPE
Interrupt
PINTFLAG0.STALL
PINTENSET.STALL
PINTFLAG0.PERR
PINTENSET.PERR
PINTFLAG0.TRFAIL
PINTENSET.TRFAIL PINT1
PINTFLAG0.TXSTP PINT0
PIPE0 PINTENSET.TXSTP
PINTFLAG0.TRCPT1
PINTENSET.TRCPT1
PINTFLAG0.TRCPT0
USB
PINTENSET.TRCPT0 Interrupt
INTFLAG.DDISC *
INTENSET.DDISC
INTFLAG.DCONN *
INTENSET.DCONN
INTFLAG.RAMACER
INTFLAGA INTENSET.RAMACER
INTFLAG.UPRSM
USB Host Interrupt
INTENSET.UPRSM
INTFLAG.DNRSM
INTENSET.DNRSM
INTFLAG.WAKEUP *
INTENSET.WAKEUP
INTFLAG.RST
INTENSET.RST
INTFLAG.HSOF
INTENSET.HSOF
* Asynchronous interrupt
The WAKEUP is an asynchronous interrupt and can be used to wake-up the device from any sleep mode.
32.8.1 Control A
Name: CTRLA
Offset: 0x00
Reset: 0x00
Property: PAC Write-Protection, Write-Synchronised
Bit 7 6 5 4 3 2 1 0
MODE RUNSTDBY ENABLE SWRST
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 1 – ENABLE Enable
Due to synchronization there is delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The value
written to CTRLA.ENABLE will read back immediately and the Synchronization status enable bit in the
Synchronization Busy register (SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE will be cleared when the
operation is complete.
This bit is Write-Synchronized.
Value Description
0 The peripheral is disabled or being disabled.
1 The peripheral is enabled or being enabled.
Name: SYNCBUSY
Offset: 0x02
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
ENABLE SWRST
Access R R
Reset 0 0
Name: QOSCTRL
Offset: 0x03
Reset: 0x000x0F
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
DQOS[1:0] CQOS[1:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: FSMSTATUS
Offset: 0x0D
Reset: 0xXXXX
Property: Read only
Bit 7 6 5 4 3 2 1 0
FSMSTATE[6:0]
Access R R R R R R R
Reset 0 0 0 0 0 0 1
Name: DESCADD
Offset: 0x24
Reset: 0x00000000
Property: PAC Write-Protection
Bit 31 30 29 28 27 26 25 24
DESCADD[31:24]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
DESCADD[23:16]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
DESCADD[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
DESCADD[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: PADCAL
Offset: 0x28
Reset: 0x0000
Property: PAC Write-Protection
The Pad Calibration values must be loaded from the NVM Software Calibration Area into the USB Pad Calibration
register by software, before enabling the USB, to achieve the specified accuracy.
Refer to NVM Software Calibration Area Mapping for further details.
Refer to for further details.
Bit 15 14 13 12 11 10 9 8
TRIM[2:0] TRANSN[4:2]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
TRANSN[1:0] TRANSP[4:0]
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
0x00
... Reserved
0x07
7:0 TSTPCKT TSTK TSTJ NREPLY SPDCONF[1:0] UPRSM DETACH
0x08 CTRLB
15:8 LPMHDSK[1:0] GNAK OPMODE2
0x0A DADD 7:0 ADDEN DADD[6:0]
0x0B Reserved
0x0C STATUS 7:0 LINESTATE[1:0] SPEED[1:0]
0x0D
... Reserved
0x0F
7:0 FNUM[4:0] MFNUM[2:0]
0x10 FNUM
15:8 FNCERR FNUM[10:5]
0x12
... Reserved
0x13
7:0 RAMACER UPRSM EORSM WAKEUP EORST SOF MSOF SUSPEND
0x14 INTENCLR
15:8 LPMSUSP LPMNYET
0x16
... Reserved
0x17
7:0 RAMACER UPRSM EORSM WAKEUP EORST SOF MSOF SUSPEND
0x18 INTENSET
15:8 LPMSUSP LPMNYET
0x1A
... Reserved
0x1B
7:0 RAMACER UPRSM EORSM WAKEUP EORST SOF MSOF SUSPEND
0x1C INTFLAG
15:8 LPMSUSP LPMNYET
0x1E
... Reserved
0x1F
7:0 EPINT7 EPINT6 EPINT5 EPINT4 EPINT3 EPINT2 EPINT1 EPINT0
0x20 EPINTSMRY
15:8
32.10.1 Control B
Name: CTRLB
Offset: 0x08
Reset: 0x0000
Property: PAC Write-Protection
Bit 15 14 13 12 11 10 9 8
LPMHDSK[1:0] GNAK OPMODE2
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
TSTPCKT TSTK TSTJ NREPLY SPDCONF[1:0] UPRSM DETACH
Access R/W R/W R/W R R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
This bit has no effect for any other endpoint but endpoint 0.
Value Description
0 Disable the “NO_REPLY” feature: Any transaction to endpoint 0 will be handled according to the
USB2.0 standard.
1 Enable the “NO_REPLY” feature: Any transaction to endpoint 0 will be ignored except SETUP.
Bit 0 – DETACH Detach
Value Description
0 The device is attached to the USB bus so that communications may occur.
1 It is the default value at reset. The internal device pull-ups are disabled, removing the device from the
USB bus.
Name: DADD
Offset: 0x0A
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
ADDEN DADD[6:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
32.10.3 Status
Name: STATUS
Offset: 0x0C
Reset: 0x40
Property: -
Bit 7 6 5 4 3 2 1 0
LINESTATE[1:0] SPEED[1:0]
Access R R R/W R/W
Reset 0 1 0 1
Name: FNUM
Offset: 0x10
Reset: 0x0000
Property: Read only
Bit 15 14 13 12 11 10 9 8
FNCERR FNUM[10:5]
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
FNUM[4:0] MFNUM[2:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: INTENCLR
Offset: 0x14
Reset: 0x0000
Property: PAC Write-Protection
This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Set (INTENSET) register.
Bit 15 14 13 12 11 10 9 8
LPMSUSP LPMNYET
Access R/W R/W
Reset 0 0
Bit 7 6 5 4 3 2 1 0
RAMACER UPRSM EORSM WAKEUP EORST SOF MSOF SUSPEND
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: INTENSET
Offset: 0x18
Reset: 0x0000
Property: PAC Write-Protection
This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Clear (INTENCLR) register.
Bit 15 14 13 12 11 10 9 8
LPMSUSP LPMNYET
Access R/W R/W
Reset 0 0
Bit 7 6 5 4 3 2 1 0
RAMACER UPRSM EORSM WAKEUP EORST SOF MSOF SUSPEND
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: INTFLAG
Offset: 0x01C
Reset: 0x0000
Property: -
Bit 15 14 13 12 11 10 9 8
LPMSUSP LPMNYET
Access R/W R/W
Reset 0 0
Bit 7 6 5 4 3 2 1 0
RAMACER UPRSM EORSM WAKEUP EORST SOF MSOF SUSPEND
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: EPINTSMRY
Offset: 0x20
Reset: 0x0000
Property: -
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
EPINT7 EPINT6 EPINT5 EPINT4 EPINT3 EPINT2 EPINT1 EPINT0
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
0x00
... Reserved
0xFF
0x0100 EPCFGn 7:0 NYETDIS EPTYPE1[2:0] EPTYPE0[2:0]
0x0101
... Reserved
0x0103
0x0104 EPSTATUSCLRn 7:0 BK1RDY BK0RDY STALLRQ1 STALLRQ0 CURBK DTGLIN DTGLOUT
0x0105 EPSTATUSSETn 7:0 BK1RDY BK0RDY STALLRQ1 STALLRQ0 CURBK DTGLIN DTGLOUT
0x0106 EPSTATUSn 7:0 BK1RDY BK0RDY STALLRQ1 STALLRQ0 CURBK DTGLIN DTGLOUT
0x0107 EPINTFLAGn 7:0 STALL1 STALL0 RXSTP TRFAIL1 TRFAIL0 TRCPT1 TRCPT0
0x0108 EPINTENCLRn 7:0 STALL1 STALL0 RXSTP TRFAIL1 TRFAIL0 TRCPT1 TRCPT0
0x0109 EPINTENSETn 7:0 STALL1 STALL0 RXSTP TRFAIL1 TRFAIL0 TRCPT1 TRCPT0
Name: EPCFGn
Offset: 0x100 [+ (n x 0x20)]
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
NYETDIS EPTYPE1[2:0] EPTYPE0[2:0]
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Name: EPSTATUSCLRn
Offset: 0x104 [+ (n * 0x20)]
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
BK1RDY BK0RDY STALLRQ1 STALLRQ0 CURBK DTGLIN DTGLOUT
Access W W W W W W W
Reset 0 0 0 0 0 0 0
Name: EPSTATUSSETn
Offset: 0x105 [+ (n x 0x20)]
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
BK1RDY BK0RDY STALLRQ1 STALLRQ0 CURBK DTGLIN DTGLOUT
Access W W W W W W W
Reset 0 0 0 0 0 0 0
Name: EPSTATUSn
Offset: 0x106 [ + (n x 0x20)]
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
BK1RDY BK0RDY STALLRQ1 STALLRQ0 CURBK DTGLIN DTGLOUT
Access R R R R R R R
Reset 0 0 0 2 0 0 0
Value Description
0 The PID of the next expected OUT transaction will be zero: data 0.
1 The PID of the next expected OUR transaction will be one: data 1.
Name: EPINTFLAGn
Offset: 0x107 [+ (n x 0x20)]
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
STALL1 STALL0 RXSTP TRFAIL1 TRFAIL0 TRCPT1 TRCPT0
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 2 0 0 2 0 2
Name: EPINTENCLRn
Offset: 0x108 [+ (n x 0x20)]
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Endpoint Interrupt Enable Set (EPINTENSET) register.
Bit 7 6 5 4 3 2 1 0
STALL1 STALL0 RXSTP TRFAIL1 TRFAIL0 TRCPT1 TRCPT0
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 2 0 0 2 0 2
Name: EPINTENSETn
Offset: 0x109 [+ (n x 0x20)]
Reset: 0x0000
Property: PAC Write-Protection
This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Endpoint Interrupt Enable Set (EPINTENCLR) register. This register is cleared by
USB reset or when EPEN[n] is zero.
Bit 7 6 5 4 3 2 1 0
STALL1 STALL0 RXSTP TRFAIL1 TRFAIL0 TRCPT1 TRCPT0
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 2 0 0 2 0 2
EPn BK1
EPn BK0
Endpoint
descriptors
Reserved
STATUS_BK
Bank1 Reserved
Descriptor En
PCKSIZE
ADDR
(2 x 0xn0) + 0x10
Reserved
STATUS_BK
Bank0 EXTREG
PCKSIZE
Growing Memory Addresses
ADDR 2 x 0xn0
Reserved +0x01B
STATUS_BK +0x01A
Bank1 Reserved +0x018
Descriptor E0
PCKSIZE +0x014
ADDR +0x010
Reserved +0x00B
Bank0
STATUS_BK +0x00A
EXTREG +0x008
PCKSIZE +0x004
ADDR +0x000 DESCADD
7:0 ADDR[7:0]
15:8 ADDR[15:8]
0x00 ADDR
23:16 ADDR[23:16]
31:24 ADDR[31:24]
7:0 BYTE_COUNT[7:0]
15:8 MULTI_PACKET_SIZE[1:0] BYTE_COUNT[13:8]
0x04 PCKSIZE
23:16 MULTI_PACKET_SIZE[9:2]
31:24 AUTO_ZLP SIZE[2:0] MULTI_PACKET_SIZE[13:10]
7:0 VARIABLE[3:0] SUBPID[3:0]
0x08 EXTREG
15:8 VARIABLE[10:4]
0x0A STATUS_BK 7:0 ERRORFLOW CRCERR
Name: ADDR
Offset: 0x00
Reset: 0xXXXXXXX
Property: NA
Bit 31 30 29 28 27 26 25 24
ADDR[31:24]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset x x x x x x x x
Bit 23 22 21 20 19 18 17 16
ADDR[23:16]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset x x x x x x x x
Bit 15 14 13 12 11 10 9 8
ADDR[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset x x x x x x x x
Bit 7 6 5 4 3 2 1 0
ADDR[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset x x x x x x x x
Name: PCKSIZE
Offset: 0x04
Reset: 0xXXXXXXXX
Property: NA
Bit 31 30 29 28 27 26 25 24
AUTO_ZLP SIZE[2:0] MULTI_PACKET_SIZE[13:10]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset x 0 0 x 0 0 0 0
Bit 23 22 21 20 19 18 17 16
MULTI_PACKET_SIZE[9:2]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
MULTI_PACKET_SIZE[1:0] BYTE_COUNT[13:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 x 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
BYTE_COUNT[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 x
Value Description
0x0 8 Byte
0x1 16 Byte
0x2 32 Byte
0x3 64 Byte
0x4 128 Byte(1)
0x5 256 Byte(1)
0x6 512 Byte(1)
0x7 1023 Byte(1)
Note: 1. For isochronous endpoint only.
Name: EXTREG
Offset: 0x08
Reset: 0xXXXXXXX
Property: NA
Bit 15 14 13 12 11 10 9 8
VARIABLE[10:4]
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
VARIABLE[3:0] SUBPID[3:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 x 0 0 0 x
VARIABLES Description
VARIABLE[3:0] bLinkState (1)
VARIABLE[7:4] BESL (2)
VARIABLE[8] bRemoteWake (1)
VARIABLE[10:9] Reserved
1. For a definition of LPM Token bRemoteWake and bLinkState fields, refer to "Table 2-3 in the reference
document ENGINEERING CHANGE NOTICE, USB 2.0 Link Power Management Addendum".
2. For a definition of LPM Token BESL field, refer to "Table 2-3 in the reference document ENGINEERING
CHANGE NOTICE, USB 2.0 Link Power Management Addendum" and "Table X-X1 in Errata for ECN USB 2.0
Link Power Management.
Name: STATUS_BK
Offset: 0x0A
Reset: 0xXXXXXXX
Property: NA
Bit 7 6 5 4 3 2 1 0
ERRORFLOW CRCERR
Access R/W R/W
Reset x x
0x00
... Reserved
0x07
AUTORESUM
7:0 TSTK TSTJ SPDCONF[1:0] RESUME
0x08 CTRLB E
15:8 L1RESUME VBUSOK BUSRESET SOFE
0x0A HSOFC 7:0 FLENCE FLENC[3:0]
0x0B Reserved
0x0C STATUS 7:0 LINESTATE[1:0] SPEED[1:0]
0x0D
... Reserved
0x0F
7:0 FNUM[4:0] MFNUM[2:0]
0x10 FNUM
15:8 FNUM[10:5]
0x12 FLENHIGH 7:0 FLENHIGH[7:0]
0x13 Reserved
7:0 RAMACER UPRSM DNRSM WAKEUP RST HSOF
0x14 INTENCLR
15:8 DDISC DCONN
0x16
... Reserved
0x17
7:0 RAMACER UPRSM DNRSM WAKEUP RST HSOF
0x18 INTENSET
15:8 DDISC DCONN
0x1A
... Reserved
0x1B
7:0 RAMACER UPRSM DNRSM WAKEUP RST HSOF
0x1C INTFLAG
15:8 DDISC DCONN
0x1E
... Reserved
0x1F
7:0 EPINT7 EPINT6 EPINT5 EPINT4 EPINT3 EPINT2 EPINT1 EPINT0
0x20 PINTSMRY
15:8
32.17.1 Control B
Name: CTRLB
Offset: 0x08
Reset: 0x0000
Property: PAC Write-Protection
Bit 15 14 13 12 11 10 9 8
L1RESUME VBUSOK BUSRESET SOFE
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
TSTK TSTJ AUTORESUME SPDCONF[1:0] RESUME
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 10 – VBUSOK VBUS is OK
This notifies the USB HOST that USB operations can be started. When this bit is zero and even if the USB HOST is
configured and enabled, HOST operation is halted. Setting this bit will allow HOST operation when the USB is
configured and enabled.
Value Description
0 The USB module is notified that the VBUS on the USB line is not powered.
1 The USB module is notified that the VBUS on the USB line is powered.
Value Description
0 The Auto Resume is disabled.
1 Enable Auto Resume
Name: HSOFC
Offset: 0x0A
Reset: 0x00
Property: PAC Write-Protection
During a very short period just before transmitting a Start-of-Frame, this register is locked. Thus, after writing, it is
recommended to check the register value, and write this register again if necessary. This register is cleared upon a
USB reset.
Bit 7 6 5 4 3 2 1 0
FLENCE FLENC[3:0]
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Value Description
0 Start-of-Frame is generated every 1ms.
1 Start-of-Frame generation depends on the signed value of FLENC[3:0].
USB Start-of-Frame period equals 1ms + (FLENC[3:0]/12000)ms
32.17.3 Status
Name: STATUS
Offset: 0x0C
Reset: 0x00
Property: Read only
Bit 7 6 5 4 3 2 1 0
LINESTATE[1:0] SPEED[1:0]
Access R R R/W R/W
Reset 0 0 0 0
Name: FNUM
Offset: 0x10
Reset: 0x0000
Property: PAC Write-Protection
Bit 15 14 13 12 11 10 9 8
FNUM[10:5]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
FNUM[4:0] MFNUM[2:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: FLENHIGH
Offset: 0x12
Reset: 0x00
Property: Read-Only
Bit 7 6 5 4 3 2 1 0
FLENHIGH[7:0]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Name: INTENCLR
Offset: 0x14
Reset: 0x0000
Property: PAC Write-Protection
This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Set (INTENSET) register.
Bit 15 14 13 12 11 10 9 8
DDISC DCONN
Access R/W R/W
Reset 0 0
Bit 7 6 5 4 3 2 1 0
RAMACER UPRSM DNRSM WAKEUP RST HSOF
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Name: INTENSET
Offset: 0x18
Reset: 0x0000
Property: PAC Write-Protection
This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Clear (INTENCLR) register.
Bit 15 14 13 12 11 10 9 8
DDISC DCONN
Access R/W R/W
Reset 0 0
Bit 7 6 5 4 3 2 1 0
RAMACER UPRSM DNRSM WAKEUP RST HSOF
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Writing a one to this bit will set the Wake Up interrupt Enable bit and enable the WAKEUP interrupt request.
Value Description
0 The WakeUp interrupt is disabled.
1 The WakeUp interrupt is enabled.
Name: INTFLAG
Offset: 0x1C
Reset: 0x0000
Property: -
Bit 15 14 13 12 11 10 9 8
DDISC DCONN
Access R/W R/W
Reset 0 0
Bit 7 6 5 4 3 2 1 0
RAMACER UPRSM DNRSM WAKEUP RST HSOF
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Name: PINTSMRY
Offset: 0x20
Reset: 0x0000
Property: Read-only
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
EPINT7 EPINT6 EPINT5 EPINT4 EPINT3 EPINT2 EPINT1 EPINT0
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bits 0, 1, 2, 3, 4, 5, 6, 7 – EPINT
The flag EPINTn is set when an interrupt is triggered by the pipe n. See the PINTFLAG register in the Host Pipe
Register section.
This bit will be cleared when there are no interrupts pending for Pipe n.
Writing to this bit has no effect.
0x00
... Reserved
0xFF
0x0100 PCFGn 7:0 PTYPE[2:0] BK PTOKEN[1:0]
0x0101
... Reserved
0x0102
0x0103 BINTERVAL 7:0 BINTERVAL[7:0]
0x0104 PSTATUSCLR 7:0 BK1RDY BK0RDY PFREEZE CURBK DTGL
0x0105 PSTATUSSET 7:0 BK1RDY BK0RDY PFREEZE CURBK DTGL
0x0106 PSTATUS 7:0 BK1RDY BK0RDY PFREEZE CURBK DTGL
0x0107 PINTFLAG 7:0 STALL TXSTP PERR TRFAIL TRCPT1 TRCPT0
0x0108 PINTENCLR 7:0 STALL TXSTP PERR TRFAIL TRCPT1 TRCPT0
0x0109 PINTENSET 7:0 STALL TXSTP PERR TRFAIL TRCPT1 TRCPT0
Name: PCFGn
Offset: 0x100 [ + (n x 0x20)]
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
PTYPE[2:0] BK PTOKEN[1:0]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
PTYPE[2:0] Description
0x0 Pipe is disabled
0x1 Pipe is enabled and configured as CONTROL
0x2 Pipe is enabled and configured as ISO
0x3 Pipe is enabled and configured as BULK
0x4 Pipe is enabled and configured as INTERRUPT
0x5 Pipe is enabled and configured as EXTENDED
0x06-0x7 Reserved
BK (1) Description
0x0 Single-bank endpoint
0x1 Dual-bank endpoint
PTOKEN[1:0](1) Description
0x0 SETUP(2)
0x1 IN
0x2 OUT
0x3 Reserved
Name: BINTERVAL
Offset: 0x103 [ + (n x 0x20)]
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
BINTERVAL[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
BINTERVAL Description
=0 Multiple consecutive OUT token is sent in the same frame until it is acked by the peripheral
>0 One OUT token is sent every BINTERVAL frame until it is acked by the peripheral
Depending from the type of pipe the desired period is defined as:
PTYPE Description
Interrupt 1 ms to 255 ms
Isochronous 2^(Binterval) * 1 ms
Bulk or control 1 ms to 255 ms
EXT LPM bInterval ignored. Always 1 ms when a NYET is received.
Name: PSTATUSCLR
Offset: 0x104 [ + (n x 0x20)]
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
BK1RDY BK0RDY PFREEZE CURBK DTGL
Access W W W W W
Reset 0 0 0 0 0
Name: PSTATUSSET
Offset: 0x105 [ + (n x 0x20)]
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
BK1RDY BK0RDY PFREEZE CURBK DTGL
Access W W W W W
Reset 0 0 0 0 0
Name: PSTATUS
Offset: 0x106 [ + (n x 0x20)]
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
BK1RDY BK0RDY PFREEZE CURBK DTGL
Access R R R R R
Reset 0 0 0 0 0
Value Description
1 The PID of the next expected transaction will be one: data 1.
Name: PINTFLAG
Offset: 0x107 [ + (n x 0x20)]
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
STALL TXSTP PERR TRFAIL TRCPT1 TRCPT0
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 2
Name: PINTENCLR
Offset: 0x108 [ + (n x 0x20)]
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Pipe Interrupt Enable Set (PINTENSET) register.
This register is cleared by USB reset or when PEN[n] is zero.
Bit 7 6 5 4 3 2 1 0
STALL TXSTP PERR TRFAIL TRCPT1 TRCPT0
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 2
Value Description
1 The Transfer Complete Bank x interrupt is enabled and an interrupt request will be generated when the
Transfer Complete interrupt x Flag is set.
Name: PINTENSET
Offset: 0x109 [ + (n x 0x20)]
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Pipe Interrupt Enable Set (PINTENCLR) register.
This register is cleared by USB reset or when PEN[n] is zero.
Bit 7 6 5 4 3 2 1 0
STALL TXSTP PERR TRFAIL TRCPT1 TRCPT0
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 2
Pn BK1
Pn BK0
Pipe descriptors
Reserved
STATUS _PIPE
CTRL_BK
Bank1
Reserved
Reserved
Descriptor Pn
PCKSIZE
ADDR (2 x 0xn0) + 0x10
Reserved
STATUS _PIPE
CTRL_PIPE
Bank0
STATUS_BK
EXTREG
PCKSIZE
ADDR 2 x 0xn0
Reserved +0x01F
Growing Memory Addresses
PCKSIZE +0x014
ADDR +0x010
Reserved +0x00F
STATUS _PIPE +0x00E
CTRL_PIPE +0x00C
Bank0
STATUS_BK +0x00A
EXTREG +0x008
PCKSIZE +0x004
ADDR +0x000 DESCADD
7:0 ADDR[7:0]
15:8 ADDR[15:8]
0x00 ADDR
23:16 ADDR[23:16]
31:24 ADDR[31:24]
7:0
15:8 MULTI_PACKET_SIZE[1:0] BYTE_COUNT[5:0]
0x04 PCKSIZE
23:16 MULTI_PACKET_SIZE[9:2]
31:24 AUTO_ZLP SIZE[2:0] MULTI_PACKET_SIZE[13:10]
7:0 VARIABLE[3:0] SUBPID[3:0]
0x08 EXTREG
15:8 VARIABLE[10:4]
0x0A STATUS_BK 7:0 ERRORFLOW CRCERR
0x0B Reserved
7:0 PDADDR[6:0]
0x0C CTRL_PIPE
15:8 PERMAX[3:0] PEPNUM[3:0]
7:0 ERCNT[2:0] CRC16ER TOUTER PIDER DAPIDER DTGLER
0x0E STATUS_PIPE
15:8
Name: ADDR
Offset: 0x00
Reset: 0xxxxxxxx
Property: NA
Bit 31 30 29 28 27 26 25 24
ADDR[31:24]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 23 22 21 20 19 18 17 16
ADDR[23:16]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
ADDR[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
ADDR[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 x
Name: PCKSIZE
Offset: 0x04
Reset: 0xXXXXXXX
Property: NA
Bit 31 30 29 28 27 26 25 24
AUTO_ZLP SIZE[2:0] MULTI_PACKET_SIZE[13:10]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset x 0 0 x 0 0 0 0
Bit 23 22 21 20 19 18 17 16
MULTI_PACKET_SIZE[9:2]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
MULTI_PACKET_SIZE[1:0] BYTE_COUNT[5:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 x 0 0 0 0 0 x
Bit 7 6 5 4 3 2 1 0
Access
Reset
SIZE[2:0] Description
0x0 8 Byte
0x1 16 Byte
0x2 32 Byte
0x3 64 Byte
0x4 128 Byte(1)
0x5 256 Byte(1)
0x6 512 Byte(1)
0x7 1024 Byte in HS mode(1)
1023 Byte in FS mode(1)
Note:
1. For Isochronous pipe only.
For IN pipes, MULTI_PACKET_SIZE holds the total number of bytes sent. MULTI_PACKET_SIZE should be written
to zero when setting up a new transfer.
For OUT pipes, MULTI_PACKET_SIZE holds the total data size for the complete transfer. This value must be a
multiple of the maximum packet size.
Name: EXTREG
Offset: 0x08
Reset: 0xXXXXXXX
Property: NA
Bit 15 14 13 12 11 10 9 8
VARIABLE[10:4]
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
VARIABLE[3:0] SUBPID[3:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 x 0 0 0 x
VARIABLE Description
VARIABLE[3:0] bLinkState(1)
VARIABLE[7:4] BESL (See LPM ECN)(2)
VARIABLE[8] bRemoteWake(1)
VARIABLE[10:9] Reserved
Note:
1. For a definition of LPM Token bRemoteWake and bLinkState fields, refer to "Table 2-3 in the reference
document ENGINEERING CHANGE NOTICE, USB 2.0 Link Power Management Addendum".
2. For a definition of LPM Token BESL field, refer to "Table 2-3 in the reference document ENGINEERING
CHANGE NOTICE, USB 2.0 Link Power Management Addendum" and "Table X-X1 in Errata for ECN USB 2.0
Link Power Management.
Name: STATUS_BK
Offset: 0x0A
Reset: 0xXXXXXXX
Property: NA
Bit 7 6 5 4 3 2 1 0
ERRORFLOW CRCERR
Access R/W R/W
Reset x x
Name: CTRL_PIPE
Offset: 0x0C
Reset: 0xXXXX
Property: PAC Write-Protection, Write-Synchronized, Read-Synchronized
Bit 15 14 13 12 11 10 9 8
PERMAX[3:0] PEPNUM[3:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 x 0 0 0 x
Bit 7 6 5 4 3 2 1 0
PDADDR[6:0]
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 x
Name: STATUS_PIPE
Offset: 0x0E
Reset: 0xXXXXXXX
Property: PAC Write-Protection, Write-Synchronized, Read-Synchronized
Bit 15 14 13 12 11 10 9 8
Access
Reset
Bit 7 6 5 4 3 2 1 0
ERCNT[2:0] CRC16ER TOUTER PIDER DAPIDER DTGLER
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 x x x x x x
33.1 Overview
The Analog-to-Digital Converter (ADC) converts analog signals to digital values. The ADC has 12-bit resolution, and
is capable of converting up to 350ksps. The input selection is flexible, and both differential and single-ended
measurements can be performed. An optional gain stage is available to increase the dynamic range. In addition,
several internal signal inputs are available. The ADC can provide both signed and unsigned results.
ADC measurements can be started by either application software or an incoming event from another peripheral in the
device. ADC measurements can be started with predictable timing, and without software intervention.
Both internal and external reference voltages can be used.
An integrated temperature sensor is available for use with the ADC. The bandgap voltage as well as the scaled I/O
and core voltages can also be measured by the ADC.
The ADC has a compare function for accurate monitoring of user-defined thresholds, with minimum software
intervention required.
The ADC may be configured for 8-, 10- or 12-bit results, reducing the conversion time. ADC conversion results are
provided left- or right-adjusted, which eases calculation when the result is represented as a signed value. It is
possible to use DMA to move ADC results directly to memory or peripherals when conversions are done.
33.2 Features
• 8-, 10- or 12-bit resolution
• Up to 350,000 samples per second (350ksps)
• Differential and single-ended inputs
– Up to 32 analog input
– 25 positive and 10 negative, including internal and external
• Five internal inputs
– Bandgap
– Temperature sensor
– DAC
– Scaled core supply
– Scaled I/O supply
• 1/2x to 16x gain
• Single, continuous and pin-scan conversion options
• Windowing monitor with selectable channel
• Conversion range:
– Vref [1v to VDDANA - 0.6V]
– ADCx * GAIN [0V to -Vref ]
• Built-in internal reference and external reference options
– Four bits for reference selection
• Event-triggered conversion for accurate timing (one event input)
• Optional DMA transfer of conversion result
• Hardware gain and offset compensation
• Averaging and oversampling with decimation to support, up to 16-bit result
• Selectable sampling time
CTRLA WINCTRL
AVGCTRL WINLT
SAMPCTRL WINUT
INPUTCTRL
EVCTRL OFFSETCORR
SWTRIG GAINCORR
ADC0
...
ADCn
INT.SIG
ADC POST
PROCESSING
RESULT
ADC0
...
ADCn
INT.SIG
INT1V CTRLB
INTVCC
VREFA
VREFB
PRESCALER
REFCTRL
Note: INT1V is the buffered internal reference of 1.0V (for ADC and DAC), derived from the internal 1.1V bandgap
reference.
Note: Refer to Configuration Summary for details on exact number of analog input channels.
Note: Refer to I/O Multiplexing and Considerations for details on the pin mapping for this peripheral. One signal can
be mapped on several pins.
Related Links
7. I/O Multiplexing and Considerations
2. Configuration Summary
Related Links
23. PORT - I/O Pin Controller
33.5.3 Clocks
The ADC bus clock (CLK_APB_ADCx) can be enabled in the Main Clock, which also defines the default state.
The ADC requires a generic clock (GCLK_ADC). This clock must be configured and enabled in the Generic Clock
Controller (GCLK) before using the ADC.
A generic clock is asynchronous to the bus clock. Due to this asynchronicity, writes to certain registers will require
synchronization between the clock domains. Refer to Synchronization for further details.
Related Links
16.6.2.6 Peripheral Clock Masking
15. GCLK - Generic Clock Controller
33.5.4 DMA
The DMA request line is connected to the DMA Controller (DMAC). Using the ADC DMA requests requires the DMA
Controller to be configured first.
Related Links
20. DMAC – Direct Memory Access Controller
33.5.5 Interrupts
The interrupt request line is connected to the interrupt controller. Using the ADC interrupt requires the interrupt
controller to be configured first.
Related Links
11.2 Nested Vector Interrupt Controller
33.5.6 Events
The events are connected to the Event System.
Related Links
24. EVSYS – Event System
33.5.10 Calibration
The BIAS and LINEARITY calibration values from the production test must be loaded from the NVM Software
Calibration Area into the ADC Calibration register (CALIB) by software to achieve specified accuracy.
Related Links
10.3.2 NVM Software Calibration Area Mapping
33.6.2.1 Initialization
Before enabling the ADC, the asynchronous clock source must be selected and enabled, and the ADC reference
must be configured. The first conversion after the reference is changed must not be used. All other configuration
registers must be stable during the conversion. The source for GCLK_ADC is selected and enabled in the System
Controller (SYSCTRL). Refer to SYSCTRL – System Controller for more details.
When GCLK_ADC is enabled, the ADC can be enabled by writing a one to the Enable bit in the Control Register A
(CTRLA.ENABLE).
Related Links
17. SYSCTRL – System Controller
33.6.2.3 Operation
In the most basic configuration, the ADC samples values from the configured internal or external sources
(INPUTCTRL register). The rate of the conversion depends on the combination of the GCLK_ADCx frequency and
the clock prescaler.
To convert analog values to digital values, the ADC needs to be initialized first, as described in 33.6.2.1 Initialization.
Data conversion can be started either manually by setting the Start bit in the Software Trigger register
(SWTRIG.START=1), or automatically by configuring an automatic trigger to initiate the conversions. A free-running
mode can be used to continuously convert an input channel. When using free-running mode the first conversion must
be started, while subsequent conversions will start automatically at the end of previous conversions.
The automatic trigger can be configured to trigger on many different conditions.
The result of the conversion is stored in the Result register (RESULT) overwriting the result from the previous
conversion.
To avoid data loss if more than one channel is enabled, the conversion result must be read as soon as it is available
(INTFLAG.RESRDY). Failing to do so will result in an overrun error condition, indicated by the OVERRUN bit in the
Interrupt Flag Status and Clear register (INTFLAG.OVERRUN). When the RESRDY interrupt flag is set, the new
result has been synchronized to the RESULT register.
To enable one of the available interrupts sources, the corresponding bit in the Interrupt Enable Set register
(INTENSET) must be written to '1'.
33.6.3 Prescaler
The ADC is clocked by GCLK_ADC. There is also a prescaler in the ADC to enable conversion at lower clock rates.
Refer to CTRLB for details on prescaler settings.
Figure 33-2. ADC Prescaler
DIV128
DIV256
DIV512
DIV16
DIV32
DIV64
DIV4
DIV8
CTRLB.PRESCALER[2:0]
CLK_ADC
The propagation delay of an ADC measurement depends on the selected mode and is given by:
• Single-shot mode:
Resolution
1+ 2
+ DelayGain
PropagationDelay =
�CLK+ − ADC
• Free-running mode:
Resolution
2
+ DelayGain
PropagationDelay =
�CLK+ − ADC
...........continued
Delay Gain (in CLK_ADC Period)
INTPUTCTRL.GAIN[3:0] Free-running mode Single shot mode
Name Differential Mode Single-Ended Differential mode Single-Ended
Mode mode
4X 0x2 1 1 1 2
8X 0x3 1 2 1.5 2.5
16X 0x4 2 2 2 3
Reserved 0x5 ... 0xE Reserved Reserved Reserved Reserved
DIV2 0xF 0 1 0.5 1.5
1 2 3 4 5 6 7 8
CLK_ ADC
START
SAMPLE
INT
Converting Bit MS B 10 9 8 7 6 5 4 3 2 1 LS B
The sampling time can be increased by using the Sampling Time Length bit group in the Sampling Time Control
register (SAMPCTRL.SAMPLEN). As example, the next figure is showing the timing conversion.
Figure 33-4. ADC Timing for One Conversion in Differential Mode without Gain, but with Increased Sampling
Time
1 2 3 4 5 6 7 8 9 10 11
CLK_ ADC
START
SAMPLE
INT
Converting Bit MS B 10 9 8 7 6 5 4 3 2 1 LS B
Figure 33-5. ADC Timing for Free Running in Differential Mode without Gain
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
CLK_ ADC
START
SAMPLE
INT
Converting Bit 11 10 9 8 7 6 5 4 3 2 1 0 11 10 9 8 7 6 5 4 3 2 1 0 11 10 9 8 7 6 5
Figure 33-6. ADC Timing for One Conversion in Single-Ended Mode without Gain
1 2 3 4 5 6 7 8 9 10 11
CLK_ADC
START
SAMPLE
AMPLIFY
INT
Converting Bit MS B 10 9 8 7 6 5 4 3 2 1 LS B
Figure 33-7. ADC Timing for Free Running in Single-Ended Mode without Gain
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
CLK_ADC
START
SAMPLE
AMPLIFY
INT
Converting Bit 11 10 9 8 7 6 5 4 3 2 1 0 11 10 9 8 7 6 5 4 3 2 1 0 11 10
33.6.6 Accumulation
The result from multiple consecutive conversions can be accumulated. The number of samples to be accumulated is
specified by the Number of Samples to be Collected field in the Average Control register (AVGCTRL.SAMPLENUM).
When accumulating more than 16 samples, the result will be too large to match the 16-bit RESULT register size. To
avoid overflow, the result is right shifted automatically to fit within the available register size. The number of automatic
right shifts is specified in the table below.
Note: To perform the accumulation of two or more samples, the Conversion Result Resolution field in the Control B
register (CTRLB.RESSEL) must be set.
Table 33-2. Accumulation
33.6.7 Averaging
Averaging is a feature that increases the sample accuracy, at the cost of a reduced sampling rate. This feature is
suitable when operating in noisy conditions.
Averaging is done by accumulating m samples, as described in 33.6.6 Accumulation, and dividing the result by m.
The averaged result is available in the RESULT register. The number of samples to be accumulated is specified by
writing to AVGCTRL.SAMPLENUM.
The division is obtained by a combination of the automatic right shift described above, and an additional right shift
that must be specified by writing to the Adjusting Result/Division Coefficient field in AVGCTRL (AVGCTRL.ADJRES).
Note: To perform the averaging of two or more samples, the Conversion Result Resolution field in the Control B
register (CTRLB.RESSEL) must be set to '1'.
Averaging AVGCTRL.SAMPLENUM samples will reduce the un-averaged sampling rate by a factor
1
.
AVGCTRL.SAMPLENUM
When the averaged result is available, the INTFLAG.RESRDY bit will be set.
Table 33-3. Averaging
Number of AVGCTRL. Intermediate Number of Division AVGCTRL.ADJRES Total Final Result Automatic
Accumulated SAMPLENUM Result Automatic Factor Number of Precision Division
Samples Precision Right Shifts Right Factor
Shifts
...........continued
Number of AVGCTRL. Intermediate Number of Division AVGCTRL.ADJRES Total Final Result Automatic
Accumulated SAMPLENUM Result Automatic Factor Number of Precision Division
Samples Precision Right Shifts Right Factor
Shifts
The offset error is defined as the deviation of the actual ADC transfer function from an ideal straight line at zero input
voltage. The offset error cancellation is handled by the Offset Correction register (OFFSETCORR). The offset
correction value is subtracted from the converted data before writing the Result register (RESULT).
The gain error is defined as the deviation of the last output step’s midpoint from the ideal straight line, after
compensating for offset error. The gain error cancellation is handled by the Gain Correction register (GAINCORR).
To correct these two errors, the Digital Correction Logic Enabled bit in the Control B register (CTRLB.CORREN) must
be set to ''.
Offset and gain error compensation results are both calculated according to:
Result = Conversion value+ − OFFSETCORR ⋅ GAINCORR
The correction will introduce a latency of 13 CLK_ADC clock cycles. In free running mode this latency is introduced
on the first conversion only, since its duration is always less than the propagation delay. In single conversion mode
this latency is introduced for each conversion.
Figure 33-8. ADC Timing Correction Enabled
START
33.6.12 Interrupts
The ADC has the following interrupt sources:
• Result Conversion Ready: RESRDY
• Window Monitor: WINMON
• Overrun: OVERRUN
Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status and Clear
(INTFLAG) register is set when the interrupt condition occurs. Each interrupt can be individually enabled by writing a
one to the corresponding bit in the Interrupt Enable Set (INTENSET) register, and disabled by writing a one to the
corresponding bit in the Interrupt Enable Clear (INTENCLR) register. An interrupt request is generated when the
interrupt flag is set and the corresponding interrupt is enabled. The interrupt request remains active until the interrupt
flag is cleared, the interrupt is disabled, or the ADC is reset. An interrupt flag is cleared by writing a one to the
corresponding bit in the INTFLAG register. Each peripheral can have one interrupt request line per interrupt source or
one common interrupt request line for all the interrupt sources. This is device dependent.
Refer to Nested Vector Interrupt Controller for details. The user must read the INTFLAG register to determine which
interrupt condition is present.
Related Links
11.2 Nested Vector Interrupt Controller
33.6.13 Events
The ADC can generate the following output events:
• Result Ready (RESRDY): Generated when the conversion is complete and the result is available.
• Window Monitor (WINMON): Generated when the window monitor condition match.
Setting an Event Output bit in the Event Control Register (EVCTRL.xxEO=1) enables the corresponding output event.
Clearing this bit disables the corresponding output event. Refer to the Event System chapter for details on configuring
the event system.
The peripheral can take the following actions on an input event:
• Start conversion (START): Start a conversion.
• Conversion flush (FLUSH): Flush the conversion.
Setting an Event Input bit in the Event Control register (EVCTRL.xxEI=1) enables the corresponding action on input
event. Clearing this bit disables the corresponding action on input event.
Note: If several events are connected to the ADC, the enabled action will be taken on any of the incoming events.
The events must be correctly routed in the Event System.
Related Links
24. EVSYS – Event System
33.6.15 Synchronization
Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be
synchronized when written or read.
When executing an operation that requires synchronization, the Synchronization Busy bit in the Status register
(STATUS.SYNCBUSY) will be set immediately, and cleared when synchronization is complete. The Synchronization
Ready interrupt can be used to signal when synchronization is complete.
If an operation that requires synchronization is executed while STATUS.SYNCBUSY=1, the bus will be stalled. All
operations will complete successfully, but the CPU will be stalled and interrupts will be pending as long as the bus is
stalled.
The following bits are synchronized when written:
• Software Reset bit in the Control A register (CTRLA.SWRST)
• Enable bit in the Control A register (CTRLA.ENABLE)
The following registers are synchronized when written:
• Control B (CTRLB)
• Software Trigger (SWTRIG)
• Window Monitor Control (WINCTRL)
• Input Control (INPUTCTRL)
• Window Upper/Lower Threshold (WINUT/WINLT)
Required write-synchronization is denoted by the "Write-Synchronized" property in the register description.
The following registers are synchronized when read:
• Software Trigger (SWTRIG)
• Input Control (INPUTCTRL)
Some registers require synchronization when read and/or written. Synchronization is denoted by the Write-
Synchronized or the Read-Synchronized property in each individual register description.
Some registers are enable-protected, meaning they can be written only when the ADC is disabled. Enable-protection
is denoted by the Enable-Protected property in each individual register description.
33.8.1 Control A
Name: CTRLA
Offset: 0x00
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
RUNSTDBY ENABLE SWRST
Access R/W R/W R/W
Reset 0 0 0
Bit 1 – ENABLE Enable
Due to synchronization, there is a delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The
value written to CTRL.ENABLE will read back immediately and the Synchronization Busy bit in the Status register
(STATUS.SYNCBUSY) will be set. STATUS.SYNCBUSY will be cleared when the operation is complete.
Value Description
0 The ADC is disabled.
1 The ADC is enabled.
Name: REFCTRL
Offset: 0x01
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
REFCOMP REFSEL[3:0]
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Note: INT1V is the buffered internal reference of 1.0V (for ADC and DAC), derived from the internal 1.1V bandgap
reference.
Name: AVGCTRL
Offset: 0x02
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
ADJRES[2:0] SAMPLENUM[3:0]
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Name: SAMPCTRL
Offset: 0x03
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
SAMPLEN[5:0]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
33.8.5 Control B
Name: CTRLB
Offset: 0x04
Reset: 0x0000
Property: Write-Protected, Write-Synchronized
Bit 15 14 13 12 11 10 9 8
PRESCALER[2:0]
Access R/W R/W R/W
Reset 0 0 0
Bit 7 6 5 4 3 2 1 0
RESSEL[1:0] CORREN FREERUN LEFTADJ DIFFMODE
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Value Description
1 The ADC conversion result is left-adjusted in the RESULT register. The high byte of the 12-bit result
will be present in the upper part of the result register. Writing this bit to zero (default) will right-adjust
the value in the RESULT register.
Name: WINCTRL
Offset: 0x08
Reset: 0x00
Property: Write-Protected, Write-Synchronized
Bit 7 6 5 4 3 2 1 0
WINMODE[2:0]
Access R/W R/W R/W
Reset 0 0 0
Name: SWTRIG
Offset: 0x0C
Reset: 0x00
Property: Write-Protected, Write-Synchronized
Bit 7 6 5 4 3 2 1 0
START FLUSH
Access R/W R/W
Reset 0 0
Name: INPUTCTRL
Offset: 0x10
Reset: 0x00000000
Property: Write-Protected, Write-Synchronized
Bit 31 30 29 28 27 26 25 24
GAIN[3:0]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 23 22 21 20 19 18 17 16
INPUTOFFSET[3:0] INPUTSCAN[3:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 15 14 13 12 11 10 9 8
MUXNEG[4:0]
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
MUXPOS[4:0]
Access R/W R/W R/W R/W R/W
Reset 0 0 0 0 0
Name: EVCTRL
Offset: 0x14
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
WINMONEO RESRDYEO SYNCEI STARTEI
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: INTENCLR
Offset: 0x16
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
SYNCRDY WINMON OVERRUN RESRDY
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: INTENSET
Offset: 0x17
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
SYNCRDY WINMON OVERRUN RESRDY
Access R/W R/W R/W R/W
Reset 0 0 0 0
Name: INTFLAG
Offset: 0x18
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
SYNCRDY WINMON OVERRUN RESRDY
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 1 – OVERRUN Overrun
This flag is cleared by writing a one to the flag.
This flag is set if RESULT is written before the previous value has been read by CPU, and an interrupt request will be
generated if INTENCLR/SET.OVERRUN is one.
Writing a zero to this bit has no effect.
Writing a one to this bit clears the Overrun interrupt flag.
33.8.13 Status
Name: STATUS
Offset: 0x19
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
SYNCBUSY
Access R
Reset 0
33.8.14 Result
Name: RESULT
Offset: 0x1A
Reset: 0x0000
Property: Read-Synchronized
Bit 15 14 13 12 11 10 9 8
RESULT[15:8]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
RESULT[7:0]
Access R R R R R R R R
Reset 0 0 0 0 0 0 0 0
Name: WINLT
Offset: 0x1C
Reset: 0x0000
Property: Write-Protected, Write-Synchronized
Bit 15 14 13 12 11 10 9 8
WINLT[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
WINLT[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: WINUT
Offset: 0x20
Reset: 0x0000
Property: Write-Protected, Write-Synchronized
Bit 15 14 13 12 11 10 9 8
WINUT[15:8]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
WINUT[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: GAINCORR
Offset: 0x24
Reset: 0x0000
Property: Write-Protected
Bit 15 14 13 12 11 10 9 8
GAINCORR[11:8]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
GAINCORR[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: OFFSETCORR
Offset: 0x26
Reset: 0x0000
Property: Write-Protected
Bit 15 14 13 12 11 10 9 8
OFFSETCORR[11:8]
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 7 6 5 4 3 2 1 0
OFFSETCORR[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
33.8.19 Calibration
Name: CALIB
Offset: 0x28
Reset: 0x0000
Property: Write-Protected
Bit 15 14 13 12 11 10 9 8
BIAS_CAL[2:0]
Access R/W R/W R/W
Reset 0 0 0
Bit 7 6 5 4 3 2 1 0
LINEARITY_CAL[7:0]
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
Name: DBGCTRL
Offset: 0x2A
Reset: 0x00
Property: Write-Protected
Bit 7 6 5 4 3 2 1 0
DBGRUN
Access R/W
Reset 0
34.1 Overview
The Analog Comparator (AC) supports multiple individual comparators. Each comparator (COMP) compares the
voltage levels on two inputs, and provides a digital output based on this comparison. Each comparator may be
configured to generate interrupt requests and/or peripheral events upon several different combinations of input
change.
Hysteresis can be adjusted to achieve the optimal operation for each application.
The input selection includes four shared analog port pins and several internal signals. Each comparator output state
can also be output on a pin for use by external devices.
The comparators are grouped in pairs on each port. The AC peripheral implements one or two pairs of comparators .
These are called Comparator 0 (COMP0) and Comparator 1 (COMP1) for the first pair and Comparator 2 (COMP2)
and Comparator 3 (COMP3) for the second pair. They have identical behaviors, but separate control registers. Each
pair can be set in window mode to compare a signal to a voltage range instead of a single voltage level.
34.2 Features
• Up to Four individual comparators
• Analog comparator outputs available on pins
– Asynchronous or synchronous
• Flexible input selection:
– Four pins selectable for positive or negative inputs
– Ground (for zero crossing)
– Bandgap reference voltage
– 64-level programmable VDD scaler per comparator
– DAC (if available)
• Interrupt generation on:
– Rising or falling edge
– Toggle
– End of comparison
• Window function interrupt generation on:
– Signal above window
– Signal inside window
– Signal below window
– Signal outside window
• Event generation on:
– Comparator output
– Window function inside/outside window
• Optional digital filter on comparator output
AIN0
+
CMP0
COMP0
AIN1
- HYSTERESIS
VDD
INTERRUPTS
SCALER
ENABLE INTERRUPT
INTERRUPT MODE SENSITIVITY
DAC CONTROL
COMPCTRLn WINCTRL & EVENTS
WINDOW
ENABLE FUNCTION GCLK_AC
BANDGAP
HYSTERESIS
AIN2 +
CMP1
COMP1
AIN3
-
AIN4
+
CMP2
COMP2
AIN5
- HYSTERESIS
VDD
INTERRUPTS
SCALER
ENABLE INTERRUPT
INTERRUPT MODE SENSITIVITY
DAC CONTROL
COMPCTRLn WINCTRL & EVENTS
WINDOW
ENABLE FUNCTION GCLK_AC
BANDGAP
HYSTERESIS
AIN6 +
CMP3
COMP3
AIN7
-
Refer to I/O Multiplexing and Considerations for details on the pin mapping for this peripheral. One signal can be
mapped on several pins.
Related Links
7. I/O Multiplexing and Considerations
34.5.3 Clocks
The AC bus clock (CLK_AC_APB) can be enabled and disabled in the Main Clock module, MCLK (see MCLK - Main
Clock, and the default state of CLK_AC_APB can be found in Peripheral Clock Masking.
Two generic clocks (GCLK_AC_DIG and GCLK_AC_ANA) are used by the AC. The digital clock (GCLK_AC_DIG) is
required to provide the sampling rate for the comparators, while the analog clock (GCLK_AC_ANA) is required for
low voltage operation (VDDANA < 2.5V) to ensure that the resistance of the analog input multiplexors remains low.
These clocks must be configured and enabled in the Generic Clock Controller before using the peripheral.
This generic clock is asynchronous to the bus clock (CLK_AC_APB). Due to this asynchronicity, writes to certain
registers will require synchronization between the clock domains. Refer to 34.6.15 Synchronization for further details.
Related Links
16. PM – Power Manager
34.5.4 DMA
Not applicable.
34.5.5 Interrupts
The interrupt request lines are connected to the interrupt controller. Using the AC interrupts requires the interrupt
controller to be configured first. Refer to Nested Vector Interrupt Controller for details.
Related Links
11.2 Nested Vector Interrupt Controller
34.5.6 Events
The events are connected to the Event System. Refer to EVSYS – Event System for details on how to configure the
Event System.
Related Links
24. EVSYS – Event System
34.6.2.1 Initialization
Before enabling the AC, the input and output events must be configured in the Event Control register (EVCTRL).
These settings cannot be changed while the AC is enabled.
The individual comparators must be also enabled by writing a '1' to the Enable bit in the Comparator x Control
registers (COMPCTRLx.ENABLE). However, when the AC is disabled, this will also disable the individual
comparators, but will not clear their COMPCTRLx.ENABLE bits.
Related Links
34.8.1 CTRLA
tSTARTUP
STATUSB.READYx
Sampled
Comparator Output
For low-power operation, comparisons can be performed during sleep modes without a clock. The comparator is
enabled continuously, and changes of the comparator state are detected asynchronously. When a toggle occurs, the
Power Manager will start CLK_AC_DIG to register the appropriate peripheral events and interrupts. The
CLK_AC_DIG clock is then disabled again automatically, unless configured to wake up the system from sleep.
Related Links
37. Electrical Characteristics
34.6.2.4.2 Single-Shot
Single-shot operation is selected by writing COMPCTRLx.SINGLE to '1'. During single-shot operation, the
comparator is normally idle. The user starts a single comparison by writing '1' to the respective Start Comparison bit
in the write-only Control B register (CTRLB.STARTx). The comparator is enabled, and after the start-up time has
passed, a single comparison is done and STATUSA is updated. Appropriate peripheral events and interrupts are also
generated. No new comparisons will be performed.
Writing '1' to CTRLB.STARTx also clears the Comparator x Ready bit in the Status B register (STATUSB.READYx).
STATUSB.READYx is set automatically by hardware when the single comparison has completed.
To remove the need for polling, an additional means of starting the comparison is also available. A read of the Status
C register (STATUSC) will start a comparison on all comparators currently configured for single-shot operation. The
read will stall the bus until all enabled comparators are ready. If a comparator is already busy with a comparison, the
read will stall until the current comparison is compete, and a new comparison will not be started.
A single-shot measurement can also be triggered by the Event System. Setting the Comparator x Event Input bit in
the Event Control Register (EVCTRL.COMPEIx) enables triggering on incoming peripheral events. Each comparator
can be triggered independently by separate events. Event-triggered operation is similar to user-triggered operation;
the difference is that a peripheral event from another hardware module causes the hardware to automatically start the
comparison and clear STATUSB.READYx.
To detect an edge of the comparator output in single-shot operation for the purpose of interrupts, the result of the
current measurement is compared with the result of the previous measurement (one sampling period earlier). An
example of single-shot operation is shown in the figure below.
Figure 34-4. Single-Shot Example
GCLK_AC
Write ‘1’ Write ‘1’
CTRLB.STARTx 2-3 cycles 2-3 cycles
tSTARTUP tSTARTUP
STATUSB.READYx
Sampled
Comparator Output
For low-power operation, event-triggered measurements can be performed during sleep modes. When the event
occurs, the Power Manager will start CLK_AC_DIG. The comparator is enabled, and after the startup time has
passed, a comparison is done and appropriate peripheral events and interrupts are also generated. The comparator
and CLK_AC_DIG are then disabled again automatically, unless configured to wake up the system from sleep.
Related Links
37. Electrical Characteristics
STATE0
COMP0
INTERRUPT
SENSITIVITY
INTERRUPTS
CONTROL
INPUT SIGNAL &
WINDOW
FUNCTION EVENTS
STATE1
COMP1
COMPCTRLx.MUXNEG SCALERx.
== 5 VALUE
6
to
COMPx
34.6.9 Filtering
The output of the comparators can be filtered digitally to reduce noise. The filtering is determined by the Filter Length
bits in the Comparator Control x register (COMPCTRLx.FLEN), and is independent for each comparator. Filtering is
selectable from none, 3-bit majority (N=3) or 5-bit majority (N=5) functions. Any change in the comparator output is
considered valid only if N/2+1 out of the last N samples agree. The filter sampling rate is the GCLK_AC frequency.
Note that filtering creates an additional delay of N-1 sampling cycles from when a comparison is started until the
comparator output is validated. For continuous mode, the first valid output will occur when the required number of
filter samples is taken. Subsequent outputs will be generated every cycle based on the current sample plus the
previous N-1 samples, as shown in Figure 34-7. For single-shot mode, the comparison completes after the Nth filter
sample, as shown in Figure 34-8.
Figure 34-7. Continuous Mode Filtering
Sampling Clock
Sampled
Comparator Output
3-bit Majority
Filter Output
5-bit Majority
Filter Output
Start
tSTARTUP
3-bit Sampled
Comparator Output
3-bit Majority
Filter Output
5-bit Sampled
Comparator Output
5-bit Majority
Filter Output
During sleep modes, filtering is supported only for single-shot measurements. Filtering must be disabled if continuous
measurements will be done during sleep modes, or the resulting interrupt/event may be generated incorrectly.
MUXPOS
COMPx CMPx
- HYSTERESIS
ENABLE
SWAP
SWAP
MUXNEG COMPCTRLx
34.6.12 Interrupts
The AC has the following interrupt sources:
• Comparator (COMP0, COMP1, COMP2, COMP3): Indicates a change in comparator status.
• Window (WIN0, WIN1): Indicates a change in the window status.
Comparator interrupts are generated based on the conditions selected by the Interrupt Selection bit group in the
Comparator Control registers (COMPCTRLx.INTSEL). Window interrupts are generated based on the conditions
selected by the Window Interrupt Selection bit group in the Window Control register (WINCTRL.WINTSELx[1:0]).
Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status and Clear
(INTFLAG) register is set when the interrupt condition occurs. Each interrupt can be individually enabled by writing a
one to the corresponding bit in the Interrupt Enable Set (INTENSET) register, and disabled by writing a one to the
corresponding bit in the Interrupt Enable Clear (INTENCLR) register. An interrupt request is generated when the
interrupt flag is set and the corresponding interrupt is enabled. The interrupt request remains active until the interrupt
flag is cleared, the interrupt is disabled, or the AC is reset. See INFLAG register for details on how to clear interrupt
flags. All interrupt requests from the peripheral are ORed together on system level to generate one combined
interrupt request to the NVIC. The user must read the INTFLAG register to determine which interrupt condition is
present.
Note that interrupts must be globally enabled for interrupt requests to be generated.
Related Links
11.2 Nested Vector Interrupt Controller
34.6.13 Events
The AC can generate the following output events:
• Comparator (COMP0, COMP1, COMP2, COMP3): Generated as a copy of the comparator status
• Window (WIN0, WIN1): Generated as a copy of the window inside/outside status
Output events must be enabled to be generated. Writing a one to an Event Output bit in the Event Control register
(EVCTRL.COMPEOx) enables the corresponding output event. Writing a zero to this bit disables the corresponding
output event. The events must be correctly routed in the Event System.
The AC can take the following action on an input event:
• Single-shot measurement
• Single-shot measurement in window mode
Writing a one to an Event Input bit into the Event Control register (EVCTRL.COMPEIx) enables the corresponding
action on input event. Writing a zero to this bit disables the corresponding action on input event. Note that if several
events are connected to the AC, the enabled action will be taken on any of the incoming events. Refer to the Event
System chapter for details on configuring the event system.
When EVCTRL.COMPEIx is one, the event will start a comparison on COMPx after the start-up time delay. In normal
mode, each comparator responds to its corresponding input event independently. For a pair of comparators in
window mode, either comparator event will trigger a comparison on both comparators simultaneously.
Comparator State
Comparator
Output or Event
tSTARTUP tSTARTUP
Input Event
Comparator
Output or Event
34.6.15 Synchronization
Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be
synchronized when written or read.
The following bits are synchronized when written:
• Software Reset bit in control register (CTRLA.SWRST)
• Enable bit in control register (CTRLA.ENABLE)
• Enable bit in Comparator Control register (COMPCTRLn.ENABLE)
The following registers are synchronized when written:
• Window Control register (WINCTRL)
Required write-synchronization is denoted by the "Write-Synchronized" property in the register description.
Related Links
14.3 Register Synchronization
34.8.1 Control A
Name: CTRLA
Offset: 0x00
Reset: 0x00
Property: PAC Write-Protection, Write-Synchronized
Bit 7 6 5 4 3 2 1 0
LPMUX RUNSTDBY ENABLE SWRST
Access R/W R/W R/W R/W
Reset 0 0 0 0
Bit 1 – ENABLE Enable
Due to synchronization, there is a delay from the time when the register is updated until the peripheral is enabled/
disabled. The value written to CTRL.ENABLE will read back immediately after being written. STATUS.SYNCBUSY is
set. STATUS.SYNCBUSY is cleared when the peripheral is enabled/disabled
Value Description
0 The AC is disabled.
1 The AC is enabled. Each comparator must also be enabled individually by the Enable bit in the
Comparator Control register (COMPCTRLn.ENABLE).
34.8.2 Control B
Name: CTRLB
Offset: 0x01
Reset: 0x00
Property: –
Bit 7 6 5 4 3 2 1 0
START1 START0
Access R/W R/W
Reset 0 0
Name: EVCTRL
Offset: 0x02
Reset: 0x0000
Property: PAC Write-Protection, Enable-Protected
Bit 15 14 13 12 11 10 9 8
COMPEI1 COMPEI0
Access R/W R/W
Reset 0 0
Bit 7 6 5 4 3 2 1 0
WINEO0 COMPEO1 COMPEO0
Access R/W R/W R/W
Reset 0 0 0
Name: INTENCLR
Offset: 0x04
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Set register (INTENSET).
Bit 7 6 5 4 3 2 1 0
WIN0 COMP1 COMP0
Access R/W R/W R/W
Reset 0 0 0
Name: INTENSET
Offset: 0x05
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Clear register (INTENCLR).
Bit 7 6 5 4 3 2 1 0
WIN0 COMP1 COMP0
Access R/W R/W R/W
Reset 0 0 0
Name: INTFLAG
Offset: 0x06
Reset: 0x00
Property: –
Bit 7 6 5 4 3 2 1 0
WIN0 COMP1 COMP0
Access R/W R/W R/W
Reset 0 0 0
Bit 4 – WINx Window x
This flag is set according to the Window x Interrupt Selection bit group in the WINCTRL register
(WINCTRL.WINTSELx) and will generate an interrupt if INTENCLR/SET.WINx is also one.
Writing a '0' to this bit has no effect.
Writing a '1' to this bit clears the Window x interrupt flag.
Bits 0, 1 – COMPx Comparator x
Reading this bit returns the status of the Comparator x interrupt flag. If comparator x is not implemented, COMPx
always reads as zero.
This flag is set according to the Interrupt Selection bit group in the Comparator x Control register
(COMPCTRLx.INTSEL) and will generate an interrupt if INTENCLR/SET.COMPx is also one.
Writing a '0' to this bit has no effect.
Writing a '1' to this bit clears the Comparator x interrupt flag.
34.8.7 Status A
Name: STATUSA
Offset: 0x08
Reset: 0x00
Property: –
Bit 7 6 5 4 3 2 1 0
WSTATE0[1:0] STATE1 STATE0
Access R R R R
Reset 0 0 0 0
34.8.8 Status B
Name: STATUSB
Offset: 0x09
Reset: 0x00
Property: –
Bit 7 6 5 4 3 2 1 0
SYNCBUSY READY1 READY0
Access R R R
Reset 0 0 0
34.8.9 Status C
Name: STATUSC
Offset: 0x0A
Reset: 0x00
Property: –
STATUSC is a copy of STATUSA (see STATUSA register), with the additional feature of automatically starting single-
shot comparisons. A read of STATUSC will start a comparison on all comparators currently configured for single-shot
operation. The read will stall the bus until all enabled comparators are ready. If a comparator is already busy with a
comparison, the read will stall until the current comparison is compete, and a new comparison will not be started.
Bit 7 6 5 4 3 2 1 0
WSTATE0[1:0] STATE1 STATE0
Access R R R R
Reset 0 0 0 0
Name: WINCTRL
Offset: 0x0C
Reset: 0x00
Property: PAC Write-Protection, Write-Synchronized
Bit 7 6 5 4 3 2 1 0
WINTSEL0[1:0] WEN0
Access R/W R/W R/W
Reset 0 0 0
Name: COMPCTRL
Offset: 0x10 + n*0x04 [n=0..1]
Reset: 0x00000000
Property: PAC Write-Protection, Write-Synchronized
Bit 31 30 29 28 27 26 25 24
FLEN[2:0]
Access R/W R/W R/W
Reset 0 0 0
Bit 23 22 21 20 19 18 17 16
HYST OUT[1:0]
Access R/W R/W R/W
Reset 0 0 0
Bit 15 14 13 12 11 10 9 8
SWAP MUXPOS[1:0] MUXNEG[2:0]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
INTSEL[1:0] SPEED[1:0] SINGLE ENABLE
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
Value Description
0 Comparator n operates in continuous measurement mode.
1 Comparator n operates in single-shot mode.
Bit 0 – ENABLE Enable
Writing a zero to this bit disables comparator n.
Writing a one to this bit enables comparator n. After writing to this bit, the value read back will not change until the
action initiated by the writing is complete.
Due to synchronization, there is a latency of at least two GCLK_AC_DIG clock cycles from updating the register until
the comparator is enabled/disabled. The bit will continue to read the previous state while the change is in progress.
Writing a one to COMPCTRLn.ENABLE will prevent further changes to the other bits in COMPCTRLn. These bits
remain protected until COMPCTRLn.ENABLE is written to zero and the write is synchronized.
34.8.12 Scaler n
Name: SCALER
Offset: 0x20 + n*0x01 [n=0..1]
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
VALUE[5:0]
Access R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0
35.1 Overview
The Digital-to-Analog Converter (DAC) converts a digital value to a voltage. The DAC has one channel with 10-bit
resolution, and it is capable of converting up to 350,000 samples per second (350ksps).
35.2 Features
• DAC with 10-bit resolution
• Up to 350ksps conversion rate
• Multiple trigger sources
• High-drive capabilities
• Output can be used as input to the Analog Comparator (AC)
• DMA support
DATABUF
Internal input
ADC Input
Output
DATA DAC10 Buffer VOUT
VREFA
DAC Controller VDDANA
Ref.voltage (VREF)
Related Links
7. I/O Multiplexing and Considerations
35.5.3 Clocks
The DAC bus clock (CLK_DAC_APB) can be enabled and disabled by the Power Manager, and the default state of
CLK_DAC_APB can be found in the Peripheral Clock Masking section.
A generic clock (GCLK_DAC) is required to clock the DAC Controller. This clock must be configured and enabled in
the Generic Clock Controller before using the DAC Controller. Refer to GCLK – Generic Clock Controller for details.
This generic clock is asynchronous to the bus clock (CLK_DAC_APB). Due to this asynchronicity, writes to certain
registers will require synchronization between the clock domains. Refer to 35.6.7 Synchronization for further details.
Related Links
16.6.2.6 Peripheral Clock Masking
15. GCLK - Generic Clock Controller
35.5.4 DMA
The DMA request line is connected to the DMA Controller (DMAC). Using the DAC Controller DMA requests requires
to configure the DMAC first.
Related Links
20. DMAC – Direct Memory Access Controller
35.5.5 Interrupts
The interrupt request line is connected to the interrupt controller. Using the DAC Controller interrupt(s) requires the
interrupt controller to be configured first.
Related Links
11.2 Nested Vector Interrupt Controller
35.5.6 Events
The events are connected to the Event System.
Related Links
24. EVSYS – Event System
Related Links
11.6 Peripheral Access Controller (PAC)
35.6.4 Interrupts
The DAC Controller has the following interrupt sources:
• Data Buffer Empty (EMPTY): Indicates that the internal data buffer of the DAC is empty.
• Underrun (UNDERRUN): Indicates that the internal data buffer of the DAC is empty and a DAC start of
conversion event occurred. Refer to 35.6.5 Events for details.
• Synchronization Ready (SYNCRDY): this asynchronous interrupt can be used to wake-up the device from any
sleep mode.
Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status and Clear
register (INTFLAG) is set when the interrupt condition occurs. Each interrupt can be individually enabled by writing a
one to the corresponding bit in the Interrupt Enable Set register (INTENSET), and disabled by writing a one to the
corresponding bit in the Interrupt Enable Clear register (INTENCLR).
An interrupt request is generated when the interrupt flag is set and the corresponding interrupt is enabled. The
interrupt request remains active until the interrupt flag is cleared, the interrupt is disabled or the DAC is reset. See
INTFLAG register for details on how to clear interrupt flags.
All interrupt requests from the peripheral are ORed together on system level to generate one combined interrupt
request to the NVIC. The user must read the INTFLAG register to determine which interrupt condition is present.
Note that interrupts must be globally enabled for interrupt requests to be generated..
Related Links
11.2 Nested Vector Interrupt Controller
35.6.5 Events
The DAC Controller can generate the following output events:
• Data Buffer Empty (EMPTY): Generated when the internal data buffer of the DAC is empty. Refer to DMA
Operation for details.
Writing a '1' to an Event Output bit in the Event Control register (EVCTRL.EMPTYEO) enables the corresponding
output event. Writing a '0' to this bit disables the corresponding output event.
The DAC can take the following action on an input event:
• Start Conversion (START): DATABUF value is transferred into DATA as soon as the DAC is ready for the next
conversion, and then conversion is started. START is considered as asynchronous to GCLK_DAC thus it is
resynchronized in DAC Controller. Refer to 35.6.2.4 Digital to Analog Conversion for details.
Writing a '1' to an Event Input bit in the Event Control register (EVCTRL.STARTEI) enables the corresponding action
on an input event. Writing a '0' to this bit disables the corresponding action on input event.
Note: When several events are connected to the DAC Controller, the enabled action will be taken on any of the
incoming events.
By default, DAC Controller detects rising edge events. Falling edge detection can be enabled by writing a '1' to
EVCTRL.INVEIx.
Related Links
24. EVSYS – Event System
35.6.7 Synchronization
Due to the asynchronicity between main clock domain and the peripheral clock domains, some registers need to be
synchronized when written or read. A register can require:
• Synchronization when written
• Synchronization when read
• Synchronization when written and read
• No synchronization
When executing an operation that requires synchronization, the Synchronization Busy bit in the Status register
(STATUS.SYNCBUSY) will be set immediately, and cleared when synchronization is complete.
If an operation that requires synchronization is executed while its busy bit is one, the operation is discarded and an
error is generated.
The following bits need synchronization when written:
• Software Reset bit in the Control A register (CTRLA.SWRST)
• Enable bit in the Control A register (CTRLA.ENABLE)
• All bits in the Data register (DATA)
• All bits in the Data Buffer register (DATABUF)
Write-synchronization is denoted by the Write-Synchronized property in the register description.
The following bits need synchronization when read:
• All bits in the Data register (DATA)
The voltage pump uses the asynchronous GCLK_DAC clock, and requires that the clock frequency be at least four
times higher than the sampling period.
35.8.1 Control A
Name: CTRLA
Offset: 0x00
Reset: 0x00
Property: PAC Write-Protection, Write-Synchronized
Bit 7 6 5 4 3 2 1 0
RUNSTDBY ENABLE SWRST
Access R/W R/W R/W
Reset 0 0 0
35.8.2 Control B
Name: CTRLB
Offset: 0x01
Reset: 0x00
Property: PAC Write-Protection, Enable-Protected
Bit 7 6 5 4 3 2 1 0
REFSEL[1:0] BDWP VPD LEFTADJ IOEN EOEN
Access R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0
Name: EVCTRL
Offset: 0x02
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
EMPTYEO STARTEI
Access R/W R/W
Reset 0 0
Name: INTENCLR
Offset: 0x04
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Set register (INTENSET).
Bit 7 6 5 4 3 2 1 0
SYNCRDY EMPTY UNDERRUN
Access R/W R/W R/W
Reset 0 0 0
Name: INTENSET
Offset: 0x05
Reset: 0x00
Property: PAC Write-Protection
This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this
register will also be reflected in the Interrupt Enable Clear register (INTENCLR).
Bit 7 6 5 4 3 2 1 0
SYNCRDY EMPTY UNDERRUN
Access R/W R/W R/W
Reset 0 0 0
Name: INTFLAG
Offset: 0x06
Reset: 0x00
Property: PAC Write-Protection
Bit 7 6 5 4 3 2 1 0
SYNCRDY EMPTY UNDERRUN
Access R/W R/W R/W
Reset 0 0 0
Bit 0 – UNDERRUN Underrun
This flag is cleared by writing a '1' to it.
This flag is set when a start conversion event occurs when DATABUF is empty, and will generate an interrupt request
if INTENCLR/SET.UNDERRUN is one.
Writing a '0' to this bit has no effect.
Writing a '1' to this bit will clear the Underrun interrupt flag.
35.8.7 Status
Name: STATUS
Offset: 0x07
Reset: 0x00
Property: -
Bit 7 6 5 4 3 2 1 0
SYNCBUSY
Access R
Reset 0
Name: DATA
Offset: 0x08
Reset: 0x0000
Property: PAC Write-Protection, Write-Synchronized
Bit 15 14 13 12 11 10 9 8
DATA[15:8]
Access W W W W W W W W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
DATA[7:0]
Access W W W W W W W W
Reset 0 0 0 0 0 0 0 0
Name: DATABUF
Offset: 0x0C
Reset: 0x0000
Property: Write-Synchronized
Bit 15 14 13 12 11 10 9 8
DATABUF[15:8]
Access W W W W W W W W
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
DATABUF[7:0]
Access W W W W W W W W
Reset 0 0 0 0 0 0 0 0
36.1 Overview
The Peripheral Touch Controller (PTC) acquires signals in order to detect a touch on the capacitive sensors. The
external capacitive touch sensor is typically formed on a PCB, and the sensor electrodes are connected to the analog
front end of the PTC through the I/O pins in the device. The PTC supports both self- and mutual-capacitance
sensors.
In the mutual-capacitance mode, sensing is done using capacitive touch matrices in various X-Y configurations,
including indium tin oxide (ITO) sensor grids. The PTC requires one pin per X-line and one pin per Y-line.
In the self-capacitance mode, the PTC requires only one pin (Y-line) for each touch sensor.
The number of available pins and the assignment of X- and Y-lines is depending on both package type and device
configuration. Refer to the Configuration Summary and I/O Multiplexing table for details.
Related Links
7. I/O Multiplexing and Considerations
2. Configuration Summary
36.2 Features
• Low-power, high-sensitivity, environmentally robust capacitive touch buttons, sliders, and wheels
• Supports wake-up on touch from Standby Sleep mode
• Supports mutual capacitance and self-capacitance sensing
– 6/10/16 buttons in self-capacitance mode, for 32-/48-/64- pins respectively
– 60/120/256 buttons in mutual-capacitance mode, for 32-/48-/64- pins respectively
– Mix-and-match mutual-and self-capacitance sensors
• One pin per electrode – no external components
• Load compensating charge sensing
– Parasitic capacitance compensation and adjustable gain for superior sensitivity
• Zero drift over the temperature and VDD range
– Auto calibration and recalibration of sensors
• Single-shot charge measurement
• Hardware noise filtering and noise signal desynchronization for high conducted immunity
• Selectable channel change delay allows choosing the settling time on a new channel, as required
• Acquisition-start triggered by command or through auto-triggering feature
• Low CPU utilization through interrupt on acquisition-complete
Related Links
7. I/O Multiplexing and Considerations
2. Configuration Summary
Input Compensation
Control Circuit
Y0
Y1 RS
Acquisition Module IRQ
- Gain control
- ADC
Ym - Filtering Result
10
CX0Y0
X0
Input Compensation
Control Circuit
Y0
Y1 RS
Acquisition Module IRQ
- Gain control
CY0 - ADC
Ym - Filtering Result
10
CYm
X Line Driver
Note: The number of X- and Y-lines are device dependent. Refer to Configuration Summary for details.
Refer to I/O Multiplexing and Considerations for details on the pin mapping for this peripheral. One signal can be
mapped on several pins.
Related Links
7. I/O Multiplexing and Considerations
2. Configuration Summary
Y1
Ym
MCU
Sensor Capacitance Cy
Y0
Cy0
Y1
Cy1
PTC
Module
Ym Cym
For more information about designing the touch sensor, refer to Buttons, Sliders and Wheels Touch Sensor Design
Guide.
36.5.2 Clocks
The PTC is clocked by the GCLK_PTC clock. The PTC operates from an asynchronous clock source and the
operation is independent of the main system clock and its derivative clocks, such as the peripheral bus clock
(CLK_APB). A number of clock sources can be selected as the source for the asynchronous GCLK_PTC. The clock
source is selected by configuring the Generic Clock Selection ID in the Generic Clock Control register. For more
information about selecting the clock sources, refer to GCLK - Generic Clock Controller.
The selected clock must be enabled in the Power Manager, before it can be used by the PTC. By default these clocks
are disabled. The frequency range of GCLK_PTC is 400kHz to 4MHz.
Related Links
15. GCLK - Generic Clock Controller
16. PM – Power Manager
Link Application
QTouch
Library
For more information about QTouch Library, refer to the QTouch Library Peripheral Touch Controller User Guide.
37.1 Disclaimer
All typical values are measured at T = 25°C unless otherwise specified. All minimum and maximum values are valid
across operating temperature and voltage unless otherwise specified.
1. Maximum source current is 46mA and maximum sink current is 65mA per cluster. A cluster is a group of
GPIOs as shown in the table below. Also note that each VDD/GND pair is connected to two clusters so current
consumption through the pair will be a sum of the clusters source/sink currents.
This device is sensitive to electrostatic discharges (ESD). Improper handling may lead to permanent
CAUTION
performance degradation or malfunctioning.
Handle the device following best practice ESD protection rules: Be aware that the human body can
accumulate charges large enough to impair functionality or destroy the device.
In debugger cold-plugging mode, NVM erase operations are not protected by the BOD33 and BOD12.
CAUTION
NVM erase operation at supply voltages below specified minimum can cause corruption of NVM areas that
are mandatory for correct device behavior.
Related Links
7.2.4 GPIO Clusters
7.2.4 GPIO Clusters
Related Links
8. Power Supply and Start-Up Considerations
...........continued
Symbol Description Max. Units
fAPBC APBC clock frequency 48 MHz
fGCLK_DFLL48M_REF DFLL48M Reference clock frequency 33 KHz
fGCLK_DPLL FDPLL96M Reference clock frequency 2 MHz
fGCLK_DPLL_32K FDPLL96M 32k Reference clock frequency 32 KHz
fGCLK_WDT WDT input clock frequency 48 MHz
fGCLK_RTC RTC input clock frequency 48 MHz
fGCLK_EIC EIC input clock frequency 48 MHz
fGCLK_USB USB input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_0 EVSYS channel 0 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_1 EVSYS channel 1 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_2 EVSYS channel 2 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_3 EVSYS channel 3 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_4 EVSYS channel 4 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_5 EVSYS channel 5 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_6 EVSYS channel 6 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_7 EVSYS channel 7 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_8 EVSYS channel 8 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_9 EVSYS channel 9 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_10 EVSYS channel 10 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_11 EVSYS channel 11 input clock frequency 48 MHz
fGCLK_SERCOMx_SLOW Common SERCOM slow input clock frequency 48 MHz
fGCLK_SERCOM0_CORE SERCOM0 input clock frequency 48 MHz
fGCLK_SERCOM1_CORE SERCOM1 input clock frequency 48 MHz
fGCLK_SERCOM2_CORE SERCOM2 input clock frequency 48 MHz
fGCLK_SERCOM3_CORE SERCOM3 input clock frequency 48 MHz
fGCLK_SERCOM4_CORE SERCOM4 input clock frequency 48 MHz
fGCLK_SERCOM5_CORE SERCOM5 input clock frequency 48 MHz
fGCLK_TCC0, fGCLK_TCC1 TCC0,TCC1 input clock frequency 96 MHz
fGCLK_TCC2, fGCLK_TCC3,fGCLK_TC3 TCC2, TCC3, TC3 input clock frequency 96 MHz
fGCLK_TC4, GCLK_TC5 TC4,TC5 input clock frequency 48 MHz
fGCLK_TC6, GCLK_TC7 TC6,TC7 input clock frequency 48 MHz
fGCLK_ADC ADC input clock frequency 48 MHz
fGCLK_AC_DIG AC digital input clock frequency 48 MHz
fGCLK_AC_ANA AC analog input clock frequency 64 KHz
fGCLK_AC1_DIG AC1 digital input clock frequency 48 MHz
...........continued
Symbol Description Max. Units
fGCLK_AC1_ANA AC1 analog input clock frequency 64 KHz
fGCLK_DAC DAC input clock frequency 350 KHz
fGCLK_PTC PTC input clock frequency 48 MHz
fGCLK_I2S_0 I2S serializer 0 input clock frequency 13 MHz
fGCLK_I2S_1 I2S serializer 1 input clock frequency 13 MHz
...........continued
Mode Conditions TA Min. Typ. Max. Units
STANDBY XOSC32K running 25°C - 4.06 12.8 μA
RTC running at 1kHz
85°C - 55.2 100
XOSC32K and RTC stopped 25°C - 2.70 12.2
85°C - 53.3 100
Table 37-10. Current Consumption (Device Variant B, C, D, L with Silicon Revision F and Silicon Revision G)
VDDIN
VDDANA
VDDIO
Amp 0
VDDCORE
– OSC8M at 8MHz
• Clocks
– OSC8M used as main clock source
– CPU, AHB and APBn clocks undivided
• The following AHB module clocks are running: NVMCTRL, HPB2 bridge, HPB1 bridge, HPB0 bridge
– All other AHB clocks stopped
• The following peripheral clocks running: PM, SYSCTRL
– All other peripheral clocks stopped
• I/Os are inactive with internal pull-up
• CPU in IDLE0 mode
• Cache enabled
• BOD33 disabled
In this default conditions, the power consumption Idefault is measured.
Operating mode for each peripheral in turn:
• Configure and enable the peripheral GCLK (When relevant, see conditions)
• Unmask the peripheral clock
• Enable the peripheral (when relevant)
• Set CPU in IDLE0 mode
• Measurement Iperiph
• Wake-up CPU via EIC (async: level detection, filtering disabled)
• Disable the peripheral (when relevant)
• Mask the peripheral clock
• Disable the peripheral GCLK (when relevant, see conditions)
Each peripheral power consumption provided in table x.y is the value (Iperiph - Idefault), using the same measurement
method as for global power consumption measurement
Table 37-12. Typical Peripheral Current Consumption
Note:
1. All TCs from 4 to 7 share the same power consumption values.
2. All SERCOMs from 0 to 5 share the same power consumption values.
3. The value includes the power consumption of the FDPLL.
4. The value includes the power consumption of the R/W access to the RAM.
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
IOL Output low-level VDD=1.62V-3V, - - 1 mA
current PORT.PINCFG.DRVSTR=0
VDD=3V-3.63V, - - 2.5
PORT.PINCFG.DRVSTR=0
VDD=1.62V-3V, - - 3
PORT.PINCFG.DRVSTR=1
VDD=3V-3.63V, - - 10
PORT.PINCFG.DRVSTR=1
IOH Output high-level VDD=1.62V-3V, - - 0.70
current PORT.PINCFG.DRVSTR=0
VDD=3V-3.63V, - - 2
PORT.PINCFG.DRVSTR=0
VDD=1.62V-3V, - - 2
PORT.PINCFG.DRVSTR=1
VDD=3V-3.63V, - - 7
PORT.PINCFG.DRVSTR=1
tRISE Rise time(1) PORT.PINCFG.DRVSTR=0load = 5pF, - - 15 ns
VDD = 3.3V
PORT.PINCFG.DRVSTR=1load = 20pF, - - 15
VDD = 3.3V
tFALL Fall time(1) PORT.PINCFG.DRVSTR=0load = 5pF, - - 15 ns
VDD = 3.3V
PORT.PINCFG.DRVSTR=1load = 20pF, - - 15
VDD = 3.3V
ILEAK Input leakage current Pull-up resistors disabled -1 +/-0.015 1 μA
Note: 1. These values are based on simulation. These values are not covered by test limits in production or
characterization.
VDD≤2.0V - - 0.2*VDD
, IOL=2mA
...........continued
Symbol Parameter Condition Min. Typ. Max. Units
IOL Output low-level current VOL =0.4V 3 mA
Standard, Fast and HS Modes
VOL =0.4V 20 - -
Fast Mode +
VOL =0.6V 6 - -
fSCL SCL clock frequency - - 3.4 MHz
I2C pins timing characteristics can be found in 37.16.3 SERCOM in I2C Mode Timing.
Note: Supplying any external components using the VDDCORE pin is not allowed to assure the integrity of the core
supply voltage.
Table 37-19. Decoupling requirements
Note: 1. It is recommended to use ceramic X7R capacitor with low-series resistance. Refer to Figure 44-1 for a
typical circuit connections of the decoupling capacitor.
Note: 2. It is recommended to use ceramic or solid tantalum capacitor with low ESR <= 1 ohms.
VDD
VPOT+
VPOT-
Time
Reset
37.11.3.1 BOD33
Figure 37-3. BOD33 Hysteresis OFF
VCC
VBOD
RESET
VCC VBOD+
VBOD-
RESET
Note: See chapter Memories table NVM User Row Mapping for the BOD33 default value settings.
Table 37-22. BOD33 LEVEL Value (Silicon Revision G)
Note: Refer to NVM User Row Mapping for the BOD33 default value settings.
Table 37-23. BOD33 Characteristics
Note: 1. These values are based on simulation. These values are not covered by test limits in production or
characterization.
Related Links
10.3.1 NVM User Row Mapping
Note:
1. These values are based on characterization. These values are not covered by test limits in production.
2. These values are based on simulation. These values are not covered by test limits in production or
characterization.
3. In this condition and for a sample rate of 350ksps, 1 Conversion at gain 1x takes 6 clock cycles of the ADC
clock.
4. It is the buffered internal reference of 1.0V derived from the internal 1.1V bandgap reference.
Table 37-25. Differential Mode (Device Variant A)
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
DNL Differential Non Linearity 1x gain +/-0.3 +/-0.5 +/-0.95 LSB
Gain Error Ext. Ref 1x -10.0 2.5 +10.0 mV
VREF=VDDANA/1.48 -15.0 -1.5 +10.0 mV
Bandgap -20.0 -5.0 +20.0 mV
Gain Accuracy(5) Ext. Ref. 0.5x +/-0.1 +/-0.2 +/-0.45 %
Ext. Ref. 2x to 16x +/-0.05 +/-0.1 +/-0.11 %
Offset Error Ext. Ref. 1x -5.0 -1.5 +5.0 mV
VREF=VDDANA/1.48 -5.0 0.5 +5.0 mV
Bandgap -5.0 3.0 +5.0 mV
SFDR Spurious Free Dynamic Range 1x Gain 62.7 70.0 75.0 dB
FCLK_ADC = 2.1MHz
SINAD Signal-to-Noise and Distortion 54.1 65.0 68.5 dB
FIN = 40kHz
SNR Signal-to-Noise Ratio 54.5 65.5 68.6 dB
AIN = 95%FSR
THD Total Harmonic Distortion -77.0 -64.0 -63.0 dB
Noise RMS T=25°C 0.6 1.0 1.6 mV
Note:
1. Maximum numbers are based on characterization and not tested in production, and valid for 5% to 95% of the
input voltage range.
2. Dynamic parameter numbers are based on characterization and not tested in production.
3. Respect the input common mode voltage through the following equations (where VCM_IN is the Input channel
common mode voltage):
– 3.1.1.If |VIN| > VREF/4
– VCM_IN < 0.95*VDDANA + VREF/4 – 0.75V
– VCM_IN > VREF/4 -0.05*VDDANA -0.1V
3.1.2.If |VIN| < VREF/4
– VCM_IN < 1.2*VDDANA - 0.75V
– VCM_IN > 0.2*VDDANA - 0.1V
4. The ADC channels on pins PA08, PA09, PA10, PA11 are powered from the VDDIO power supply. The ADC
performance of these pins will not be the same as all the other ADC channels on pins powered from the
VDDANA power supply.
5. The gain accuracy represents the gain error expressed in percent. Gain accuracy (%) = (Gain Error in V x
100) / (2*Vref/GAIN)
Table 37-27. Single-Ended Mode (Device Variant A)
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
Offset Error Ext. Ref. 1x -5.0 0.6 +5.0 mV
SFDR Spurious Free Dynamic Range 1x gain 63.0 68.0 71.0 dB
FCLK_ADC = 2.1MHz
SINAD Signal-to-Noise and Distortion 55.0 60.1 63.0 dB
FIN = 40kHz
SNR Signal-to-Noise Ratio 54.0 61.0 64.0 dB
AIN = 95%FSR
THD Total Harmonic Distortion -70.8 -68.0 -65.0 dB
Noise RMS T = 25°C - 1.0 - mV
Note:
1. Maximum numbers are based on characterization and not tested in production, and for 5% to 95% of the input
voltage range.
2. Respect the input common mode voltage through the following equations (where VCM_IN is the Input channel
common mode voltage) for all VIN:
– VCM_IN < 0.7*VDDANA + VREF/4 – 0.75V
– VCM_IN > VREF/4 – 0.3*VDDANA - 0.1V
3. The ADC channels on pins PA08, PA09, PA10, PA11 are powered from the VDDIO power supply. The ADC
performance of these pins will not be the same as all the other ADC channels on pins powered from the
VDDANA power supply.
4. The gain accuracy represents the gain error expressed in percent. Gain accuracy (%) = (Gain Error in V x
100) / (Vref/GAIN)
Average Conditions SNR (dB) SINAD (dB) SFDR (dB) ENOB (bits)
Number
1 In differential mode, 1x gain, VDDANA=3.0V, 66.0 65.0 72.8 9.75
VREF=1.0V, 350kSps at 25°C
8 67.6 65.8 75.1 10.62
32 69.7 67.1 75.3 10.85
128 70.4 67.5 75.5 10.91
Average Conditions SNR (dB) SINAD (dB) SFDR (dB) ENOB (bits)
Number
1 In differential mode, 1x gain, VDDANA=3.0V, 66.0 65.0 72.8 10.5
VREF=1.0V, 350kSps at 25°C
8 67.6 65.8 75.1 10.62
32 69.7 67.1 75.3 10.85
128 70.4 67.5 75.5 10.91
(GAINCORR). The offset and gain correction value is subtracted from the converted data before writing the Result
register (RESULT).
Table 37-31. Offset and Gain correction feature
VDDANA/2
Analog Input
AINx CSAMPLE
RSOURCE RSAMPLE
VIN
To achieve n bits of accuracy, the �SAMPLE capacitor must be charged at least to a voltage of
�CSAMPLE ≥ �IN × 1 + − 2− � + 1
The minimum sampling time �SAMPLEHOLD for a given �SOURCEcan be found using this formula:
where
1
�SAMPLEHOLD =
2 × �ADC
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
Internal reference voltage 1 - 1 - V
Internal reference voltage 2 - VDDANA - V
Linear output voltage range 0.05 - VDDANA-0.05 V
Minimum resistive load 5 - - kΩ
Maximum capacitance load - - 100 pF
IDD DC supply current(2) Voltage pump disabled - 160 230 μA
1. These values are based on simulation. These values are not covered by test limits in production or
characterization.
Table 37-34. Accuracy Characteristics(1) (Device Variant A)
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
VSCALE INL(3) -1.4 0.75 +1.4 LSB
DNL(3) -0.9 0.25 +0.9 LSB
Offset Error (1)(2) -0.200 0.260 +0.920 LSB
Gain Error (1)(2) -0.89 0.215 0.89 LSB
Note:
1. According to the standard equation V(X)=VLSB*(X+1); VLSB=VDDANA/64
2. Data computed with the Best Fit method
3. Data computed using histogram
Note: 1. These values are based on characterization. These values are not covered by test limits in production.
Temperature sensor values are not guaranteed for Automotive parts.
The temperature sensor values are logged during test production flow for Room and Hot insertions:
• ROOM_TEMP_VAL_INT and ROOM_TEMP_VAL_DEC contains the measured temperature at room insertion
(e.g. for ROOM_TEMP_VAL_INT=25 and ROOM_TEMP_VAL_DEC=2, the measured temperature at room
insertion is 25.2°C).
• HOT_TEMP_VAL_INT and HOT_TEMP_VAL_DEC contains the measured temperature at hot insertion (e.g. for
HOT_TEMP_VAL_INT=83 and HOT_TEMP_VAL_DEC=3, the measured temperature at room insertion is
83.3°C).
The temperature log row also contains the corresponding 12-bit ADC conversions of both Room and Hot
temperatures:
• ROOM_ADC_VAL contains the 12-bit ADC value corresponding to (ROOM_TEMP_VAL_INT,
ROOM_TEMP_VAL_DEC)
• HOT_ADC_VAL contains the 12-bit ADC value corresponding to (HOT_TEMP_VAL_INT,
HOT_TEMP_VAL_DEC)
The temperature log row also contains the corresponding 1V internal reference of both Room and Hot temperatures:
• ROOM_INT1V_VAL is the 2’s complement of the internal 1V reference value corresponding to
(ROOM_TEMP_VAL_INT, ROOM_TEMP_VAL_DEC)
• HOT_INT1V_VAL is the 2’s complement of the internal 1V reference value corresponding to
(HOT_TEMP_VAL_INT, HOT_TEMP_VAL_DEC)
• ROOM_INT1V_VAL and HOT_INT1V_VAL values are centered around 1V with a 0.001V step. In other words,
the range of values [0,127] corresponds to [1V, 0.873V] and the range of values [-1, -127] corresponds to
[1.001V, 1.127V]. INT1V == 1 - (VAL/1000) is valid for both ranges.
Given a temperature sensor ADC conversion value ADCm, we can infer a coarse value of the temperature tempC as:
1 INT1��
ADC� ⋅ + − ADC� ⋅ ⋅ temp� + − temp�
212 + − 1 212 + − 1
temp� = temp� +
INT1�� INT1��
ADC� ⋅ 12
+ − ADC� ⋅ 12
2 + −1 2 + −1
[Equation 1]
Note:
1. In the previous expression, we have added the conversion of the ADC register value to be expressed in V.
2. This is a coarse value because we assume INT1V=1V for this ADC conversion.
Using the (tempR, INT1VR) and (tempH, INT1VH) points, using a linear interpolation we have the following equation:
INT1� + − INT1�� INT1�� + − INT1��
=
temp+ − temp� temp� + − temp�
Then using the coarse temperature value, we can infer a closer to reality INT1V value during the ADC conversion as:
INT1�� + − INT1�� ⋅ temp� + − temp�
INT1�� = INT1�� +
temp� + − temp�
Back to [Equation 1], if we replace INT1V=1V by INT1V = INT1Vm, we can deduce a finer temperature value as:
INT1�� INT1��
ADC� ⋅ + − ADC� ⋅ ⋅ temp� ⋅ temp�
212 + − 1 12
2 + −1
temp� = temp� +
INT1�� INT1��
ADC� ⋅ 12
+ − ADC� ⋅ 12
2 + −1 2 + −1
[Equation 1bis]
Note that on this flash technology, a max number of 8 consecutive write is allowed per row. Once this number is
reached, a row erase is mandatory.
Table 37-43. Flash Endurance and Data Retention
1. The EEPROM emulation is a software emulation described in the App note AT03265.
2. An endurance cycle is a write and an erase operation.
Table 37-45. NVM Characteristics (Device Variant A)
C LEXT Xin
Crystal
LM
C SHUNT
RM
C STRAY
CM
Xout
C LEXT
IDFLL Power consumption on VDDIN IDFLLVAL.COARSE = DFLL48M COARSE CAL - 403 453 μA
DFLLVAL.FINE = 512
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
tLOCK Lock time fREF = XTAL, 32 .768kHz, 100ppm DFLLMUL = 100 200 500 μs
1464
DFLLVAL.COARSE = DFLL48M COARSE CAL
DFLLVAL.FINE = 512
DFLLCTRL.BPLCKC = 1
DFLLCTRL.QLDIS = 0
DFLLCTRL.CCDIS = 1
DFLLMUL.FSTEP = 10
1. To insure that the device stays within the maximum allowed clock frequency, any reference clock for DFLL in
close loop must be within a 2% error accuracy.
Notes: 1. These values are based on simulation. These values are not covered by test limits in production or
characterization.
2. This oscillator is always on.
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
Jp Period jitter fIN= 32 kHz, fOUT= 48 MHz - 1.5 2.0 %
fIN= 32 kHz, fOUT= 96 MHz - 3.0 10.0
fIN= 2 MHz, fOUT= 48 MHz - 1.3 2.0
fIN= 2 MHz, fOUT= 96 MHz - 3.0 7.0
tLOCK Lock Time After start-up, time to get lock signal. - 1.3 2 ms
fIN= 32 kHz, fOUT= 96 MHz
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
Duty Duty cycle 40 50 60 %
Note: All values have been characterized with FILTSEL[1/0] as the default value.
140
120
100
80
Scan rate 10ms
60 Scan rate 50ms
0
1 2 4 8 16 32 64
Sample averaging
200
180
160
140
120
Scan rate 10ms
100
80 Scan rate 50ms
60 Scan rate 100ms
40 Scan rate 200ms
20
0
1 2 4 8 16 32 64
Sample averaging
1200
1000
800
Scan rate 10ms
600
Scan rate 50ms
400 Scan rate 100ms
Scan rate 200ms
200
Linear (Scan rate 50ms)
0
1 2 4 8 16 32 64
Sample averaging
900
800
700
600
500 Scan rate 10ms
400 Scan rate 50ms
300 Scan rate 100ms
200
Scan rate 200ms
100
0
1 2 4 8 16 32 64
Sample averaging
5000
4500
4000
3500
3000
Scan rate 10ms
2500
2000 Scan rate 50ms
1500 Scan rate 100ms
1000 Scan rate 200ms
500
0
1 2 4 8 16 32 64
Sample averaging
1800
1600
1400
1200
1000 Scan rate 10ms
800 Scan rate 50ms
600 Scan rate 100ms
400
Scan rate 200ms
200
0
1 2 4 8 16 32 64
Sample averaging
80 %
70 %
60 %
50 %
Channel count 1
40 %
Channel count 10
30 %
Channel count 100
20 %
10 %
0%
10 50 100 200
1 2 4 8 16 32 64
Sample Averaging
1 2 4 8 16 32 64
Sample Averaging
1 2 4 8 16 32 64
Sample Averaging
1 2 4 8 16 32 64
Sample Averaging
1 2 4 8 16 32 64
Sample Averaging
1 2 4 8 16 32 64
Sample Averaging
Note:
1. Capacitance load that the PTC circuitry can compensate for each channel.
Table 37-62. Analog Gain Settings
Note:
1. Analog Gain is a parameter of the QTouch Library. Refer to the QTouch Library Peripheral Touch Controller
User Guide.
2. GAIN_16 and GAIN_32 settings are not recommended, otherwise the PTC measurements might get unstable.
The values in the Power Consumption table below are measured values of power consumption under the following
conditions:
Operating conditions
VDD = 3.3 V
Clocks
- The CPU frequency must be higher 8MHz when USB is active (No constraint for USB suspend mode)
- The operating voltages must be 3.3V (Min. 3.0V, Max. 3.6V).
- The GCLK_USB frequency accuracy source must be less than:
- In USB device mode, 48MHz +/-0.25%
- In USB host mode, 48MHz +/-0.05%
Table 37-64. GCLK_USB Clock Setup Recommendations
Notes: 1. When using DFLL48M in USB recovery mode, the Fine Step value must be Ah to guarantee a USB clock at
+/-0.25% before 11ms after a resume.
2. Very high signal quality and crystal less. It is the best setup for USB Device mode.
3. FDPLL lock time is short when the clock frequency source is high (> 1MHz). Thus, FDPLL and external OSC can
be stopped during USB suspend mode to reduce consumption and guarantee a USB wake-up time (See TDRSMDN
in USB specification).
SS
SCK
(CPOL = 0)
tSCKW
SCK
(CPOL = 1)
tSCKW
tMIS tMIH tSCK
MISO
MSB LSB
(Data Input)
tMOH tMOH
MOSI
MSB LSB
(Data Output)
SS
SCK
(CPOL = 0)
tSSCKW
SCK
(CPOL = 1)
tSSCKW
tSIS tSIH tSSCK
MOSI
MSB LSB
(Data Input)
MISO
MSB LSB
(Data Output)
Notes: 1. These values are based on simulation. These values are not covered by test limits in production.
2. See 37.9 I/O Pin Characteristics
tLOW tLOW
SCL
tSU;STA tHD;STA tHD;DAT tSU;DAT
tSU;STO
SDA
tBUF
1. These values are based on simulation. These values are not covered by test limits in production.
2. Cb = Capacitive load on each bus line. Otherwise noted, value of Cb set to 20pF.
SWDIO pin to
Tri State Acknowledge Tri State
debugger
Write Cycle
From debugger to
Stop Park Tri State Start
SWDIO pin
Tis Tih
From debugger to
SWDCLK pin
SWDIO pin to
Tri State Acknowledge Data Data Parity Tri State
debugger
Note: 1. These values are based on simulation. These values are not covered by test limits in production or
characterization.
MCK output
tM_SCKOR tM_SCKOF
SCK output
tM_FSOH tM_SCKO
tM_SDOH
tM_SDIS tM_SDIH tM_FSOV
FS output
tM_SDOV
SD input
Figure 37-25. I2S Timing Slave Mode Slave mode: SCK and FS are input
tS_FSIH
SCK input
tS_FSIS tS_SCKI
tS_SDOH
tS_SDIS tS_SDIH
FS input
tS_SDOV
SD input
SCK input
...........continued
Name Description Mode VDD=1.8V VDD=3.3V Units
Min. Typ. Max Min. Typ. Max.
tS_FSIH FS hold time Slave mode 0 0 ns
tM_SDIS Data input setup time Master mode 34.7 24.5 ns
tM_SDIH Data input hold time Master mode -8.2 -8.2 ns
tS_SDIS Data input setup time Slave mode 4.6 3.9 ns
tS_SDIH Data input hold time Slave mode 1.2 1.2 ns
tM_SDOV Data output valid time Master transmitter 5.6 4.8 ns
tM_SDOH Data output hold time Master transmitter -0.5 -0.5 ns
tS_SDOV Data output valid time Slave transmitter 36.2 25.9 ns
tS_SDOH Data output hold time Slave transmitter 36 25.7 ns
tPDM2LS Data input setup time Master mode PDM2 Left 34.7 24.5 ns
tPDM2LH Data input hold time Master mode PDM2 Left -8.2 -8.2 ns
tPDM2RS Data input setup time Master mode PDM2 Right 30.5 20.9 ns
tPDM2RH Data input hold time Master mode PDM2 Right -6.7 -6.7 ns
...........continued
Name Description Mode VDD=1.8V VDD=3.3V Units
Min. Typ. Max. Min. Typ. Max.
tS_FSIS FS setup time Slave mode 6 5.3 ns
tS_FSIH FS hold time Slave mode 0 0 ns
tM_SDIS Data input setup time Master mode 36 25.9 ns
tM_SDIH Data input hold time Master mode -8.2 -8.2 ns
tS_SDIS Data input setup time Slave mode 9.1 8.3 ns
tS_SDIH Data input hold time Slave mode 3.8 3.7 ns
tM_SDOV Data output valid time Master transmitter 2.5 1.9 ns
tM_SDOH Data output hold time Master transmitter -0.1 -0.1 ns
tS_SDOV Data output valid time Slave transmitter 29.8 19.7 ns
tS_SDOH Data output hold time Slave transmitter 29.1 18.9 ns
tPDM2LS Data input setup time Master mode PDM2 Left 35.5 25.3 ns
tPDM2LH Data input hold time Master mode PDM2 Left -8.2 -8.2 ns
tPDM2RS Data input setup time Master mode PDM2 Right 30.6 21.1 ns
tPDM2RH Data input hold time Master mode PDM2 Right -7 -7 ns
38.1 Disclaimer
All typical values are measured at T = 25°C unless otherwise specified. All minimum and maximum values are valid
across operating temperature and voltage unless otherwise specified.
1. Maximum source current is 46mA and maximum sink current is 65mA per cluster. A cluster is a group of
GPIOs. Also note that each VDD/GND pair is connected to two clusters so current consumption through the
pair will be a sum of the clusters source/sink currents.
Related Links
7.2.4 GPIO Clusters
1. With BOD33 disabled. If the BOD33 is enabled, refer to the BOD33 characteristics.
Related Links
38.6.2.1 BOD33 Characteristics
...........continued
Symbol Description Max. Units
fGCLK_SERCOMx_SLOW Common SERCOM slow input clock frequency 48 MHz
fGCLK_SERCOM0_CORE SERCOM0 input clock frequency 48 MHz
fGCLK_SERCOM1_CORE SERCOM1 input clock frequency 48 MHz
fGCLK_SERCOM2_CORE SERCOM2 input clock frequency 48 MHz
fGCLK_SERCOM3_CORE SERCOM3 input clock frequency 48 MHz
fGCLK_SERCOM4_CORE SERCOM4 input clock frequency 48 MHz
fGCLK_SERCOM5_CORE SERCOM5 input clock frequency 48 MHz
fGCLK_TCC0, fGCLK_TCC1 TCC0, TCC1 input clock frequency 96 MHz
fGCLK_TCC2, fGCLK_TCC3, fGCLK_TC3 TCC2, TCC3, TC3 input clock frequency 96 MHz
fGCLK_TC4, fGCLK_TC5 TC4, TC5 input clock frequency 48 MHz
fGCLK_TC6, fGCLK_TC7 TC6, TC7 input clock frequency 48 MHz
fGCLK_ADC ADC input clock frequency 48 MHz
fGCLK_AC_DIG AC digital input clock frequency 48 MHz
fGCLK_AC_ANA AC analog input clock frequency 64 KHz
fGCLK_AC1_DIG AC1 digital input clock frequency 48 MHz
fGCLK_AC1_ANA AC1 analog input clock frequency 64 KHz
fGCLK_DAC DAC input clock frequency 350 KHz
fGCLK_PTC PTC input clock frequency 48 MHz
fGCLK_I2S_0 I2S serial 0 input clock frequency 13 MHz
fGCLK_I2S_1 I2S serial 1 input clock frequency 13 MHz
Note:
1. Measurements were done with SYSCTRL->VREG.bit.RUNSTDBY = 1
Table 38-6. Current Consumption (Silicon Revision G)
VDDIN
VDDANA
VDDIO
Amp 0
VDDCORE
VDD
VPOT+
VPOT-
Time
Reset
1. These values are based on simulation. These values are not covered by test limits in production or
characterization.
1. These values are based on characterization. These values are not covered by test limits in production.
2. These values are based on simulation. These values are not covered by test limits in production or
characterization.
3. In this condition and for a sample rate of 350ksps, a conversion takes 6 clock cycles of the ADC clock
(conditions: 1X gain, 12-bit resolution, differential mode, free-running).
4. It is the buffered internal reference of 1.0V derived from the internal 1.1V bandgap reference.
Table 38-11. Differential Mode
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
Gain Error Ext. Ref 1x -10.0 -1.3 +10.0 mV
VREF=VDDANA/1.48 -20.0 -10.0 +10.0 mV
Bandgap -20.0 +2 +20.0 mV
Gain Accuracy(5) Ext. Ref. 0.5x +/-0.02 +/-0.05 +/-0.2 %
Ext. Ref. 2x to 16x +/-0.01 +/-0.03 +/-0.5 %
Offset Error Ext. Ref. 1x -8.0 -1.0 +8.0 mV
VREF=VDDANA/1.48 -8.0 -0.60 +8.0 mV
Bandgap -6.0 -1.0 +6.0 mV
SFDR Spurious Free Dynamic Range 1x Gain 65.0 71.5 76.0 dB
FCLK_ADC = 2.1MHz
SINAD Signal-to-Noise and Distortion 58.0 65.0 67.0 dB
FIN = 40kHz
SNR Signal-to-Noise Ratio 60.0 66.0 68.6 dB
AIN = 95%FSR
THD Total Harmonic Distortion -75.0 -71.0 -67.0 dB
Noise RMS T=25°C 0.6 1.0 1.6 mV
1. Maximum numbers are based on characterization and not tested in production, and valid for 5% to 95% of the
input voltage range.
2. Dynamic parameter numbers are based on characterization and not tested in production.
3. Respect the input common mode voltage through the following equations (where VCM_IN is the Input channel
common mode voltage):
3.1. If |VIN| > VREF/4
• VCM_IN < 0.95*VDDANA + VREF/4 – 0.75V
• VCM_IN > VREF/4 -0.05*VDDANA -0.1V
3.2. If |VIN| < VREF/4
• VCM_IN < 1.2*VDDANA - 0.75V
• VCM_IN > 0.2*VDDANA - 0.1V
4. The ADC channels on pins PA08, PA09, PA10, PA11 are powered from the VDDIO power supply. The ADC
performance of these pins will not be the same as all the other ADC channels on pins powered from the
VDDANA power supply.
5. The gain accuracy represents the gain error expressed in percent. Gain accuracy (%) = (Gain Error in V x
100) / (2*Vref/GAIN)
Table 38-12. Single-Ended Mode
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
SFDR Spurious Free Dynamic Range 1x Gain 63.0 68.0 70.1 dB
FCLK_ADC = 2.1MHz
SINAD Signal-to-Noise and Distortion 55.0 60.1 62.5 dB
FIN = 40kHz
SNR Signal-to-Noise Ratio 54.0 61.0 64.0 dB
AIN = 95%FSR
THD Total Harmonic Distortion -70.0 -68.0 -65.0 dB
Noise RMS T = 25°C - 1.0 - mV
1. Maximum numbers are based on characterization and not tested in production, and for 5% to 95% of the input
voltage range.
2. Respect the input common mode voltage through the following equations (where VCM_IN is the Input channel
common mode voltage) for all VIN:
– VCM_IN < 0.7*VDDANA + VREF/4 – 0.75V
– VCM_IN > VREF/4 – 0.3*VDDANA - 0.1V
3. The ADC channels on pins PA08, PA09, PA10, PA11 are powered from the VDDIO power supply. The ADC
performance of these pins will not be the same as all the other ADC channels on pins powered from the
VDDANA power supply.
4. The gain accuracy represents the gain error expressed in percent. Gain accuracy (%) = (Gain Error in V x
100) / (Vref/GAIN)
Gain Factor Conditions Offset Error (mV) Gain Error (mV) Total Unadjusted Error
(LSB)
0.5x In differential mode, 1x gain, 0.25 1 2.4
VDDANA=3.0V, VREF=1.0V,
350kSps at 25°C
1x 0.2 0.1 1.5
2x 0.15 -0.15 2.7
...........continued
Gain Factor Conditions Offset Error (mV) Gain Error (mV) Total Unadjusted Error
(LSB)
8x -0.05 0.05 3.2
16x 0.1 -0.05 6.1
VDDANA/2
Analog Input
AINx CSAMPLE
RSOURCE RSAMPLE
VIN
To achieve n bits of accuracy, the �SAMPLE capacitor must be charged at least to a voltage of
�CSAMPLE ≥ �IN × 1 − 2− � + 1
The minimum sampling time �SAMPLEHOLD for a given �SOURCEcan be found using this formula:
where
1
�SAMPLEHOLD =
2 × �ADC
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
IDD DC supply current(2) Voltage pump disabled - 160 245 μA
1. These values are based on simulation. These values are not covered by test limits in production or
characterization.
Table 38-17. Accuracy Characteristics
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
Offset Hysteresis = 0, Fast mode -15 0.0 +15 mV
Hysteresis = 0, Low power mode -25 0.0 +25 mV
Hysteresis Hysteresis = 1, Fast mode 20 50 85 mV
Hysteresis = 1, Low power mode 15 40 75 mV
Propagation delay Changes for VACM=VDDANA/2 - 90 180 ns
100mV overdrive, Fast mode
Changes for VACM=VDDANA/2 - 282 520 ns
100mV overdrive, Low power mode
tSTARTUP Startup time Enable to ready delay - 1 2.6 μs
Fast mode
Enable to ready delay - 14 22 μs
Low power mode
VSCALE INL(3) -1.4 0.75 1.4 LSB
DNL(3) -0.9 0.25 0.9 LSB
Offset Error (1)(2) -0.20 0.26 +0.92 LSB
Gain Error (1)(2) -0.89 0.215 0.89 LSB
1. The EEPROM emulation is a software emulation described in the App note AT03265.
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
IXOSC Current Consumption f = 2MHz, CL = 20pF, AGC off 65 87 μA
f = 2MHz, CL = 20pF, AGC on 52 76
f = 4MHz, CL = 20pF, AGC off 117 155
f = 4MHz, CL = 20pF, AGC on 74 104
f = 8MHz, CL = 20pF, AGC off 226 308
f = 8MHz, CL = 20pF, AGC on 128 180
f = 16MHz, CL = 20pF, AGC off 502 714
f = 16MHz, CL = 20pF, AGC on 307 590
f = 32MHz, CL = 18pF, AGC off 1622 2257
f = 32MHz, CL = 18pF, AGC on 615 1280
tSTARTUP Startup time f = 2MHz, CL = 20pF, - 14K 48K cycles
XOSC.GAIN = 0, ESR = 600Ω
f = 4MHz, CL = 20pF, - 6800 19.5K
XOSC.GAIN = 1, ESR = 100Ω
f = 8 MHz, CL = 20pF, - 5550 13K
XOSC.GAIN = 2, ESR = 35Ω
f = 16 MHz, CL = 20pF, - 6750 14.5K
XOSC.GAIN = 3, ESR = 25Ω
f = 32MHz, CL = 18pF, - 5.3K 9.6K
XOSC.GAIN = 4, ESR = 40Ω
C LEXT Xin
Crystal
LM
C SHUNT
RM
C STRAY
CM
Xout
C LEXT
IDFLL Power consumption on VDDIN IDFLLVAL.COARSE = DFLL48M COARSE CAL - 403 453 μA
DFLLVAL.FINE = 512
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
fREF Reference frequency I 0.732 32.768 33 kHz
Jitter Period Jitter fREF = 32.768kHz - - 0.42 ns
IDFLL Power consumption on fREF = 32.768kHz - 403 453 μA
VDDIN
tLOCK Lock time fREF = 32.768kHz 200 500 μs
DFLLVAL.COARSE = DFLL48M COARSE CAL
DFLLVAL.FINE = 512
DFLLCTRL.BPLCKC = 1
DFLLCTRL.QLDIS = 0
DFLLCTRL.CCDIS = 1
DFLLMUL.FSTEP = 10
1. These values are based on simulation, and not covered by test limits in production or characterization.
2. This oscillator is always on.
Note: All values have been characterized with FILTSEL[1/0] as default value.
Table 38-31. FDPLL96M Characteristics(1) (Silicon Revision F and G)
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
IFDPLL96M Current consumption fIN= 32 kHz, fOUT= 48 MHz - 500 - μA
fIN= 32 kHz, fOUT= 96 MHz - 900 -
Jp Period jitter fIN= 32 kHz, fOUT= 48 MHz - 2.1 3.0 %
fIN= 32 kHz, fOUT= 96 MHz - 3.8 9.2
fIN= 2 MHz, fOUT= 48 MHz - 2.2 3.2
fIN= 2 MHz, fOUT= 96 MHz - 4.4 10.0
tLOCK Lock Time After startup, time to get lock signal. - 1.2 2 ms
fIN= 32 kHz, fOUT= 96 MHz
Note: 1. All values have been characterized with FILTSEL[1/0] as default value.
PTC scan
Drift
Symbol Parameters rate Oversamples Ta Typ. Max Units
Calibration
(msec)
4 9 458
10
16 17 467
4 5 452
50
16 6 454
Disabled
4 4 452
100
16 5 453
4 4 452
200
Current 16 Max 105°C Typ 4 452
IDD µA
Consumption 4 25°C 15 466
10
16 23 476
4 7 456
50
16 8 459
Enabled
4 5 455
100
16 6 455
4 6 453
200
16 6 454
39.1 Disclaimer
All typical values are measured at T = 25°C unless otherwise specified. All minimum and maximum values are valid
across operating temperature and voltage unless otherwise specified.
Note:
1. Maximum source current is 14mA and maximum sink current is 19.5mA per cluster. A cluster is a group of
GPIOs, see related links. Also note that each VDD/GND pair is connected to 2 clusters so current
consumption through the pair will be a sum of the clusters source/sink currents.
Related Links
7.2.4 GPIO Clusters
Note:
Notes: 1. With BOD33 disabled. If the BOD33 is enabled, check Table 37-21.
...........continued
Symbol Description Max. Units
fGCLK_EVSYS_CHANNEL_10 EVSYS channel 10 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_11 EVSYS channel 11 input clock frequency 48 MHz
fGCLK_SERCOMx_SLOW Common SERCOM slow input clock frequency 48 MHz
fGCLK_SERCOM0_CORE SERCOM0 input clock frequency 48 MHz
fGCLK_SERCOM1_CORE SERCOM1 input clock frequency 48 MHz
fGCLK_SERCOM2_CORE SERCOM2 input clock frequency 48 MHz
fGCLK_SERCOM3_CORE SERCOM3 input clock frequency 48 MHz
fGCLK_SERCOM4_CORE SERCOM4 input clock frequency 48 MHz
fGCLK_SERCOM5_CORE SERCOM5 input clock frequency 48 MHz
fGCLK_TCC0, fGCLK_TCC1 TCC0, TCC1 input clock frequency 96 MHz
fGCLK_TCC2, fGCLK_TC3 TCC2, TC3 input clock frequency 96 MHz
fGCLK_TC4, fGCLK_TC5 TC4, TC5 input clock frequency 48 MHz
fGCLK_TC6, fGCLK_TC7 TC6, TC7 input clock frequency 48 MHz
fGCLK_ADC ADC input clock frequency 48 MHz
fGCLK_AC_DIG AC digital input clock frequency 48 MHz
fGCLK_AC_ANA AC analog input clock frequency 64 KHz
fGCLK_DAC DAC input clock frequency 350 KHz
fGCLK_PTC PTC input clock frequency 48 MHz
fGCLK_I2S_0 I2S serializer 0 input clock frequency 13 MHz
fGCLK_I2S_1 I2S serializer 1 input clock frequency 13 MHz
...........continued
Symbol Description Max. Units
fAPBA APBA clock frequency 48 MHz
fAPBB APBB clock frequency 48 MHz
fAPBC APBC clock frequency 48 MHz
fGCLK_DFLL48M_REF DFLL48M Reference clock frequency 33 KHz
fGCLK_DPLL FDPLL96M Reference clock frequency 2 MHz
fGCLK_DPLL_32K FDPLL96M 32k Reference clock frequency 32 KHz
fGCLK_WDT WDT input clock frequency 48 MHz
fGCLK_RTC RTC input clock frequency 48 MHz
fGCLK_EIC EIC input clock frequency 48 MHz
fGCLK_USB USB input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_0 EVSYS channel 0 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_1 EVSYS channel 1 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_2 EVSYS channel 2 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_3 EVSYS channel 3 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_4 EVSYS channel 4 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_5 EVSYS channel 5 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_6 EVSYS channel 6 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_7 EVSYS channel 7 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_8 EVSYS channel 8 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_9 EVSYS channel 9 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_10 EVSYS channel 10 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_11 EVSYS channel 11 input clock frequency 48 MHz
fGCLK_SERCOMx_SLOW Common SERCOM slow input clock frequency 48 MHz
fGCLK_SERCOM0_CORE SERCOM0 input clock frequency 48 MHz
fGCLK_SERCOM1_CORE SERCOM1 input clock frequency 48 MHz
fGCLK_SERCOM2_CORE SERCOM2 input clock frequency 48 MHz
fGCLK_SERCOM3_CORE SERCOM3 input clock frequency 48 MHz
fGCLK_SERCOM4_CORE SERCOM4 input clock frequency 48 MHz
fGCLK_SERCOM5_CORE SERCOM5 input clock frequency 48 MHz
fGCLK_TCC0, fGCLK_TCC1 TCC0, TCC1 input clock frequency 96 MHz
fGCLK_TCC2, fGCLK_TCC3, fGCLK_TC3 TCC2, TCC3,TC3 input clock frequency 96 MHz
fGCLK_TC4, fGCLK_TC5 TC4, TC5 input clock frequency 48 MHz
fGCLK_TC6, fGCLK_TC7 TC6, TC7 input clock frequency 48 MHz
fGCLK_ADC ADC input clock frequency 48 MHz
fGCLK_AC_DIG AC digital input clock frequency 48 MHz
...........continued
Symbol Description Max. Units
fGCLK_AC_ANA AC analog input clock frequency 64 KHz
fGCLK_AC1_DIG AC1 digital input clock frequency 48 MHz
fGCLK_AC1_ANA AC1 analog input clock frequency 64 KHz
fGCLK_DAC DAC input clock frequency 350 KHz
fGCLK_PTC PTC input clock frequency 48 MHz
fGCLK_I2S_0 I2S serializer 0 input clock frequency 13 MHz
fGCLK_I2S_1 I2S serializer 1 input clock frequency 13 MHz
Table
• 39-7. Current Consumption (Device Variant A, B, C and L. Silicon Revision F)
Note:
1. Measurements were done with SYSCTRL->VREG.bit.RUNSTDBY = 1
Note:
1. Measurements done with VREG.bit.RUNSTDBY = 1.
Table 39-9. Wake-up Time (SAMD21)
VDDIN
VDDANA
VDDIO
Amp 0
VDDCORE
VDD
VPOT+
VPOT-
Time
Reset
39.6.2.1 BOD33
Table 39-11. BOD33 Characteristics (Device Variant A)
Note: 1. These values are based on simulation. These values are not covered by test limits in production or
characterization.
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
CSAMPLE Sampling capacitance(2) - 3.5 - pF
RSAMPLE Input channel source - - 3.5 kΩ
resistance(2)
IDD DC supply current(1) fCLK_ADC = 2.1MHz(3) - 1.25 1.85 mA
VDDANA Power Supply Voltage T>105°C 3 3.6 V
Note:
1. These values are based on characterization. These values are not covered by test limits in production.
2. These values are based on simulation. These values are not covered by test limits in production or
characterization.
3. In this condition and for a sample rate of 350ksps, 1 Conversion at gain 1x takes 6 clock cycles of the ADC
clock (conditions: 1X gain, 12-bit resolution, differential mode, free-running).
4. All single-shot measurements are performed with VDDANA > 3.0V.
5. It is the buffered internal reference of 1.0V derived from the internal 1.1V bandgap reference.
Table 39-14. Operating Conditions (Device Variant B, C, D and L)
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
IDD DC supply current(1) fCLK_ADC = - 1.25 1.85 mA
2.1MHz(3)
VDDANA Power Supply Voltage T>105°C 3 3.6 V
Note:
1. These values are based on characterization. These values are not covered by test limits in production.
2. These values are based on simulation. These values are not covered by test limits in production or
characterization.
3. In this condition and for a sample rate of 350ksps, 1 Conversion at gain 1x takes 6 clock cycles of the ADC
clock (conditions: 1X gain, 12-bit resolution, differential mode, free-running).
4. It is the buffered internal reference of 1.0V derived from the internal 1.1V bandgap reference.
Table 39-15. Differential Mode (Device Variant A)
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
Gain Error Ext. Ref 1x -10.0 -1.3 +10 mV
VREF=VDDANA/1.48 -25.0 -10.1 +10.0 mV
Bandgap -25.0 +2 +10.0 mV
Gain Accuracy(5) Ext. Ref. 0.5x +/-0.005 +/-0.05 +/-0.15 %
Ext. Ref. 2x to 16x +/-0.01 +/-0.03 +/-0.5 %
Offset Error Ext. Ref. 1x -8.0 -1.0 +8.0 mV
VREF=VDDANA/1.48 -8.0 -0.6 +8.0 mV
Bandgap -6.0 -1.0 +8.0 mV
SFDR Spurious Free Dynamic Range 1x Gain 65.0 71.5 73.5 dB
FCLK_ADC = 2.1MHz
SINAD Signal-to-Noise and Distortion 58.0 65.0 67.0 dB
FIN = 40kHz
SNR Signal-to-Noise Ratio 60.0 66 68.6 dB
AIN = 95%FSR
THD Total Harmonic Distortion -73.0 -71.0 -67.0 dB
Noise RMS T=25°C 0.6 1.0 1.6 mV
Note:
1. Maximum numbers are based on characterization and not tested in production, and valid for 5% to 95% of the
input voltage range.
2. Dynamic parameter numbers are based on characterization and not tested in production.
3. Respect the input common mode voltage through the following equations (where VCM_IN is the Input channel
common mode voltage):
– 3.1.1.If |VIN| > VREF/4
– VCM_IN < 0.95*VDDANA + VREF/4 – 0.75V
– VCM_IN > VREF/4 -0.05*VDDANA -0.1V
3.1.2.If |VIN| < VREF/4
– VCM_IN < 1.2*VDDANA - 0.75V
– VCM_IN > 0.2*VDDANA - 0.1V
4. The ADC channels on pins PA08, PA09, PA10, PA11 are powered from the VDDIO power supply. The ADC
performance of these pins will not be the same as all the other ADC channels on pins powered from the
VDDANA power supply.
5. The gain accuracy represents the gain error expressed in percent. Gain accuracy (%) = (Gain Error in V x
100) / (2*Vref/GAIN)
Table 39-17. Single-Ended Mode (Device Variant A)
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
Offset Error Ext. Ref. 1x -5.0 1.5 +10.0 mV
SFDR Spurious Free Dynamic Range 1x Gain 63.1 65.0 66.5 dB
FCLK_ADC = 2.1MHz
SINAD Signal-to-Noise and Distortion 50.7 59.5 61.0 dB
FIN = 40kHz
SNR Signal-to-Noise Ratio 49.9 60.0 64.0 dB
AIN = 95%FSR
THD Total Harmonic Distortion -65.4 -63.0 -62.1 dB
Noise RMS T = 25°C - 1.0 - mV
Note:
1. Maximum numbers are based on characterization and not tested in production, and for 5% to 95% of the input
voltage range.
2. Respect the input common mode voltage through the following equations (where VCM_IN is the Input channel
common mode voltage) for all VIN:
– VCM_IN < 0.7*VDDANA + VREF/4 – 0.75V
– VCM_IN > VREF/4 – 0.3*VDDANA - 0.1V
3. The ADC channels on pins PA08, PA09, PA10, PA11 are powered from the VDDIO power supply. The ADC
performance of these pins will not be the same as all the other ADC channels on pins powered from the
VDDANA power supply.
4. The gain accuracy represents the gain error expressed in percent. Gain accuracy (%) = (Gain Error in V x
100) / (Vref/GAIN)
VDDANA/2
Analog Input
AINx CSAMPLE
RSOURCE RSAMPLE
VIN
To achieve n bits of accuracy, the �SAMPLE capacitor must be charged at least to a voltage of
�CSAMPLE ≥ �IN × 1 + − 2− � + 1
The minimum sampling time �SAMPLEHOLD for a given �SOURCEcan be found using this formula:
where
1
�SAMPLEHOLD =
2 × �ADC
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
Minimum resistive load 5 - - kΩ
Maximum capacitance load - - 100 pF
IDD DC supply current(2) Voltage pump disabled - 160 283 μA
Note: 1. These values are based on simulation. These values are not covered by test limits in production or
characterization.
Table 39-22. Accuracy Characteristics(1)(Device Variant A)
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
INL Integral non-linearity VREF= Ext 1.0V VDD = 1.6V 0.7 0.75 2.0 LSB
VDD = 3.6V 0.6 0.65 1.5
VREF = VDDANA VDD = 1.6V 0.6 0.85 2.0
VDD = 3.6V 0.5 0.8 1.5
VREF= INT1V VDD = 1.6V 0.5 0.75 1.5
VDD = 3.6V 0.7 0.8 1.5
DNL Differential non-linearity VREF= Ext 1.0V VDD = 1.6V +/-0.3 +/-0.4 +/-1.0 LSB
VDD = 3.6V +/-0.25 +/-0.4 +/-0.75
VREF= VDDANA VDD = 1.6V +/-0.4 +/-0.55 +/-1.5
VDD = 3.6V +/-0.2 +/-0.3 +/-0.75
VREF= INT1V VDD = 1.6V +/-0.5 +/-0.7 +/-1.5
VDD = 3.6V +/-0.4 +/-0.7 +/-1.5
Gain error Ext. VREF +/-0.5 +/-5 +/-12 mV
Offset error Ext. VREF +/-2 +/-1.5 +/-8 mV
Note:
1. According to the standard equation V(X)=VLSB*(X+1); VLSB=VDDANA/64
2. Data computed with the Best Fit method
3. Data computed using histogram
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
Temperature sensor 2.06 2.16 2.26 mV/°C
slope
Variation over VDDANA VDDANA=1.62V to 3.6V -0.4 1.4 3 mV/V
voltage
Temperature Sensor Using the method described in the 37.11.8.2 -13.0 - 13.0 °C
accuracy Software-based Refinement of the Actual
Temperature
Note: 1. These values are based on characterization. These values are not covered by test limits in production.
Note that on this flash technology, a max number of 8 consecutive write is allowed per row. Once this number is
reached, a row erase is mandatory.
Table 39-29. Flash Endurance and Data Retention
Notes: 1. The EEPROM emulation is a software emulation described in the App note AT03265.
2. An endurance cycle is a write and an erase operation.
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
Current Consumption f = 2MHz, CL = 20pF, AGC off 27 65 90 μA
f = 2MHz, CL = 20pF, AGC on 14 52 79
f = 4MHz, CL = 20pF, AGC off 61 117 161
f = 4MHz, CL = 20pF, AGC on 23 74 110
f = 8MHz, CL = 20pF, AGC off 131 226 319
f = 8MHz, CL = 20pF, AGC on 56 128 193
f = 16MHz, CL = 20pF, AGC off 305 502 742
f = 16MHz, CL = 20pF, AGC on 116 307 627
f = 32MHz, CL = 18pF, AGC off 1031 1622 2344
f = 32MHz, CL = 18pF, AGC on 278 615 1422
tSTARTUP Start-up time f = 2MHz, CL = 20pF, - 14K 48K cycles
XOSC.GAIN = 0, ESR = 600Ω
f = 4MHz, CL = 20pF, - 6800 19.5K
XOSC.GAIN = 1, ESR = 100Ω
f = 8 MHz, CL = 20pF, - 5550 13K
XOSC.GAIN = 2, ESR = 35Ω
f = 16 MHz, CL = 20pF, - 6750 14.5K
XOSC.GAIN = 3, ESR = 25Ω
f = 32MHz, CL = 18pF, - 5.3K 9.6K
XOSC.GAIN = 4, ESR = 40Ω
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
Current Consumption f = 2MHz, CL = 20pF, AGC off 27 65 90 μA
f = 2MHz, CL = 20pF, AGC on 14 52 79
f = 4MHz, CL = 20pF, AGC off 61 117 160
f = 4MHz, CL = 20pF, AGC on 23 74 110
f = 8MHz, CL = 20pF, AGC off 131 226 319
f = 8MHz, CL = 20pF, AGC on 56 128 193
f = 16MHz, CL = 20pF, AGC off 305 502 741
f = 16MHz, CL = 20pF, AGC on 116 307 626
f = 32MHz, CL = 18pF, AGC off 1031 1622 2344
f = 32MHz, CL = 18pF, AGC on 278 615 1400
tSTARTUP Start-up time f = 2MHz, CL = 20pF, - 14K 48K cycles
XOSC.GAIN = 0, ESR = 600Ω
f = 4MHz, CL = 20pF, - 6800 19.5K
XOSC.GAIN = 1, ESR = 100Ω
f = 8 MHz, CL = 20pF, - 5550 13K
XOSC.GAIN = 2, ESR = 35Ω
f = 16 MHz, CL = 20pF, - 6750 14.5K
XOSC.GAIN = 3, ESR = 25Ω
f = 32MHz, CL = 18pF, - 5.3K 9.6K
XOSC.GAIN = 4, ESR = 40Ω
C LEXT Xin
Crystal
LM
C SHUNT
RM
C STRAY
CM
Xout
C LEXT
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
IDFLL Power consumption on VDDIN IDFLLVAL.COARSE = DFLL48M COARSE CAL - 403 457 μA
DFLLVAL.FINE = 512
IDFLL Power consumption on VDDIN IDFLLVAL.COARSE = DFLL48M COARSE CAL - 403 453 μA
DFLLVAL.FINE = 512
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
tLOCK Lock time fREF = 32 .768kHz - 200 500 μs
DFLLVAL.COARSE = DFLL48M COARSE CAL
DFLLVAL.FINE = 512
DFLLCTRL.BPLCKC = 1
DFLLCTRL.QLDIS = 0
DFLLCTRL.CCDIS = 1
DFLLMUL.FSTEP = 10
Table 39-44. Ultra Low-Power Internal 32 kHz RC Oscillator Characteristics (Device Variant B, C, D and L)
Note:
1. These values are based on simulation, and are not covered by test limits in production or characterization.
2. This oscillator is always on.
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
tLOCK Lock Time After start-up, time to get lock signal. - 1.2 2 ms
fIN= 32 kHz, fOUT= 96 MHz
Table 39-49. FDPLL96M Characteristics(1) (Device Variant B, C, D and L with Silicon Revision F and G)
Note:
1. All values have been characterized with FILTSEL[1/0] as default value.
Drift Calibration enabled: RTC interrupts (wakeup) the CPU to perform PTC scans. PTC drift calibration is performed
every 1.5 sec.
Table 39-50. Power Consumption (1)
PTC scan
Drift
Symbol Parameters rate Oversamples Ta Typ. Max Units
Calibration
(msec)
4 66 791
10
16 75 803
4 61 787
50
16 63 791
Disabled
4 61 788
100
16 62 790
4 60 788
200
Current 16 Max 125°C Typ 61 789
IDD (2) µA
Consumption 4 25°C 71 802
10
16 80 813
4 63 792
50
16 65 795
Enabled
4 62 791
100
16 63 793
4 62 790
200
16 63 791
Note:
1. These are based on characterization.
2. On this table, the LDO Voltage Regulator is enabled in Standby mode (SYSCTRL.VREG.RUNSTDBY = 1).
40.1 Disclaimer
All typical values are measured at T = 25°C unless otherwise specified. All minimum and maximum values are valid
across operating temperature and voltage unless otherwise specified.
Note:
1. Maximum source current is 14mA and maximum sink current is 19.5mA per cluster. A cluster is a group of
GPIOs, see related links. Also note that each VDD/GND pair is connected to 2 clusters so current
consumption through the pair will be a sum of the clusters source/sink currents.
Related Links
GPIO Clusters
Note: To secure power up and power down sequence, enabling BOD33 is recommended.
Related Links
Power Supply and Start-Up Considerations
...........continued
Symbol Description Max. Units
fGCLK_EVSYS_CHANNEL_3 EVSYS channel 3 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_4 EVSYS channel 4 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_5 EVSYS channel 5 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_6 EVSYS channel 6 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_7 EVSYS channel 7 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_8 EVSYS channel 8 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_9 EVSYS channel 9 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_10 EVSYS channel 10 input clock frequency 48 MHz
fGCLK_EVSYS_CHANNEL_11 EVSYS channel 11 input clock frequency 48 MHz
fGCLK_SERCOMx_SLOW Common SERCOM slow input clock frequency 48 MHz
fGCLK_SERCOM0_CORE SERCOM0 input clock frequency 48 MHz
fGCLK_SERCOM1_CORE SERCOM1 input clock frequency 48 MHz
fGCLK_SERCOM2_CORE SERCOM2 input clock frequency 48 MHz
fGCLK_SERCOM3_CORE SERCOM3 input clock frequency 48 MHz
fGCLK_SERCOM4_CORE SERCOM4 input clock frequency 48 MHz
fGCLK_SERCOM5_CORE SERCOM5 input clock frequency 48 MHz
fGCLK_TCC0, fGCLK_TCC1 TCC0, TCC1 input clock frequency 80 MHz
fGCLK_TCC2, fGCLK_TC3 TCC2,TC3 input clock frequency 80 MHz
fGCLK_TC4, fGCLK_TC5 TC4, TC5 input clock frequency 48 MHz
fGCLK_TC6, fGCLK_TC7 TC6,TC7 input clock frequency 48 MHz
fGCLK_ADC ADC input clock frequency 48 MHz
fGCLK_AC_DIG AC digital input clock frequency 48 MHz
fGCLK_AC_ANA AC analog input clock frequency 64 kHz
fGCLK_DAC DAC input clock frequency 350 kHz
fGCLK_PTC PTC input clock frequency 48 MHz
fGCLK_I2S_0 I2S serial 0 input clock frequency 13 MHz
fGCLK_I2S_1 I2S serial 1 input clock frequency 13 MHz
...........continued
Symbol Description Max. Units
fGCLK_SERCOM0_CORE SERCOM0 input clock frequency 48 MHz
fGCLK_SERCOM1_CORE SERCOM1 input clock frequency 48 MHz
fGCLK_SERCOM2_CORE SERCOM2 input clock frequency 48 MHz
fGCLK_SERCOM3_CORE SERCOM3 input clock frequency 48 MHz
fGCLK_SERCOM4_CORE SERCOM4 input clock frequency 48 MHz
fGCLK_SERCOM5_CORE SERCOM5 input clock frequency 48 MHz
fGCLK_TCC0, GCLK_TCC1 TCC0, TCC1 input clock frequency 96 MHz
fGCLK_TCC2,fGCLK_TCC3, GCLK_TC3 TCC2, TCC3, TC3 input clock frequency 96 MHz
fGCLK_TC4, GCLK_TC5 TC4, TC5 input clock frequency 48 MHz
fGCLK_TC6, GCLK_TC7 TC6,TC7 input clock frequency 48 MHz
fGCLK_ADC ADC input clock frequency 48 MHz
fGCLK_AC_DIG AC digital input clock frequency 48 MHz
fGCLK_AC_ANA AC analog input clock frequency 64 kHz
fGCLK_DAC DAC input clock frequency 350 kHz
fGCLK_PTC PTC input clock frequency 48 MHz
fGCLK_I2S_0 I2S serial 0 input clock frequency 13 MHz
fGCLK_I2S_1 I2S serial 1 input clock frequency 13 MHz
Note:
1. Measurements done with VREG.bit.RUNSTDBY = 1.
Note:
1. Measurements done with VREG.bit.RUNSTDBY = 1.
Note:
1. Measurements done with VREG.bit.RUNSTDBY = 1.
Table 40-13. Wake-Up Time
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
IOL Output low-level current VDD = 2.7V-3V, - - - mA
PORT.PINCFG.DRVSTR=0 - - 1
VDD = 3V-3.63V, - - -
PORT.PINCFG.DRVSTR=0 - - 2.5
VDD = 2.7V-3V, - - -
PORT.PINCFG.DRVSTR=1 - - 3
VDD = 3V-3.63V, - - -
PORT.PINCFG.DRVSTR=1 - - 10
IOH Output high-level current VDD = 2.7V-3V, - - -
PORT.PINCFG.DRVSTR=0 - - 0.7
VDD = 3V-3.63V, - - -
PORT.PINCFG.DRVSTR=0 - - 2
VDD = 2.7V-3V, - - -
PORT.PINCFG.DRVSTR = 1 - - 2
VDD = 3V-3.63V, - - -
PORT.PINCFG.DRVSTR = 1 - - 7
tRISE Rise time(1) load = 20 pF, VDD = 3.3V - - 15 ns
PORT.PINCFG.DRVSTR=1 - - -
Load = 5 pF, VDD = 3.3V - - 15
PORT.PINCFG.DRVSTR=0 - - -
tFALL Fall time(1) load = 20 pF, VDD = 3.3V - - 15
PORT.PINCFG.DRVSTR = 1 - - -
load = 5 pF, VDD = 3.3V - - 15
PORT.PINCFG.DRVSTR = 0 - - -
ILEAK Input leakage current Pull-up resistors disabled -1 +/-0.015 1 µA
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
IOL Output low-level current VDD = 2.7V-3V, - - 3 mA
VDD=3V-3.63V, - - 8
IOH Output high-level current VDD=2.7V-3V, - - 2
VDD = 3V-3.63V, - - 7
tRISE Rise time(1) Load = 5pF, VDD = 3.3V - - 15 ns
Load = 20pF, VDD = 3.3V
tFALL Fall time(1) Load = 5pF, VDD = 3.3V - - 15
Load = 20pF, VDD = 3.3V
ILEAK Input leakage current Pull-up resistors disabled -1 +/-0.015 1 µA
Note:
1. These values are based on simulation. They are not covered by production test limits or characterization.
2. The I2C pins have faster fall-time in I2C Fast Plus mode (Fm+) and High Speed mode (HS). The fall-time can
be in 7 ns range in Fm+ mode, and in 5 ns range in HS mode.
3. USB pads PA24, PA25 compliant with USB standard in USB mode.
Note: Refer to the Memories table NVM User Row Mapping for the BOD33 default value settings.
Table 40-21. BOD33 Characteristics (Device Variant D)
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
VHYST VBOD+ - VBOD- Hysteresis ON 35 - 170 mV
tDET (1) Detection time Time with VDDANA < VTH - 0.9 - µs
necessary to generate a reset
signal
IBOD33 Current Consumption IDLE2, Mode CONT 25°C - 33 48 µA
-40 to 125 - - 53.0
IDLE2, Mode SAMPL 25°C - 0.03 0.50
-40 to 125 - - 2.3
STDBY, Mode SAMPL 25°C - 0.13 0.50
-40 to 125 - - 1.7
tSTARTUP (1) Start-up time - 1.2 - µs
Note:
1. These values are based on simulation. These values are not covered by test limits in production or
characterization.
...........continued
Symbol Parameters Conditions Min Typ Max Unit
Sampling rate(2) Single shot (with 5 - 300 ksps
VDDANA > 3.0V)(4)
...........continued
Symbol Parameters Conditions Min Typ Max Unit
VREFINTVCC0 Internal ratiometric 2.0V < -1 - 1 %
Voltage Error reference 0(2) error VDDANA<3.63V
VREFINTVCC1 Internal ratiometric VDDANA>2.0V - VDDANA/2 - V
reference 1(2)
VREFINTVCC1 Internal ratiometric 2.0V < -1 - 1 %
Voltage Error reference 1(2) error VDDANA<3.63V
Conversion range(1) Differential mode -VREF/ - +VREF/GAIN V
GAIN
Single-ended mode 0 - +VREF/GAIN V
CSAMPLE Sampling capacitance(2) - 3.5 - pF
RSAMPLE Input channel source - - 3.5 kohms
resistance(2)
IDD DC supply current(1) fCLK_ADC = - 1.25 4.7 mA
2.1MHzI(3)
Note:
1. These values are based on characterization. These values are not covered by test limits in production.
2. These values are based on simulation. These values are not covered by test limits in production or
characterization.
3. In this condition and for a sample rate of 350ksps, 1 Conversion at gain 1x takes 6 clock cycles of the ADC
clock.
4. All single-shot measurements are performed with VDDANA > 3.0V (cf. ADC errata).
5. It is the buffered internal reference of 1.0V derived from the internal 1.1V bandgap reference.
Table 40-26. Differential Mode : FCLK_ADC = 2.1MHz (Device Variant A)
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
SFDR Spurious Free Dynamic Range 1x Gain 64.2 70 78.9 dB
SINAD Signal-to-Noise and Distortion FIN = 40kHz 60.4 61.1 62.7 dB
SNR Signal-to-Noise Ratio AIN = 95%FSR 63.4 64.4 66 dB
THD Total Harmonic Distortion -65.0 -64.0 -62.6 dB
Noise RMS T=25°C 0.6 1 2.5 mV
Note:
1. Maximum numbers are based on characterization and not tested in production, and valid for 5% to 95% of the
input voltage range.
2. Dynamic parameter numbers are based on characterization and not tested in production.
3. Respect the input common mode voltage through the following equations (where VCM_IN is the Input channel
common mode voltage):
– 3.1.1.If |VIN| > VREF/4
– VCM_IN < 0.95*VDDANA + VREF/4 – 0.75V
– VCM_IN > VREF/4 -0.05*VDDANA -0.1V
3.1.2.If |VIN| < VREF/4
– VCM_IN < 1.2*VDDANA - 0.75V
– VCM_IN > 0.2*VDDANA - 0.1V
4. The ADC channels on pins PA08, PA09, PA10, and PA11 are powered from the VDDIO power supply. The ADC
performance of these pins will not be the same as all the other ADC channels on pins powered from the
VDDANA power supply.
5. The gain accuracy represents the gain error expressed in percent. Gain accuracy (%) = (Gain Error in V x
100) / (2*VREF/GAIN).
Table 40-28. Single Ended Mode FCLK_ADC = 2.1MHz (Device Variant A)
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
OE Offset Error Ext. Ref. 1x -5 3.2 12 mV
SFDR Spurious Free Dynamic Range 1x Gain 61.7 66.6 66.6 dB
SINAD Signal-to-Noise and Distortion FIN = 40kHz 53.9 58.8 60.7 dB
SNR Signal-to-Noise Ratio AIN = 95%FSR 52.9 59.7 62.7 dB
THD Total Harmonic Distortion -67.6 -66.6 -63.7 dB
- Noise RMS T = 25°C - 1 6 mV
Note:
1. Maximum numbers are based on characterization and not tested in production, and for 5% to 95% of the input
voltage range.
2. Respect the input common mode voltage through the following equations (where VCM_IN is the Input channel
common mode voltage) for all VIN:
– VCM_IN < 0.7*VDDANA + VREF/4 – 0.75V
– VCM_IN > VREF/4 – 0.3*VDDANA - 0.1V
3. The ADC channels on pins PA08, PA09, PA10, and PA11 are powered from the VDDIO power supply. The ADC
performance of these pins will not be the same as all the other ADC channels on pins powered from the
VDDANA power supply.
4. The gain accuracy represents the gain error expressed in percent. Gain accuracy (%) = (Gain Error in V x
100) / (VREF/GAIN).
Note:
1. These values are based on specifications otherwise noted.
2. These values are based on characterization. These values are not covered by test limits in production.
Table 40-31. Clock and Timing (1)
Note:
1. These values are based on simulation. These values are not covered by test limits in production or
characterization.
Table 40-32. Accuracy Characteristics(1) (Device Variant A)
Note:
1. All values measured using a conversion rate of 350ksps.
...........continued
Symbol Parameter Conditions Min. Typ. Max.
tSTARTUP Startup time Enable to ready delay - 1 3
Fast mode
Note:
1. According to the standard equation V(X)=VLSB*(X+1); VLSB=VDDANA/64
2. Data computed with the Best Fit method.
3. Data computed using histogram.
Note: With on this flash technology, a max number of 8 consecutive write is allowed per row. Once this number is
reached, a row erase is mandatory.
Table 40-39. Flash Endurance and Data Retention (Device Variant A)
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
RetNVM100 Retention after up to 100 Average ambient 55°C 25 >100 - Years
CycNVM Cycling Endurance(1) -40°C < Ta < 125°C 10K - - Cycles
Note:
1. An endurance cycle is a write and an erase operation.
Table 40-40. Flash Endurance and Data Retention (Device Variant B and D)
Note:
1. An endurance cycle is a write and an erase operation.
Table 40-41. EEPROM Emulation(1) Endurance and Data Retention (Device Variant A)
Table 40-42. EEPROM Emulation(1) Endurance and Data Retention (Device Variant B and D)
Note:
1. The EEPROM emulation is a software emulation described in the Application Note AT03265: SAM
D10/D11/D20/D21/R/L/C EEPROM Emulator (EEPROM) Service.
2. An endurance cycle is a write and an erase operation.
Table 40-43. NVM Characteristics
...........continued
Symbol Parameter Conditions Min. Typ. Max. Units
IXOSC Current consumption f = 2MHz, CL=20 pF XOSC.GAIN=0, AGC off - 65 240 uA
f = 2MHz, CL=20 pF XOSC.GAIN=0, AGC on - 52 240
f = 4MHz, CL=20 pF XOSC.GAIN=1, AGC off - 117 309
f = 4MHz, CL=20 pF XOSC.GAIN=1, AGC on - 74 281
f = 8MHz, CL=20 pF XOSC.GAIN=2, AGC off - 226 435
f = 8MHz, CL=20 pF XOSC.GAIN=2, AGC on - 128 356
f = 16MHz, CL=20 pF XOSC.GAIN=3, AGC - 502 748
off
f = 16MHz, CL=20 pF XOSC.GAIN=3, AGC - 307 627
on
f = 32MHz, CL=18 pF XOSC.GAIN=4, AGC - 1622 2344
off
f = 32MHz, CL=18 pF XOSC.GAIN=4, AGC - 615 1422
on
tSTART Startup time f = 2MHz, CL=20 pF XOSC,GAIN=0, - 15.6K 51.0K Cycles
ESR=600 Ohms
f = 4MHz, CL=20 pF XOSC,GAIN=1, - 6.3K 20.1K
ESR=100 Ohms
f = 8MHz, CL=20 pF XOSC,GAIN=2, - 6.2K 20.3K
ESR=35 Ohms
f = 16MHz, CL=20 pF XOSC,GAIN=3, - 7.7K 21.2K
ESR=25 Ohms
f = 32MHz, CL=18 pF XOSC,GAIN=4, - 6.0K 14.2K
ESR=40 Ohms
...........continued
Symbol Parameter Conditions Min. Typ. Max Units
CL Crystal load capacitance - - - 12.5 pF
CSHUNT Crystal shunt capacitance - - 0.1 - pF
CXIN32 Parasitic capacitor load TQFP64/48/32 packages - 3.1 - pF
CXOUT32 Parasitic capacitor load - 3.3 - pF
IXOSC32K Current consumption - - 1.2 2.5 µA
ESR Crystal equivalent series resistance CL=12.5pF - - 141 kΩ
f=32.768kHz
Safety Factor = 3
Table 40-48. 32 kHz Crystal Oscillator Electrical Characteristics (Device Variant B and D)
IDFLL Power consumption on VDDIN DFLLVAL.COARSE = DFLL48M COARSE CAL - 403 457 µA
DFLLVAL.FINE = 512
IDFLL Power consumption on VDDIN DFLLVAL.COARSE = DFLL48M COARSE CAL - 403 457 µA
DFLLVAL.FINE = 512
Note: All parts are tested in production to be able to use the DFLL as main CPU clock whether in DFLL closed loop
mode with an external OSC reference or the internal OSC8M.
Note:
1. These values are based on simulation. These values are not covered by test limits in production or
characterization.
2. This oscillator is always on.
...........continued
Symbol Parameter Conditions Min. Typ. Max Units
IOSC8M Current consumption IDLE2 on OSC32K versus IDLE2 on calibrated OSC8M - 64 100 uA
enabled at 8MHz (FRANGE=1, PRESC=0)
tSTARTUP Startup time - - 2.4 3.9 us
Duty Duty Cycle - - 50 - %
Note:
1. All values have been characterized with FILTSEL[1/0] as default value.
PTC scan
Symbol Parameters Drift Calibration Oversamples Ta Typ. Max. Units
rate (msec)
IDD(2) Current Consumption Disabled 10 4 Max. 125°C 72 1151 µA
16 Typ. 25°C 84 1167
50 4 65 1148
16 68 1154
100 4 64 1148
16 65 1151
200 4 64 1151
16 64 1150
Enabled 10 4 77 1152
16 88 1181
50 4 67 1156
16 70 1160
100 4 66 1154
16 67 1158
200 4 65 1155
16 66 1157
PTC scan
Symbol Parameters Drift Calibration Oversamples Ta Typ. Max. Units
rate (msec)
IDD(2) Current Consumption Disabled 10 4 Max. 125°C 66 791 µA
16 Typ. 25°C 75 803
50 4 61 787
16 63 791
100 4 61 788
16 62 790
200 4 60 788
16 61 789
Enabled 10 4 71 802
16 80 813
50 4 63 792
16 65 795
100 4 62 791
16 63 793
200 4 62 790
16 63 791
Note:
1. These are based on characterization.
2. On this table, the LDO voltage regulator is enabled in Standby mode (SYSCTRL.VREG.RUNSTDBY = 1).
41.1 Disclaimer
All typical values are measured at T = 25°C unless otherwise specified. All minimum and maximum values are valid
across operating temperature and voltage unless otherwise specified.
1. Maximum source current is 46mA and maximum sink current is 65mA per cluster. A cluster is a group of
GPIOs as shown in the table below. Also note that each VDD/GND pair is connected to two clusters so current
consumption through the pair will be a sum of the clusters source/sink currents.
This device is sensitive to electrostatic discharges (ESD). Improper handling may lead to permanent
CAUTION
performance degradation or malfunctioning.
Handle the device following best practice ESD protection rules: Be aware that the human body can
accumulate charges large enough to impair functionality or destroy the device.
In debugger cold-plugging mode, NVM erase operations are not protected by the BOD33 and BOD12.
CAUTION
NVM erase operation at supply voltages below specified minimum can cause corruption of NVM areas that
are mandatory for correct device behavior.
Related Links
7.2.4 GPIO Clusters
7.2.4 GPIO Clusters
Voltage
Conditions Symbol Min. Max. Unit
VDDIO
Full Voltage Range VDDIN 2.7 3.63 V
VDDANA
Related Links
8. Power Supply and Start-Up Considerations
...........continued
Description Symbol Max. Unit
SERCOM0 input clock frequency fGCLK_SERCOM0_CORE 48 MHz
SERCOM1 input clock frequency fGCLK_SERCOM1_CORE 48 MHz
SERCOM2 input clock frequency fGCLK_SERCOM2_CORE 48 MHz
SERCOM3 input clock frequency fGCLK_SERCOM3_CORE 48 MHz
SERCOM4 input clock frequency fGCLK_SERCOM4_CORE 48 MHz
SERCOM5 input clock frequency fGCLK_SERCOM5_CORE 48 MHz
TCC0, TCC1 input clock frequency fGCLK_TCC0, GCLK_TCC1 96 MHz
TCC2,TC3 input clock frequency fGCLK_TCC2, GCLK_TC3 48 MHz
TC4, TC5 input clock frequency fGCLK_TC4, GCLK_TC5 96 MHz
TC6,TC7 input clock frequency fGCLK_TC6, GCLK_TC7 48 MHz
ADC input clock frequency fGCLK_ADC 48 MHz
AC digital input clock frequency fGCLK_AC_DIG 48 MHz
AC analog input clock frequency fGCLK_AC_ANA 64 kHz
DAC input clock frequency fGCLK_DAC 350 kHz
PTC input clock frequency fGCLK_PTC 48 MHz
I2S serial 0 input clock frequency fGCLK_I2S_0 13 MHz
I2S serial 1 input clock frequency fGCLK_I2S_1 13 MHz
...........continued
Mode Conditions TA VCC Typ. Max. Unit
25°C 3.3V 4.6 15.0
XOSC32K running
70°C 3.3V 23 96
RTC running at 1kHz
STANDBY(1) 105°C 3.3V 95.0 390.0
(Device Variant B / Die rev. F) μA
25°C 3.3V 3.4 14.0
XOSC32K and RTC stopped 70°C 3.3V 22 95
105°C 3.3V 94.0 388.0
XOSC32K running 25°C 3.3V 61.0 72.0
RTC running at 1kHz 70°C 3.3V 87 176
VDDIN
VDDANA
VDDIO
Amp 0
VDDCORE
Note: These values are based on simulation. These values are not covered by test limits in production or
characterization.
VOL = 0.4V
3
Standard, Fast and HS Modes
Output low-level current VOL = 0.4V IOL mA
20 - -
Fast Mode +
VOL = 0.6V 6 - -
SCL clock frequency fSCL - - 3.4 MHz
I2C pins timing characteristics can be found in the SERCOM in I2C Mode Timing section.
Table 41-14. I2C Pins Characteristics in I/O Configuration
...........continued
Parameter Conditions Symbol Min. Typ. Max. Unit
VDD = 2.7V-3V,
PORT.PINCFG.
- - 1
DRVSTR=0
VDD = 3V-3.63V,
PORT.PINCFG.
- - 2.5
DRVSTR=0
Output low-level current IOL
VDD = 2.7V-3V,
PORT.PINCFG.
- - 3
DRVSTR=1
VDD = 3V-3.63V,
PORT.PINCFG.
- - 10
DRVSTR=1
mA
VDD = 2.7V-3V,
PORT.PINCFG.
- - 0.70
DRVSTR=0
VDD = 3V-3.63V,
PORT.PINCFG.
- - 2
DRVSTR=0
Output high-level current IOH
VDD = 2.7V-3V,
PORT.PINCFG.
- - 2
DRVSTR=1
VDD = 3V-3.63V,
PORT.PINCFG.
- - 7
DRVSTR=1
load = 20pF,
VDD = 3.3V
15
PORT.PINCFG.
Rise time DRVSTR=1 tRISE ns
load = 5pF, VDD = 3.3V
PORT.PINCFG. 15
DRVSTR=0
load = 20pF,
VDD = 3.3V
15
PORT.PINCFG.
Fall time DRVSTR=1 tFALL ns
load = 5pF, VDD = 3.3V
PORT.PINCFG. 15
DRVSTR=0
Input leakage current Pull-up resistors disabled ILEAK -1 0.015 1 μA
Related Links
Note: Supplying any external components using VDDCORE pin is not allowed to assure the integrity of the core
supply voltage.
Table 41-18. Decoupling Requirements
VDD
VPOT+
VPOT-
Time
Reset
41.10.3.1 BOD33
Table 41-20. BOD33 LEVEL Value
Note: Refer to NVM User Row Mapping for the BOD33 default value settings.
Figure 41-3. BOD33 Hysteresis OFF
VCC
VBOD
RESET
VCC VBOD+
VBOD-
RESET
Note: 1.These values are based on simulation, and are not covered by test limits in production or characterization.
Table 41-22. BOD33 Power Consumption
Related Links
10.3.1 NVM User Row Mapping
...........continued
Parameter Conditions Symbol Min. Typ. Max. Unit
Conversion time(1) 1x Gain - 6 - - cycles
Voltage reference range - VREF 1.0 - VDDANA – 0.6 V
Internal 1V reference(2, 4) - VREFINT 1V - 1 - V
Internal ratiometric reference 0(2) - VREFINT VCC0 - VDDANA/1.48 - V
Internal ratiometric reference 0(2) VREFINT VCC0 Voltage
2.0V < VDDANA<3.63V -1 - 1 %
error Error
Internal ratiometric reference 1(2) VDDANA > 2.0V VREFINT VCC1 - VDDANA/2 - V
Internal ratiometric reference 1(2) V V Voltage
2.0V < VDDANA < 3.63V REFINT CC1 –1 - 1 %
error Error
Conversion range(1) Differential mode –VREF/GAIN - +VREF/GAIN V
Single-ended mode 0 - +VREF/GAIN V
Sampling capacitance (2) - CSAMPLE - 3.5 - pF
Input channel source
- RSAMPLE - - 3.5 kΩ
resistance(2)
DC supply current(1) fCLK_ADC = 2.1 MHz(3) IDD - 2.9 4.1 mA
Note:
1. These values are based on characterization, and are not covered by test limits in production.
2. These values are based on simulation, and are not covered by test limits in production or characterization.
3. In this condition and for a sample rate of 350 ksps, 1 conversion at gain 1x takes 6 clock cycles of the ADC
clock.
4. It is the buffered internal reference of 1.0V derived from the internal 1.1V bandgap reference.
Table 41-24. Differential Mode
...........continued
Parameter Conditions Symbol Min. Typ. Max. Unit
Spurious Free Dynamic Range 1x Gain SFDR 65 71.5 76 dB
Signal-to-Noise and Distortion FCLK_ADC = 2.1 MHz SINAD 58 65 67 dB
Signal-to-Noise Ratio FIN = 40 kHz SNR 60 66 68.6 dB
AIN = 95% FSR
Total Harmonic Distortion THD –75 –71 –67 dB
Noise RMS T = 25°C 0.6 1 2.5 mV
Note:
1. Maximum numbers are based on characterization and not tested in production, and valid for 5% to 95% of the
input voltage range.
2. Dynamic parameter numbers are based on characterization and not tested in production.
3. Respect the Input Common mode voltage through the following equations (where, VCM_IN is the Input
Channel Common mode voltage):
If |VIN| > VREF/4
VCM_IN < 0.95 × VDDANA + VREF/4 – 0.75V
VCM_IN > VREF/4 -0.05 × VDDANA – 0.1V
If |VIN| < VREF/4
VCM_IN < 1.2 × VDDANA – 0.75V
VCM_IN > 0.2 × VDDANA – 0.1V
4. The ADC channels on the pins, PA08, PA09, PA10, PA11, are powered from the VDDIO power supply. The
ADC performance of these pins will not be the same as all the other ADC channels on pins powered from the
VDDANA power supply.
5. The gain accuracy represents the gain error expressed in percent.
Gain accuracy (%) = (Gain Error in V × 100) / (2 × Vref/GAIN)
Table 41-25. Single-Ended Mode
Note:
1. Maximum numbers are based on characterization and not tested in production, and for 5% to 95% of the input
voltage range.
2. Respect the input common mode voltage through the following equations, where VCM_IN is the Input Channel
Common mode voltage for all VIN:
VCM_IN < 0.7 × VDDANA + VREF/4 – 0.75V
VCM_IN > VREF/4 – 0.3 × VDDANA – 0.1V
3. The ADC channels on the pins, PA08, PA09, PA10, PA11, are powered from the VDDIO power supply. The
ADC performance of these pins will not be the same as all the other ADC channels on pins powered from the
VDDANA power supply.
4. The gain accuracy represents the gain error expressed in percent.
Gain accuracy (%) = (Gain Error in V × 100) / (Vref/GAIN).
Average Number Conditions SNR (dB) SINAD (dB) SFDR (dB) ENOB (bits)
1 66.0 65.0 72.8 10.5
8 In differential mode, 1x gain, 67.6 65.8 75.1 10.62
32 VDDANA = 3.0V, VREF = 1.0V, 350kSps at 25°C 69.7 67.1 75.3 10.85
128 70.4 67.5 75.5 10.91
VDDANA/2
Analog Input
AINx CSAMPLE
RSOURCE RSAMPLE
VIN
To achieve n bits of accuracy, the �SAMPLE capacitor must be charged at least to a voltage of
�CSAMPLE ≥ �IN × 1 + − 2− � + 1
The minimum sampling time �SAMPLEHOLD for a given �SOURCEcan be found using this formula:
where
1
�SAMPLEHOLD =
2 × �ADC
...........continued
Parameter Conditions Min. Typ. Max. Unit
VDDNA > 2.6V - - 2.85 μs
Startup time
VDDNA < 2.6V - - 10 μs
1. These values are based on simulation. These values are not covered by test limits in production or
characterization.
Table 41-30. Accuracy Characteristics(1)
...........continued
Parameter Conditions Symbol Min. Typ. Max. Unit
Hysteresis = 1, Fast mode 8 50 102 mV
Hysteresis
Hysteresis = 1, Low-power mode 14 50 75 mV
Changes for VACM = VDDANA/2
90 180 ns
100mV overdrive, Fast mode
Propagation delay
Changes for VACM = VDDANA/2
302 534 ns
100mV overdrive, Low-power mode
Enable to ready delay
1 2 μs
Fast mode
Start-up time tSTARTUP
Enable to ready delay
- 14 23 μs
Low-power mode
INL(3) –1.4 0.201 1.4 LSB
DNL(3) –0.9 0.022 0.9 LSB
VSCALE
Offset Error (1)(2) –0.2 0.056 0.92 LSB
Gain Error (1)(2) –0.89 0.079 0.89 LSB
Over voltage at
1.08 1.1 1.11 V
25°C
Note that on this flash technology, a max number of 8 consecutive write is allowed per row. Once this number is
reached, a row erase is mandatory.
The EEPROM emulation is a software emulation described in the App note AT03265. An endurance cycle is a write
and an erase operation.
Table 41-36. NVM Characteristics
f = 2 MHz,
CL = 20pF - - 330
XOSC.GAIN = 0
f = 4 MHz,
Crystal Equivalent Series Resistance CL = 20pF - - 240
XOSC.GAIN = 1
Safety Factor = 3 ESR Ω
f = 8 MHz,
The AGC does not have any noticeable impact on these
measurements. CL = 20pF - - 105
XOSC.GAIN = 2
f = 16 MHz,
CL = 20pF - - 60
XOSC.GAIN = 3
f = 32 MHz,
CL = 18pF - - 55
XOSC.GAIN = 4
f = 4 MHz,
CL = 20pF,
- 6.3K 20.1K
XOSC.GAIN = 1,
ESR = 100Ω
f = 8 MHz,
CL = 20pF,
- 6.2K 20.3K
Startup time tSTARTUP cycles
XOSC.GAIN = 2,
ESR = 35Ω
f = 16 MHz,
CL = 20pF,
- 7.7K 21.2K
XOSC.GAIN = 3,
ESR = 25Ω
f = 32 MHz,
CL = 18pF,
- 6.0K 14.2K
XOSC.GAIN = 4,
ESR = 40Ω
f = 2 MHz,
CL = 20pF,
- 82 187
XOSC.GAIN = 0,
AGC on
f = 4 MHz,
CL = 20pF,
Current Consumption - 140 256 μA
XOSC.GAIN = 1,
AGC off
f = 4 MHz,
CL = 20pF,
- 102 219
XOSC.GAIN = 1,
AGC on
f = 8 MHz,
CL = 20pF,
- 243 380
XOSC.GAIN = 2,
AGC off
...........continued
Parameter Conditions Symbol Min. Typ. Max. Unit
f = 8 MHz,
CL = 20pF,
- 166 299
XOSC.GAIN = 2,
AGC on
f = 16 MHz,
CL = 20pF,
- 493 685
XOSC.GAIN = 3,
AGC off
f = 16 MHz,
CL = 20pF,
Current Consumption - 293 480 μA
XOSC.GAIN = 3,
AGC on
f = 32 MHz,
CL = 18pF,
- 1343 1975
XOSC.GAIN = 4,
AGC off
f = 32 MHz,
CL = 18pF,
- 555 776
XOSC.GAIN = 4,
AGC on
C LEXT Xin
Crystal
LM
C SHUNT
RM
C STRAY
CM
Xout
C LEXT
...........continued
Parameter Conditions Symbol Min. Typ. Max. Unit
DFLLVAL.COARSE = DFLL48M COARSE CAL
Power consumption on VDDIN IDFLL - 403 453 μA
DFLLVAL.FINE = 512
Power consumption on VDDIN fREF = XTAL, 32.768kHz, 100ppm IDFLL - 403 453 μA
Note:
1. All parts are tested in production to be able to use the DFLL as main CPU clock whether in DFLL closed loop
mode with an external OSC reference or the internal OSC8M.
2. To ensure that the device stays within the maximum allowed clock frequency, any reference clock for DFLL in
close loop must be within a 2% error accuracy.
at VDD = 3.3V
1. These values are based on simulation. These values are not covered by test limits in production or
characterization.
...........continued
Parameter Conditions Symbol Min. Typ. Max. Unit
After startup, time to get lock signal.
fIN = 32kHz, fOUT = 96MHz - 1 2 ms
Lock Time tLOCK
fIN = 2MHz, fOUT = 96MHz - 25 50 μs
Duty cycle Duty 40 50 60 %
140
120
100
80
Scan rate 10ms
60 Scan rate 50ms
0
1 2 4 8 16 32 64
Sample averaging
200
180
160
140
120
Scan rate 10ms
100
80 Scan rate 50ms
60 Scan rate 100ms
40 Scan rate 200ms
20
0
1 2 4 8 16 32 64
Sample averaging
1200
1000
800
Scan rate 10ms
600
Scan rate 50ms
400 Scan rate 100ms
Scan rate 200ms
200
Linear (Scan rate 50ms)
0
1 2 4 8 16 32 64
Sample averaging
900
800
700
600
500 Scan rate 10ms
400 Scan rate 50ms
300 Scan rate 100ms
200
Scan rate 200ms
100
0
1 2 4 8 16 32 64
Sample averaging
5000
4500
4000
3500
3000
Scan rate 10ms
2500
2000 Scan rate 50ms
1500 Scan rate 100ms
1000 Scan rate 200ms
500
0
1 2 4 8 16 32 64
Sample averaging
1800
1600
1400
1200
1000 Scan rate 10ms
800 Scan rate 50ms
600 Scan rate 100ms
400
Scan rate 200ms
200
0
1 2 4 8 16 32 64
Sample averaging
80 %
70 %
60 %
50 %
Channel count 1
40 %
Channel count 10
30 %
Channel count 100
20 %
10 %
0%
10 50 100 200
1 2 4 8 16 32 64
Sample Averaging
1 2 4 8 16 32 64
Sample Averaging
1 2 4 8 16 32 64
Sample Averaging
1 2 4 8 16 32 64
Sample Averaging
1 2 4 8 16 32 64
Sample Averaging
1 2 4 8 16 32 64
Sample Averaging
Note:
1. Capacitance load that the PTC circuitry can compensate for each channel.
Note:
1. Analog Gain is a parameter of the QTouch Library. Refer to the QTouch Library Peripheral Touch Controller
User Guide.
2. GAIN_16 and GAIN_32 settings are not recommended, otherwise the PTC measurements might get unstable.
The values in the Power Consumption table below are measured values of power consumption under the following
conditions:
Operating conditions
VDD = 3.3 V
Clocks
OSC8M used as main clock source, running undivided at 8MHz
CPU is running on flash with 0 wait states, at 8MHz
PTC running at 4MHz
PTC configuration
Mutual-capacitance mode
One touch channel
System configuration
Standby sleep mode enabled
RTC running on OSCULP32K: used to define the PTC scan rate, through the event system
Drift Calibration disabled: no interrupts, PTC scans are performed in standby mode
Drift Calibration enabled: RTC interrupts (wakeup) the CPU to perform PTC scans. PTC drift calibration is performed
every 1.5 sec.
Table 41-50.
...........continued
Clock setup USB Device USB Host
FDPLL96M Any internal OSC source (32K, 8M, ... ) No No
Any external XOSC source (< 1MHz) Yes No
Any external XOSC source (> 1MHz) Yes(3) Yes
Notes: 1. When using DFLL48M in USB recovery mode, the Fine Step value must be Ah to guarantee a USB clock at
+/-0.25% before 11ms after a resume.
2. Very high signal quality and crystal less. It is the best setup for USB Device mode.
3. FDPLL lock time is short when the clock frequency source is high (> 1MHz). Thus, FDPLL and external OSC can
be stopped during USB suspend mode to reduce consumption and guarantee a USB wake-up time (See TDRSMDN
in USB specification).
SS
SCK
(CPOL = 0)
tSCKW
SCK
(CPOL = 1)
tSCKW
tMIS tMIH tSCK
MISO
MSB LSB
(Data Input)
tMOH tMOH
MOSI
MSB LSB
(Data Output)
SS
SCK
(CPOL = 0)
tSSCKW
SCK
(CPOL = 1)
tSSCKW
tSIS tSIH tSSCK
MOSI
MSB LSB
(Data Input)
MISO
MSB LSB
(Data Output)
1. These values are based on simulation. These values are not covered by test limits in production.
2. See 41.8 I/O Pin Characteristics.
tLOW tLOW
SCL
tSU;STA tHD;STA tHD;DAT tSU;DAT
tSU;STO
SDA
tBUF
1. These values are based on simulation. These values are not covered by test limits in production.
2. Cb = Capacitive load on each bus line. Otherwise noted, value of Cb set to 20pF.
SWDIO pin to
Tri State Acknowledge Tri State
debugger
Write Cycle
From debugger to
Stop Park Tri State Start
SWDIO pin
Tis Tih
From debugger to
SWDCLK pin
SWDIO pin to
Tri State Acknowledge Data Data Parity Tri State
debugger
Note: 1. These values are based on simulation. These values are not covered by test limits in production or
characterization.
MCK output
tM_SCKOR tM_SCKOF
SCK output
tM_FSOH tM_SCKO
tM_SDOH
tM_SDIS tM_SDIH tM_FSOV
FS output
tM_SDOV
SD input
Figure 41-25. I2S Timing Slave Mode Slave mode: SCK and FS are input
tS_FSIH
SCK input
tS_FSIS tS_SCKI
tS_SDOH
tS_SDIS tS_SDIH
FS input
tS_SDOV
SD input
SCK input
...........continued
Name Description Mode VDD=1.8V VDD=3.3V Units
Min. Typ. Max Min. Typ. Max.
tS_FSIH FS hold time Slave mode 0 0 ns
tM_SDIS Data input setup time Master mode 34.7 24.5 ns
tM_SDIH Data input hold time Master mode -8.2 -8.2 ns
tS_SDIS Data input setup time Slave mode 4.6 3.9 ns
tS_SDIH Data input hold time Slave mode 1.2 1.2 ns
tM_SDOV Data output valid time Master transmitter 5.6 4.8 ns
tM_SDOH Data output hold time Master transmitter -0.5 -0.5 ns
tS_SDOV Data output valid time Slave transmitter 36.2 25.9 ns
tS_SDOH Data output hold time Slave transmitter 36 25.7 ns
tPDM2LS Data input setup time Master mode PDM2 Left 34.7 24.5 ns
tPDM2LH Data input hold time Master mode PDM2 Left -8.2 -8.2 ns
tPDM2RS Data input setup time Master mode PDM2 Right 30.5 20.9 ns
tPDM2RH Data input hold time Master mode PDM2 Right -6.7 -6.7 ns
...........continued
Name Description Mode VDD=1.8V VDD=3.3V Units
Min. Typ. Max. Min. Typ. Max.
tS_FSIS FS setup time Slave mode 6 5.3 ns
tS_FSIH FS hold time Slave mode 0 0 ns
tM_SDIS Data input setup time Master mode 36 25.9 ns
tM_SDIH Data input hold time Master mode -8.2 -8.2 ns
tS_SDIS Data input setup time Slave mode 9.1 8.3 ns
tS_SDIH Data input hold time Slave mode 3.8 3.7 ns
tM_SDOV Data output valid time Master transmitter 2.5 1.9 ns
tM_SDOH Data output hold time Master transmitter -0.1 -0.1 ns
tS_SDOV Data output valid time Slave transmitter 29.8 19.7 ns
tS_SDOH Data output hold time Slave transmitter 29.1 18.9 ns
tPDM2LS Data input setup time Master mode PDM2 Left 35.5 25.3 ns
tPDM2LH Data input hold time Master mode PDM2 Left -8.2 -8.2 ns
tPDM2RS Data input setup time Master mode PDM2 Right 30.6 21.1 ns
tPDM2RH Data input hold time Master mode PDM2 Right -7 -7 ns
42. Appendix A
Ordering Code FLASH (bytes) SRAM (bytes) Temperature Grade Package Carrier Type
ATSAMD21J18A-AU-SLL 256K 32K -40°C to 85°C TQFP64 Tray
ATSAMD21J18A-MU-SLL 256K 32K -40°C to 85°C QFN64 Tray
Ordering Code FLASH (bytes) SRAM (bytes) Temperature Grade Package Carrier Type
ATSAMD21G18A-AU-SLL 256K 32K -40°C to 85°C TQFP48 Tray
ATSAMD21G18A-MU-SLL 256K 32K -40°C to 85°C QFN48 Tray
Ordering Code FLASH(bytes) SRAM (bytes) Temperature Grade Package Carrier Type
ATSAMD21E18A-AU-SLL 256K 32K -40°C to 85°C TQFP32 Tray
ATSAMD21E18A-MU-SLL 256K 32K -40°C to 85°C QFN32 Tray
ATSAMD21E17D-MUT-SLL 128K 16K -40°C to 85°C QFN32 Tape & Reel
ATSAMD21E16B-MU-SLL 64K 8K -40°C to 85°C QFN32 Tray
ATSAMD21E16B-MUT-SLL 64K 8K -40°C to 85°C QFN32 Tape & Reel
300 mg
Note: The exposed die attach pad is not connected electrically inside the device.
Table 43-4. Device and Package Maximum Weight
200 mg
200 mg
Note: For the most current package drawings, please see the Microchip Packaging Specification located at http://
www.microchip.com/packaging.
27.4 mg
140 mg
Note: The exposed die attach pad is not connected electrically inside the device.
140 mg
140 mg
Note: For the most current package drawings, please see the Microchip Packaging Specification located at http://
www.microchip.com/packaging.
7.3 mg
100 mg
Note: The exposed die attach pad is connected inside the device to GND and GNDANA.
Table 43-28. Device and Package Maximum Weight
90 mg
90 mg
Note: For the most current package drawings, please see the Microchip Packaging Specification located at http://
www.microchip.com/packaging.
35-Ball Wafer Level Chip Scale Package (FQB) - 2.821x2.529 mm Body [WLCSP]
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
D A
NOTE 1 B
1 2 3 4 5 6
C
E
D
(DATUM B)
E
(DATUM A)
2X F
0.03 C
2X
TOP VIEW
0.03 C
SEE DETAIL A
C
A
SEATING
PLANE
SIDE VIEW
D1
1 2 3 4 5 6
e
E 2
D
E1
C
NOTE 1
35X Øb
0.15 C A B
e 0.05 C
BOTTOM VIEW
35-Ball Wafer Level Chip Scale Package (FQB) - 2.821x2.529 mm Body [WLCSP]
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
(A3)
0.10 C
A2
A1
35X
0.075 C
DETAIL A
Units MILLIMETERS
Dimension Limits MIN NOM MAX
Number of Terminals N 35
Pitch e 0.40 BSC
Overall Height A - - 0.483
Bump Height A1 0.17 0.20 0.23
Die Thickness A2 0.178 0.203 0.228
Backside Coating A3 0.04 REF
Overall Length D 2.529 BSC
Overall Bump Pitch D1 2.00 BSC
Overall Width E 2.821 BSC
Overall Bump Pitch E1 2.00 BSC
Terminal Width b 0.23 0.26 0.29
Notes:
1. Pin 1 visual index feature may vary, but must be located within the hatched area.
2. Package is saw singulated
3. Dimensioning and tolerancing per ASME Y14.5M
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
REF: Reference Dimension, usually without tolerance, for information purposes only.
35-Ball Wafer Level Chip Scale Package (FQB) - 2.821x2.529 mm Body [WLCSP]
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
1 2 3 4 5 6
B
ØX
C1
D
E
E
E
SILK SCREEN C2
Units MILLIMETERS
Dimension Limits MIN NOM MAX
Contact Pitch E 0.40 BSC
Contact Pad Spacing C1 2.00 BSC
Contact Pad Spacing C2 2.00 BSC
Contact Pad Diameter (X35) X 0.26
Notes:
1. Dimensioning and tolerancing per ASME Y14.5M
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
6.22 mg
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
35X
0.05 C
0.06 C
D A B
NOTE 1
1 2 3 4 5 6
C
E
D
(DATUM B)
E
(DATUM A)
F
2X
0.03 C
2X TOP VIEW A1
0.03 C
A3
eD A2
e A
2
SEATING
C
PLANE
SIDE VIEW
F
E e
2
D
eE
C
1 2 3 4 5 6
35X Øb
e 0.015 C A B
BOTTOM VIEW
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
Units MILLIMETERS
Dimension Limits MIN NOM MAX
Number of Terminals N 35
Pitch e 0.40 BSC
Overall Height A 0.403 0.443 0.483
Ball Height A1 0.17 0.20 0.23
Die Thickness A2 0.178 0.203 0.228
Film Thickness A3 0.036 0.040 0.044
Overall Length D 2.831 BSC
Overall Pitch eD 2.00 BSC
Overall Width E 2.916 BSC
Overall Pitch eE 2.00 BSC
Ball Diameter b 0.24 0.27 0.30
Notes:
1. Pin 1 visual index feature may vary, but must be located within the hatched area.
2. Package is saw singulated
3. Dimensioning and tolerancing per ASME Y14.5M
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
REF: Reference Dimension, usually without tolerance, for information purposes only.
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
C1
1 2 3 4 5 6
C2
D
ØX
SILK SCREEN
E
Notes:
1. Dimensioning and tolerancing per ASME Y14.5M
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
Where:
• “YY”: Manufacturing year
• “WW”: Manufacturing week
• “R”: Internal Code
• “XXXXXX”: Lot number
44.1 Introduction
This chapter describes a common checklist which should be used when starting and reviewing the schematics for a
SAM D21 design. This chapter illustrates a recommended power supply connection, how to connect external analog
references, programmer, debugger, oscillator and crystal.
VDDANA
10µF 100nF
GNDANA
VDDIO
100nF
VDDIN
100nF
VDDCORE
10µF
1µF
GND
Note: 1. It is recommended to use a ceramic or solid tantalum capacitor with low ESR. Refer to table 37-18 in
37.11.1 Voltage Regulator Characteristics for additional details on ESR.
Table 44-1. Power Supply Connections, VDDCORE From Internal Regulator
...........continued
Signal Name Recommended Pin Connection Description
VDDANA 1.62V - 3.63V Analog supply voltage
Decoupling/filtering capacitors 100nF(1)(2) and 10μF(1)
Ferrite bead(4) prevents the VDD noise interfering the VDDANA
Note:
1. These values are only given as typical examples.
2. Decoupling capacitor should be placed close to the device for each supply pin pair in the signal group, low
ESR caps should be used for better decoupling.
3. An inductor should be added between the external power and the VDD for power filtering.
4. Ferrite bead has better filtering performance than the common inductor at high frequencies. It can be added
between VDD and VDDANA for preventing digital noise from entering the analog power domain. The bead
should provide enough impedance (e.g. 50Ω at 20MHz and 220Ω at 100MHz) for separating the digital power
from the analog power domain. Make sure to select a ferrite bead designed for filtering applications with a low
DC resistance to avoid a large voltage drop across the ferrite bead.
AREFA
EXTERNAL
4.7µF 100nF
REFERENCE 1 GND
AREFB
EXTERNAL
4.7µF 100nF
REFERENCE 2 GND
AREFA
EXTERNAL
4.7µF 100nF
REFERENCE GND
AREFB
100nF
GND
VDD
10k Ω
RESET
330Ω
100nF
GND
VDD
2.2kΩ 100pF
330Ω RESET
GND
Note: This reset circuit is intended to improve EFT immunity, but does not filter low-frequency glitches, which makes
it not suitable as an example for applications requiring debouncing on a reset button.
Table 44-3. Reset Circuit Connections
2. The SAM D21 features an internal pull-up resistor on the RESET pin, hence an external pull-up is optional.
XOUT/GPIO
NC/GPIO
XIN
CLEXT
XOUT
CLEXT
The crystal should be located as close to the device as possible. Long signal lines may cause a load too high to
operate the crystal, and cause crosstalk to other parts of the system.
Table 44-5. Crystal Oscillator Checklist
The SAM D21 oscillator is optimized for very-low-power consumption, so pay close attention when selecting crystals.
See the table below for maximum ESR recommendations on 9pF and 12.5pF crystals.
The low-frequency crystal oscillator provides an internal load capacitance of typical values available in Table , 32 kHz
Crystal Oscillator Characteristics. This internal load capacitance and PCB capacitance can use a crystal inferior to
12.5pF load capacitance without external capacitors as shown in the following figure.
Table 44-6. Maximum ESR Recommendation for 32.768 kHz Crystal
Note: Maximum ESR is typical value based on characterization. These values are not covered by test limits in
production.
Figure 44-8. External Real Time Oscillator without Load Capacitor
XIN32
32.768kHz XOUT32
However, to improve crystal accuracy and safety factor, the data sheet recommends adding external capacitors as
shown in the next figure.
To find suitable load capacitance for a 32.768 kHz crystal, consult the crystal data sheet.
Figure 44-9. External Real Time Oscillator with Load Capacitor
CLEXT XIN32
32.768kHz XOUT32
CLEXT
1kΩ
SWCLK
Related Links
44.1.1 Operation in Noisy Environment
VDD
Cortex Debug Connector
(10-pin)
VTref SWDIO
1
GND SWDCLK RESET
GND NC
NC NC SWCLK
NC nRESET
SWDIO
GND
SWDCLK 1
GND
NC VTG RESET
SWDIO RESET
NC NC SWCLK
NC NC
SWDIO
GND
VDD
20-pin IDC JTAG Connector
VCC NC
1
NC GND RESET
NC GND
SWDIO GND SWCLK
SWDCLK GND
NC GND SWDIO
NC GND*
nRESET GND* GND
NC GND*
NC GND*
GND (Board)
It is recommended to increase ESD protection on the USB D+, D-, and VBUS lines using dedicated transient
suppressors. These protections should be located as close as possible to the USB connector to reduce the potential
discharge path and reduce discharge propagation within the entire system.
The USB FS cable includes a dedicated shield wire that should be connected to the board with caution. Special
attention should be paid to the connection between the board ground plane and the shield from the USB connector
and the cable.
Tying the shield directly to ground would create a direct path from the ground plane to the shield, turning the USB
cable into an antenna. To limit the USB cable antenna effect, it is recommended to connect the shield and ground
through an RC filter.
Figure 44-15. Protected USB Interface Example Schematic
USB Transient
VBUS
protection
USB
Connector USB
Differential
Data Line Pair USB_D+
VBUS
D+
D-
GND
USB_D-
4.5nF
Shield
1MO
RC Filter
(GND/Shield
Connection) GND (Board)
45. Conventions
Symbol Description
165 Decimal number
0b0101 Binary number (example 0b0101 = 5 decimal)
'0101' Binary numbers are given without prefix if unambiguous
0x3B24 Hexadecimal number
X Represents an unknown or don't care value
Z Represents a high-impedance (floating) state for either a
signal or a bus
Symbol Description
KB (kbyte) kilobyte (210 = 1024)
MB (Mbyte) megabyte (220 = 1024*1024)
GB (Gbyte) gigabyte (230 = 1024*1024*1024)
b bit (binary '0' or '1')
B byte (8 bits)
1kbit/s 1,000 bit/s rate (not 1,024 bit/s)
1Mbit/s 1,000,000 bit/s rate
1Gbit/s 1,000,000,000 bit/s rate
word 32 bit
half-word 16 bit
Symbol Description
kHz 1 kHz = 103 Hz = 1,000 Hz
KHz 1 KHz = 1,024 Hz, 32 KHz = 32,768 Hz
MHz 1 MHz = 106 Hz = 1,000,000 Hz
GHz 1 GHz = 109 Hz = 1,000,000,000 Hz
s second
...........continued
Symbol Description
ms millisecond
µs microsecond
ns nanosecond
Symbol Description
R/W Read/Write accessible register bit. The user can read from and write to this bit.
R Read-only accessible register bit. The user can only read this bit. Writes will be ignored.
W Write-only accessible register bit. The user can only write this bit. Reading this bit will return an
undefined value.
BIT Bit names are shown in uppercase. (Example ENABLE)
FIELD[n:m] A set of bits from bit n down to m. (Example: PINA[3:0] = {PINA3, PINA2, PINA1, PINA0}
Reserved Reserved bits are unused and reserved for future use. For compatibility with future devices,
always write reserved bits to zero when the register is written. Reserved bits will always return
zero when read.
Reserved bit field values must not be written to a bit field. A reserved value will not be read from
a read-only bit field.
PERIPHERALi If several instances of a peripheral exist, the peripheral name is followed by a number to indicate
the number of the instance in the range 0-n. PERIPHERAL0 denotes one specific instance.
Reset Value of a register after a power Reset. This is also the value of registers in a peripheral after
performing a software Reset of the peripheral, except for the Debug Control registers.
SET/CLR Registers with SET/CLR suffix allows the user to clear and set bits in a register without doing a
read-modify-write operation. These registers always come in pairs. Writing a ‘1’ to a bit in the
CLR register will clear the corresponding bit in both registers, while writing a ‘1’ to a bit in the
SET register will set the corresponding bit in both registers. Both registers will return the same
value when read. If both registers are written simultaneously, the write to the CLR register will
take precedence.
Abbreviation Description
AC Analog Comparator
ADC Analog-to-Digital Converter
ADDR Address
AES Advanced Encryption Standard
AHB Advanced High-performance Bus
AMBA® Advanced Microcontroller Bus Architecture
APB AMBA Advanced Peripheral Bus
AREF Analog reference voltage
BLB Boot Lock Bit
BOD Brown-out Detector
CAL Calibration
CC Compare/Capture
CCL Configurable Custom Logic
CLK Clock
CRC Cyclic Redundancy Check
CTRL Control
DAC Digital-to-Analog Converter
DAP Debug Access Port
DFLL Digital Frequency Locked Loop
DPLL Digital Phase Locked Loop
DMAC DMA (Direct Memory Access) Controller
DSU Device Service Unit
EEPROM Electrically Erasable Programmable Read-Only Memory
EIC External Interrupt Controller
EVSYS Event System
FDPLL Fractional Digital Phase Locked Loop, also DPLL
GCLK Generic Clock Controller
GND Ground
GPIO General Purpose Input/Output
I2C Inter-Integrated Circuit
IF Interrupt flag
INT Interrupt
...........continued
Abbreviation Description
MBIST Memory built-in self-test
MEM-AP Memory Access Port
MTB Micro Trace Buffer
NMI Non-maskable interrupt
NVIC Nested Vector Interrupt Controller
NVM Non-Volatile Memory
NVMCTRL Non-Volatile Memory Controller
OSC Oscillator
PAC Peripheral Access Controller
PC Program Counter
PER Period
PM Power Manager
POR Power-on reset
PORT I/O Pin Controller
PTC Peripheral Touch Controller
PWM Pulse Width Modulation
RAM Random-Access Memory
REF Reference
RTC Real-Time Counter
RX Receiver/Receive
SEEP SmartEEPROM Page
SERCOM Serial Communication Interface
SMBus™ System Management Bus
SP Stack Pointer
SPI Serial Peripheral Interface
SRAM Static Random-Access Memory
SUPC Supply Controller
SWD Serial Wire Debug
TC Timer/Counter
TCC Timer/Counter for Control Applications
TRNG True Random Number Generator
TX Transmitter/Transmit
ULP Ultra low-power
USART Universal Synchronous and Asynchronous Serial Receiver and Transmitter
USB Universal Serial Bus
...........continued
Abbreviation Description
VDD Common voltage to be applied to VDDIO, VDDIN and VDDANA
VDDIN Digital supply voltage
VDDIO Digital supply voltage
VDDANA Analog supply voltage
VREF Voltage reference
WDT Watchdog Timer
XOSC Crystal Oscillator
Section Description
Appendix A Added a new appendix SIL 2 Enabled Functional Safety Devices
Packaging Information Added ‘35-ball WLCSP (Device variant D)’
DAC • Updated the INTENSET register, changed disable to enable for interrupts.
• Updated the SYNCRDY bit of the INTENSET Register.
Added information about internal 1.0V buffered reference voltage.
SAM DA1 Electrical Updated I2C Pins Characteristics in I2C Configuration in I2C Pins.
Characteristics Updated label for internal 1.1V Bandgap Reference
Added information about internal 1.0V buffered reference voltage for ADC and DAC.
SERCOM I2C Updated the SYSOP bit of the SYNCBUSY Register with the removal of erroneous
text
SERCOM SPI Updated DOPO description.
EIC Note added for CONFIGn registers.
DMAC Updatetd Sleep mode operation description.
SYSCTRL Removed reference to BOD12 registers. Added ENABLE bit in the VREG register.
DSU Related linked added in the DID register description.
Section Description
Block Diagram Added arrow between PORT and AHB-APB BRIDGE B.
Pinout Updated section titles
Product Mapping Updated the diagram to show the Internal Flash.
PORT I/O Pin Controller Corrected the WRCONFIG register to show the
DRVSTR bit.
SERCOM Under Clock Generation - Baud-Rate Generator, the
table was updated with a new information and equations.
...........continued
Section Description
SERCOM USART • Information regarding FIFO was removed as it is
not supported on this device
• The FIFOCLR bit was removed from the CTRLB
register
• The FIFOSPACE and FIFOPTR registers were
removed
Timer Counter (TC) • In Counter Mode, Count32 was updated with new
TC numbering
• The register summaries for 8-bit Mode, 16-bit
Mode, and 32-bit Mode were updated to correctly
display
...........continued
Section Description
TCC • FCTRLA and FCTRLB had their naming corrected
• In the WEXCTRL register the DTIEN bit had the
numbering updated
• In the DRVCTRL register the numbering was
updated for the INVENx, NRVx, and NREx bits
• In the EVCTRL register the numbering was updated
for the MCEOx, MCEIx, TCEIx, and TCINVx
Registers
• In the INTENCLR, INTENSET, and INTFLAG
registers the numbering was updated for the MCx
bit
• In the STATUS register the numbering was updated
for the CMPx and FAULTx bits
• The PATT register was updated to properly display
the PGVx and PGEx bits
• The PATTB register was updated to properly display
the PGVBx and PGEBx bits
SAM DA1 Electrical Characteristics This section was migrated into this data sheet from the
original SAM DA1 data sheet.
Schematic Checklist Updated External Reset Circuit with changes to the
diagram External Reset Circuit Schematic.
Packaging Information Updated Package Markings with a new marking
diagram.
Ordering Information • Added: under Package Grade Z = -40 – 125C Matte Sn Plating AEC-Q100
ADC • Bandgap reference as input was omitted in previous version of the data sheet. It is
added in this version.
10. Memories • 10.3.1 NVM User Row Mapping: Added BOOTPROT default value for
WLCSP.
37. Electrical Characteristics • 37.9.1 Normal I/O Pins: Added condition to Pull-up - Pull-down
resistance.
3. SAM D21 Ordering • Added information to the pin count explanation. For the The G letter indicates 48 pin
Information(1) packages, while the WLCSP option is 45 pins.
• ATSAMD21E18A-MFUT corrected to ATSAMD21E18A-MFT.
• Device Identification:
– Removed C variants.
– Added device identification values for the devices in WLCSP packages. These
have separate device id's compared to the other package options.
18. WDT – Watchdog • 18.5.7 Debug Operation: Removed the sentence "This peripheral can be forced to
Timer continue operation during debugging." The WDT can not be forced to continue
operation in debug mode.
13. DSU - Device Service Unit • 13.11.5 Testing of On-Board Memories MBIST: Updated description.
24. EVSYS – Event System • 24.8.1 CTRL.SWRST: Added recommendation when doing a software reset.
28. SERCOM I2C – Inter- • Corrected cross references in the Master 28.10.1 CTRLA.SCLSM and Slave
Integrated Circuit 28.8.1 CTRLASCLSM bits.
31. TCC – Timer/Counter for • Value 0 in CAPTMIN mode is captured only in down-counting mode.
Control Applications
33. ADC – Analog-to-Digital • 33.6.5 Differential and Single-Ended Conversions: Corrected register
Converter reference from INPUTCTRL.DIFFMODE to CTRLB.DIFFMODE.
• 33.8.14 RESULT: Corrected description. Reference to "single-ended mode"
corrected to "single conversion mode".
37. Electrical Characteristics • 37.3 Absolute Maximum Ratings: Add ESD warnings.
• 37.16.5 I2S Timing: fM_SCKO and fM_SCKI values for VDD=1.8V moved from
the minimum to maximum column.
• XOSC32K 37.13.2.1.1 Crystal Oscillator Characteristics: Removed
conditions from the parasitic capacitor loads CXIN32 and CXOUT32. The
difference between package types is so small that it can be ingored.
44. Schematic Checklist • 44.5.3 External Real Time Oscillator: Added note on how to minimize jitter.
39. Electrical Characteristics • 39.4 Maximum Clock Frequencies: Corrected heading of Table 39-6 say
at 125°C "Device Variant B".
13. DSU - Device Service • 13.11.6 System Services Availability when Accessed Externally and Device is
Unit Protected: MBIST not available when device is operated from external address
range and device is protected.
19. RTC – Real-Time • 19.6.3.3 Clock/Calendar (Mode 2): Example added on how the clock counter
Counter works in calendar mode.
31. TCC – Timer/Counter • 31.6.3.6 Non-Recoverable Faults: Removed references to Update Fault State
for Control Applications (UFS).
• Removed the UFS bit from the INTENCLR, INTENSET, INTFLAG and STATUS
registers.
• Removed RAMP2C from the 31.8.16 WAVE.WAVE[2:0]=0x3
37. Electrical • 37.3 Absolute Maximum Ratings: Updated VPIN minimum and maximum values.
Characteristics (Related to the new Injection Current definition section)
• 37.5 Supply Characteristics: Corrected supply rise rates units from V/s to V/μs.
• 37.7 Power Consumption: Added power consumption numbers for Device
Variant C.
• 37.13.7 Fractional Digital Phase Locked Loop (FDPLL96M) Characteristics:
Added characterization data for Device Variant C.
• Added 37.10 Injection Current section.
43. Packaging Information • Added 43.1.13 35 ball WLCSP (Device Variant C) package outline drawing.
39. Electrical • 39.8.7 Fractional Digital Phase Locked Loop (FDPLL96M) Characteristics:
Characteristics at 125°C Added characterization data for Device Variant C.
• 39.2 Absolute Maximum Ratings: Updated VPIN minimum and maximum values.
(Related to the new Injection Current definition section)
Packaging Information
Updated ΘJC value from 3.1 to 15.0 °C/W for 32-pin QFN package in 37.2.1 Thermal Resistance
Data.
Added package drawing for 43.1.12 35 ball WLCSP (Device Variant B).
Schematic Checklist
44.2.1 Power Supply Connections:
VDDCORE decoupling capacitor value updated from 100nF to 1μF.
References to AREFA and AREFB replaced with VREFA and VREFB respectively.
5. Pinout:
Added pinout figures for 5.1.2 UFBGA64 and 5.3.1 WLCSP45.
9. Product Mapping:
Updated Product Mapping figure with Internal RWW section block for Device Variant B.
10. Memories:
10.2 Physical Memory Map: Added start address for Internal Read While Write (RWW) section for
Device Variant B.
11. Processor And Architecture:
11.1.1 Cortex M0+ Configuration: Removed green connection dots between DMAC Data and AHB-
APB Bridge A and Bridge B.
22. NVMCTRL – Nonvolatile Memory Controller:
Errata
Updated errata for revision A, B and C: Added Errata Reference 13140, 12860.
2. Configuration Summary
Added 32KB Flash and 4KB SRAM options to SAM D21J and SAM D21G.
3. SAM D21 Ordering Information(1)
Added Tray to Carrier Type option for SAM D21E, SAMD 21G and SAMD21J ordering codes.
7. I/O Multiplexing and Considerations:
Updated REF function on PA03 and PA04 in Table 7-1:
PA03: DAC/VREFP changed to DAC/VREFA.
PA04: ADC VREFP changed to ADC/VREFB.
Updated COM function on PA30 and PA31:
PA30: CORTEX_M0P/SWCLK changed to SWCKL.
PA31: Added SWDIO.
10. Memories
Added a second note to Table 10-3.
Added Figure 10-1 Calibration and Auxiliary Space.
Added default values for fuses in Table 10-7 NVM User Row Mapping.
19.6.9.1 Periodic Events: Bit names updated fro, PERx to PEREOx in example, Figure 19-4.
CLOCK.HOUR[4:0]: Updated Table 19-4
Mode 0 and Mode 2: CMPx bit renamed to CMP0 since only one CMP0 is available.
Bit description of CLOCK.HOUR[4:0]: Updated Table 19-4
ALARMn register renamed to ALARM0.
Updated VDD max from 3.63V to 3.63V in 37.3 Absolute Maximum Ratings.
Updated VDDIN pin from 57 to 56 in 7.2.4 GPIO Clusters.
37.7 Power Consumption: Updated Max values for STANDBY from 190.6μA and 197.3μA to 100μA in Table 37-8.
Added 37.8 Peripheral Power Consumption.
37.9 I/O Pin Characteristics: tRISE and tFALL updated with different load conditions depending on the DVRSTR
value in .
37.9 I/O Pin Characteristics: Correct typo IOL and IOH Max values inverted between PORT.PINCFG.DRVSTR=0
and 1, tRISE and tFALL updated with different load conditions depending on the DVRSTR value in Table 37-15.
37.11 Analog Characteristics: Removed note from Table 37-19.
37.11.4 Analog-to-Digital (ADC) characteristics: Added Max DC supply current (IDD), RSAMPLE maximum value
changed from 2.8kW to 3.5kW, Conversion time Typ value change to Min Value in Table 37-24.
37.11.5 Digital to Analog Converter (DAC) Characteristics: Added Max DC supply current (IDD) in Table 37-32.
37.11.6 Analog Comparator Characteristics: Added Min and Max values for VSCALE INL, DNL, Offset Error and
Gain Error in Table 37-36.
37.11.7 Internal 1.1V Bandgap Reference Characteristics: Added Min and Max values, removed accuracy row in
Table 37-38.
37.16.3 SERCOM in I2C Mode Timing: Add Typical values for tR in Table 37-68.
Removed Asynchronous Watchdog Clock Characterization.
37.13.4 32.768kHz Internal oscillator (OSC32K) Characteristics: Added Max current consumption (IOSC32K) in Table
37-55.
Updated Crystal Oscillator Characteristics (XOSC32K) ESR maximum values, 37.13.2.1.1 Crystal Oscillator
Characteristics.
Updated Crystal Oscillator Characteristics (XOSC) ESR maximum value, 37.13.1.2 Crystal Oscillator
Characteristics from 348kΩ to 141kΩ.
37.13.3 Digital Frequency Locked Loop (DFLL48M) Characteristics: Updated presentation, now separating
between Open- and Closed Loop Modes. Added fREF Min and Max values to Table 37-52.
Updated typical Startup time ( tSTARTUP) from 6.1µs to 8µs in Table 37-53.
Updated typical Fine lock time (tLFINE) from 700µs to 600µs in Table 37-53.
37.13.7 Fractional Digital Phase Locked Loop (FDPLL96M) Characteristics: Added Current consumption
(IFDPLL96M), Period Jitter (Jp), Lock time (tLOCK), Duty cycles parameters in Table 37-58.
Added 37.15 USB Characteristics.
37.16 Timing Characteristics: Added SCK period (tSCK) Typ value in Table 37-65.
Errata
Errata for revision B added.
Customer Support
Users of Microchip products can receive assistance through several channels:
• Distributor or Representative
• Local Sales Office
• Field Application Engineer (FAE)
• Technical Support
Customers should contact their distributor, representative or Field Application Engineer (FAE) for support. Local sales
offices are also available to help customers. A listing of sales offices and locations is included in the back of this
document.
Technical support is available through the web site at: http://www.microchip.com/support
ATSAMD 21 E 15 A - M U T
Product Family
SAMD = General Purpose Microcontroller Package Carrier
No character = Tray (Default)
Product Series T = Tape and Reel
21 = Cortex M0 + CPU, Basic Feature Set
+ DMA + USB Package Grade
Pin Count U = -40 - 85°C Matte Sn Plating
E = 32 Pins (35 Pins for WLCSP) N = -40 - 105°C Matte Sn Plating
G = 48 Pins (45 Pins for WLCSP) F = -40 - 125°C Matte Sn Plating
J = 64 Pins Z = -40 - 125°C Matte Sn Plating
Flash Memory Density (AEC-Q100 Qualified)
18 = 256 KB Package Type
17 = 128 KB A = TQFP(4)
16 = 64 KB M = QFN(4)
15 = 32 KB U = WLCSP (2,3)
Device Variant C = UFBGA
A = Default Variant
B = Added RWW support for 32 KB and 64 KB memory options
C = Silicon revision F for WLCSP45 package option
L = Pinout optimized for Analog and PWM
D = Silicon Revision G with RWW Support in 128KB memory options
Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you
may have a right to sue for relief under that Act.
Legal Notice
Information contained in this publication regarding device applications and the like is provided only for your
convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with
your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER
EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION,
INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR
FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip
devices in life support and/or safety applications is entirely at the buyer’s risk, and the buyer agrees to defend,
indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such
use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights unless
otherwise stated.
Trademarks
The Microchip name and logo, the Microchip logo, AnyRate, AVR, AVR logo, AVR Freaks, BeaconThings, BitCloud,
CryptoMemory, CryptoRF, dsPIC, FlashFlex, flexPWR, Heldo, JukeBlox, KeeLoq, KeeLoq logo, Kleer, LANCheck,
LINK MD, maXStylus, maXTouch, MediaLB, megaAVR, MOST, MOST logo, MPLAB, OptoLyzer, PIC, picoPower,
PICSTART, PIC32 logo, Prochip Designer, QTouch, RightTouch, SAM-BA, SpyNIC, SST, SST Logo, SuperFlash,
tinyAVR, UNI/O, and XMEGA are registered trademarks of Microchip Technology Incorporated in the U.S.A. and
other countries.
ClockWorks, The Embedded Control Solutions Company, EtherSynch, Hyper Speed Control, HyperLight Load,
IntelliMOS, mTouch, Precision Edge, and Quiet-Wire are registered trademarks of Microchip Technology Incorporated
in the U.S.A.
Adjacent Key Suppression, AKS, Analog-for-the-Digital Age, Any Capacitor, AnyIn, AnyOut, BodyCom, chipKIT,
chipKIT logo, CodeGuard, CryptoAuthentication, CryptoCompanion, CryptoController, dsPICDEM, dsPICDEM.net,
Dynamic Average Matching, DAM, ECAN, EtherGREEN, In-Circuit Serial Programming, ICSP, Inter-Chip
Connectivity, JitterBlocker, KleerNet, KleerNet logo, Mindi, MiWi, motorBench, MPASM, MPF, MPLAB Certified logo,
MPLIB, MPLINK, MultiTRAK, NetDetach, Omniscient Code Generation, PICDEM, PICDEM.net, PICkit, PICtail,
PureSilicon, QMatrix, RightTouch logo, REAL ICE, Ripple Blocker, SAM-ICE, Serial Quad I/O, SMART-I.S., SQI,
SuperSwitcher, SuperSwitcher II, Total Endurance, TSHARC, USBCheck, VariSense, ViewSpan, WiperLock,
Wireless DNA, and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated in the U.S.A.
Silicon Storage Technology is a registered trademark of Microchip Technology Inc. in other countries.
GestIC is a registered trademark of Microchip Technology Germany II GmbH & Co. KG, a subsidiary of Microchip
Technology Inc., in other countries.
All other trademarks mentioned herein are property of their respective companies.
© 2018, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved.
ISBN: 978-1-5224-5840-1
ISO/TS 16949
Microchip received ISO/TS-16949:2009 certification for its worldwide headquarters, design and wafer fabrication
facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California and India. The
Company’s quality system processes and procedures are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code
hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition,
Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified.