04 - Reference Manual - Esp32 - Technical - Reference - Manual - en
04 - Reference Manual - Esp32 - Technical - Reference - Manual - en
Version 4.4
Espressif Systems
Copyright © 2021
www.espressif.com
About This Manual
The ESP32 Technical Reference Manual is addressed to application developers. The manual provides detailed
and complete information on how to use the ESP32 memory and peripherals.
For pin definition, electrical characteristics, and package information, please see ESP32 Datasheet.
Document Updates
Please always refer to the latest version at https://www.espressif.com/en/support/download/documents.
Revision History
For any changes to this document over time, please refer to the last page.
Certification
Download certificates for Espressif products from www.espressif.com/en/certificates.
Contents
Contents
5 DPort Registers 85
5.1 Introduction 85
5.2 Features 85
5.3 Functional Description 85
5.3.1 System and Memory Register 85
5.3.2 Reset and Clock Registers 85
5.3.3 Interrupt Matrix Register 85
5.3.4 DMA Registers 90
5.3.5 PID/MPU/MMU Registers 90
5.3.6 APP_CPU Controller Registers 92
5.3.7 Peripheral Clock Gating and Reset 93
5.4 Register Summary 96
Glossary 713
Abbreviations for Peripherals 713
Abbreviations for Registers 713
List of Tables
1-1 Address Mapping 26
1-2 Embedded Memory Address Mapping 27
1-3 Module with DMA 29
1-4 External Memory Address Mapping 29
1-5 Cache memory mode 30
1-6 Peripheral Address Mapping 31
2-1 PRO_CPU, APP_CPU Interrupt Configuration 35
2-2 CPU Interrupts 37
3-1 PRO_CPU and APP_CPU Reset Reason Values 39
3-2 CPU_CLK Source 41
3-3 CPU_CLK Derivation 41
3-4 Peripheral Clock Usage 42
3-5 APB_CLK Derivation 42
3-6 REF_TICK Derivation 43
3-7 LEDC_SCLK Derivation 43
4-1 IO_MUX Light-sleep Pin Function Registers 50
4-2 GPIO Matrix Peripheral Signals 52
4-3 IO_MUX Pad Summary 57
4-4 RTC_MUX Pin Summary 58
7-1 Mapping Between SPI Bus Signals and Pin Function Signals 121
7-2 Command Definitions Supported by GP-SPI Slave in Half-duplex Mode 123
7-3 Clock Polarity and Phase, and Corresponding SPI Register Values for SPI Master 125
7-4 Clock Polarity and Phase, and Corresponding SPI Register Values for SPI Slave 125
9-1 SD/MMC Signal Description 188
9-2 DES0 193
9-3 DES1 194
9-4 DES2 195
9-5 DES3 195
10-1 Destination Address Filtering 224
10-2 Source Address Filtering 224
10-3 Transmit Descriptor 0 (TDES0) 230
10-4 Transmit Descriptor 1 (TDES1) 234
10-5 Transmit Descriptor 2 (TDES2) 234
10-6 Transmit Descriptor 3 (TDES3) 234
10-7 Transmit Descriptor 6 (TDES6) 234
10-8 Transmit Descriptor 7 (TDES7) 235
10-9 Receive Descriptor 0 (RDES0) 235
10-10 Receive Descriptor 1 (RDES1) 238
10-11 Receive Descriptor 2 (RDES2) 238
10-12 Receive Descriptor 3 (RDES3) 238
10-13 Receive Descriptor 4 (RDES4) 239
10-14 Receive Descriptor 6 (RDES6) 240
10-15 Receive Descriptor 7 (RDES7) 240
27-4 Page Mode of MMU for the Remaining 128 KB of Internal SRAM0 and SRAM2 601
27-5 Page Boundaries for SRAM0 MMU 602
27-6 Page Boundaries for SRAM2 MMU 602
27-7 DPORT_DMMU_TABLEn_REG & DPORT_IMMU_TABLEn_REG 603
27-8 MPU for DMA 604
27-9 Virtual Address for External Memory 606
27-10 MMU Entry Numbers for PRO_CPU 606
27-11 MMU Entry Numbers for APP_CPU 606
27-12 MMU Entry Numbers for PRO_CPU (Special Mode) 607
27-13 MMU Entry Numbers for APP_CPU (Special Mode) 607
27-14 Virtual Address Mode for External SRAM 608
27-15 Virtual Address for External SRAM ( Normal Mode ) 609
27-16 Virtual Address for External SRAM ( Low-High Mode ) 609
27-17 Virtual Address for External SRAM (Even-Odd Mode) 609
27-18 MMU Entry Numbers for External RAM 610
27-19 MPU for Peripheral 611
27-20 DPORT_AHBLITE_MPU_TABLE_X_REG 612
28-1 Interrupt Vector Entry Address 614
28-2 Configuration of PIDCTRL_LEVEL_REG 614
28-3 Configuration of PIDCTRL_FROM_n_REG 615
29-1 ESP32 Capacitive Sensing Touch Pads 623
29-2 Inputs of SAR ADC module 626
29-3 ESP32 SAR ADC Controllers 627
29-4 Fields of the Pattern Table Register 629
29-5 Fields of Type I DMA Data Format 630
29-6 Fields of Type II DMA Data Format 630
30-1 ALU Operations Among Registers 652
30-2 ALU Operations with Immediate Value 653
30-3 ALU Operations with Stage Count Register 654
30-4 Input Signals Measured Using the ADC Instruction 658
31-1 RTC Power Domains 680
31-2 Wake-up Source 682
List of Figures
1-1 System Structure 25
1-2 System Address Mapping 25
1-3 Cache Block Diagram 30
2-1 Interrupt Matrix Structure 34
3-1 System Reset 39
3-2 System Clock 40
4-1 IO_MUX, RTC IO_MUX and GPIO Matrix Overview 45
4-2 Peripheral Input via IO_MUX, GPIO Matrix 46
4-3 Output via GPIO Matrix 48
4-4 ESP32 I/O Pad Power Sources (QFN 6*6, Top View) 51
4-5 ESP32 I/O Pad Power Sources (QFN 5*5, Top View) 51
6-1 DMA Engine Architecture 116
6-2 Linked List Structure 117
6-3 Data Transfer in UDMA Mode 118
6-4 SPI DMA 119
7-1 SPI Architecture 121
7-2 SPI Master and Slave Full-duplex/Half-duplex Communication 122
7-3 SPI Data Buffer 124
7-4 GP-SPI ������ 127
7-5 Parallel QSPI 127
7-6 Communication Format of Parallel QSPI 128
8-1 SDIO Slave Block Diagram 155
8-2 SDIO Bus Packet Transmission 156
8-3 CMD53 Content 156
8-4 SDIO Slave DMA Linked List Structure 157
8-5 SDIO Slave Linked List 157
8-6 Packet Sending Procedure (Initiated by Slave) 158
8-7 Packet Receiving Procedure (Initiated by Host) 159
8-8 Loading Receiving Buffer 160
8-9 Sampling Timing Diagram 160
8-10 Output Timing Diagram 161
9-1 SD/MMC Controller Topology 187
9-2 SD/MMC Controller External Interface Signals 188
9-3 SDIO Host Block Diagram 188
9-4 Command Path State Machine 190
9-5 Data Transmit State Machine 190
9-6 Data Receive State Machine 191
9-7 Descriptor Chain 193
9-8 The Structure of a Linked List 193
9-9 Clock Phase Selection 197
10-1 Ethernet MAC Functionality Overview 217
10-2 Ethernet Block Diagram 219
10-3 MII Interface 226
1.1 Introduction
The ESP32 is a dual-core system with two Harvard Architecture Xtensa LX6 CPUs. All embedded memory, external
memory and peripherals are located on the data bus and/or the instruction bus of these CPUs.
With some minor exceptions (see below), the address mapping of two CPUs is symmetric, meaning that they
use the same addresses to access the same memory. Multiple peripherals in the system can access embedded
memory via DMA.
The two CPUs are named “PRO_CPU” and “APP_CPU” (for “protocol” and “application”), however, for most pur-
poses the two CPUs are interchangeable.
1.2 Features
• Address Space
– 4 GB (32-bit) address space for both data bus and instruction bus
– Some embedded and external memory regions can be accessed by either data bus or instruction bus
• Embedded Memory
• External Memory
Off-chip SPI memory can be mapped into the available address space as external memory. Parts of the
embedded memory can be used as transparent cache for this external memory.
• Peripherals
– 41 peripherals
• DMA
The block diagram in Figure 1-1 illustrates the system structure, and the block diagram in Figure 1-2 illustrates the
address map structure.
Addresses below 0x4000_0000 are serviced using the data bus. Addresses in the range 0x4000_0000 ~ 0x4FFF_FFFF
are serviced using the instruction bus. Finally, addresses over and including 0x5000_0000 are shared by the data
and instruction bus.
The data bus and instruction bus are both little-endian: for example, byte addresses 0x0, 0x1, 0x2, 0x3 access
the least significant, second least significant, second most significant, and the most significant bytes of the 32-bit
word stored at the 0x0 address, respectively. The CPU can access data bus addresses via aligned or non-aligned
byte, half-word and word read-and-write operations. The CPU can read and write data through the instruction
bus, but only in a word aligned manner; non-word-aligned access will cause a CPU exception.
Each CPU can directly access embedded memory through both the data bus and the instruction bus, external
memory which is mapped into the address space (via transparent caching & MMU), and peripherals. Table 1-1
illustrates address ranges that can be accessed by each CPU’s data bus and instruction bus.
Some embedded memories and some external memories can be accessed via the data bus or the instruction bus.
In these cases, the same memory is available to either of the CPUs at two address ranges.
Boundary Address
Bus Type Size Target
Low Address High Address
0x0000_0000 0x3F3F_FFFF Reserved
Data 0x3F40_0000 0x3F7F_FFFF 4 MB External Memory
Data 0x3F80_0000 0x3FBF_FFFF 4 MB External Memory
0x3FC0_0000 0x3FEF_FFFF 3 MB Reserved
Data 0x3FF0_0000 0x3FF7_FFFF 512 KB Peripheral
Data 0x3FF8_0000 0x3FFF_FFFF 512 KB Embedded Memory
Instruction 0x4000_0000 0x400C_1FFF 776 KB Embedded Memory
Instruction 0x400C_2000 0x40BF_FFFF 11512 KB External Memory
0x40C0_0000 0x4FFF_FFFF 244 MB Reserved
Data / Instruction 0x5000_0000 0x5000_1FFF 8 KB Embedded Memory
0x5000_2000 0xFFFF_FFFF Reserved
The 448 KB internal ROM is divided into two parts: Internal ROM 0 (384 KB) and Internal ROM 1 (64 KB). The 520
KB internal SRAM is divided into three parts: Internal SRAM 0 (192 KB), Internal SRAM 1 (128 KB), and Internal
SRAM 2 (200 KB). RTC FAST Memory and RTC SLOW Memory are both implemented as SRAM.
Table 1-2 lists all embedded memories and their address ranges on the data and instruction buses.
Boundary Address
Bus Type Size Target Comment
Low Address High Address
Data 0x3FF8_0000 0x3FF8_1FFF 8 KB RTC FAST Memory PRO_CPU Only
0x3FF8_2000 0x3FF8_FFFF 56 KB Reserved -
Data 0x3FF9_0000 0x3FF9_FFFF 64 KB Internal ROM 1 -
0x3FFA_0000 0x3FFA_DFFF 56 KB Reserved -
Data 0x3FFA_E000 0x3FFD_FFFF 200 KB Internal SRAM 2 DMA
Data 0x3FFE_0000 0x3FFF_FFFF 128 KB Internal SRAM 1 DMA
Boundary Address
Bus Type Size Target Comment
Low Address High Address
Instruction 0x4000_0000 0x4000_7FFF 32 KB Internal ROM 0 Remap
Instruction 0x4000_8000 0x4005_FFFF 352 KB Internal ROM 0 -
0x4006_0000 0x4006_FFFF 64 KB Reserved -
Instruction 0x4007_0000 0x4007_FFFF 64 KB Internal SRAM 0 Cache
Instruction 0x4008_0000 0x4009_FFFF 128 KB Internal SRAM 0 -
Instruction 0x400A_0000 0x400A_FFFF 64 KB Internal SRAM 1 -
Instruction 0x400B_0000 0x400B_7FFF 32 KB Internal SRAM 1 Remap
Instruction 0x400B_8000 0x400B_FFFF 32 KB Internal SRAM 1 -
Instruction 0x400C_0000 0x400C_1FFF 8 KB RTC FAST Memory PRO_CPU Only
Boundary Address
Bus Type Size Target Comment
Low Address High Address
Data Instruc-
0x5000_0000 0x5000_1FFF 8 KB RTC SLOW Memory -
tion
The address range of the first 32 KB of the ROM 0 (0x4000_0000 ~ 0x4000_7FFF) can be remapped in order to
access a part of Internal SRAM 1 that normally resides in a memory range of 0x400B_0000 ~ 0x400B_7FFF. While
remapping, the 32 KB SRAM cannot be accessed by an address range of 0x400B_0000 ~ 0x400B_7FFF any more,
but it can still be accessible through the data bus (0x3FFE_8000 ~ 0x3FFE_FFFF). This can be done on a per-CPU
basis: setting bit 0 of register DPORT_PRO_BOOT_REMAP_CTRL_REG or DPORT_APP_BOOT_REMAP_CTRL_REG
will remap SRAM for the PRO_CPU and APP_CPU, respectively.
0x4007_0000 ~ 0x4007_FFFF of the instruction bus. The remaining 128 KB can always be read and written by
either CPU at addresses 0x4008_0000 ~ 0x4009_FFFF of instruction bus.
The address range accessed via the instruction bus is in reverse order (word-wise) compared to access via the
data bus. That is to say, address
0x3FFE_0000 and 0x400B_FFFC access the same word
0x3FFE_0004 and 0x400B_FFF8 access the same word
0x3FFE_0008 and 0x400B_FFF4 access the same word
……
0x3FFF_FFF4 and 0x400A_0008 access the same word
0x3FFF_FFF8 and 0x400A_0004 access the same word
0x3FFF_FFFC and 0x400A_0000 access the same word
The data bus and instruction bus of the CPU are still both little-endian, so the byte order of individual words is not
reversed between address spaces. For example, address
0x3FFE_0000 accesses the least significant byte in the word accessed by 0x400B_FFFC.
0x3FFE_0001 accesses the second least significant byte in the word accessed by 0x400B_FFFC.
0x3FFE_0002 accesses the second most significant byte in the word accessed by 0x400B_FFFC.
0x3FFE_0003 accesses the most significant byte in the word accessed by 0x400B_FFFC.
0x3FFE_0004 accesses the least significant byte in the word accessed by 0x400B_FFF8.
0x3FFE_0005 accesses the second least significant byte in the word accessed by 0x400B_FFF8.
0x3FFE_0006 accesses the second most significant byte in the word accessed by 0x400B_FFF8.
0x3FFE_0007 accesses the most significant byte in the word accessed by 0x400B_FFF8.
……
0x3FFF_FFF8 accesses the least significant byte in the word accessed by 0x400A_0004.
0x3FFF_FFF9 accesses the second least significant byte in the word accessed by 0x400A_0004.
0x3FFF_FFFA accesses the second most significant byte in the word accessed by 0x400A_0004.
0x3FFF_FFFB accesses the most significant byte in the word accessed by 0x400A_0004.
0x3FFF_FFFC accesses the least significant byte in the word accessed by 0x400A_0000.
0x3FFF_FFFD accesses the second most significant byte in the word accessed by 0x400A_0000.
0x3FFF_FFFE accesses the second most significant byte in the word accessed by 0x400A_0000.
0x3FFF_FFFF accesses the most significant byte in the word accessed by 0x400A_0000.
Part of this memory can be remapped onto the ROM 0 address space. See Internal Rom 0 for more informa-
tion.
1.3.2.6 DMA
DMA uses the same addressing as the CPU data bus to read and write Internal SRAM 1 and Internal SRAM 2.
This means DMA uses an address range of 0x3FFE_0000 ~ 0x3FFF_FFFF to read and write Internal SRAM 1 and
an address range of 0x3FFA_E000 ~ 0x3FFD_FFFF to read and write Internal SRAM 2.
In the ESP32, 13 peripherals are equipped with DMA. Table 1-3 lists these peripherals.
The two address ranges of PRO_CPU access RTC FAST Memory in the same order, so, for example, addresses
0x3FF8_0000 and 0x400C_0000 access the same word. On the APP_CPU, these address ranges do not
provide access to RTC FAST Memory or any other memory location.
Boundary Address
Bus Type Size Target Comment
Low Address High Address
Data 0x3F40_0000 0x3F7F_FFFF 4 MB External Flash Read
Data 0x3F80_0000 0x3FBF_FFFF 4 MB External SRAM Read and Write
Boundary Address
Bus Type Size Target Comment
Low Address High Address
Instruction 0x400C_2000 0x40BF_FFFF 11512 KB External Flash Read
1.3.4 Cache
As shown in Figure 1-3, each of the two CPUs in ESP32 has 32 KB of cache for accessing external storage.
PRO CPU uses bit PRO_CACHE_ENABLE in register DPORT_PRO_CACHE_CTRL_REG to enable the Cache,
while APP CPU uses bit APP_CACHE_ENABLE in register DPORT_APP_CACHE_CTRL_REG to enable the same
function.
ESP32 uses a two-way set-associative cache. When the Cache function is to be used either by PRO CPU or APP
CPU, bit CACHE_MUX_MODE[1:0] in register DPORT_CACHE_MUX_MODE_REG can be set to select POOL0 or
POOL1 in the Internal SRAM0 as the cache memory. When both PRO CPU and APP CPU use the Cache function,
POOL0 and POOL1 in the Internal SRAM0 will be used simultaneously as the cache memory, while they can also
be used by the instruction bus. This is depicted in table 1-5 below.
As described in table 1-5, when bit CACHE_MUX_MODE is set to 1 or 2, PRO CPU and APP CPU cannot enable
the Cache function at the same time. When the Cache function is enabled, POOL0 or POOL1 can only be used
as the cache memory, and cannot be used by the instruction bus as well.
ESP32 Cache supports the Flush function. It is worth noting that when the Flush function is used, the data written
in the cache will be disposed rather than being rewritten into the External SRAM. To enable the Flush function, first
clear bit x_CACHE_FLUSH_ENA in register DPORT_x_CACHE_CTRL_REG, then set this bit to 1. Afterwards, the
system hardware will set bit x_CACHE_FLUSH_DONE to 1, where x can be ”PRO” or ”APP”, indicating that the
cache flush operation has been completed.
For more information about the address mapping of ESP32 Cache, please refer to Embedded Memory and External
Memory.
1.3.5 Peripherals
The ESP32 has 41 peripherals. Table 1-6 specifically describes the peripherals and their respective address ranges.
Nearly all peripheral modules can be accessed by either CPU at the same address with just a single exception;
this being the PID Controller.
Boundary Address
Bus Type Size Target Comment
Low Address High Address
Data 0x3FF0_0000 0x3FF0_0FFF 4 KB DPort Register
Data 0x3FF0_1000 0x3FF0_1FFF 4 KB AES Accelerator
Data 0x3FF0_2000 0x3FF0_2FFF 4 KB RSA Accelerator
Data 0x3FF0_3000 0x3FF0_3FFF 4 KB SHA Accelerator
Data 0x3FF0_4000 0x3FF0_4FFF 4 KB Secure Boot
0x3FF0_5000 0x3FF0_FFFF 44 KB Reserved
Data 0x3FF1_0000 0x3FF1_3FFF 16 KB Cache MMU Table
0x3FF1_4000 0x3FF1_EFFF 44 KB Reserved
Data 0x3FF1_F000 0x3FF1_FFFF 4 KB PID Controller Per-CPU peripheral
0x3FF2_0000 0x3FF3_FFFF 128 KB Reserved
Data 0x3FF4_0000 0x3FF4_0FFF 4 KB UART0
0x3FF4_1000 0x3FF4_1FFF 4 KB Reserved
Data 0x3FF4_2000 0x3FF4_2FFF 4 KB SPI1
Data 0x3FF4_3000 0x3FF4_3FFF 4 KB SPI0
Data 0x3FF4_4000 0x3FF4_4FFF 4 KB GPIO
0x3FF4_5000 0x3FF4_7FFF 12 KB Reserved
Data 0x3FF4_8000 0x3FF4_8FFF 4 KB RTC
Data 0x3FF4_9000 0x3FF4_9FFF 4 KB IO MUX
0x3FF4_A000 0x3FF4_AFFF 4 KB Reserved
Data 0x3FF4_B000 0x3FF4_BFFF 4 KB SDIO Slave One of three parts
Data 0x3FF4_C000 0x3FF4_CFFF 4 KB UDMA1
0x3FF4_D000 0x3FF4_EFFF 8 KB Reserved
Data 0x3FF4_F000 0x3FF4_FFFF 4 KB I2S0
Data 0x3FF5_0000 0x3FF5_0FFF 4 KB UART1
0x3FF5_1000 0x3FF5_2FFF 8 KB Reserved
Data 0x3FF5_3000 0x3FF5_3FFF 4 KB I2C0
Data 0x3FF5_4000 0x3FF5_4FFF 4 KB UDMA0
Data 0x3FF5_5000 0x3FF5_5FFF 4 KB SDIO Slave One of three parts
Data 0x3FF5_6000 0x3FF5_6FFF 4 KB RMT
Data 0x3FF5_7000 0x3FF5_7FFF 4 KB PCNT
Data 0x3FF5_8000 0x3FF5_8FFF 4 KB SDIO Slave One of three parts
Data 0x3FF5_9000 0x3FF5_9FFF 4 KB LED PWM
Data 0x3FF5_A000 0x3FF5_AFFF 4 KB Efuse Controller
Data 0x3FF5_B000 0x3FF5_BFFF 4 KB Flash Encryption
Boundary Address
Bus Type Size Target Comment
Low Address High Address
0x3FF5_C000 0x3FF5_DFFF 8 KB Reserved
Data 0x3FF5_E000 0x3FF5_EFFF 4 KB PWM0
Data 0x3FF5_F000 0x3FF5_FFFF 4 KB TIMG0
Data 0x3FF6_0000 0x3FF6_0FFF 4 KB TIMG1
0x3FF6_1000 0x3FF6_3FFF 12 KB Reserved
Data 0x3FF6_4000 0x3FF6_4FFF 4 KB SPI2
Data 0x3FF6_5000 0x3FF6_5FFF 4 KB SPI3
Data 0x3FF6_6000 0x3FF6_6FFF 4 KB SYSCON
Data 0x3FF6_7000 0x3FF6_7FFF 4 KB I2C1
Data 0x3FF6_8000 0x3FF6_8FFF 4 KB SDMMC
Data 0x3FF6_9000 0x3FF6_AFFF 8 KB EMAC
0x3FF6_B000 0x3FF6_BFFF 4 KB Reserved
Data 0x3FF6_C000 0x3FF6_CFFF 4 KB PWM1
Data 0x3FF6_D000 0x3FF6_DFFF 4 KB I2S1
Data 0x3FF6_E000 0x3FF6_EFFF 4 KB UART2
Data 0x3FF6_F000 0x3FF6_FFFF 4 KB PWM2
Data 0x3FF7_0000 0x3FF7_0FFF 4 KB PWM3
0x3FF7_1000 0x3FF7_4FFF 16 KB Reserved
Data 0x3FF7_5000 0x3FF7_5FFF 4 KB RNG
0x3FF7_6000 0x3FF7_FFFF 40 KB Reserved
Notice:
• Peripherals accessed by the CPU via 0x3FF40000 ~ 0x3FF7FFFF address space (DPORT address) can also
be accessed via 0x60000000 ~ 0x6003FFFF (AHB address). (0x3FF40000 + n) address and (0x60000000
+ n) address access the same content, where n = 0 ~ 0x3FFFF.
• The CPU can access peripherals via DPORT address more efficiently than via AHB address. However,
DPORT address is characterized by speculative reads, which means it cannot guarantee that each read is
valid. In addition, DPORT address will upset the order of r/w operations on the bus to improve performance,
which may cause programs that have strict requirements on the r/w order to crash. On the other hand, using
AHB address to read FIFO registers will cause unpredictable errors. To address above issues please strictly
follow the instructions documented in ESP32 ECO and Workarounds for Bugs, specifically sections 3.3, 3.10,
3.16, and 3.17.
3FF5_5FFF and 0x3FF5_8000 ~ 3FF5_8FFF of each CPU’s data bus. Similarly to other peripherals, access to this
peripheral is identical for both CPUs.
Internally, the SRAM is organized in 32K-sized banks. Each CPU and DMA channel can simultaneously access
the SRAM at full speed, provided they access addresses in different memory banks.
2.1 Overview
The Interrupt Matrix embedded in the ESP32 independently allocates peripheral interrupt sources to the two CPUs’
peripheral interrupts. This configuration is made to be highly flexible in order to meet many different needs.
2.2 Features
• Accepts 71 peripheral interrupt sources as input.
The four remaining peripheral interrupt sources are CPU-specific, two per CPU. GPIO_INTERRUPT_PRO and
GPIO_INTERRUPT_PRO_NMI can only be allocated to PRO_CPU. GPIO_INTERRUPT_APP and GPIO_INTERRUPT
_APP_NMI can only be allocated to APP_CPU. As a result, PRO_CPU and APP_CPU each have 69 peripheral in-
terrupt sources.
• PRO_X_MAP_REG (or APP_X_MAP_REG) stands for any particular peripheral interrupt configuration register
of the PRO_CPU (or APP_CPU). The peripheral interrupt configuration register corresponds to the peripheral
interrupt source Source_X. In Table 2-1 the registers listed under “PRO_CPU (APP_CPU) - Peripheral Interrupt
Configuration Register” correspond to the peripheral interrupt sources listed in “Peripheral Interrupt Source
- Name”.
• Interrupt_P stands for CPU peripheral interrupt, numbered as Num_P. Num_P can take the ranges 0 ~ 5, 8
~ 10, 12 ~ 14, 17 ~ 28, 30 ~ 31.
• Interrupt_I stands for the CPU internal interrupt numbered as Num_I. Num_I can take values 6, 7, 11, 15,
16, 29.
Using this terminology, the possible operations of the Interrupt Matrix controller can be described as follows:
• Allocate multiple peripheral sources Source_Xn ORed to PRO_CPU (APP_CPU) peripheral interrupt
Set multiple PRO_Xn_MAP_REG (APP_Xn_MAP_REG) to the same Num_P. Any of these peripheral interrupts
will trigger CPU Interrupt_P.
• CPU reset: Only resets the registers of one or both of the CPU cores.
• Core reset: Resets all the digital registers, including CPU cores, external GPIO and digital GPIO. The RTC is
not reset.
• System reset: Resets all the registers on the chip, including those of the RTC.
– PLL_CLK is an internal PLL clock with a frequency of 320 MHz or 480 MHz.
– XTL_CLK is a clock signal generated using an external crystal with a frequency range of 2 ~ 40 MHz.
– RTC8M_CLK is an internal clock with a default frequency of 8 MHz. This frequency is adjustable.
– RTC8M_D256_CLK is divided from RTC8M_CLK. Its frequency is (RTC8M_CLK / 256). With the default
RTC8M_CLK frequency of 8 MHz, this clock runs at 31.250 KHz.
– RTC_CLK is an internal low power clock with a default frequency of 150 KHz. This frequency is ad-
justable.
• Audio Clock
– APLL_CLK is an internal Audio PLL clock with a frequency range of 16 ~ 128 MHz.
The CPU_CLK clock source is determined by the RTC_CNTL_SOC_CLK_SEL register. PLL_CLK, APLL_CLK,
RTC8M_CLK, and XTL_CLK can be set as the CPU_CLK source; see Table 3-2 and 3-3.
By configuring correct divider values for each APB_CLK source, the user can ensure that the REF_TICK frequency
does not change when CPU_CLK changes source, causing the APB_CLK frequency to change.
The LED PWM module can use RTC8M_CLK as a clock source when APB_CLK is disabled. In other words,
when the system is in low-power consumption mode (see Power Management Chapter), normal peripherals will
be halted (APB_CLK is turned off), but the LED PWM can work normally via RTC8M_CLK.
For LOW_POWER_CLK, one of RTC_CLK, SLOW_CLK, RTC8M_CLK or XTL_CLK can be selected as the low-
power consumption mode clock source for Wi-Fi and BT.
SLOW_CLK is used to clock the Power Management module. It can be sourced from RTC_CLK, XTL32K_CLK or
RTC8M_D256_CLK
FAST_CLK is used to clock the On-chip Sensor module. It can be sourced from a divided XTL_CLK or from
RTC8M_CLK.
Providing an integrated precision clock source can minimize system cost. To this end, ESP32 integrates an audio
PLL intended for I2S peripherals. More details on how to clock the I2S module, using an APLL clock, can be found
in Chapter I2S. The Audio PLL formula is as follows:
fxtal (sdm2+ sdm1 + sdm0 +4)
28 216
fout = 2(odiv+2)
The operating frequency range of the numerator is 350 MHz ~ 500 MHz:
sdm1 sdm0
350M Hz < fxtal (sdm2 + 28
+ 216
+ 4) < 500M Hz
Please note that sdm1 and sdm0 are not available on revision0 of ESP32. Please consult the silicon revision in
ECO and Workarounds for Bugs in ESP32 for further details.
Audio PLL can be manually enabled or disabled via registers RTC_CNTL_PLLA_FORCE_PU and RTC_CNTL_PLLA
_FORCE_PD, respectively. Disabling it takes priority over enabling it. When RTC_CNTL_PLLA_FORCE_PU and
RTC_CNTL_PLLA
_FORCE_PD are 0, PLL will follow the state of the system, i.e., when the system enters sleep mode, PLL will be
disabled automatically; when the system wakes up, PLL will be enabled automatically.
4.1 Overview
The ESP32 chip features 34 physical GPIO pads. Each pad can be used as a general-purpose I/O, or be connected
to an internal peripheral signal. The IO_MUX, RTC IO_MUX and the GPIO matrix are responsible for routing signals
from the peripherals to GPIO pads. Together these systems provide highly configurable I/O.
Note that the I/O GPIO pads are 019, 2123, 2527, 3239, while the output GPIOs are 019, 2123, 2527,
3233. GPIO pads 3439 are inputonly.
This chapter describes the signal selection and connection between the digital pads (FUN_SEL, IE, OE, WPU,
WDU, etc.), 162 peripheral input and 176 output signals (control signals: SIG_IN_SEL, SIG_OUT_SEL, IE, OE,
etc.), fast peripheral input/output signals (control signals: IE, OE, etc.), and RTC IO_MUX.
1. The IO_MUX contains one register per GPIO pad. Each pad can be configured to perform a ”GPIO” function
(when connected to the GPIO Matrix) or a direct function (bypassing the GPIO Matrix). Some high-speed
digital functions (Ethernet, SDIO, SPI, JTAG, UART) can bypass the GPIO Matrix for better high-frequency
digital performance. In this case, the IO_MUX is used to connect these pads directly to the peripheral.)
See Section 4.10 for a list of IO_MUX functions for each I/O pad.
2. The GPIO Matrix is a full-switching matrix between the peripheral input/output signals and the pads.
• For input to the chip: Each of the 162 internal peripheral inputs can select any GPIO pad as the input
source.
• For output from the chip: The output signal of each of the 34 GPIO pads can be from one of the 176
peripheral output signals.
3. RTC IO_MUX is used to connect GPIO pads to their low-power and analog functions. Only a subset of GPIO
pads have these optional ”RTC” functions.
The input signal is read from the GPIO pad through the IO_MUX. The IO_MUX must be configured to set the chosen
pad to ”GPIO” function. This causes the GPIO pad input signal to be routed into the GPIO Matrix, which in turn
routes it to the selected peripheral input.
To read GPIO pad X into peripheral signal Y, follow the steps below:
1. Configure the GPIO_FUNCy_IN_SEL_CFG register corresponding to peripheral signal Y in the GPIO Matrix:
• Set the GPIO_FUNCy_IN_SEL field in this register, corresponding to the GPIO pad X to read from. Clear
all other fields corresponding to other GPIO pads.
2. Configure the GPIO_FUNCx_OUT_SEL_CFG register and clear the GPIO_ENABLE_DATA[x] field correspond-
ing to GPIO pad X in the GPIO Matrix:
• Set the GPIO_FUNCx_OEN_SEL bit in the GPIO_FUNCx_OUT_SEL_CFG register to force the pin’s
output state to be determined always by the GPIO_ENABLE_DATA[x] field.
3. Configure the IO_MUX to select the GPIO Matrix. Set the IO_MUX_x_REG register corresponding to GPIO
pad X as follows:
• Set the function field (MCU_SEL) to the IO_MUX function corresponding to GPIO X (this is Function
#3—numeric value 2—for all pins).
• Set or clear the FUN_WPU and FUN_WPD bits, as desired, to enable/disable internal pull-up/pull-down
resistors.
Notes:
• It is possible to have a peripheral read a constantly low or constantly high input value without connecting
this input to a pad. This can be done by selecting a special GPIO_FUNCy_IN_SEL input, instead of a GPIO
number:
For example, to connect RMT peripheral channel 0 input signal (RMT_SIG_IN0_IDX, signal index 83) to GPIO 15,
please follow the steps below. Note that GPIO 15 is also named the MTDO pin:
4. Set the IO_MUX_GPIO15 register MCU_SEL field to 2 (GPIO function) and also set the FUN_IE bit (input
mode).
The input value of any GPIO pin can be read at any time without configuring the GPIO Matrix for a particular
peripheral signal. However, it is necessary to enable the input in the IO_MUX by setting the FUN_IE bit in the
IO_MUX_x_REG register corresponding to pad X, as mentioned in Section 4.2.2.
4.3 Peripheral Output via GPIO Matrix
4.3.1 Summary
To output a signal from a peripheral via the GPIO Matrix, the GPIO Matrix is configured to route the peripheral output
signal (0-18, 23-37, 61-121, 140-125, 224-228) to one of the 28 GPIOs (0-19, 21-23, 25-27, 32-33).
The output signal is routed from the peripheral into the GPIO Matrix. It is then routed into the IO_MUX, which is
configured to set the chosen pad to ”GPIO” function. This causes the output GPIO signal to be connected to the
pad.
Note:
The peripheral output signals 224 to 228 can be configured to be routed in from one GPIO and output directly from another
GPIO.
signal0_out 0 MCU_SEL
signal1_out 1
signal2_out 2
signal3_out 3
0 (FUNC)
1 (FUNC)
GPIO X out I/O Pad x
2 (GPIO)
GPIOx_out
signal228_out 228
FUN_OE = 1
GPIO_OUT_DATA bit x 256 (0x100)
256sdfsdfasdfgas
• Set the GPIO_FUNCx_OUT_SEL field in GPIO_FUNCx_OUT_SEL_CFG to the numeric index (Y) of de-
sired peripheral output signal Y.
• If the signal should always be enabled as an output, set the GPIO_FUNCx_OEN_SEL bit in the GPIO_FUNCx_OUT_SEL
register and the GPIO_ENABLE_DATA[x] field in the GPIO_ENABLE_REG register corresponding to
GPIO pad X. To have the output enable signal decided by internal logic, clear the GPIO_FUNCx_OEN_SEL
bit instead.
2. For an open drain output, set the GPIO_PINx_PAD_DRIVER bit in the GPIO_PINx register corresponding to
GPIO pad X. For push/pull mode (default), clear this bit.
3. Configure the IO_MUX to select the GPIO Matrix. Set the IO_MUX_x_REG register corresponding to GPIO
pad X as follows:
• Set the function field (MCU_SEL) to the IO_MUX function corresponding to GPIO X (this is Function
#3—numeric value 2—for all pins).
• Set the FUN_DRV field to the desired value for output strength (0-3). The higher the drive strength, the
more current can be sourced/sunk from the pin.
• If using open drain mode, set/clear the FUN_WPU and FUN_WPD bits to enable/disable the internal
pull-up/down resistors.
Notes:
• The output signal from a single peripheral can be sent to multiple pads simultaneously.
To configure a pad as simple GPIO output, the GPIO Matrix GPIO_FUNCx_OUT_SEL register is configured with a
special peripheral index value (0x100).
Selecting this option is less flexible than using the GPIO Matrix, as the IO_MUX register for each GPIO pad can
only select from a limited number of functions. However, better high-frequency digital performance will be main-
tained.
1. IO_MUX for the GPIO pad must be set to the required pad function. (Please refer to section 4.10 for a list of
pad functions.)
2. For inputs, the SIG_IN_SEL register must be cleared to route the input directly to the peripheral.
When configured as RTC GPIOs, the output pads can still retain the output level value when the chip is in Deep-
sleep mode, and the input pads can wake up the chip from Deep-sleep.
If the RTC_IO_TOUCH_PADx_TO_GPIO bit is cleared, then I/O to and from that pad is routed to the RTC subsys-
tem. In this mode, the RTC_GPIO_PINx register is used for digital I/O and the analog features of the pad are also
See 4.11 for a table mapping GPIO pads to their RTC equivalent pins and analog functions. Note that the
RTC_IO_PINx registers use the RTC GPIO pin numbering, not the GPIO pad numbering.
If SLP_SEL is set to 0, the pin functions remain the same in both normal execution and Light-sleep mode.
Note:
• For digital pads, to maintain the pad’s input/output status in Deep-sleep mode, you can set
REG_DG_PAD_FORCE_UNHOLD to 0 before powering down.
For RTC pads, the input and output values are controlled by the corresponding bits of register
RTC_CNTL_HOLD_FORCE_REG, and you can set it to 1 to hold the value or set it to 0 to unhold the value.
• For digital pads, to disable the hold function after the chip is woken up, you can set REG_DG_PAD_FORCE_UNHOLD
to 1. To maintain the hold function of the pad, you can change the corresponding bit in the register by setting
RTC_CNTL_HOLD_FORCE_REG to 1.
VDD3P3_CPU
GPIO21
GPIO22
GPIO19
XTAL_N
XTAL_P
U0RXD
U0TXD
VDDA
VDDA
CAP1
CAP2
48
47
46
45
44
43
42
41
40
39
38
37
VDDA 1 36 GPIO23
LNA_IN 2 35 GPIO18
VDD3P3 3 34 GPIO5
VDD3P3 4 33 SD_DATA_1
SENSOR_VP 5 32 SD_DATA_0
SENSOR_VN 8 29 SD_DATA_3
CHIP_PU 9 28 SD_DATA_2
VDET_1 10 27 GPIO17
VDET_2 11 26 VDD_SDIO
32K_XP 12 25 GPIO16
13
14
15
16
17
18
19
20
21
22
23
24
Analog pads
32K_XN
GPIO25
GPIO26
GPIO27
MTMS
MTDI
VDD3P3_RTC
MTCK
MTDO
GPIO2
GPIO0
GPIO4
Pads powered by VDD3P3_CPU
Figure 44. ESP32 I/O Pad Power Sources (QFN 6*6, Top View)
GPIO21
GPIO22
XTAL_N
XTAL_P
U0RXD
U0TXD
VDDA
VDDA
CAP1
CAP2
48
47
46
45
44
43
42
41
40
39
VDDA 1 38 GPIO19
LNA_IN 2 37 VDD3P3_CPU
VDD3P3 3 36 GPIO23
VDD3P3 4 35 GPIO18
SENSOR_VP 5 34 GPIO5
SENSOR_CAPP 6 33 SD_DATA_1
SENSOR_CAPN 7 32 SD_DATA_0
ESP32
49 GND
SENSOR_VN 8 31 SD_CLK
CHIP_PU 9 30 SD_CMD
VDET_1 10 29 SD_DATA_3
VDET_2 11 28 SD_DATA_2
32K_XP 12 27 GPIO17
32K_XN 13 26 VDD_SDIO
GPIO25 14 25 GPIO16
15
16
17
18
19
20
21
22
23
24
Analog pads
GPIO26
GPIO27
MTMS
MTDI
VDD3P3_RTC
MTCK
MTDO
GPIO2
GPIO0
GPIO4
Figure 45. ESP32 I/O Pad Power Sources (QFN 5*5, Top View)
• Pads marked blue are RTC pads that have their individual analog function and can also act as normal digital
• Pads marked green can be powered externally or internally via VDD_SDIO (see below).
Without an external power supply, the internal regulator will supply VDD_SDIO. The VDD_SDIO voltage can be
configured to be either 1.8V or the same as VDD3P3_RTC, depending on the state of the MTDI pad at reset –
a high level configures 1.8V and a low level configures the voltage to be the same as VDD3P3_RTC. Setting the
efuse bit determines the default voltage of the VDD_SDIO. In addition, software can change the voltage of the
VDD_SDIO by configuring register bits.
Direct I/O in IO_MUX ”YES” means that this signal is also available directly via IO_MUX. To apply the GPIO Matrix
to these signals, their corresponding SIG_IN_SEL register must be cleared.
GPIO Pad Name Function 1 Function 2 Function 3 Function 4 Function 5 Function 6 Reset Notes
0 GPIO0 GPIO0 CLK_OUT1 GPIO0 - - EMAC_TX_CLK 3 R
1 U0TXD U0TXD CLK_OUT3 GPIO1 - - EMAC_RXD2 3 -
2 GPIO2 GPIO2 HSPIWP GPIO2 HS2_DATA0 SD_DATA0 - 2 R
3 U0RXD U0RXD CLK_OUT2 GPIO3 - - - 3 -
4 GPIO4 GPIO4 HSPIHD GPIO4 HS2_DATA1 SD_DATA1 EMAC_TX_ER 2 R
5 GPIO5 GPIO5 VSPICS0 GPIO5 HS1_DATA6 - EMAC_RX_CLK 3 -
6 SD_CLK SD_CLK SPICLK GPIO6 HS1_CLK U1CTS - 3 -
7 SD_DATA_0 SD_DATA0 SPIQ GPIO7 HS1_DATA0 U2RTS - 3 -
8 SD_DATA_1 SD_DATA1 SPID GPIO8 HS1_DATA1 U2CTS - 3 -
9 SD_DATA_2 SD_DATA2 SPIHD GPIO9 HS1_DATA2 U1RXD - 3 -
10 SD_DATA_3 SD_DATA3 SPIWP GPIO10 HS1_DATA3 U1TXD - 3 -
11 SD_CMD SD_CMD SPICS0 GPIO11 HS1_CMD U1RTS - 3 -
12 MTDI MTDI HSPIQ GPIO12 HS2_DATA2 SD_DATA2 EMAC_TXD3 2 R
13 MTCK MTCK HSPID GPIO13 HS2_DATA3 SD_DATA3 EMAC_RX_ER 2 R
14 MTMS MTMS HSPICLK GPIO14 HS2_CLK SD_CLK EMAC_TXD2 3 R
15 MTDO MTDO HSPICS0 GPIO15 HS2_CMD SD_CMD EMAC_RXD3 3 R
16 GPIO16 GPIO16 - GPIO16 HS1_DATA4 U2RXD EMAC_CLK_OUT 1 -
17 GPIO17 GPIO17 - GPIO17 HS1_DATA5 U2TXD EMAC_CLK_180 1 -
18 GPIO18 GPIO18 VSPICLK GPIO18 HS1_DATA7 - - 1 -
19 GPIO19 GPIO19 VSPIQ GPIO19 U0CTS - EMAC_TXD0 1 -
21 GPIO21 GPIO21 VSPIHD GPIO21 - - EMAC_TX_EN 1 -
22 GPIO22 GPIO22 VSPIWP GPIO22 U0RTS - EMAC_TXD1 1 -
23 GPIO23 GPIO23 VSPID GPIO23 HS1_STROBE - - 1 -
25 GPIO25 GPIO25 - GPIO25 - - EMAC_RXD0 0 R
26 GPIO26 GPIO26 - GPIO26 - - EMAC_RXD1 0 R
27 GPIO27 GPIO27 - GPIO27 - - EMAC_RX_DV 0 R
32 32K_XP GPIO32 - GPIO32 - - - 0 R
33 32K_XN GPIO33 - GPIO33 - - - 0 R
34 VDET_1 GPIO34 - GPIO34 - - - 0 R, I
35 VDET_2 GPIO35 - GPIO35 - - - 0 R, I
36 SENSOR_VP GPIO36 - GPIO36 - - - 0 R, I
37 SENSOR_CAPP GPIO37 - GPIO37 - - - 0 R, I
38 SENSOR_CAPN GPIO38 - GPIO38 - - - 0 R, I
39 SENSOR_VN GPIO39 - GPIO39 - - - 0 R, I
Reset Configurations
Notes
• I - Pad can only be configured as input GPIO. These input-only pads do not feature an output driver or
internal pull-up/pull-down circuitry.
Please refer to the ESP32 Pin Lists in ESP32 Datasheet for more details.
4.13 Registers
Register 4.1. GPIO_OUT_REG (0x0004)
31 0
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x Reset
31 0
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x Reset
GPIO_OUT_W1TS_REG GPIO0-31 output set register. For every bit that is 1 in the value written here,
the corresponding bit in GPIO_OUT_REG will be set. (WO)
31 0
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x Reset
GPIO_OUT_W1TC_REG GPIO0-31 output clear register. For every bit that is 1 in the value written
here, the corresponding bit in GPIO_OUT_REG will be cleared. (WO)
_O
e
rv
O
se
PI
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x x x x x x x x Reset
TA
_ DA
UT
d)
_O
ve
er
O
s
PI
(re
G
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x x x x x x x x Reset
GPIO_OUT_DATA GPIO32-39 output value set register. For every bit that is 1 in the value written
here, the corresponding bit in GPIO_OUT1_DATA will be set. (WO)
A
AT
_D
UT
d)
_O
e
rv
O
se
PI
(re
G
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x x x x x x x x Reset
GPIO_OUT_DATA GPIO32-39 output value clear register. For every bit that is 1 in the value written
here, the corresponding bit in GPIO_OUT1_DATA will be cleared. (WO)
31 0
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x Reset
31 0
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x Reset
GPIO_ENABLE_W1TS_REG GPIO0-31 output enable set register. For every bit that is 1 in the value
written here, the corresponding bit in GPIO_ENABLE will be set. (WO)
31 0
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x Reset
GPIO_ENABLE_W1TC_REG GPIO0-31 output enable clear register. For every bit that is 1 in the
value written here, the corresponding bit in GPIO_ENABLE will be cleared. (WO)
TA
DA
E_
BL
NA
d)
_E
e
rv
O
se
PI
(re
G
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x x x x x x x x Reset
TA
DA
E_
BL
NA
d)
_E
r ve
O
se
PI
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x x x x x x x x Reset
GPIO_ENABLE_DATA GPIO32-39 output enable set register. For every bit that is 1 in the value written
here, the corresponding bit in GPIO_ENABLE1 will be set. (WO)
_E
rv
O
se
PI
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x x x x x x x x Reset
GPIO_ENABLE_DATA GPIO32-39 output enable clear register. For every bit that is 1 in the value
written here, the corresponding bit in GPIO_ENABLE1 will be cleared. (WO)
G
IN
P
AP
TR
d)
_S
ve
er
O
s
PI
(re
G
31 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x x x x x x x x x x x x x x x x Reset
31 0
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x Reset
GPIO_IN_REG GPIO0-31 input value. Each bit represents a pad input value, 1 for high level and 0
for low level. (RO)
EXT
_N
TA
DA
N_
)
ed
_I
rv
O
se
PI
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x x x x x x x x Reset
GPIO_IN_DATA_NEXT GPIO32-39 input value. Each bit represents a pad input value. (RO)
31 0
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x Reset
GPIO_STATUS_REG GPIO0-31 interrupt status register. Each bit can be either of the two interrupt
sources for the two CPUs. The enable bits in GPIO_STATUS_INTERRUPT, corresponding to the
0-4 bits in GPIO_PINn_REG should be set to 1. (R/W)
31 0
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x Reset
GPIO_STATUS_W1TS_REG GPIO0-31 interrupt status set register. For every bit that is 1 in the value
written here, the corresponding bit in GPIO_STATUS_INTERRUPT will be set. (WO)
31 0
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x Reset
GPIO_STATUS_W1TC_REG GPIO0-31 interrupt status clear register. For every bit that is 1 in the
value written here, the corresponding bit in GPIO_STATUS_INTERRUPT will be cleared. (WO)
T
UP
RR
TE
IN
S_
TU
TA
d)
_S
rve
O
se
PI
(re
G
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x x x x x x x x Reset
_S
rv
O
se
PI
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x x x x x x x x Reset
GPIO_STATUS_INTERRUPT GPIO32-39 interrupt status set register. For every bit that is 1 in the
value written here, the corresponding bit in GPIO_STATUS_INTERRUPT1 will be set. (WO)
T
UP
RR
TE
IN
S_
TU
TA
)
ed
_S
rv
O
se
PI
(re
G
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x x x x x x x x Reset
GPIO_STATUS_INTERRUPT GPIO32-39 interrupt status clear register. For every bit that is 1 in the
value written here, the corresponding bit in GPIO_STATUS_INTERRUPT1 will be cleared. (WO)
31 0
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x Reset
31 0
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x Reset
31 0
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x Reset
31 0
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x Reset
T
IN
U_
CP
PP
d)
_A
ve
er
O
s
PI
(re
G
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x x x x x x x x Reset
T
IN
I_
NM
U_
CP
PP
)
ed
_A
rv
O
se
PI
(re
G
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x x x x x x x x Reset
T
IN
U_
CP
RO
d)
_P
rve
O
se
PI
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x x x x x x x x Reset
_P
rve
O
se
PI
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x x x x x x x x Reset
LE
AB
EN
R
VE
P_
PE
RI
NA
EU
TY
_D
_E
AK
T_
ed AD
NT
IN
W
P
I
n_
n_
n_
n_
IN
IN
IN
IN
d)
)
ed
ed
_P
_P
_P
_P
ve
rv
rv
rv
er
O
se
se
se
s
PI
PI
PI
PI
(re
(re
(re
(re
G
G
31 18 17 13 12 11 10 9 7 6 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 x x x x x 0 0 x x x x 0 0 0 0 x 0 0 Reset
GPIO_PINn_WAKEUP_ENABLE GPIO wake-up enable will only wake up the CPU from Light-sleep.
(R/W)
L
SE
IN
_I L
Cy SE
N_
N_
UN N_
_I
Cy
_F _I
O y
UN
PI IG
)
ed
G _S
_F
rv
O
se
PI
PI
(re
31 8 7 6 5 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x x x x x x x x Reset
GPIO_SIGy_IN_SEL Bypass the GPIO Matrix. 1: route through GPIO Matrix, 0: connect signal di-
rectly to peripheral configured in the IO_MUX. (R/W)
GPIO_FUNCy_IN_SEL Selection control for peripheral input y. A value of 0-39 selects which of the
40 GPIO Matrix input pins this signal is connected to, or 0x38 for a constantly high input or 0x30
for a constantly low input. (R/W)
UT EL EL
EL
_O _S _S
_S
EL
Cn EN INV
NV
_S
_I
UN _O _
_F Cn EN
UT
O N O
_O
PI U _
G _F C n
Cn
O N
UN
)
PI U
ed
G _F
_F
rv
O
se
PI
PI
(re
G
31 12 11 10 9 8 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x x x x x x x x x x x x Reset
GPIO_FUNCn_OEN_INV_SEL 1: Invert the output enable signal; 0: do not invert the output enable
signal. (R/W)
GPIO_FUNCn_OUT_INV_SEL 1: Invert the output value; 0: do not invert the output value. (R/W)
K2
1
LK
LK
L
_C
_C
_C
RL
RL
RL
d)
ve
CT
CT
CT
r
se
N_
N_
N_
(re
PI
PI
PI
31 12 11 8 7 4 3 0
Note:
Only the above mentioned combinations of clock source and clock output pins are possible.
The CLK_OUT1-3 can be found in the IO_MUX Pad Summary.
SL _W U
M _SE D
CU V
N_ PU
CU D
L
FU R V
CU P
P P
)
CU L
E
ed
P
E
M _W
M _IE
_O
_D
_S
FU _W
W
FU IE
D
rv
N_
N_
CU
CU
se
N
FU
(re
M
31 15 14 12 11 10 9 8 7 6 5 4 3 2 1 0
MCU_SEL Select the IO_MUX function for this signal. 0 selects Function 1, 1 selects Function 2, etc.
(R/W)
FUN_DRV Select the drive strength of the pad. A higher value corresponds with a higher strength.
For GPIO34-39, FUN_DRV is always 0. For detailed drive strength, please see note 8 in Table
”Notes on ESP32 Pin Lists”, in ESP32 Datasheet. (R/W)
FUN_IE Input enable of the pad. 1: input enabled; 0: input disabled. (R/W)
[FUN_WPU]Pull-up enable of the pad. 1: internal pull-up enabled; 0: internal pull-up disabled.
GPIO pins 34-39 are input-only. These pins do not feature an output driver or internal pull- up/pull-
down circuitry, therefore, their FUN_WPU is always 0. (R/W)
MCU_DRV Select the drive strength of the pad during sleep mode. A higher value corresponds with
a higher strength. (R/W)
MCU_IE Input enable of the pad during sleep mode. 1: input enabled; 0: input disabled. (R/W)
MCU_WPU Pull-up enable of the pad during sleep mode. 1: internal pull-up enabled; 0: internal
pull-up disabled. (R/W)
MCU_WPD Pull-down enable of the pad during sleep mode. 1: internal pull-down enabled; 0: internal
pull-down disabled. (R/W)
SLP_SEL Sleep mode selection of this pad. Set to 1 to put the pad in sleep mode. (R/W)
MCU_OE Output enable of the pad in sleep mode. 1: enable output; 0: disable output. (R/W)
A
AT
_D
UT
_O
O
PI
_ G
TC
)
_R
ed
rv
O
CI
se
RT
(re
31 14 13 0
x x x x x x x x x x x x x x x x x x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
)
_R
ed
rv
O
CI
se
RT
31 14 13 (re 0
x x x x x x x x x x x x x x x x x x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTCIO_RTC_GPIO_OUT_DATA_W1TS GPIO0-17 output set register. For every bit that is 1 in the
value written here, the corresponding bit in RTCIO_RTC_GPIO_OUT will be set. (WO)
)
_R
ed
rv
O
CI
se
RT
(re
31 14 13 0
x x x x x x x x x x x x x x x x x x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTCIO_RTC_GPIO_OUT_DATA_W1TC GPIO0-17 output clear register. For every bit that is 1 in the
value written here, the corresponding bit in RTCIO_RTC_GPIO_OUT will be cleared. (WO)
E
BL
NA
_E
O
PI
_G
TC
)
_R
ed
rv
O
CI
se
RT
(re
31 14 13 0
x x x x x x x x x x x x x x x x x x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
)
_R
ed
rv
O
CI
se
RT
(re
31 14 13 0
x x x x x x x x x x x x x x x x x x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTCIO_RTC_GPIO_ENABLE_W1TS GPIO0-17 output enable set register. For every bit that is 1 in
the value written here, the corresponding bit in RTCIO_RTC_GPIO_ENABLE will be set. (WO)
d)
_R
e
rv
O
CI
se
RT
(re
31 14 13 0
x x x x x x x x x x x x x x x x x x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTCIO_RTC_GPIO_ENABLE_W1TC GPIO0-17 output enable clear register. For every bit that is 1 in
the value written here, the corresponding bit in RTCIO_RTC_GPIO_ENABLE will be cleared. (WO)
NT
S _I
TU
TA
_S
O
PI
_G
TC
)
_R
ed
rv
O
CI
se
RT
(re
31 14 13 0
x x x x x x x x x x x x x x x x x x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
)
_R
ed
rv
O
CI
se
RT
(re
31 14 13 0
x x x x x x x x x x x x x x x x x x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
d)
_R
e
rv
O
CI
se
RT
(re
31 14 13 0
x x x x x x x x x x x x x x x x x x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
XT
NE
N_
_I
O
PI
_G
TC
)
_R
ed
rv
O
CI
se
RT
(re
31 14 13 0
x x x x x x x x x x x x x x x x x x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTCIO_RTC_GPIO_IN_NEXT GPIO0-17 input value. Bit14 is GPIO[0], bit15 is GPIO[1], etc. Each
bit represents a pad input value, 1 for high level, and 0 for low level. (RO)
LE
AB
EN
ER
P_
IV
PE
R
EU
TY
_D
AK
T_
D
PA
IN
W
n_
n_
n_
IN
IN
IN
_P
_P
_P
O
O
PI
PI
PI
_G
_G
G
C_
TC
TC
T
)
d)
_R
_R
_R
ed
ed
e
rv
rv
rv
O
O
CI
CI
CI
se
se
se
RT
RT
RT
(re
(re
(re
31 11 10 9 7 6 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x x x x 0 0 0 0 x 0 0 Reset
31 0
0 Reset
RTCIO_DIG_PAD_HOLD_REG Selects the digital pads which should be put on hold. While 0 allows
normal operation, 1 puts the pad on hold. (R/W)
Name Description
Bit[0] Set to 1 to enable the Hold function of pad U0RTD
Bit[1] Set to 1 to enable the Hold function of pad U0TXD
Bit[2] Set to 1 to enable the Hold function of pad
SD_CLK
Bit[3] Set to 1 to enable the Hold function of pad
SD_DATA0
Bit[4] Set to 1 to enable the Hold function of pad
SD_DATA1
Bit[5] Set to 1 to enable the Hold function of pad
SD_DATA2
Bit[6] Set to 1 to enable the Hold function of pad
SD_DATA3
Bit[7] Set to 1 to enable the Hold function of pad
SD_CMD
Bit[8] Set to 1 to enable the Hold function of pad GPIO5
Bit[9] Set to 1 to enable the Hold function of pad GPIO16
Bit[10] Set to 1 to enable the Hold function of pad GPIO17
Bit[11] Set to 1 to enable the Hold function of pad GPIO18
Bit[12] Set to 1 to enable the Hold function of pad GPIO19
Bit[13] Set to 1 to enable the Hold function of pad GPIO20
Bit[14] Set to 1 to enable the Hold function of pad GPIO21
Bit[15] Set to 1 to enable the Hold function of pad GPIO22
Bit[16] Set to 1 to enable the Hold function of pad GPIO23
AS LL
PH HA
E
L_ D_
AL XP
_H _
O LL
CI HA
)
ed
RT IO_
rv
se
C
RT
(re
31 30 29 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EN _S SE SLP L
EL
E3 LP EL
E4 LP EL
EN _S SE U SE
SE U SE
1_ _SE
SE
SE SL SE
S S SE
2_ _IE
3_ _IE
IE
E
RT IO_ NS SEN _M _S
FU IE
_F _IE
S
_S
NS 3_S _S
NS 4_S _S
RT IO_ NS R_S NSE _HO D
RT IO_ NS R_S NSE _HO D
CI SE OR EN 4_ LD
EN R EN 1_ LD
_I
_S OR EN 2_M X_
N_
N_
N_
_
EN 1_ _
EN 2_ P_
_
C SE O E 2 L
C SE O E 3 L
UN
UN
P
SE E LP
S _S SE MU
RT IO_ NS R_S NSE _HO
_S SO S E O
FU
FU
FU
EN _S SE SL
EN _S SE SL
O N _ S H
F
R N _
R N _
4_
C SE O E 1
3
RT IO_ NS R_S NSE
SO _S SE
SE
SO _S SE
CI SE OR NSE
SO _S SE
SE
SO _S SE
EN R EN
EN R EN
EN R EN
N
EN R EN
C SE O E
E
E
RT IO_ NS R_S
_S SO S
_S SO S
_S SO S
_S SO S
C E R_
O N _
C SE R_
O N _
O N _
C SE R_
O N _
CI SE OR
CI SE OR
CI SE OR
C SE O
SO
RT IO_ NS
RT _ S N
C SE
)
S
_S
_S
_S
ed
RT IO_
RT IO_
R T O_
R T O_
RT IO_
rv
O
O
CI
CI
CI
CI
CI
CI
se
C
C
RT
RT
RT
RT
RT
RT
RT
RT
RT
(re
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTCIO_SENSOR_SENSEn_HOLD Set to 1 to hold the output value on sensen; 0 is for normal op-
eration. (R/W)
RTCIO_SENSOR_SENSEn_FUN_SEL Select the RTC IO_MUX function for this pad. 0: select Func-
tion 0; 1: select Function 1. (R/W)
RTCIO_SENSOR_SENSEn_SLP_SEL Selection of sleep mode for the pad: set to 1 to put the pad
in sleep mode. (R/W)
C1 X_ L
_F SEL
EL
EL
DC C1 LP_ EL
2_ P_ L
U E
DC SL SE
_F E
IE
M _S
AD FUN IE
FU IE
_S
_S
D S S
DC D _H D
_A ADC _M D
_I
N_
_A 1_ P_
_A 2_ P_
2_ UX
_A _A 2 L
_ C1 OL
UN
UN
O C C O
L
CI AD AD _H
DC D _S
DC D _S
_
RT IO_ C_ C1
_A _A 1
C2
_A _A 2
O C C
C
O C C
C
C AD AD
RT IO_ _AD
CI AD AD
CI AD AD
RT O_ C_
RT _ _
RT O_ C_
DC
C
CI AD
CI AD
CI AD
)
_A
ed
RT IO_
RT O_
rv
O
O
CI
CI
CI
se
C
C
RT
RT
RT
RT
RT
(re
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTCIO_ADC_ADCn_HOLD Set to 1 to hold the output value on the pad; 0 is for normal operation.
(R/W)
RTCIO_ADC_ADCn_FUN_SEL Select the RTC function for this pad. 0: select Function 0; 1: select
Function 1. (R/W)
RTCIO_ADC_ADCn_SLP_SEL Signal selection of pad’s sleep mode. Set this bit to 1 to put the pad
to sleep. (R/W)
RTCIO_ADC_ADCn_SLP_IE Input enable of the pad in sleep mode. 1 enabled; 0 disabled. (R/W)
E
RC
O
_F
C1 X_ C
PD
_F SEL
EL
_P P 1 P L
U A
C1 UN E
O D_ AC SL SE
AC E
_P C LP E
_X
_P 1_M _D
_S
DA 1_F _O
DA 1_R LD
_D _I
AD DA _S _I
CI PA PD 1_ P_
AC
O D_ AC RV
C1 DE
UE
UN
AD AC XPD
_P C O
RT O_ D_ AC SL
AD DA _H
_D
_D
_R
D 1_
CI PA PD 1_
C1
_P P 1
C1
_P C
RT _ _ C
DA
DA
AD DA
DA
A
CI PA PD
CI PA PD
_P
_P
_P P
RT O_ D_
O D_
RT IO_ D_
AD
AD
D
CI PA
CI PA
C A
)
_P
_P
_P
ed
RT O_
R T O_
R T O_
rv
O
O
CI
CI
CI
CI
CI
CI
se
RT
RT
RT
RT
RT
RT
(re
31 30 29 28 27 26 19 18 17 16 15 14 13 12 11 10 9 0
2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTCIO_PAD_PDAC1_HOLD Set to 1 to hold the output value on the pad; set to 0 for normal oper-
ation. (R/W)
RTCIO_PAD_PDAC1_SLP_SEL Sleep mode selection signal of the pad. Set this bit to 1 to put the
pad to sleep. (R/W)
RTCIO_PAD_PDAC1_SLP_IE Input enable of the pad in sleep mode. 1: enabled; 0: disabled. (R/W)
E
RC
O
_F
C2 X_ C
PD
_F SEL
EL
_P P 2 P L
U A
C2 UN E
O D_ AC SL SE
AC E
_P C LP E
_X
_P 2_M _D
_S
DA 2_F _O
DA 2_R LD
_D _I
AD DA _S _I
CI PA PD 2_ P_
AC
O D_ AC RV
C2 DE
UE
UN
AD AC XPD
_P C O
RT O_ D_ AC SL
AD DA _H
_D
_D
_R
D 2_
CI PA PD 2_
C2
_P P 2
C2
_P C
RT _ _ C
DA
DA
AD DA
DA
A
CI PA PD
CI PA PD
_P
_P
_P P
RT O_ D_
O D_
RT IO_ D_
AD
AD
D
CI PA
CI PA
C A
)
_P
_P
_P
ed
RT O_
R T O_
R T O_
rv
O
O
CI
CI
CI
CI
CI
CI
se
RT
RT
RT
RT
RT
RT
(re
31 30 29 28 27 26 19 18 17 16 15 14 13 12 11 10 9 0
2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTCIO_PAD_PDAC2_HOLD Set to 1 to hold the output value on the pad; 0 is for normal operation.
(R/W)
RTCIO_PAD_PDAC2_FUN_SEL Select the RTC function for this pad. 0: select Function 0; 1: select
Function 1. (R/W)
RTCIO_PAD_PDAC2_SLP_SEL Sleep mode selection signal of the pad. Set this bit to 1 to put the
pad to sleep. (R/W)
RTCIO_PAD_PDAC2_SLP_IE Input enable of the pad in sleep mode. 1: enabled; 0: disabled. (R/W)
K
K
2N X_S L
32
UN L
EL
2K
O AL 2 LP L
L_ 2N LP L
32
2P U 2K
L_ 2P LP L
U SE
E
U E
DR UN E
TA X3 _S SE
TA 3 S SE
E
L_
E
X3 _S _IE
_S
_F _O
X3 _S _IE
_S
_F _O
_3
L_
X3 _M 3
X3 _R D
2P N_I
X3 _R D
_M X_
_I
_X _ N P_
_
_X _ P_ _
TA
L_ 2N OL
RV
2N DE
2P E
L_ 2P OL
RV
TA
2P DE
UE
CI XT _XP TAL
UN
2N LP
L_ 2N AL
2P LP
U
O AL 2 L
_X
_X
TA 3 H
_D
_R
TA 3 H
TA X3 XT
CI XT _X3 _S
_D
_R
CI XT _X3 _S
_F
_F
X
_
AS
_X _ P_
ES
C_
2N
_X _ N
_X _ _
R T _ L 2N
RT O_ AL 2P
O AL D
O AL 2
O AL 2
BI
DA
X3
CI T X3
X3
CI XT _X3
X3
CI XT _X3
X3
CI XT _X3
_D
X
X
L_
L_
L_
L_
L_
L_
RT O_ AL
RT O_ AL
RT O_ AL
RT O_ AL
RT _ L
L
TA
TA
TA
TA
TA
TA
TA
CI XT
CI XT
CI XT
CI T
CI XT
)
ed
_X
_X
_X
_X
_X
_X
_X
RT O_
RT _
RT _
RT _
RT IO_
rv
O
O
CI
CI
CI
CI
CI
CI
CI
CI
CI
CI
CI
se
C
RT
RT
RT
RT
RT
RT
RT
RT
RT
RT
RT
RT
(re
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2 0 0 0 2 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 Reset
RTCIO_XTAL_X32N_HOLD Set to 1 to hold the output value on the pad; 0 is for normal operation.
(R/W)
RTCIO_XTAL_X32P_HOLD Set to 1 to hold the output value on the pad, 0 is for normal operation.
(R/W)
RTCIO_XTAL_X32N_MUX_SEL 0: route X32N pad to the digital IO_MUX; 1: route to RTC block.
(R/W)
RTCIO_XTAL_X32P_MUX_SEL 0: route X32P pad to the digital IO_MUX; 1: route to RTC block.
(R/W)
RTCIO_XTAL_X32N_SLP_SEL Sleep mode selection. Set this bit to 1 to put the pad to sleep. (R/W)
RTCIO_XTAL_X32N_SLP_IE Input enable of the pad in sleep mode. 1: enabled; 0: disabled. (R/W)
RTCIO_XTAL_X32P_SLP_SEL Sleep mode selection. Set this bit to 1 to put the pad to sleep. (R/W)
RTCIO_XTAL_X32P_SLP_IE Input enable of the pad in sleep mode. 1: enabled; 0: disabled. (R/W)
E
G
H_ _BI
FL
UR
AN
EF
RE
UC PD
DC
DR
D
X
H_
H_
H_
H_
UC
UC
UC
UC
O
)
ed
_T
_T
_T
_T
_T
rv
O
O
CI
CI
CI
CI
CI
se
RT
RT
RT
RT
RT
(re
31 30 29 28 27 26 25 24 23 22 0
0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTCIO_TOUCH_XPD_BIAS Touch sensor bias power on bit. 1: power on; 0: disabled. (R/W)
RTCIO_TOUCH_DCUR Touch sensor bias current. When BIAS_SLEEP is enabled, this setting is
available. (R/W)
EL
IO
UC AD XPD PT
Dn _GP
_S
UC P _T T
P _ O
O H_ Dn AR
AC
UN
H_ ADn IE_
O
_T C A ST
_D
H_ n_T
_F
O U P _
Dn
CI TO H_ Dn
PA
RT IO_ UC _PA
PA
H_
C O H
UC
RT _ UC
O
CI TO
O
d)
)
ed
_T
_T
ve
RT O_
rv
O
O
er
CI
CI
CI
se
s
RT
RT
RT
(re
(re
31 26 25 23 22 21 20 19 18 17 16 0
0 0 0 0 0 0 0x4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTCIO_TOUCH_PADn_DAC Touch sensor slope control. 3-bit for each touch pad, defaults to 100.
(R/W)
RTCIO_TOUCH_PADn_TIE_OPT Default touch sensor tie option. 0: tie low; 1: tie high. (R/W)
RTCIO_TOUCH_PADn_TO_GPIO Connect the RTC pad input to digital pad input; 0 is available.
(R/W)
d)
_E
e
rv
O
CI
se
RT
(re
31 27 26 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTCIO_EXT_WAKEUP0_SEL GPIO[0-17] can be used to wake up the chip when the chip is in the
sleep mode. This register prompts the pad source to wake up the chip when the latter is in
deep/light sleep mode. 0: select GPIO0; 1: select GPIO2, etc. (R/W)
EL
_S
C TR
X T_
_E
TL
d)
_X
ve
O
er
CI
s
RT
(re
31 27 26 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTCIO_XTL_EXT_CTR_SEL Select the external crystal power down enable source to get into
sleep mode. 0: select GPIO0; 1: select GPIO2, etc. The input value on this pin XOR
RTC_CNTL_XTL_EXT_CTR_LV is the crystal power down enable signal. (R/W)
EL
SE
_S
A_
CL
SD
_S
C_
2C
I2
_I
R_
AR
A
d)
_S
_S
ve
O
r
CI
CI
se
RT
RT
(re
31 30 29 28 27 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTCIO_SAR_I2C_SDA_SEL Selects the other pad as the RTC I2C SDA signal. 0: pad
TOUCH_PAD[1]; 1: pad TOUCH_PAD[3]. Default value is 0. (R/W)
RTCIO_SAR_I2C_SCL_SEL Selects the other pad as the RTC I2C SCL signal. 0: pad
TOUCH_PAD[0]; 1: pad TOUCH_PAD[2]. Default value is 0. (R/W)
5 DPort Registers
5.1 Introduction
The ESP32 integrates a large number of peripherals, and enables the control of individual peripherals to achieve
optimal characteristics in performance-vs-power-consumption scenarios. The DPort registers control clock man-
agement (clock gating), power management, and the configuration of peripherals and core-system modules. The
system arranges each module with configuration registers contained in the DPort Register.
5.2 Features
DPort registers correspond to different peripheral blocks and core modules:
• Interrupt matrix
• DMA
• PID/MPU/MMU
• APP_CPU
• DPORT_PRO_BOOT_REMAP_CTRL_REG
• DPORT_APP_BOOT_REMAP_CTRL_REG
• DPORT_CACHE_MUX_MODE_REG
• DPORT_CPU_PER_CONF_REG
• DPORT_CPU_INTR_FROM_CPU_0_REG
• DPORT_CPU_INTR_FROM_CPU_1_REG
• DPORT_CPU_INTR_FROM_CPU_2_REG
• DPORT_CPU_INTR_FROM_CPU_3_REG
• DPORT_PRO_INTR_STATUS_0_REG
• DPORT_PRO_INTR_STATUS_1_REG
• DPORT_PRO_INTR_STATUS_2_REG
• DPORT_APP_INTR_STATUS_0_REG
• DPORT_APP_INTR_STATUS_1_REG
• DPORT_APP_INTR_STATUS_2_REG
• DPORT_PRO_MAC_INTR_MAP_REG
• DPORT_PRO_MAC_NMI_MAP_REG
• DPORT_PRO_BB_INT_MAP_REG
• DPORT_PRO_BT_MAC_INT_MAP_REG
• DPORT_PRO_BT_BB_INT_MAP_REG
• DPORT_PRO_BT_BB_NMI_MAP_REG
• DPORT_PRO_RWBT_IRQ_MAP_REG
• DPORT_PRO_RWBLE_IRQ_MAP_REG
• DPORT_PRO_RWBT_NMI_MAP_REG
• DPORT_PRO_RWBLE_NMI_MAP_REG
• DPORT_PRO_SLC0_INTR_MAP_REG
• DPORT_PRO_SLC1_INTR_MAP_REG
• DPORT_PRO_UHCI0_INTR_MAP_REG
• DPORT_PRO_UHCI1_INTR_MAP_REG
• DPORT_PRO_TG_T0_LEVEL_INT_MAP_REG
• DPORT_PRO_TG_T1_LEVEL_INT_MAP_REG
• DPORT_PRO_TG_WDT_LEVEL_INT_MAP_REG
• DPORT_PRO_TG_LACT_LEVEL_INT_MAP_REG
• DPORT_PRO_TG1_T0_LEVEL_INT_MAP_REG
• DPORT_PRO_TG1_T1_LEVEL_INT_MAP_REG
• DPORT_PRO_TG1_WDT_LEVEL_INT_MAP_REG
• DPORT_PRO_TG1_LACT_LEVEL_INT_MAP_REG
• DPORT_PRO_GPIO_INTERRUPT_MAP_REG
• DPORT_PRO_GPIO_INTERRUPT_NMI_MAP_REG
• DPORT_PRO_CPU_INTR_FROM_CPU_0_MAP_REG
• DPORT_PRO_CPU_INTR_FROM_CPU_1_MAP_REG
• DPORT_PRO_CPU_INTR_FROM_CPU_2_MAP_REG
• DPORT_PRO_CPU_INTR_FROM_CPU_3_MAP_REG
• DPORT_PRO_SPI_INTR_0_MAP_REG
• DPORT_PRO_SPI_INTR_1_MAP_REG
• DPORT_PRO_SPI_INTR_2_MAP_REG
• DPORT_PRO_SPI_INTR_3_MAP_REG
• DPORT_PRO_I2S0_INT_MAP_REG
• DPORT_PRO_I2S1_INT_MAP_REG
• DPORT_PRO_UART_INTR_MAP_REG
• DPORT_PRO_UART1_INTR_MAP_REG
• DPORT_PRO_UART2_INTR_MAP_REG
• DPORT_PRO_SDIO_HOST_INTERRUPT_MAP_REG
• DPORT_PRO_EMAC_INT_MAP_REG
• DPORT_PRO_PWM0_INTR_MAP_REG
• DPORT_PRO_PWM1_INTR_MAP_REG
• DPORT_PRO_PWM2_INTR_MAP_REG
• DPORT_PRO_PWM3_INTR_MAP_REG
• DPORT_PRO_LEDC_INT_MAP_REG
• DPORT_PRO_EFUSE_INT_MAP_REG
• DPORT_PRO_CAN_INT_MAP_REG
• DPORT_PRO_RTC_CORE_INTR_MAP_REG
• DPORT_PRO_RMT_INTR_MAP_REG
• DPORT_PRO_PCNT_INTR_MAP_REG
• DPORT_PRO_I2C_EXT0_INTR_MAP_REG
• DPORT_PRO_I2C_EXT1_INTR_MAP_REG
• DPORT_PRO_RSA_INTR_MAP_REG
• DPORT_PRO_SPI1_DMA_INT_MAP_REG
• DPORT_PRO_SPI2_DMA_INT_MAP_REG
• DPORT_PRO_SPI3_DMA_INT_MAP_REG
• DPORT_PRO_WDG_INT_MAP_REG
• DPORT_PRO_TIMER_INT1_MAP_REG
• DPORT_PRO_TIMER_INT2_MAP_REG
• DPORT_PRO_TG_T0_EDGE_INT_MAP_REG
• DPORT_PRO_TG_T1_EDGE_INT_MAP_REG
• DPORT_PRO_TG_WDT_EDGE_INT_MAP_REG
• DPORT_PRO_TG_LACT_EDGE_INT_MAP_REG
• DPORT_PRO_TG1_T0_EDGE_INT_MAP_REG
• DPORT_PRO_TG1_T1_EDGE_INT_MAP_REG
• DPORT_PRO_TG1_WDT_EDGE_INT_MAP_REG
• DPORT_PRO_TG1_LACT_EDGE_INT_MAP_REG
• DPORT_PRO_MMU_IA_INT_MAP_REG
• DPORT_PRO_MPU_IA_INT_MAP_REG
• DPORT_PRO_CACHE_IA_INT_MAP_REG
• DPORT_APP_MAC_INTR_MAP_REG
• DPORT_APP_MAC_NMI_MAP_REG
• DPORT_APP_BB_INT_MAP_REG
• DPORT_APP_BT_MAC_INT_MAP_REG
• DPORT_APP_BT_BB_INT_MAP_REG
• DPORT_APP_BT_BB_NMI_MAP_REG
• DPORT_APP_RWBT_IRQ_MAP_REG
• DPORT_APP_RWBLE_IRQ_MAP_REG
• DPORT_APP_RWBT_NMI_MAP_REG
• DPORT_APP_RWBLE_NMI_MAP_REG
• DPORT_APP_SLC0_INTR_MAP_REG
• DPORT_APP_SLC1_INTR_MAP_REG
• DPORT_APP_UHCI0_INTR_MAP_REG
• DPORT_APP_UHCI1_INTR_MAP_REG
• DPORT_APP_TG_T0_LEVEL_INT_MAP_REG
• DPORT_APP_TG_T1_LEVEL_INT_MAP_REG
• DPORT_APP_TG_WDT_LEVEL_INT_MAP_REG
• DPORT_APP_TG_LACT_LEVEL_INT_MAP_REG
• DPORT_APP_TG1_T0_LEVEL_INT_MAP_REG
• DPORT_APP_TG1_T1_LEVEL_INT_MAP_REG
• DPORT_APP_TG1_WDT_LEVEL_INT_MAP_REG
• DPORT_APP_TG1_LACT_LEVEL_INT_MAP_REG
• DPORT_APP_GPIO_INTERRUPT_MAP_REG
• DPORT_APP_GPIO_INTERRUPT_NMI_MAP_REG
• DPORT_APP_CPU_INTR_FROM_CPU_0_MAP_REG
• DPORT_APP_CPU_INTR_FROM_CPU_1_MAP_REG
• DPORT_APP_CPU_INTR_FROM_CPU_2_MAP_REG
• DPORT_APP_CPU_INTR_FROM_CPU_3_MAP_REG
• DPORT_APP_SPI_INTR_0_MAP_REG
• DPORT_APP_SPI_INTR_1_MAP_REG
• DPORT_APP_SPI_INTR_2_MAP_REG
• DPORT_APP_SPI_INTR_3_MAP_REG
• DPORT_APP_I2S0_INT_MAP_REG
• DPORT_APP_I2S1_INT_MAP_REG
• DPORT_APP_UART_INTR_MAP_REG
• DPORT_APP_UART1_INTR_MAP_REG
• DPORT_APP_UART2_INTR_MAP_REG
• DPORT_APP_SDIO_HOST_INTERRUPT_MAP_REG
• DPORT_APP_EMAC_INT_MAP_REG
• DPORT_APP_PWM0_INTR_MAP_REG
• DPORT_APP_PWM1_INTR_MAP_REG
• DPORT_APP_PWM2_INTR_MAP_REG
• DPORT_APP_PWM3_INTR_MAP_REG
• DPORT_APP_LEDC_INT_MAP_REG
• DPORT_APP_EFUSE_INT_MAP_REG
• DPORT_APP_CAN_INT_MAP_REG
• DPORT_APP_RTC_CORE_INTR_MAP_REG
• DPORT_APP_RMT_INTR_MAP_REG
• DPORT_APP_PCNT_INTR_MAP_REG
• DPORT_APP_I2C_EXT0_INTR_MAP_REG
• DPORT_APP_I2C_EXT1_INTR_MAP_REG
• DPORT_APP_RSA_INTR_MAP_REG
• DPORT_APP_SPI1_DMA_INT_MAP_REG
• DPORT_APP_SPI2_DMA_INT_MAP_REG
• DPORT_APP_SPI3_DMA_INT_MAP_REG
• DPORT_APP_WDG_INT_MAP_REG
• DPORT_APP_TIMER_INT1_MAP_REG
• DPORT_APP_TIMER_INT2_MAP_REG
• DPORT_APP_TG_T0_EDGE_INT_MAP_REG
• DPORT_APP_TG_T1_EDGE_INT_MAP_REG
• DPORT_APP_TG_WDT_EDGE_INT_MAP_REG
• DPORT_APP_TG_LACT_EDGE_INT_MAP_REG
• DPORT_APP_TG1_T0_EDGE_INT_MAP_REG
• DPORT_APP_TG1_T1_EDGE_INT_MAP_REG
• DPORT_APP_TG1_WDT_EDGE_INT_MAP_REG
• DPORT_APP_TG1_LACT_EDGE_INT_MAP_REG
• DPORT_APP_MMU_IA_INT_MAP_REG
• DPORT_APP_MPU_IA_INT_MAP_REG
• DPORT_APP_CACHE_IA_INT_MAP_REG
• DPORT_SPI_DMA_CHAN_SEL_REG
• DPORT_PRO_CACHE_CTRL_REG
• DPORT_APP_CACHE_CTRL_REG
• DPORT_IMMU_PAGE_MODE_REG
• DPORT_DMMU_PAGE_MODE_REG
• DPORT_AHB_MPU_TABLE_0_REG
• DPORT_AHB_MPU_TABLE_1_REG
• DPORT_AHBLITE_MPU_TABLE_UART_REG
• DPORT_AHBLITE_MPU_TABLE_SPI1_REG
• DPORT_AHBLITE_MPU_TABLE_SPI0_REG
• DPORT_AHBLITE_MPU_TABLE_GPIO_REG
• DPORT_AHBLITE_MPU_TABLE_FE2_REG
• DPORT_AHBLITE_MPU_TABLE_FE_REG
• DPORT_AHBLITE_MPU_TABLE_TIMER_REG
• DPORT_AHBLITE_MPU_TABLE_RTC_REG
• DPORT_AHBLITE_MPU_TABLE_IO_MUX_REG
• DPORT_AHBLITE_MPU_TABLE_WDG_REG
• DPORT_AHBLITE_MPU_TABLE_HINF_REG
• DPORT_AHBLITE_MPU_TABLE_UHCI1_REG
• DPORT_AHBLITE_MPU_TABLE_I2S0_REG
• DPORT_AHBLITE_MPU_TABLE_UART1_REG
• DPORT_AHBLITE_MPU_TABLE_I2C_EXT0_REG
• DPORT_AHBLITE_MPU_TABLE_UHCI0_REG
• DPORT_AHBLITE_MPU_TABLE_SLCHOST_REG
• DPORT_AHBLITE_MPU_TABLE_RMT_REG
• DPORT_AHBLITE_MPU_TABLE_PCNT_REG
• DPORT_AHBLITE_MPU_TABLE_SLC_REG
• DPORT_AHBLITE_MPU_TABLE_LEDC_REG
• DPORT_AHBLITE_MPU_TABLE_EFUSE_REG
• DPORT_AHBLITE_MPU_TABLE_SPI_ENCRYPT_REG
• DPORT_AHBLITE_MPU_TABLE_PWM0_REG
• DPORT_AHBLITE_MPU_TABLE_TIMERGROUP_REG
• DPORT_AHBLITE_MPU_TABLE_TIMERGROUP1_REG
• DPORT_AHBLITE_MPU_TABLE_SPI2_REG
• DPORT_AHBLITE_MPU_TABLE_SPI3_REG
• DPORT_AHBLITE_MPU_TABLE_APB_CTRL_REG
• DPORT_AHBLITE_MPU_TABLE_I2C_EXT1_REG
• DPORT_AHBLITE_MPU_TABLE_SDIO_HOST_REG
• DPORT_AHBLITE_MPU_TABLE_EMAC_REG
• DPORT_AHBLITE_MPU_TABLE_PWM1_REG
• DPORT_AHBLITE_MPU_TABLE_I2S1_REG
• DPORT_AHBLITE_MPU_TABLE_UART2_REG
• DPORT_AHBLITE_MPU_TABLE_PWM2_REG
• DPORT_AHBLITE_MPU_TABLE_PWM3_REG
• DPORT_AHBLITE_MPU_TABLE_PWR_REG
• DPORT_IMMU_TABLE0_REG
• DPORT_IMMU_TABLE1_REG
• DPORT_IMMU_TABLE2_REG
• DPORT_IMMU_TABLE3_REG
• DPORT_IMMU_TABLE4_REG
• DPORT_IMMU_TABLE5_REG
• DPORT_IMMU_TABLE6_REG
• DPORT_IMMU_TABLE7_REG
• DPORT_IMMU_TABLE8_REG
• DPORT_IMMU_TABLE9_REG
• DPORT_IMMU_TABLE10_REG
• DPORT_IMMU_TABLE11_REG
• DPORT_IMMU_TABLE12_REG
• DPORT_IMMU_TABLE13_REG
• DPORT_IMMU_TABLE14_REG
• DPORT_IMMU_TABLE15_REG
• DPORT_DMMU_TABLE0_REG
• DPORT_DMMU_TABLE1_REG
• DPORT_DMMU_TABLE2_REG
• DPORT_DMMU_TABLE3_REG
• DPORT_DMMU_TABLE4_REG
• DPORT_DMMU_TABLE5_REG
• DPORT_DMMU_TABLE6_REG
• DPORT_DMMU_TABLE7_REG
• DPORT_DMMU_TABLE8_REG
• DPORT_DMMU_TABLE9_REG
• DPORT_DMMU_TABLE10_REG
• DPORT_DMMU_TABLE11_REG
• DPORT_DMMU_TABLE12_REG
• DPORT_DMMU_TABLE13_REG
• DPORT_DMMU_TABLE14_REG
• DPORT_DMMU_TABLE15_REG
• When DPORT_APPCPU_CLKGATE_EN=0, the APP_CPU clock can be disabled to reduce power consump-
tion.
• When APP_CPU is booted up with a ROM code, it will jump to the address stored in the DPORT_APPCPU_
BOOT_ADDR register.
– BIT26, PWM3
– BIT25, PWM2
– BIT23, UART2
– BIT22, SPI_DMA
– BIT21, I2S1
– BIT20, PWM1
– BIT19, CAN
– BIT18, I2C1
– BIT17, PWM0
– BIT16, SPI3
– BIT14, eFuse
– BIT12, UHCI1
– BIT11, LED_PWM
– BIT10, PULSE_CNT
– BIT8, UHCI0
– BIT7, I2C0
– BIT6, SPI2
– BIT5, UART1
– BIT4, I2S0
– BIT3, WDG
– BIT2, UART
– BIT1, SPI
– BIT0, Timers
– BIT26, PWM3
– BIT25, PWM2
– BIT23, UART2
– BIT22, SPI_DMA
– BIT21, I2S1
– BIT20, PWM1
– BIT19, CAN
– BIT18, I2C1
– BIT17, PWM0
– BIT16, SPI3
– BIT14, eFuse
– BIT12, UHCI1
– BIT11, LED_PWM
– BIT10, PULSE_CNT
– BIT8, UHCI0
– BIT7, I2C0
– BIT6, SPI2
– BIT5, UART1
– BIT4, I2S0
– BIT3, WDG
– BIT2, UART
– BIT1, SPI
– BIT0, Timers
5.5 Registers
Register 5.1. PRO_BOOT_REMAP_CTRL_REG (0x000)
AP
M
RE
T_
O
d)
O
ve
_B
r
se
O
PR
(re
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
AP
M
RE
T_
O
d)
BO
e
rv
P_
se
AP
(re
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0x000000000 Reset
31 0
0x000000000 Reset
NG
TI
ET
ES
_R
d)
PU
ve
PC
ser
AP
(re
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 Reset
N
_E
E
AT
G
LK
_C
d )
PU
ve
PC
r
se
AP
(re
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
L
AL
ST
UN
_R
d)
PU
ve
PC
r
se
AP
(re
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0x000000000 Reset
L
SE
D_
O
RI
PE
PU
d)
ve
_C
er
U
s
CP
(re
31 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
CPU_CPUPERIOD_SEL Select CPU clock. Refer to Table 3-3 for details. (R/W)
NA _E E
_E SH ON
BL NA
A
HE LU _D
N
E
_E
AC E_F SH
M
LE IT
_C H LU
RA
G PL
L
O AC _F
_I
_H
IN _S
PR _C HE
M
_S M
O AC
RA
O RA
)
d)
)
ed
ed
ed
e
PR _C
_D
PR _D
rv
rv
rv
rv
se
se
se
se
O
O
PR
PR
PR
(re
(re
(re
(re
31 17 16 15 12 11 10 9 6 5 4 3 2 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 Reset
PRO_DRAM_HL Determines the virtual address mode of the external SRAM. (R/W)
PRO_DRAM_SPLIT Determines the virtual address mode of the external SRAM. (R/W)
PRO_SINGLE_IRAM_ENA Determines a special mode for PRO_CPU access to the external flash.
(R/W)
AB EN E
EN H_ N
LE A
E_ US _DO
NA
_E
CH _FL SH
M
LE LIT
CA HE U
RA
P_ C _FL
NG SP
L
_I
_H
AP _CA HE
SI _
M
P_ AM
P C
A
d)
)
ed
ed
ed
DR
AP _DR
AP _CA
ve
rv
rv
rv
r
P_
se
se
se
se
P
P
AP
AP
AP
(re
(re
(re
(re
31 15 14 13 12 11 10 9 6 5 4 3 2 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 Reset
APP_DRAM_HL Determines the virtual address mode of the External SRAM. (R/W)
APP_DRAM_SPLIT Determines the virtual address mode of the External SRAM. (R/W)
APP_SINGLE_IRAM_ENA Determines a special mode for APP_CPU access to the external flash.
(R/W)
DE
O
_M
UX
M
d)
E_
e
rv
CH
se
CA
(re
31 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
CACHE_MUX_MODE The mode of the two caches sharing the memory. (R/W)
d)
ve
ve
U_
r
r
se
se
M
(re
(re
IM
31 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
IMMU_PAGE_MODE Page size in the MMU for the internal SRAM 0. (R/W)
DE
O
ed _M
E
se AG
)
)
P
ed
U_
v
rv
er
M
s
DM
(re
(re
31 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
DMMU_PAGE_MODE Page size in the MMU for the internal SRAM 2. (R/W)
31 0
0x000000000 Reset
1
D_
d )
_P
ve
AM
ser
SR
(re
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0x0FFFFFFFF Reset
_1
NT
RA
G
S S_
CE
d)
AC
ve
B_
s er
AH
(re
31 9 8 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x1FF Reset
31 0
0x0F9C1E06F Reset
31 0
0x000000000 Reset
AB
A
EN
EN
T_
T_
P
P
RY
RY
NC
EC
_D
_E
PI
PI
)
d)
)
_S
_S
d
ed
ve
e
E
E
rv
rv
r
AV
AV
se
se
se
SL
SL
(re
(re
(re
31 13 12 11 9 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0x0FFFCE030 Reset
31 0
0x000000000 Reset
_n
PU
_C
M
O
R
_F
TR
d )
IN
ve
U_
ser
CP
(re
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0x000000000 Reset
31 0
0x000000000 Reset
_M
d
ve
_*
r
se
O
PR
(re
31 5 4 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16 Reset
AP
d)
M
ve
*_
r
P_
se
AP
(re
31 5 4 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16 Reset
IG
NF
O
_C
NT
RA
_G
SS
CE
AC
*_
E_
)
ed
IT
rv
BL
se
AH
(re
31 6 5 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
n
BLE
d)
TA
e
U_
rv
se
M
(re
IM
31 7 6 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 Reset
U_
rv
M
se
DM
(re
31 7 6 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 Reset
EL
_S
ER
AD
O
TL
O
O
_B
W
_S
)
ed
RE
rv
CU
se
SE
(re
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EL
EL
EL
_S
_S
_S
AN
AN
AN
CH
CH
CH
A_
A_
A_
M
DM
DM
_D
2_
_
)
I3
I1
ed
PI
SP
SP
rv
S
se
I_
I_
I_
SP
SP
SP
(re
31 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
6.1 Overview
Direct Memory Access (DMA) is used for high-speed data transfer between peripherals and memory, as well as
from memory to memory. Data can be quickly moved with DMA without any CPU intervention, thus allowing for
more efficient use of the cores when processing data.
In the ESP32, 13 peripherals are capable of using DMA for data transfer, namely, UART0, UART1, UART2, SPI1,
SPI2, SPI3, I2S0, I2S1, SDIO slave, SD/MMC host, EMAC, BT, and Wi-Fi.
6.2 Features
The DMA controllers in the ESP32 feature:
Each DMA controller features different functions. However, the architecture of the DMA engine (DMA_ENGINE) is
the same in all DMA controllers.
The DMA Engine accesses SRAM over the AHB BUS. In Figure 6-1, the RAM represents the internal SRAM banks
available on ESP32. Further details on the SRAM addressing range can be found in Chapter System and Memory.
Software can use a DMA Engine by assigning a linked list to define the DMA operational parameters.
The DMA Engine transmits the data from the RAM to a peripheral, according to the contents of the out_link de-
scriptor. Also, the DMA Engine stores the data received from a peripheral into a specified RAM location, according
to the contents of the in_link descriptor.
The DMA descriptor’s linked lists (out_link and in_link) have the same structure. As shown in Figure 6-2, a linked-list
descriptor consists of three words. The meaning of each field is as follows:
• owner (DW0) [31]: The allowed operator of the buffer corresponding to the current linked list.
1’b0: the allowed operator is the CPU;
1’b1: the allowed operator is the DMA controller.
• length (DW0) [23:12]: The number of valid bytes in the buffer corresponding to the current linked list. The
field value indicates the number of bytes to be transferred to/from the buffer denoted by word DW1.
• size (DW0) [11:0]: The size of the buffer corresponding to the current linked list.
NOTE: The size must be word-aligned.
• buffer address pointer (DW1): Buffer address pointer. This is the address of the data buffer.
NOTE: The buffer address must be word-aligned.
• next descriptor address (DW2): The address pointer of the next linked-list item. The value is 0, if the current
linked-list item is the last on the list (eof=1).
When receiving data, if the data transfer length is smaller than the specified buffer size, DMA will not use the
remaining space. This enables the DMA engine to be used for transferring an arbitrary number of data bytes.
Figure 6-3 shows the data transfer in UDMA mode. Before the DMA Engine receives data, software must initialize
the receive-linked-list. UHCIx_INLINK_ADDR is used to point to the first in_link descriptor. The register must be
programmed with the lower 20 bits of the address of the initial linked-list item. After UHCIx_INLINK_START is set,
the Universal Host Controller Interface (UHCI) will transmit the data received by UART to the Decoder. After being
parsed, the data will be stored in the RAM as specified by the receive-linked-list descriptor.
Before DMA transmits data, software must initialize the transmit-linked-list and the data to be transferred. UHCI_
OUTLINK_ADDR is used to point to the first out_link descriptor. The register must be programmed with the lower
20 bits of the address of the initial transmit-linked-list item. After UHCIx_OUTLINK_START is set, the DMA Engine
will read data from the RAM location specified by the linked-list descriptor and then transfer the data through the
Encoder. The DMA Engine will then shift the data out serially through the UART transmitter.
The UART DMA follows a format of (separator + data + separator). The Encoder is used for adding separa-
tors before and after data, as well as using special-character sequences to replace data that are the same
as separators. The Decoder is used for removing separators before and after data, as well as replacing the
special-character sequences with separators. There can be multiple consecutive separators marking the begin-
ning or end of data. These separators can be configured through UHCIx_SEPER_CH, with the default values
being 0xC0. Data that are the same as separators can be replaced with UHCIx_ESC_SEQ0_CHAR0 (0xDB
by default) and UHCIx_ESC_SEQ0_CHAR1 (0xDD by default). After the transmission process is complete, a
UHCIx_OUT_TOTAL_EOF_INT interrupt will be generated. After the reception procedure is complete, a UHCIx_IN_
SUC_EOF_INT interrupt will be generated.
ESP32 SPI modules can use DMA as well as the CPU for data exchange with peripherals. As can be seen from
Figure 6-4, two DMA channels are shared by SPI1, SPI2 and SPI3 controllers. Each DMA channel can be used
by any one SPI controller at any given time.
The ESP32 SPI DMA Engine also uses a linked list to receive/transmit data. Burst transmission is supported. The
minimum data length for a single transfer is one byte. Consecutive data transfer is also supported.
I2S_OUTLINK_START bit in I2S_OUT_LINK_REG and I2S_INLINK_START bit in I2S_IN_LINK_REG are used for en-
abling the DMA Engine and are self-cleared by hardware. When I2S_OUTLINK_START is set to 1, the DMA Engine
starts processing the outbound linked-list descriptor and gets prepared to send data. When I2S_INLINK_START
is set to 1, the DMA Engine starts processing the inbound linked-list descriptor and gets prepared to receive
data.
4. In I2S master mode, set I2S_TX_START bit or I2S_RX_START bit to initiate an I2S operation;
In I2S slave mode, set I2S_TX_START bit or I2S_RX_START bit and wait for data transfer to be initiated by
the host device.
For more information on I2S DMA interrupts, please see Section DMA Interrupts, in Chapter I2S.
7.1 Overview
As Figure 7-1 shows, ESP32 integrates four SPI controllers which can be used to communicate with external
devices that use the SPI protocol. Controller SPI0 is used as a buffer for accessing external memory. Controller
SPI1 can be used as a master. Controllers SPI2 and SPI3 can be configured as either a master or a slave. When
used as a master, each SPI controller can drive multiple CS signals (CS0 ~ CS2) to activate multiple slaves.
Controllers SPI1 ~ SPI3 share two DMA channels.
The SPI signal buses consist of D, Q, CS0-CS2, CLK, WP, and HD signals, as Table 7-1 shows. Controllers
SPI0 and SPI1 share one signal bus through an arbiter; the signals of the shared bus start with ”SPI”. Controllers
SPI2 and SPI3 use signal buses starting with ”HSPI” and ”VSPI” respectively. The I/O lines included in the above-
mentioned signal buses can be mapped to pins via either the IO_MUX module or the GPIO matrix. (Please refer
to Chapter IO_MUX for details.)
The SPI controller supports four-line full-duplex/half-duplex communication (MOSI, MISO, CS, and CLK lines) and
three-line half-duplex-only communication (DATA, CS, and CLK lines) in GP-SPI mode. In QSPI mode, an SPI
controller accesses the flash or SRAM by using signal buses D, Q, CS0 ~ CS2, CLK, WP, and HD as a four-bit
parallel SPI bus. The mapping between SPI bus signals and pin function signals under different communication
modes is shown in Table 7-1.
Table 71. Mapping Between SPI Bus Signals and Pin Function Signals
• Programmable clock
Parallel QSPI
• SPI interrupts
7.3 GPSPI
The SPI master mode supports four-line full-duplex/half-duplex communication and three-line half-duplex commu-
nication. Figure 7-2 outlines the connections needed for four-line full-duplex/half-duplex communications.
The SPI1 ~ SPI3 controllers can communicate with other slaves as a standard SPI master. SPI2 and SPI3 can
be configured as either a master or a slave. Every SPI master can be connected to three slaves at most by default.
When not using DMA, the maximum length of data received/sent in one burst is 64 bytes. The data length is in
multiples of one byte.
Command Description
0x1 Received by slave; writes data sent by the master into the slave status register via MOSI.
0x2 Received by slave; writes data sent by the master into the slave data buffer via MOSI.
0x3 Sent by slave; sends data in the slave buffer to master via MISO.
0x4 Sent by slave; sends data in the slave status register to master via MISO.
Writes master data on MOSI into data buffer and then sends the date in the slave data buffer
0x6
to MISO.
4. received and/or sent data: length of 0 ~ 512 bits (64 bytes); Master Out Slave In (MOSI) or Master In Slave
Out (MISO).
The address length is up to 32 bits in GP-SPI master mode and 64 bits in QSPI master mode. The command
phase, address phase, dummy phase and received/sent data phase are controlled by bits SPI_USR_COMMAND,
SPI_USR_ADDR, SPI_USR_DUMMY and SPI_USR_MISO/SPI_USR_MOSI respectively in register SPI_USER_REG.
A certain phase is enabled only when its corresponding control bit is set to 1. Details can be found in register de-
scription. When SPI works as a master, the register can be configured by software as required to determine
whether or not to enable a certain phase.
When SPI works as a slave, the communication format must contain command, address, received and/or sent
data, among which the command has several options listed in Table 7-2. During data transmission or reception,
the CS signal should keep logic level low. If the CS signal is pulled up during transmission, the internal state of the
slave will be reset.
The master can write the slave status register SPI_SLV_WR_STATUS_REG, and decide whether to read data from
register SPI_SLV_WR_STATUS_REG or register SPI_RD_STATUS_REG via the SPI_SLV_STATUS_READBACK bit
in register SPI_SLAVE1_REG. The SPI master can maintain communication with the slave by reading and writing
slave status register, thus realizing complex communication with ease.
The length of received and sent data is controlled by SPI_MISO_DLEN_REG and SPI_MOSI_DLEN_REG in master
mode, as well as SPI_SLV_RDBUF_DLEN_REG and SPI_SLV_WRBUF_DLEN_REG in slave mode. A reception or
transmission of data is controlled by bit SPI_USR_MOSI or SPI_USR_MISO in SPI_USER_REG. The SPI_USR bit
in register SPI_CMD_REG needs to be configured to initialize a data transfer.
Note:
• In half-duplex communication, the order of command, address, received and/or sent data in the communication
format should be followed strictly.
• In half-duplex communication, communication formats ”command + address + received data + sent data” and
”received data + sent data” are not applicable to DMA.
• When ESP32 SPI acts as a slave, the master CS should be active at least one SPI clock period before a read/write
process is initiated, and should be inactive at least one SPI clock period after the read/write process is completed.
ESP32 SPI has 16 × 32 bits of data buffer to buffer data-send and data-receive operations. As is shown in Figure
7-3, received data is written from the low byte of SPI_W0_REG by default and the writing ends with SPI_W15_REG.
If the data length is over 64 bytes, the extra part will be written from SPI_W0_REG.
Data buffer blocks SPI_W0_REG ~ SPI_W7_REG and SPI_W8_REG ~ SPI_W15_REG data correspond to the
lower part and the higher part respectively. They can be used separately, and are controlled by the SPI_USR_MOSI_HIGHPART
bit and the SPI_USR_MISO_HIGHPART bit in register SPI_USER_REG. For example, if SPI is configured as a mas-
ter, when SPI_USR_MOSI_HIGHPART = 1, SPI_W8_REG ~ SPI_W15_REG are used as buffer for sending data;
when SPI_USR_MISO_HIGHPART = 1, SPI_W8_REG ~ SPI_W15_REG are used as buffer for receiving data. If
SPI acts as a slave, when SPI_USR_MOSI_HIGHPART = 1, SPI_W8_REG ~ SPI_W15_REG are used as buffer
for receiving data; when SPI_USR_MISO_HIGHPART = 1, SPI_W8_REG ~ SPI_W15_REG are used as buffer for
sending data.
Table 73. Clock Polarity and Phase, and Corresponding SPI Register Values for SPI Master
fapb
fspi =
(SPI_CLKCNT_N+1)(SPI_CLKDIV_PRE+1)
SPI_CLKCNT_N and SPI_CLKDIV_PRE are two bits of register SPI_CLOCK_REG (Please refer to 7.7 Regis-
ter Description for details). SPI_CLKCNT_H = ⌊ SPI_CLKCNT_N+1
2 –1⌋, SPI_CLKCNT_N=SPI_CLKCNT_L. When the
SPI_CLK_EQU_SYSCLK bit in register SPI_CLOCK_REG is set to 1, and the other bits are set to 0, SPI output
clock frequency is fapb . For other clock frequencies, SPI_CLK_EQU_SYSCLK needs to be 0. In slave mode,
SPI_CLKCNT_N, SPI_CLKCNT_L, SPI_CLKCNT_H and SPI_CLKDIV_PRE should all be 0.
Table 74. Clock Polarity and Phase, and Corresponding SPI Register Values for SPI Slave
1. mode0 means CPOL=0, CPHA=0. When SPI is idle, the clock output is logic low; data changes on the
falling edge of the SPI clock and is sampled on the rising edge;
2. mode1 means CPOL=0, CPHA=1. When SPI is idle, the clock output is logic low; data changes on the rising
edge of the SPI clock and is sampled on the falling edge;
3. mode2 means when CPOL=1, CPHA=0. When SPI is idle, the clock output is logic high; data changes on
the rising edge of the SPI clock and is sampled on the falling edge;
4. mode3 means when CPOL=1, CPHA=1. When SPI is idle, the clock output is logic high; data changes on
the falling edge of the SPI clock and is sampled on the rising edge.
When GP-SPI is used as master and the data signals are not received by the SPI controller via GPIO matrix, if
GP-SPI output clock frequency is clkapb /2, register SPI_MISO_DELAY_MODE should be set to 0 when configuring
the clock polarity. If GP-SPI output clock frequency is not higher than clkapb /4, register SPI_MISO_DELAY_MODE
can be set to the corresponding value in Table 7-3 when configuring the clock polarity.
When GP-SPI is used in master mode and the data signals enter the SPI controller via the GPIO matrix:
1. If GP-SPI output clock frequency is clkapb /2, register SPI_MISO_DELAY_MODE should be set to 0 and the
dummy phase should be enabled (SPI_USR_DUMMY = 1) for one clkspi clock cycle (SPI_USR_DUMMY_CYCLELEN
= 0) when configuring the clock polarity;
2. If GP-SPI output clock frequency is clkapb /4, register SPI_MISO_DELAY_MODE should be set to 0 when
configuring the clock polarity;
3. If GP-SPI output clock frequency is not higher than clkapb /8, register SPI_MISO_DELAY_MODE can be set
to the corresponding value in Table 7-3 when configuring the clock polarity.
When GP-SPI is used in slave mode, the clock signal and the data signals should be routed to the SPI controller
via the same path, i.e., neither the clock signal nor the data signals passes through GPIO matrix, or both of them
pass through GPIO matrix. This is important in ensuring that the signals are not delayed by different time periods
before they reach the SPI hardware.
Assume that tspi , tpre and tv in Figure 7-4 denote SPI clock period, how far ahead data output is, and data output
delay time, respectively. Assume the SPI slave’s main clock period is tapb . For non-DMA mode0, SPI slave data
output is delayed by tv :
• tv < 3.5 ∗ tapb , if CLK does not pass through GPIO matrix;
In DMA mode1 and mode3, SPI slave data output is delayed by the same period of time as in non-DMA mode.
However, for mode0 and mode2, SPI slave data is output earlier by tpre :
• tpre < (tspi /2 − 5.5 ∗ tapb ), if CLK does not pass through GPIO matrix;
• tpre < (tspi /2 − 7.5 ∗ tapb ), if CLK passes through GPIO matrix.
To conclude, if signals do not pass through GPIO matrix, the SPI slave clock frequency is up to fapb /8; if signals
pass through GPIO matrix, the SPI slave clock frequency is up to fapb /12. Note that (tspi /2–tpre ) represents data
output hold time for SPI slave in mode0 and mode2.
SPI1, SPI2 and SPI3 controllers can also be configured as QSPI master to connect to external memory. The
maximum output clock frequency of the SPI memory interface is fapb , with the same clock configuration as that of
the GP-SPI master.
ESP32 QSPI supports flash-read operation in one-line, two-line, and four-line modes. When working as a QSPI
master, the command phase, address phase, dummy phase and data phase can be configured as needed, as
flexible as in GP-SPI mode.
Note that GPI-SPI full-duplex mode does not support dummy phase.
ESP32 SPI reckons the completion of send- and/or receive-operations as the completion of one operation from
the controller and generates one interrupt. When ESP32 SPI is configured to slave mode, the slave will generate
read/write status registers and read/write buffer data interrupts according to different operations.
• SPI_OUT_DONE_INT: Triggered when the last linked list item has zero length.
• SPI_IN_DONE_INT: Triggered when the last received linked list had a length of 0.
7.8 Registers
Register 7.1. SPI_CMD_REG (0x0)
d)
)
ed
SR
ve
rv
U
er
se
I_
s
SP
(re
(re
31 19 18 17 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SPI_USR An SPI operation will be triggered when this bit is set. The bit will be cleared once the
operation is done. (R/W)
31 0
0x000000000 Reset
SPI_ADDR_REG It stores the transmitting address when master is in half-duplex mode or QSPI mode.
If the address length is bigger than 32 bits, this register stores the higher 32 bits of address value,
SPI_SLV_WR_STATUS_REG stores the rest lower part of address value. If the address length is
smaller than 33 bits, this register stores all the address value. The register is in valid only when
SPI_USR_ADDR bit is set to 1. (R/W)
I_ EA OR ER
se EA QIO R
DE
(re FR D_ DE
_M L
SP FR IT_ RD
O
UA
RD UA
I_ d) DIO
I_ _B O
ST D
SP RD IT_
SP rve D_
D_
FA D_
I_ _B
EA
I_ EA
)
)
ed
ed
ed
SP WR
SP WP
FR
SP FR
rv
rv
rv
se
se
se
I_
I_
I_
SP
SP
(re
(re
(re
31 27 26 25 24 23 22 21 20 19 15 14 13 12 0
0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SPI_WR_BIT_ORDER This bit determines the bit order for command, address and data in transmitted
signal. 1: sends LSB first; 0: sends MSB first. (R/W)
SPI_RD_BIT_ORDER This bit determines the bit order for received data in received signal. 1: receives
LSB first; 0: receives MSB first. (R/W)
SPI_FREAD_QIO This bit is used to enable four-line address writes and data reads in QSPI mode.
(R/W)
SPI_FREAD_DIO This bit is used to enable two-line address writes and data reads in QSPI mode.
(R/W)
SPI_WP This bit determines the write-protection signal output when SPI is idle in QSPI mode. 1:
output high; 0: output low. (R/W)
SPI_FREAD_QUAD This bit is used to enable four-line data reads in QSPI mode. (R/W)
SPI_FREAD_DUAL This bit is used to enable two-line data reads in QSPI mode. (R/W)
SPI_FASTRD_MODE Reserved.
d)
e
CS
rv
se
I_
SP
(re
31 28 27 0
0x05 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SPI_CS_HOLD_DELAY Reserved.
T
EX
S_
S
U
TU
AT
TA
ST
S
I_
I_
SP
SP
31 24 23 16 15 0
SPI_STATUS_EXT Reserved.
SPI_STATUS Reserved.
DE
DE
DE
O
M
M
DE
M
O
O
NU
U
UM
H_
_N
O
Y_
Y_
_
_M
_N
IG
AY
AY
E
LA
LA
M
_H
AY
AY
M
EL
EL
TI
E
I
UT
_T
EL
EL
_D
_D
_D
_D
P_
LD
O
_D
_D
TU
SI
SI
_
IS
IS
ed
O
HO
CK
CS
CS
SE
M
rv
I_
I_
I_
I_
I_
I_
I_
I_
I_
se
SP
SP
SP
SP
SP
SP
SP
SP
SP
re
31 28 27 26 25 23 22 21 20 18 17 16 15 12 11 8 7 4 3 0
0x00 0x0 0x0 0x0 0x0 0x0 0x00 0x00 0x01 0x01 Reset
SPI_CS_DELAY_NUM Reserved.
SPI_CS_DELAY_MODE Reserved.
SPI_MOSI_DELAY_NUM It is used to configure the number of system clock cycles by which the
MOSI signals are delayed. (R/W)
SPI_MOSI_DELAY_MODE This register field determines the way the MOSI signals are delayed by
SPI clock. (R/W)
After being delayed by SPI_MOSI_DELAY_NUM system clocks, the MOSI signals will then be de-
layed by the configuration of SPI_MOSI_DELAY_MODE, specifically:
0: no delay.
1: if SPI_CK_OUT_EDGE or SPI_CK_I_EDGE is set, the MOSI signals are delayed by half a cycle,
otherwise they are delayed by one cycle.
2: if SPI_CK_OUT_EDGE or SPI_CK_I_EDGE is set, the MOSI signals are delayed by one cycle,
otherwise they are delayed by half a cycle.
3: the MOSI signals are delayed one cycle.
SPI_MISO_DELAY_NUM It is used to configure the number of system clock cycles by which the
MISO signals are delayed. (R/W)
SPI_MISO_DELAY_MODE This register field determines the way MISO signals are delayed by SPI
clock. (R/W)
After being delayed by SPI_MISO_DELAY_NUM system clock, the MISO signals will then be de-
layed by the configuration of SPI_MISO_DELAY_MODE, specifically:
0: no delay.
1: if SPI_CK_OUT_EDGE or SPI_CK_I_EDGE is set, the MISO signals are delayed by half a cycle,
otherwise they are delayed by one cycle.
2: if SPI_CK_OUT_EDGE or SPI_CK_I_EDGE is set, the MISO signals are delayed by one cycle,
otherwise they are delayed by half a cycle.
3: the MISO signals are delayed by one cycle.
SPI_HOLD_TIME The number of SPI clock cycles by which CS pin signals are delayed. It is only valid
when SPI_CS_HOLD is set to 1. (R/W)
SPI_SETUP_TIME It is to configure the time between the CS signal active edge and the first SPI
clock edge. It is only valid in half-duplex mode or QSPI mode and when SPI_CS_SETUP is set to
1. (R/W)
LK
SC
SY
E
PR
_H
U_
_L
T_
V_
NT
NT
EQ
CN
I
KC
KC
KD
_
LK
LK
CL
CL
CL
C
C
I_
I_
I_
I_
I_
SP
SP
SP
SP
SP
31 30 18 17 12 11 6 5 0
SPI_CLK_EQU_SYSCLK In master mode, when this bit is set to 1, SPI output clock is equal to system
clock; when set to 0, SPI output clock is divided from system clock. In slave mode, it should be
set to 0. (R/W)
SPI_CLKDIV_PRE In master mode, it is used to configure the pre-divider value for SPI output clock.
It is only valid when SPI_CLK_EQU_SYSCLK is 0. In slave mode, it should be set to 0. (R/W)
SPI_CLKCNT_N In master mode, it is used to configure the divider for SPI output clock. It is only
valid when SPI_CLK_EQU_SYSCLK is 0. In slave mode, it should be set to 0. (R/W)
HP T
T
IG AR
AR
IS IG E
_H HP
O ER
ER
M I_H L
I_ R_ DR ND
R_ OS Y_ID
E_ RD
I_ _S GE E
RD
I_ _B DU D
_ B TE L
SP CS ED DG
SP US AD MA
SP US MIS MY
SP WR E_ A
RD Y A
Y T _O
SP FW TE_ IO
SP FW TE_ IO
I_ R_ MM
I_ RIT QU
I_ _I_ _E
_H UP
I_ R_ O
SP US DU I
O
I_ R_ M
I_ RI Q
I_ R_ M
I_ R_ S
I_ RI D
LD
N
SP US MO
SP FW E_
SP US CO
SP US DU
SP CK UT
CS ET
DI
US M
O
I_ RIT
UT
I_ _O
I_ R_
)
ed
ed
ed
SP SIO
SP FW
DO
SP CK
SP US
rv
rv
rv
se
se
se
I_
I_
I_
I_
I_
SP
SP
SP
SP
(re
(re
(re
31 30 29 28 27 26 25 24 23 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 Reset
SPI_USR_COMMAND This bit enables the command phase of an SPI operation in SPI half-duplex
mode and QSPI mode. (R/W)
SPI_USR_ADDR This bit enables the address phase of an SPI operation in SPI half-duplex mode and
QSPI mode. (R/W)
SPI_USR_DUMMY This bit enables the dummy phase of an SPI operation in SPI half-duplex mode
and QSPI mode. (R/W)
SPI_USR_MISO This bit enables the read-data phase of an SPI operation in SPI half-duplex mode
and QSPI mode. (R/W)
SPI_USR_MOSI This bit enables the write-data phase of an SPI operation in SPI half-duplex mode
and QSPI mode. (R/W)
SPI_USR_DUMMY_IDLE The SPI clock signal is disabled in the dummy phase when the bit is set in
SPI half-duplex mode and QSPI mode. (R/W)
SPI_USR_MOSI_HIGHPART If set, MOSI data is stored in SPI_W8 ~ SPI_W15 of the SPI buffer.
(R/W)
SPI_USR_MISO_HIGHPART If set, MISO data is stored in SPI_W8 ~ SPI_W15 of the SPI buffer.
(R/W)
SPI_FWRITE_QIO Reserved.
SPI_FWRITE_DIO Reserved.
SPI_FWRITE_QUAD Reserved.
SPI_FWRITE_DUAL Reserved.
SPI_WR_BYTE_ORDER This bit determines the byte order of the command, address and data in
transmitted signal. 1: big-endian; 0: little-endian. (R/W)
SPI_RD_BYTE_ORDER This bit determines the byte order of received data in transmitted signal. 1:
big-endian; 0: little_endian. (R/W)
SPI_CK_OUT_EDGE This bit, combined with SPI_MOSI_DELAY_MODE, sets the MOSI signal delay
mode. It is only valid in master mode. (R/W)
SPI_CK_I_EDGE In slave mode, the bit is the same as SPI_CK_OUT_EDGE in master mode. It is
combined with SPI_MISO_DELAY_MODE. It is only valid in slave mode. (R/W)
SPI_CS_SETUP Setting this bit enables a delay between CS active edge and the first clock edge,
in multiples of one SPI clock cycle. In full-duplex mode and QSPI mode, setting this bit results in
(SPI_SETUP_TIME + 1.5) SPI clock cycles delay. In full-duplex mode, there will be 1.5 SPI clock
cycles delay for mode0 and mode2, and 1 SPI clock cycle delay for mode1 and mode3. (R/W)
SPI_CS_HOLD Setting this bit enables a delay between the end of a transmission and CS being
inactive, as specified in SPI_HOLD_TIME. (R/W)
EN
EL
CL
EN
CY
L
IT
Y_
_B
M
DR
M
DU
D
_A
R_
)
ed
SR
US
rv
U
se
I_
I_
SP
SP
(re
31 26 25 8 7 0
23 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 Reset
SPI_USR_ADDR_BITLEN It indicates the bit length of the transmitted address minus one in half-
duplex mode and QSPI mode, in multiples of one bit. It is only valid when SPI_USR_ADDR is set
to 1. (RO)
SPI_USR_DUMMY_CYCLELEN It indicates the number of SPI clock cycles for the dummy phase
minus one in SPI half-duplex mode and QSPI mode. It is only valid when SPI_USR_DUMMY is set
to 1. (R/W)
EN
UE
TL
L
VA
BI
D_
D_
AN
AN
M
M
M
M
CO
O
_C
R_
)
ed
R
US
US
rv
se
I_
I_
SP
SP
(re
31 28 27 16 15 0
7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SPI_USR_COMMAND_BITLEN It indicates the bit length of the command phase minus one in SPI
half-duplex mode and QSPI mode. It is only valid when SPI_USR_COMMAND is set to 1. (R/W)
N
LE
B IT
_D
SI
O
_M
)
ed
SR
rv
U
se
I_
SP
(re
31 24 23 0
0 0 0 0 0 0 0 0 0x0000000 Reset
SPI_USR_MOSI_DBITLEN It indicates the length of MOSI data minus one, in multiples of one bit. It
is only valid when SPI_USR_MOSI is set to 1 in master mode. (R/W)
US
rv
se
I_
SP
(re
31 24 23 0
0 0 0 0 0 0 0 0 0x0000000 Reset
SPI_USR_MISO_DBITLEN It indicates the length of MISO data minus one, in multiples of one bit. It
is only valid when SPI_USR_MISO is set to 1 in master mode. (R/W)
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SPI_SLV_WR_STATUS_REG In the slave mode this register is the status register for the master to
write the slave. In the master mode, if the address length is bigger than 32 bits, SPI_ADDR_REG
stores the higher 32 bits of address value, and this register stores the rest lower part of address
value. (R/W)
L
ED IVE
EL
O
E
_S
_P
E_ CT
G
CK
CS
DL A
_I P_
R_
R_
SP CS DIS
0_ S
S
CK EE
CS I
DI
TE
TE
I_ 1_D
DI
I_ _K
I_ 2_
I_ d)
d)
)
AS
AS
ed
ed
K_
SP rve
e
SP CS
SP CS
rv
rv
rv
M
C
se
se
se
se
I_
I_
I_
I_
SP
SP
SP
SP
(re
(re
(re
(re
31 30 29 28 14 13 11 10 9 8 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 Reset
SPI_CS_KEEP_ACTIVE This bit is only used in master mode where when it is set, the CS signal will
keep active. (R/W)
SPI_CK_IDLE_EDGE This bit is only used in master mode to configure the logicl level of SPI output
clock in idle state. (R/W)
1: the spi_clk line keeps high when idle;
0: the spi_clk line keeps low when idle.
SPI_MASTER_CK_SEL Reserved.
SPI_MASTER_CS_POL Reserved.
SPI_CK_DIS Reserved.
SPI_CS2_DIS This bit enables the SPI CS2 signal. 1: disables CS2; 0: enables CS2. (R/W)
SPI_CS1_DIS This bit enables the SPI CS1 signal. 1: disables CS1; 0: enables CS1. (R/W)
SPI_CS0_DIS This bit enables the SPI CS0 signal. 1: disables CS0; 0: enables CS0. (R/W)
D
D_ _ST _EN
FI EN
AN
I_ _ DO IN N
_D NE
I_ _R _B INT N
V_ _ _D NE
N
NE
SP TR D_ UF EN
_B F_D E
SP SLV S_ UF_ TE
SP SLV R TA_ TE
SP SLV WR NE TE
RD BU ON
DE A_
NE
UF O
CM RD UF
I_ _W ST DO
TE
O
I_ AN B _IN
I_ _W S IN
M
TA
V_ _ _B
SP SLV D_ TA_
SP SLV R TEN
SP SLV R DE
SP SLV E_M ET
SL R A
_C
T
_S
SL R D
DE
CN
I_ AV ES
I_ _W O
I_ _W _R
I_ _R _S
I_ _ _S
I_ _W IN
ST
ST
O
SP SL _R
S_
SP SLV S_
M
LA
LA
I_ NC
AN
SP _I_
I_ N
)
V_
V_
ed
A
CS
SP SY
TR
SP TR
SL
SL
rv
se
I_
I_
I_
I_
I_
I_
SP
SP
SP
SP
SP
(re
31 30 29 28 27 26 23 22 20 19 17 16 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SPI_SYNC_RESET When set, it resets the latched values of the SPI clock line, CS line and data line.
(R/W)
SPI_SLAVE_MODE This bit is used to set the mode of the SPI device. (R/W)
1: slave mode;
0: master mode.
SPI_SLV_WR_RD_BUF_EN This bit is only used in slave half-duplex mode, where when it is set, the
write and read data commands are enabled. (R/W)
SPI_SLV_WR_RD_STA_EN This bit is only used in slave half-duplex mode, where when it is set, the
write and read status commands are enabled. (R/W)
SPI_SLV_CMD_DEFINE Reserved.
SPI_TRANS_CNT The counter for operations in both the master mode and the slave mode. (RO)
SPI_SLV_LAST_STATE In slave mode, this contains the state of the SPI state machine. (RO)
SPI_SLV_LAST_COMMAND Reserved.
SPI_CS_I_MODE Reserved.
SPI_TRANS_INTEN The interrupt enable bit for the SPI_TRANS_DONE_INT interrupt. (R/W)
SPI_SLV_WR_STA_INTEN The interrupt enable bit for the SPI_SLV_WR_STA_INT interrupt. (R/W)
SPI_SLV_RD_STA_INTEN The interrupt enable bit for the SPI_SLV_RD_STA_INT interrupt. (R/W)
SPI_SLV_WR_BUF_INTEN The interrupt enable bit for the SPI_SLV_WR_BUF_INT interrupt. (R/W)
SPI_SLV_RD_BUF_INTEN The interrupt enable bit for the SPI_SLV_RD_BUF_INT interrupt. (R/W)
SPI_TRANS_DONE The raw interrupt status bit for the SPI_TRANS_DONE_INT interrupt. It is set by
hardware and cleared by software. (R/W)
SPI_SLV_WR_STA_DONE The raw interrupt status bit for the SPI_SLV_WR_STA_INT interrupt. It is
set by hardware and cleared by software, and only applicable to slave half-duplex mode. (R/W)
SPI_SLV_RD_STA_DONE The raw interrupt status bit for the SPI_SLV_RD_STA_INT interrupt. It is
set by hardware and cleared by software, and only applicable to slave half-duplex mode. (R/W)
SPI_SLV_WR_BUF_DONE The raw interrupt status bit for the SPI_SLV_WR_BUF_INT interrupt. It is
set by hardware and cleared by software, and only applicable to slave half-duplex mode. (R/W)
SPI_SLV_RD_BUF_DONE The raw interrupt status bit for the SPI_SLV_RD_BUF_INT interrupt. It is
set by hardware and cleared by software, and only applicable to slave half-duplex mode. (R/W)
M N
K
BU _D MY N
EN
DU M N
M Y_E
AC
RD UF M _E
N
F_ UM _E
EN
EA EN
Y_
LE
V_ B DU MY
EN
DB
TL
_R T_
IT
TL
SL R _ M
BI
_B
US AS
I_ _W TA U
R_
BI
DR
AT _F
DD
ST US
AD
U
T
_A
AT
V_ AT
S
R_
SP LV R
RD
ST
SL T
_W
I_ _W
I_ _S
)
V_
V_
I_ _
ed
SP LV
LV
SP SLV
SL
SL
rv
S
S
se
I_
I_
I_
I_
I_
SP
SP
SP
SP
SP
(re
31 27 26 25 24 16 15 10 9 4 3 2 1 0
SPI_SLV_STATUS_BITLEN It is only used in slave half-duplex mode to configure the length of the
master writing into the status register. (R/W)
SPI_SLV_STATUS_FAST_EN Reserved.
SPI_SLV_STATUS_READBACK Reserved.
SPI_SLV_RD_ADDR_BITLEN It indicates the address length in bits minus one for a slave-read oper-
ation. It is only valid in slave half-duplex mode. (R/W)
SPI_SLV_WR_ADDR_BITLEN It indicates the address length in bits minus one for a slave-write op-
eration. It is only valid in slave half-duplex mode. (R/W)
SPI_SLV_WRSTA_DUMMY_EN In slave mode, this bit enables the dummy phase for write-status
operations. It is only valid in slave half-duplex mode.(R/W)
SPI_SLV_RDSTA_DUMMY_EN In slave mode, this bit enables the dummy phase for read-status
operations. It is only valid in slave half-duplex mode. (R/W)
SPI_SLV_WRBUF_DUMMY_EN In slave mode, this bit enables the dummy phase for write-buffer
operations. It is only valid in slave half-duplex mode. (R/W)
SPI_SLV_RDBUF_DUMMY_EN In slave mode, this bit enables the dummy phase for read-buffer
operations. It is only valid in slave half-duplex mode. (R/W)
EN
N
EN
N
LE
LE
EL
EL
E
CL
CL
CL
CL
CY
CY
CY
CY
Y_
Y_
Y_
Y_
M
M
M
M
UM
M
UM
M
DU
DU
_D
_
F_
A_
UF
TA
BU
ST
RB
RS
RD
RD
W
W
_
V_
LV
LV
LV
SL
S
S
I_
I_
I_
I_
SP
SP
SP
SP
31 24 23 16 15 8 7 0
SPI_SLV_WRBUF_DUMMY_CYCLELEN It indicates the number of SPI clock cycles minus one for
the dummy phase for write-data operations. It is only valid when SPI_SLV_WRBUF_DUMMY_EN
is set to 1 in slave half-duplex mode. (R/W)
SPI_SLV_RDBUF_DUMMY_CYCLELEN It indicates the number of SPI clock cycles minus one for
the dummy phase for read-data operations. It is only valid when SPI_SLV_RDBUF_DUMMY_EN is
set to 1 in slave half-duplex mode. (R/W)
E
UE
LU
LU
L
VA
VA
VA
VA
D_
D_
D_
D_
M
M
M
CM
_C
_C
C
F_
A_
UF
TA
BU
ST
RB
RS
RD
RD
W
W
V_
V_
V_
V_
SL
SL
SL
SL
I_
I_
I_
I_
SP
SP
SP
SP
31 24 23 16 15 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SPI_SLV_WRSTA_CMD_VALUE Reserved.
SPI_SLV_RDSTA_CMD_VALUE Reserved.
SPI_SLV_WRBUF_CMD_VALUE Reserved.
SPI_SLV_RDBUF_CMD_VALUE Reserved.
N
LE
IT
DB
U F_
RB
W
d)
_
LV
ve
S
er
I_
s
SP
(re
31 24 23 0
0 0 0 0 0 0 0 0 0x0000000 Reset
SPI_SLV_WRBUF_DBITLEN It indicates the length of written data minus one, in multiples of one bit.
It is only valid in slave half-duplex mode. (R/W)
N
LE
IT
DB
F_
BU
RD
)
V_
ed
SL
rv
se
I_
SP
(re
31 24 23 0
0 0 0 0 0 0 0 0 0x0000000 Reset
SPI_SLV_RDBUF_DBITLEN It indicates the length of read data minus one, in multiples of one bit. It
is only valid in slave half-duplex mode. (R/W)
V_
ed
SL
rv
se
I_
SP
(re
31 24 23 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SPI_SLV_RDATA_BIT It indicates the bit length of data the master reads from the slave, minus one.
It is only valid in slave half-duplex mode. (R/W)
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SPI_TX_CRC_REG Reserved.
d)
ve
ST
er
I_
s
SP
(re
31 3 2 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
_E R_ T_ EN
DE EN
O BU EN
UT C RS ST_
O _
M ST
ST
se A_ _S UE
I_ TD _BU UR
F_ R
P
I_ d) _S P
_R ST _R
TO
(re DM TX TIN
SP rve RX TO
SP OU CR _B
I_ T_ IFO
SP OU _F T
I_ S A
I_ A_ N
I_ BM S
T
SP DM CO
SP AH _R
SP ND DA
O S
se ST
IN R
I_ BM
I_ A_
I_ T_
d)
)
ed
ed
SP DM
ve
SP OU
SP AH
rv
rv
r
I
se
se
I_
I_
SP
SP
(re
(re
(re
31 17 16 15 14 13 12 11 10 9 8 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 Reset
SPI_DMA_CONTINUE This bit enables SPI DMA continuous data TX/RX mode. (R/W)
SPI_DMA_TX_STOP When in continuous TX/RX mode, setting this bit stops sending data. (R/W)
SPI_DMA_RX_STOP When in continuous TX/RX mode, setting this bit stops receiving data. (R/W)
SPI_OUT_DATA_BURST_EN SPI DMA reads data from memory in burst mode. (R/W)
SPI_AHBM_FIFO_RST This bit is used to reset SPI DMA AHB master FIFO pointer. (R/W)
SPI_OUT_RST The bit is used to reset DMA out-FSM and out-data FIFO pointer. (R/W)
SPI_IN_RST The bit is used to reset DMA in-DSM and in-data FIFO pointer. (R/W)
R
P
DD
TO
UT K S
O IN E
I_ TL _R
_A
SP OU INK
NK
LI
I_ TL
I_ d)
d)
UT
SP rve
e
SP OU
rv
O
se
se
I_
SP
(re
(re
31 30 29 28 27 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0x000000 Reset
ET
NK TA RT
_R
LI S A
_S RT
R
TO
P
IN _ T
DD
TO
I_ INK ES
AU
SP INL K_R
_A
K_
NK
I_ IN
N
I_ d)
)
ed
LI
LI
SP INL
SP rve
IN
IN
rv
se
se
I_
I_
SP
SP
(re
(re
31 30 29 28 27 21 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0x000000 Reset
SPI_INLINK_AUTO_RET when the bit is set, inlink descriptor jumps to the next descriptor when a
packet is invalid. (R/W)
N
RX N
_E
A_ _E
X
DM T
I_ A_
d)
SP DM
e
rv
se
I_
SP
(re
31 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EN A
T_ E N
Y_ IN A
A
PT R_ EN
I N T_
EM RO T_
NA
R_ ER _IN
SP IN_ C_ _IN NA _E
SC R_ OR
I_ SU NE _E NT
I_ DO EO IN A
I_ IN _ IN N
SP IN_ R_ F_ _EN
SP INL NE F_ T_E
_D SC RR
IN IN CR A
SP IN_ DO INT F_I
NK _D _E
I_ T_ F_ O
I_ ER EO T
SP OU EO L_E
I_ T_ TA
LI K
SP OU TO
I_ T_
d)
ve
SP OU
er
I_
s
SP
(re
31 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SPI_OUT_EOF_INT_ENA The interrupt enable bit for the SPI_OUT_EOF_INT interrupt. (R/W)
SPI_OUT_DONE_INT_ENA The interrupt enable bit for the SPI_OUT_DONE_INT interrupt. (R/W)
SPI_IN_SUC_EOF_INT_ENA The interrupt enable bit for the SPI_IN_SUC_EOF_INT interrupt. (R/W)
SPI_IN_ERR_EOF_INT_ENA The interrupt enable bit for the SPI_IN_ERR_EOF_INT interrupt. (R/W)
SPI_IN_DONE_INT_ENA The interrupt enable bit for the SPI_IN_DONE_INT interrupt. (R/W)
RA W
T_ R A
Y_ IN W
W
PT R_ RA
IN T_
EM RO T_
AW
R_ ER _IN
SP IN_ C_ _IN AW _R
SC R_ OR
I_ DO EO IN W
I_ SU NE _R NT
I_ IN _ IN A
SP IN_ R_ F_ _RA
SP INL NE F_ T_R
IN IN CR AW
_D SC RR
SP IN_ DO INT F_I
NK _D _E
I_ T_ F_ O
I_ ER EO T
SP OU EO L_E
I_ T_ TA
LI K
SP OU TO
I_ T_
d)
ve
SP OU
er
I_
s
SP
(re
31 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SPI_OUT_TOTAL_EOF_INT_RAW The raw interrupt status bit for the SPI_OUT_TOTAL_EOF_INT in-
terrupt. (RO)
SPI_OUT_EOF_INT_RAW The raw interrupt status bit for the SPI_OUT_EOF_INT interrupt. (RO)
SPI_OUT_DONE_INT_RAW The raw interrupt status bit for the SPI_OUT_DONE_INT interrupt. (RO)
SPI_IN_SUC_EOF_INT_RAW The raw interrupt status bit for the SPI_IN_SUC_EOF_INT interrupt.
(RO)
SPI_IN_ERR_EOF_INT_RAW The raw interrupt status bit for the SPI_IN_ERR_EOF_INT interrupt.
(RO)
SPI_IN_DONE_INT_RAW The raw interrupt status bit for the SPI_IN_DONE_INT interrupt. (RO)
T_ S T
PT R_ ST
ST
IN T_
EM RO T_
Y_ IN
R_ ER _IN
T
SP IN_ C_ _IN T _S
SC R_ OR
I_ SU NE _S NT
I_ IN _ IN T
I_ TL S _ST T
SP INL NE F_ T_S
SP IN_ R_ F_ _ST
_D SC RR
SP IN_ DO INT F_I
NK _D _E
I_ T_ F_ O
I_ DO EO IN
I_ ER EO T
SP OU EO L_E
IN IN CR
I_ T_ TA
LI K
SP OU TO
I_ T_
d)
ve
SP OU
er
I_
s
SP
(re
31 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SPI_OUT_EOF_INT_ST The masked interrupt status bit for the SPI_OUT_EOF_INT interrupt. (RO)
SPI_OUT_DONE_INT_ST The masked interrupt status bit for the SPI_OUT_DONE_INT interrupt.
(RO)
SPI_IN_SUC_EOF_INT_ST The masked interrupt status bit for the SPI_IN_SUC_EOF_INT interrupt.
(RO)
SPI_IN_ERR_EOF_INT_ST The masked interrupt status bit for the SPI_IN_ERR_EOF_INT interrupt.
(RO)
SPI_IN_DONE_INT_ST The masked interrupt status bit for the SPI_IN_DONE_INT interrupt. (RO)
CL R
T_ C L
Y_ IN R
R
PT R_ CL
IN T_
EM RO T_
LR
R_ ER _IN
SP IN_ C_ _IN LR _C
SC R_ OR
I_ SU NE _C NT
I_ DO EO IN R
I_ IN _ IN L
SP INL NE F_ T_C
SP IN_ R_ F_ _CL
_D SC RR
IN IN CR LR
SP IN_ DO INT F_I
NK _D _E
I_ T_ F_ O
I_ ER EO T
SP OU EO L_E
I_ T_ TA
LI K
SP OU TO
I_ T_
d)
ve
SP OU
er
I_
s
SP
(re
31 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SPI_IN_SUC_EOF_DES_ADDR_REG The last inlink descriptor address when SPI DMA encountered
EOF. (RO)
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SPI_OUT_EOF_DES_ADDR_REG The last outlink descriptor address when SPI DMA encountered
EOF. (RO)
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RE
L
O P
DD
UL
IF M
_F _E
_A
)
ed
TX IFO
ES
rv
_D
_F
se
TX
TX
(re
31 30 29 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
TX_DES_ADDRESS The LSB of the SPI DMA outlink descriptor address. (RO)
S
ES
_F TY
DR
L
O P
UL
IF M
AD
_F _E
d)
S_
RX FIFO
ve
E
r
_D
se
_
RX
RX
(re
31 30 29 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RX_DES_ADDRESS The LSB of the SPI DMA inlink descriptor address. (RO)
8.1 Overview
The ESP32 features hardware support for the industry-standard Secure Digital (SD) device interface that
conforms to the SD Input/Output (SDIO) Specification Version 2.0. This allows a host controller to access the
ESP32 via an SDIO bus protocol, enabling high-speed data transfer.
The SDIO interface may be used to read ESP32 SDIO registers directly and access shared memory via Direct
Memory Access (DMA), thus reducing processing overhead while maintaining high performance.
8.2 Features
• Meets SDIO V2.0 specification
The Host System represents any SDIO specification V2.0-compatible host device. The Host System interacts
with the ESP32 (configured as the SDIO slave) via the standard SDIO bus implementation.
The SDIO Device Interface block enables effective communication with the external Host by directly providing
SDIO interface registers and enabling DMA operation for high-speed data transfer over the Advanced
High-performance Bus (AHB) without engaging the CPU.
ESP32 segregates data into packets sent to/from the Host. To achieve high bus utilization and data transfer
rates, we recommend the single block transmission mode. For detailed information on this mode, please refer to
the SDIO V2.0 protocol specification. When Host and Slave exchange data as blocks on the SDIO bus, the Slave
automatically pads data-when sending data out-and automatically strips padding data from the incoming data
block.
Whether the Slave pads or discards the data depends on the data address on the SDIO bus. When the data
address is equal to, or greater than, 0x1F800, the Slave will start padding or discarding data. Therefore, the
starting data address should be 0x1F800 - Packet_length, where Packet_length is measured in bytes. Data flow
on the SDIO bus is shown in Figure 8-2.
The standard IO_RW_EXTENDED (CMD53) command is used to initiate a packet transfer of an arbitrary length.
The content of the CMD53 command used in data transmission is as illustrated in Figure 8-3 below. For detailed
information on CMD53, please refer to the SDIO protocol specifications.
There are 54 bytes of field between SLCHOST_CONF_W0_REG and SLCHOST_CONF_W15_REG. Host and
Slave can access and change these fields, thus facilitating the information interaction between Host and
Slave.
8.3.4 DMA
The SDIO Slave module uses dedicated DMA to access data residing in the RAM. As shown in Figure 8-1, the
RAM is accessed over the AHB. DMA accesses RAM through a linked-list descriptor. Every linked list is
• Owner: The allowed operator of the buffer that corresponds to the current linked list. 0: CPU is the allowed
operator; 1: DMA is the allowed operator.
• Eof: End-of-file marker, indicating that this linked-list element is the last element of the data packet.
• Length: The number of valid bytes in the buffer, i.e., the number of bytes that should be accessed from the
buffer for reading/writing.
• Buffer Address Pointer: The address of the data buffer as seen by the CPU (according to the RAM address
space).
• Next Descriptor Address: The address of the next linked-list element in the CPU RAM address space. If the
current linked list is the last one, the Eof bit should be 1, and the last descriptor address should be 0.
When the Host is interrupted, it reads relevant information from the Slave by visiting registers SLC0HOST_INT
and SLCHOST_PKT_LEN.
• SLCHOST_PKT_LEN: Packet length accumulator register. The current value minus the value of last time
equals the packet length sent this time.
In order to start DMA, the CPU needs to write the low 20 bits of the address of the first linked-list element to the
SLC0_RXLINK_ADDR bit of SLC0RX_LINK, then set the SLC0_RXLINK_START bit of SLC0RX_LINK. The DMA
will automatically complete the data transfer. Upon completion of the operation, DMA will interrupt the CPU so
that the buffer space can be freed or reused.
The Host obtains the number of available receiving buffers from the Slave by accessing register
SLC0HOST_TOKEN_RDATA. The Slave CPU should update this value after the receiving DMA linked list is
prepared.
The Host can figure out the available buffer space, using HOSTREG_SLC0_TOKEN1 minus the number of
buffers already used.
If the buffers are not enough, the Host needs to constantly poll the register until there are enough buffers
available.
To ensure sufficient receiving buffers, the Slave CPU must constantly load buffers on the receiving linked list. The
process is shown in Figure 8-8.
The CPU first needs to append new buffer segments at the end of the linked list that is being used by DMA and is
available for receiving data.
The CPU then needs to notify the DMA that the linked list has been modified. This can be done by setting bit
SLC0_TXLINK_RESTART of the SLC0TX_LINK register. Please note that when the CPU initiates DMA to receive
packets for the first time, SLC0_TXLINK_RESTART should be set to 1.
Lastly, the CPU refreshes any available buffer information by writing to the SLC0TOKEN1 register.
When the incoming data changes near the rising edge of the clock, the Slave will perform sampling on the falling
edge of the clock, or vice versa, as Figure 8-9 shows.
Sampling edges are configured via the FRC_POS_SAMP and FRC_NEG_SAMP bitfields in the SLCHOST_CONF
register. Each field is five bits wide, with bits corresponding to the CMD line and four DATA lines (0-3). Setting a
bit in FRC_POS_SAMP causes the corresponding line to be sampled for input at the rising clock edge, whereas
setting a bit in FRC_NEG_SAMP causes the corresponding line to be sampled for input at the falling clock
edge.
The Slave can also select the edge at which data output lines are driven to accommodate for any latency caused
by the physical signal path, as shown in Figure 8-10.
Driving edges are configured via the FRC_SDIO20 and FRC_SDIO11 bitfields in the SLCHOST_CONF register.
Each field is five bits wide, with bits corresponding to the CMD line and four DATA lines (0-3). Setting a bit in
FRC_SDIO20 causes the corresponding line to output at the rising clock edge, whereas setting a bit in
FRC_SDIO11 causes the corresponding line to output at the falling clock edge.
8.3.7 Interrupt
Host and Slave can interrupt each other via the interrupt vector. Both Host and Slave have eight interrupt
vectors. The interrupt is enabled by configuring the interrupt vector register (setting the enable bit to 1). The
interrupt vector registers can clear themselves automatically, which means one interrupt at a time and no other
configuration is required.
O TES CK
LR
LO P_ BA
_C
P_ T
ST
X_ O R
O
TE
_T LO _W
UT
A
C0 X_ TO
N_
X_ T
T
SL _R AU
_T RS
RS
KE
se F0_ C0 X_
C0 X_
TO
L R
SL _R
0_
O 0_S C0_
0_ C0
LC
CC NF SL
NF L
_S
O 0_S
SL CO 0_
0
NF
C NF
CC NF
d)
)
N
ed
ed
ve
SL CO
SL O
rv
rv
CC
CC
er
se
C
s
SL
SL
SL
(re
(re
(re
31 15 14 13 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 Reset
SLCCONF0_SLC0_RX_LOOP_TEST Loop around when the slave buffer finishes sending packets.
When set to 1, hardware will not change the owner bit in the linked list. (R/W)
SLCCONF0_SLC0_TX_LOOP_TEST Loop around when the slave buffer finishes receiving packets.
When set to 1, hardware will not change the owner bit in the linked list. (R/W)
_R W
AW
AW W
NT A
_R RA
C T_ C_ O _B _IN RA
C0 T_ C_ O _B _IN RA
IN A
RA
C T_ C_ O _B _IN W
C T_ C_ O _B T W
NE F_ AW
T_ C_ O _B _I R
C_ HO T_B 3_ _R
HO T_B 2_ _R
_ B _I _R
0_ _R
RR NT
NT _
C T_ C_ X_ RT _R
C0 X_ N _R
C T_ C0 _S F_ R
C T_ C_ O R T
X_ _ T
CR ER
C T_ C0 X_ _I
T_ C0 X_ _
X_ C
C
IN SL _R OF
SL 0IN SL _R VF
_T S
C d) C0 X_D
C _ 0 _O
C0 T_ C0 X_E
SL IN L TX
SL rve SL _R
SL IN SL _R
_
se T_ C0
C0 T_ C0
C0 T_ C0
C
(re IN SL
SL IN L
SL IN SL
S
S
C0 T_
C0 T_
C0 _
d)
)
ed
ed
T
ve
SL 0IN
SL 0IN
SL 0IN
rv
rv
er
se
se
C
C
s
SL
SL
(re
(re
(re
31 27 26 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0x00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SLC0INT_SLC0_RX_DSCR_ERR_INT_RAW The raw interrupt bit for Slave sending descriptor error
(RO)
SLC0INT_SLC0_TX_DSCR_ERR_INT_RAW The raw interrupt bit for Slave receiving descriptor error.
(RO)
SLC0INT_SLC0_RX_EOF_INT_RAW The interrupt mark bit when Slave sending operation is finished.
(RO)
SLC0INT_SLC0_RX_DONE_INT_RAW The raw interrupt bit to mark single buffer as sent by Slave.
(RO)
SLC0INT_SLC0_TX_DONE_INT_RAW The raw interrupt bit to mark a single buffer as finished during
Slave receiving operation. (RO)
SLC0INT_SLC0_TX_OVF_INT_RAW The raw interrupt bit to mark Slave receiving buffer overflow.
(RO)
SLC0INT_SLC0_RX_UDF_INT_RAW The raw interrupt bit for Slave sending buffer underflow. (RO)
SLC0INT_SLC0_TX_START_INT_RAW The raw interrupt bit for registering Slave receiving initializa-
tion interrupt. (RO)
SLC0INT_SLC0_RX_START_INT_RAW The raw interrupt bit to mark Slave sending initialization in-
terrupt. (RO)
SLC0INT_SLC_FRHOST_BIT7_INT_RAW The interrupt mark bit 7 for Host to interrupt Slave. (RO)
SLC0INT_SLC_FRHOST_BIT6_INT_RAW The interrupt mark bit 6 for Host to interrupt Slave. (RO)
SLC0INT_SLC_FRHOST_BIT5_INT_RAW The interrupt mark bit 5 for Host to interrupt Slave. (RO)
SLC0INT_SLC_FRHOST_BIT4_INT_RAW The interrupt mark bit 4 for Host to interrupt Slave. (RO)
SLC0INT_SLC_FRHOST_BIT3_INT_RAW The interrupt mark bit 3 for Host to interrupt Slave. (RO)
SLC0INT_SLC_FRHOST_BIT2_INT_RAW The interrupt mark bit 2 for Host to interrupt Slave. (RO)
SLC0INT_SLC_FRHOST_BIT1_INT_RAW The interrupt mark bit 1 for Host to interrupt Slave. (RO)
SLC0INT_SLC_FRHOST_BIT0_INT_RAW The interrupt mark bit 0 for Host to interrupt Slave. (RO)
Espressif Systems 165 ESP32 TRM (Version4.4)
Submit Documentation Feedback
8 SDIO Slave Controller
NT T
T
_I _S
_S
_S S T
C T_ C_ O _B _IN ST
C0 T_ C_ O _B _IN ST
SL FR S IT NT T
FR S IT INT T
ST IT1 INT T
IT NT T
IN T
ST
T_ C_ O _B _I S
C_ HO T_B 3_ _S
HO T_B 2_ _S
_B _I _S
0_ _S
RR NT
NT _
T_
NE F_ T
T
_I INT
_E R_I
DO EO _S
C T_ C_ O _B _IN
SL 0IN SL _R TA INT T
C T_ C_ X_ RT _S
C0 X_ N _S
C T_ C_ O _B T
C T_ C0 _S F_ S
C T_ C_ O R T
X_ _ T
CR ER
E
I
C T_ C0 X_ _I
T_ C0 X_ _
X_ C
C
IN SL _R OF
SL 0IN SL _R VF
_T S
C d) C0 X_D
C _ 0 _O
C0 T_ C0 X_E
SL IN L TX
SL rve SL _R
SL IN SL _R
_
se T_ C0
C0 T_ C0
C0 T_ C0
C
(re IN SL
SL IN L
SL IN SL
S
S
C0 T_
C0 T_
C0 _
)
d)
)
ed
ed
T
ve
SL 0IN
SL 0IN
SL 0IN
rv
rv
er
se
se
C
C
s
SL
SL
(re
(re
(re
31 27 26 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0x00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SLC0INT_SLC0_RX_DSCR_ERR_INT_ST The interrupt status bit for Slave sending descriptor error.
(RO)
SLC0INT_SLC0_TX_DSCR_ERR_INT_ST The interrupt status bit for Slave receiving descriptor error.
(RO)
SLC0INT_SLC0_RX_EOF_INT_ST The interrupt status bit for finished Slave sending operation. (RO)
SLC0INT_SLC0_RX_DONE_INT_ST The interrupt status bit for finished Slave sending operation.
(RO)
SLC0INT_SLC0_TX_SUC_EOF_INT_ST The interrupt status bit for marking Slave receiving opera-
tion as finished. (RO)
SLC0INT_SLC0_TX_DONE_INT_ST The interrupt status bit for marking a single buffer as finished
during the receiving operation. (RO)
SLC0INT_SLC0_TX_OVF_INT_ST The interrupt status bit for Slave receiving overflow interrupt. (RO)
SLC0INT_SLC0_RX_UDF_INT_ST The interrupt status bit for Slave sending buffer underflow. (RO)
SLC0INT_SLC0_TX_START_INT_ST The interrupt status bit for Slave receiving interrupt initialization.
(RO)
SLC0INT_SLC0_RX_START_INT_ST The interrupt status bit for Slave sending interrupt initialization.
(RO)
SLC0INT_SLC_FRHOST_BIT7_INT_ST The interrupt status bit 7 for Host to interrupt Slave. (RO)
SLC0INT_SLC_FRHOST_BIT6_INT_ST The interrupt status bit 6 for Host to interrupt Slave. (RO)
SLC0INT_SLC_FRHOST_BIT5_INT_ST The interrupt status bit 5 for Host to interrupt Slave. (RO)
SLC0INT_SLC_FRHOST_BIT4_INT_ST The interrupt status bit 4 for Host to interrupt Slave. (RO)
SLC0INT_SLC_FRHOST_BIT3_INT_ST The interrupt status bit 3 for Host to interrupt Slave. (RO)
SLC0INT_SLC_FRHOST_BIT2_INT_ST The interrupt status bit 2 for Host to interrupt Slave. (RO)
SLC0INT_SLC_FRHOST_BIT1_INT_ST The interrupt status bit 1 for Host to interrupt Slave. (RO)
SLC0INT_SLC_FRHOST_BIT0_INT_ST The interrupt status bit 0 for Host to interrupt Slave. (RO)
_E A
NA
NT N
NA A
_E E N
C T_ C_ O _B _IN EN
C0 T_ C_ O _B _IN EN
T_ C_ O _B _I EN
IN N
EN
C T_ C_ O _B _IN A
C T_ C_ O _B T A
NE F_ A
C_ HO T_B 3_ _E
HO T_B 2_ _E
_B _I _E
0_ _E
RR NT
NT _
_I INT
SL 0IN SL _R TA INT NA
_E R_I
SU E_ N
_ D _E T_
C T_ C_ X_ RT _E
C0 X_ N _E
C T_ C_ O R T
C T_ C0 _S F_ E
CR ER
C T_ C0 X_ _I
T_ C0 X_ _
X_ C
IN SL _R OF
SL 0IN SL _R VF
_T S
C d) C0 X_D
C _ 0 _O
C0 T_ C0 X_E
SL IN L TX
SL rve SL _R
SL IN SL _R
_
se T_ C0
C0 T_ C0
C0 T_ C0
C
(re IN SL
SL IN L
SL IN L
S
S
S
C0 T_
C0 T_
C0 _
d)
)
ed
ed
T
ve
SL 0IN
SL 0IN
SL 0IN
rv
rv
er
se
se
C
C
s
SL
SL
(re
(re
(re
31 27 26 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0x00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SLC0INT_SLC0_RX_DSCR_ERR_INT_ENA The interrupt enable bit for Slave sending linked list de-
scriptor error. (R/W)
SLC0INT_SLC0_TX_DSCR_ERR_INT_ENA The interrupt enable bit for Slave receiving linked list de-
scriptor error. (R/W)
SLC0INT_SLC0_RX_EOF_INT_ENA The interrupt enable bit for Slave sending operation completion.
(R/W)
SLC0INT_SLC0_RX_DONE_INT_ENA The interrupt enable bit for single buffer’s sent interrupt, in
Slave sending mode. (R/W)
SLC0INT_SLC0_TX_SUC_EOF_INT_ENA The interrupt enable bit for Slave receiving operation com-
pletion. (R/W)
SLC0INT_SLC0_TX_DONE_INT_ENA The interrupt enable bit for single buffer’s full event, in Slave
receiving mode. (R/W)
SLC0INT_SLC0_TX_OVF_INT_ENA The interrupt enable bit for Slave receiving buffer overflow. (R/W)
SLC0INT_SLC0_RX_UDF_INT_ENA The interrupt enable bit for Slave sending buffer underflow.
(R/W)
SLC0INT_SLC0_TX_START_INT_ENA The interrupt enable bit for Slave receiving operation initial-
ization. (R/W)
SLC0INT_SLC0_RX_START_INT_ENA The interrupt enable bit for Slave sending operation initializa-
tion. (R/W)
SLC0INT_SLC_FRHOST_BIT7_INT_ENA The interrupt enable bit 7 for Host to interrupt Slave. (R/W)
SLC0INT_SLC_FRHOST_BIT6_INT_ENA The interrupt enable bit 6 for Host to interrupt Slave. (R/W)
SLC0INT_SLC_FRHOST_BIT5_INT_ENA The interrupt enable bit 5 for Host to interrupt Slave. (R/W)
SLC0INT_SLC_FRHOST_BIT4_INT_ENA The interrupt enable bit 4 for Host to interrupt Slave. (R/W)
SLC0INT_SLC_FRHOST_BIT3_INT_ENA The interrupt enable bit 3 for Host to interrupt Slave. (R/W)
SLC0INT_SLC_FRHOST_BIT2_INT_ENA The interrupt enable bit 2 for Host to interrupt Slave. (R/W)
SLC0INT_SLC_FRHOST_BIT1_INT_ENA The interrupt enable bit 1 for Host to interrupt Slave. (R/W)
SLC0INT_SLC_FRHOST_BIT0_INT_ENA The interrupt enable bit 0 for Host to interrupt Slave. (R/W)
Espressif Systems 167 ESP32 TRM (Version4.4)
Submit Documentation Feedback
8 SDIO Slave Controller
NT LR
LR
LR R
_C CL
C0 T_ C_ O _B _IN CL
IN L
CL
C T_ C_ O _B _IN R
C T_ C_ O _B T R
C T_ C_ O _B _IN C
T_ C_ O _B _I C
C_ HO T_B 3_ _C
HO T_B 2_ _C
_B _I _C
0_ _C
NE F_ LR
RR NT
NT _
_I INT
SL 0IN SL _R TA INT LR
DO EO _C
_E R_I
C T_ C_ X_ RT _C
C0 X_ N _C
C T_ C0 _S F_ C
C T_ C_ O R T
X_ _ T
CR ER
E
I
C T_ C0 X_ _I
T_ C0 X_ _
X_ C
C
IN SL _R OF
SL 0IN SL _R VF
_T S
C d) C0 X_D
C _ 0 _O
C0 T_ C0 X_E
SL IN L TX
SL rve SL _R
SL IN SL _R
_
se T_ C0
C0 T_ C0
C0 T_ C0
C
(re IN SL
SL IN L
SL IN SL
S
S
C0 T_
C0 T_
C0 _
)
d)
)
ed
ed
T
ve
SL 0IN
SL 0IN
SL 0IN
rv
rv
er
se
se
C
C
s
SL
SL
(re
(re
(re
31 27 26 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0x00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SLC0INT_SLC0_RX_DSCR_ERR_INT_CLR Interrupt clear bit for Slave sending linked list descriptor
error. (WO)
SLC0INT_SLC0_TX_DSCR_ERR_INT_CLR Interrupt clear bit for Slave receiving linked list descriptor
error. (WO)
SLC0INT_SLC0_RX_EOF_INT_CLR Interrupt clear bit for Slave sending operation completion. (WO)
SLC0INT_SLC0_RX_DONE_INT_CLR Interrupt clear bit for single buffer’s sent interrupt, in Slave
sending mode. (WO)
SLC0INT_SLC0_TX_DONE_INT_CLR Interrupt clear bit for single buffer’s full event, in Slave receiving
mode. (WO)
SLC0INT_SLC0_TX_OVF_INT_CLR Set this bit to clear the Slave receiving overflow interrupt. (WO)
SLC0INT_SLC0_RX_UDF_INT_CLR Set this bit to clear the Slave sending underflow interrupt. (WO)
SLC0INT_SLC0_TX_START_INT_CLR Set this bit to clear the interrupt for Slave receiving operation
initialization. (WO)
SLC0INT_SLC0_RX_START_INT_CLR Set this bit to clear the interrupt for Slave sending operation
initialization. (WO)
R
P
DD
TO
RX K ES
0_ LIN _R
_A
LC RX K
K
_S 0_ LIN
IN
XL
RX LC RX
_R
C0 _S 0_
0
SL 0RX SLC
LC
_S
C d)
)
C _
ed
SL 0RX
RX
SL rve
rv
C0
se
se
SL
(re
(re
31 30 29 28 27 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0x000000 Reset
SLC0RX_SLC0_RXLINK_RESTART Set this bit to restart and continue the linked list operation for
sending packets. (R/W)
SLC0RX_SLC0_RXLINK_START Set this bit to start the linked list operation for sending packets.
Sending will start from the address indicated by SLC0_RXLINK_ADDR. (R/W)
SLC0RX_SLC0_RXLINK_STOP Set this bit to stop the linked list operation. (R/W)
SLC0RX_SLC0_RXLINK_ADDR The lowest 20 bits in the initial address of Slave’s sending linked list.
(R/W)
NK TA RT
LI _S TA
_S RT
R
P
DD
TO
TX K S
0_ LIN RE
_A
LC TX K_
NK
_S 0_ LIN
LI
TX LC TX
TX
C0 _S 0_
0_
SL 0TX LC
LC
C _S
S
C d)
X_
ed
SL 0TX
SL rve
T
rv
C0
se
se
SL
(re
(re
31 30 29 28 27 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0x000000 Reset
SLC0TX_SLC0_TXLINK_RESTART Set this bit to restart and continue the linked list operation for
receiving packets. (R/W)
SLC0TX_SLC0_TXLINK_START Set this bit to start the linked list operation for receiving packets.
Receiving will start from the address indicated by SLC0_TXLINK_ADDR. (R/W)
SLC0TX_SLC0_TXLINK_STOP Set this bit to stop the linked list operation for receiving packets.
(R/W)
SLC0TX_SLC0_TXLINK_ADDR The lowest 20 bits in the initial address of Slave’s receiving linked
list. (R/W)
EC
TV
N
_I
ST
HO
O
_T
C0
SL
C_
VE
)
)
d
ed
ed
ve
NT
rv
rv
r
se
se
se
CI
SL
(re
(re
(re
31 24 23 16 15 8 7 0
RE
O
TA
M
DA
C_
IN
W
_
_
N1
N1
N1
KE
KE
KE
O
TO
TO
_T
_
0
C0
C0
LC
SL
L
_S
_S
1_
N1
N1
EN
KE
KE
(re OK
d)
C0 d)
)
ed
TO
O
ve
SL rve
T
T
rv
er
C0
C0
se
se
s
SL
SL
(re
(re
31 28 27 16 15 14 13 12 11 0
LR
_A H N
UT _EN
EN ITC _E
_C
_L ST H
O
C0 X_ ITC
SL _T ST
1_ C0 X_
NF L R
O 1_S C0_
CC NF SL
SL CO 1_
C NF
d)
)
ed
ed
e
SL CO
rv
rv
rv
se
se
se
C
SL
(re
(re
(re
31 23 22 16 15 7 6 5 4
0x000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 Reset
CE
LA
EP
_R
NO
N_
KE
TO
_
C0
)
ed
SL
rv
C_
se
SL
(re
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
TA
_M
DA
NC
W
se N_I
N_
)
)
E
E
ed
ed
_L
_L
ve
rv
rv
r
C0
C0
se
se
SL
SL
(re
(re
(re
31 29 28 23 22 21 20 19 0
SLC0_LEN_INC_MORE Set this bit to add the value of SLC0_LEN to that of SLC0_LEN_WDATA.
(WO)
_L
rv
C0
se
SL
(re
31 20 19 0
N1
KE
O
_T
0
LC
_S
G
)
)
ed
ed
RE
rv
rv
ST
se
se
HO
(re
(re
31 28 27 16 15 0
W
RA
ST IT1 T_ W
W
IN AW
T_
HO _B _IN RA
_B _IN RA
RA
C0 ST LC OH T_ 6_ _R
C0 ST LC OH T_ 5_ _R
ST LC OH ST_ 4_ _R
LC O ST 3_ _R
0_ T_R
IN
TO ST IT2 T_
T_
T_
RA
_IN RA
C0 ST LC OH T_ 7_
AC
DF T_
SL HO _S 0_T OS BIT
IT
_P
_U _IN
C0 ST LC OH T_
W
RX F
SL HO _S 0_T OS
E
0_ OV
_N
C0 ST LC OH
LC X_
X
_R
_S 0_T
SL HO _S 0_T
C0
ST LC
C0 ST LC
L
_S
HO _S
SL HO _S
ST
C0 OST
C0 ST
d)
)
ed
ed
ed
HO
SL HO
e
H
rv
rv
rv
rv
C0
C0
C0
se
se
se
se
SL
SL
SL
SL
(re
(re
(re
(re
31 26 25 24 23 22 18 17 16 15 8 7 6 5 4 3 2 1 0
0x00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
ST
T_
C0 S LC TO OS BIT INT T
ST LC TO OST BIT INT T
LC TO S IT NT T
TO S IT NT T
ST IT1 INT T
IT NT T
IN T
IN
C S L T OS BIT IN
KE
T
_I ST
DF T_
C S L T OS BIT
NT
_P
_U _IN
RX VF
C S L T OS
NE
0_ _O
SL HO T_S 0_ H
X_
C0 S LC TO
LC TX
R
0_
_S 0 _
ST LC
C S L
_S
HO T_S
SL 0HO T_S
ST
C0 S
C S
)
d)
d)
)
ed
ed
HO
SL HO
SL 0HO
ve
ve
rv
rv
er
er
C0
C0
se
se
C
s
s
SL
SL
SL
(re
(re
(re
(re
31 26 25 24 23 22 18 17 16 15 8 7 6 5 4 3 2 1 0
0x00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
K
H EC
_C
EN
N
LE
_L
0_
0
LC
LC
_S
_S
G
G
RE
RE
ST
ST
O
O
_H
_H
ST
ST
O
O
CH
CH
SL
SL
31 20 19 0
SLCHOST_HOSTREG_SLC0_LEN The accumulated value of the data length sent by the Slave. The
value gets updated only when the Host reads it.
0
NF
NF
NF
NF
O
O
_C
_C
_C
_C
ST
ST
ST
ST
O
O
CH
CH
CH
CH
SL
SL
SL
SL
31 24 23 16 15 8 7 0
SLCHOST_CONF3 The information interaction register between Host and Slave. Both Host and Slave
can access it. (R/W)
SLCHOST_CONF2 The information interaction register between Host and Slave. Both Host and Slave
can access it. (R/W)
SLCHOST_CONF1 The information interaction register between Host and Slave. Both Host and Slave
can access it. (R/W)
SLCHOST_CONF0 The information interaction register between Host and Slave. Both Host and Slave
can access it. (R/W)
4
NF
NF
NF
NF
O
O
_C
_C
_C
_C
ST
ST
ST
ST
O
O
CH
CH
CH
CH
SL
SL
SL
SL
31 24 23 16 15 8 7 0
SLCHOST_CONF7 The information interaction register between Host and Slave. Both Host and Slave
can access it. (R/W)
SLCHOST_CONF6 The information interaction register between Host and Slave. Both Host and Slave
can access it. (R/W)
SLCHOST_CONF5 The information interaction register between Host and Slave. Both Host and Slave
can access it. (R/W)
SLCHOST_CONF4 The information interaction register between Host and Slave. Both Host and Slave
can access it. (R/W)
10
8
NF
NF
NF
NF
O
O
_C
_C
_C
_C
ST
ST
ST
ST
O
O
CH
CH
CH
CH
SL
SL
SL
31 24 23 16 15 8 7 SL 0
SLCHOST_CONF11 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF10 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF9 The information interaction register between Host and Slave. Both Host and Slave
can access it. (R/W)
SLCHOST_CONF8 The information interaction register between Host and Slave. Both Host and Slave
can access it. (R/W)
15
4
1
NF
NF
O
O
_C
_C
ST
ST
O
O
CH
CH
SL
SL
31 24 23 16
SLCHOST_CONF15 The information interaction register between Host and Slave. Both Host and
Slave can be read from and written to this. (R/W)
SLCHOST_CONF14 The information interaction register between Host and Slave. Both Host and
Slave can be read from and written to this. (R/W)
18
NF
NF
O
O
_C
_C
ST
ST
O
O
CH
CH
SL
SL
31 24 23 16
SLCHOST_CONF19 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF18 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
27
26
4
2
2
NF
NF
NF
NF
O
O
_C
_C
_C
_C
ST
ST
ST
ST
O
O
CH
CH
CH
CH
SL
SL
SL
SL
31 24 23 16 15 8 7 0
SLCHOST_CONF27 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF26 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF25 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF24 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
29
NF
NF
O
O
_C
_C
ST
ST
d)
)
ed
ve
O
rv
CH
CH
r
se
se
SL
SL
(re
31 24 23 16 15 8 7
(re 0
SLCHOST_CONF31 The interrupt vector used by Host to interrupt Slave. This bit will not be cleared
automatically. (WO)
SLCHOST_CONF29 The interrupt vector used by Host to interrupt Slave. This bit will not be cleared
automatically. (WO)
35
34
2
3
3
NF
NF
NF
NF
O
O
_C
_C
_C
_C
ST
ST
ST
ST
O
O
CH
CH
CH
CH
SL
SL
SL
SL
31 24 23 16 15 8 7 0
SLCHOST_CONF35 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF34 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF33 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF32 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
38
37
36
NF
NF
NF
NF
O
O
_C
_C
_C
_C
ST
ST
ST
ST
O
O
CH
CH
CH
CH
SL
SL
SL
31 24 23 16 15 8 7
SL 0
SLCHOST_CONF39 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF38 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF37 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF36 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
43
42
0
4
4
NF
NF
NF
NF
O
O
_C
_C
_C
_C
ST
ST
ST
ST
O
O
CH
CH
CH
CH
SL
SL
SL
SL
31 24 23 16 15 8 7 0
SLCHOST_CONF43 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF42 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF41 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF40 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
46
45
44
NF
NF
NF
NF
O
O
_C
_C
_C
_C
ST
ST
ST
ST
O
O
CH
CH
CH
CH
SL
SL
SL
31 24 23 16 15 8 7
SL 0
SLCHOST_CONF47 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF46 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF45 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF44 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
51
50
8
4
4
NF
NF
NF
NF
O
O
_C
_C
_C
_C
ST
ST
ST
ST
O
O
CH
CH
CH
CH
SL
SL
SL
SL
31 24 23 16 15 8 7 0
SLCHOST_CONF51 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF50 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF49 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF48 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
54
53
52
NF
NF
NF
NF
O
O
_C
_C
_C
_C
ST
ST
ST
ST
O
O
CH
CH
CH
CH
SL
SL
SL
31 24 23 16 15 8 7
SL 0
SLCHOST_CONF55 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF54 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF53 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF52 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
59
58
6
5
5
NF
NF
NF
NF
O
O
_C
_C
_C
_C
ST
ST
ST
ST
O
O
CH
CH
CH
CH
SL
SL
SL
SL
31 24 23 16 15 8 7 0
SLCHOST_CONF59 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF58 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF57 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF56 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
62
61
60
NF
NF
NF
NF
O
O
_C
_C
_C
_C
ST
ST
ST
ST
O
O
CH
CH
CH
CH
SL
SL
SL
31 24 23 16 15 8 7
SL 0
SLCHOST_CONF63 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF62 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF61 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
SLCHOST_CONF60 The information interaction register between Host and Slave. Both Host and
Slave can access it. (R/W)
R
CL
C0 S LC TO ST IT5 T_ R
ST LC TO ST IT4 T_ R
LC TO ST IT3 T_ R
TO S IT T R
ST IT1 NT_ LR
IT T R
IN LR
T_
_B _IN CL
HO T_B 2_I _C
0_ _C
C
IN
T_
T_
C S LC TO ST IT6 T
R
T_ R
CL
_IN CL
C S LC TO ST IT7
AC
DF T_
SL 0HO T_S 0_ HO _B
_P
_U _IN
W
C S LC TO ST
RX VF
NE
SL 0HO T_S 0_ HO
0_ _O
_
C S LC TO
RX
LC TX
0_
_S 0_
SL 0HO T_S 0_
LC
ST LC
C S LC
_S
HO _S
SL HO T_S
ST
T
C0 S
C0 S
)
)
ed
ed
ed
ed
O
SL O
SL 0HO
0H
H
rv
rv
rv
rv
C0
se
se
se
se
C
C
SL
SL
SL
(re
(re
(re
(re
31 26 25 24 23 22 18 17 16 15 8 7 6 5 4 3 2 1 0
0x00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
A
EN
A
ST 1_ C0_ HO _BIT INT A
_S _T OS BIT3 T_ A
A
HO _B IN NA
_B _IN NA
T_ A
T_
_IN EN
_IN EN
IN
TO ST IT2_ T_E
ST IT1 T_E
E
I T 0 T_
T_
T
T
A
_IN NA
IN
KE
EN
DF T_E
AC
T_
T
T
BI
I
BI
B
O B
_P
_U IN
_
LC OH T_
RX F_
W
_F SL TO ST
NE
0_ OV
O
O
O
O
SL HO _FN SLC TOH
N1 C0 H
X_
LC X_
_R
_S _T
C0 ST 1_ 0_
C0 ST 1_ 0_
C0 ST 1_ 0_
C0 ST 1_ 0_
C0 ST 1_ 0_
0_
0
N1 C0
LC
SL HO _FN SLC
_F SL
_S
ST 1_
C0 ST 1_
N1
HO FN
SL HO _FN
_F
_
ST
C0 ST
C0 ST
d)
d)
d)
d)
HO
SL HO
rve
rve
rve
rve
H
C0
C0
C0
se
se
se
se
SL
SL
SL
SL
(re
(re
(re
(re
31 26 25 24 23 22 18 17 16 15 8 7 6 5 4 3 2 1 0
0x00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
P
P
AM
M
SA
20
11
_S
S_
IO
O
G
DI
O
SD
NE
_P
_S
_
_
RC
RC
RC
RC
_F
_F
_F
_F
ST
ST
ST
ST
d)
d)
ve
ve
O
CH
CH
CH
CH
er
er
s
SL
SL
SL
SL
(re
(re
31 28 27 20 19 15 14 10 9 5 4 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SLCHOST_FRC_POS_SAMP Set this bit to sample the corresponding signal at the rising clock edge.
(R/W)
SLCHOST_FRC_NEG_SAMP Set this bit to sample the corresponding signal at the falling clock edge.
(R/W)
SLCHOST_FRC_SDIO20 Set this bit to output the corresponding signal at the rising clock edge.
(R/W)
SLCHOST_FRC_SDIO11 Set this bit to output the corresponding signal at the falling clock edge.
(R/W)
Y1 LE
AD AB
RE N
O _E
_I D
O E
DI PE
_S HS
NF IG
)
ed
HI _H
rv
NF
se
(re
HI
31 3 2 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
9.1 Overview
The ESP32 memory card interface controller provides a hardware interface between the Advanced Peripheral Bus
(APB) and an external memory device. The memory card interface allows the ESP32 to be connected to SDIO
memory cards, MMC cards and devices with a CE-ATA interface. It supports two external cards (Card0 and
Card1).
9.2 Features
This module has the following features:
The SD/MMC controller topology is shown in Figure 9-1. The controller supports two peripherals which cannot be
functional at the same time.
• Bus Interface Unit (BIU): It provides APB interfaces for registers, data read and write operation by FIFO and
DMA.
• Card Interface Unit (CIU): It handles external memory card interface protocols. It also provides clock control.
9.4.1.1 BIU
The BIU provides the access to registers and FIFO data through the Host Interface Unit (HIU). Additionally, it provides
FIFO access to independent data through a DMA interface. The host interface can be configured as an APB
interface. Figure 9-3 illustrates the internal components of the BIU. The BIU provides the following functions:
• Host interface
• DMA interface
• Interrupt control
• Register access
• FIFO access
9.4.1.2 CIU
The CIU module implements the card-specific protocols. Within the CIU, the command path control unit and
data path control unit prompt the controller to interface with the command and data ports, respectively, of the
SD/MMC/CE-ATA cards. The CIU also provides clock control. Figure 9-3 illustrates the internal structure of the
CIU, which consists of the following primary functional blocks:
• Command path
• Data path
• Clock control
• Mux/demux unit
If the data_expected bit is set in the Command register, the new command is a data-transfer command and the
data path starts one of the following operations:
If no data are received by the data timeout, the data path signals a data timeout to the BIU, which marks an end
to the data transfer. Based on the value of the transfer_mode bit in the Command register, the data-receive state
machine gets data from the card’s data bus in a stream or block(s). The data receive state machine is shown in
Figure 9-6.
• During an open-ended card-write operation, if the card clock is stopped due to FIFO being empty, the
software must fill FIFO with data first, and then start the card clock. Only then can it issue a stop/abort
command to the card.
• During an SDIO/COMBO card transfer, if the card function is suspended and the software wants to resume
the suspended transfer, it must first reset FIFO, and then issue the resume command as if it were a new
data-transfer command.
• When issuing card reset commands (CMD0, CMD15 or CMD52_reset), while a card data transfer is in
progress, the software must set the stop_abort_cmd bit in the Command register, so that the CIU can
stop the data transfer after issuing the card reset command.
• When the data’s end bit error is set in the RINTSTS register, the CIU does not guarantee SDIO interrupts. In
such a case, the software ignores SDIO interrupts and issues a stop/abort command to the card, so that
the card stops sending read-data.
• If the card clock is stopped due to FIFO being full during a card read, the software will read at least two FIFO
locations to restart the card clock.
• Only one CE-ATA device at a time can be selected for a command or data transfer. For example, when data
are transferred from a CE-ATA device, a new command should not be sent to another CE-ATA device.
• If a CE-ATA device’s interrupts are enabled (nIEN=0), a new RW_BLK command should not be sent to the
same device if the execution of a RW_BLK command is already in progress (the RW_BLK command used in
this databook is the RW_MULTIPLE_BLOCK MMC command defined by the CE-ATA specifications). Only
the CCSD can be sent while waiting for the CCS.
• If, however, a CE-ATA device’s interrupts are disabled (nIEN=1), a new command can be issued to the same
device, allowing it to read status information.
• The send_auto_stop signal is not supported (software should not set the send_auto_stop bit) in CE-ATA
transfers.
After configuring the command start bit to 1, the values of the following registers cannot be changed before a
command has been issued:
• CMD - command
• TMOUT - timeout
If SDIO-sending is enabled, data can be written to the transferred RAM module by APB interface or DMA. Data
will be written from register EMAC_FIFO to the CPU, directly, by an APB interface.
When a subunit of the data path receives data, the subdata will be written onto the receive-RAM. Then, these
subdata can be read either with the APB or the DMA method at the reading end. Register EMAC_FIFO can be
read by the APB directly.
The DES2 element contains the address pointer to the data buffer.
The DES3 element contains the address pointer to the next descriptor if the present descriptor is not the last one
in a chained descriptor structure.
Table 95. DES3
9.9 Initialization
9.9.1 DMAC Initialization
The DMAC initialization should proceed as follows:
• Write to the DMAC Bus Mode Register (BMOD_REG) will set the Host bus’s access parameters.
• Write to the DMAC Interrupt Enable Register (IDINTEN) will mask any unnecessary interrupt causes.
• The software driver creates either the transmit or the receive descriptor list. Then, it writes to the DMAC
Descriptor List Base Address Register (DBADDR), providing the DMAC with the starting address of the list.
1. The Host sets up the elements (DES0-DES3) for transmission, and sets the OWN bit (DES0[31]). The Host
also prepares the data buffer.
2. The Host programs the write-data command in the CMD register in BIU.
3. The Host also programs the required transmit threshold (TX_WMARK field in FIFOTH register).
4. The DMAC engine fetches the descriptor and checks the OWN bit. If the OWN bit is not set, it means that
the host owns the descriptor. In this case, the DMAC enters a suspend-state and asserts the Descriptor
Unable interrupt in the IDSTS register. In such a case, the host needs to release the DMAC by writing any
value to PLDMND_REG.
5. It then waits for the Command Done (CD) bit and no errors from BIU, which indicates that a transfer can be
done.
6. Subsequently, the DMAC engine waits for a DMA interface request (dw_dma_req) from BIU. This request will
be generated, based on the programmed transmit-threshold value. For the last bytes of data which cannot
be accessed using a burst, single transfers are performed on the AHB Master Interface.
7. The DMAC fetches the transmit data from the data buffer in the Host memory and transfers them to FIFO for
transmission to card.
8. When data span across multiple descriptors, the DMAC fetches the next descriptor and extends its operation
using the following descriptor. The last descriptor bit indicates whether the data span multiple descriptors
or not.
9. When data transmission is complete, the status information is updated in the IDSTS register by setting the
Transmit Interrupt, if it has already been enabled. Also, the OWN bit is cleared by the DMAC by performing
a write transaction to DES0.
1. The Host sets up the element (DES0-DES3) for reception, and sets the OWN bit (DES0[31]).
2. The Host programs the read-data command in the CMD register in BIU.
3. Then, the Host programs the required level of the receive-threshold (RX_WMARK field in FIFOTH register).
4. The DMAC engine fetches the descriptor and checks the OWN bit. If the OWN bit is not set, it means that the
host owns the descriptor. In this case, the DMA enters a suspend-state and asserts the Descriptor Unable
interrupt in the IDSTS register. In such a case, the host needs to release the DMAC by writing any value to
PLDMND_REG.
5. It then waits for the Command Done (CD) bit and no errors from BIU, which indicates that a transfer can be
done.
6. The DMAC engine then waits for a DMA interface request (dw_dma_req) from BIU. This request will be
generated, based on the programmed receive-threshold value. For the last bytes of the data which cannot
be accessed using a burst, single transfers are performed on the AHB.
7. The DMAC fetches the data from FIFO and transfers them to the Host memory.
8. When data span across multiple descriptors, the DMAC will fetch the next descriptor and extend its operation
using the following descriptor. The last descriptor bit indicates whether the data span multiple descriptors
or not.
9. When data reception is complete, the status information is updated in the IDSTS register by setting Receive-
Interrupt, if it has already been enabled. Also, the OWN bit is cleared by the DMAC by performing a write-
transaction to DES0.
Please find detailed information on the clock phase selection register CLK_EDGE_SEL in Section Registers.
9.11 Interrupt
Interrupts can be generated as a result of various events. The IDSTS register contains all the bits that might cause
an interrupt. The IDINTEN register contains an enable bit for each of the events that can cause an interrupt.
There are two groups of summary interrupts, ”Normal” ones (bit8 NIS) and ”Abnormal” ones (bit9 AIS), as outlined in
the IDSTS register. Interrupts are cleared by writing 1 to the position of the corresponding bit. When all the enabled
interrupts within a group are cleared, the corresponding summary bit is also cleared. When both summary bits are
cleared, the interrupt signal dmac_intr_o is de-asserted (stops signalling).
Interrupts are not queued up, and if a new interrupt-event occurs before the driver has responded to it, no addi-
tional interrupts are generated. For example, the Receive Interrupt IDSTS[1] indicates that one or more data were
transferred to the Host buffer.
An interrupt is generated only once for concurrent events. The driver must scan the IDSTS register for the interrupt
cause.
9.13 Registers
SD/MMC controller registers can be accessed by the APB bus of the CPU.
US
AT
SD _ST
CC PT
P_ U
SE RT SD TO RR
ET
NS
O C _S TE
se A ES TA
ES
O
AB D_C TO _IN
(re _W _R DA
P
_R
N U CE
AD Q _
ER
D
DM rve LE
CO _R ET
RE D_I EA
RO T
SE _A VI
IN ve T
LL
NT ESE
I
ND DE
se B
S
N _R
d)
d)
T_ d)
A d)
R
ed
FO E
SE TA_
ve
ve
FI _R
(re EN
rv
er
er
r
se
A
s
CE
(re
(re
(re
31 25 24 23 12 11 10 9 8 7 6 5 4 3 2 1 0
SEND_CCSD When set, SD/MMC sends CCSD to the CE-ATA device. Software sets this bit only
if the current command is expecting CCS (that is, RW_BLK), and if interrupts are enabled for the
CE-ATA device. Once the CCSD pattern is sent to the device, SD/MMC automatically clears the
send_ccsd bit. It also sets the Command Done (CD) bit in the RINTSTS register, and generates
an interrupt for the host, in case the Command Done interrupt is not masked. NOTE: Once the
send_ccsd bit is set, it takes two card clock cycles to drive the CCSD on the CMD line. Due to this,
within the boundary conditions the CCSD may be sent to the CE-ATA device, even if the device
has signalled CCS. (R/W)
SEND_IRQ_RESPONSE Bit automatically clears once response is sent. To wait for MMC card inter-
rupts, host issues CMD40 and waits for interrupt response from MMC card(s). In the meantime, if
host wants SD/MMC to exit waiting for interrupt state, it can set this bit, at which time SD/MMC
command state-machine sends CMD40 response on bus and returns to idle state. (R/W)
DMA_RESET To reset DMA interface, firmware should set bit to 1. This bit is auto-cleared after two
AHB clocks. (R/W)
FIFO_RESET To reset FIFO, firmware should set bit to 1. This bit is auto-cleared after completion of
reset operation. Note: FIFO pointers will be out of reset after 2 cycles of system clocks in addition
to synchronization delay (2 cycles of card clock), after the fifo_reset is cleared. (R/W)
CONTROLLER_RESET To reset controller, firmware should set this bit. This bit is auto-cleared after
two AHB and two cclk_in clock cycles. (R/W)
R2
R1
R0
DE
DE
DE
DE
VI
VI
VI
VI
DI
DI
DI
DI
K_
K_
K_
K_
CL
CL
CL
CL
31 24 23 16 15 8 7 0
CLK_DIVIDER3 Clock divider-3 value. Clock division factor is 2*n, where n=0 bypasses the divider
(division factor of 1). For example, a value of 1 means divide by 2*1 = 2, a value of 0xFF means
divide by 2*255 = 510, and so on. In MMC-Ver3.3-only mode, these bits are not implemented
because only one clock divider is supported. (R/W)
CLK_DIVIDER2 Clock divider-2 value. Clock division factor is 2*n, where n=0 bypasses the divider
(division factor of 1). For example, a value of 1 means divide by 2*1 = 2, a value of 0xFF means
divide by 2*255 = 510, and so on. In MMC-Ver3.3-only mode, these bits are not implemented
because only one clock divider is supported. (R/W)
CLK_DIVIDER1 Clock divider-1 value. Clock division factor is 2*n, where n=0 bypasses the divider
(division factor of 1). For example, a value of 1 means divide by 2*1 = 2, a value of 0xFF means
divide by 2*255 = 510, and so on. In MMC-Ver3.3-only mode, these bits are not implemented
because only one clock divider is supported. (R/W)
CLK_DIVIDER0 Clock divider-0 value. Clock division factor is 2*n, where n=0 bypasses the divider
(division factor of 1). For example, a value of 1 means divide by 2*1 = 2, a value of 0xFF means
divide by 2*255 = 510, and so on. In MMC-Ver3.3-only mode, these bits are not implemented
because only one clock divider is supported. (R/W)
EG
_R
)
ed
RC
rv
KS
se
CL
(re
31 4 3 0
CLKSRC_REG Clock divider source for two SD cards is supported. Each card has two bits assigned
to it. For example, bit[1:0] are assigned for card 0, bit[3:2] are assigned for card 1. Card 0 maps
and internally routes clock divider[0:3] outputs to cclk_out[1:0] pins, depending on bit value.
00 : Clock divider 0;
01 : Clock divider 1;
10 : Clock divider 2;
11 : Clock divider 3.
In MMC-Ver3.3-only controller, only one clock divider is supported. The cclk_out is always from
clock divider 0, and this register is not implemented. (R/W)
L
BE
NA
d)
_E
e
rv
LK
se
CC
(re
31 2 1 0
CCLK_ENABEL Clock-enable control for two SD card clocks and one MMC card clock is supported.
0: Clock disabled;
1: Clock enabled.
In MMC-Ver3.3-only mode, since there is only one cclk_out, only cclk_enable[0] is used. (R/W)
UT
EO
IM
UT
_T
EO
E
NS
M
TI
O
_
SP
TA
DA
RE
31 8 7 0
DATA_TIMEOUT Value for card data read timeout. This value is also used for data starvation by host
timeout. The timeout counter is started only after the card clock is stopped. This value is specified
in number of card output clocks, i.e. cclk_out of the selected card.
NOTE: The software timer should be used if the timeout value is in the order of 100 ms. In this
case, read data timeout interrupt needs to be disabled. (R/W)
RESPONSE_TIMEOUT Response timeout value. Value is specified in terms of number of card output
clocks, i.e., cclk_out. (R/W)
4
TH
T
ID
ID
)
d)
_W
_W
ed
e
rv
rv
RD
RD
se
se
CA
CA
(re
(re
31 18 17 16 15 2 1 0
CARD_WIDTH4 One bit per card indicates if card is 1-bit or 4-bit mode.
0: 1-bit mode;
1: 4-bit mode.
Bit[1:0] correspond to card[1:0] respectively. Only NUM_CARDS*2 number of bits are imple-
mented. (R/W)
CK
r
se
O
BL
(re
31 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x00200 Reset
31 0
0x000000200 Reset
BYTCNT_REG Number of bytes to be transferred, should be an integral multiple of Block Size for
block transfers. For data transfers of undefined byte lengths, byte count should be set to 0. When
byte count is set to 0, it is the responsibility of host to explicitly send stop/abort command to
terminate data transfer. (R/W)
K
AS
M
T_
K
)
AS
ed
N
_I
rv
M
IO
se
T_
SD
(re
IN
31 18 17 16 15 0
SDIO_INT_MASK SDIO interrupt mask, one bit for each card. Bit[17:16] correspond to card[15:0] re-
spectively. When masked, SDIO interrupt detection for that card is disabled. 0 masks an interrupt,
and 1 enables an interrupt. In MMC-Ver3.3-only mode, these bits are always 0. (R/W)
INT_MASK These bits used to mask unwanted interrupts. A value of 0 masks interrupt, and a value
of 1 enables the interrupt. (R/W)
Bit 15 (EBE): End-bit error, read/write (no CRC)
Bit 14 (ACD): Auto command done
Bit 13 (SBE/BCI): Start Bit Error/Busy Clear Interrupt
Bit 12 (HLE): Hardware locked write error
Bit 11 (FRUN): FIFO underrun/overrun error
Bit 10 (HTO): Data starvation-by-host timeout/Volt_switch_int
Bit 9 (DRTO): Data read timeout
Bit 8 (RTO): Response timeout
Bit 7 (DCRC): Data CRC error
Bit 6 (RCRC): Response CRC error
Bit 5 (RXDR): Receive FIFO data request
Bit 4 (TXDR): Transmit FIFO data request
Bit 3 (DTO): Data transfer over
Bit 2 (CD): Command done
Bit 1 (RE): Response error
Bit 0 (CD): Card detect
31 0
0x000000000 Reset
Y
NL
_O
RS
E
T R O P LET
TE
EX TH RC
IS
DA D/W R_M TO P
E_ NG _C
EG
_R E
A FE _S OM
TR D_A DA CM N
CK IC
CT
N RV T_ IO
A U TA D
NS LE E
O E_ NS
LO EV
CH A_E ITE DE
RE NS TO _C
SE T_P OR AT
PE
RE PO ES D
DA EA TED
R
_C _D
SP NS PO
S _R TE
AI B LIZ
BE
TE TA
RE CK EC
US rve MD
W P_A IA
UP D_C EC
X
UM
(re rve E
DE
O NIT
E XP
se L
A P
E d)
se d)
se d)
se d)
se d)
S d)
se C
_N
(re _HO
RE _EX
IN
(re RT_
(re rve
(re rve
(re rve
CC rve
ST D_I
D_
RD
N
A
CM
CA
SE
ST
31 30 29 28 27 26 25 24 23 22 21 20 16 15 14 13 12 11 10 9 8 7 6 5 0
START_CMD Start command. Once command is served by the CIU, this bit is automatically cleared.
When this bit is set, host should not attempt to write to any command registers. If a write is
attempted, hardware lock error is set in raw interrupt register. Once command is sent and a
response is received from SD_MMC_CEATA cards, Command Done bit is set in the raw interrupt
Register. (R/W)
USE_HOLE Use Hold Register. (R/W) 0: CMD and DATA sent to card bypassing HOLD Register; 1:
CMD and DATA sent to card through the HOLD Register.
UPDATE_CLOCK_REGISTERS_ONLY (R/W)
0: Normal command sequence.
1: Do not send commands, just update clock register value into card clock domain
Following register values are transferred into card clock domain: CLKDIV, CLRSRC, and CLKENA.
Changes card clocks (change frequency, truncate off or on, and set low-frequency mode). This
is provided in order to change clock frequency or stop clock without having to send command to
cards.
During normal command sequence, when update_clock_registers_only = 0, following control reg-
isters are transferred from BIU to CIU: CMD, CMDARG, TMOUT, CTYPE, BLKSIZ, and BYTCNT.
CIU uses new register values for new command sequence to card(s). When bit is set, there are no
Command Done interrupts because no command is sent to SD_MMC_CEATA cards.
CARD_NUMBER Card number in use. Represents physical slot number of card being accessed. In
MMC-Ver3.3-only mode, up to two cards are supported. In SD-only mode, up to two cards are
supported. (R/W)
SEND_INITIALIZATION (R/W)
0: Do not send initialization sequence (80 clocks of 1) before sending this command.
1: Send initialization sequence before sending this command.
After power on, 80 clocks must be sent to card for initialization before sending any commands to
card. Bit should be set while sending first command to card so that controller will initialize clocks
before sending command to card.
STOP_ABORT_CMD (R/W)
0: Neither stop nor abort command can stop current data transfer. If abort is sent to function-
number currently selected or not in data-transfer mode, then bit should be set to 0.
1: Stop or abort command intended to stop current data transfer in progress. When open-ended
or predefined data transfer is in progress, and host issues stop or abort command to stop data
transfer, bit should be set so that command/data state-machines of CIU can return correctly to idle
state.
WAIT_PRVDATA_COMPLETE (R/W)
0: Send command at once, even if previous data transfer has not completed;
1: Wait for previous data transfer to complete before sending Command.
The wait_prvdata_complete = 0 option is typically used to query status of card during data transfer
or to stop current data transfer. card_number should be same as in previous command.
SEND_AUTO_STOP (R/W)
0: No stop command is sent at the end of data transfer;
1: Send stop command at the end of data transfer.
TRANSFER_MODE (R/W)
0: Block data transfer command;
1: Stream data transfer command. Don’t care if no data expected.
READ/WRITE (R/W)
0: Read from card;
1: Write to card.
Don’t care if no data is expected from card.
DATA_EXPECTED (R/W)
0: No data transfer expected.
1: Data transfer expected.
CHECK_RESPONSE_CRC (R/W)
0: Do not check;
1: Check response CRC.
Some of command responses do not return valid CRC bits. Software should disable CRC checks
for those commands in order to disable CRC checking by controller.
RESPONSE_LENGTH (R/W)
0: Short response expected from card;
1: Long response expected from card.
RESPONSE_EXPECT (R/W)
0: No response expected from card;
1: Response expected from card.
31 0
0x000000000 Reset
31 0
0x000000000 Reset
31 0
0x000000000 Reset
31 0
0x000000000 Reset
SK
PT
RU
M
S_
ER
U
NT
d)
AT
e
ST
_I
rv
IO
se
T_
SD
(re
IN
31 18 17 16 15 0
SDIO_INTERRUPT_MSK Interrupt from SDIO card, one bit for each card. Bit[17:16] correspond
to card1 and card0, respectively. SDIO interrupt for card is enabled only if corresponding
sdio_int_mask bit is set in Interrupt mask register (Setting mask bit enables interrupt). (RO)
INT_STATUS_MSK Interrupt enabled only if corresponding bit in interrupt mask register is set. (RO)
Bit 15 (EBE): End-bit error, read/write (no CRC)
Bit 14 (ACD): Auto command done
Bit 13 (SBE/BCI): Start Bit Error/Busy Clear Interrupt
Bit 12 (HLE): Hardware locked write error
Bit 11 (FRUN): FIFO underrun/overrun error
Bit 10 (HTO): Data starvation by host timeout (HTO)
Bit 9 (DTRO): Data read timeout
Bit 8 (RTO): Response timeout
Bit 7 (DCRC): Data CRC error
Bit 6 (RCRC): Response CRC error
Bit 5 (RXDR): Receive FIFO data request
Bit 4 (TXDR): Transmit FIFO data request
Bit 3 (DTO): Data transfer over
Bit 2 (CD): Command done
Bit 1 (RE): Response error
Bit 0 (CD): Card detect
W
RA
T_
W
UP
RA
RR
US_
E
NT
d)
AT
ve
ST
_I
er
IO
T_
s
SD
(re
IN
31 18 17 16 15 0
SDIO_INTERRUPT_RAW Interrupt from SDIO card, one bit for each card. Bit[17:16] correspond to
card1 and card0, respectively. Setting a bit clears the corresponding interrupt bit and writing 0 has
no effect. (R/W)
0: No SDIO interrupt from card;
1: SDIO interrupt from card.
In MMC-Ver3.3-only mode, these bits are always 0. Bits are logged regardless of interrupt-mask
status. (R/W)
INT_STATUS_RAW Setting a bit clears the corresponding interrupt and writing 0 has no effect. Bits
are logged regardless of interrupt mask status. (R/W)
Bit 15 (EBE): End-bit error, read/write (no CRC)
Bit 14 (ACD): Auto command done
Bit 13 (SBE/BCI): Start Bit Error/Busy Clear Interrupt
Bit 12 (HLE): Hardware locked write error
Bit 11 (FRUN): FIFO underrun/overrun error
Bit 10 (HTO): Data starvation by host timeout (HTO)
Bit 9 (DTRO): Data read timeout
Bit 8 (RTO): Response timeout
Bit 7 (DCRC): Data CRC error
Bit 6 (RCRC): Response CRC error
Bit 5 (RXDR): Receive FIFO data request
Bit 4 (TXDR): Transmit FIFO data request
Bit 3 (DTO): Data transfer over
Bit 2 (CD): Command done
Bit 1 (RE): Response error
Bit 0 (CD): Card detect
S
TE
SY
K
M K
TA
AR
BU
ER R
AT MA
_S
EX
_3 Y C_
M
S
W R
ND
TA US _M
TU
FS
X_ TE
T
_I
FI _TX TY
DA _B TE
_R WA
TA
D_
UN
FI _EM L
TA TA
NS
P
_S
AN
FO L
se d)
FO _
ed
FI _FU
DA A_S
(re rve
O
_C
M
rv
SP
M
se
FO
FO
FO
T
CO
DA
RE
(re
FI
FI
31 30 29 17 16 11 10 9 8 7 4 3 2 1 0
RESPONSE_INDEX Index of previous response, including any auto-stop sent by core. (RO)
FIFO_TX_WATERMARK FIFO reached Transmit watermark level, not qualified with data transfer. (RO)
FIFO_RX_WATERMARK FIFO reached Receive watermark level, not qualified with data transfer. (RO)
ZE
SI
N_
O
TI
AC
NS
A
TR
E_
PL
K
TI
K
AR
UL
AR
)
d)
d)
ed
M
ve
ve
M
rv
A_
_W
_W
er
er
se
s
DM
RX
TX
(re
(re
(re
31 30 28 27 26 16 15 12 11 0
RX_WMARK FIFO threshold watermark level when receiving data to card.When FIFO data count
reaches greater than this number (FIFO_RX_WATERMARK), DMA/FIFO request is raised. During
end of packet, request is generated regardless of threshold programming in order to complete any
remaining data.In non-DMA mode, when receiver FIFO threshold (RXDR) interrupt is enabled, then
interrupt is generated instead of DMA request.During end of packet, interrupt is not generated if
threshold programming is larger than any remaining data. It is responsibility of host to read remain-
ing bytes on seeing Data Transfer Done interrupt.In DMA mode, at end of packet, even if remaining
bytes are less than threshold, DMA request does single transfers to flush out any remaining bytes
before Data Transfer Done interrupt is set. (R/W)
TX_WMARK FIFO threshold watermark level when transmitting data to card. When FIFO data count
is less than or equal to this number (FIFO_TX_WATERMARK), DMA/FIFO request is raised. If In-
terrupt is enabled, then interrupt occurs. During end of packet, request or interrupt is generated,
regardless of threshold programming.In non-DMA mode, when transmit FIFO threshold (TXDR) in-
terrupt is enabled, then interrupt is generated instead of DMA request. During end of packet, on
last interrupt, host is responsible for filling FIFO with only required remaining bytes (not before FIFO
is full or after CIU completes data transfers, because FIFO may not be empty). In DMA mode, at
end of packet, if last transfer is less than burst size, DMA controller does single cycles until required
bytes are transferred. (R/W)
_ N
CT
E TE
)
ed
_D
rv
RD
se
CA
(re
31 2 1 0
CARD_DETECT_N Value on card_detect_n input ports (1 bit per card), read-only bits.0 represents
presence of card. Only NUM_CARDS number of bits are implemented. (RO)
CT
TE
RO
)
_P
ed
TE
rv
se
RI
(re
W
31 2 1 0
WRITE_PROTECT Value on card_write_prt input ports (1 bit per card).1 represents write protection.
Only NUM_CARDS number of bits are implemented. (RO)
31 0
0x000000000 Reset
31 0
0x000000000 Reset
TBBCNT_REG Number of bytes transferred between Host/DMA memory and BIU FIFO. (RO)
T
UN
CO
_
CE
d)
UN
ve
BO
er
s
DE
(re
31 24 23 0
0 0 0 0 0 0 0 0 0x0000000 Reset
DEBOUNCE_COUNT Number of host clocks (clk) used by debounce filter logic. The typical de-
bounce time is 5 ~ 25 ms to prevent the card instability when the card is inserted or removed.
(R/W)
31 0
0x000000000 Reset
USRID_REG User identification register, value set by user. Default reset value can be picked by user
while configuring core before synthesis. Can also be used as a scratchpad register by user. (R/W)
ET
ES
_R
RD
d)
CA
e
rv
T_
se
RS
(re
31 2 1 0
0 0x1 Reset
RST_CARD_RESET Hardware reset.1: Active mode; 0: Reset. These bits cause the cards to enter
pre-idle state, which requires them to be re-initialized. CARD_RESET[0] should be set to 1’b0 to
reset card0, CARD_RESET[1] should be set to 1’b0 to reset card1.The number of bits implemented
is restricted to NUM_CARDS. (R/W)
R
L
SW
PB
DE
O FB
d)
)
ed
D_
D_
BM D_
D_
ve
rv
er
O
se
s
BM
BM
BM
(re
(re
31 11 10 8 7 6 2 1 0
BMOD_PBL Programmable Burst Length. These bits indicate the maximum number of beats to be
performed in one IDMAC transaction. The IDMAC will always attempt to burst as specified in PBL
each time it starts a burst transfer on the host bus. The permissible values are 1, 4, 8, 16, 32, 64,
128 and 256. This value is the mirror of MSIZE of FIFOTH register. In order to change this value,
write the required value to FIFOTH register. This is an encode value as follows:
000: 1-byte transfer; 001: 4-byte transfer; 010: 8-byte transfer; 011: 16-byte transfer; 100: 32-
byte transfer; 101: 64-byte transfer; 110: 128-byte transfer; 111: 256-byte transfer.
PBL is a read-only value and is applicable only for data access, it does not apply to descriptor
access. (R/W)
BMOD_FB Fixed Burst. Controls whether the AHB Master interface performs fixed burst transfers or
not. When set, the AHB will use only SINGLE, INCR4, INCR8 or INCR16 during start of normal
burst transfers. When reset, the AHB will use SINGLE and INCR burst transfer operations. (R/W)
BMOD_SWR Software Reset. When set, the DMA Controller resets all its internal registers. It is
automatically cleared after one clock cycle. (R/W)
31 0
0x000000000 Reset
PLDMND_REG Poll Demand. If the OWN bit of a descriptor is not set, the FSM goes to the Suspend
state. The host needs to write any value into this register for the IDMAC FSM to resume normal
descriptor fetch operation. This is a write only register, PD bit is write-only. (WO)
31 0
0x000000000 Reset
DBADDR_REG Start of Descriptor List. Contains the base address of the First Descriptor. The LSB
bits [1:0] are ignored and taken as all-zero by the IDMAC internally. Hence these LSB bits may be
treated as read-only. (R/W)
DE
O
_C
M
(re S_ S
BE
ID S_ E
(re NIS
S
se DU
ST CE
ST FB
FS
d)
ST )
ST d)
ST RI
ST AI
TI
ed
_F
ve
ID rve
S_
ID S_
S_
ID S_
ID S_
S_
rv
TS
r
se
se
ST
ST
S
(re
ID
ID
ID
ID
31 17 16 13 12 10 9 8 7 6 5 4 3 2 1 0
IDSTS_FBE_CODE Fatal Bus Error Code. Indicates the type of error that caused a Bus Error. Valid
only when the Fatal Bus Error bit IDSTS[2] is set. This field does not generate an interrupt. (RO)
3b001: Host Abort received during transmission;
3b010: Host Abort received during reception;
Others: Reserved.
IDSTS_AIS Abnormal Interrupt Summary. Logical OR of the following: IDSTS[2] : Fatal Bus Interrupt,
IDSTS[4] : DU bit Interrupt. Only unmasked bits affect this bit. This is a sticky bit and must be
cleared each time a corresponding bit that causes AIS to be set is cleared. Writing 1 clears this
bit. (R/W)
IDSTS_NIS Normal Interrupt Summary. Logical OR of the following: IDSTS[0] : Transmit Interrupt,
IDSTS[1] : Receive Interrupt. Only unmasked bits affect this bit. This is a sticky bit and must be
cleared each time a corresponding bit that causes NIS to be set is cleared. Writing 1 clears this
bit. (R/W)
IDSTS_CES Card Error Summary. Indicates the status of the transaction to/from the card, also
present in RINTSTS. Indicates the logical OR of the following bits: EBE : End Bit Error, RTO :
Response Timeout/Boot Ack Timeout, RCRC : Response CRC, SBE : Start Bit Error, DRTO : Data
Read Timeout/BDS timeout, DCRC : Data CRC for Receive, RE : Response Error.
Writing 1 clears this bit. The abort condition of the IDMAC depends on the setting of this CES bit.
If the CES bit is enabled, then the IDMAC aborts on a response error. (R/W)
IDSTS_DU Descriptor Unavailable Interrupt. This bit is set when the descriptor is unavailable due to
OWN bit = 0 (DES0[31] =0). Writing 1 clears this bit. (R/W)
IDSTS_FBE Fatal Bus Error Interrupt. Indicates that a Bus Error occurred (IDSTS[12:10]) . When this
bit is set, the DMA disables all its bus accesses. Writing 1 clears this bit. (R/W)
IDSTS_RI Receive Interrupt. Indicates the completion of data reception for a descriptor. Writing 1
clears this bit. (R/W)
IDSTS_TI Transmit Interrupt. Indicates that data transmission is finished for a descriptor. Writing 1
clears this bit. (R/W)
ID TEN FBE
ID rve DU
I
TE RI
TE AI
TI
(re N_N
d)
IN d)
IN _
IN _
se _
IN _
IN _
N_
ed
ID TEN
ID TEN
ID TEN
ve
rv
r
se
se
IN
IN
(re
ID
ID
31 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
IDINTEN_CES Card Error summary Interrupt Enable. When set, it enables the Card Interrupt sum-
mary. (R/W)
IDINTEN_DU Descriptor Unavailable Interrupt. When set along with Abnormal Interrupt Summary
Enable, the DU interrupt is enabled. (R/W)
IDINTEN_FBE Fatal Bus Error Enable. When set with Abnormal Interrupt Summary Enable, the Fatal
Bus Error Interrupt is enabled. When reset, Fatal Bus Error Enable Interrupt is disabled. (R/W)
IDINTEN_RI Receive Interrupt Enable. When set with Normal Interrupt Summary Enable, Receive
Interrupt is enabled. When reset, Receive Interrupt is disabled. (R/W)
IDINTEN_TI Transmit Interrupt Enable. When set with Normal Interrupt Summary Enable, Transmit
Interrupt is enabled. When reset, Transmit Interrupt is disabled. (R/W)
31 0
0x000000000 Reset
DSCADDR_REG Host Descriptor Address Pointer, updated by IDMAC during operation and cleared
on reset. This register points to the start address of the current descriptor read by the IDMAC.
(RO)
31 0
0x000000000 Reset
BUFADDR_REG Host Buffer Address Pointer, updated by IDMAC during operation and cleared on
reset. This register points to the current Data Buffer Address being accessed by the IDMAC. (RO)
EL
EL
EL
_S
_S
S
F_
V
DR
SA
SL
N
H
L
E_
E_
E_
E_
E_
E_
G
G
D
ED
ED
ED
_E
_E
_E
d)
_
IN
IN
IN
IN
IN
IN
ve
LK
LK
LK
LK
LK
LK
r
se
CC
CC
CC
CC
CC
CC
(re
31 21 20 17 16 13 12 9 8 6 5 3 2 0
CCLKIN_EDGE_L The low level of the divider clock. The value should be larger than
CCLKIN_EDGE_H. (R/W)
CCLKIN_EDGE_H The high level of the divider clock. The value should be smaller than
CCLKIN_EDGE_L. (R/W)
CCLKIN_EDGE_SLF_SEL It is used to select the clock phase of the internal signal from phase90,
phase180, or phase270. (R/W)
CCLKIN_EDGE_SAM_SEL It is used to select the clock phase of the input signal from phase90,
phase180, or phase270. (R/W)
CCLKIN_EDGE_DRV_SEL It is used to select the clock phase of the output signal from phase90,
phase180, or phase270. (R/W)
10.1 Overview
Features of Ethernet
By using the external Ethernet PHY (physical layer), ESP32 can send and receive data via Ethernet MAC (Me-
dia Access Controller) according to the IEEE 802.3 standard, as Figure 10-1 shows. Ethernet is currently the
most commonly used network protocol that controls how data is transmitted over local- and wide-area networks,
abbreviated as LAN and WAN, respectively.
• IEEE 1588-2008 standard for specifying the accuracy of networked clock synchronization
• Two industry-standard interfaces conforming with IEEE 802.3-2002: Media-Independent Interface (MII) and
Reduced Media-Independent Interface (RMII).
• Support for a data transmission rate of 10 Mbit/s or 100 Mbit/s through an external PHY interface
• Communication with an external Fast Ethernet PHY through IEEE 802.3-compliant MII and RMII interfaces
• Support for:
– Carrier Sense Multiple Access / Collision Detection (CSMA/CD) protocol in half-duplex mode
– operations in full-duplex mode, forwarding the received pause-control frame to the user application
– If the flow control input signal disappears during a full-duplex operation, a pause frame with zero pause
time value is automatically transmitted.
• The Preamble and the Start Frame Delimiter (SFD) are inserted in the Transmit path, and deleted in the
Receive path.
• Cyclic Redundancy Check (CRC) and Pad can be controlled on a per-frame basis.
• The Pad is generated automatically, if data is below the minimum frame length.
– All frames in mixed mode can be transmitted without being filtered for network monitoring
– A status report is attached each time all incoming packets are transmitted and filtered
• Use of the Management Data Input/Output (MDIO) interface to configure and manage PHY devices
• Support for the offloading of received IPv4 and TCP packets encapsulated by an Ethernet frame in the
reception function
• Support for checking IPv4 header checksums, as well as TCP, UDP, or ICMP (Internet Control Message
Protocol) checksums encapsulated in IPv4/IPv6 packets in the enhanced reception function
• Support for Ethernet frame timestamps. (For details please refer to IEEE 1588-2008.) Each frame has a
64-bit timestamp when transmitted or received.
• Two sets of FIFOs: one 2 KB Tx FIFO with programmable threshold and one 2 KB Rx FIFO with configurable
threshold (64 bytes by default)
• When Rx FIFO stores multiple frames, the Receive Status Vector is inserted into the Rx FIFO after transmitting
an EOF (end of frame), so that the Rx FIFO does not need to store the Receive Status of these frames.
• In store-and-forward mode, all error frames can be filtered during reception, but not forwarded to the appli-
cation.
• Support for data statistics by generating pulses for lost or corrupted frames in the Rx FIFO due to an overflow
• Support for store-and-forward mechanism when transmitting data to the MAC core
• Automatic re-transmission of collided frames during transmission (subject to certain conditions, see section
10.2.1.2)
• Discarding frames in cases of late collisions, excessive collisions, excessive deferrals, and under-run condi-
tions
• Calculating the IPv4 header checksum, as well as the TCP, UDP, or ICMP checksum, and then inserting them
into frames transmitted in store-and-forward mode.
Ethernet MAC consists of the MAC-layer configuration register module and three layers: EMAC_CORE (MAC Core
Layer), EMAC_MTL (MAC Transition Layer), and EMAC_DMA (Direct Memory Access). Each of these three layers
has two directions: Tx and Rx. They are connected to the system through the Advanced High-Performance Bus
(AHB) and the Advanced Peripheral Bus (APB) on the chip. Off the chip, they communicate with the external PHY
through the MII and RMII interfaces to establish an Ethernet connection.
10.2 EMAC_CORE
The MAC supports many interfaces with the PHY chip. The PHY interface can be selected only once after reset.
The MAC communicates with the application side (DMA side), using the MAC Transmit Interface (MTI), MAC Receive
Interface (MRI) and the MAC Control Interface (MCI).
After the EOF (end of frame) is transmitted to the MAC, the MAC completes the normal transmission and yields the
Transmit Status to the MTL. If a normal collision (in half-duplex mode) occurs during transmission, the MAC makes
valid the Transmit Status in the MTL. It then accepts and drops all further data until the next SOF is received. The
MTL block should retransmit the same frame from SOF upon observing a retry request (in the Status) from the
MAC.
The MAC issues an underflow status if the MTL is not able to provide the data continuously during transmission.
During the normal transmission of a frame from MTL, if the MAC receives an SOF without getting an EOF for the
previous frame, it ignores the SOF and considers the new frame as a continuation of the previous one.
When the application sets the Flow Control Busy bit (FCB bit in the Flow Control Register) to 1, or when the Rx
FIFO is full, a pause frame is transmitted.
• If an application has requested flow control by setting the FCB bit in the Flow Control Register to 1, the MAC
will generate and send a single pause frame. The pause time value in the generated frame is the pause time
value programmed in the Flow Control Register. To extend or end the pause time before the time specified
in the previously transmitted pause frame, the application program must configure the pause time value in
the Flow Control Register to the appropriate value and, then, request another pause frame transmission.
• If the application has requested flow control when the Rx FIFO is full, the MAC will generate and transmit a
pause frame. The value of the pause time of the generated frame is the pause time value programmed in
the Flow Control Register. If the Rx FIFO remains full during the configurable interval, which is determined
by the Pause Low Threshold bit (PLT) in the Flow Control Register before the pause time expires, a second
pause frame will be transmitted. As long as the Rx FIFO remains full, the process repeats itself. If the FIFO
is no longer full before the sample time, the MAC will send a pause frame with zero pause time, indicating to
the remote end that the Rx buffer is ready to receive the new data frame.
The MAC transmitter may abort the transmission of a frame because of collision, Tx FIFO underflow, loss of carrier,
jabber timeout, no carrier, excessive deferral, and late collision. When frame transmission is aborted because of
collision, the MAC requests retransmission of the frame.
The frame received by the MAC will be pushed into the Rx FIFO. Once the FIFO status exceeds the Receive
Threshold, configured by the Receive Threshold Control (RTC) bit in the Operation Mode register, the DMA can
initiate a preconfigured burst transmission to the AHB interface.
In the default pass-through mode, when the FIFO receives a complete packet or 64 bytes configured by the RTC
bit in the Operation Mode Register, the data pops up and its availability is notified to the DMA. After the DMA
initiates the transmission to the AHB interface, the data transmission continues from the FIFO until the complete
packet is transmitted. Upon completing transmitting the EOF, the status word will pop up and be transmitted to
In the Rx FIFO Store-and-Forward mode (configured through the RSF or Receive Store and Forward bit in the
Operation Mode Register), only the valid frames are read and forwarded to the application. In the passthrough
mode, error frames are not discarded because the error status is received at the end of the frame. The start of
frame will have been read from the FIFO at that point.
If the received frame length/type is less than 0x600 and the automatic CRC/Pad removal option is programmed for
the MAC, the MAC will send frame data to the Rx FIFO (the amount of data does not exceed the number specified
in the length/type field). Then MAC begins discarding the remaining section, including the FCS field. If the frame
length/type is greater than, or equal to, 0x600, the MAC will send all received Ethernet frame data to the Rx FIFO,
regardless of the programmed value of the automatic CRC removal option. By default, the MAC watchdog timer
is enabled, meaning that frames, including DA, SA, LT, data, pad and FCS, which exceed 2048 bytes, are cut off.
This function can be disabled by programming the Watchdog Disable (WD) bit in the MAC Configuration Register.
However, even if the watchdog timer is disabled, frames longer than 16 KB will be cut off and the watchdog timeout
status will be given.
The MAC will also decode the type, the opcode, and the pause timer field of the Receive Control Frame. If the value
of the status byte counter is 64 bits and there are no CRC errors, the MAC transmitter will halt the transmission of
any data frame. The duration of the pause is the decoded pause time value multiplied by the interval (which is 64
bytes for both 10 Mbit/s and 100 Mb/s modes). At the same time, if another pause frame of zero pause time is
detected, the MAC will reset the pause time to manage the new pause request.
If the type field (0x8808), the opcode (0x00001), and the byte length (64 bytes) of the received control frame are not
0x8808, 0x00001, and 64 bytes, respectively, or if there is a CRC error, the MAC will not generate a pause.
If a pause frame has a multicast destination address, the MAC filters the frame, according to the address match-
ing.
For pause frames with a unicast destination address, the MAC checks whether the DA matches the content of the
EMACADDR0 Register, and whether the Unicast Pause Frame Detect (UPFD) bit in the Flow Control Register is
set to 1. The Pass Control Frames (PCF) bits in the Frame Filter Register [7:6] control the filtering of frames and
addresses.
If the function that corresponds to the Flush Transmit FIFO (FTF) bit and the Forward Undersized Good Frames
(FUGF) bit in the Operation Mode Register is enabled, the Rx FIFO can filter error frames and runt frames. If the re-
ceive FIFO is configured to operate in store-and-forward mode, all error frames will be filtered and discarded.
In passthrough mode, if a frame’s status and length are available when reading a SOF from the Rx FIFO, the entire
error frame can be discarded. DMA can clear the error frame being read from the FIFO by enabling the Receive
Frame Clear bit. The data transmission to the application (DMA) will then stop, and the remaining frames will be
read internally and discarded. If FIFO is available, the transmission of the next frame will be initiated.
The interrupt register bits only indicate various interrupt events. To clear the interrupts, the corresponding status
register and other registers must be read. An Interrupt Status Register describes the events that prompt the MAC
core to generate interrupts. Each interrupt event can be prevented by setting the corresponding mask bit in the
Interrupt Mask Register to 1. For example, if bit3 of the interrupt register is set high, it indicates that a magic packet
or Wake-on-LAN frame has been received in Power-down mode. The PMT Control and Status register must be
read to clear this interrupt event.
Physical (MAC) addresses are used for address checking during address filtering.
In perfect filtering mode, the multicast address is compared with the programmed MAC Destination Address Reg-
isters (EMACADDR0 ~ EMACADDR7). Group address filtering is also supported.
When the SAF enable bit is set to 1, the result of the SA filtering and DA filtering is AND’ed to determine whether
or not to forward the frame. Any frame that fails to pass will be discarded. Frames need to pass both filterings in
order to be forwarded to the application.
The following two tables summarize the destination address and source address filtering, based on the type of the
frames received.
The filtering parameters in the MAC Frame Filter Register described in Table 10-1 are as follows.
Parameter name: Parameter setting:
PM: Pass All Multicast 1: Set
PF: Perfect Filter 0: Cleared
DAIF: Destination Address Inverse Filtering
PAM: Pass All Multicast
DB: Disable Broadcast Frames
The filtering parameters in the MAC Frame Filter Register described in Table 10-2 are as follows.
• Jabber timeout
• Late collision
• Frame underflow
• Excessive deferral
• Excessive collision
The received frames are considered ”good frames”, if there are not any of the following errors:
• CRC error
• Frame size over the maximum size (for non-type frames over the maximum frame size only)�
For details please refer to Register Summary and Linked List Descriptors.
• MII_TX_CLK: TX clock signal. This signal provides the reference timing for TX data transmission. The fre-
quencies are divided into two types: 2.5 MHz at a data transmission rate of 10 Mbit/s, and 25 MHz at 100
Mbit/s.
• MII_TXD[3:0]: Transmit data signal in groups of four, syn-driven by the MAC sub-layer, and valid only when
the MII_TX_EN signal is valid. MII_TXD[0] is the lowest significant bit and MII_TXD[3] is the highest significant
bit. When the signal MII_TX_EN is pulled low, sending data does not have any effect on the PHY.
• MII_TX_EN: Transmit data enable signal. This signal indicates that the MAC is currently sending nibbles (4
bits) for the MII. This signal must be synchronized with the first nibble of the header (MII_TX_CLK) and must
be synchronized when all nibbles to be transmitted are sent to the MII.
• MII_RX_CLK: RX clock signal. This signal provides the reference timing for RX data transmission. The
frequencies are divided into two types: 2.5 MHz at the data transmission rate of 10 Mbit/s, and 25 MHz at
100 Mbit/s.
• MII_RXD[3:0]: Receive data signal in groups of four, syn-driven by the PHY, and valid only when MII_RX_DV
signal is valid. MII_RXD[0] is the lowest significant bit and MII_RXD[3] is the highest significant bit. When
MII_RX_DV is disabled and MII_RX_ER is enabled, the specific MII_RXD[3:0] value represents specific infor-
mation from the PHY.
• MII_RX_DV: Receive data valid signal. This signal indicates that the PHY is currently receiving the recovered
and decoded nibble that will be transmitted to the MII. This signal must be synchronized with the first nibble
of the recovered frame (MII_RX_CLK) and remain synchronized till the last nibble of the recovered frame. This
signal must be disabled before the first clock cycle following the last nibble. In order to receive the frame
correctly, the MII_RX_DV signal must cover the frame to be received over the time range, starting no later
than when the SFD field appears.
• MII_CRS: Carrier sense signal. When the transmitting or receiving medium is in the non-idle state, the signal
is enabled by the PHY. When the transmitting or receiving medium is in the idle state, the signal is disabled by
the PHY. The PHY must ensure that the MII_CRS signal remains valid under conflicting conditions. This signal
does not need to be synchronized with the TX and RX clocks. In full-duplex mode, this signal is insignificant.
• MII_COL: Collision detection signal. After a collision is detected on the medium, the PHY must immedi-
ately enable the collision detection signal, and the collision detection signal must remain active as long as a
condition for collision exists. This signal does not need to be synchronized with the TX and RX clocks. In
full-duplex mode, this signal is meaningless.
• MII_RX_ER: Receive error signal. The signal must remain for one or more cycles (MII_RX_CLK) to indicate to
the MAC sublayer that an error has been detected somewhere in the frame.
• MDIO and MDC: Management Data Input/Output and Management Data Clock. The two signals consti-
tute a serial bus defined for the Ethernet family of IEEE 802.3 standards, used to transfer control and data
information to the PHY, see section Station Management Agent (SMA) Interface.
• The same reference clock must be provided externally both to the MAC and the external Ethernet PHY. It
provides independent 2-bit-wide Tx and Rx data paths.
Please refer to Register Summary for details about the EMII Address Register and the EMII Data Register.
31 0
TTSS
OWN
TTSE
Ctrl/status Status
TDES0 Ctrl[30:26] Ctrl[24:18] Status[16:7] [6:3] [2:0]
Ctrl
TDES1 [31:29] Reserved Transmit Buffer Size[12:0]
TDES4 Reserved
TDES5 Reserved
RDES0 Status[30:0]
Ctrl
Res
Ctrl
RDES5 Reserved
• Latched-low (LL)
• Latched-high (LH)
10.10 Registers
Note: The value of all reset registers must be set to the reset value.
EN
US X8_ AL ST
SE D A
EN
_L
E_ MO IBE
H
L DR UR
IZ
L
ST
ST SC
P_ E
RA ST
_L
L
PB
_S
PB
PB AD DB
UR
P
R
_R RB_
O
SC
KI
BU
A_
A E
d)
TI
_B
S
X
ve
DE
SW _A
M
D_
C_
DM MI
G
r
_D
A
T_
se
O
I_
XE
DM
DM
PR
PR
DE
RX
AL
(re
FI
31 27 26 25 24 23 22 17 16 15 14 13 8 7 6 2 1 0
DMAMIXEDBURST When this bit is set high and the FB(FIXES_BURST) bit is low, the AHB master
interface starts all bursts of a length more than 16 with INCR (undefined burst), whereas it reverts
to fixed burst transfers (INCRx and SINGLE) for burst length of 16 and less. (R/W)
DMAADDRALIBEA When this bit is set high and the FB bit is 1, the AHB interface generates all bursts
aligned to the start address LS bits. If the FB bit is 0, the first burst (accessing the start address of
data buffer) is not aligned, but subsequent bursts are aligned to the address. (R/W)
PBLX8_MODE When set high, this bit multiplies the programmed PBL(PROG_BURST_LEN) value
(Bits[22:17] and Bits[13:8]) eight times. Therefore, the DMA transfers the data in 8, 16, 32, 64,
128, and 256 beats depending on the PBL value. (R/W)
USE_SEP_PBL When set high, this bit configures the Rx DMA to use the value configured in
Bits[22:17] as PBL. The PBL value in Bits[13:8] is applicable only to the Tx DMA operations. When
reset to low, the PBL value in Bits[13:8] is applicable for both DMA engines. (R/W)
RX_DMA_PBL This field indicates the maximum number of beats to be transferred in one Rx DMA
transaction. This is the maximum value that is used in a single block Read or Write.The Rx DMA
always attempts to burst as specified in the RPBL(RX_DMA_PBL) bit each time it starts a burst
transfer on the host bus. You can program RPBL with values of 1, 2, 4, 8, 16, and 32. Any other
value results in undefined behavior. This field is valid and applicable only when USP(USE_SEP_PBL)
is set high. (R/W)
FIXED_BURST This bit controls whether the AHB master interface performs fixed burst transfers or
not. When set, the AHB interface uses only SINGLE, INCR4, INCR8, or INCR16 during start of
the normal burst transfers. When reset, the AHB interface uses SINGLE and INCR burst transfer
operations. (R/W)
PRI_RATIO These bits control the priority ratio in the weighted round-robin arbitration between the
Rx DMA and Tx DMA. These bits are valid only when Bit 1 (DA) is reset. The priority ratio Rx:Tx
represented by each bit: (R/W)
• 2’b00 — 1: 1
• 2’b01 — 2: 0
• 2’b10 — 3: 1
• 2’b11 — 4: 1
PROG_BURST_LEN These bits indicate the maximum number of beats to be transferred in one DMA
transaction. If the number of beats to be transferred is more than 32, then perform the following
steps: 1. Set the PBLx8 mode; 2. Set the PBL. (R/W)
ALT_DESC_SIZE When set, the size of the alternate descriptor increases to 32 bytes. (R/W)
DESC_SKIP_LEN This bit specifies the number of Word to skip between two unchained descriptors.
The address skipping starts from the end of current descriptor to the start of next descriptor. When
the DSL(DESC_SKIP_LEN) value is equal to zero, the descriptor table is taken as contiguous by
the DMA in Ring mode. (R/W)
DMA_ARB_SCH This bit specifies the arbitration scheme between the transmit and receive paths.
1’b0: weighted round-robin with RX: TX or TX: RX, priority specified in PR (bit[15:14]); 1’b1 Fixed
priority (Rx priority to Tx). (R/W)
SW_RST When this bit is set, the MAC DMA Controller resets the logic and all internal registers of the
MAC. It is cleared automatically after the reset operation is complete in all of the ETH_MAC clock
domains. Before reprogramming any register of the ETH_MAC, you should read a zero (0) value in
this bit. (R/WS/SC)
31 0
0x000000000 Reset
TRANS_POLL_DEMAND When these bits are written with any value, the DMA reads the current
descriptor to which the Register (Current Host Transmit Descriptor Register) is pointing. If that
descriptor is not available (owned by the Host), the transmission returns to the suspend state and
Bit[2] (TU) of Status Register is asserted. If the descriptor is available, the transmission resumes.
(RO/WT)
31 0
0x000000000 Reset
RECV_POLL_DEMAND When these bits are written with any value, the DMA reads the current de-
scriptor to which the Current Host Receive Descriptor Register is pointing. If that descriptor is
not available (owned by the Host), the reception returns to the Suspended state and Bit[7] (RU) of
Status Register is asserted. If the descriptor is available, the Rx DMA returns to the active state.
(RO/WT)
31 0
0x000000000 Reset
START_RECV_LIST This field contains the base address of the first descriptor in the Receive De-
scriptor list. The LSB Bits[1:0] are ignored and internally taken as all-zero by the DMA. Therefore,
these LSB bits are read-only. (R/W)
31 0
0x000000000 Reset
START_TRANS_LIST This field contains the base address of the first descriptor in the Transmit De-
scriptor list. The LSB Bits[1:0] are ignored and are internally taken as all-zero by the DMA. Therefore,
these LSB bits are read-only. (R/W)
T ST L
E
P
IN C_ AI
L
AN _PR _UN O
AT
IN
A NT N P
O
AI
S_ O AV
CV RO TO T
AT
TR S FLO OW
TR NS UF R_T
FA Y_ SU M
TR V_I F_U TO
ST
R_
RE V_P T_ _IN
AV
S_ T
RL T_ UM
ST
L_ C M
(re BU V_IN
ed INT
A _J W
ER
C_
C U _S
AN V L
A _B E
TA RE M
C D S
C_
TR NS ABB
EA IN _S
RE _W AN
TS
RE _B C
T_
TR _O D
O
AC INT
RO
CV _UN
PR
N_ INT
M
BI
CV TR
)
)
ed
ed
_P
R_
S_
_P
EM I_
AB M_
RE _
RE NS
Y
R
rv
rv
rv
RO
AN
CV
RL
_T
se
se
se
R
NO
ER
RE
TR
EA
TS
(re
(re
31 30 29 28 27 26 25 23 22 20 19 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
TS_TRI_INT This bit indicates an interrupt event in the Timestamp Generator block of the ETH_MAC.
The software must read the corresponding registers in the ETH_MAC to get the exact cause of the
interrupt and clear its source to reset this bit to 1’b0. (RO)
EMAC_PMT_INT This bit indicates an interrupt event in the PMT module of the ETH_MAC. The soft-
ware must read the PMT Control and Status Register in the MAC to get the exact cause of interrupt
and clear its source to reset this bit to 1’b0. (RO)
ERROR_BITS This field indicates the type of error that caused a Bus Error, for example, error response
on the AHB interface. This field is valid only when Bit[13] (FBI) is set. This field does not generate
an interrupt. (RO)
TRANS_PROC_STATE This field indicates the Transmit DMA FSM state. This field does not generate
an interrupt. (RO)
• 3’b111: Running. Transferring the TX packets data from transmit buffer to host memory.
RECV_PROC_STATE This field indicates the Receive DMA FSM state. This field does not generate
an interrupt. (RO)
• 3’b111: Running. Transferring the TX packets data from receive buffer to host memory.
NORM_INT_SUMM Normal Interrupt Summary bit value is the logical OR of the following bits when
the corresponding interrupt bits are enabled in Interrupt Enable Register:(R/SS/WC)
• Bit[14]: Early Receive Interrupt. Only unmasked bits affect the Normal Interrupt Summary bit.
This is a sticky bit and must be cleared (by writing 1 to this bit) each time a corresponding bit,
which causes NIS to be set, is cleared.
ABN_INT_SUMM Abnormal Interrupt Summary bit value is the logical OR of the following when the
corresponding interrupt bits are enabled in Interrupt Enable Register: (R/SS/WC)
• Bit[13]: Fatal Bus Error. Only unmasked bits affect the Abnormal Interrupt Summary bit. This
is a sticky bit and must be cleared (by writing 1 to this bit) each time a corresponding bit,
which causes AIS to be set, is cleared.
EARLY_RECV_INT This bit indicates that the DMA filled the first data buffer of the packet. This bit is
cleared when the software writes 1 to this bit or when Bit[6] (RI) of this register is set (whichever
occurs earlier). (R/SS/WC)
FATAL_BUS_ERR_INT This bit indicates that a bus error occurred, as described in Bits [25:23]. When
this bit is set, the corresponding DMA engine disables all of its bus accesses. (R/SS/WC)
EARLY_TRANS_INT This bit indicates that the frame to be transmitted is fully transferred to the MTL
Transmit FIFO. (R/SS/WC)
RECV_WDT_TO When set, this bit indicates that the Receive Watchdog Timer expired while receiving
the current frame and the current frame is truncated after the watchdog timeout. (R/SS/WC)
RECV_PROC_STOP This bit is asserted when the Receive Process enters the Stopped state.
(R/SS/WC)
RECV_BUF_UNAVAIL This bit indicates that the host owns the Next Descriptor in the Receive List and
the DMA cannot acquire it. The Receive Process is suspended. To resume processing Receive
descriptors, the host should change the ownership of the descriptor and issue a Receive Poll
Demand command. If no Receive Poll Demand is issued, the Receive Process resumes when
the next recognized incoming frame is received. This bit is set only when the previous Receive
Descriptor is owned by the DMA. (R/SS/WC)
RECV_INT This bit indicates that the frame reception is complete. When reception is complete, the
Bit[31] of RDES1 (Disable Interrupt on Completion) is reset in the last Descriptor, and the specific
frame status information is updated in the descriptor. The reception remains in the Running state.
(R/SS/WC)
TRANS_UNDFLOW This bit indicates that the Transmit Buffer had an Underflow during frame trans-
mission. Transmission is suspended and an Underflow Error TDES0[1] is set. (R/SS/WC)
RECV_OVFLOW This bit indicates that the Receive Buffer had an Overflow during frame recep-
tion. If the partial frame is transferred to the application, the overflow status is set in RDES0[11].
(R/SS/WC)
TRANS_JABBER_TO This bit indicates that the Transmit Jabber Timer expired, which happens when
the frame size exceeds 2,048 (10,240 bytes when the Jumbo frame is enabled). When the Jabber
Timeout occurs, the transmission process is aborted and placed in the Stopped state. This causes
the Transmit Jabber Timeout TDES0[14] flag to assert. (R/SS/WC)
TRANS_BUF_UNAVAIL This bit indicates that the host owns the Next Descriptor in the Transmit
List and the DMA cannot acquire it. Transmission is suspended. Bits[22:20] explain the Transmit
Process state transitions. To resume processing Transmit descriptors, the host should change
the ownership of the descriptor by setting TDES0[31] and then issue a Transmit Poll Demand
command. (R/SS/WC)
TRANS_INT This bit indicates that the frame transmission is complete. When transmission is com-
plete, Bit[31] (OWN) of TDES0 is reset, and the specific frame status information is updated in the
descriptor. (R/SS/WC)
D
AN
M
M
CO
N_
M
O
CV D A
ES
SI
se d) RE AR _FR
IS
M
SM
RA
(re rve _ RW RR
X E
) _R AM
_F
se S O _E
AN
L
L
R E
rv O FR
TR
(re FLU E_F IP
TR
ed _TR
RM F
O ND RAM
O
RX GF _G
P
se ST D_
ST _SE _C
_C
S_ R C
IF
H_ WD
ed P
DI STO _T
(re T_ ON
_F
H
DR U F
SH
P_ E
H
D_ R_
ES
_ OP
TX
ST
US _F
AR C
d)
_S d)
D_ d)
RE
ed
ed
HR
FL TR
T_
ve
TX rve
FW rve
RX DR
FW E
rv
rv
rv
TH
er
AR
_T
se
se
se
se
S_
PT
_
s
ST
TX
(re
(re
(re
(re
(re
DI
O
31 27 26 25 24 23 22 21 20 19 17 16 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
DIS_DROP_TCPIP_ERR_FRAM When this bit is set, the MAC does not drop the frames which only
have errors detected by the Receive Checksum engine.When this bit is reset, all error frames are
dropped if the Fwd_Err_Frame bit is reset. (R/W)
RX_STORE_FORWARD When this bit is set, the MTL reads a frame from the Rx FIFO only after the
complete frame has been written to it. (R/W)
DIS_FLUSH_RECV_FRAMES When this bit is set, the Rx DMA does not flush any frames because
of the unavailability of receive descriptors or buffers. (R/W)
TX_STR_FWD When this bit is set, transmission starts when a full frame resides in the MTL Trans-
mit FIFO. When this bit is set, the TX_THRESH_CTRL values specified in TX_THRESH_CTRL are
ignored. (R/W)
FLUSH_TX_FIFO When this bit is set, the transmit FIFO controller logic is reset to its default values
and thus all data in the Tx FIFO is lost or flushed. This bit is cleared internally when the flushing
operation is complete. (R/WS/SC)
TX_THRESH_CTRL These bits control the threshold level of the MTL Transmit FIFO. Transmission
starts when the frame size within the MTL Transmit FIFO is larger than the threshold. In addition,
full frames with a length less than the threshold are also transmitted. These bits are used only
when TX_STR_FWD is reset. 3’b000: 64, 3’b001: 128, 3’b010: 192, 3’b011: 256, 3’b100: 40,
3’b101: 32, 3’b110: 24, 3’b111: 16. (R/W)
FWD_ERR_FRAME When this bit is reset, the Rx FIFO drops frames with error status (CRC error,
collision error, giant frame, watchdog timeout, or overflow). (R/W)
FWD_UNDER_GF When set, the Rx FIFO forwards Undersized frames (that is, frames with no Error
and length less than 64 bytes) including pad-bytes and CRC.
DROP_GFRM When set, the MAC drops the received giant frames in the Rx FIFO, that is, frames that
are larger than the computed giant frame limit. (R/W)
RX_THRESH_CTRL These two bits control the threshold level of the MTL Receive FIFO. Transfer (re-
quest) to DMA starts when the frame size within the MTL Receive FIFO is larger than the threshold.
2’b00: 64; 2’b01: 32; 2’b10: 96; 2’b11: 128. (R/W)
OPT_SECOND_FRAME When this bit is set, it instructs the DMA to process the second frame of the
Transmit data even before the status for the first frame is obtained. (R/W)
START_STOP_RX When this bit is set, the Receive process is placed in the Running state. The DMA
attempts to acquire the descriptor from the Receive list and processes the incoming frames.When
this bit is cleared, the Rx DMA operation is stopped after the transfer of the current frame. (R/W)
A R E
DM IN_ UE
EE
DM IN_ TE
DM IN_ ISE
DM IN_ WT
DM IN_ ISE
N IE
DM IN_ BU
DM IN_ TIE
DM IN_ SE
N_ E
DM IN_ IE
DM IN_ IE
DM IN_ IE
E
AI ER
A TB
(re _FB
AI TS
A TJ
TI
A O
A N
A U
A R
A R
A R
)
DM d)
A A
A E
ed
DM IN_
DM IN_
e
rv
rv
A
A
se
se
DM
(re
31 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
DMAIN_NISE When this bit is set, normal interrupt summary is enabled. When this bit is reset, normal
interrupt summary is disabled. This bit enables the following interrupts in Status Register: (R/W)
DMAIN_AISE When this bit is set, abnormal interrupt summary is enabled. When this bit is reset,
the abnormal interrupt summary is disabled. This bit enables the following interrupts in Status
Register:(R/W)
DMAIN_ERIE When this bit is set with Normal Interrupt Summary Enable (Bit[16]), the Early Receive
Interrupt is enabled. When this bit is reset, the Early Receive Interrupt is disabled. (R/W)
DMAIN_FBEE When this bit is set with Abnormal Interrupt Summary Enable (Bit[15]), the Fatal Bus
Error Interrupt is enabled. When this bit is reset, the Fatal Bus Error Enable Interrupt is disabled.
(R/W)
DMAIN_ETIE When this bit is set with an Abnormal Interrupt Summary Enable (Bit[15]), the Early
Transmit Interrupt is enabled. When this bit is reset, the Early Transmit Interrupt is disabled. (R/W)
DMAIN_RWTE When this bit is set with Abnormal Interrupt Summary Enable (Bit[15]), the Receive
Watchdog Timeout Interrupt is enabled. When this bit is reset, the Receive Watchdog Timeout
Interrupt is disabled. (R/W)
DMAIN_RSE When this bit is set with Abnormal Interrupt Summary Enable (Bit[15]), the Receive
Stopped Interrupt is enabled. When this bit is reset, the Receive Stopped Interrupt is disabled.
(R/W)
DMAIN_RBUE When this bit is set with Abnormal Interrupt Summary Enable (Bit[15]), the Receive
Buffer Unavailable Interrupt is enabled. When this bit is reset, the Receive Buffer Unavailable Inter-
rupt is disabled. (R/W)
DMAIN_RIE When this bit is set with Normal Interrupt Summary Enable (Bit[16]), the Receive Interrupt
is enabled. When this bit is reset, the Receive Interrupt is disabled. (R/W)
DMAIN_UIE When this bit is set with Abnormal Interrupt Summary Enable (Bit[15]), the Transmit Un-
derflow Interrupt is enabled. When this bit is reset, the Underflow Interrupt is disabled. (R/W)
DMAIN_OIE When this bit is set with Abnormal Interrupt Summary Enable (Bit[15]), the Receive Over-
flow Interrupt is enabled. When this bit is reset, the Overflow Interrupt is disabled. (R/W)
DMAIN_TJTE When this bit is set with Abnormal Interrupt Summary Enable (Bit[15]), the Transmit
Jabber Timeout Interrupt is enabled. When this bit is reset, the Transmit Jabber Timeout Interrupt
is disabled. (R/W)
DMAIN_TBUE When this bit is set with Normal Interrupt Summary Enable (Bit 16), the Transmit Buffer
Unavailable Interrupt is enabled. When this bit is reset, the Transmit Buffer Unavailable Interrupt is
disabled. (R/W)
DMAIN_TSE When this bit is set with Abnormal Interrupt Summary Enable (Bit[15]), the Transmission
Stopped Interrupt is enabled. When this bit is reset, the Transmission Stopped Interrupt is disabled.
(R/W)
DMAIN_TIE When this bit is set with Normal Interrupt Summary Enable (Bit[16]), the Transmit Interrupt
is enabled. When this bit is reset, the Transmit Interrupt is disabled. (R/W)
FC
C
FO
M
C
_B
_B
_F
C
)
_F
ed
ow
ow
ow
ed
rv
rfl
rfl
rfl
se
iss
ve
ve
ve
(re
M
O
O
30 29 28 27 17 16 10 0
Overflow_BFOC This bit is set every time the Overflow Frame Counter (Bits[27:17]) overflows, that
is, the Rx FIFO overflows with the overflow frame counter at maximum value. In such a scenario,
the overflow frame counter is reset to all-zeros and this bit indicates that the rollover happened.
(R/SS/RC)
Overflow_FC This field indicates the number of frames missed by the application. This counter is
incremented each time the MTL FIFO overflows. The counter is cleared when this register is read.
(R/SS/RC)
Overflow_BMFC This bit is set every time Missed Frame Counter (Bits[15:0]) overflows, that is, the
DMA discards an incoming frame because of the Host Receive Buffer being unavailable with the
missed frame counter at maximum value. In such a scenario, the Missed frame counter is reset to
all-zeros and this bit indicates that the rollover happened. (R/SS/RC)
Missed_FC This field indicates the number of frames missed by the controller because of the Host
Receive Buffer being unavailable. This counter is incremented each time the DMA discards an
incoming frame. The counter is cleared when this register is read. (R/SS/RC)
TC
r
se
W
(re
RI
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x000 Reset
RIWTC This bit indicates the number of system clock cycles multiplied by 256 for which the watchdog
timer is set. The watchdog timer gets triggered with the programmed value after the Rx DMA
completes the transfer of a frame for which the RI (RECV_INT) status bit is not set because of the
setting in the corresponding descriptor RDES1[31]. When the watchdog timer runs out, the RI bit
is set and the timer is stopped. The watchdog timer is reset when the RI bit is set high because of
automatic setting of RI as per RDES1[31] of any received frame. (R/W)
31 0
0x000000000 Reset
TRANS_DSCR_ADDR_PTR The address of the current receive descriptor list. Cleared on Reset.
Pointer updated by the DMA during operation. (RO)
31 0
0x000000000 Reset
RECV_DSCR_ADDR_PTR The address of the current receive descriptor list. Cleared on Reset.
Pointer updated by the DMA during operation. (RO)
31 0
0x000000000 Reset
TRANS_BUFF_ADDR_PTR The address of the current receive descriptor list. Cleared on Reset.
Pointer updated by the DMA during operation. (RO)
31 0
0x000000000 Reset
RECV_BUFF_ADDR_PTR The address of the current receive descriptor list. Cleared on Reset.
Pointer updated by the DMA during operation. (RO)
CK
AP
AD
HE
IT
EG
E
IP
AM
M
RS
EM rve RY FLO
EM AC STR
LC
EM rve BE OG
AM
EM CR LE CK
LI
AC II EC
FR
EM CD OFF
AC X RA
A XO ED
se AB D
se ET F
R
A UP A
C
AC d) R
A XI X
A OO N
(re CR PCO
BO
(re J CH
EM CD PB
RF
AC CR
EM CT ER
EM CR PE
EM CL W
EM M B
K
AC ISA
TE
M
AC AT
EM AD
A F
A ES
)
AC d)
ed
ed
RX
JU
KP
IN
EM CW
EM CD
B
P
EM F
rv
rv
C
AC
S2
se
se
TF
IR
A
EM
EM
EM
SA
AS
(re
(re
PL
31 30 28 27 26 24 23 22 21 20 19 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SAIRC This field controls the source address insertion or replacement for all transmitted frames.
Bit[30] specifies which MAC Address register (0 or 1) is used for source address insertion or re-
placement based on the values of Bits [29:28]: (R/W)
• 2’b0x: The input signals mti_sa_ctrl_i and ati_sa_ctrl_i control the SA field generation.
• 2’b10: If Bit[30] is set to 0, the MAC inserts the content of the MAC Address 0 registers in
the SA field of all transmitted frames. If Bit[30] is set to 1 the MAC inserts the content of the
MAC Address 1 registers in the SA field of all transmitted frames.
• 2’b11: If Bit[30] is set to 0, the MAC replaces the content of the MAC Address 0 registers in
the SA field of all transmitted frames. If Bit[30] is set to 1, the MAC replaces the content of
the MAC Address 1 registers in the SA field of all transmitted frames.
ASS2KP When set, the MAC considers all frames, with up to 2,000 bytes length, as normal packets.
When Bit[20] (JE) is not set, the MAC considers all received frames of size more than 2K bytes
as Giant frames. When this bit is reset and Bit[20] (JE) is not set, the MAC considers all received
frames of size more than 1,518 bytes (1,522 bytes for tagged) as Giant frames. When Bit[20] is
set, setting this bit has no effect on Giant Frame status. (R/W)
EMACWATCHDOG When this bit is set, the MAC disables the watchdog timer on the receiver. The
MAC can receive frames of up to 16,383 bytes. When this bit is reset, the MAC does not allow a
receive frame which more than 2,048 bytes (10,240 if JE is set high) or the value programmed in
Register (Watchdog Timeout Register). The MAC cuts off any bytes received after the watchdog
limit number of bytes. (R/W)
EMACJABBER When this bit is set, the MAC disables the jabber timer on the transmitter. The MAC
can transfer frames of up to 16,383 bytes. When this bit is reset, the MAC cuts off the trans-
mitter if the application sends out more than 2,048 bytes of data (10,240 if JE is set high) during
transmission. (R/W)
EMACJUMBOFRAME When this bit is set, the MAC allows Jumbo frames of 9,018 bytes (9,022
bytes for VLAN tagged frames) without reporting a giant frame error in the receive frame status.
(R/W)
EMACINTERFRAMEGAP These bits control the minimum IFG between frames during transmission.
(R/W)
• 3’b111: 40 bit times. In the half-duplex mode, the minimum IFG can be configured only for
64 bit times (IFG = 100). Lower values are not considered.
EMACDISABLECRS When set high, this bit makes the MAC transmitter ignore the MII CRS signal
during frame transmission in the half-duplex mode. This request results in no errors generated
because of Loss of Carrier or No Carrier during such transmission. When this bit is low, the MAC
transmitter generates such errors because of Carrier Sense and can even abort the transmissions.
(R/W)
EMACMII This bit selects the Ethernet line speed. It should be set to 1 for 10 or 100 Mbps operations.
In 10 or 100 Mbps operations, this bit, along with FES(EMACFESPEED) bit, it selects the exact
linespeed. In the 10/100 Mbps-only operations, the bit is always 1. (R/W)
EMACFESPEED This bit selects the speed in the MII, RMII interface. 0: 10 Mbps; 1: 100 Mbps.
(R/W)
EMACRXOWN When this bit is set, the MAC disables the reception of frames when the TX_EN is
asserted in the half-duplex mode. When this bit is reset, the MAC receives all packets that are
given by the PHY while transmitting. This bit is not applicable if the MAC is operating in the full-
duplex mode. (R/W)
EMACLOOPBACK When this bit is set, the MAC operates in the loopback mode MII. The MII Receive
clock input (CLK_RX) is required for the loopback to work properly, because the transmit clock is
not looped-back internally. (R/W)
EMACDUPLEX When this bit is set, the MAC operates in the full-duplex mode where it can transmit
and receive simultaneously. This bit is read only with default value of 1’b1 in the full-duplex-mode.
(R/W)
EMACRXIPCOFFLOAD When this bit is set, the MAC calculates the 16-bit one’s complement of the
one’s complement sum of all received Ethernet frame payloads. It also checks whether the IPv4
Header checksum (assumed to be bytes 25/26 or 29/30 (VLAN-tagged) of the received Ethernet
frame) is correct for the received frame and gives the status in the receive status word. The MAC
also appends the 16-bit checksum calculated for the IP header datagram payload (bytes after the
IPv4 header) and appends it to the Ethernet frame transferred to the application (when Type 2 COE
is deselected). When this bit is reset, this function is disabled. (R/W)
EMACRETRY When this bit is set, the MAC attempts only one transmission. When a collision occurs
on the MII interface, the MAC ignores the current frame transmission and reports a Frame Abort
with excessive collision error in the transmit frame status. When this bit is reset, the MAC attempts
retries based on the settings of the BL field (Bits [6:5]). This bit is applicable only in the half-duplex
mode. (R/W)
EMACPADCRCSTRIP When this bit is set, the MAC strips the Pad or FCS field on the incoming
frames only if the value of the length field is less than 1,536 bytes. All received frames with length
field greater than or equal to 1,536 bytes are passed to the application without stripping the Pad
or FCS field. When this bit is reset, the MAC passes all incoming frames, without modifying them,
to the Host. (R/W)
EMACBACKOFFLIMIT The Back-Off limit determines the random integer number (r) of slot time de-
lays (512 bit times for 10/100 Mbps) for which the MAC waits before rescheduling a transmission
attempt during retries after a collision. This bit is applicable only in the half-duplex mode.
• 11: k = min (n, 1), n = retransmission attempt. The random integer r takes the value in the
range 0 ~ 2000.
EMACTX When this bit is set, the transmit state machine of the MAC is enabled for transmission on
the MII. When this bit is reset, the MAC transmit state machine is disabled after the completion of
the transmission of the current frame, and does not transmit any further frames. (R/W)
EMACRX When this bit is set, the receiver state machine of the MAC is enabled for receiving frames
from the MII. When this bit is reset, the MAC receive state machine is disabled after the completion
of the reception of the current frame, and does not receive any further frames from the MII. (R/W)
PLTF These bits control the number of preamble bytes that are added to the beginning of every Trans-
mit frame. The preamble reduction occurs only when the MAC is operating in the full-duplex mode.
2’b00: 7 bytes of preamble. 2’b01: 5 bytes of preamble. 2’b10: 3 bytes of preamble. (R/W)
L
AL
E_
d)
PM d)
ve
e
IV
DE
rv
CE
SA E
se
se
O
IF
IF
M
F
F
F
RE
DB
PC
DA
SA
(re
(re
PA
31 30 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 0 0 0 0 0 0 Reset
RECEIVE_ALL When this bit is set, the MAC Receiver module passes all received frames, irrespective
of whether they pass the address filter or not, to the Application. The result of the SA or DA filtering
is updated (pass or fail) in the corresponding bits in the Receive Status Word. When this bit is reset,
the Receiver module passes only those frames to the Application that pass the SA or DA address
filter. (R/W)
SAFE When this bit is set, the MAC compares the SA field of the received frames with the values
programmed in the enabled SA registers. If the comparison fails, the MAC drops the frame. When
this bit is reset, the MAC forwards the received frame to the application with updated SAF bit of
the Rx Status depending on the SA address comparison. (R/W)
SAIF When this bit is set, the Address Check block operates in inverse filtering mode for the SA
address comparison. The frames whose SA matches the SA registers are marked as failing the
SA Address filter. When this bit is reset, frames whose SA does not match the SA registers are
marked as failing the SA Address filter. (R/W)
PCF These bits control the forwarding of all control frames (including unicast and multicast Pause
frames). (R/W)
• 2’b00: MAC filters all control frames from reaching the application.
• 2’b01: MAC forwards all control frames except Pause frames to application even if they fail
the Address filter.
• 2’b10: MAC forwards all control frames to application even if they fail the Address Filter.
• 2’b11: MAC forwards control frames that pass the Address Filter.
The following conditions should be true for the Pause frames processing:
• Condition 1: The MAC is in the full-duplex mode and flow control is enabled by setting Bit 2
(RFE) of Register (Flow Control Register) to 1.
• Condition 2: The destination address (DA) of the received frame matches the special multicast
address or the MAC Address 0 when Bit 3 (UP) of the Register(Flow Control Register) is set.
• Condition 3: The Type field of the received frame is 0x8808 and the OPCODE field is 0x0001.
DBF When this bit is set, the AFM(Address Filtering Module) module blocks all incoming broadcast
frames. In addition, it overrides all other filter settings. When this bit is reset, the AFM module
passes all received broadcast frames. (R/W)
PAM When set, this bit indicates that all received frames with a multicast destination address (first bit
in the destination address field is ’1’) are passed. (R/W)
DAIF When this bit is set, the Address Check block operates in inverse filtering mode for the DA
address comparison for both unicast and multicast frames. When reset, normal filtering of frames
is performed. (R/W)
PMODE When this bit is set, the Address Filter module passes all incoming frames irrespective of the
destination or source address. The SA or DA Filter Fails status bits of the Receive Status Word are
always cleared when PR(PRT_RATIO) is set. (R/W)
K
CL
)
IIB E
d
Y
M RIT
ve
EG
SR
US
EV
er
IIW
IIC
IID
IIR
s
(re
M
M
M
31 16 15 11 10 6 5 2 1 0
MIIDEV This field indicates which of the 32 possible PHY devices are being accessed. (R/W)
MIIREG These bits select the desired MII register in the selected PHY device. (R/W)
• 4’b0000: When the APB clock frequency is 80 MHz, the MDC clock frequency is
APB_CLK/42;
• 4’b0011: When the APB clock frequency is 40 MHz, the MDC clock frequency is
APB_CLK/26.
MIIWRITE When set, this bit indicates to the PHY that this is a Write operation using the MII Data
register. If this bit is not set, it indicates that this is a Read operation, that is, placing the data in the
MII Data register. (R/W)
MIIBUSY This bit should read logic 0 before writing to PHY Addr Register and PHY data Register.
During a PHY register access, the software sets this bit to 1’b1 to indicate that a Read or Write
access is in progress. PHY data Register is invalid until this bit is cleared by the MAC. Therefore,
PHY data Register (MII Data) should be kept valid until the MAC clears this bit during a PHY Write
operation. Similarly for a read operation, the contents of Register 5 are not valid until this bit is
cleared. The subsequent read or write operation should happen only after the previous operation
is complete. Because there is no acknowledgment from the PHY to MAC after a read or write
operation is completed, there is no change in the functionality of this bit even when the PHY is not
present. (R/WS/SC)
A
ed
AT
rv
D
se
II_
(re
M
31 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x00000 Reset
MII_DATA This field contains the 16-bit data value read from the PHY after a Management Read
operation or the 16-bit data value to be written to the PHY before a Management Write operation.
(R/W)
E
IM
)
_T
ed
SE
A
rv
BB
RF D
CE
FC E
se
U
C
T
UP
PA
(re
PL
TF
31 16 15 6 5 4 3 2 1 0
PAUSE_TIME This field holds the value to be used in the Pause Time field in the transmit control
frame. If the Pause Time bits is configured to be double-synchronized to the MII clock domain,
then consecutive writes to this register should be performed only after at least four clock cycles in
the destination clock domain. (R/W)
PLT This field configures the threshold of the Pause timer automatic retransmission of the Pause frame.
The threshold values should be always less than the Pause Time configured in Bits[31:16]. For
example, if PT = 100H (256 slot-times), and PLT = 01, then a second Pause frame is automatically
transmitted at 228 (256-28) slot times after the first Pause frame is transmitted. The following list
provides the threshold values for different values: (R/W)
• 2’b00: The threshold is Pause time minus 4 slot times (PT-4 slot times).
• 2’b01: The threshold is Pause time minus 28 slot times (PT-28 slot times).
• 2’b10: The threshold is Pause time minus 144 slot times (PT-144 slot times).
• 2’b11: The threshold is Pause time minus 256 slot times (PT-256 slot times). The slot time is
defined as the time taken to transmit 512 bits (64 bytes) on the MII interface.
UPFD A pause frame is processed when it has the unique multicast address specified in the IEEE
Std 802.3. When this bit is set, the MAC can also detect Pause frames with unicast address of
the station. This unicast address should be as specified in the EMACADDR0 High Register and
EMACADDR0 Low Register. When this bit is reset, the MAC only detects Pause frames with unique
multicast address. (R/W)
RFCE When this bit is set, the MAC decodes the received Pause frame and disables its transmitter for
a specified (Pause) time. When this bit is reset, the decode function of the Pause frame is disabled.
(R/W)
TFCE In the full-duplex mode, when this bit is set, the MAC enables the flow control operation to
transmit Pause frames. When this bit is reset, the flow control operation in the MAC is disabled,
and the MAC does not transmit any Pause frames. In the half-duplex mode, when this bit is set,
the MAC enables the backpressure operation. When this bit is reset, the backpressure feature is
disabled. (R/W)
FCBBA This bit initiates a Pause frame in the full-duplex mode and activates the backpressure function
in the half-duplex mode if the TFCE bit is set. In the full-duplex mode, this bit should be read as
1’b0 before writing to the Flow Control register. To initiate a Pause frame, the Application must set
this bit to 1’b1. During a transfer of the Control Frame, this bit continues to be set to signify that
a frame transmission is in progress. After the completion of Pause frame transmission, the MAC
resets this bit to 1’b0. The Flow Control register should not be written to until this bit is cleared. In
the half-duplex mode, when this bit is set (and TFCE is set), then backpressure is asserted by the
MAC. During backpressure, when the MAC receives a new frame, the transmitter starts sending
a JAM pattern resulting in a collision. When the MAC is configured for the full-duplex mode, the
BPA is automatically disabled. (R/WS/SC)(FCB)/(R/W)(BPA(backpressure activate))
ed S
rv A
AC CS
TL CS
TL CS
S
M rve S
(re FLS
se C
S
ES
AC S
ES
d)
TL d)
AC )
RC
se E
ed
ed
TL F
(re FW
C
F
W
R
(re TFN
M TSF
ve
RP
RF
TP
TP
TF
RF
RF
rv
rv
TF
TF
R
r
se
se
se
AC
AC
TL
TL
TL
(re
(re
M
M
31 26 25 24 23 22 21 20 19 18 17 16 15 10 9 8 7 6 5 4 3 2 1 0
MTLTSFFS When high, this bit indicates that the MTL TxStatus FIFO is full. Therefore, the MTL cannot
accept any more frames for transmission. (RO)
MTLTFNES When high, this bit indicates that the MTL Tx FIFO is not empty and some data is left for
transmission. (RO)
MTLTFWCS When high, this bit indicates that the MTL Tx FIFO Write Controller is active and is trans-
ferring data to the Tx FIFO. (RO)
MTLTFRCS This field indicates the state of the Tx FIFO Read Controller: (RO)
MACTP When high, this bit indicates that the MAC transmitter is in the Pause condition (in the full-
duplex-mode) and hence does not schedule any frame for transmission. (RO)
MACTFCS This field indicates the state of the MAC Transmit Frame Controller module: (RO)
• 2’b01: Waiting for status of previous frame or IFG or backoff period to be over.
• 2’b10: Generating and transmitting a Pause frame (in the full-duplex mode).
MACTPES When high, this bit indicates that the MAC MII transmit protocol engine is actively trans-
mitting data and is not in the IDLE state. (RO)
MTLRFFLS This field gives the status of the fill-level of the Rx FIFO: (RO)
MTLRFRCS This field gives the state of the Rx FIFO read Controller: (RO)
MTLRFWCAS When high, this bit indicates that the MTL Rx FIFO Write Controller is active and is
transferring a received frame to the FIFO. (RO)
MACRFFCS When high, this field indicates the active state of the FIFO Read and Write controllers
of the MAC Receive Frame Controller Module. MACRFFCS[1] represents the status of FIFO Read
controller. MACRFFCS[0] represents the status of small FIFO Write controller. (RO)
MACRPES When high, this bit indicates that the MAC MII receive protocol engine is actively receiving
data and not in IDLE state. (RO)
FR
UF
RW
T_
PM
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
WKUPPKTFILTER The MSB (31st bit) must be zero. Bit j[30:0] is the byte mask. If Bit 1/2/3/4
(byte number) of the byte mask is set, the CRC block processes the filter 0/1/2/3 Offset + j of the
incoming packet (RWKPTR is 0/1/2/3). (R/W)
• RWKPTR is 4: Bit 3/11/19/27 specifies the address type, defining the destination address
type of the pattern. When the bit is set, the pattern applies to only multicast packets; when
the bit is reset, the pattern applies only to unicast packet for filter 0/1/2/3. Bit 0/8/16/24 is
the enable bit for filter 0/1/2/3;
• RWKPTR is 5: This filter 0/1/2/3 offset register defines the offset (within the packet) from
which the filter 0/1/2/3 examines the packets;
• RWKPTR is 6: This filter 0 (bit[15:0])/1 (bit[31:16]) CRC16 register contains the CRC16 value
calculated from the pattern and also the byte mask programmed to the wake-up filter register
block; The polynomial:
• RWKPTR is 7: This filter 2 bit[15:0])/3(bit[31:16]) CRC16 register contains the CRC16 value
calculated from the pattern and also the byte mask programmed to the wake-up filter register
block. The polynomial:
rv T
RC D
se VD
RD TEN
PW PK N
RS
KP V
K E
(re CA
N
)
RW d)
G C
ed
ed
ed
TR
G T
ILT
W
e
M PR
M PK
LU
rv
rv
rv
KP
KF
se
se
se
K
LB
RW
RW
RW
(re
(re
(re
G
31 30 29 28 24 23 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 Reset
RWKFILTRST When this bit is set, it resets the remote RWKPTR register to 3’b000. (R/WS/SC)
RWKPTR The maximum value of the pointer is 7 ,the detail information ,please refer to PMT_RWUFFR.
(RO)
GLBLUCAST When set, enables any unicast packet filtered by the MAC (DAFilter) address recognition
to be a remote wake-up frame. (R/W)
RWKPRCVD When set, this bit indicates the power management event is generated because of the
reception of a remote wake-up frame. This bit is cleared by a Read into this register. (R/SS/RC)
MGKPRCVD When set, this bit indicates that the power management event is generated because of
the reception of a magic packet. This bit is cleared by a Read into this register. (R/SS/RC)
RWKPKTEN hen set, enables generation of a power management event because of remote wake-up
frame reception. (R/W)
MGKPKTEN When set, enables generation of a power management event because of magic packet
reception. (R/W)
PWRDWN hen set, the MAC receiver drops all received frames until it receives the expected magic
packet or remote wake-up frame. This bit must only be set when MGKPKTEN, GLBLUCAST, or
RWKPKTEN bit is set high. (R/WS/SC)
d)
S d)
d)
ed
ve
PL rve
ve
TL EN
TL IST
EN
RL IEX
(re XA
ST
TL IEX
rv
N
r
r
se
se
se
se
PI
IE
PI
IT
PI
P
P
(re
(re
(re
RL
RL
LP
LP
31 20 19 18 17 16 15 10 9 8 7 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
LPITXA This bit controls the behavior of the MAC when it is entering or coming out of the LPI mode on
the transmit side.If the LPITXA and LPIEN bits are set to 1, the MAC enters the LPI mode only after
all outstanding frames and pending frames have been transmitted. The MAC comes out of the
LPI mode when the application sends any frame.When this bit is 0, the LPIEN bit directly controls
behavior of the MAC when it is entering or coming out of the LPI mode. (R/W)
PLS This bit indicates the link status of the PHY. When set, the link is considered to be okay (up) and
when reset, the link is considered to be down. (R/W)
LPIEN When set, this bit instructs the MAC Transmitter to enter the LPI state. When reset, this bit
instructs the MAC to exit the LPI state and resume normal transmission.This bit is cleared when
the LPITXA bit is set and the MAC exits the LPI state because of the arrival of a new packet for
transmission. (R/W/SC)
RLPIST When set, this bit indicates that the MAC is receiving the LPI pattern on the MII interface.
(R/W)
TLPIST When set, this bit indicates that the MAC is receiving the LPI pattern on the MII interface.
(R/W)
RLPIEX When set, this bit indicates that the MAC Receiver has stopped receiving the LPI pattern on
the MII interface, exited the LPI state, and resumed the normal reception. This bit is cleared by a
read into this register. (R/SS/RC)
RLPIEN When set, this bit indicates that the MAC Receiver has received an LPI pattern and entered
the LPI state. This bit is cleared by a read into this register. (R/SS/RC)
TLPIEX When set, this bit indicates that the MAC transmitter has exited the LPI state after the user
has cleared the LPIEN bit and the LPI_TW_Timer has expired.This bit is cleared by a read into this
register. (R/SS/RC)
TLPIEN When set, this bit indicates that the MAC Transmitter has entered the LPI state because of
the setting of the LPIEN bit. This bit is cleared by a read into this register. (R/SS/RC)
ER
ER
IM
IM
_T
)
_T
ed
W
LS
rv
_T
se
I_
I
LP
LP
(re
31 26 25 16 15 0
0 0 0 0 0 0 0 x 3 E 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
LPI_LS_TIMER This field specifies the minimum time (in milliseconds) for which the link status from
the PHY should be up (OKAY) before the LPI pattern can be transmitted to the PHY. The MAC
does not transmit the LPI pattern even when the LPIEN bit is set unless the LPI_LS_Timer reaches
the programmed terminal count. The default value of the LPI_LS_Timer is 1000 (1 sec) as defined
in the IEEE standard.(R/W)
LPI_TW_TIMER This field specifies the minimum time (in microseconds) for which the MAC waits after
it stops transmitting the LPI pattern to the PHY and before it resumes the normal transmission. The
TLPIEX status bit is set after the expiry of this timer.(R/W)
d)
)
S
ed
ed
ed
e
(re TS
NT
rv
rv
rv
v
er
IIN
TI
se
se
se
s
PM
(re
(re
(re
LP
31 11 10 9 8 4 3 2 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
LPIINTS When the Energy Efficient Ethernet feature is enabled, this bit is set for any LPI state entry or
exit in the MAC Transmitter or Receiver. This bit is cleared on reading Bit[0] of Register (LPI Control
and Status Register). (RO)
PMTINTS This bit is set when a magic packet or remote wake-up frame is received in the power-down
mode (see Bit[5] and Bit[6] in the PMT Control and Status Register). This bit is cleared when both
Bits[6:5] are cleared because of a read operation to the PMT Control and Status register. This bit
is valid only when you select the optional PMT module during core configuration. (RO)
K
rv SK
AS
d)
)
se A
M
ed
ed
ed
(re TM
ve
NT
rv
rv
r
IIN
TI
se
se
se
PM
(re
(re
(re
LP
31 11 10 9 8 4 3 2 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
LPIINTMASK When set, this bit disables the assertion of the interrupt signal because of the setting
of the LPI Interrupt Status bit in Register (Interrupt Status Register). (R/W)
PMTINTMASK When set, this bit disables the assertion of the interrupt signal because of the setting
of PMT Interrupt Status bit in Register (Interrupt Status Register). (R/W)
I
_H
LE
S0
AB
ES
EN
DR
S_
d)
D
ES
ve
_A
DR
AC
se
AD
(re
M
31 30 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0FFFF Reset
MAC_ADDRESS0_HI This field contains the upper 16 bits (47:32) of the first 6-byte MAC address.
The MAC uses this field for filtering the received frames and inserting the MAC address in the
Transmit Flow Control (Pause) Frames. (R/W)
31 0
0x0FFFFFFFF Reset
EMACADDR0LOW_REG This field contains the lower 32 bits of the first 6-byte MAC address. This
is used by the MAC for filtering the received frames and inserting the MAC address in the Transmit
Flow Control (Pause) Frames. (R/W)
L
RO
RE 1
I
SS
_H
NT
DD LE
S1
_A AB
O
_C
S
CE _EN
RE
TE
DD
UR SS
BY
d)
ve
_A
SO RE
K_
er
AC
AS
D
s
AD
(re
M
M
31 30 29 24 23 16 15 0
ADDRESS_ENABLE1 When this bit is set, the address filter module uses the second MAC address
for perfect filtering. When this bit is reset, the address filter module ignores the address for filtering.
(R/W)
SOURCE_ADDRESS When this bit is set, the EMACADDR1[47:0] is used to compare with the SA
fields of the received frame. When this bit is reset, the EMACADDR1[47:0] is used to compare with
the DA fields of the received frame. (R/W)
MASK_BYTE_CONTROL These bits are mask control bits for comparison of each of the
EMACADDR1 bytes. When set high, the MAC does not compare the corresponding byte of re-
ceived DA or SA with the contents of EMACADDR1 registers. Each bit controls the masking of the
bytes as follows:
You can filter a group of addresses (known as group address filtering) by masking one or more
bytes of the address. (R/W)
MAC_ADDRESS1_HI This field contains the upper 16 bits, Bits[47:32] of the second 6-byte MAC
address. (R/W)
31 0
0x0FFFFFFFF Reset
EMACADDR1LOW_REG This field contains the lower 32 bits of the second 6-byte MAC address.
The content of this field is undefined, so the register needs to be configured after the initialization
process. (R/W)
L2
RO
2
RE 2
I
SS
_H
NT
DD LE
S2
_A AB
O
_C
S
CE _EN
RE
TE
DD
UR SS
BY
d)
ve
_A
SO RE
K_
er
AC
AS
D
s
AD
(re
M
M
31 30 29 24 23 16 15 0
ADDRESS_ENABLE2 When this bit is set, the address filter module uses the third MAC address for
perfect filtering. When this bit is reset, the address filter module ignores the address for filtering.
(R/W)
SOURCE_ADDRESS2 When this bit is set, the EMACADDR2[47:0] is used to compare with the SA
fields of the received frame. When this bit is reset, the EMACADDR2[47:0] is used to compare with
the DA fields of the received frame. (R/W)
MASK_BYTE_CONTROL2 These bits are mask control bits for comparison of each of the
EMACADDR2 bytes. When set high, the MAC does not compare the corresponding byte of re-
ceived DA or SA with the contents of EMACADDR2 registers. Each bit controls the masking of the
bytes as follows:
You can filter a group of addresses (known as group address filtering) by masking one or more
bytes of the address. (R/W)
MAC_ADDRESS2_HI This field contains the upper 16 bits, Bits[47:32] of the third 6-byte MAC ad-
dress. (R/W)
31 0
0x0FFFFFFFF Reset
EMACADDR2LOW_REG This field contains the lower 32 bits of the third 6-byte MAC address. The
content of this field is undefined, so the register needs to be configured after the initialization pro-
cess. (R/W)
L3
RO
3
RE 3
I
SS
_H
NT
DD LE
S3
_A AB
O
_C
S
CE _EN
RE
TE
DD
UR SS
BY
d)
ve
_A
SO RE
K_
er
AC
AS
D
s
AD
(re
M
M
31 30 29 24 23 16 15 0
ADDRESS_ENABLE3 When this bit is set, the address filter module uses the fourth MAC address for
perfect filtering. When this bit is reset, the address filter module ignores the address for filtering.
(R/W)
SOURCE_ADDRESS3 When this bit is set, the EMACADDR3[47:0] is used to compare with the SA
fields of the received frame. When this bit is reset, the EMACADDR3[47:0] is used to compare with
the DA fields of the received frame. (R/W)
MASK_BYTE_CONTROL3 These bits are mask control bits for comparison of each of the
EMACADDR3 bytes. When set high, the MAC does not compare the corresponding byte of re-
ceived DA or SA with the contents of EMACADDR3 registers. Each bit controls the masking of the
bytes as follows:
You can filter a group of addresses (known as group address filtering) by masking one or more
bytes of the address. (R/W)
MAC_ADDRESS3_HI This field contains the upper 16 bits, Bits[47:32] of the fourth 6-byte MAC ad-
dress. (R/W)
31 0
0x0FFFFFFFF Reset
EMACADDR3LOW_REG This field contains the lower 32 bits of the fourth 6-byte MAC address.
The content of this field is undefined, so the register needs to be configured after the initialization
process. (R/W)
L4
RO
4
RE 4
I
SS
_H
NT
DD LE
S4
_A AB
O
_C
S
CE _EN
RE
TE
DD
UR SS
BY
d)
ve
_A
SO RE
K_
er
AC
AS
D
s
AD
(re
M
M
31 30 29 24 23 16 15 0
ADDRESS_ENABLE4 When this bit is set, the address filter module uses the fifth MAC address for
perfect filtering. When this bit is reset, the address filter module ignores the address for filtering.
(R/W)
SOURCE_ADDRESS4 When this bit is set, the EMACADDR4[47:0] is used to compare with the SA
fields of the received frame. When this bit is reset, the EMACADDR4[47:0] is used to compare with
the DA fields of the received frame. (R/W)
MASK_BYTE_CONTROL4 These bits are mask control bits for comparison of each of the
EMACADDR4 bytes. When set high, the MAC does not compare the corresponding byte of re-
ceived DA or SA with the contents of EMACADDR4 registers. Each bit controls the masking of the
bytes as follows:
You can filter a group of addresses (known as group address filtering) by masking one or more
bytes of the address. (R/W)
MAC_ADDRESS4_HI This field contains the upper 16 bits, Bits[47:32] of the fifth 6-byte MAC ad-
dress. (R/W)
31 0
0x0FFFFFFFF Reset
EMACADDR4LOW_REG This field contains the lower 32 bits of the fifth 6-byte MAC address. The
content of this field is undefined, so the register needs to be configured after the initialization pro-
cess. (R/W)
L5
RO
5
RE 5
I
SS
_H
NT
DD LE
S5
_A AB
O
_C
S
CE _EN
RE
TE
DD
UR SS
BY
d)
ve
_A
SO RE
K_
er
AC
AS
D
s
AD
(re
M
M
31 30 29 24 23 16 15 0
ADDRESS_ENABLE5 When this bit is set, the address filter module uses the sixth MAC address for
perfect filtering. When this bit is reset, the address filter module ignores the address for filtering.
(R/W)
SOURCE_ADDRESS5 When this bit is set, the EMACADDR5[47:0] is used to compare with the SA
fields of the received frame. When this bit is reset, the EMACADDR5[47:0] is used to compare with
the DA fields of the received frame. (R/W)
MASK_BYTE_CONTROL5 These bits are mask control bits for comparison of each of the
EMACADDR5 bytes. When set high, the MAC does not compare the corresponding byte of re-
ceived DA or SA with the contents of EMACADDR5 registers. Each bit controls the masking of the
bytes as follows:
You can filter a group of addresses (known as group address filtering) by masking one or more
bytes of the address. (R/W)
MAC_ADDRESS5_HI This field contains the upper 16 bits, Bits[47:32] of the sixth 6-byte MAC ad-
dress. (R/W)
31 0
0x0FFFFFFFF Reset
EMACADDR5LOW_REG This field contains the lower 32 bits of the sixth 6-byte MAC address. The
content of this field is undefined, so the register needs to be configured after the initialization pro-
cess. (R/W)
L6
RO
6
RE 6
I
SS
_H
NT
DD LE
S6
_A AB
O
_C
S
CE _EN
RE
TE
DD
UR SS
BY
d)
ve
_A
SO RE
K_
er
AC
AS
D
s
AD
(re
M
M
31 30 29 24 23 16 15 0
ADDRESS_ENABLE6 When this bit is set, the address filter module uses the seventh MAC address
for perfect filtering. When this bit is reset, the address filter module ignores the address for filtering.
(R/W)
SOURCE_ADDRESS6 When this bit is set, the EMACADDR6[47:0] is used to compare with the SA
fields of the received frame. When this bit is reset, the EMACADDR6[47:0] is used to compare with
the DA fields of the received frame. (R/W)
MASK_BYTE_CONTROL6 These bits are mask control bits for comparison of each of the
EMACADDR6 bytes. When set high, the MAC does not compare the corresponding byte of re-
ceived DA or SA with the contents of EMACADDR6 registers. Each bit controls the masking of the
bytes as follows:
You can filter a group of addresses (known as group address filtering) by masking one or more
bytes of the address. (R/W)
MAC_ADDRESS6_HI This field contains the upper 16 bits, Bits[47:32] of the seventh 6-byte MAC
address. (R/W)
31 0
0x0FFFFFFFF Reset
EMACADDR6LOW_REG This field contains the lower 32 bits of the seventh 6-byte MAC address.
The content of this field is undefined, so the register needs to be configured after the initialization
process. (R/W)
L7
RO
7
RE 7
I
SS
_H
NT
DD LE
S7
_A AB
O
_C
S
CE _EN
RE
TE
DD
UR SS
BY
d)
ve
_A
SO RE
K_
er
AC
AS
D
s
AD
(re
M
M
31 30 29 24 23 16 15 0
ADDRESS_ENABLE7 When this bit is set, the address filter module uses the eighth MAC address
for perfect filtering. When this bit is reset, the address filter module ignores the address for filtering.
(R/W)
SOURCE_ADDRESS7 When this bit is set, the EMACADDR7[47:0] is used to compare with the SA
fields of the received frame. When this bit is reset, the EMACADDR7[47:0] is used to compare with
the DA fields of the received frame. (R/W)
MASK_BYTE_CONTROL7 These bits are mask control bits for comparison of each of the
EMACADDR7 bytes. When set high, the MAC does not compare the corresponding byte of re-
ceived DA or SA with the contents of EMACADDR7 registers. Each bit controls the masking of the
bytes as follows:
You can filter a group of addresses (known as group address filtering) by masking one or more
bytes of the address. (R/W)
MAC_ADDRESS7_HI This field contains the upper 16 bits, Bits[47:32] of the eighth 6-byte MAC
address. (R/W)
31 0
0x0FFFFFFFF Reset
EMACADDR7LOW_REG This field contains the lower 32 bits of the eighth 6-byte MAC address.
The content of this field is undefined, so the register needs to be configured after the initialization
process. (R/W)
)
UT
EO
ed M
ED
DE
rv TI
se R_
PE
)
NK )
O
S
ed
ed
RX
_M
(re BE
_S
rv
rv
ID
se
se
NK
AB
SM
(re
(re
(J
LI
LI
31 17 16 15 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
JABBER_TIMEOUT This bit indicates whether there is jabber timeout error (1’b1) in the received
frame. (RO)
LINK_SPEED This bit indicates the current speed of the link: (RO)
• 2’b01: 25 MHz.
LINK_MODE This bit indicates the current mode of operation of the link: (RO)
TO
)
)
ed
ed
G
G
rv
rv
DO
DO
se
se
PW
(re
(re
31 17 16 15 14 13 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0000 Reset
PWDOGEN When this bit is set and Bit[23] (WD) of EMACCONFIG_REG is reset, the WTO field
(Bits[13:0]) is used as watchdog timeout for a received frame. When this bit is cleared, the watch-
dog timeout for a received frame is controlled by the setting of Bit[23] (WD) and Bit[20] (JE) in
EMACCONFIG_REG. (R/W)
WDOGTO When Bit[16] (PWE) is set and Bit[23] (WD) of EMACCONFIG_REG is reset, this field is used
as watchdog timeout for a received frame. If the length of a received frame exceeds the value of
this field, such frame is terminated and declared as an error frame. (R/W)
UM
M
_N
NU
V
DI
_
IV
H_
_D
_
UT
UT
_O
_O
LK
LK
)
ed
_C
_C
rv
AC
AC
se
EM
EM
(re
31 8 7 4 3 0
EMAC_CLK_OUT_H_DIV_NUM RMII CLK using internal PLLA CLK, the half divider number, when
using RMII PHY. (R/W)
EMAC_CLK_OUT_DIV_NUM RMII CLK using internal PLLA CLK, the whole divider number, when
using RMII PHY. (R/W)
0M
M
0
0M
_1
_1
00
M
M
_1
_1
U
NU
M
UM
L
_N
E
V_
_S
IV
_N
_N
DI
LK
_D
IV
IV
_
_C
_H
_H
_D
_D
SC
SC
SC
SC
SC
d)
_O
_O
_O
_O
_O
e
rv
AC
AC
AC
AC
AC
se
EM
EM
EM
EM
EM
(re
31 25 24 23 18 17 12 11 6 5 0
0 0 0 0 0 0 0 0 0 1 9 19 Reset
EMAC_OSC_CLK_SEL Ethernet work using external PHY output clock or not for RMII CLK, when
using RMII PHY. When this bit is set to 1, external PHY CLK is used. When this bit is set to 0, PLLA
CLK is used. (R/W)
TX N
N
A d) LK_ X_E
_E
N
SC N
_E
_O _E
EM rve I_C _R
XT C
se MI LK
S
_E _O
(re C_ I_C
AC INT
A MI
d)
A d)
ve
EM rve
EM C_
EM C_
er
se
s
(re
(re
31 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EL
_S
TF
IN
H Y_
d)
)
ed
_P
ve
rv
AC
r
se
se
EM
(re
(re
31 16 15 13 12 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EMAC_PHY_INTF_SEL The PHY interface selected. 0x0: PHY MII, 0x4: PHY RMII. (R/W)
EN
D_
_P
AM
d)
_R
ve
AC
r
se
EM
(re
31 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EMAC_RAM_PD_EN Ethernet RAM power-down enable signal. Bit[0]: TX SRAM; Bit[1]: RX SRAM.
Setting the bit to 1 powers down the RAM. (R/W)
11.1 Overview
An I2C (Inter-Integrated Circuit) bus can be used for communication with several external devices connected to the
same bus as ESP32. The ESP32 has dedicated hardware to communicate with peripherals on the I2C bus.
11.2 Features
The I2C controller has the following features:
• Supports continuous data transmission with disabled Serial Clock Line (SCL)
Communication starts when a master sends out a start condition: it will pull the SDA line low, and will then pull
the SCL line high. It will send out nine clock pulses over the SCL line. The first eight pulses are used to shift out a
byte consisting of a 7-bit address and a read/write bit. If a slave with this address is active on the bus, the slave
can answer by pulling the SDA low on the ninth clock pulse. The master can then send out more 9-bit clock pulse
clusters and, depending on the read/write bit sent, the device or the master will shift out data on the SDA line, with
the other side acknowledging the transfer by pulling the SDA low on the ninth clock pulse. During data transfer,
the SDA line changes only when the SCL line is low. When the master has finished the communication, it will send
a stop condition on the bus by raising SDA, while SCL will already be high.
The ESP32 I2C peripheral can handle the I2C protocol, freeing up the processor cores for other tasks.
11.3.2 Architecture
An I2C controller can operate either in master mode or slave mode. The I2C_MS_MODE register is used to
select the mode. Figure 11-1 shows the I2C Master architecture, while Figure 11-2 shows the I2C Slave architec-
ture.
• RAM, the size of which is 32 x 8 bits, and it is directly mapped onto the address space of the CPU cores,
starting at address REG_I2C_BASE+0x100. Each byte of I2C data is stored in a 32-bit word of memory (so,
the first byte is at +0x100, the second byte at +0x104, the third byte at +0x108, etc.) Users need to set
register I2C_NONFIFO_EN.
• A CMD_Controller and 16 command registers (cmd0 ~ cmd15), which are used by the I2C Master to control
data transmission. One command at a time is executed by the I2C controller.
• SCL_FSM: A state machine that controls the SCL clock. The I2C_SCL_HIGH_PERIOD_REG and I2C_SCL_
LOW_PERIOD_REG registers are used to configure the frequency and duty cycle of the signal on the SCL
line.
• DATA_Shifter which converts the byte data to an outgoing bitstream, or converts an incoming bitstream to
byte data. I2C_RX_LSB_FIRST and I2C_TX_LSB_FIRST can be used for configuring whether the LSB or
MSB is stored or transmitted first.
• SCL_Filter and SDA_Filter: Input noise filter for the I2C_Slave. The filter can be enabled or disabled by
configuring I2C_SCL_FILTER_EN and I2C_SDA_FILTER_EN. The filter can remove line glitches with pulse
width less than I2C_SCL_FILTER_THRES and I2C_SDA_FILTER_THRES ABP clock cycles.
Figure 11-3 is an I2C sequence chart. When the I2C controller works in master mode, SCL is an output signal.
In contrast, when the I2C controller works in slave mode, the SCL becomes an input signal. The values assigned
to I2C_SDA_HOLD_REG and I2C_SDA_SAMPLE_REG are still valid in slave mode. Users need to configure the
values of I2C_SDA_HOLD_TIME and I2C_SDA_SAMPLE_TIME, according to the host characteristics, for the I2C
slave to receive data properly. Table 11-1 shows available settings of SCL low and high level cycles when SCL is
configured to direct output mode. The settings determine the SCL output frequency fscl .
80 MHz
fscl =
SCL_Low_Level_Cycles + SCL_High_Level_Cycles
According to the I2C protocol, each transmission of data begins with a START condition and ends with a STOP
condition. Data is transmitted by one byte at a time, and each byte has an ACK bit. The receiver informs the
transmitter to continue transmission by pulling down SDA, which indicates an ACK. The receiver can also indicate
it wants to stop further transmission by pulling up the SDA line, thereby not indicating an ACK.
Figure 11-3 also shows the registers that can configure the START bit, STOP bit, SDA hold time, and SDA sample
time.
Notice: If the I2C pads are configured in open-drain mode, it will take longer for the signal lines to transition from
a low level to a high level. The transition duration is determined together by the pull-up resistor and capacitor. The
output frequency of SCL is relatively low in open-drain mode.
The Command register is active only in I2C master mode, with its internal structure shown in Figure 11-4.
CMD_DONE: The CMD_DONE bit of every command can be read by software to tell if the command has been
handled by hardware.
op_code: op_code is used to indicate the command. The I2C controller supports four commands:
• RSTART: op_code = 0 is the RSTART command to control the transmission of a START or RESTART I2C
condition.
• WRITE: op_code = 1 is the WRITE command for the I2C Master to transmit data.
• READ: op_code = 2 is the READ command for the I2C Master to receive data.
• STOP: op_code = 3 is the STOP command to control the transmission of a STOP I2C condition.
• END: op_code = 4 is the END command for continuous data transmission. When the END command is
given, SCL is temporarily disabled to allow software to reload the command and data registers for subsequent
events before resuming. Transmission will then continue seamlessly.
A complete data transmission process begins with an RSTART command, and ends with a STOP command.
ack_value: When receiving data, this bit is used to indicate whether the receiver will send an ACK after this byte
has been received.
ack_exp: This bit is to set an expected ACK value for the transmitter.
ack_check_en: When transmitting a byte, this bit enables checking the ACK value received against the ack_exp
value. Checking is enabled by 1, while 0 disables it.
byte_num: This register specifies the length of data (in bytes) to be read or written. The maximum length is 255,
while the minimum is 1. When the op_code is RSTART, STOP or END, this value is meaningless.
In all subsequent figures that illustrate I2C transactions and behavior, both the I2C Master and Slave devices are
assumed to be ESP32 I2C peripheral controllers for ease of demonstration.
Figure 11-5 shows the I2C Master writing N bytes of data to an I2C Slave. According to the I2C protocol, the
first byte is the Slave address. As shown in the diagram, the first byte of the RAM unit has been populated with
the Slave’s 7-bit address plus the 1-bit read/write flag. In this case, the flag is zero, indicating a write operation.
The rest of the RAM unit holds N bytes of data ready for transmission. The cmd unit has been populated with the
sequence of commands for the operation.
For the I2C master to begin an operation, the bus must not be busy, i.e. the SCL line must not be pulled low by
another device on the I2C bus. The I2C operation can only begin when the SCL line is released (made high) to
indicate that the I2C bus is free. After the cmd unit and data are prepared, I2C_TRANS_START bit in I2C_CTR_REG
must be set to begin the configured I2C Master operation. The I2C Master then initiates a START condition on the
bus and progresses to the WRITE command which will fetch N+1 bytes from RAM and send them to the Slave.
The first of these bytes is the address byte.
When the transmitted data size exceeds I2C_NONFIFO_TX_THRES, an I2C_TX_SEND_EMPTY_INT interrupt will
be generated. After detecting the interrupt, software can read TXFIFO_END_ADDR in register RXFIFO_ST_REG,
get the last address of the data in the RAM and refresh the old data in the RAM. TXFIFO_END_ADDR will be
refreshed each time interrupt I2C_TX_SEND_EMPTY_INT or I2C_TRANS_COMPLETE_INT occurs.
When ack_check_en is set to 1, the Master will check the ACK value each time it sends a data byte. If the ACK
value received does not match ack_exp (the expected ACK value) in the WRITE command, then the Master will
generate an I2C_ACK_ERR_INT interrupt and stop the transmission.
During transmission, when the SCL is high, if the input value and output value of SDA do not match, then the
Master will generate an I2C_ARBITRATION_LOST_INT interrupt. When the transmission is finished, the Master will
generate an I2C_TRANS_COMPLETE_INT interrupt.
After detecting the START bit sent from the Master, the Slave will start receiving the address and comparing it
to its own. If the address does not match I2C_SLAVE_ADDR, then the Slave will ignore the rest of the transmis-
sion. If they do match, the Slave will store the rest of the data into RAM in the receiving order. When the data
size exceeds I2C_NONFIFO_RX_THRES, an I2C_RX_REC_FULL_INT interrupt is generated. After detecting the
interrupt, software will get the starting and ending addresses in the RAM by reading RXFIFO_START_ADDR and
RXFIFO_END_ADDR bits in register RXFIFO_ST_REG, and fetch the data for further processing. Register RX-
FIFO_START_ADDR is refreshed only once during each transmission, while RXFIFO_END_ADDR gets refreshed
every time when either I2C_RX_REC_FULL_INT or I2C_TRANS_COMPLETE_INT interrupt is generated.
When the END command is not used, the I2C master can transmit up to (14*255-1) bytes of valid data, and the
cmd unit is populated with RSTART + 14 WRITE + 1 STOP.
• If the Master fails to send a STOP bit, because the SDA is pulled low by other devices, then the Master needs
to be reset.
• If the Master fails to send a START bit, because the SDA or SCL is pulled low by other devices, then the
Master needs to be reset. It is recommended that the software uses a timeout period to implement the reset.
• If the SDA is pulled low by the Slave during transmission, the Master can simply release it by sending it nine
SCL clock signals at the most.
It is important to note that the behaviour of another I2C master or slave device on the bus may not always be similar
to that of the ESP32 I2C peripheral in the master- or slave-mode operation described above. Please consult the
datasheets of the respective I2C devices to ensure proper operation under all bus conditions.
The ESP32 I2C controller uses 7-bit addressing by default. However, 10-bit addressing can also be used. In
the master, this is done by sending a second I2C address byte after the first address byte. In the slave, the
I2C_SLAVE_ADDR_10BIT_EN bit in I2C_SLAVE_ADDR_REG can be set to activate a 10-bit addressing mode.
I2C_SLAVE_ADDR is used to configure the I2C Slave address, as per usual. Figure 11-6 shows the equivalent of
I2C Master operation writing N-bytes of data to an I2C Slave with a 10-bit address. Since 10-bit Slave addresses
require an extra address byte, both the byte_num field of the WRITE command and the number of total bytes in
RAM increase by one.
When the END command is not used, the I2C master can transmit up to (14*255-2) bytes of valid data to Slave
with 10-bit address.
One way many I2C Slave devices are designed is by exposing a register block containing various settings. The
I2C Master can write one or more of these registers by sending the Slave a register address. The ESP32 I2C Slave
controller has hardware support for such a scheme.
Specifically, on the Slave, I2C_FIFO_ADDR_CFG_EN can be set so that the I2C Master can write to a specified
register address inside the I2C Slave memory block. Figure 11-7 shows the Master writing N-bytes of data byte0 ~
byte(N-1) from the RAM unit to register address M (determined by addrM in RAM unit) with the Slave. In this mode,
Slave can receive up to 32 bytes of valid data. When Master needs to transmit extra amount of data, segmented
transmission can be enabled.
Figure 117. I2C Master Writes to addrM in RAM of Slave with 7bit Address
If the data size exceeds the capacity of a 14-byte read/write cmd, the END command can be called to enable
segmented transmission. Figure 11-8 shows the Master writing data to the Slave, in three segments. The first
segment shows the configuration of the Master’s commands and the preparation of data in the RAM unit. When the
I2C_TRANS_START bit is enabled, the Master starts transmission. After executing the END command, the Master
will turn off the SCL clock and pull the SCL low to reserve the bus and prevent any other device from transacting
on the bus. The controller will generate an I2C_END_DETECT_INT interrupt to notify the software.
Figure 118. Master Writes to Slave with 7bit Address in Three Segments
After detecting an I2C_END_DETECT_INT interrupt, the software can refresh the contents of the cmd and RAM
blocks, as shown in the second segment. Subsequently, it should clear the I2C_END_DETECT_INT interrupt and
resume the transaction by setting the I2C_TRANS_START bit. To stop the transaction, it should configure the cmd,
as the third segment shows, and enable the I2C_TRANS_START bit to generate a STOP bit, after detecting the
I2C_END_DETECT_INT interrupt.
Please note that the other masters on the bus will be starved of bus time between two segments. The bus is only
released after a STOP signal is sent.
Note: When there are more than three segments, the address of an END command in the cmd should not be
altered into another command by the next segment.
Figure 11-9 shows the Master reading N-bytes of data from an Slave with a 7-bit address. At first, the Master
needs to send the address of the Slave, so cmd1 is a WRITE command. The byte that this command sends is
the slave address plus the R/W flag, which in this case is 1 and, therefore, indicates that this is going to be a
read operation. The Slave starts to send data to the Master if the addresses match. The Master will return ACK,
according to the ack_value in the READ command, upon receiving every byte. As can be seen from Figure 11-9,
READ is divided into two segments. The Master replies ACK to N-1 bytes in cmd2 and does not reply ACK to the
single byte READ command in cmd3, i.e., the last transmitted data. Users can configure it as they wish.
When storing the received data, Master will start from the first address in RAM. Byte0 (Slave address + 1-bit R/W
marker bit) will be overwritten.
When the END command is not used, the Master can transmit up to (13*255) bytes of valid data. The cmd unit is
populated with RSTART + 1 WRITE + 13 READ + 1 STOP.
Figure 11-10 shows the Master reading data from a slave with a 10-bit address. This mode can be enabled
by setting I2C_SLAVE_ADDR_10BIT_EN bit and preparing data to be sent in the slave RAM. In the Master, two
bytes of RAM are used for a 10-bit address. Finally, the I2C _TRANS_START bit must be set to enable one
transaction.
Figure 11-11 shows the Master reading data from a specified address in the Slave. This mode can be enabled
by setting I2C_FIFO_ADDR_CFG_EN and preparing the data to be read by the master in the Slave RAM block.
Subsequently, the address of the Slave and the address of the specified register (that is, M) have to be determined
by the master. Finally, the I2C_TRANS_START bit must be set in the Master to initiate the read operation, following
which the Slave will fetch N bytes of data from RAM and send them to the Master.
Figure 1111. Master Reads N Bytes of Data from addrM in Slave with 7bit Address
Figure 11-12 shows the Master reading N+M bytes of data in three segments from the Slave. The first segment
shows the configuration of the cmd and the preparation of data in the Slave RAM. When the I2C_TRANS_START
bit is enabled, the Master starts the operation. The Master will refresh the cmd after executing the END com-
mand. It will clear the I2C_END_DETECT_INT interrupt, set the I2C_TRANS_START bit and resume the transac-
tion. To stop the transaction, the Master will configure the cmd, as the third segment shows, after detecting the
I2C_END_DETECT_INT interrupt. After setting the I2C_TRANS_START bit, Master will send a STOP bit to stop
the transaction.
Figure 1112. Master Reads from Slave with 7bit Address in Three Segments
11.3.7 Interrupts
• I2C_TX_SEND_EMPTY_INT: Triggered when the has sent nonfifo_tx_thres bytes of data.
• I2C_ACK_ERR_INT: Triggered when the Master receives an ACK that is not as expected, or when the Slave
receives an ACK whose value is 1.
• I2C_TIME_OUT_INT: Triggered when the SCL stays high or low for more than I2C_TIME_OUT clocks.
• I2C_ARBITRATION_LOST_INT: Triggered when the Master’s SCL is high, while the output value and input
value of the SDA do not match.
11.5 Registers
Register 11.1. I2C_SCL_LOW_PERIOD_REG (0x0000)
D
IO
ER
_P
W
LO
_
d)
CL
ve
S
er
C_
s
(re
I2
31 14 13 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2C_SCL_LOW_PERIOD This register is used to configure for how long SCL remains low in master
mode, in APB clock cycles. (R/W)
RC _OU EL
FO E EV
UT
E_ T
A_ RC L_L
O
C_ AN F T
) E T
se _M ST T
I2 TR B_ IRS
I2 rve OD AR
(re S S_ RS
SD FO C
C_ L_ _S
I
C_ L F
I2 TX_ SB_
I2 SC LE
S
P
C_ _L
d)
C_ M
C_ d
e
I2 SA
I2 RX
rv
M
se
C _
(re
I2
31 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 Reset
I2C_RX_LSB_FIRST This bit is used to control the storage mode for received data. (R/W)
1: receive data from the least significant bit;
0: receive data from the most significant bit.
I2C_TX_LSB_FIRST This bit is used to control the sending mode for data needing to be sent. (R/W)
1: send data from the least significant bit;
0: send data from the most significant bit.
I2C_TRANS_START Set this bit to start sending the data in txfifo. (R/W)
I2C_MS_MODE Set this bit to configure the module as an I2C Master. Clear this bit to configure the
module as an I2C Slave. (R/W)
I2C_SAMPLE_SCL_LEVEL 1: sample SDA data on the SCL low level; 0: sample SDA data on the
SCL high level. (R/W)
T
AS
D
_L
SE
E
T
AS
AT
C_ B S ES
ST
_L
I2 BU E_A NS
I2 AR BU DR
NT
NT
N_
TE
_ Y
K_ R W
T
C_ AV A
C_ S D
C_ AV T
_C
C
_C
C_ E S
I2 SL _TR
I2 SL OU
TA
AI
I2 TIM LO
RE
AC E_
O
_M
O
_S
_
IF
_
F
C_ TE
)
d)
)
ed
ed
C_ d
FI
CL
CL
XF
ve
I2 rve
I2 BY
TX
rv
rv
R
_S
S
er
se
se
se
C_
C_
C_
s
C
(re
(re
(re
(re
I2
I2
I2
I2
31 30 28 27 26 24 23 18 17 14 13 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2C_SCL_STATE_LAST This field indicates the states of the state machine used to produce SCL.
(RO)
0: Idle; 1: Start; 2: Negative edge; 3: Low; 4: Positive edge; 5: High; 6: Stop
I2C_SCL_MAIN_STATE_LAST This field indicates the states of the I2C module state machine. (RO)
0: Idle; 1: Address shift; 2: ACK address; 3: Rx data; 4: Tx data; 5: Send ACK; 6: Wait ACK
I2C_TXFIFO_CNT This field stores the amount of received data in RAM. (RO)
I2C_RXFIFO_CNT This field represents the amount of data needed to be sent. (RO)
I2C_SLAVE_ADDRESSED When configured as an I2C Slave, and the address sent by the master is
equal to the address of the slave, then this bit will be of high level. (RO)
I2C_BUS_BUSY 1: the I2C bus is busy transferring data; 0: the I2C bus is in idle state. (RO)
I2C_ARB_LOST When the I2C controller loses control of SCL line, this register changes to 1. (RO)
I2C_TIME_OUT When the I2C controller takes more than I2C_TIME_OUT clocks to receive a data bit,
this field changes to 1. (RO)
I2C_SLAVE_RW When in slave mode, 1: master reads from slave; 0: master writes to slave. (RO)
I2C_ACK_REC This register stores the value of the received ACK bit. (RO)
IM
e
rv
T
se
C_
(re
I2
31 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2C_TIME_OUT_REG This register is used to configure the timeout for receiving a data bit in APB
clock cycles. (R/W)
EN
T_
BI
10
R_
R
DD
DD
_A
_A
VE
VE
)
ed
LA
LA
rv
_S
S
se
C_
C
(re
I2
I2
31 30 15 14 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2C_SLAVE_ADDR_10BIT_EN This field is used to enable the slave 10-bit addressing mode in master
mode. (R/W)
I2C_SLAVE_ADDR When configured as an I2C Slave, this field is used to configure the slave address.
(R/W)
DR
DR
AD
D
T_
_A
DR
R
ND
TA
AD
DD
_S
_E
T_
FO
FO
_A
R
ND
FI
FI
TA
X
_S
_E
_T
_T
FO
FO
FO
FO
d)
FI
FI
FI
FI
ve
RX
RX
_R
_R
r
se
C_
C_
C
C
(re
I2
I2
I2
I2
31 20 19 15 14 10 9 5 4 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2C_TXFIFO_END_ADDR This is the offset address of the last sent data, as described
in nonfifo_tx_thres register. The value refreshes when I2C_TX_SEND_EMPTY_INT or
I2C_TRANS_COMPLETE_INT interrupt is generated. (RO)
I2C_TXFIFO_START_ADDR This is the offset address of the first sent data, as described in non-
fifo_tx_thres register. (RO)
I2C_RXFIFO_END_ADDR This is the offset address of the last received data, as de-
scribed in nonfifo_rx_thres_register. This value refreshes when I2C_RX_REC_FULL_INT or
I2C_TRANS_COMPLETE_INT interrupt is generated. (RO)
I2C_RXFIFO_START_ADDR This is the offset address of the last received data, as described in non-
fifo_rx_thres_register. (RO)
N
ES
RE
N _E
HR
TH
_E FG
_T
X_
IF _C
X
_R
_T
NF DDR
O
O
IF
IF
NO _A
NF
NF
)
C_ )
C_ O
ed
ed
O
NO
I2 FIF
rv
rv
N
se
se
C_
C_
(re
(re
I2
I2
I2
31 26 25 20 19 14 13 12 11 10
I2C_NONFIFO_TX_THRES When I2C sends more than nonfifo_tx_thres bytes of data, it will generate
a tx_send_empty_int_raw interrupt and update the current offset address of the sent data. (R/W)
I2C_NONFIFO_RX_THRES When I2C receives more than nonfifo_rx_thres bytes of data, it will gen-
erate a rx_send_full_int_raw interrupt and update the current offset address of the received data.
(R/W)
I2C_FIFO_ADDR_CFG_EN When this bit is set to 1, the byte received after the I2C address byte
represents the offset address in the I2C Slave RAM. (R/W)
AW RA W
_R T_ RA
W
CT OS P_ AW
NT IN T_
W
TE _L OM _R
_I T_ IN
C_ E ST _ _R A
I2 AR ER MP RA AW
I2 TR _OU AR AW AW
I2 TIM S_ INT NT _R
DE ION _C INT
T
C_ S C T_ _R
C_ AN R _ IN
D_ AT AN E_
W
I2 MA S_ _IN INT
I2 TR ER ULL Y_
EN ITR TR LET
R
T
_ I
C_ AN T T_
C_ K _F P
I2 AC EC EM
T O
C_ _R _
C_ B _
I2 RX END
_
C_ S
)
ed
I2 TX_
rv
se
C_
(re
I2
31 13 12 11 10 9 8 7 6 5 3
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2C_RX_REC_FULL_INT_RAW The raw interrupt status bit for the I2C_RX_REC_FULL_INT interrupt.
(RO)
I2C_ACK_ERR_INT_RAW The raw interrupt status bit for the I2C_ACK_ERR_INT interrupt. (RO)
I2C_TRANS_START_INT_RAW The raw interrupt status bit for the I2C_TRANS_START_INT interrupt.
(RO)
I2C_TIME_OUT_INT_RAW The raw interrupt status bit for the I2C_TIME_OUT_INT interrupt. (RO)
I2C_END_DETECT_INT_RAW The raw interrupt status bit for the I2C_END_DETECT_INT interrupt.
(RO)
LR CL R
_C T_ CL
R
CT OS P_ LR
NT IN T_
R
TE _L OM _C
_I T_ IN
C_ E ST _ _C L
I2 TIM S_ INT NT _C
I2 AR ER MP CLR LR
I2 TR _OU AR LR LR
DE ION _C INT
T
C_ S C T_ _C
C_ AN R _ IN
D_ AT AN E_
I2 MA S_ _IN INT
I2 TR ER ULL Y_
EN ITR TR LET
C
T
_ I
C_ AN T T_
C_ K _F P
I2 AC EC EM
T O
C_ _R _
C_ B _
I2 RX END
_
C_ S
d)
I2 TX_
ve
er
C_
s
(re
I2
31 13 12 11 10 9 8 7 6 5 3
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
NA EN A
_E T_ EN
A
CT OS P_ NA
NT IN T_
A
TE _L OM _E
_I T_ IN
C_ E ST _ _E N
I2 AR ER MP EN NA
I2 TIM S_ INT NT _E
I2 TR _OU AR NA NA
DE ION _C INT
T
C_ S C T_ _E
C_ AN R _ IN
D_ AT AN E_
A
I2 MA S_ _IN INT
I2 TR ER ULL Y_
EN ITR TR LET
E
T
_ I
C_ AN T T_
C_ K _F P
I2 AC EC EM
T O
C_ _R _
C_ B _
I2 RX END
_
C_ S
d)
I2 TX_
ve
er
C_
s
(re
I2
31 13 12 11 10 9 8 7 6 5 3
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2C_ACK_ERR_INT_ENA The interrupt enable bit for the I2C_ACK_ERR_INT interrupt. (R/W)
I2C_TIME_OUT_INT_ENA The interrupt enable bit for the I2C_TIME_OUT_INT interrupt. (R/W)
I2C_END_DETECT_INT_ENA The interrupt enable bit for the I2C_END_DETECT_INT interrupt. (R/W)
_S T_ ST
NT IN T_
T ST
CT OS P_ T
TE _L OM _S
_I T_ IN
C_ E ST _ _S T
I2 TIM S_ INT NT _S
DE ION _C INT
I2 AR ER MP ST T
I2 TR _OU AR T T
T
C_ S C T_ _S
C_ AN R _ IN
D_ AT AN E_
I2 MA S_ _IN INT
I2 TR ER ULL Y_
EN ITR TR LET
S
T
_ I
C_ AN T T_
C_ K _F P
I2 AC EC EM
T O
C_ _R _
C_ B _
I2 RX END
_
C_ S
d)
I2 TX_
ve
er
C_
s
(re
I2
31 13 12 11 10 9 8 7 6 5 3
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2C_RX_REC_FULL_INT_ST The masked interrupt status bit for the I2C_RX_REC_FULL_INT inter-
rupt. (RO)
I2C_ACK_ERR_INT_ST The masked interrupt status bit for the I2C_ACK_ERR_INT interrupt. (RO)
I2C_TRANS_START_INT_ST The masked interrupt status bit for the I2C_TRANS_START_INT inter-
rupt. (RO)
I2C_TIME_OUT_INT_ST The masked interrupt status bit for the I2C_TIME_OUT_INT interrupt. (RO)
I2C_END_DETECT_INT_ST The masked interrupt status bit for the I2C_END_DETECT_INT interrupt.
(RO)
SD
rv
se
C_
(re
I2
31 10 9 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2C_SDA_HOLD_TIME This register is used to configure the time to hold the data after the negative
edge of SCL, in APB clock cycles. (R/W)
E
M
TI
E_
PL
M
SA
A_
d)
ve
SD
er
C_
s
(re
I2
31 10 9 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2C_SDA_SAMPLE_TIME This register is used to configure for how long SDA is sampled, in APB
clock cycles. (R/W)
D
O
RI
PE
H_
G
HI
L_
d)
ve
SC
r
se
C_
(re
I2
31 14 13 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2C_SCL_HIGH_PERIOD This register is used to configure for how long SCL remains high in master
mode, in APB clock cycles. (R/W)
E
M
_TI
LD
O
T _H
AR
ST
L_
)
d
ve
SC
r
se
C_
(re
I2
31 10 9 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 Reset
I2C_SCL_START_HOLD_TIME This register is used to configure the time between the negative edge
of SDA and the negative edge of SCL for a START condition, in APB clock cycles. (R/W)
E
M
TI
P_
TU
SE
R T_
TA
RS
L_
)
ed
SC
rv
se
C_
(re
I2
31 10 9 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 Reset
I2C_SCL_RSTART_SETUP_TIME This register is used to configure the time between the positive
edge of SCL and the negative edge of SDA for a RESTART condition, in APB clock cycles. (R/W)
E
IM
_T
LD
HO
P_
O
ST
L_
)
ed
SC
rv
se
C_
(re
I2
31 14 13 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2C_SCL_STOP_HOLD_TIME This register is used to configure the delay after the STOP condition,
in APB clock cycles. (R/W)
SC
r
se
C_
(re
I2
31 10 9 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2C_SCL_STOP_SETUP_TIME This register is used to configure the time between the positive edge
of SCL and the positive edge of SDA, in APB clock cycles. (R/W)
S
RE
N
TH
_E
R_
ER
E
LT
LT
FI
I
_F
_
d)
CL
CL
ve
_S
S
er
C_
s
C
(re
I2
I2
31 4 3 2 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 Reset
I2C_SCL_FILTER_THRES When a pulse on the SCL input has smaller width than this register value
in APB clock cycles, the I2C controller will ignore that pulse. (R/W)
S
RE
EN
TH
R_
R_
E
E
LT
LT
FI
FI
A_
A_
ed)
SD
rv
_S
se
C_
C
(re
I2
I2
31 4 3 2 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 Reset
I2C_SDA_FILTER_THRES When a pulse on the SDA input has smaller width than this register value
in APB clock cycles, the I2C controller will ignore that pulse. (R/W)
Dn
AN
AN
M
M
M
M
)
ed
CO
CO
rv
se
C_
C_
(re
I2
I2
31 30 14 13 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2C_COMMANDn_DONE When command n is done in I2C Master mode, this bit changes to high
level. (R/W)
12.1 Overview
The I2S bus provides a flexible communication interface for streaming digital data in multimedia applications, es-
pecially digital audio applications. The ESP32 includes two I2S interfaces: I2S0 and I2S1.
The I2S standard bus defines three signals: a clock signal, a channel selection signal, and a serial data signal. A
basic I2S data bus has one master and one slave. The roles remain unchanged throughout the communication.
The I2S modules on the ESP32 provide separate transmit and receive channels for high performance.
Figure 12-1 is the system block diagram of the ESP32 I2S module. In the figure above, the value of ”n” can be
either 0 or 1. There are two independent I2S modules embedded in ESP32, namely I2S0 and I2S1. Each I2S
module contains a Tx (transmit) unit and a Rx (receive) unit. Both the Tx unit and the Rx unit have a three-wire
interface that includes a clock line, a channel selection line and a serial data line. The serial data line of the Tx unit is
fixed as output, and the serial data line of the Rx unit is fixed as input. The clock line and the channel selection line
of the Tx and Rx units can be configured to both master transmitting mode and slave receiving mode. In the LCD
mode, the serial data line extends to the parallel data bus. Both the Tx unit and the Rx unit have a 32-bit-wide FIFO
with a depth of 64. Besides, only I2S0 supports on-chip DAC/ADC modes, as well as receiving and transmitting
PDM signals.
The right side of Figure 12-1 shows the signal bus of the I2S module. The signal naming rule of the Rx and Tx
units is I2SnA_B_C, where ”n” stands for either I2S0 or I2S1; ”A” represents the direction of I2S module’s data
bus signal, ”I” represents input, ”O” represents output; ”B” represents signal function; ”C” represents the signal
direction, ”in” means that the signal is input into the I2S module, while ”out” means that the I2S module outputs
the signal. For a detailed description of the I2S signal bus, please refer to Table 12-1.
Table 12-1 describes the signal bus of the I2S module. Except for the I2Sn_CLK signal, all other signals are mapped
to the chip pin via the GPIO matrix and IO MUX. The I2Sn_CLK signal is mapped to the chip pin via the IO_MUX.
For details, please refer to the chapter about IO_MUX and the GPIO Matrix.
Note:
Assume that the bit width of the input/output signal is N, the input signal should be configured to I2SnI_Data_in[N-1:0],
and the output signal to I2SnO_Data_out[23:23-N+1]. Generally, for input signals, N=8 or 16; while for output signals,
N=8, 16 or 24 (note that I2S1 does not support 24-bit width).
12.2 Features
I2S mode
LCD mode
I2S interrupts
Notice:
• When using PLL_D2_CLK as the clock source, it is not recommended to divide it using decimals. For high
performance audio applications, the analog PLL output clock source APLL_CLK must be used to acquire
highly accurate I2Sn_CLK and BCK. For further details, please refer to the chapter entitled Reset and Clock.
• When ESP32 I2S works in slave mode, the master must use I2Sn_CLK as the master clock and fi2s >= 8 *
fBCK .
The relation between I2Sn_CLK frequency fi2s and the divider clock source frequency fpll can be seen in the
equation below:
fpll
fi2s =
N + ba
”N”, whose value is >=2, corresponds to the REG _CLKM_DIV_NUM [7:0] bits of register I2S_CLKM_CONF_REG
, ”b” is the I2S_CLKM_DIV_B[5:0] bit and ”a” is the I2S_CLKM_DIV_A[5:0] bit.
In master mode, the serial clock BCK in the I2S module is derived from I2Sn_CLK, that is:
fi2s
fBCK =
M
In master transmitting mode, ”M”, whose value is >=2, is the I2S_TX_BCK_DIV_NUM[5:0] bit of register I2S_SAMPLE
_RATE_CONF_REG. In master receiving mode, ”M” is the I2S_RX_BCK_DIV_NUM[5:0] bit of register I2S_SAMPLE
_RATE_CONF_REG.
As is shown in Figure 12-3, the Philips I2S bus specifications require that the WS signal starts to change one BCK
clock cycle earlier than the SD signal on BCK falling edge, which means the WS signal becomes valid one clock
cycle before the first bit of data transfer on the current channel, and changes one clock cycle earlier than the end
of data transfer on the current channel. The SD signal line transmits the most significant bit of audio data first. If
the I2S_RX_MSB_SHIFT bit and the I2S_TX_MSB_SHIFT bit of register I2S_CONF_REG are set to 1, respectively,
the I2S module will use the Philips standard when receiving and transmitting data.
The MSB alignment standard is shown in Figure 12-4. WS and SD signals both change simultaneously on the falling
edge of BCK under the MSB alignment standard. The WS signal continues until the end of the current channel-data
transmission, and the SD signal line transmits the most significant bit of audio data first. If the I2S_RX_MSB_SHIFT
and I2S_TX_MSB_SHIFT bits of register I2S_CONF_REG are cleared, the I2S module will use the MSB alignment
standard when receiving and transmitting data.
Generally, both the I2S_RX_FIFO_MOD_FORCE_EN bit and I2S_TX_FIFO_MOD_FORCE_EN bits of register I2S_
FIFO_CONF_REG should be set to 1. I2S_TX_DATA_NUM[5:0] bit and I2S_RX_DATA_NUM[5:0] are used to control
the length of the data that have been sent, received and buffered. Hardware inspects the received-data length
RX_LEN and the transmitted-data length TX_LEN. Both the received and the transmitted data are buffered in the
FIFO method.
When RX_LEN is greater than I2S_RX_DATA_NUM[5:0], the received data, which is buffered in FIFO, has reached
the set threshold and needs to be read out to prevent an overflow. When TX_LEN is less than I2S_TX_DATA_NUM[5:0],
the transmitted data, which is buffered in FIFO, has not reached the set threshold and software can continue feeding
data into FIFO.
I2S_TX_FIFO_MOD[2:0] Description
0 16-bit dual channel data
Tx FIFO mode0 2 32-bit dual channel data
3 32-bit single channel data
Tx FIFO mode1 1 16-bit single channel data
At the first stage, there are two modes for data to be sent and written into FIFO. In Tx FIFO mode0, the Tx data-
to-be-sent are written into FIFO according to the time order. In Tx FIFO mode1, the data-to-be-sent are divided
into 16 high- and 16 low-order bits. Then, both the 16 high- and 16 low-order bits are recomposed and written
′
into FIFO. The details are shown in Figure 12-6 with the corresponding registers listed in Table 12-2. Dn consists
′′
of 16 high-order bits of Dn and 16 zeros. Dn consists of 16 low-order bits of Dn and 16 zeros. That is to say,
′ ′′
Dn = {Dn [31 : 16], 16′ h0}, Dn = {Dn [15 : 0], 16′ h0}.
At the second stage, the system reads data that will be sent from FIFO, according to the relevant register configura-
tion. The mode in which the system reads data from FIFO is relevant to the configuration of I2S_TX_FIFO_MOD[2.0]
and I2S_TX_CHAN_MOD[2:0]. I2S_TX_FIFO_MOD[2.0] determines whether the data are 16-bit or 32-bit, as shown
in Table 12-2, while I2S_TX_CHAN_MOD[2:0] determines the format of the data-to-be-sent, as shown in Table 12-
3.
I2S_TX_CHAN_MOD[2:0] Description
0 Dual channel mode
Mono mode
When I2S_TX_MSB_RIGHT equals 0, the left-channel data are ”holding”
1 their values and the right-channel data change into the left-channel data.
I2S_TX_CHAN_MOD[2:0] Description
When I2S_TX_MSB_RIGHT equals 1, the right-channel data are ”holding”
their values and the left-channel data change into the right-channel data.
Mono mode
When I2S_TX_MSB_RIGHT equals 0, the right-channel data are ”holding”
2 their values and the left-channel data change into the right-channel data.
When I2S_TX_MSB_RIGHT equals 1, the left-channel data are ”holding”
their values and the right-channel data change into the left-channel data.
Mono mode
When I2S_TX_MSB_RIGHT equals 0, the left-channel data are constants
3 in the range of REG[31:0].
When I2S_TX_MSB_RIGHT equals 1, the right-channel data are constants
in the range of REG[31:0].
Mono mode
When I2S_TX_MSB_RIGHT equals 0, the right-channel data are constants
4 in the range of REG[31:0].
When I2S_TX_MSB_RIGHT equals 1, the left-channel data are constants
in the range of REG[31:0].
The output of the third stage is determined by the mode of the I2S and I2S_TX_BITS_MOD[5:0] bits of register
I2S_SAMPLE_RATE_CONF_REG.
• The input serial-bit stream is transformed into a 64-bit parallel-data stream in I2S mode. In LCD mode, the
input parallel-data stream will be extended to a 64-bit parallel-data stream.
• Data are read from FIFO by CPU/DMA and written into the internal memory.
At the first stage of receiving data, the received-data stream is expanded to a zero-padded parallel-data stream with
32 high-order bits and 32 low-order bits, according to the level of the I2SnI_WS_out (or I2SnI_WS_in) signal. The
I2S_RX_MSB_RIGHT bit of register I2S_CONF_REG is used to determine how the data are to be expanded.
For example, as is shown in Figure 12-7, if the width of serial data is 16 bits, when I2S_RX_RIGHT_FIRST equals
1, Data0 will be discarded and I2S will start receiving data from Data1. If I2S_RX_MSB_RIGHT equals 1, data
of the first stage would be {0xF EDC0000, 0x32100000}. If I2S_RX_MSB_RIGHT equals 0, data of the first
stage would be {0x32100000, 0xF EDC0000}. When I2S_RX_RIGHT_FIRST equals 0, I2S will start receiving data
from Data0. If I2S_RX_MSB_RIGHT equals 1, data of the first stage would be {0xF EDC0000, 0x76540000}. If
I2S_RX_MSB_RIGHT equals 0, data of the first stage would be {0x76540000, 0xF EDC0000}.
As is shown in Table 12-4 and Figure 12-8, at the second stage, the received data of the Rx unit is written into FIFO.
There are four modes of writing received data into FIFO. Each mode corresponds to a value of I2S_RX_FIFO_MOD[2:0]
bit.
Table 124. Modes of Writing Received Data into FIFO and the Corresponding Register Configuration
At the third stage, CPU or DMA will read data from FIFO and write them into the internal memory directly. The
register configuration that each mode corresponds to is shown in Table 12-5.
Table 125. The Register Configuration to Which the Four Modes Correspond
I2S_RX_SLAVE_MOD bit and I2S_TX_SLAVE_MOD bit of register I2S_CONF_REG can configure I2S to slave re-
ceiving mode and slave transmitting mode, respectively.
I2S_TX_START bit of register I2S_CONF_REG is used to enable transmission. When I2S is in master transmitting
mode and this bit is set, the module will keep driving the clock signal and data of left and right channels. If FIFO
sends out all the buffered data and there are no new data to shift, the last batch of data will be looped on the data
line. When this bit is reset, master will stop driving clock and data lines. When I2S is configured to slave transmitting
mode and this bit is set, the module will wait for the master BCK clock to enable a transmit operation.
The I2S_RX_START bit of register I2S_CONF_REG is used to enable a receive operation. When I2S is in master
receiving mode and this bit is set, the module will keep driving the clock signal and sampling the input data stream
until this bit is reset. If I2S is configured to slave receiving mode and this bit is set, the receiving module will wait
for the master BCK clock to enable a receiving operation.
The output clock of PDM is mapped to the I2S0*_WS_out signal. Its configuration is identical to I2S’s BCK. Please
refer to section 12.3, ”The Clock of I2S Module”, for further details. The bit width for both received and transmitted
I2S PCM signals is 16 bits.
The PDM transmitting module is used to convert PCM signals into PDM signals, as shown in Figure 12-9. HPF is
a high-speed channel filter, and LPF is a low-speed channel filter. The PDM signal is derived from the PCM signal,
after upsampling and filtering. Signal I2S_TX_PDM_HP_BYPASS of register I2S_PDM_CONF_REG can be set to
bypass the HPF at the PCM input. Filter module group0 carries out the upsampling. If the frequency of the PDM
signal is fpdm and the frequency of the PCM signal is fpcm , the relation between fpdm and fpcm is given by:
I2S_T X_P DM _F P
fpdm = 64×fpcm ×
I2S_T X_P DM _F S
The upsampling factor of 64 is the result of the two upsampling stages.
Table 12-6 lists the configuration rates of the I2S_TX_PDM_FP bit and the I2S_TX_PDM_FS bit of register I2S_PDM
_FREQ_CONF_REG, whose output PDM signal frequency remains 48×128 KHz at different PCM signal frequen-
cies.
The I2S_TX_PDM_SINC_OSR2 bit of I2S_PDM_CONF_REG is the upsampling rate of the Filter group0.
I2S_T X_P DM _F P
I2S_T X_P DM _SIN C_OSR2 =
I2S_T X_P DM _F S
As is shown in Figure 12-10, the I2S_TX_PDM_EN bit and the I2S_PCM2PDM_CONV_EN bit of register I2S_PDM_
CONF_REG should be set to 1 to use the PDM sending module. The I2S_TX_PDM_SIGMADELTA_IN_SHIFT bit,
I2S_TX_PDM_SINC_IN_SHIFT bit, I2S_TX_PDM_LP_IN_SHIFT bit and I2S_TX_PDM_HP_IN_SHIFT bit of register
I2S_PDM_CONF_REG are used to adjust the size of the input signal of each filter module.
As is shown in Figure 12-11, the I2S_RX_PDM_EN bit and the I2S_PDM2PCM_CONV_EN bit of register I2S_PDM_
CONF_REG should be set to 1, in order to use the PDM receiving module. As is shown in Figure 12-12, the PDM
receiving module will convert the received PDM signal into a 16-bit PCM signal. Filter group1 is used to downsample
the PDM signal, and the I2S_RX_PDM_SINC_DSR_16_EN bit of register I2S_PDM_CONF_REG is used to adjust
the corresponding down-sampling rate.
Table 12-7 shows the configuration of the I2S_RX_PDM_SINC_DSR_16_EN bit whose PCM signal frequency re-
mains 48 KHz at different PDM signal frequencies.
• ADC/DAC mode
The clock configuration of the LCD master transmitting mode is identical to I2S’ clock configuration. In the LCD
mode, the frequency of WS is half of f BCK .
The I2S_LCD_EN bit of register I2S_CONF2_REG needs to be set and the I2S_TX_SLAVE_MOD bit of register
I2S_CONF_REG needs to be cleared, in order to configure I2S to the LCD master transmitting mode. Mean-
while, data should be sent under the correct mode, according to the I2S_TX_CHAN_MOD[2:0] bit of register
I2S_CONF_CHAN_REG and the I2S_TX_FIFO_MOD[2:0] bit of register I2S_FIFO_CONF_REG. The WS signal
needs to be inverted when it is routed through the GPIO Matrix. For details, please refer to the chapter about
IO_MUX and the GPIO Matrix. The I2S_LCD_TX_SDX2_EN bit and the I2S_LCD_TX_WRX2_EN bit of register
I2S_CONF2_REG should be set to the LCD master transmitting mode, so that both the data bus and WR signal
work in the appropriate mode.
As is shown in Figure 12-14 and Figure 12-15, the I2S_LCD_TX_WRX2_EN bit should be set to 1 and the
I2S_LCD_TX_SDX2_EN bit should be set to 0 in the data frame, form 1. Both I2S_LCD_TX_SDX2_EN bit and
I2S_LCD_TX_WRX2_EN bit are set to 1 in the data frame, form 2.
The PCLK in the Camera module connects to I2SnI_WS_in in the I2S module, as Figure 12-16 shows.
When I2S is in the camera slave receiving mode, and when I2Sn_H_SYNC, I2S_V_SYNC and I2S_H_REF are held
high, the master starts transmitting data, that is,
Thus, during data transmission, these three signals should be kept at a high level. For example, if the I2Sn_V_SYNC
signal of a camera is at low level during data transmission, it will be inverted when routed to the I2S module. ESP32
supports signal inversion through the GPIO matrix. For details, please refer to the chapter about IO_MUX and the
GPIO Matrix.
In order to make I2S work in camera mode, the I2S_LCD_EN bit and the I2S_CAMERA_EN bit of register I2S_CONF2
_REG are set to 1, the I2S_RX_SLAVE_MOD bit of register I2S_CONF_REG is set to 1, the I2S_RX_MSB_RIGHT
bit and the I2S_RX_RIGHT_FIRST bit of I2S_CONF_REG are set to 0. Thus, I2S works in the LCD slave receiving
mode. At the same time, in order to use the correct mode to receive data, both the I2S_RX_CHAN_MOD[2:0] bit
of register I2S_CONF_CHAN_REG and the I2S_RX_FIFO_MOD[2:0] bit of register I2S_FIFO_CONF_REG are set
to 1.
Firstly, the I2S_LCD_EN bit of register I2S_CONF2_REG is set to 1, and the I2S_RX_SLAVE_MOD bit of register
I2S_CONF_REG is set to 0, so that the I2S0 module works in LCD master receiving mode, and the I2S0 module
clock is configured such that the WS signal of I2S0 outputs an appropriate frequency. Then, the APB_CTRL_SAR
ADC_DATA_TO_I2S bit of register APB_CTRL_APB_SARADC_CTRL_REG is set to 1. Enable I2S to receive data
after configuring the relevant registers of SARADC. For details, please refer to Chapter On-Chip Sensors and
Analog Signal Processing.
The I2S0 module should be configured to master transmitting mode when it connects to the on-chip DAC. Figure
12-18 shows the signal connection between the I2S0 module and the DAC. The DAC’s control module regards
I2S_CLK as the clock in this configuration. As shown in Figure 12-19, when the data bus inputs data to the DAC’s
control module, the latter will input right-channel data to DAC1 module and left-channel data to DAC2 module.
When using the I2S DMA module, 8 bits of data-to-be-transmitted are shifted to the left by 8 bits of data-to-be-
received into the DMA double-byte type of buffer.
The I2S_LCD_EN bit of register I2S_CONF2_REG should be set to 1, while I2S_RX_SHORT_SYNC, I2S_TX_SHORT
_SYNC, I2S_CONF_REG , I2S_RX_MSB_SHIFT and I2S_TX_MSB_SHIFT should all be reset to 0. The I2S_TX_
SLAVE_MOD bit of register I2S_CONF_REG should be set to 0, as well, when using the DAC mode of I2S0. Select
a suitable transmit mode according to the standards of transmitting a 16-bit digital data stream. Configure the I2S0
module clock to output a suitable frequency for the I2S_CLK and the WS of I2S. Enable I2S0 to send data after
configuring the relevant DAC registers.
• I2S_IN_DSCR_EMPTY_INT: Triggered when there are no valid receiving linked lists left.
• I2S_OUT_DONE_INT: Triggered when all transmitted and buffered data have been read.
12.8 Registers
Register 12.1. I2S_FIFO_WR_REG (0x0000)
G
RE
R_
_W
FO
FI
S_
I2
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0
G
RE
D_
_R
O
IF
S _F
I2
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0
I2S_FIFO_RD_REG Stores the data that I2S receives from FIFO. (RO)
I2 TX_ SB _SY C
I2 RX SB HIF C
_F T
T
S_ _M RT YN
_M D
S_ M _R K
S_ M _S N
S_ S T D
S_ _R _R ET
S_ _M _R T
_R ET ET
S_ _S T S
S_ M O T
S_ S E S
S_ _R _S T
S_ R T T
I2 RX LAV _MO
I2 TX_ SB BAC
I2 RX SB IGH
I2 X_ AR O
I2 TX_ ON IGH
I2 RX IGH FIR
I2 X_ AV IR
I2 TX_ IGH HIF
I2 RX HO _S
I2 RX FO ES
TX ES ES
_
T
S_ F _R
S_ _M P
ET
S_ _S O
S_ _F T
S_ _S E
S_ S R
I2 RX OO
I2 RX TAR
I2 RX ON
I2 TX_ HO
I2 TX_ IFO
ES
T
L
L
I
)
S_ _
d
I2 SIG
ve
T
er
S_
s
(re
I2
31 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2S_SIG_LOOPBACK Enable signal loopback mode, with transmitter module and receiver module
sharing the same WS and BCK signals. (R/W)
I2S_RX_MSB_RIGHT Set this to place right-channel data at the MSB in the receive FIFO. (R/W)
I2S_TX_MSB_RIGHT Set this bit to place right-channel data at the MSB in the transmit FIFO. (R/W)
I2S_RX_MONO Set this bit to enable receiver’s mono mode in PCM standard mode. (R/W)
I2S_TX_MONO Set this bit to enable transmitter’s mono mode in PCM standard mode. (R/W)
I2S_RX_SHORT_SYNC Set this bit to enable receiver in PCM standard mode. (R/W)
I2S_TX_SHORT_SYNC Set this bit to enable transmitter in PCM standard mode. (R/W)
I2S_RX_MSB_SHIFT Set this bit to enable receiver in Philips standard mode. (R/W)
I2S_TX_MSB_SHIFT Set this bit to enable transmitter in Philips standard mode. (R/W)
se T_ F_ _I T AW
S_ T_ _ R NT AW
S_ d N _R _R W
AW
I2 rve DO INT NT _RA
IN W W
NT W
(re OU EO RR _IN _R
I2 OU CR _E Y_I _R
I2 TX_ UN INT AW W
E_ A A
AK AT _R W
W
_I A
_R
W
T NT
E_ A_ AW
S_ _H G _R A
S_ P LL IN W
TA T_R
_T _D NT RA
S_ _W P T_ A
I2 RX FU Y_I AW
I2 TX_ EM INT AW
RA
I2 RX UN NT T_R
I2 RX EM _IN _R
I2 TX_ FU Y_ RA
I2 IN_ DS MP F_I
RX UT _I T_
D A IN
R
T_
_ R
E R
T
S_ T_ _ O
S_ H _ IN
S_ W PT _
S_ R G _
S_ _R LL N
I2 OU CR L_E
I2 X_ NE F_
O O
E
R
T
_
S_ D TA
I
S_ D E
S_ D C
I2 IN_ C_
I2 IN_ TO
S
U
S_ T_
d)
)
S_ S
ve
I2 OU
I2 IN_
T
r
se
S_
(re
I2
31 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2S_OUT_TOTAL_EOF_INT_RAW The raw interrupt status bit for the I2S_OUT_TOTAL_EOF_INT in-
terrupt. (RO)
I2S_IN_DSCR_EMPTY_INT_RAW The raw interrupt status bit for the I2S_IN_DSCR_EMPTY_INT in-
terrupt. (RO)
I2S_OUT_DSCR_ERR_INT_RAW The raw interrupt status bit for the I2S_OUT_DSCR_ERR_INT in-
terrupt. (RO)
I2S_IN_DSCR_ERR_INT_RAW The raw interrupt status bit for the I2S_IN_DSCR_ERR_INT interrupt.
(RO)
I2S_OUT_EOF_INT_RAW The raw interrupt status bit for the I2S_OUT_EOF_INT interrupt. (RO)
I2S_OUT_DONE_INT_RAW The raw interrupt status bit for the I2S_OUT_DONE_INT interrupt. (RO)
I2S_IN_SUC_EOF_INT_RAW The raw interrupt status bit for the I2S_IN_SUC_EOF_INT interrupt.
(RO)
I2S_IN_DONE_INT_RAW The raw interrupt status bit for the I2S_IN_DONE_INT interrupt. (RO)
I2S_TX_HUNG_INT_RAW The raw interrupt status bit for the I2S_TX_HUNG_INT interrupt. (RO)
I2S_RX_HUNG_INT_RAW The raw interrupt status bit for the I2S_RX_HUNG_INT interrupt. (RO)
I2S_TX_REMPTY_INT_RAW The raw interrupt status bit for the I2S_TX_REMPTY_INT interrupt. (RO)
I2S_TX_WFULL_INT_RAW The raw interrupt status bit for the I2S_TX_WFULL_INT interrupt. (RO)
I2S_RX_REMPTY_INT_RAW The raw interrupt status bit for the I2S_RX_REMPTY_INT interrupt.
(RO)
I2S_RX_WFULL_INT_RAW The raw interrupt status bit for the I2S_RX_WFULL_INT interrupt. (RO)
I2S_TX_PUT_DATA_INT_RAW The raw interrupt status bit for the I2S_TX_PUT_DATA_INT interrupt.
(RO)
I2S_RX_TAKE_DATA_INT_RAW The raw interrupt status bit for the I2S_RX_TAKE_DATA_INT inter-
rupt. (RO)
se T_ F_ _I T T
I2 OU CR _E Y_I _ST
T
E_ T T
_S
_I T
S_ T_ _ R NT
T NT
S_ d N _S _S
S_ _H G _S T
TA T_S
_T _D NT ST
S_ _W P T_ T
NT
I2 RX UN INT T_S
ST
I2 RX EM _IN _S
E_ A_ T
I2 IN_ DS MP F_I
I2 TX_ FU Y_ ST
I2 RX FU Y_I T
I2 TX_ EM INT T
RX UT _I T_
AK AT _S
I2 TX_ UN INT T
D A IN
T_
S
E R
_ S
T
S_ T_ _ O
S_ H E_ IN
S_ W PT _
S _ P LL IN
S_ R G _
S_ _R LL N
IN
I2 OU CR L_E
I2 X_ N F_
O
E
R
T
_
S_ D TA
S_ D E
S_ D C
I2 TX_ C_
I2 IN_ TO
O
S
U
S_ T_
)
)
ed
S_ S
I2 OU
I2 IN_
rv
T
se
S_
(re
I2
31 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2S_IN_DSCR_ERR_INT_ST The masked interrupt status bit for the I2S_IN_DSCR_ERR_INT inter-
rupt. (RO)
I2S_OUT_EOF_INT_ST The masked interrupt status bit for the I2S_OUT_EOF_INT interrupt. (RO)
I2S_OUT_DONE_INT_ST The masked interrupt status bit for the I2S_OUT_DONE_INT interrupt. (RO)
I2S_IN_SUC_EOF_INT_ST The masked interrupt status bit for the I2S_IN_SUC_EOF_INT interrupt.
(RO)
I2S_IN_DONE_INT_ST The masked interrupt status bit for the I2S_IN_DONE_INT interrupt. (RO)
I2S_TX_HUNG_INT_ST The masked interrupt status bit for the I2S_TX_HUNG_INT interrupt. (RO)
I2S_RX_HUNG_INT_ST The masked interrupt status bit for the I2S_RX_HUNG_INT interrupt. (RO)
I2S_TX_REMPTY_INT_ST The masked interrupt status bit for the I2S_TX_REMPTY_INT interrupt.
(RO)
I2S_TX_WFULL_INT_ST The masked interrupt status bit for the I2S_TX_WFULL_INT interrupt. (RO)
I2S_RX_REMPTY_INT_ST The masked interrupt status bit for the I2S_RX_REMPTY_INT interrupt.
(RO)
I2S_RX_WFULL_INT_ST The masked interrupt status bit for the I2S_RX_WFULL_INT interrupt. (RO)
I2S_TX_PUT_DATA_INT_ST The masked interrupt status bit for the I2S_TX_PUT_DATA_INT inter-
rupt. (RO)
I2S_RX_TAKE_DATA_INT_ST The masked interrupt status bit for the I2S_RX_TAKE_DATA_INT inter-
rupt. (RO)
se T_ F_ _I T A
S_ T_ _ R NT A
S_ d N _E _E A
(re OU EO RR _IN _EN
I2 OU CR _E Y_I _EN
NA
IN A A
NT A
E_ N N
I2 TX_ UN INT NA A
_I N
AK AT _E A
_E
A
T NT
S_ _H G _E N
TA T_E
_T _D NT EN
E_ A_ NA
S_ _W P T_ N
S_ P LL IN A
EN
I2 RX FU Y_I NA
I2 RX UN NT T_E
I2 TX_ EM INT NA
I2 TX_ FU Y_ EN
I2 RX EM _IN _E
I2 IN_ DS MP F_I
RX UT _I T_
D A IN
T_
E
E R
_ E
T
S_ T_ _ O
S_ H _ IN
S_ W PT _
S_ R G _
S_ _R LL N
I2 OU CR L_E
I2 X_ NE F_
O O
E
R
T
_
S_ D TA
I
S_ D E
S_ D C
I2 IN_ C_
I2 IN_ TO
S
U
S_ T_
)
)
ed
S_ S
I2 OU
I2 IN_
rv
T
se
S_
(re
I2
31 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2S_OUT_EOF_INT_ENA The interrupt enable bit for the I2S_OUT_EOF_INT interrupt. (R/W)
I2S_OUT_DONE_INT_ENA The interrupt enable bit for the I2S_OUT_DONE_INT interrupt. (R/W)
I2S_IN_SUC_EOF_INT_ENA The interrupt enable bit for the I2S_IN_SUC_EOF_INT interrupt. (R/W)
I2S_IN_DONE_INT_ENA The interrupt enable bit for the I2S_IN_DONE_INT interrupt. (R/W)
I2S_TX_HUNG_INT_ENA The interrupt enable bit for the I2S_TX_HUNG_INT interrupt. (R/W)
I2S_RX_HUNG_INT_ENA The interrupt enable bit for the I2S_RX_HUNG_INT interrupt. (R/W)
I2S_TX_REMPTY_INT_ENA The interrupt enable bit for the I2S_TX_REMPTY_INT interrupt. (R/W)
I2S_TX_WFULL_INT_ENA The interrupt enable bit for the I2S_TX_WFULL_INT interrupt. (R/W)
I2S_RX_REMPTY_INT_ENA The interrupt enable bit for the I2S_RX_REMPTY_INT interrupt. (R/W)
I2S_RX_WFULL_INT_ENA The interrupt enable bit for the I2S_RX_WFULL_INT interrupt. (R/W)
se T_ F_ _I T LR
S_ T_ _ R NT LR
S_ d N _C _C R
LR
I2 rve DO INT NT _CL
(re OU EO RR _IN _C
I2 OU CR _E Y_I _C
IN R R
_I LR
E_ L L
I2 TX_ UN INT LR R
_C
AK AT _C R
S_ _W P T_ LR
T NT
TA T_C
S_ _H G _C L
_T _D NT CL
E_ A_ LR
S_ P LL IN R
I2 RX UN NT T_C
I2 RX FU Y_I LR
NT
CL
I2 TX_ EM INT LR
I2 RX EM _IN _C
I2 TX_ FU Y_ CL
I2 IN_ DS MP F_I
RX UT _I T_
D A IN
C
T_
_ C
E R
T
S_ T_ _ O
S_ H _ IN
S_ W PT _
S_ R G _
S_ _R LL N
I2 OU CR L_E
I2 X_ NE F_
O O
E
R
T
_
S_ D TA
I
S_ D E
S_ D C
I2 IN_ C_
I2 IN_ TO
S
U
S_ T_
d)
)
S_ S
ve
I2 OU
I2 IN_
T
r
se
S_
(re
I2
31 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
AY
AY
LA
AY
Y
Y
AY
LA
EL
Y
EL
LA
DE
Y
EL
LA
Y
LA
LA
EL
_D
DE
LA
_D
DE
N W
NV
TX SY LE_
_D
DE
DE
_D
DE
DE
UT
S
UT
_B C_S
T_
_I
UT
UT
SY C_
N_
AB
IN
N_
AT _IN
_O
_
_O
U
IN
O
IN
O
_D N
_I
K_
O
EN
_I
_
S_
CK
S_
K
CK
CK
D_
D_
S
S
C
BC
A_
_W
_W
_W
_W
S_ _D
_B
_S
)
_B
_B
_S
ed
I2 X
RX
RX
RX
RX
RX
TX
TX
TX
TX
TX
TX
rv
_D
_R
se
S_
S_
S_
S_
S_
S_
S_
S_
S_
S_
S_
S
S
(re
I2
I2
I2
I2
I2
I2
I2
I2
I2
I2
I2
I2
I2
31 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2S_TX_BCK_IN_INV Set this bit to invert the BCK signal into the slave transmitter. (R/W)
I2S_RX_DSYNC_SW Set this bit to synchronize signals into the receiver in double sync method.
(R/W)
I2S_TX_DSYNC_SW Set this bit to synchronize signals into the transmitter in double sync method.
(R/W)
I2S_RX_BCK_OUT_DELAY Number of delay cycles for BCK signal out of the receiver. (R/W)
I2S_RX_WS_OUT_DELAY Number of delay cycles for WS signal out of the receiver. (R/W)
I2S_TX_SD_OUT_DELAY Number of delay cycles for SD signal out of the transmitter. (R/W)
I2S_TX_WS_OUT_DELAY Number of delay cycles for WS signal out of the transmitter. (R/W)
I2S_TX_BCK_OUT_DELAY Number of delay cycles for BCK signal out of the transmitter. (R/W)
I2S_RX_SD_IN_DELAY Number of delay cycles for SD signal into the receiver. (R/W)
I2S_RX_WS_IN_DELAY Number of delay cycles for WS signal into the receiver. (R/W)
I2S_RX_BCK_IN_DELAY Number of delay cycles for BCK signal into the receiver. (R/W)
I2S_TX_WS_IN_DELAY Number of delay cycles for WS signal into the transmitter. (R/W)
I2S_TX_BCK_IN_DELAY Number of delay cycles for BCK signal into the transmitter. (R/W)
E_ N
EN
RC _E
FO CE
D_ R
O FO
_ M D_
M
UM
D
NU
IF MO
_N
_M
_M
A_
N
_F _
A
TX IFO
_E
O
AT
AT
IF
IF
CR
_D
)
_D
S_ _F
_F
_F
d
ve
DS
I2 RX
RX
RX
TX
TX
er
S_
S_
S_
S_
S_
S_
s
(re
I2
I2
I2
I2
I2
I2
31 21 20 19 18 16 15 13 12 11 6 5 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 32 32 Reset
31 0
64 Reset
31 0
0 Reset
I2S_CONF_SINGLE_DATA_REG The right channel or the left channel outputs constant values stored
in this register according to TX_CHAN_MOD and I2S_TX_MSB_RIGHT. (R/W)
D
O
O
M
M
N_
N_
HA
HA
_C
_C
)
ed
RX
TX
rv
se
S_
S_
(re
I2
I2
31 5 4 3 2 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2S_RX_CHAN_MOD I2S receiver channel mode configuration bits. Please refer to Section 12.4.5
for further details. (R/W)
I2S_TX_CHAN_MOD I2S transmitter channel mode configuration bits. Please refer to Section 12.4.4
for further details. (R/W)
R
P
DD
TO
UT K S
O IN RE
_A
S_ TL _
I2 OU INK
NK
LI
S_ TL
)
)
S_ d
UT
I2 rve
ve
I2 OU
_O
er
se
S
(re
(re
I2
31 30 29 28 27 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0x000000 Reset
DR
P
IN K_ ST
TO
AD
S_ IN E
I2 INL K_R
K_
S_ IN
N
)
)
S_ d
ed
LI
I2 rve
I2 INL
rv
IN
se
se
S_
(re
(re
I2
31 30 29 28 27 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0x000000 Reset
31 0
0x000000000 Reset
31 0
0x000000000 Reset
31 0
0x000000000 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
I2 rve EO BU _EN N
DE EN
S_ BM _ ES K
se T_ R_ ST _E
I2 AH OP _T BAC
O _
(re OU SC UR ST
M ST
I2 AH _R ES T
ST
S_ S TA ER
S_ TD B R
S_ d F_ R
S_ LO O R
S_ BM S T
I2 OU R_ _BU
_R ST R
I2 IN_ LO _W
I2 IND DA N
IN R O_
W
T
P
T
S_ T_ TO
S_ T_ IF
S_ T_ O
I2 OU _F
I2 OU K_
I2 OU AU
ST
C
S_ EC
S_ T_
d)
)
ve
I2 OU
I2 CH
er
_
s
S
(re
I2
31 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 Reset
I2S_CHECK_OWNER Set this bit to check the owner bit by hardware. (R/W)
I2S_OUT_AUTO_WRBACK Set this bit to enable automatic outlink-writeback when all the data in tx
buffer has been transmitted. (R/W)
I2S_AHBM_FIFO_RST Set this bit to reset AHB interface cmdFIFO of DMA. (R/W)
31 0
0x000000000 Reset
31 0
0x000000000 Reset
T
IF
A
SH
_ EN
_
UT
UT
UT
EO
EO
EO
IM
IM
IM
_T
_T
_T
FO
FO
IF
I
FI
d)
_F
_F
_
ve
LC
LC
LC
r
se
S_
S_
S_
(re
I2
I2
I2
31 12 11 10 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0x010 Reset
I2S_LC_FIFO_TIMEOUT_SHIFT The bits are used to set the tick counter threshold. The tick counter
is reset when the counter value >= 88000/2i2s_lc_fifo_timeout_shift . (R/W)
I2S_LC_FIFO_TIMEOUT When the value of FIFO hung counter is equal to this bit value, sending
data-timeout interrupt or receiving data-timeout interrupt will be triggered. (R/W)
S
AS
AS
NF
NF
YP
YP
CM EN
O
_C
_B
_C
_B
_P P_
CM
CM
RX TO
C
_P
d)
S_ S
_P
_P
I2 TX_
ve
RX
TX
TX
er
S_
S_
S_
S_
s
(re
I2
I2
I2
I2
31 9 8 7 6 4 3 2 0
I2S_TX_STOP_EN Set this bit and the transmitter will stop transmitting BCK signal and WS signal
when tx FIFO is empty. (R/W)
I2S_RX_PCM_BYPASS Set this bit to bypass the Compress/Decompress module for the received
data. (R/W)
I2S_TX_PCM_BYPASS Set this bit to bypass the Compress/Decompress module for the transmitted
data. (R/W)
RC PU
PD
O E_
E_
_F C
FO R
FI FO
_
d)
se d)
)
S_ d
S_ O
ve
(re rve
I2 rve
I2 FIF
r
se
se
(re
(re
31 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 Reset
N
_E
N
ER R EN
EN _E
RT
(re D_E C_S EN
M _W 2_
A_ X2
N TA
_
CA TX DX
LC AD ID
S_ _ AL
S_ D_ S
I2 LC TX_
I2 EXT _V
R
S_ D_
d)
S_ )
ed
S_ E
ve
I2 INT
I2 C
rv
L
er
se
_
s
S
(re
I2
I2
31 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 Reset
I2S_EXT_ADC_START_EN Set this bit to enable the start of external ADC . (R/W)
I2S_LCD_TX_SDX2_EN Set this bit to duplicate data pairs (Data Frame, Form 2) in LCD mode. (R/W)
M
NU
_B
A_
_
) A
IV
IV
IV
ed N
_D
_D
_D
rv _E
KM
KM
se KA
d)
LK
ve
(re CL
CL
CL
_C
r
se
S_
S_
S_
S
(re
I2
I2
I2
I2
31 22 21 20 19 14 13 8 7 0
M
NU
NU
D
V_
_
O
IV
I
_M
_M
_D
_D
S
CK
S
CK
IT
IT
_B
_B
d)
_B
_B
ve
RX
RX
TX
TX
er
S_
S_
S_
S_
s
(re
I2
I2
I2
I2
31 24 23 18 17 12 11 6 5 0
0 0 0 0 0 0 0 0 16 16 6 6 Reset
I2S_RX_BITS_MOD Set the bits to configure the bit length of I2S receiver channel. (R/W)
I2S_TX_BITS_MOD Set the bits to configure the bit length of I2S transmitter channel. (R/W)
FT
HI
_S
EN
IN
6_
T
A_
IF
_1
FT
FT
DM EN NV N
N
_D S
SH
2
LT
DM NC AS
_ P _ O _E
_E
SR
HI
SR
HI
DE
_S
TX DM _C V
P
_S
IN
S_ _P M N
TX M_ _BY
C_
IN
C_
IN
I2 RX PD _CO
M
P_
P_
IG
IN
IN
D P
N
SI
_P _H
_H
_S
_S
_S
S_ M M
_E
_L
I2 PC PC
RX DM
DM
DM
DM
D M
2
2
)
)
S_ P
_P
_P
_P
_P
_P
S_ M
ed
ed
I2 TX_
I2 PD
TX
TX
TX
TX
rv
rv
se
se
_
S_
S_
S_
S_
S_
_
S
S
(re
(re
I2
I2
I2
I2
I2
I2
I2
31 26 25 24 23 22 21 20 19 18 17 16 15 8 7 4 3 2 1 0
I2S_TX_PDM_HP_BYPASS Set this bit to bypass the transmitter’s PDM HP filter. (R/W)
I2S_RX_PDM_SINC_DSR_16_EN PDM downsampling rate for filter group 1 in receiver mode. (R/W)
1: downsampling rate = 128;
0: downsampling rate = 64.
I2S_TX_PDM_SIGMADELTA_IN_SHIFT Adjust the size of the input signal into filter module. (R/W)
0: divided by 2; 1: multiplied by 1; 2: multiplied by 2; 3: multiplied by 4.
I2S_TX_PDM_SINC_IN_SHIFT Adjust the size of the input signal into filter module. (R/W)
0: divided by 2; 1: multiplied by 1; 2: multiplied by 2; 3: multiplied by 4.
I2S_TX_PDM_LP_IN_SHIFT Adjust the size of the input signal into filter module. (R/W)
0: divided by 2; 1: multiplied by 1; 2: multiplied by 2; 3: multiplied by 4.
I2S_TX_PDM_HP_IN_SHIFT Adjust the size of the input signal into filter module. (R/W)
0: divided by 2; 1: multiplied by 1; 2: multiplied by 2; 3: multiplied by 4.
S
_F
_F
M
DM
D
)
_P
_P
ed
TX
TX
rv
se
S_
S_
(re
I2
I2
31 20 19 10 9 0
BA K
CK
T_ C
E SE BA
D L E T_
_ I _R E
TX IFO ES
S_ F _R
I2 TX_ IFO
d)
S_ _F
ve
I2 RX
er
S_
s
(re
I2
31 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 Reset
I2S_RX_FIFO_RESET_BACK This bit is used to confirm if the Rx FIFO reset is done. 1: reset is not
ready; 0: reset is ready. (RO)
I2S_TX_FIFO_RESET_BACK This bit is used to confirm if the Tx FIFO reset is done. 1: reset is not
ready; 0: reset is ready. (RO)
I2S_TX_IDLE The status bit of the transmitter. 1: the transmitter is idle; 0: the transmitter is busy.
(RO)
13.1 Overview
Embedded applications often require a simple method of exchanging data between devices that need minimal
system resources. The Universal Asynchronous Receiver/Transmitter (UART) is one such standard that can realize
a flexible full-duplex data exchange among different devices. The three UART controllers available on a chip are
compatible with UART-enabled devices from various manufacturers. The UART can also carry out an IrDA (Infrared
Data Exchange), or function as an RS-485 modem.
All UART controllers integrated in the ESP32 feature an identical set of registers for ease of programming and
flexibility. In this documentation, these controllers are referred to as UARTn, where n = 0, 1, and 2, referring to
UART0, UART1, and UART2, respectively.
A typical UART frame begins with a START bit, followed by a “character” and an optional parity bit for error detection,
and it ends with a STOP condition. The UART controllers available on the ESP32 provide hardware support for
multiple lengths of data and STOP bits. In addition, the controllers support both software and hardware flow
control, as well as DMA, for seamless high-speed data transfer. This allows the developer to employ multiple
UART ports in the system with minimal software overhead.
Figure 13-1 shows the basic block diagram of the UART controller. The UART block can derive its clock from two
sources: the 80-MHz APB_CLK, or the reference clock REF_TICK (please refer to Chapter Reset and Clock for
more details). These two clock sources can be selected by configuring UART_TICK_REF_ALWAYS_ON.
Then, a divider in the clock path divides the selected clock source to generate clock signals that drive the UART
module. UART_CLKDIV_REG contains the clock divider value in two parts — UART_CLKDIV (integral part) and
UART_CLKDIV_FRAG (decimal part).
The UART controller can be further broken down into two functional blocks — the transmit block and the receive
block.
The transmit block contains a transmit-FIFO buffer, which buffers data awaiting to be transmitted. Software can
write Tx_FIFO via APB, and transmit data into Tx_FIFO via DMA. Tx_FIFO_Ctrl is used to control read- and write-
access to the Tx_FIFO. When Tx_FIFO is not null, Tx_FSM reads data via Tx_FIFO_Ctrl, and transmits data out
according to the set frame format. The outgoing bit stream can be inverted by appropriately configuring the register
UART_TXD_INV.
The receive-block contains a receive-FIFO buffer, which buffers incoming data awaiting to be processed. The
input bit stream, rxd_in, is fed to the UART controller. Negation of the input stream can be controlled by config-
uring the UART_RXD_INV register. Baudrate_Detect measures the baud rate of the input signal by measuring the
minimum pulse width of the input bit stream. Start_Detect is used to detect a START bit in a frame of incoming
data. After detecting the START bit, RX_FSM stores data retrieved from the received frame into Rx_FIFO through
Rx_FIFO_Ctrl.
Software can read data in the Rx_FIFO through the APB. In order to free the CPU from engaging in data transfer
operations, the DMA can be configured for sending or receiving data.
HW_Flow_Ctrl is able to control the data flow of rxd_in and txd_out through standard UART RTS and CTS flow
control signals (rtsn_out and ctsn_in). SW_Flow_Ctrl controls the data flow by inserting special characters in the
incoming and outgoing data flow. When UART is in Light-sleep mode (refer to Chapter Low-Power Management),
Wakeup_Ctrl will start counting pulses in rxd_in. When the number or positive edges of RxD signal is greater than
or equal to (UART_ACTIVE_THRESHOLD+2), a wake_up signal will be generated and sent to RTC. RTC will then
wake up the UART controller. Note that only UART1 and UART2 support Light-sleep mode and that rxd_in cannot
be input through GPIO Matrix but only through IO_MUX.
Three UART controllers share a 1024 × 8-bit RAM space. As illustrated in Figure 13-2, RAM is allocated in different
blocks. One block holds 128 × 8-bit data. Figure 13-2 illustrates the default RAM allocated to Tx_FIFO and
Rx_FIFO of the three UART controllers. Tx_FIFO of UARTn can be extended by setting UARTn_TX_SIZE, while
Rx_FIFO of UARTn can be extended by setting UARTn_RX_SIZE.
NOTICE: Extending the FIFO space of a UART controller may take up the FIFO space of another UART con-
troller.
If none of the UART controllers is active, setting UART_MEM_PD, UART1_MEM_PD, and UART2_MEM_PD can
prompt the RAM to enter low-power mode.
In UART0, bit UART_TXFIFO_RST and bit UART_RXFIFO_RST can be set to reset Tx_FIFO or Rx_FIFO, respec-
tively. In UART1, bit UART1_TXFIFO_RST and bit UART1_RXFIFO_RST can be set to reset Tx_FIFO or Rx_FIFO,
respectively.
Note:
UART2 doesn’t have any register to reset Tx_FIFO or Rx_FIFO, and the UART1_TXFIFO_RST and UART1_RXFIFO_RST
in UART1 may impact the functioning of UART2. Therefore, these 2 registers in UART1 should only be used when the
Tx_FIFO and Rx_FIFO in UART2 do not have any data.
In order to use the baud rate detection feature, some random data should be sent to the receiver before starting the
UART communication stream. This is required so that the baud rate can be determined based on the pulse width.
UART_LOWPULSE_MIN_CNT stores minimum low-pulse width, UART_HIGHPULSE_MIN_CNT stores minimum
high-pulse width. By reading these two registers, software can calculate the baud rate of the transmitter.
The length of a character (BIT0 to BITn) can comprise 5 to 8 bits and can be configured by UART_BIT_NUM.
When UART_PARITY_EN is set, the UART controller hardware will add the appropriate parity bit after the data.
UART_PARITY is used to select odd parity or even parity. If the receiver detects an error in the input character,
interrupt UART_PARITY_ERR_INT will be generated. If the receiver detects an error in the frame format, interrupt
UART_FRM_ERR_INT will be generated.
Interrupt UART_TX_DONE_INT will be generated when all data in Tx_FIFO have been transmitted. When UART_TXD
_BRK is set, the transmitter sends several NULL characters after the process of sending data is completed. The
number of NULL characters can be configured by UART_TX_BRK_NUM. After the transmitter finishes sending
all NULL characters, interrupt UART_TX_BRK_DONE_INT will be generated. The minimum interval between data
frames can be configured with UART_TX_IDLE_NUM. If the idle time of a data frame is equal to, or larger than,
the configured value of register UART_TX_IDLE_NUM, interrupt UART_TX_BRK_IDLE_DONE_INT will be gener-
ated.
Figure 13-4 shows a special AT_CMD character format. If the receiver constantly receives UART_AT_CMD_CHAR
characters and these characters satisfy the following conditions, interrupt UART_AT_CMD_CHAR_DET_INT will
be generated.
• Between the first UART_AT_CMD_CHAR and the last non-UART_AT_CMD_CHAR, there are at least UART_
PER_IDLE_NUM APB clock cycles.
• Between every UART_AT_CMD_CHAR character there must be less than UART_RX_GAP_TOUT APB clock
cycles.
• The number of received UART_AT_CMD_CHAR characters must be equal to, or greater than, UART_CHAR_NUM.
• Between the last UART_AT_CMD_CHAR character received and the next non-UART_AT_CMD_CHAR, there
are at least UART_POST_IDLE_NUM APB clock cycles.
Figure 13-5 illustrates how the UART hardware flow control works. In hardware flow control, a high state of the
output signal rtsn_out signifies that a data transmission is requested, while a low state of the same signal notifies
the counterpart to stop data transmission until rtsn_out is pulled high again. There are two ways for a transmitter
to realize hardware flow control:
If the UART controller detects an edge on ctsn_in, it will generate interrupt UART_CTS_CHG_INT and will stop
transmitting data, once the current data transmission is completed.
The high level of the output signal dtrn_out signifies that the transmitter has finished data preparation. UART
controller will generate interrupt UART_DSR_CHG_INT, after it detects an edge on the input signal dsrn_in. After
the software detects the above-mentioned interrupt, the input signal level of dsrn_in can be figured out by reading
UART_DSRN. The software then decides whether it is able to receive data at that time or not.
Setting UART_LOOPBACK will enable the UART loopback detection function. In this mode, the output signal
txd_out of UART is connected to its input signal rxd_in, rtsn_out is connected to ctsn_in, and dtrn_out is connected
to dsrn_out. If the data transmitted corresponds to the data received, UART is able to transmit and receive data
normally.
UART can also control the software flow by transmitting special characters. Setting UART_SW_FLOW_CON_EN
will enable the software flow control function. If the number of data bytes that UART has received exceeds that of
the UART_XOFF threshold, the UART controller can send UART_XOFF_CHAR to instruct its counterpart to stop
data transmission.
When UART_SW_FLOW_CON_EN is 1, software can send flow control characters at any time. When UART_SEND
_XOFF is set, the transmitter will insert a UART_XOFF_CHAR and send it after the current data transmission is
completed. When UART_SEND_XON is set, the transmitter will insert a UART_XON_CHAR and send it after the
current data transmission is completed.
• UART_RS485_CLASH_INT: Triggered when a collision is detected between transmitter and receiver in RS-
485 mode.
• UART_TX_DONE_INT: Triggered when the transmitter has sent out all FIFO data.
• UART_TX_BRK_IDLE_DONE_INT: Triggered when the transmitter’s idle state has been kept to a minimum
after sending the last data.
• UART_TX_BRK_DONE_INT: Triggered when the transmitter completes sending NULL characters, after all
data in transmit-FIFO are sent.
• UART_SW_XOFF_INT: Triggered, if the receiver gets an Xon char when UART_SW_FLOW_CON_EN is set
to 1.
• UART_SW_XON_INT: Triggered, if the receiver gets an Xoff char when UART_SW_FLOW_CON_EN is set to
1.
• UART_RXFIFO_TOUT_INT: Triggered when the receiver takes more time than RX_TOUT_THRHD to receive
a byte.
• UART_BRK_DET_INT: Triggered when the receiver detects a 0 level after the STOP bit.
• UART_CTS_CHG_INT: Triggered when the receiver detects an edge change of the CTSn signal.
• UART_DSR_CHG_INT: Triggered when the receiver detects an edge change of the DSRn signal.
• UART_RXFIFO_OVF_INT: Triggered when the receiver gets more data than the FIFO can store.
• UART_PARITY_ERR_INT: Triggered when the receiver detects a parity error in the data.
• UART_TXFIFO_EMPTY_INT: Triggered when the amount of data in the transmit-FIFO is less than what
tx_mem_cnttxfifo_cnt specifies.
• UART_RXFIFO_FULL_INT: Triggered when the receiver gets more data than what (rx_flow_thrhd_h3, rx_flow_thrhd)
specifies.
• UHCI_SEND_S_REG_Q_INT: When using the single_send registers to send a series of short packets, this is
triggered when DMA has sent a short packet.
• UHCI_OUTLINK_EOF_ERR_INT: Triggered when there are some errors in EOF in the outlink descriptor.
• UHCI_IN_DSCR_EMPTY_INT: Triggered when there are not enough inlinks for DMA.
• UHCI_OUT_DSCR_ERR_INT: Triggered when there are some errors in the inlink descriptor.
• UHCI_IN_DSCR_ERR_INT: Triggered when there are some errors in the outlink descriptor.
• UHCI_IN_ERR_EOF_INT: Triggered when there are some errors in EOF in the inlink descriptor.
• UHCI_TX_HUNG_INT: Triggered when DMA takes much time to read data from RAM.
FIFO configuration
UART_FIFO_REG FIFO data register 0x3FF40000 0x3FF50000 0x3FF6E000 R/W
UART threshold and al-
UART_MEM_CONF_REG 0x3FF40058 0x3FF50058 0x3FF6E058 R/W
location configuration
Receive and transmit
UART_MEM_CNT_STATUS_REG 0x3FF40064 0x3FF50064 0x3FF6E064 RO
memory configuration
Interrupt registers
UART_INT_RAW_REG Raw interrupt status 0x3FF40004 0x3FF50004 0x3FF6E004 RO
Masked interrupt sta-
UART_INT_ST_REG 0x3FF40008 0x3FF50008 0x3FF6E008 RO
tus
UART_INT_ENA_REG Interrupt enable bits 0x3FF4000C 0x3FF5000C 0x3FF6E00C R/W
UART_INT_CLR_REG Interrupt clear bits 0x3FF40010 0x3FF50010 0x3FF6E010 WO
13.5 Registers
Register 13.1. UART_FIFO_REG (0x0)
T E
BY
D_
_R
FO
FI
RX
d)
ve
T_
er
R
s
UA
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
R X N IT _ AW AW
RT XF ON NT _R AW AW
W
RA
UA T_G _BR _ID _R R_I AW
UA T_T _DO AR ERR _R _R
RA W
R X _P _ NT INT
R W F _ T T
R X K NT R _R
R X H IN AW W
N
W
T_ A
UA _B IF _IN _R AW
UL _I W
_R IFO RR _R AW
I
UA T_R R_C G_ _R RA
IN _R
UA T_T _BR E_I Y_E INT
UA T_T 485 RM H_I T_
UA T_S _X DE E_I E_
_F TY RA
UA T_T RIT R_ INT W
R R O_ IN AW
XF _E _I AW
R R O_ T AW
L_ NT
R S _F S DE
R S H NT T_
RT XF Y_E INT _R
R W H_ N N
R T E UT W
R A ER F_ A
N
O P _
UA T_S ITC _DO _DO
UA T_P M_ OV T_R
UA T_D S_C T_I _IN
IF M NT
UA T_R 485 LA R_
R S _C HA
T
UA T_R 485 _C
R S D
O
UA _R CM
RT T_
)
ed
UA T_A
rv
se
R
UA
(re
31 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
UART_RS485_CLASH_INT_RAW The raw interrupt status bit for the UART_RS485_CLASH_INT in-
terrupt. (RO)
UART_TX_DONE_INT_RAW The raw interrupt status bit for the UART_TX_DONE_INT interrupt. (RO)
UART_GLITCH_DET_INT_RAW The raw interrupt status bit for the UART_GLITCH_DET_INT inter-
rupt. (RO)
UART_SW_XOFF_INT_RAW The raw interrupt status bit for the UART_SW_XOFF_INT interrupt. (RO)
UART_SW_XON_INT_RAW The raw interrupt status bit for the UART_SW_XON_INT interrupt. (RO)
UART_RXFIFO_TOUT_INT_RAW The raw interrupt status bit for the UART_RXFIFO_TOUT_INT in-
terrupt. (RO)
UART_BRK_DET_INT_RAW The raw interrupt status bit for the UART_BRK_DET_INT interrupt. (RO)
UART_CTS_CHG_INT_RAW The raw interrupt status bit for the UART_CTS_CHG_INT interrupt. (RO)
UART_DSR_CHG_INT_RAW The raw interrupt status bit for the UART_DSR_CHG_INT interrupt.
(RO)
UART_RXFIFO_OVF_INT_RAW The raw interrupt status bit for the UART_RXFIFO_OVF_INT inter-
rupt. (RO)
UART_FRM_ERR_INT_RAW The raw interrupt status bit for the UART_FRM_ERR_INT interrupt. (RO)
UART_PARITY_ERR_INT_RAW The raw interrupt status bit for the UART_PARITY_ERR_INT inter-
rupt. (RO)
UART_RXFIFO_FULL_INT_RAW The raw interrupt status bit for the UART_RXFIFO_FULL_INT inter-
rupt. (RO)
R X ON NT _S T T
ST
UA T_T _DO AR ERR _ST _S
R W OF T_ NT INT
S
T_ T
_
I N _S
UA T_R R_C G_ _S ST
UA T_T _BR E_I Y_E INT
UA T_T 485 RM H_I T_
UA T_S _X DE E_I E_
ST
UA T_B FIF _IN _S T
_F TY ST
_R IFO RR _S T
L_ NT
R S _F S DE
R S H NT T_
R W H_ N N
RT XF Y_E INT _S
R
R X N IT _
R A E R F_ T
R R O_ IN T
O P _
XF _E _I T
R R O_ T T
UA _S TC DO DO
R X H INT T
UA T_P M_ OV T_S
UA T_D S_C T_I _IN
UA T_C K_D TO _ST
IF M NT
UA T_F FIF G_ _S
UL _I
UA T_R 485 LA R_
R S _C HA
R T E UT
N
UA T_R 485 _C
R S D
K
UA _R CM
RT T_
)
X
d
UA T_A
ve
er
R
s
UA
(re
31 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
UART_TX_DONE_INT_ST The masked interrupt status bit for the UART_TX_DONE_INT interrupt.
(RO)
UART_GLITCH_DET_INT_ST The masked interrupt status bit for the UART_GLITCH_DET_INT inter-
rupt. (RO)
UART_SW_XOFF_INT_ST The masked interrupt status bit for the UART_SW_XOFF_INT interrupt.
(RO)
UART_SW_XON_INT_ST The masked interrupt status bit for the UART_SW_XON_INT interrupt. (RO)
UART_BRK_DET_INT_ST The masked interrupt status bit for the UART_BRK_DET_INT interrupt.
(RO)
UART_CTS_CHG_INT_ST The masked interrupt status bit for the UART_CTS_CHG_INT interrupt.
(RO)
UART_DSR_CHG_INT_ST The masked interrupt status bit for the UART_DSR_CHG_INT interrupt.
(RO)
UART_RXFIFO_OVF_INT_ST The masked interrupt status bit for the UART_RXFIFO_OVF_INT inter-
rupt. (RO)
UART_FRM_ERR_INT_ST The masked interrupt status bit for the UART_FRM_ERR_INT interrupt.
(RO)
UART_PARITY_ERR_INT_ST The masked interrupt status bit for the UART_PARITY_ERR_INT inter-
rupt. (RO)
R X N IT _ A NA
RT XF ON NT _E NA NA
A
EN
UA T_T _DO AR ERR _EN _E
R W F _ T T
EN A
R X K NT R _E
R X H IN NA A
T_ N
A
UA _B IF _IN _E NA
I
UA T_R R_C G_ _E EN
UL _I A
_R IFO RR _E NA
IN _E
UA T_T _BR E_I Y_E INT
UA T_T 485 RM H_I T_
UA T_S _X DE E_I E_
_F TY EN
UA T_T RIT R_ INT A
R R O_ IN NA
XF _E _I NA
L_ NT
R R O_ T NA
R S _F S DE
R S H NT T_
R W H_ N N
RT XF Y_E INT _E
R T E UT A
R A ER F_ N
N
O P _
UA T_S ITC _DO _DO
UA T_P M_ OV T_E
IF M NT
UA T_F FIF G_ T_E
UA T_R 485 LA R_
R S _C HA
T
UA T_R 485 _C
R S D
O
UA _R CM
RT T_
d)
UA T_A
ve
er
R
s
UA
(re
31 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
UART_TX_DONE_INT_ENA The interrupt enable bit for the UART_TX_DONE_INT interrupt. (R/W)
UART_SW_XOFF_INT_ENA The interrupt enable bit for the UART_SW_XOFF_INT interrupt. (R/W)
UART_SW_XON_INT_ENA The interrupt enable bit for the UART_SW_XON_INT interrupt. (R/W)
UART_BRK_DET_INT_ENA The interrupt enable bit for the UART_BRK_DET_INT interrupt. (R/W)
UART_CTS_CHG_INT_ENA The interrupt enable bit for the UART_CTS_CHG_INT interrupt. (R/W)
UART_DSR_CHG_INT_ENA The interrupt enable bit for the UART_DSR_CHG_INT interrupt. (R/W)
UART_FRM_ERR_INT_ENA The interrupt enable bit for the UART_FRM_ERR_INT interrupt. (R/W)
R X N IT _ LR LR
RT XF ON NT _C LR LR
R
CL
UA T_T _DO AR ERR _C _C
R W F _ T T
T_ LR
R X K NT R _C
R X H INT LR R
R
UA _B IF _IN _C LR
I
IN _C
UL _I LR
UA T_R R_C G_ _C CL
_R IFO RR _C LR
UA T_T _BR E_I Y_E INT
UA T_T 485 RM H_I T_
UA T_S _X DE E_I E_
CL
R A ER F_ LR
R R O_ IN LR
L_ NT
_F TY C
XF _E _I LR
RT XF Y_E INT _C
R S _ F S DE
R R O _ T LR
R S H NT T_
R W H_ N N
R T E UT R
N
O P _
UA T_S ITC _DO _DO
UA T_P M_ OV T_C
UA T_C K_D TO _CL
UA T_D S_C T_I _IN
UA T_F FIF G_ _C
IF M NT
UA T_T RIT R_ INT
UA T_R 485 LA R_
R S _C HA
T
UA T_R 485 _C
R S D
O
UA _R CM
RT T_
d)
UA T_A
ve
er
R
s
UA
(re
31 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
UART_RXFIFO_FULL_INT_CLR Set this bit to clear the UART_RXFIFO_FULL_INT interrupt. This bit
can be set only when data in Rx_FIFO is less than UART_RXFIFO_FULL_THRHD. (WO)
AG
FR
_
IV
V
DI
D
LK
LK
)
ed
_C
_C
rv
RT
RT
se
UA
UA
(re
31 24 23 20 19 0
N
_E
ILT
UD
_F
BA
CH
O
T
UT
LI
)
)
d
ed
_G
_A
ve
rv
RT
RT
er
se
s
UA
UA
(re
(re
31 16 15 8 7 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x010 0 0 0 0 0 0 0 0 Reset
UART_GLITCH_FILT When the input pulse width is lower than this value, the pulse is ignored. This
register is used in the autobauding process. (R/W)
UT
UT
NT
N T
O
O
_C
_C
X_
X_
O
O
UR
UT
rv RN
rv RN
(re T_D SN
(re T_D SN
IF
IF
RT XD
UA T_R D
F
T_
T_
XF
se S
R T
se T
RX
R T
)
R X
ed
ed
UA _C
UA T_R
_S
_S
UA T_T
_T
T_
RT
RT
RT
R
R
UA
UA
UA
UA
UA
UA
31 30 29 28 27 24 23 16 15 14 13 12 11 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
UART_TXD This bit represents the level of the internal UART RxD signal. (RO)
UART_RTSN This bit corresponds to the level of the internal UART CTS signal. (RO)
UART_DTRN This bit corresponds to the level of the internal UAR DSR signal. (RO)
UART_ST_UTX_OUT This register stores the state of the transmitter’s finite state machine. 0:
TX_IDLE; 1: TX_STRT; 2: TX_DAT0; 3: TX_DAT1; 4: TX_DAT2; 5: TX_DAT3; 6: TX_DAT4; 7:
TX_DAT5; 8: TX_DAT6; 9: TX_DAT7; 10: TX_PRTY; 11: TX_STP1; 12: TX_STP2; 13: TX_DL0;
14: TX_DL1. (RO)
UART_TXFIFO_CNT (tx_mem_cnt, txfifo_cnt) stores the number of bytes of valid data in transmit-
FIFO. tx_mem_cnt stores the three most significant bits, txfifo_cnt stores the eight least significant
bits. (RO)
UART_RXD This bit corresponds to the level of the internal UART RxD signal. (RO)
UART_CTSN This bit corresponds to the level of the internal UART CTS signal. (RO)
UART_DSRN This bit corresponds to the level of the internal UAR DSR signal. (RO)
UART_ST_URX_OUT This register stores the value of the receiver’s finite state machine. 0: RX_IDLE;
1: RX_STRT; 2: RX_DAT0; 3: RX_DAT1; 4: RX_DAT2; 5: RX_DAT3; 6: RX_DAT4; 7: RX_DAT5; 8:
RX_DAT6; 9: RX_DAT7; 10: RX_PRTY; 11: RX_STP1; 12:RX_STP2; 13: RX_DL1. (RO)
UART_RXFIFO_CNT (rx_mem_cnt, rxfifo_cnt) stores the number of bytes of valid data in the receive-
FIFO. rx_mem_cnt register stores the three most significant bits, rxfifo_cnt stores the eight least
significant bits. (RO)
N
O
S_
AY
M
W
NU
R RD BA N
AL
R RD TX V
R RD W V
R X EN T
UA T_T A_ _EN
R RD O_ T
UA T_I OP _E
UA T_I A_ CTL
UA T_I A_ _IN
UA T_I A_ CK
UA T_I A_ _IN
UA T_S D_B LX
UA T_T A_ RS
IT EN
T_
UA T_I FIF RS
F_
R O OW
RT W RK
M
R X DP
R T NV
R X NV
BI
R RD RX
UA SW TR
RT TS NV
R X NV
_S TS
RE
R X NV
R S NV
R RD TX
AR _
R X _
NU
_P ITY
Y
UA T_R FIFO
P_
_ _D
UA T_C R_I
UA T_L _FL
RT _R
UA T_T D_I
K_
UA _R _I
UA T_R S_I
UA _T _I
UA T_D D_I
_
TO
RT TR
RT AR
IC
IT
d)
d)
UA T_D
_B
UA _P
T
ve
ve
T_
RT
RT
er
er
R
R
s
s
UA
UA
UA
UA
(re
(re
31 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 3 0 0 Reset
UART_TICK_REF_ALWAYS_ON This register is used to select the clock; 1: APB clock; 0: REF_TICK.
(R/W)
UART_DTR_INV Set this bit to invert the level of the UART DTR signal. (R/W)
UART_RTS_INV Set this bit to invert the level of the UART RTS signal. (R/W)
UART_TXD_INV Set this bit to invert the level of the UART TxD signal. (R/W)
UART_DSR_INV Set this bit to invert the level of the UART DSR signal. (R/W)
UART_CTS_INV Set this bit to invert the level of the UART CTS signal. (R/W)
UART_RXD_INV Set this bit to invert the level of the UART Rxd signal. (R/W)
UART_TXFIFO_RST Set this bit to reset the UART transmit-FIFO. NOTICE: UART2 doesn’t have any
register to reset Tx_FIFO or Rx_FIFO, and the UART1_TXFIFO_RST and UART1_RXFIFO_RST in
UART1 may impact the functioning of UART2. Therefore, these two registers in UART1 should
only be used when the Tx_FIFO and Rx_FIFO in UART2 do not have any data. (R/W)
UART_RXFIFO_RST Set this bit to reset the UART receive-FIFO. NOTICE: UART2 doesn’t have any
register to reset Tx_FIFO or Rx_FIFO, and the UART1_TXFIFO_RST and UART1_RXFIFO_RST in
UART1 may impact the functioning of UART2. Therefore, these two registers in UART1 should
only be used when the Tx_FIFO and Rx_FIFO in UART2 do not have any data. (R/W)
UART_TX_FLOW_EN Set this bit to enable the flow control function for the transmitter. (R/W)
UART_LOOPBACK Set this bit to enable the UART loopback test mode. (R/W)
UART_IRDA_RX_INV Set this bit to invert the level of the IrDA receiver. (R/W)
UART_IRDA_TX_INV Set this bit to invert the level of the IrDA transmitter. (R/W)
UART_IRDA_WCTL 1: The IrDA transmitter’s 11th bit is the same as its 10th bit; 0: set IrDA trans-
mitter’s 11th bit to 0. (R/W)
UART_IRDA_TX_EN This is the start enable bit of the IrDA transmitter. (R/W)
UART_IRDA_DPLX Set this bit to enable the IrDA loopback mode. (R/W)
UART_TXD_BRK Set this bit to enable the transmitter to send NULL, when the process of sending
data is completed. (R/W)
UART_SW_DTR This register is used to configure the software DTR signal used in software flow
control. (R/W)
UART_SW_RTS This register is used to configure the software RTS signal used in software flow con-
trol. (R/W)
UART_STOP_BIT_NUM This register is used to set the length of the stop bit; 1: 1 bit, 2: 1.5 bits.
(R/W)
UART_BIT_NUM This register is used to set the length of data; 0: 5 bits, 1: 6 bits, 2: 7 bits, 3: 8
bits. (R/W)
UART_PARITY_EN Set this bit to enable the UART parity check. (R/W)
UART_PARITY This register is used to configure the parity check mode; 0: even, 1: odd. (R/W)
D
RH
HD
TH
HR
HD
HD
Y_
_T
HR
HR
PT
N
N
L
_E
UL
_T
_E
_T
M
W
_F
UT
UT
_E
O
LO
O
FO
TO
TO
FL
F
_F
FI
FI
X_
X_
X_
RX
RX
d)
)
TX
ed
_R
_R
_R
ve
T_
T_
T_
rv
RT
RT
RT
er
se
R
R
s
UA
UA
UA
UA
UA
UA
(re
(re
31 30 24 23 22 16 15 14 8 7 6 0
UART_RX_TOUT_EN This is the enable bit for the UART receive-timeout function. (R/W)
UART_RX_TOUT_THRHD This register is used to configure the UART receiver’s timeout value when
receiving a byte. When using APB_CLK as the clock source, the register counts by UART baud
cycle multiplied by 8. When using REF_TICK as the clock source, the register counts by
UART baud cycle * 8 * (REF_TICK frequency)/(APB_CLK frequency). (R/W)
UART_RX_FLOW_EN This is the flow enable bit of the UART receiver; 1: choose software flow control
by configuring the sw_rts signal; 0: disable software flow control. (R/W)
UART_RX_FLOW_THRHD When the receiver gets more data than its threshold value, the receiver
produces a signal that tells the transmitter to stop transferring data. The threshold value is
(rx_flow_thrhd_h3, rx_flow_thrhd). (R/W)
UART_TXFIFO_EMPTY_THRHD When the data amount in transmit-FIFO is less than its thresh-
old value, it will produce a TXFIFO_EMPTY_INT_RAW interrupt. The threshold value is
(tx_mem_empty_thrhd, txfifo_empty_thrhd). (R/W)
UART_RXFIFO_FULL_THRHD When the receiver gets more data than its threshold value, the re-
ceiver will produce an RXFIFO_FULL_INT_RAW interrupt. The threshold value is (rx_flow_thrhd_h3,
rxfifo_full_thrhd). (R/W)
_L
rv
RT
se
UA
(re
31 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0x0FFFFF Reset
UART_LOWPULSE_MIN_CNT This register stores the value of the minimum duration of the low-level
pulse. It is used in the baud rate detection process. (RO)
NT
_C
IN
M
E_
S
UL
HP
IG
d)
_H
ve
RT
er
s
UA
(re
31 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0x0FFFFF Reset
UART_HIGHPULSE_MIN_CNT This register stores the value of the minimum duration of the high
level pulse. It is used in baud rate detection process. (RO)
T
CN
E_
DG
_E
XD
)
ed
_R
rv
RT
se
UA
(re
31 10 9 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x000 Reset
UART_RXD_EDGE_CNT This register stores the count of the RxD edge change. It is used in the
baud rate detection process. (RO)
EN
N_
O
LO EL
RT ON E_X FF
_C
_S O ON
R O _X F
UA T_F RC ON
UA T_X RC XO
_F _D
UA T_F ND OF
W
W FF
R O E_
R E _X
UA T_S ND
R E
)
ed
UA T_S
rv
se
R
UA
(re
31 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
UART_FORCE_XOFF Set this bit to set the internal CTSn and stop the transmitter from sending data.
(R/W)
UART_FORCE_XON Set this bit to clear the internal CTSn and enable the transmitter to continue
sending data. (R/W)
UART_XONOFF_DEL Set this bit to remove the flow-control char from the received data. (R/W)
UART_SW_FLOW_CON_EN Set this bit to enable software flow control. It is used with register
sw_xon or sw_xoff. (R/W)
LD
HO
ES
HR
_T
VE
TI
AC
d)
ve
T_
r
se
R
UA
(re
31 10 9 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0F0 Reset
UART_ACTIVE_THRESHOLD When the number of positive edges of RxD signal is larger than or
equal to (UART_ACTIVE_THRESHOLD+2), the system emerges from Light-sleep mode and be-
comes active. (R/W)
LD
LD
O
HO
SH
S
AR
E
R
RE
HR
A
H
CH
TH
_C
_T
N_
N_
FF
FF
O
XO
X
_X
_X
T_
T_
RT
RT
R
R
UA
UA
UA
UA
31 24 23 16 15 8 7 0
UART_XOFF_CHAR This register stores the Xoff flow control char. (R/W)
UART_XON_CHAR This register stores the Xon flow control char. (R/W)
UART_XOFF_THRESHOLD When the data amount in receive-FIFO is more than what this register
indicates, it will send an Xoff char, with uart_sw_flow_con_en set to 1. (R/W)
UART_XON_THRESHOLD When the data amount in receive-FIFO is less than what this register in-
dicates, it will send an Xon char, with uart_sw_flow_con_en set to 1. (R/W)
HD
M
M
HR
NU
NU
_T
E_
K_
LE
DL
BR
ID
I
X_
X_
X_
d)
_R
_T
_T
ve
RT
RT
RT
r
se
UA
UA
UA
(re
31 28 27 20 19 10 9 0
UART_TX_BRK_NUM This register is used to configure the number of zeros (0) sent, after the process
of sending data is completed. It is active when txd_brk is set to 1. (R/W)
UART_TX_IDLE_NUM This register is used to configure the duration between transfers. (R/W)
UART_RX_IDLE_THRHD When the receiver takes more time to receive Byte data than what this
register indicates, it will produce a frame-end signal. (R/W)
RT L0 N X_ EN
R L TX _ NU
NU
EN
UA T_D 485 XBY Y_
Y_
R S R DL
DL
UA _R 85 X_
X_
N
RT S4 _R
_E
_T
S4 N
85
UA _R 85
85
_R _E
S4
RT S4
d)
_R
UA _R
ve
RT
RT
r
se
UA
UA
(re
31 10 9 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
UART_RS485_TX_DLY_NUM This register is used to delay the transmitter’s internal data signal.
(R/W)
UART_RS485_RX_DLY_NUM This register is used to delay the receiver’s internal data signal. (R/W)
UART_RS485RXBY_TX_EN 1: enable the RS-485 transmitter to send data, when the RS-485 re-
ceiver line is busy; 0: the RS-485 transmitter should not send data, when its receiver is busy.
(R/W)
UART_RS485TX_RX_EN Set this bit to enable the transmitter’s output signal loop back to the re-
ceiver’s input signal. (R/W)
UART_DL1_EN Set this bit to delay the STOP bit by 1 bit. (R/W)
UART_DL0_EN Set this bit to delay the STOP bit by 1 bit after DL1. (R/W)
_P
rv
RT
se
UA
(re
31 24 23 0
0 0 0 0 0 0 0 0 0x0186A00 Reset
UART_PRE_IDLE_NUM This register is used to configure the idle-time duration before the first
at_cmd is received by the receiver. When the duration is less than what this register indicates,
it will not take the next data received as an at_cmd char. (R/W)
UM
_N
E
DL
_I
ST
O
)
ed
_P
rv
RT
se
UA
(re
31 24 23 0
0 0 0 0 0 0 0 0 0x0186A00 Reset
UART_POST_IDLE_NUM This register is used to configure the duration between the last at_cmd
and the next data. When the duration is less than what this register indicates, it will not take the
previous data as an at_cmd char. (R/W)
UT
O
_T
AP
G
X_
)
d
_R
ve
RT
er
s
UA
(re
31 24 23 0
0 0 0 0 0 0 0 0 0x0001E00 Reset
UART_RX_GAP_TOUT This register is used to configure the interval between the at_cmd chars.
When the interval is greater than the value of this register, it will not take the data as continuous
at_cmd chars. The register should be configured to more than half of the baud rate. (R/W)
D_
R_
CM
HA
T_
)
ed
_C
_A
rv
RT
RT
se
UA
UA
(re
31 16 15 8 7 0
UART_CHAR_NUM This register is used to configure the number of continuous at_cmd chars re-
ceived by the receiver. (R/W)
UART_AT_CMD_CHAR This register is used to configure the content of an at_cmd char. (R/W)
D
RH
3
RH
_H
H3
_H
_H
TH
LD
D_
TH
LD
HD
Y_
HO
RH
_
HO
PT
HR
LL
H
M
_T
RE
_T
_F
RE
_E
W
UT
TH
D
EM
EM
TH
ZE
E
LO
_P
IZ
TO
_
I
M
N_
M
FF
_S
_F
EM
X_
X_
X_
X_
O
XO
RX
RX
d)
UA d)
ed
_M
_R
_R
_X
_T
_T
ve
e
T_
T_
T_
rv
rv
RT
RT
RT
RT
RT
RT
er
se
se
R
R
s
UA
UA
UA
UA
UA
UA
UA
UA
(re
(re
(re
31 30 28 27 25 24 23 22 21 20 18 17 15 14 11 10 7 6 3 2 1 0
UART_TX_SIZE This register is used to configure the amount of memory allocated to the transmit-
FIFO. The default number is 128 bytes. (R/W)
UART_RX_SIZE This register is used to configure the amount of memory allocated to the receive-
FIFO. The default number is 128 bytes. (R/W)
UART_MEM_PD Set this bit to power down the memory. When the reg_mem_pd register is set to 1
for all UART controllers, Memory will enter the low-power mode. (R/W)
NT
NT
_C
_C
EM
EM
M
M
X_
X_
d)
_R
_T
ve
RT
RT
r
se
UA
UA
(re
31 6 5 3 2 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
NT
_C
IN
M
E_
DG
SE
O
d)
_P
ve
RT
er
s
UA
(re
31 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0x0FFFFF Reset
UART_POSEDGE_MIN_CNT This register stores the count of RxD positive edges. It is used in the
autobaud detection process. (RO)
T
CN
_
IN
M
E_
G
ED
EG
d)
_N
e
rv
RT
se
UA
(re
31 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0x0FFFFF Reset
UART_NEGEDGE_MIN_CNT This register stores the count of RxD negative edges. It is used in the
autobaud detection process. (RO)
EP EN N EN
C R ID N N
_S D_ _E F_
UH I_C T_ _E _E
CI EA EC EO
C AR OF RC
_U T1 E
T0 E
E
CI AR _C
AR _C
_C
_E
C EN E
UH I_L OD
ER
UH I_U T2
C NC
C AR
d)
)
ed
ed
UH I_U
ve
UH I_E
rv
rv
er
se
se
C
C
s
UH
UH
(re
(re
(re
31 22 21 20 19 18 17 16 15 12 11 10 9 8 0
0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
UHCI_SEPER_EN Set this bit to use a special char and separate the data frame. (R/W)
UHCI_UART2_CE Set this bit to use UART2 and transmit or receive data. (R/W)
UHCI_UART1_CE Set this bit to use UART1 and transmit or receive data. (R/W)
UHCI_UART0_CE Set this bit to use UART and transmit or receive data. (R/W)
C U O RR IN RA W
UH I_O T_E _E RR_ T_ RA
UH I_IN T_D F_IN _IN T_ W
UH I_O DSC CR_ TY _IN W
C _ O T T_ RA
C _ _ _IN W W
UH I_T HU _I RA AW
UH I_R HU _IN INT AW
UH I_IN T_D _E _ER T_
UH I_T DO EO INT W
W
T_ W
AR IN AW
C U R OF _IN
X_ AR INT AW
C _ _ F_ RA
C X_ NG T_ _R
C X_ NE F_ _R
CI X_S NG NT_ W
RA
IN A
UH I_O DSC _E OF
T_ T_R
ST T_ _R
UH I_IN SUC EO T_
_R T _ R
C _ K _E
UH I_IN TLIN TAL
C U O
UH _O _T
CI UT
d)
UH I_O
ve
er
C
s
UH
31 (re 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
UHCI_IN_DSCR_ERR_INT_RAW The raw interrupt status bit for the UHCI_IN_DSCR_ERR_INT in-
terrupt. (RO)
UHCI_OUT_EOF_INT_RAW The raw interrupt status bit for the UHCI_OUT_EOF_INT interrupt. (RO)
UHCI_OUT_DONE_INT_RAW The raw interrupt status bit for the UHCI_OUT_DONE_INT interrupt.
(RO)
UHCI_IN_ERR_EOF_INT_RAW The raw interrupt status bit for the UHCI_IN_ERR_EOF_INT interrupt.
(RO)
UHCI_IN_SUC_EOF_INT_RAW The raw interrupt status bit for the UHCI_IN_SUC_EOF_INT inter-
rupt. (RO)
UHCI_IN_DONE_INT_RAW The raw interrupt status bit for the UHCI_IN_DONE_INT interrupt. (RO)
UHCI_TX_HUNG_INT_RAW The raw interrupt status bit for the UHCI_TX_HUNG_INT interrupt. (RO)
UHCI_RX_HUNG_INT_RAW The raw interrupt status bit for the UHCI_RX_HUNG_INT interrupt. (RO)
UHCI_TX_START_INT_RAW The raw interrupt status bit for the UHCI_TX_START_INT interrupt. (RO)
UHCI_RX_START_INT_RAW The raw interrupt status bit for the UHCI_RX_START_INT interrupt.
(RO)
C _ K _E IN T _ST
UH I_IN TLIN TAL _Q_ T_S INT
C _ O T T_ ST
C U R OF _IN T
C U O G IN _
UH I_O T_T RE _Q_ WM
UH I_T HU _I ST T
UH I_R HU _IN INT T
C X_ NG T_ _S
C U S_ G L_
C _ _ F_ ST
C X_ NE F_ _S
ST
IN T
AR IN T
X_ AR INT T
UH I_O D_ RE UL
T_ T_S
UH I_T DO EO INT
UH I_IN SUC EO T_
ST T_ _S
_R T _ S
T_
CI X_S NG NT_
C EN A_ _F
C _ _ _IN
UH I_S D_ IFO
C EN NF
UH _S _I
CI MA
)
ed
UH I_D
rv
se
C
UH
(re
31 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
UHCI_IN_DSCR_ERR_INT_ST The masked interrupt status bit for the UHCI_IN_DSCR_ERR_INT in-
terrupt. (RO)
UHCI_OUT_EOF_INT_ST The masked interrupt status bit for the UHCI_OUT_EOF_INT interrupt.
(RO)
UHCI_OUT_DONE_INT_ST The masked interrupt status bit for the UHCI_OUT_DONE_INT interrupt.
(RO)
UHCI_IN_ERR_EOF_INT_ST The masked interrupt status bit for the UHCI_IN_ERR_EOF_INT inter-
rupt. (RO)
UHCI_IN_SUC_EOF_INT_ST The masked interrupt status bit for the UHCI_IN_SUC_EOF_INT inter-
rupt. (RO)
UHCI_IN_DONE_INT_ST The masked interrupt status bit for the UHCI_IN_DONE_INT interrupt. (RO)
UHCI_TX_HUNG_INT_ST The masked interrupt status bit for the UHCI_TX_HUNG_INT interrupt.
(RO)
UHCI_RX_HUNG_INT_ST The masked interrupt status bit for the UHCI_RX_HUNG_INT interrupt.
(RO)
UHCI_TX_START_INT_ST The masked interrupt status bit for the UHCI_TX_START_INT interrupt.
(RO)
UHCI_RX_START_INT_ST The masked interrupt status bit for the UHCI_RX_START_INT interrupt.
(RO)
C U O RR IN EN A
UH I_O T_E _E RR_ T_ EN
UH I_IN TLIN TAL _Q_ T_E INT
C _ O T T_ EN
C U R OF _IN N
C U O G IN _
C _ _ _IN A A
UH I_O T_T RE _Q_ WM
UH I_T HU _I EN NA
UH I_R HU _IN INT NA
UH I_T DO EO INT A
A
T_ A
C _ _ F_ EN
AR IN NA
C U S_ G L_
C X_ NG T_ _E
X_ AR INT NA
C X_ NE F_ _E
CI X_S NG NT_ A
EN
IN N
UH I_O D_ RE UL
UH I_IN SUC EO T_
T_ T_E
ST T_ _E
_R T _ E
C EN A_ _F
UH I_S D_ IFO
C EN NF
UH _S _I
CI MA
)
ed
UH I_D
rv
se
C
UH
(re
31 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
UHCI_OUT_EOF_INT_ENA The interrupt enable bit for the UHCI_OUT_EOF_INT interrupt. (R/W)
UHCI_OUT_DONE_INT_ENA The interrupt enable bit for the UHCI_OUT_DONE_INT interrupt. (R/W)
UHCI_IN_DONE_INT_ENA The interrupt enable bit for the UHCI_IN_DONE_INT interrupt. (R/W)
UHCI_TX_HUNG_INT_ENA The interrupt enable bit for the UHCI_TX_HUNG_INT interrupt. (R/W)
UHCI_RX_HUNG_INT_ENA The interrupt enable bit for the UHCI_RX_HUNG_INT interrupt. (R/W)
UHCI_TX_START_INT_ENA The interrupt enable bit for the UHCI_TX_START_INT interrupt. (R/W)
UHCI_RX_START_INT_ENA The interrupt enable bit for the UHCI_RX_START_INT interrupt. (R/W)
C U O RR IN CL R
UH I_IN TLIN TAL _Q_ T_C INT
C _ O T T_ CL
C U R OF _IN L
C U O G IN _
C _ _ _IN R R
UH I_O T_T RE _Q_ WM
UH I_T HU _I CL LR
UH I_R HU _IN INT LR
UH I_T DO EO INT R
R
C X_ NG T_ _C
IN LR
AR IN LR
C _ _ F_ CL
C X_ NE F_ _C
C U S_ G L_
X_ AR INT LR
CI X_S NG NT_ R
CL
UH I_O D_ RE UL
T_ T_C
ST T_ _C
UH I_IN SUC EO T_
_R T _ C
T_
C EN A_ _F
UH I_S D_ IFO
C EN NF
UH I_S A_I
C M
)
ed
UH I_D
rv
se
C
UH
(re
31 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
_F PTY
L
UL
UT M
_O _E
CI UT
)
ed
UH I_O
rv
se
C
UH
(re
31 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 Reset
TA
SH
DA
U
_W
_P
O
FO
F
FI
FI
UT
UT
)
)
d
ed
_O
_O
ve
rv
r
CI
CI
se
se
UH
UH
(re
(re
31 17 16 15 9 8 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x000 Reset
UHCI_OUTFIFO_PUSH Set this bit to push data into DMA FIFO. (R/W)
UHCI_OUTFIFO_WDATA This is the data that need to be pushed into DMA FIFO. (R/W)
D
_R
_P
O
FO
IF
FI
NF
)
d)
d
N
ve
e
_I
_I
rv
r
CI
CI
se
se
UH
UH
(re
(re
31 17 16 15 12 11 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0000 Reset
UHCI_INFIFO_POP Set this bit to pop data from DMA FIFO. (R/W)
UHCI_INFIFO_RDATA This register stores the data popping from DMA FIFO. (RO)
NK TA RT
LI _S TA
_S RT
DR
P
CI UT K_ RK
TO
UT NK ES
D
UH I_O TLIN _PA
_O LI R
_A
C U K
NK
UH I_O TLIN
LI
UT
C U
)
ed
UH I_O
O
rv
_
CI
se
C
UH
UH
(re
31 30 29 28 27 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0x000000 Reset
UHCI_OUTLINK_PARK 1: the outlink descriptor’s FSM is in idle state; 0: the outlink descriptor’s FSM
is working. (RO)
UHCI_OUTLINK_RESTART Set this bit to restart the outlink descriptor from the last address. (R/W)
UHCI_OUTLINK_STOP Set this bit to stop dealing with the outlink descriptor. (R/W)
UHCI_OUTLINK_ADDR This register stores the least significant 20 bits of the first outlink descriptor’s
address. (R/W)
DR
P
CI LIN _R K
NL K_ ST
O
UH _IN K R
AD
E
CI LIN _PA
K_
UH I_IN INK
IN
C L
NL
d)
UH _IN
ve
_I
_I
r
CI
CI
se
UH
UH
(re
31 30 29 28 27 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0x000000 Reset
UHCI_INLINK_PARK 1: the inlink descriptor’s FSM is in idle state; 0: the inlink descriptor’s FSM is
working. (RO)
UHCI_INLINK_START Set this bit to start dealing with the inlink descriptors. (R/W)
UHCI_INLINK_STOP Set this bit to stop dealing with the inlink descriptors. (R/W)
UHCI_INLINK_ADDR This register stores the 20 least significant bits of the first inlink descriptor’s
address. (R/W)
E
_R
_S RE
N
UM
UM N
_E
_S _E
ed ECK M_
CK EQ
U
CH N
S
X_ K_
HE K_
_T C
_C C
CI X_A
CI HE
)
)
ed
UH I_C
UH I_T
rv
rv
se
se
C
C
UH
UH
(re
(re
31 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 Reset
31 0
0x000000000 Reset
31 0
0x000000000 Reset
31 0
0x000000000 Reset
31 0
0x000000000 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
UH I_T 13_ SC N
UH I_T 11_ SC_ N
SC N
N
UH I_R DB SC N
UH I_T C0 SC N
CI X_D ES EN
C0 SC N
C X_ _E _E
C X_ E _E
_E _E
_E
C X_ _E _E
C X_ _E _E
X_ _E _E
UH I_R 11 SC
_T B C
C X_ _E
UH I_R 13
C X_
d)
UH I_R
ve
er
C
s
UH
(re
31 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 Reset
UHCI_RX_13_ESC_EN Set this bit to enable replacing flow control char 0x13, when DMA sends data.
(R/W)
UHCI_RX_11_ESC_EN Set this bit to enable replacing flow control char 0x11, when DMA sends data.
(R/W)
UHCI_RX_DB_ESC_EN Set this bit to enable replacing 0xdb char, when DMA sends data. (R/W)
UHCI_RX_C0_ESC_EN Set this bit to enable replacing 0xc0 char, when DMA sends data. (R/W)
UHCI_TX_13_ESC_EN Set this bit to enable decoding flow control char 0x13, when DMA receives
data. (R/W)
UHCI_TX_11_ESC_EN Set this bit to enable decoding flow control char 0x11, when DMA receives
data. (R/W)
UHCI_TX_DB_ESC_EN Set this bit to enable decoding 0xdb char, when DMA receives data. (R/W)
UHCI_TX_C0_ESC_EN Set this bit to enable decoding 0xc0 char, when DMA receives data. (R/W)
FT
FT
NA
NA
HI
HI
_S
_E
_S
_E
UT
UT
UT
UT
UT
UT
EO
EO
EO
EO
EO
EO
IM
IM
IM
IM
IM
IM
_T
_T
_T
_T
_T
_T
FO
FO
FO
O
IF
IF
IF
FI
FI
FI
XF
XF
XF
)
RX
RX
X
ed
_R
_T
_T
_T
rv
_
CI
CI
CI
CI
CI
CI
se
UH
UH
UH
UH
UH
UH
(re
31 24 23 22 20 19 12 11 10 8 7 0
UHCI_RXFIFO_TIMEOUT_ENA This is the enable bit for DMA send-data timeout. (R/W)
UHCI_RXFIFO_TIMEOUT_SHIFT The tick count is cleared when its value is equal to or greater than
(17’d8000»reg_rxfifo_timeout_shift). (R/W)
UHCI_RXFIFO_TIMEOUT This register stores the timeout value. When DMA takes more time to read
data from RAM than what this register indicates, it will produce the UHCI_RX_HUNG_INT interrupt.
(R/W)
UHCI_TXFIFO_TIMEOUT_SHIFT The tick count is cleared when its value is equal to or greater than
(17’d8000»reg_txfifo_timeout_shift). (R/W)
UHCI_TXFIFO_TIMEOUT This register stores the timeout value. When DMA takes more time to
receive data than what this register indicates, it will produce the UHCI_TX_HUNG_INT interrupt.
(R/W)
R0
AR
HA
CH
C
2_
2_
2
EQ
EQ
Q
SE
_S
_S
C_
SC
SC
d)
ES
e
_E
_E
rv
_
CI
CI
CI
se
UH
UH
UH
(re
31 24 23 16 15 8 7 0
UHCI_ESC_SEQ2_CHAR1 This register stores the second char used to replace the reg_esc_seq2 in
data. (R/W)
UHCI_ESC_SEQ2_CHAR0 This register stores the first char used to replace the reg_esc_seq2 in
data. (R/W)
UHCI_ESC_SEQ2 This register stores the flow_control char to turn off the flow_control. (R/W)
14.1 Introduction
The LED_PWM controller is primarily designed to control the intensity of LEDs, although it can be used to generate
PWM signals for other purposes as well. It has 16 channels which can generate independent waveforms that can
be used to drive RGB LED devices. For maximum flexibility, the high-speed as well as the low-speed channels can
be driven from one of four high-speed/low-speed timers. The PWM controller also has the ability to automatically
increase or decrease the duty cycle gradually, allowing for fades without any processor interference. To increase
resolution, the LED_PWM controller is also able to dither between two values, when a fractional PWM value is
configured.
The LED_PWM controller has eight high-speed and eight low-speed PWM generators. In this document, they
will be referred to as hschn and lschn, respectively. These channels can be driven from four timers which will be
indicated by h_timerx and l_timerx.
14.2 Functional Description
14.2.1 Architecture
Figure 14-1 shows the architecture of the LED_PWM controller. As can be seen in the figure, the LED_PWM
controller contains eight high-speed and eight low-speed channels. There are four high-speed clock modules for
the high-speed channels, from which one h_timerx can be selected. There are also four low-speed clock modules
for the low-speed channels, from which one l_timerx can be selected.
Figure 14-2 illustrates a PWM channel with its selected timer; in this instance a high-speed channel and associated
high-speed timer.
14.2.2 Timers
A high-speed timer consists of a multiplexer to select one of two clock sources: either REF_TICK or APB_CLK.
For more information on the clock sources, please see Chapter Reset And Clock. The input clock is divided down
by a divider first. The division factor is specified by LEDC_CLK_DIV_NUM_HSTIMERx which contains a fixed point
number: the highest 10 bits represent the integer portion A, while the lowest eight bits contain the fractional portion
B. The effective division factor is as follows:
B
LEDC_CLK_DIV _N U M _HST IM ERx = A 256
Figure 14-3 shows the input/output clock when the fractional portion B is not 0. As shown in the firgure, the 256
output clocks consist of B output clocks as result of division by (A+1) divider and (256-B) output clocks as result
of division by A divider. The B output clocks are evenly distributed in the 256 output clocks.
The output clock of the divider is the base clock for the counter which will count up to the value specified in
LEDC_HSTIMERx_DUTY_RES. An overflow interrupt will be generated once the counting value reaches
2LEDC_HST IM ERx_DU T Y _RES − 1, at which point the counter restarts counting from 0. It is also possible to reset,
suspend, and read the values of the counter by software.
The output signal of the timer is the 20-bit value generated by the counter. The cycle period of this signal defines
the frequency of the signals of any PWM channels connected to this timer. This frequency depends on both the
division factor of the divider, as well as the range of the counter:
Table 14-1 lists the commonly-used frequencies and their corresponding resolutions.
The low-speed timers l_timerx on the low-speed channel differ from the high-speed timers h_timerx in two as-
pects:
1. Where the high-speed timer clock source can be clocked from REF_TICK or APB_CLK, the low-speed timers
are sourced from either REF_TICK or SLOW_CLOCK. The SLOW_CLOCK source can be either APB_CLK
(80 MHz) or 8 MHz, and can be selected using LEDC_APB_CLK_SEL.
2. The high-speed counter and divider are glitch-free, which means that if the software modifies the maximum
counter or divisor value, the update will come into effect after the next overflow interrupt. In contrast, the
low-speed counter and divider will update these values only when LEDC_LSTIMERx_PARA_UP is set.
14.2.3 Channels
A channel takes the 20-bit value from the counter of the selected high-speed timer and compares it to a set of two
values in order to set the channel output. The first value it is compared to is the content of LEDC_HPOINT_HSCHn;
if these two match, the output will be latched high. The second value is the sum of LEDC_HPOINT_HSCHn and
LEDC_DUTY_HSCHn[24..4]. When this value is reached, the output is latched low. By using these two values,
the relative phase and the duty cycle of the PWM output can be set. Figure 14-4 illustrates this.
LEDC_DUTY_HSCHn is a fixed-point register with four fractional bits. As mentioned before, when LEDC_DUTY_
HSCHn[24..4] is used in the PWM calculation directly, LEDC_DUTY_HSCHn[3..0] can be used to dither the output.
If this value is non-zero, with a statistical chance of LEDC_DUTY_HSCHn[3..0]/16, the actual PWM pulse will be
one cycle longer. This effectively increases the resolution of the PWM generator to 25 bits, but at the cost of a
slight jitter in the duty cycle.
The channels also have the ability to automatically fade from one duty cycle value to another. This feature is enabled
by setting LEDC_DUTY_START_HSCHn. When this bit is set, the PWM controller will automatically increment or
decrement the value in LEDC_DUTY_HSCHn, depending on whether the bit LEDC_DUTY_INC_HSCHn is set or
cleared, respectively. The speed the duty cycle changes is defined as such: every time the LEDC_DUTY_CYCLE_
HSCHn cycles, the content of LEDC_DUTY_SCALE_HSCHn is added to or subtracted from LEDC_DUTY_HSCHn[24..4].
The length of the fade can be limited by setting LEDC_DUTY_NUM_HSCHn: the fade will only last that number of
cycles before finishing. A finished fade also generates an interrupt.
Notes
• When LEDC is in fade mode, configure the second fade only after LEDC_DUTY_CHNG_END_HSCHn or
LEDC_DUTY_CHNG_END_LSCHn interrupt is generated.
• When LEDC is in decremental fade mode and LEDC_DUTY_HSCHn is 2LEDC_HST IM ERx_DU T Y _RES , LEDC_
DUTY_SCALE_HSCHn cannot be set to 1. When LEDC is in decremental fade mode and LEDC_DUTY_LSCHn
is 2LEDC_LST IM ERx_DU T Y _RES , LEDC_DUTY_SCALE_LSCHn cannot be set to 1.
14.2.4 Interrupts
• LEDC_DUTY_CHNG_END_LSCHn_INT: Triggered when a fade on a low-speed channel has finished.
• LEDC_HS_TIMERx_OVF_INT: Triggered when a high-speed timer has reached its maximum counter value.
• LEDC_LS_TIMERx_OVF_INT: Triggered when a low-speed timer has reached its maximum counter value.
14.4 Registers
Register 14.1. LEDC_HSCHn_CONF0_REG (n: 07) (0x1C+0x10*n)
_H Hn
Hn
C
_S _HS
SC
IM T_E Hn
U C
N
DC _O HS
EL
LE SIG LV_
ER
_ E_
DC DL
)
ed
_T
LE C_I
v
er
D
s
LE
(re
31 4 3 2 1 0
0x00000000 0 0 0 Reset
LEDC_IDLE_LV_HSCHn This bit is used to control the output value when high-speed channel n is
inactive. (R/W)
LEDC_SIG_OUT_EN_HSCHn This is the output enable control bit for high-speed channel n. (R/W)
LEDC_TIMER_SEL_HSCHn There are four high-speed timers. These two bits are used to select one
of them for high-speed channel n: (R/W)
0: select hstimer0;
1: select hstimer1;
2: select hstimer2;
3: select hstimer3.
C_
rv
se
D
LE
(re
31 20 19 0
LEDC_HPOINT_HSCHn The output value changes to high when htimerx(x=[0,3]), selected by high-
speed channel n, has reached LEDC_HPOINT_HSCHn[19:0]. (R/W)
n
CH
HS
Y_
UT
)
ed
_D
rv
DC
se
LE
(re
31 25 24 0
LEDC_DUTY_HSCHn The register is used to control output duty. When hstimerx(x=[0,3]), selected
by high-speed channel n, has reached LEDC_LPOINT_HSCHn, the output signal changes to low.
(R/W)
LEDC_LPOINT_HSCHn=LEDC_LPOINT_HSCHn[19:0]+LEDC_DUTY_HSCHn[24:4] (1)
LEDC_LPOINT_HSCHn=LEDC_LPOINT_HSCHn[19:0]+LEDC_DUTY_HSCHn[24:4] +1) (2)
See the Functional Description for more information on when (1) or (2) is chosen.
n
CH H n
CH
CH
n
HS SC
CH
n
HS
HS
C_ H
E_
E_
IN T_
_H
CL
AL
Y_ AR
M
NU
C
CY
UT ST
_S
_D TY_
Y_
TY
TY
UT
DC U
DU
DU
LE C_D
_D
C_
C_
DC
D
D
LE
LE
LE
LE
31 30 29 20 19 10 9 0
LEDC_DUTY_INC_HSCHn This register is used to increase or decrease the duty of output signal for
high-speed channel n. (R/W)
LEDC_DUTY_NUM_HSCHn This register is used to control the number of times the duty cycle is
increased or decreased for high-speed channel n. (R/W)
LEDC_DUTY_CYCLE_HSCHn This register is used to increase or decrease the duty cycle every time
LEDC_DUTY_CYCLE_HSCHn cycles for high-speed channel n. (R/W)
LEDC_DUTY_SCALE_HSCHn This register is used to increase or decrease the step scale for high-
speed channel n. (R/W)
n_R
CH
HS
Y_
UT
)
ed
_D
rv
DC
se
LE
(re
31 25 24 0
LEDC_DUTY_HSCHn_R This register represents the current duty cycle of the output signal for high-
speed channel n. (RO)
_L Hn
Hn
C
U C n
_S _LS
SC
DC _O LS H
IM T_E Hn
LE SIG LV_ LSC
N
EL
_ E_ _
DC DL UP
LE C_I RA_
ER
d)
D A
LE C_P
_T
e
rv
se
D
LE
(re
31 5 4 3 2 1 0
0x0000000 0 0 0 0 Reset
LEDC_IDLE_LV_LSCHn This bit is used to control the output value, when low-speed channel n is
inactive. (R/W)
LEDC_SIG_OUT_EN_LSCHn This is the output enable control bit for low-speed channel n. (R/W)
LEDC_TIMER_SEL_LSCHn There are four low-speed timers, the two bits are used to select one of
them for low-speed channel n. (R/W)
0: select lstimer0;
1: select lstimer1;
2: select lstimer2;
3: select lstimer3.
n
CH
LS
T_
IN
PO
d)
_H
ve
DC
er
s
LE
(re
31 20 19 0
LEDC_HPOINT_LSCHn The output value changes to high when lstimerx(x=[0,3]), selected by low-
speed channel n, has reached LEDC_HPOINT_LSCHn[19:0]. (R/W)
Hn
SC
_L
TY
DU
)
ed
C_
rv
se
D
LE
(re
31 25 24 0
LEDC_DUTY_LSCHn The register is used to control output duty. When lstimerx(x=[0,3]), chosen by
low-speed channel n, has reached LEDC_LPOINT_LSCHn,the output signal changes to low. (R/W)
LEDC_LPOINT_LSCHn=(LEDC_HPOINT_LSCHn[19:0]+LEDC_DUTY_LSCHn[24:4]) (1)
LEDC_LPOINT_LSCHn=(LEDC_HPOINT_LSCHn[19:0]+LEDC_DUTY_LSCHn[24:4] +1) (2)
See the Functional Description for more information on when (1) or (2) is chosen.
n
CH H n
CH
CH
Hn
LS C
n
LS
C_ LS
SC
_L
_
IN T_
_L
LE
CL
Y_ AR
CA
U
CY
UT ST
_N
_S
_D TY_
Y_
Y
Y
UT
UT
UT
DC U
LE C_D
_D
_D
C_
DC
DC
D
D
LE
LE
LE
LE
31 30 29 20 19 10 9 0
LEDC_DUTY_INC_LSCHn This register is used to increase or decrease the duty of output signal for
low-speed channel n. (R/W)
LEDC_DUTY_NUM_LSCHn This register is used to control the number of times the duty cycle is
increased or decreased for low-speed channel n. (R/W)
LEDC_DUTY_SCALE_LSCHn This register is used to increase or decrease the step scale for low-
speed channel n. (R/W)
_D
ve
DC
r
se
LE
(re
31 25 24 0
LEDC_DUTY_LSCHn_R This register represents the current duty of the output signal for low-speed
channel n. (RO)
x
ER
ES
IM
x_ T x
ER RS ER
ST
_R
E
IM x_ IM
_H
TY
US
ST ER ST
UM
DU
PA
_H TIM L_H
x_
_N
ER
IV
DC S SE
_D
IM
LE C_H K_
LK
ST
D IC
d)
_C
_H
LE C_T
ve
DC
DC
er
D
s
LE
LE
LE
(re
31 26 25 24 23 22 5 4 0
LEDC_TICK_SEL_HSTIMERx This bit is used to select APB_CLK or REF_TICK for high-speed timer
x. (R/W)
1: APB_CLK;
0: REF_TICK.
LEDC_HSTIMERx_RST This bit is used to reset high-speed timer x. The counter value will be ’zero’
after reset. (R/W)
LEDC_HSTIMERx_PAUSE This bit is used to suspend the counter in high-speed timer x. (R/W)
LEDC_CLK_DIV_NUM_HSTIMERx This register is used to configure the division factor for the divider
in high-speed timer x. The least significant eight bits represent the fractional part. (R/W)
LEDC_HSTIMERx_DUTY_RES This register is used to control the range of the counter in high-speed
timer x. The counter range is [0, 2LEDC_HST IM ERx_DU T Y _RES ], the maximum bit width for counter
is 20. (R/W)
_H
rv
DC
se
LE
(re
31 20 19 0
0x0000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
LEDC_HSTIMERx_CNT Software can read this register to get the current counter value of high-speed
timer x. (RO)
x
ER
S
IM
x_ T x
IM x_ IM P
RE
ER RS ER
ST
ST ER ST U
Y_
_L IM L_L RA_
_L
US
T
UM
DU
DC ST SE A
PA
LE C_L K_ x_P
_N
x_
D IC ER
ER
IV
_D
LE _T IM
IM
LK
DC ST
ST
d)
_C
LE C_L
_L
ve
DC
DC
er
D
s
LE
LE
LE
(re
31 27 26 25 24 23 22 5 4 0
LEDC_TICK_SEL_LSTIMERx This bit is used to select SLOW_CLK or REF_TICK for low-speed timer
x. (R/W)
1: SLOW_CLK;
0: REF_TICK.
LEDC_LSTIMERx_RST This bit is used to reset low-speed timer x. The counter will show 0 after
reset. (R/W)
LEDC_LSTIMERx_PAUSE This bit is used to suspend the counter in low-speed timer x. (R/W)
LEDC_CLK_DIV_NUM_LSTIMERx This register is used to configure the division factor for the divider
in low-speed timer x. The least significant eight bits represent the fractional part. (R/W)
LEDC_LSTIMERx_DUTY_RES This register is used to control the range of the counter in low-speed
timer x. The counter range is [0, 2LEDC_LST IM ERx_DU T Y _RES ], the max bit width for counter is
20. (R/W)
_L
e
rv
DC
se
LE
(re
31 20 19 0
0x0000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
LEDC_LSTIMERx_CNT Software can read this register to get the current counter value of low-speed
timer x. (RO)
31
31
0
0
0
0
0
0
(re (re
s
0
0
se
Espressif Systems
rv er
e ve
0
0
d) d)
interrupt. (RO)
interrupt. (RO)
interrupt. (RO)
interrupt. (RO)
0
0
0
24
0
24
0
0
23
23
LE LE
D D
14 LED PWM Controller (LEDC)
0
0
22
22
LE C_D LE C_D
D U D U
0
0
21
LE C_D TY_ 21 LE C_D TY_
DC U C DC U C
0
0
20
20
LE _D TY_ HN LE _D TY_ HN
D U C G_ D U C G_
0
0
19
19
0
0
18
18
0
0
17
17
LE _D TY_ HN EN LS 7_ LE _D TY_ HN EN LS 7_
D U C G_ D_ CH IN D U C G_ D_ CH IN
0
0
16
16
0
0
15
15
LEDC_DUTY_CHNG_END_LSCHn_INT_ST The
LEDC_DUTY_CHNG_END_HSCHn_INT_ST The
LE C_D TY_ HN EN LS 5_ T_S LE C_D TY_ HN EN LS 5_ T_R W
D U C G_ D_ CH IN T D U C G_ D_ CH IN A
394
LEDC_DUTY_CHNG_END_LSCHn_INT_RAW The
LEDC_DUTY_CHNG_END_HSCHn_INT_RAW The
0
0
14
14
0
0
13
13
DC U C G_ D_ CH IN T DC U C G_ D_ CH IN AW
0
0
12
12
raw
raw
masked
D U C G_ D_ CH IN T D U C G_ D_ CH IN A
masked
0
0
11
11
10
10
9
9
0
0
8
8
interrupt
0
0
interrupt
interrupt
Register 14.16. LEDC_INT_ST_REG (0x0184)
D U C G_ D_ C IN T D U C G_ D_ C IN A
7
7
Register 14.15. LEDC_INT_RAW_REG (0x0180)
0
0
6
6
0
0
5
5
status
0
0
status
status
status
D S ER G_ D_ C IN T D S ER G_ D_ C IN A
4
4
0
0
bit
3
3
0
0
bit
bit
LE C_L TIM 2_ F_ HS H1_ T_S LE C_L TIM 2_ F_ HS H1_ T_R W
D S ER OV INT C IN T D S ER OV INT C IN A
2
2
0
0
for
for
for
1
1
0
0
0
0
LE _H TIM 3_ F_ _S LE _H TIM 3_ F_ _R
DC S ER OV NT T I DC S ER OV NT AWI
T _
_H TIM 2_ F_ _S _H IM 2_ F_ R
ST ER OV INT T ST ER OV INT AW
0 Reset
0 Reset
IM 1_ F_ _S IM 1_ F_ _R
ER OV IN T ER OV IN AW
31
31
0
0
0
0
0
0
(WO)
(re (re
0
0
se se
Espressif Systems
rv rv
ed ed
0
0
) )
rupt. (R/W)
rupt. (R/W)
0
0
0
24
0
24
0
0
23
23
LE LE
D D
14 LED PWM Controller (LEDC)
0
0
22
22
LE C_D LE C_D
D U D U
0
0
21
21
LE C_D TY_ LE C_D TY_
D U C DC U C
0
0
20
20
0
0
19
19
0
0
18
18
0
0
17
17
LE _D TY_ HN EN LS 7_ LE _D TY_ HN EN LS 7_
D U C G_ D_ CH IN D U C G_ D_ CH IN
0
0
16
16
0
0
15
15
LEDC_DUTY_CHNG_END_LSCHn_INT_CLR Set
LEDC_DUTY_CHNG_END_HSCHn_INT_CLR Set
D U C G_ D_ CH IN L D U C G_ D_ CH IN N
LEDC_DUTY_CHNG_END_LSCHn_INT_ENA The
395
LEDC_DUTY_CHNG_END_HSCHn_INT_ENA The
0
0
14
14
0
0
13
13
12
12
this
this
0
0
11
11
interrupt
0
0
10
10
9
9
0
0
bit
bit
D U C G_ D_ C IN L D U C G_ D_ C IN N
8
8
0
0
7
7
0
0
enable
D U C G_ D_ C IN L D U C G_ D_ C IN N
6
6
0
0
to
to
DC ST C G_ D_ CH IN L D S C G_ D_ C IN N
5
5
0
0
4
4
bit
0
0
3
3
0
0
clear
clear
2
2
0
0
for
D S ER OV INT LR IN L D S ER OV INT NA IN N
1
1
0
0
0
0
LE _H TIM 3_ F_ _C LE _H TIM 3_ F_ _E
DC S ER OV NT LRI DC S ER OV NT NAI
T _ T _
_H IM 2_ F_ C _H IM 2_ F_ E
ST ER OV INT LR ST ER OV INT NA
0 Reset
0 Reset
IM 1_ F_ _C IM 1_ F_ _E
ER OV IN LR ER OV IN NA
L
SE
LK_
_C
PB
d)
A
ve
C_
er
D
s
LE
(re
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
15.1 Introduction
The RMT (Remote Control) module is primarily designed to send and receive infrared remote control signals that
implement on-off keying in a carrier frequency, but due to its design it can be used to generate various types of
signals. An RMT transmitter does this by reading consecutive duration values of an active and inactive output from
the built-in RAM block, optionally modulating it with a carrier wave. A receiver will inspect its input signal, optionally
filtering it, and will place the lengths of time the signal is active and inactive in the RAM block.
The RMT module has eight channels, numbered zero to seven; registers, signals and blocks that are duplicated in
each channel are indicated by an n which is used as a placeholder for the channel number.
The RMT module contains eight channels. Each channel has both a transmitter and a receiver, but only one of them
can be active in every channel. The eight channels share a 512x32-bit RAM block which can be read and written
by the processor cores over the APB bus, read by the transmitters, and written by the receivers. The transmitted
signal can optionally be modulated by a carrier wave. Each channel is clocked by a divided-down signal derived
from either the APB bus clock or REF_TICK.
The data structure in RAM is shown in Figure 15-2. Each 32-bit value contains two 16-bit entries, with two fields
in every entry, ”level” and ”period”. ”Level” indicates whether a high-/low-level value was received or is going to be
sent, while ”period” points out the divider-clock cycles for which the level lasts. A zero period is interpreted as an
end-marker: the transmitter will stop transmitting once it has read this, and the receiver will write this, once it has
detected that the signal it received has gone idle.
Normally, only one block of 64x32-bit worth of data can be sent or received. If the data size is larger than this
block size, blocks can be extended or the channel can be configured for the wraparound mode.
The RMT RAM can be accessed via the APB bus. The initial address is 0x3FF56800. The RAM block is divided into
eight 64x32-bit blocks. By default, each channel uses one block (block zero for channel zero, block one for channel
one, and so on). Users can extend the memory to a specific channel by configuring the RMT_MEM_SIZE_CHn
register; setting this to >1 will prompt the channel to use the memory of subsequent channels as well. The RAM
address range of channel n is start_addr_CHn to end_addr_CHn, which is defined by:
To protect a receiver from overwriting the blocks a transmitter is about to transmit, RMT_MEM_OWNER_CHn can
be configured to designate the owner, be it a transmitter or receiver, of channel n’s RAM block. This way, if this
ownership is violated, the RMT_CHn_ERR interrupt will be generated.
Note: When enabling the continuous transmission mode by setting RMT_REG_TX_CONTI_MODE, the transmitter
will transmit the data on the channel continuously, that is, from the first byte to the last one, then from the first to
the last again, and so on. In this mode, there will be an idle level lasting one clk_div cycle between N and N+1
transmissions.
15.2.3 Clock
The main clock of a channel is generated by taking either the 80 MHz APB clock or REF_TICK (usually 1MHz),
according to the state of RMT_REF_ALWAYS_ON_CHn. (For more information on clock sources, please see
Chapter Reset And Clock.) Then, the aforementioned state gets scaled down using a configurable 8-bit divider to
create the channel clock which is used by both the carrier wave generator and the counter. The divider value can
be set by configuring RMT_DIV_CNT_CHn.
15.2.4 Transmitter
When the RMT_TX_START_CHn register is 1, the transmitter of channel n will start reading and sending data from
RAM. The transmitter will receive a 32-bit value each time it reads from RAM. Of these 32 bits, the low 16-bit entry
is sent first and the high entry second.
To transmit more data than can be fitted in the channel’s RAM, the wraparound mode can be enabled. In this mode,
when the transmitter has reached the last entry in the channel’s memory, it will loop back to the first byte. To use
this mechanism for sending more data than can be fitted in the channel’s RAM, fill the RAM with the initial events
and set RMT_CHn_TX_LIM_REG to cause an RMT_CHn_TX_THR_EVENT_INT interrupt before the wraparound
happens. Then, when the interrupt happens, the already sent data should be replaced by subsequent events, so
that when the wraparound happens the transmitter will seamlessly continue sending the new events.
With or without the wraparound mode enabled, transmission ends when an entry with zero length is encoun-
tered. When this happens, the transmitter will generate an RMT_CHn_TX_END_INT interrupt and return to the idle
state. When a transmitter is in the idle state, the output level defaults to end-mark 0. Users can also configure
RMT_IDLE_OUT_EN_CHn and RMT_IDLE_OUT_LV_CHn to control the output level manually.
The output of the transmitter can be modulated using a carrier wave by setting RMT_CARRIER_EN_CHn. The
carrier frequency and duty cycle can be configured by adjusting the carrier’s high and low durations in channel-
clock cycles, in RMT_CARRIER_HIGH_CHn and RMT_CARRIER_LOW_CHn.
15.2.5 Receiver
When RMT_RX_EN_CHn is set to 1, the receiver in channel n becomes active, measuring the duration between
input signal edges. These will be written as period/level value pairs to the channel RAM in the same fashion
as the transmitter sends them. Receiving ends, when the receiver detects no change in signal level for more
than RMT_IDLE_THRES_CHn channel clock ticks. The receiver will write a final entry with 0 period, generate an
RMT_CHn_RX_END_INT_RAW interrupt and return to the idle state.
The receiver has an input signal filter which can be configured using RMT_RX_FILTER_EN_CHn: The filter will
remove pulses with a length of less than RMT_RX_FILTER_THRES_CHn in APB clock periods.
When the RMT module is inactive, the RAM can be put into low-power mode by setting the RMT_MEM_PD register
to 1.
15.2.6 Interrupts
• RMT_CHn_TX_THR_EVENT_INT: Triggered when the amount of data the transmitter has sent matches the
value of RMT_CHn_TX_LIM_REG.
• RMT_CHn_TX_END_INT: Triggered when the transmitter has finished transmitting the signal.
15.4 Registers
Register 15.1. RMT_CHnCONF0_REG (n: 07) (0x0020+8*n)
Hn Hn
_C _C
EN _LV
n
CH
n
CH
R_ T
n
S_
IE OU
CH
E_
RE
RR R_
_
IZ
T_ ARR D
NT
TH
CA IE
RM _C _P
_S
_C
_
T EM
EM
LE
T d)
V
ID
DI
RM rve
RM _M
M
T_
T_
T_
se
RM
RM
RM
(re
31 30 29 28 27 24 23 8 7 0
RMT_MEM_PD This bit is used to power down the entire RMT RAM block. (It only exists in
RMT_CH0CONF0). 1: power down memory; 0: power up memory. (R/W)
RMT_CARRIER_OUT_LV_CHn This bit is used for configuration when the carrier wave is being trans-
mitted. Transmit on low output level with 1, and transmit on high output level with 0. (R/W)
RMT_CARRIER_EN_CHn This is the carrier modulation enable-control bit for channel n. Carrier mod-
ulation is enabled with 1, while carrier modulation is disabled with 0. (R/W)
RMT_MEM_SIZE_CHn This register is used to configure the amount of memory blocks allocated to
channel n. (R/W)
RMT_IDLE_THRES_CHn In receive mode, when no edge is detected on the input signal for longer
than REG_IDLE_THRES_CHn channel clock cycles, the receive process is finished. (R/W)
RMT_DIV_CNT_CHn This register is used to set the divider for the channel clock of channel n. (R/W)
Hn
CH Hn
Hn n
_C CH
_C
T_ _C
Hn
n
T d) WN OD n
_ S C H T_ n
F_ WA _C n
T_ S_O n
ER E_
TX N_ RS CH
RE AL _LV H
RS N
CN Y H
TA n C
T_ EF_ UT N_C
HR
Hn
T_ X_E R_ T_
se EM NT N
RM _R _W _RS
(re M O _E
_T
_C
RM _R _O _E
ER
T_ _C ER
RT
T LE UT
D
ILT
RM _TX FILT
RM _M _R
RM _ID _O
_F
T EM
T M
T LE
T _
d)
E
RX
X
RM _ID
ve
RM _M
RM R
T_
T_
er
T
s
RM
RM
RM
(re
31 20 19 18 17 16 15 8 7 6 5 4 3 2 1 0
RMT_IDLE_OUT_EN_CHn This is the output enable-control bit for channel n in IDLE state. (R/W)
RMT_IDLE_OUT_LV_CHn This bit configures the level of output signals in channel n when the latter
is in IDLE state. (R/W)
RMT_REF_ALWAYS_ON_CHn This bit is used to select the channel’s base clock. 1:clk_apb;
0:clk_ref. (R/W)
RMT_REF_CNT_RST_CHn Setting this bit resets the clock divider of channel n. (R/W)
RMT_RX_FILTER_THRES_CHn In receive mode, channel n ignores input pulse when the pulse width
is smaller than this value in APB clock periods. (R/W)
RMT_TX_CONTI_MODE_CHn If this bit is set, instead of going to an idle state when transmission
ends, the transmitter will restart transmission. This results in a repeating output signal. (R/W)
RMT_MEM_OWNER_CHn This bit marks channel n’s RAM block ownership. Number 1 indicates
that the receiver is using the RAM, while 0 indicates that the transmitter is using the RAM. (R/W)
RMT_MEM_RD_RST_CHn Set this bit to reset the read-RAM address for channel n by accessing the
transmitter. (R/W)
RMT_MEM_WR_RST_CHn Set this bit to reset the write-RAM address for channel n by accessing
the receiver. (R/W)
31
31
RM RM
T_ T
0
0
30
30
RM C RM _C
T H7 T H7
0
0
29
29
RM _C _T RM _C _T
X X
T H6 _ T H6 _
0
0
(RO)
28
28
RM _C _T THR RM _C _T THR
X X
T H5 _ _ T H5 _ _
0
0
27
27
Espressif Systems
RM _C _T THR EVE RM _C _T THR EVE
T 4H X_ _ N
T 4H X_ _ N
rupt. (RO)
rupt. (RO)
rupt. (RO)
0
0
26
26
RM _C _T THR EVE T_IN RM _C _T THR EVE T_IN
X X
T_ H3_ _T _E NT T_ T H3 _ _ N T
0
0
25
25
RM C T HR VE _IN ST RM _C _T THR EVE T_IN _RA
X X
T H2 _ _ N T T H2 _ _ N T W
0
0
24
24
RM _C _T THR EVE T_IN _ST RM _C _T THR EVE T_IN _RA
H X_ _ N T H X
T 1 T 1 _ _ N T W
0
0
23
23
RM _C _T THR EVE T_IN _ST RM _C _T THR EVE T_IN _RA
X X
T H0 _ _ N T T H0 _ _ N T W
0
0
22
22
RM _C _T THR EVE T_IN _ST RM _C _T THR EVE T_IN _RA
H X H X_ _ N T W
T 7 _ _ N T T 7
0
0
21
21
T H7 R _ N T T H7 R _ N T W
0
0
20
20
0
0
19
19
0
0
18
18
RMT_CHn_TX_THR_EVENT_INT_ST The
0
0
17
17
0
0
16
16
RM _C _T EN ST T RM C T N A W
X D X D
T H5 _ _ T H5 _ _ W
0
0
15
15
T 5 R _ _S T 5 R _ _R
403
0
0
14
14
T H5 X_ T_ _S T H5 X_ T_ _R
masked
0
0
13
13
RM _C _T EN ST T RM _C _T EN RA AW
X D X D
T H4 _ _ T H4 _ _ W
0
0
12
12
0
0
11
11
10
10
RM _C _T EN ST T RM _C _T EN RA AW
X D X D
interrupt
T H3 _ _ T H3 _ _ W
interrupt
9
9
0
0
8
8
0
0
T 3 X_ T_ _S T 3 X_ T_ _R
7
7
0
0
RM _C _T EN ST T RM _C _T EN RA AW
X D X D
T H2 _ _ T H2 _ _ W
status
6
6
0
0
status
RM _C _E END INT RM _C _E END INT
R R
T H2 R _ _S T H2 R _ _R
5
5
0
0
4
4
0
0
bit
RM _C _T EN ST T RM _C _T EN RA AW
X D X D
bit
T H1 _ _ T H1 _ _ W
3
3
0
0
2
2
0
0
for
T H1 X_ T_ _S T H1 X_ T_ _R
1
1
0
0
RM _C _T EN ST T RM _C _T EN RA AW
X D X D
T H0 _ _ T H0 _ _ W
0
0
RMT_CHn_ERR_INT_ST The masked interrupt status bit for the RMT_CHn_ERR_INT interrupt. (RO)
RMT_CHn_TX_END_INT_ST The masked interrupt status bit for the RMT_CHn_TX_END_INT inter-
RMT_CHn_RX_END_INT_ST The masked interrupt status bit for the RMT_CHn_RX_END_INT inter-
the
RMT_CHn_TX_END_INT_RAW The raw interrupt status bit for the RMT_CHn_TX_END_INT interrupt.
RMT_CHn_RX_END_INT_RAW The raw interrupt status bit for the RMT_CHn_RX_END_INT inter-
the
CH RX IN T CH RX IN T W
0_ _E T_S _ST 0_ _E T_R _RA
0 Reset
0 Reset
TX ND T TX ND A W
31
31
RM RM
T_ T
0
0
30
30
RM C RM _C
T H7 T H7
0
0
29
29
RM _C _T RM _C _T
X X
T H6 _ T H6 _
0
0
28
28
RM _C _T THR RM _C _T THR
X X
(R/W)
(R/W)
T H5 _ _ T H5 _ _
0
0
27
27
Espressif Systems
RM _C _T THR EVE RM _C _T THR EVE
H X H X_ _ N
T 4 _ _ N T 4
0
0
26
26
RM _C _T THR EVE T_IN RM _C _T THR EVE T_IN
X X
T H3 _ _ N T T H3 _ _ N T
terrupt. (WO)
0
0
25
25
RM _C _T THR EVE T_IN _C RM _C _T THR EVE T_IN _EN
X L X
T H2 _ _ N T R T H2 _ _ N T A
0
0
24
24
RM _C _T THR EVE T_IN _C RM _C _T THR EVE T_IN _EN
H X_ _ N T LR H X
T 1 T 1 _ _ N T A
0
0
23
23
RM _C _T THR EVE T_IN _C RM _C _T THR EVE T_IN _EN
X L X
T H0 _ _ N T R T H0 _ _ N T A
0
0
22
22
RM _C _T THR EVE T_IN _C RM _C _T THR EVE T_IN _EN
T 7H X_ _ N T LR
T 7H X_ _ N T A
0
0
21
21
T H7 R _ N T R T H7 R _ N T A
0
0
20
20
0
0
19
19
0
0
18
18
0
0
17
17
0
0
16
16
RM C T N L R RM C T N N A
X D X D
T H5 _ _ R T H5 _ _ A
0
0
15
15
404
RMT_CHn_TX_THR_EVENT_INT interrupt. (R/W)
0
0
14
14
0
0
13
13
RM _C _T EN CL LR RM _C _T EN EN NA
X D X D
T H4 _ _ R T H4 _ _ A
0
0
12
12
interrupt
0
0
11
11
10
10
RM _C _T EN CL LR RM _C _T EN EN NA
X D X D
T H3 _ _ R T H3 _ _ A
9
9
0
0
8
8
0
0
H H
Register 15.5. RMT_INT_ENA_REG (0x00A8)
7
7
0
0
RM _C _T EN CL LR RM _C _T EN EN NA
X D X D
T H2 _ _ R T H2 _ _ A
6
6
0
0
5
5
0
0
bit
4
4
0
0
RM _C _T EN CL LR RM _C _T EN EN NA
X D X D
T H1 _ _ R T H1 _ _ A
0
0
2
2
0
0
1
1
0
0
RM _C _T EN CL LR RM _C _T EN EN NA
X D X D
CH RX IN T LR CH RX IN T A
0_ _E T_C _CL 0_ _E T_E _EN
0 Reset
0 Reset
TX ND L R TX ND N A
Hn
CH
_C
H_
W
IG
O
H
L
R_
R_
IE
IE
RR
RR
CA
CA
T_
T_
RM
RM
31 16 15 0
RMT_CARRIER_HIGH_CHn This field is used to configure the carrier wave’s high-level clock period
for channel n. The clock source can be either REF_TICK or APB_CLK. (R/W)
RMT_CARRIER_LOW_CHn This field is used to configure the carrier wave’s low-level clock period
for channel n. The clock source can be either REF_TICK or APB_CLK. (R/W)
Hn
_C
IM
_L
d)
TX
ve
T_
r
se
RM
(re
31 9 8 0
RMT_TX_LIM_CHn When channel n sends more entries than specified here, it produces a
TX_THR_EVENT interrupt. (R/W)
S_ N
EN
ES P_E
CC A
_A WR
EM X_
M _T
T_ EM
)
ed
RM _M
rv
se
T
RM
(re
31 2 1 0
0x00000000 0 0 Reset
RMT_MEM_TX_WRAP_EN This bit enables wraparound mode: when the transmitter of a channel
has reached the end of its memory block, it will resume sending at the start of its memory region.
(R/W)
16.1 Introduction
The Motor Control Pulse Width Modulator (MCPWM) peripheral is intended for motor and power control. It provides
six PWM outputs that can be set up to operate in several topologies. One common topology uses a pair of PWM
outputs driving an H-bridge to control motor rotation speed and rotation direction.
The timing and control resources inside are allocated into two major types of submodules: PWM timers and PWM
operators. Each PWM timer provides timing references that can either run freely or be synced to other timers or
external sources. Each PWM operator has all necessary control resources to generate waveform pairs for one
PWM channel. The MCPWM peripheral also contains a dedicated capture submodule that is used in systems
where accurate timing of external events is important.
ESP32 contains two MCPWM peripherals: MCPWM0 and MCPWM1. Their control registers are located in 4-KB
memory blocks starting at memory locations 0x3FF5E000 and 0x3FF6C000 respectively.
16.2 Features
Each MCPWM peripheral has one clock divider (prescaler), three PWM timers, three PWM operators, and a capture
module. Figure 16-1 shows the submodules inside and the signals on the interface. PWM timers are used for
generating timing references. The PWM operators generate desired waveform based on the timing references.
Any PWM operator can be configured to use the timing references of any PWM timers. Different PWM operators
can use the same PWM timer’s timing references to produce related PWM signals. PWM operators can also use
different PWM timers’ values to produce the PWM signals that work alone. Different PWM timers can also be
synced together.
– The 16-bit counter in the PWM timer can work in count-up mode, count-down mode or count-up-down
mode.
– A hardware sync can trigger a reload on the PWM timer with a phase register. It will also trigger the
prescaler’ restart, so that the timer’s clock can also be synced. The source of the sync can come from
any GPIO or any other PWM timer’s sync_out.
– Every PWM operator has two PWM outputs: PWMxA and PWMxB. They can work independently, in
symmetric and asymmetric configuration.
– Modulating of PWM output by high-frequency carrier signals, useful when gate drives are insulated with
a transformer.
– Period, time stamps and important control registers have shadow registers with flexible updating meth-
ods.
– Programmable fault handling allocated on fault condition in both cycle-by-cycle mode and one-shot
mode.
– A fault condition can force the PWM output to either high or low logic levels.
• Capture Module
– Speed measurement of rotating machinery (for example, toothed sprockets sensed with Hall sensors)
– Decoding current or voltage amplitude derived from duty-cycle-encoded signals from current/voltage
sensors
– Three individual capture channels, each of which has a time-stamp register (32 bits)
– The capture timer can sync with a PWM timer or external signals.
16.3 Submodules
16.3.1 Overview
This section lists the configuration parameters of key submodules. For information on adjusting a specific param-
eter, e.g. synchronization source of PWM timer, please refer to Section 16.3.2 for details.
Configuration parameter:
Configuration parameters:
• Configure the the reloading phase (including the value and the phase) used during software and hardware
synchronization.
• Synchronize the PWM timers with each other. Either hardware or software synchronization may be used.
• Configure the source of the PWM timer’s the synchronization input to one of the seven sources below:
– Three synchronization signals from the GPIO matrix: SYNC0, SYNC1, SYNC2.
• Configure the source of the PWM timer’s synchronization output to one of the four sources below:
The configuration parameters of the operator submodule are shown in Table 16-1.
• Set up the PWM duty cycle for PWMxA and/or PWMxB out-
put.
• Set up at which time the timing events occur.
• Define what action should be taken on timing events:
– Switch high or low PWMxA and/or PWMxB outputs
PWM Generator – Toggle PWMxA and/or PWMxB outputs
– Take no action on outputs
• Use direct s/w control to force the state of PWM outputs
• Add a dead time to raising and / or failing edge on PWM out-
puts.
• Configure update method for this submodule.
• Configure if and how the PWM module should react the fault
event signals.
• Specify the action taken when a fault event occurs:
– Force PWMxA and/or PWMxB high.
– Force PWMxA and/or PWMxB low.
– Configure PWMxA and/or PWMxB to ignore any fault
event.
Fault Handler • Configure how often the PWM should react to fault events:
– One-shot
– Cycle-by-cycle
• Generate interrupts.
• Bypass the fault handler submodule entirely.
• Set up an option for cycle-by-cycle actions clearing.
• If desired, independently-configured actions can be taken
when time-base counter is counting down or up.
Configuration parameters:
• Enable fault event generation and configure the polarity of fault event generation for every fault signal
Configuration parameters:
• Control how often events occur by specifying the PWM timer frequency or period.
• Configure a particular PWM timer to synchronize with other PWM timers or modules.
• Set one of the following timer counting modes: count-up, count-down, count-up-down.
• Change the rate of the PWM timer clock (PT_clk) with a prescaler. Each timer has its own prescaler config-
ured with PWM_TIMERx_PRESCALE of register PWM_TIMER0_CFG0_REG. The PWM timer increments or
decrements at a slower pace, depending on the setting of this register.
• Count-Up Mode:
In this mode, the PWM timer increments from zero until reaching the value configured in the period register.
Once done, the PWM timer returns to zero and starts increasing again. PWM period is equal to the value of
period register + 1.
Note: The period register is PWM_TIMERx_PERIOD (x = 0, 1, 2), i.e., PWM_TIMER0_PERIOD, PWM_TIMER1_PERIOD,
PWM_TIMER2_PERIOD.
• Count-Down Mode:
The PWM timer decrements to zero, starting from the value configured in the period register. After reaching
zero, it is set back to the period value. Then it starts to decrement again. In this case, the PWM period is
also equal to the value of period register + 1.
• Count-Up-Down Mode:
This is a combination of the two modes mentioned above. The PWM timer starts increasing from zero until
the period value is reached. Then, the timer decreases back to zero. This pattern is then repeated. The
PWM period is the result of (the value of period register × 2 + 1).
Figures 16-7 to 16-10 show PWM timer waveforms in different modes, including timer behavior during synchro-
nization events.
When the PWM timer is running, it generates the following timing events periodically and automatically:
• UTEP
The timing event generated when the PWM timer’s value equals to the value of the period register
(PWM_TIMERx_PERIOD) and when the PWM timer is increasing.
• UTEZ
The timing event generated when the PWM timer’s value equals to zero and when the PWM timer is increas-
ing.
• DTEP
The timing event generated when the PWM timer’s value equals to the value of the period register
(PWM_TIMERx_PERIOD) and when the PWM timer is decreasing.
• DTEZ
The timing event generated when the PWM timer’s value equals to zero and when the PWM timer is decreas-
ing.
Figures 16-11 to 16-13 show the timing waveforms of U/DTEP and U/DTEZ.
• Active Register
This register is directly responsible for controlling all actions performed by hardware.
• Shadow Register
It acts as a temporary buffer for a value to be written on the active register. Before this happens, the content
of the shadow register has no direct effect on the controlled hardware. At a specific, user-configured point
in time, the value saved in the shadow register is copied to the active register. This helps to prevent spurious
operation of the hardware, which may happen when a register is asynchronously modified by software. Both
the shadow register and the active register have the same memory address. The software always writes into,
or reads from the shadow register. The moment of updating the active register is determined by its specific
update method register. The update can start when the PWM timer is equal to zero, when the PWM timer is
equal to period,at a synchronization moment, or immediately. Software can trigger a globally forced update
which will prompt all registers in the module to be updated according to shadow registers.
• Generates a PWM signal pair, based on timing references obtained from the corresponding PWM timer.
• Each signal out of the PWM signal pair includes a specific pattern of dead time.
In this submodule, important timing events are generated or imported. The events are then converted into specific
actions to generate the desired waveforms at the PWMxA and PWMxB outputs.
• Generation of timing events based on time stamps configured using the A and B registers. Events happen
when the following conditions are satisfied:
– UTEA: the PWM timer is counting up and its value is equal to register A.
– UTEB: the PWM timer is counting up and its value is equal to register B.
– DTEA: the PWM timer is counting down and its value is equal to register A.
– DTEB: the PWM timer is counting down and its value is equal to register B.
• Qualification and generation of set, clear and toggle actions, based on the timing events.
• Controlling of the PWM duty cycle, depending on configuration of the PWM generator submodule.
• Handling of new time stamp values, using shadow, registers to prevent glitches in the PWM cycle.
The time stamp registers A and B, as well as action configuration registers PWM_GENx_A_REG and PWM_GENx_B_REG
are shadowed. Shadowing provides a way of updating registers in sync with the hardware. For a description of
the shadow registers, please see 16.3.2.3.
Timing Events
For convenience, all timing signals and events are summarized in Table 16-2.
The purpose of a software-force event is to impose non-continuous or continuous changes on the PWMxA and
PWMxB outputs. The change is done asynchronously. Software-force control is handled by the
PWM_PWM_GENx_FORCE_REG registers.
The selection and configuration of T0/T1 in the PWM generator submodule is independent of the configuration
of fault events in the fault handler submodule. A particular trip event may or may not be configured to cause trip
action in the fault handler submodule, but the same event can be used by the PWM generator to trigger T0/T1 for
controlling PWM waveforms.
It is important to know that when the PWM timer is in count-up-down mode, it will always decrement after a TEP
event, and will always increment after a TEZ event. So when the PWM timer is in count-up-down mode, DTEP
and UTEZ events will occur, while the events UTEP and DTEZ will never occur.
The PWM generator can handle multiple events at the same time. Events are prioritized by the hardware and
relevant details are provided in Table 16-3 and Table 16-4. Priority levels range from 1 (the highest) to 7 (the
lowest). Please note that the priority of TEP and TEZ events depends on the PWM timer’s direction.
If the value of A or B is set to be greater than the period, then U/DTEA and U/DTEB will never occur.
Notes:
1. UTEP and UTEZ do not happen simultaneously. When the PWM timer is in count-up mode, UTEP will always
happen one cycle earlier than UTEZ, as demonstrated in Figure 16-11, so their action on PWM signals will
not interrupt each other. When the PWM timer is in count-up-down mode, UTEP will not occur.
2. DTEP and DTEZ do not happen simultaneously. When the PWM timer is in count-down mode, DTEZ will
always happen one cycle earlier than DTEP, as demonstrated in Figure 16-12, so their action on PWM signals
will not interrupt each other. When the PWM timer is in count-up-down mode, DTEZ will not occur.
The PWM generator submodule controls the behavior of outputs PWMxA and PWMxB when a particular timing
event occurs. The timing events are further qualified by the PWM timer’s counting direction (up or down). Knowing
the counting direction, the submodule may then perform an independent action at each stage of the PWM timer
counting up or down.
• Set High:
Set the output of PWMxA or PWMxB to a high level.
• Clear Low:
Clear the output of PWMxA or PWMxB by setting it to a low level.
• Toggle:
Change the current output level of PWMxA or PWMxB to the opposite value. If it is currently pulled high, pull
it low, or vice versa.
• Do Nothing:
Keep both outputs PWMxA and PWMxB unchanged. In this state, interrupts can still be triggered.
The configuration of actions on outputs is done by using registers PWN_GENx_A_REG and PWN_GENx_B_REG.
So, the action to be taken on each output is set independently. Also there is great flexibility in selecting actions
to be taken on a given output based on events. More specifically, any event listed in Table 16-2 can operate on
either output PWMxA or PWMxB. To check out registers for particular generator 0, 1 or 2, please refer to register
description in Section 16.4.
Figure 16-15 presents the symmetric PWM waveform generated when the PWM timer is counting up and down.
DC 0%–100% modulation can be calculated via the formula below:
If A matches the PWM timer value and the PWM timer is incrementing, then the PWM output is pulled up. If A
matches the PWM timer value while the PWM timer is decrementing, then the PWM output is pulled low.
The PWM waveforms in Figures 16-16 to 16-19 show some common PWM operator configurations. The following
conventions are used in the figures:
Figure 1616. CountUp, Single Edge Asymmetric Waveform, with Independent Modulation on PWMxA
and PWMxB — Active High
The duty modulation for PWMxA is set by B, active high and proportional to B.
The duty modulation for PWMxB is set by A, active high and proportional to A.
Figure 1617. CountUp, Pulse Placement Asymmetric Waveform with Independent Modulation on PWMxA
Pulses may be generated anywhere within the PWM cycle (zero – period).
PWMxA’s high time duty is proportional to (B – A).
Figure 1618. CountUpDown, Dual Edge Symmetric Waveform, with Independent Modulation on PWMxA
and PWMxB — Active High
The duty modulation for PWMxA is set by A, active high and proportional to A.
The duty modulation for PWMxB is set by B, active high and proportional to B.
Outputs PWMxA and PWMxB can drive independent switches.
Figure 1619. CountUpDown, Dual Edge Symmetric Waveform, with Independent Modulation on PWMxA
and PWMxB — Complementary
SoftwareForce Events
There are two types of software-force events inside the PWM generator:
Figure 16-20 shows a waveform of NCI software-force events. NCI events are used to force PWMxA output low.
Forcing on PWMxB is disabled in this case.
Figure 16-21 shows a waveform of CNTU software-force events. UTEZ events are selected as triggers for CNTU
software-force events. CNTU is used to force the PWMxB output low. Forcing on PWMxA is disabled.
Several options to generate signals on PWMxA and PWMxB outputs, with a specific placement of signal edges,
have been discussed in section 16.3.3.1. The required dead time is obtained by altering the edge placement
between signals and by setting the signal’s duty cycle. Another option is to control the dead time using a specialized
submodule – the Dead Time Generator.
The key functions of the dead time generator submodule are as follows:
• Generating signal pairs (PWMxA and PWMxB) with a dead time from a single PWMxA input
• This submodule may also be bypassed, if the dead time is configured directly in the generator submodule.
Delay registers RED and FED are shadowed with registers PWM_DTx_RED_CFG_REG and PWM_DTx_FED_CFG_REG.
For the description of shadow registers, please see section 16.3.2.3.
Options for setting up the dead-time submodule are shown in Figure 16-22.
Figure 1622. Options for Setting up the Dead Time Generator Submodule
S0-8 in the figure above are switches controlled by registers PWM_DTx_CFG_REG shown in Table 16-5.
Switch Register
S0 PWM_DTx_B_OUTBYPASS
S1 PWM_DTx_A_OUTBYPASS
S2 PWM_DTx_RED_OUTINVERT
S3 PWM_DTx_FED_OUTINVERT
S4 PWM_DTx_RED_INSEL
S5 PWM_DTx_FED_INSEL
S6 PWM_DTx_A_OUTSWAP
S7 PWM_DTx_B_OUTSWAP
S8 PWM_DTx_DEB_MODE
All switch combinations are supported, but not all of them represent the typical modes of use. Table 16-6 doc-
uments some typical dead time configurations. In these configurations the position of S4 and S5 sets PWMxA
as the common source of both falling-edge and rising-edge delay. The modes presented in table 16-6 may be
categorized as follows:
• Mode 1: Bypass delays on both falling (FED) as well as raising edge (RED)
In this mode the dead time submodule is disabled. Signals PWMxA and PWMxB pass through without any
modifications.
• Modes 6 and 7: Bypass delay on falling edge (FED) or rising edge (RED)
In these modes, either RED (Rising Edge Delay) or FED (Falling Edge Delay) is bypassed. As a result, the
corresponding delay is not applied.
Rising edge (RED) and falling edge (FED) delays may be set up independently. The delay value is programmed
using the 16-bit registers PWM_DTx_RED and PWM_DTx_FED. The register value represents the number of clock
(DT_clk) periods by which a signal edge is delayed. DT_CLK can be selected from PWM_clk or PT_clk through
register PWM_DTx_CLK_SEL.
To calculate the delay on falling edge (FED) and rising edge (RED), use the following formulas:
Function Overview
• Carrier frequency
Operational Highlights
The PWM carrier clock (PC_clk) is derived from PWM_clk. The frequency and duty cycle are configured by the
PWM_CARRIERx_PRESCALE and PWM_CARRIERx_DUTY bits in the PWM_CARRIERx_CFG_REG register. The
purpose of one-shot pulses is to provide high-energy impulse to reliably turn on the power switch. Subsequent
pulses sustain the power-on status. The width of a one-shot pulse is configurable with the PWM_CARRIERx_OSHTWTH
bits. Enabling/disabling of the carrier submodule is done with the PWM_CARRIERx_EN bit.
Waveform Examples
Figure 16-27 shows an example of waveforms, where a carrier is superimposed on original PWM pulses. This
figure do not show the first one-shot pulse and the duty-cycle control. Related details are covered in the following
two sections.
OneShot Pulse
The width of the first pulse is configurable. It may assume one of 16 possible values and is described by the
formula below:
Where:
• (P W M _CARRIERx_OSHT W T H + 1) is the width of the first pulse (whose value ranges from 1 to 16).
The first one-shot pulse and subsequent sustaining pulses are shown in Figure 16-28.
Figure 1628. Example of the First Pulse and the Subsequent Sustaining Pulses of the PWM Carrier Sub
module
After issuing the first one-shot pulse, the remaining PWM signal is modulated according to the carrier frequency.
Users can configure the duty cycle of this signal. Tuning of duty may be required, so that the signal passes
through the isolating transformer and can still operate (turn on/off) the motor drive, changing rotation speed and
direction.
The duty cycle may be set to one of seven values, using PWM_CARRIERx_DUTY, or bits [7:5] of register
PWM_CARRIERx_CFG_REG.
Duty = P W M _CARRIERx_DU T Y ÷ 8
All seven settings of the duty cycle are shown in Figure 16-29.
Figure 1629. Possible Duty Cycle Settings for Sustaining Pulses in the PWM Carrier Submodule
• Forcing outputs PWMxA and PWMxB, upon detected fault, to one of the following states:
– High
– Low
– Toggle
– No action taken
This section provides the operational tips and set-up options for the fault handler submodule.
Fault signals coming from pads are sampled and synced in the GPIO matrix. In order to guarantee the successful
sampling of fault pulses, each pulse duration must be at least two APB clock cycles. The fault detection submodule
will then sample fault signals by using PWM_clk. So, the duration of fault pulses coming from GPIO matrix must be
at least one PWM_clk cycle. Differently put, regardless of the period relation between APB clock and PWM_clk, the
width of fault signal pulses on pads must be at least equal to the sum of two APB clock cycles and one PWM_clk
cycle.
Each level of fault signals, FAULT0 to FAULT2, can be used by the fault handler submodule to generate fault events
(fault_event0 to fault_event2). Every fault event can be configured individually to provide CBC action, OST action,
or none.
• One 32-bit timer (counter) which can be synchronized with the PWM timer, another submodule or software.
• Three capture channels, each equipped with a 32-bit time-stamp and a capture prescaler.
• Independent edge polarity (rising/falling edge) selection for any capture channel.
16.5 Registers
Register 16.1. PWM_CLK_CFG_REG (0x0000)
E
AL
SC
RE
_P
LK
)
ed
_C
rv
M
se
PW
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x000 Reset
D
HO
ET
M
UP
L E
D_
CA
D
IO
ES
RI
ER
PR
PE
P
0_
0_
0_
ER
ER
ER
IM
IM
IM
)
ed
_T
_T
_T
rv
M
se
PW
PW
PW
(re
31 26 25 24 23 8 7 0
T
AR
D
O
ST
M
0_
0_
ER
ER
IM
M
d)
I
_T
_T
e
rv
M
se
PW
PW
(re
31 5 4 3 2 0
PWM_TIMER0_MOD PWM timer0 working mode. 0: freeze, 1: increase mode, 2: decrease mode,
3: up-down mode. (R/W)
PWM_TIMER0_START PWM timer0 start and stop control. 0: if PWM timer0 starts, then stops at
TEZ; 1: if timer0 starts, then stops at TEP; 2: PWM timer0 starts and runs on; 3: timer0 starts and
stops at the next TEZ; 4: timer0 starts and stops at the next TEP. TEP here and below means the
event that happens when the timer equals to period. (R/W)
N
IO
CT
E
0_ NC EL
IR
NC SW
EN
_S
_D
CO
I_
SE
SY _
AS
HA
YN
PH
ER SY
P
_S
0_
0_
IM 0_
M ER0
ER
ER
_T R
M IME
IM
IM
PW IM
d )
_T
_T
_T
PW _T
ve
er
M
s
PW
PW
PW
(re
31 21 20 19 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_TIMER1_SYNCI_EN When set, timer reloading with phase on sync input event is enabled.
(R/W)
E
LU
RE
VA
DI
0_
0_
ER
ER
M
IM
d)
I
_T
_T
ve
r
M
se
PW
PW
(re
31 17 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
D
HO
ET
M
UP
L E
D_
CA
D
IO
ES
RI
ER
PR
PE
P
1_
1_
1_
ER
ER
ER
IM
IM
IM
)
ed
_T
_T
_T
rv
M
se
PW
PW
PW
(re
31 26 25 24 23 8 7 0
PWM_TIMER1_PERIOD_UPMETHOD Updating method for the active register of PWM timer1 pe-
riod. 0: immediately, 1: update at TEZ, 2: update at sync, 3: update at TEZ or sync. (R/W)
T
AR
D
O
ST
M
1_
1_
ER
ER
IM
M
d)
I
_T
_T
e
rv
M
se
PW
PW
(re
31 5 4 3 2 0
PWM_TIMER1_MOD PWM timer1 working mode. 0: freeze, 1: increase mode, 2: decrease mode,
3: up-down mode. (R/W)
PWM_TIMER1_START PWM timer1 start and stop control. 0: if PWM timer1 starts, then stops at
TEZ; 1: if PWM timer1 starts, then stops at TEP; 2: PWM timer1 starts and runs on; 3: PWM
timer1 starts and stops at the next TEZ; 4: PWM timer1 starts and stops at the next TEP. (R/W)
N
IO
CT
E
1_ NC EL
IR
NC SW
EN
_S
_D
CO
I_
SE
SY _
AS
HA
YN
PH
ER SY
P
_S
1_
1_
IM 1_
M ER1
ER
ER
_T R
M IME
IM
IM
PW IM
d )
_T
_T
_T
PW _T
ve
er
M
s
PW
PW
PW
(re
31 21 20 19 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_TIMER1_SYNCI_EN When set, timer reloading with phase at a sync input event is enabled.
(R/W)
E
LU
RE
VA
DI
1_
1_
ER
ER
M
IM
d)
I
_T
_T
ve
r
M
se
PW
PW
(re
31 17 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
D
HO
ET
M
UP
L E
D_
CA
D
IO
ES
RI
ER
PR
PE
P
2_
2_
2_
ER
ER
ER
IM
IM
IM
)
ed
_T
_T
_T
rv
M
se
PW
PW
PW
(re
31 26 25 24 23 8 7 0
T
AR
D
O
ST
M
2_
2_
ER
ER
IM
M
d)
I
_T
_T
e
rv
M
se
PW
PW
(re
31 5 4 3 2 0
PWM_TIMER2_MOD PWM timer2 working mode. 0: freeze, 1: increase mode, 2: decrease mode,
3: up-down mode. (R/W)
PWM_TIMER2_START PWM timer2 start and stop control. 0: if PWM timer2 starts, then stops at
TEZ; 1: if PWM timer2 starts, then stops at TEP; 2: PWM timer2 starts and runs on; 3: PWM
timer2 starts and stops at the next TEZ; 4: PWM timer2 starts and stops at the next TEP. (R/W)
N
IO
CT
E
2_ NC EL
IR
NC SW
EN
_S
_D
CO
I_
SE
SY _
AS
HA
YN
PH
ER SY
P
_S
2_
2_
IM 2_
M ER2
ER
ER
_T R
M IME
IM
IM
PW IM
d )
_T
_T
_T
PW _T
ve
er
M
s
PW
PW
PW
(re
31 21 20 19 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_TIMER2_SYNCI_EN When set, timer reloading with phase on sync input event is enabled.
(R/W)
E
LU
RE
VA
DI
2_
2_
ER
ER
M
IM
d)
I
_T
_T
ve
r
M
se
PW
PW
(re
31 17 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
NC _IN RT
NV T
T
_I R
ER
SY I1 VE
I0 VE
L_ NC _IN
NA SY CI2
EL
EL
SE
IS
IS
ER L_ N
CI
XT NA SY
NC
NC
YN
_E R L_
SY
SY
S
M XTE NA
2_
1_
0_
P W _E R
ER
ER
ER
M XTE
IM
IM
IM
)
ed
PW _E
_T
_T
_T
rv
M
se
PW
PW
PW
PW
(re
31 12 11 10 9 8 6 5 3 2 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_TIMER2_SYNCISEL Select sync input for PWM timer2. 1: PWM timer0 sync_out, 2: PWM
timer1 sync_out, 3: PWM timer2 sync_out, 4: SYNC0 from GPIO matrix, 5: SYNC1 from GPIO
matrix, 6: SYNC2 from GPIO matrix, other values: no sync input selected. (R/W)
PWM_TIMER1_SYNCISEL Select sync input for PWM timer1. 1: PWM timer0 sync_out, 2: PWM
timer1 sync_out, 3: PWM timer2 sync_out, 4: SYNC0 from GPIO matrix, 5: SYNC1 from GPIO
matrix, 6: SYNC2 from GPIO matrix, other values: no sync input selected. (R/W)
PWM_TIMER0_SYNCISEL Select sync input for PWM timer0. 1: PWM timer0 sync_out, 2: PWM
timer1 sync_out, 3: PWM timer2 sync_out, 4: SYNC0 from GPIO matrix, 5: SYNC1 from GPIO
matrix, 6: SYNC2 from GPIO matrix, other values: no sync input selected. (R/W)
L
SE
SE
SE
ER
ER
ER
IM
IM
IM
_T
_T
_T
R2
R1
R0
TO
TO
T
RA
RA
RA
PE
PE
PE
d)
_O
_O
_O
ve
r
M
se
PW
PW
PW
(re
31 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_OPERATOR2_TIMERSEL Select the PWM timer for PWM operator2’s timing reference. 0:
timer0, 1: timer1, 2: timer2. (R/W)
PWM_OPERATOR1_TIMERSEL Select the PWM timer for PWM operator1’s timing reference. 0:
timer0, 1: timer1, 2: timer2. (R/W)
PWM_OPERATOR0_TIMERSEL Select the PWM timer for PWM operator0’s timing reference. 0:
timer0, 1: timer1, 2: timer2. (R/W)
_F LL
L
D
UL
HO
HO
D W FU
SH W_
ET
ET
M
M
A_ D
0_ SH
UP
UP
EN B_
B_
A_
_ G 0_
0_
0_
M EN
EN
EN
)
ed
PW _G
_G
_G
rv
M
se
PW
PW
PW
(re
31 10 9 8 7 4 3 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_GEN0_B_SHDW_FULL Set and reset by hardware. If set, PWM generator 0 time stamp B’s
shadow register.ister is filled and to be transferred to time stamp B’s active register. If cleared, time
stamp B’s active register has been updated with Shadow register latest value. (RO)
PWM_GEN0_A_SHDW_FULL Set and reset by hardware. If set, PWM generator 0 time stamp A’s
shadow register.ister is filled and to be transferred to time stamp A’s active register. If cleared, time
stamp A’s active register has been updated with Shadow register latest value. (RO)
PWM_GEN0_B_UPMETHOD Updating method for PWM generator 0 time stamp B’s active register.
When all bits are set to 0: immediately; when bit0 is set to 1: TEZ; when bit1 is set to 1: TEP;
when bit2 is set to 1: sync; when bit3 is set to 1: disable the update. (R/W)
PWM_GEN0_A_UPMETHOD Updating method for PWM generator 0 time stamp A’s active register.
When all bits are set to 0: immediately; when bit0 is set to 1: TEZ; when bit1 is set to 1: TEP;
when bit2 is set to 1: sync; when bit3 is set to 1: disable the update. (R/W)
_G
ve
r
M
se
PW
(re
31 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
_G
rv
M
se
PW
(re
31 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
D
HO
ET
P M
L
EL
_U
E
_S
_S
G
CF
T1
T0
0_
0_
0_
EN
EN
EN
d)
_G
_G
_G
ver
M
se
PW
PW
PW
(re
31 10 9 7 6 4 3 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_GEN0_T1_SEL Source selection for PWM generator 0 event_t1, taking effect immediately. 0:
fault_event0, 1: fault_event1, 2: fault_event2, 3: sync_taken, 4: none. (R/W)
PWM_GEN0_T0_SEL Source selection for PWM generator 0 event_t0, taking effect immediately, 0:
fault_event0, 1: fault_event1, 2: fault_event2, 3: sync_taken, 4: none. (R/W)
PWM_GEN0_CFG_UPMETHOD Updating method for PWM generator 0’s active register of config-
uration. When all bits are set to 0: immediately; when bit0 is set to 1: TEZ; when bit1 is set to 1:
TEP; when bit2 is set to 1: sync; when bit3 is set to 1: disable the update. (R/W)
D
HO
DE
DE
ET
CE DE
O
RC OD
M
M
M
O
UP
E_
E_
M
M
E_
E_
RC
RC
E_
E
RC
RC
RC
FO
FO
R
O
FO
TU
TU
IF
IF
IF
IF
TU
PW EN _NC
PW EN _NC
CN
NC
NC
CN
CN
B_
A_
_G _A_
A_
_G _B
_G _B
0_
0_
0_
0_
0
0
PW EN
PW EN
EN
EN
EN
d)
_G
_G
_G
_G
ve
er
M
s
PW
PW
PW
(re
31 16 15 14 13 12 11 10 9 8 7 6 5 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x20 Reset
B
EA
EA
P
Z
EZ
TE
TE
TE
TE
TE
1
0
DT
DT
DT
UT
UT
UT
UT
_D
_D
_D
_U
_U
A_
A_
A_
A_
A_
A_
A_
A
A
0_
0_
0_
0_
0_
0_
0_
0_
0_
0_
0_
0_
EN
EN
EN
EN
EN
EN
EN
EN
EN
EN
EN
EN
)
ed
_G
_G
_G
_G
_G
_G
_G
_G
_G
_G
_G
_G
rv
M
se
PW
PW
PW
PW
PW
PW
PW
PW
PW
PW
PW
PW
(re
31 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_GEN0_A_DT0 Action on PWM0A triggered by event_t0 when the timer decreases. (R/W)
PWM_GEN0_A_DTEB Action on PWM0A triggered by event TEB when the timer decreases. (R/W)
PWM_GEN0_A_DTEA Action on PWM0A triggered by event TEA when the timer decreases. (R/W)
PWM_GEN0_A_DTEP Action on PWM0A triggered by event TEP when the timer decreases. (R/W)
PWM_GEN0_A_DTEZ Action on PWM0A triggered by event TEZ when the timer decreases. (R/W)
PWM_GEN0_A_UT1 Action on PWM0A triggered by event_t1 when the timer increases. (R/W)
PWM_GEN0_A_UT0 Action on PWM0A triggered by event_t0 when the timer increases. (R/W)
PWM_GEN0_A_UTEB Action on PWM0A triggered by event TEB when the timer increases. (R/W)
PWM_GEN0_A_UTEA Action on PWM0A triggered by event TEA when the timer increases. (R/W)
PWM_GEN0_A_UTEP Action on PWM0A triggered by event TEP when the timer increases. (R/W)
PWM_GEN0_A_UTEZ Action on PWM0A triggered by event TEZ when the timer increases. (R/W)
B
EA
EA
P
Z
EZ
TE
TE
TE
TE
TE
1
0
DT
DT
DT
UT
UT
UT
UT
_D
_D
_D
_U
_U
B_
B_
B_
B_
B_
B_
B_
B
B
0_
0_
0_
0_
0_
0_
0_
0_
0_
0_
0_
0_
EN
EN
EN
EN
EN
EN
EN
EN
EN
EN
EN
EN
)
ed
_G
_G
_G
_G
_G
_G
_G
_G
_G
_G
_G
_G
rv
M
se
PW
PW
PW
PW
PW
PW
PW
PW
PW
PW
PW
PW
(re
31 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_GEN0_B_DT0 Action on PWM0B triggered by event_t0 when the timer decreases. (R/W)
PWM_GEN0_B_DTEB Action on PWM0B triggered by event TEB when the timer decreases. (R/W)
PWM_GEN0_B_DTEA Action on PWM0B triggered by event TEA when the timer decreases. (R/W)
PWM_GEN0_B_DTEP Action on PWM0B triggered by event TEP when the timer decreases. (R/W)
PWM_GEN0_B_DTEZ Action on PWM0B triggered by event TEZ when the timer decreases. (R/W)
PWM_GEN0_B_UT1 Action on PWM0B triggered by event_t1 when the timer increases. (R/W)
PWM_GEN0_B_UT0 Action on PWM0B triggered by event_t0 when the timer increases. (R/W)
PWM_GEN0_B_UTEB Action on PWM0B triggered by event TEB when the timer increases. (R/W)
PWM_GEN0_B_UTEA Action on PWM0B triggered by event TEA when the timer increases. (R/W)
PWM_GEN0_B_UTEP Action on PWM0B triggered by event TEP when the timer increases. (R/W)
PWM_GEN0_B_UTEZ Action on PWM0B triggered by event TEZ when the timer increases. (R/W)
D
PW _D _B _IN EL RT
D
PW _D _R _IN TIN RT
HO
HO
M T0 ED BY SS
M T0 ED UT SS
M T0 ED S E
M T0 ED U E
V
EB SW P
O P
PW _D _F _O INV
ET
PW _D _F UT PA
ET
PW _D _R _O PA
_D UT A
DE
_M A
_D A T L
T0 _O SW
M T0_ OU SE
PM
PM
M T0 _O BY
M T0 _O EL
PW _D _A UT
_U
PW _D _B _S
_U
ED
M T0 LK
ED
_
PW _D _C
_R
_F
M T0
T0
T0
)
ed
PW _D
_D
_D
rv
M
se
PW
PW
PW
(re
31 18 17 16 15 14 13 12 11 10 9 8 7 4 3 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 Reset
PWM_DT0_RED_UPMETHOD Updating method for RED (rising edge delay) active register. 0: im-
mediately; when bit0 is set to 1: TEZ; when bit1 is set to 1: TEP; when bit2 is set to 1: sync; when
bit3 is set to 1: disable the update. (R/W)
PWM_DT0_FED_UPMETHOD Updating method for FED (falling edge delay) active register. 0: im-
mediately; when bit0 is set to 1: TEZ; when bit1 is set to 1: TEP; when bit2 is set to 1: sync; when
bit3 is set to 1: disable the update. (R/W)
T
ed
_D
rv
M
se
PW
(re
31 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
D
RE
0_
)
T
ed
_D
rv
M
se
PW
(re
31 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
T
ER
LE
_I T
TH
UT R
NV
CA
O VE
TY
ES
0_ _IN
SH
DU
PR
EN
ER IN
O
RI 0_
0_
0_
0_
0_
AR IER
ER
ER
ER
ER
RI
RI
RI
RI
_C R
M AR
AR
AR
AR
AR
d)
PW _C
_C
_C
_C
_C
r ve
M
se
PW
PW
PW
PW
PW
(re
31 14 13 12 11 8 7 5 4 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_CARRIER0_IN_INVERT When set, invert the input of PWM0A and PWM0B for this submodule.
(R/W)
PWM_CARRIER0_OUT_INVERT When set, invert the output of PWM0A and PWM0B for this sub-
module. (R/W)
PWM_CARRIER0_OSHWTH Width of the first pulse�in number of periods of the carrier. (R/W)
PWM_CARRIER0_PRESCALE PWM carrier0 clock (PC_clk) prescale value. Period of PC_clk = pe-
riod of PWM_clk * (PWM_CARRIER0_PRESCALE + 1). (R/W)
PWM_CARRIER0_EN When set, carrier0 function is enabled. When cleared, carrier0 is bypassed.
(R/W)
_D
_U
D
_U
_D
_U
_D
BC
M H0 0_ T
C_
C_
M H0_ 1_C C
H0 2_ C
W C
M H0 1_ T
M H0 2_ T
M H0 W T
PW _F _F _OS
BC
BC
ST
ST
ST
ST
PW _F F S
PW _F _F OS
PW _F _S OS
PW _F _F CB
_F F B
_S CB
_C
CB
CB
M H0_ 0_O
_O
_C
_O
_C
_
A_
_
_B
_B
_B
_B
_A
_A
_A
PW _F _F
_
H0
H0
H0
H0
H0
H0
H0
PW H0
M H0
d)
ve
_F
_F
_F
_F
_F
_F
_F
_F
PW _F
er
M
s
PW
PW
PW
PW
PW
PW
PW
PW
(re
31 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_FH0_B_OST_U One-shot mode action on PWM0B when a fault event occurs and the timer is
increasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH0_B_OST_D One-shot mode action on PWM0B when a fault event occurs and the timer is
decreasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH0_B_CBC_U Cycle-by-cycle mode action on PWM0B when a fault event occurs and the
timer is increasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH0_B_CBC_D Cycle-by-cycle mode action on PWM0B when a fault event occurs and the
timer is decreasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH0_A_OST_U One-shot mode action on PWM0A when a fault event occurs and the timer is
increasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH0_A_OST_D One-shot mode action on PWM0A when a fault event occurs and the timer is
decreasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH0_A_CBC_U Cycle-by-cycle mode action on PWM0A when a fault event occurs and the
timer is increasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH0_A_CBC_D Cycle-by-cycle mode action on PWM0A when a fault event occurs and the
timer is decreasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH0_F0_OST event_f0 will trigger one-shot mode action. 0: disable, 1: enable. (R/W)
PWM_FH0_F1_OST event_f1 will trigger one-shot mode action. 0: disable, 1: enable. (R/W)
PWM_FH0_F2_OST event_f2 will trigger one-shot mode action. 0: disable, 1: enable. (R/W)
PWM_FH0_SW_OST Enable register for software-forced one-shot mode action. 0: disable, 1: en-
able. (R/W)
PWM_FH0_F0_CBC event_f0 will trigger cycle-by-cycle mode action. 0: disable, 1: enable. (R/W)
PWM_FH0_F1_CBC event_f1 will trigger cycle-by-cycle mode action. 0: disable, 1: enable. (R/W)
PWM_FH0_F2_CBC event_f2 will trigger cycle-by-cycle mode action. 0: disable, 1: enable. (R/W)
BC
_C E_C T
LR SE
S
RC O
ST
_C U L
O E_
_O
H0 CP
_F C
PW H0 OR
B
_F F
M H0_
PW H0
)
ed
PW _F
_F
_F
rv
M
se
PW
(re
31 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_FH0_FORCE_OST A toggle (software negation of this bit’s value) triggers a one-shot mode
action. (R/W)
PWM_FH0_CBCPULSE The cycle-by-cycle mode action refresh moment selection. When bit0 is set
to 1: TEZ; when bit1 is set to 1: TEP. (R/W)
N
BC N
_O
_C _O
H0 ST
_F O
M H0_
)
ed
PW _F
rv
M
se
PW
(re
31 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_FH0_OST_ON Set and reset by hardware. If set, a one-shot mode action is on-going. (RO)
PWM_FH0_CBC_ON Set and reset by hardware. If set, a cycle-by-cycle mode action is on-going.
(RO)
_F LL
L
D
UL
HO
HO
D W FU
SH W_
ET
ET
M
M
A_ D
1_ SH
UP
UP
EN B_
B_
A_
_ G 1_
1_
1_
M EN
EN
EN
)
ed
PW _G
_G
_G
rv
M
se
PW
PW
PW
(re
31 10 9 8 7 4 3 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_GEN1_B_SHDW_FULL Set and reset by hardware. If set, PWM generator 1 time stamp B’s
shadow register is filled and to be transferred to time stamp B’s active register. If cleared, time
stamp B’s active register has been updated with shadow register’s latest value. (RO)
PWM_GEN1_A_SHDW_FULL Set and reset by hardware. If set, PWM generator 1 time stamp A’s
shadow register is filled and to be transferred to time stamp A’s active register. If cleared, time
stamp A’s active register has been updated with shadow register latest value. (RO)
PWM_GEN1_B_UPMETHOD Updating method for PWM generator 1 time stamp B’s active register.
0: immediately; when bit0 is set to 1: TEZ; when bit1 is set to 1: TEP; when bit2 is set to 1: sync;
when bit3 is set to 1: disable the update. (R/W)
PWM_GEN1_A_UPMETHOD Updating method for PWM generator 1 time stamp A’s active register.
0: immediately; when bit0 is set to 1: TEZ; when bit1 is set to 1: TEP; when bit2 is set to 1: sync;
when bit3 is set to 1: disable the update. (R/W)
_G
ve
r
M
se
PW
(re
31 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
_G
rv
M
se
PW
(re
31 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
D
HO
ET
P M
L
EL
_U
E
_S
_S
G
CF
T1
T0
1_
1_
1_
EN
EN
EN
d)
_G
_G
_G
ver
M
se
PW
PW
PW
(re
31 10 9 7 6 4 3 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_GEN1_T1_SEL Source selection for PWM generator1 event_t1, taking effect immediately, 0:
fault_event0, 1: fault_event1, 2: fault_event2, 3: sync_taken, 4: none. (R/W)
PWM_GEN1_T0_SEL Source selection for PWM generator1 event_t0, taking effect immediately, 0:
fault_event0, 1: fault_event1, 2: fault_event2, 3: sync_taken, 4: none. (R/W)
D
HO
DE
DE
ET
CE DE
O
RC OD
M
M
M
O
UP
E_
E_
M
M
E_
E_
RC
RC
E_
E
RC
RC
RC
FO
FO
R
O
FO
TU
TU
IF
IF
IF
IF
TU
PW EN _NC
PW EN _NC
CN
NC
NC
CN
CN
B_
A_
_G _A_
A_
_G _B
_G _B
1_
1_
1_
1_
1
1
PW EN
PW EN
EN
EN
EN
d)
_G
_G
_G
_G
ve
er
M
s
PW
PW
PW
(re
31 16 15 14 13 12 11 10 9 8 7 6 5 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x20 Reset
B
EA
EA
P
Z
EZ
TE
TE
TE
TE
TE
1
0
DT
DT
DT
UT
UT
UT
UT
_D
_D
_D
_U
_U
A_
A_
A_
A_
A_
A_
A_
A
A
1_
1_
1_
1_
1_
1_
1_
1_
1_
1_
1_
1_
EN
EN
EN
EN
EN
EN
EN
EN
EN
EN
EN
EN
)
ed
_G
_G
_G
_G
_G
_G
_G
_G
_G
_G
_G
_G
rv
M
se
PW
PW
PW
PW
PW
PW
PW
PW
PW
PW
PW
PW
(re
31 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_GEN1_A_DT0 Action on PWM1A triggered by event_t0 when the timer decreases. (R/W)
PWM_GEN1_A_DTEB Action on PWM1A triggered by event TEB when the timer decreases. (R/W)
PWM_GEN1_A_DTEA Action on PWM1A triggered by event TEA when the timer decreases. (R/W)
PWM_GEN1_A_DTEP Action on PWM1A triggered by event TEP when the timer decreases. (R/W)
PWM_GEN1_A_DTEZ Action on PWM1A triggered by event TEZ when the timer decreases. (R/W)
PWM_GEN1_A_UT1 Action on PWM1A triggered by event_t1 when the timer increases. (R/W)
PWM_GEN1_A_UT0 Action on PWM1A triggered by event_t0 when the timer increases. (R/W)
PWM_GEN1_A_UTEB Action on PWM1A triggered by event TEB when the timer increases. (R/W)
PWM_GEN1_A_UTEA Action on PWM1A triggered by event TEA when the timer increases. (R/W)
PWM_GEN1_A_UTEP Action on PWM1A triggered by event TEP when the timer increases. (R/W)
PWM_GEN1_A_UTEZ Action on PWM1A triggered by event TEZ when the timer increases. (R/W)
B
EA
EA
P
Z
EZ
TE
TE
TE
TE
TE
1
0
DT
DT
DT
UT
UT
UT
UT
_D
_D
_D
_U
_U
B_
B_
B_
B_
B_
B_
B_
B
B
1_
1_
1_
1_
1_
1_
1_
1_
1_
1_
1_
1_
EN
EN
EN
EN
EN
EN
EN
EN
EN
EN
EN
EN
)
ed
_G
_G
_G
_G
_G
_G
_G
_G
_G
_G
_G
_G
rv
M
se
PW
PW
PW
PW
PW
PW
PW
PW
PW
PW
PW
PW
(re
31 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_GEN1_B_DT0 Action on PWM1B triggered by event_t0 when the timer decreases. (R/W)
PWM_GEN1_B_DTEB Action on PWM1B triggered by event TEB when the timer decreases. (R/W)
PWM_GEN1_B_DTEA Action on PWM1B triggered by event TEA when the timer decreases. (R/W)
PWM_GEN1_B_DTEP Action on PWM1B triggered by event TEP when the timer decreases. (R/W)
PWM_GEN1_B_DTEZ Action on PWM1B triggered by event TEZ when the timer decreases. (R/W)
PWM_GEN1_B_UT1 Action on PWM1B triggered by event_t1 when the timer increases. (R/W)
PWM_GEN1_B_UT0 Action on PWM1B triggered by event_t0 when the timer increases. (R/W)
PWM_GEN1_B_UTEB Action on PWM1B triggered by event TEB when the timer increases. (R/W)
PWM_GEN1_B_UTEA Action on PWM1B triggered by event TEA when the timer increases. (R/W)
PWM_GEN1_B_UTEP Action on PWM1B triggered by event TEP when the timer increases. (R/W)
PWM_GEN1_B_UTEZ Action on PWM1B triggered by event TEZ when the timer increases. (R/W)
D
PW _D _B _IN EL RT
D
PW _D _R _IN TIN RT
HO
HO
M T1 ED BY SS
M T1 ED UT SS
M T1 ED S E
M T1 ED U E
V
EB SW P
O P
PW _D _F _O INV
ET
PW _D _F UT PA
ET
PW _D _R _O PA
_D UT A
DE
_M A
_D A T L
T1 _O SW
M T1_ OU SE
PM
PM
M T1 _O BY
M T1 _O EL
PW _D _A UT
_U
PW _D _B _S
_U
ED
M T1 LK
ED
_
PW _D _C
_R
_F
M T1
T1
T1
)
ed
PW _D
_D
_D
rv
M
se
PW
PW
PW
(re
31 18 17 16 15 14 13 12 11 10 9 8 7 4 3 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 Reset
PWM_DT1_RED_UPMETHOD Updating method for RED active register. 0: immediately; when bit0
is set to 1: TEZ; when bit1 is set to 1: TEP; when bit2 is set to 1: sync; when bit3 is set to 1:
disable the update. (R/W)
PWM_DT1_FED_UPMETHOD Updating method for FED active register. 0: immediately; when bit0
is set to 1: TEZ; when bit1 is set to 1: TEP; when bit2 is set to 1: sync; when bit3 is set to 1:
disable the update. (R/W)
T
ed
_D
rv
M
se
PW
(re
31 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
D
RE
1_
)
T
ed
_D
rv
M
se
PW
(re
31 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
T
ER
LE
_I T
TH
UT R
NV
CA
O VE
TY
ES
1_ _IN
SH
DU
PR
EN
ER IN
O
RI 1_
1_
1_
1_
1_
AR IER
ER
ER
ER
ER
RI
RI
RI
RI
_C R
M AR
AR
AR
AR
AR
d)
PW _C
_C
_C
_C
_C
r ve
M
se
PW
PW
PW
PW
PW
(re
31 14 13 12 11 8 7 5 4 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_CARRIER1_IN_INVERT When set, invert the input of PWM1A and PWM1B for this submodule.
(R/W)
PWM_CARRIER1_OUT_INVERT When set, invert the output of PWM1A and PWM1B for this sub-
module. (R/W)
PWM_CARRIER1_OSHWTH Width of the first pulse in number of periods of the carrier. (R/W)
PWM_CARRIER1_PRESCALE PWM carrier1 clock (PC_clk) prescale value. Period of PC_clk = pe-
riod of PWM_clk * (PWM_CARRIER1_PRESCALE + 1). (R/W)
PWM_CARRIER1_EN When set, carrier1 function is enabled. When cleared, carrier1 is bypassed.
(R/W)
_D
_U
D
_U
_D
_U
_D
BC
M H1 0_ T
C_
C_
M H1_ 1_C C
H1 2_ C
W C
M H1 1_ T
M H1 2_ T
M H1 W T
PW _F _F _OS
BC
BC
ST
ST
ST
ST
PW _F F S
PW _F _F OS
PW _F _S OS
PW _F _F CB
_F F B
_S CB
_C
CB
CB
M H1_ 0_O
_O
_C
_O
_C
_
A_
_
_B
_B
_B
_B
_A
_A
_A
PW _F _F
_
H1
H1
H1
H1
H1
H1
H1
PW H1
M H1
d)
ve
_F
_F
_F
_F
_F
_F
_F
_F
PW _F
er
M
s
PW
PW
PW
PW
PW
PW
PW
PW
(re
31 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_FH1_B_OST_U One-shot mode action on PWM1B when a fault event occurs and the timer is
increasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH1_B_OST_D One-shot mode action on PWM1B when a fault event occurs and the timer is
decreasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH1_B_CBC_U Cycle-by-cycle mode action on PWM1B when a fault event occurs and the
timer is increasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH1_B_CBC_D Cycle-by-cycle mode action on PWM1B when a fault event occurs and the
timer is decreasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH1_A_OST_U One-shot mode action on PWM1A when a fault event occurs and the timer is
increasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH1_A_OST_D One-shot mode action on PWM1A when a fault event occurs and the timer is
decreasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH1_A_CBC_U Cycle-by-cycle mode action on PWM1A when a fault event occurs and the
timer is increasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH1_A_CBC_D Cycle-by-cycle mode action on PWM1A when a fault event occurs and the
timer is decreasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH1_F0_OST Enable event_f0 to trigger one-shot mode action. 0: disable, 1: enable. (R/W)
PWM_FH1_F1_OST Enable event_f1 to trigger one-shot mode action. 0: disable, 1: enable. (R/W)
PWM_FH1_F2_OST Enable event_f2 to trigger one-shot mode action. 0: disable, 1: enable. (R/W)
PWM_FH1_SW_OST Enable the register for software-forced one-shot mode action. 0: disable, 1:
enable. (R/W)
PWM_FH1_F2_CBC Enable event_f2 to will trigger cycle-by-cycle mode action. 0: disable, 1: en-
able. (R/W)
PWM_FH1_SW_CBC Enable the register for software-forced cycle-by-cycle mode action. 0: disable,
1: enable. (R/W)
BC
_C E_C T
LR SE
S
RC O
ST
_C U L
O E_
_O
H1 CP
_F C
PW H1 OR
B
_F F
M H1_
PW H1
)
ed
PW _F
_F
_F
rv
M
se
PW
(re
31 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_FH1_FORCE_OST A toggle (software negation of this bit’s value) triggers a one-shot mode
action. (R/W)
PWM_FH1_CBCPULSE The cycle-by-cycle mode action refresh moment selection. When bit0 is set
to 1: TEZ; when bit1 is set to 1: TEP. (R/W)
N
BC N
_O
_C _O
H1 ST
_F O
M H1_
)
ed
PW _F
rv
M
se
PW
(re
31 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_FH1_OST_ON Set and reset by hardware. If set, a one-shot mode action is on-going. (RO)
PWM_FH1_CBC_ON Set and reset by hardware. If set, a cycle-by-cycle mode action is on-going.
(RO)
_F LL
L
D
UL
HO
HO
D W FU
SH W_
ET
ET
M
M
A_ D
2_ SH
UP
UP
EN B_
B_
A_
_ G 2_
2_
2_
M EN
EN
EN
)
ed
PW _G
_G
_G
rv
M
se
PW
PW
PW
(re
31 10 9 8 7 4 3 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_GEN2_B_SHDW_FULL Set and reset by hardware. If set, PWM generator 2 time stamp B’s
shadow register is filled and to be transferred to time stamp B’s active register. If cleared, time
stamp B’s active register has been updated with shadow register’s latest value. (RO)
PWM_GEN2_A_SHDW_FULL Set and reset by hardware. If set, PWM generator 2 time stamp A’s
shadow register is filled and to be transferred to time stamp A’s active register. If cleared, time
stamp A’s active register has been updated with shadow register’s latest value. (RO)
PWM_GEN2_B_UPMETHOD Updating method for PWM generator 2 time stamp B’s active register.
0: immediately; when bit0 is set to 1: TEZ; when bit1 is set to 1: TEP; when bit2 is set to 1: sync;
when bit3 is set to 1: disable the update. (R/W)
PWM_GEN2_A_UPMETHOD Updating method for PWM generator 2 time stamp A’s active register.
0: immediately; when bit0 is set to 1: TEZ; when bit1 is set to 1: TEP; when bit2 is set to 1: sync;
when bit3 is set to 1: disable the update. (R/W)
_G
ve
r
M
se
PW
(re
31 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
_G
rv
M
se
PW
(re
31 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
D
HO
ET
P M
L
EL
_U
E
_S
_S
G
CF
T1
T0
2_
2_
2_
EN
EN
EN
d)
_G
_G
_G
ver
M
se
PW
PW
PW
(re
31 10 9 7 6 4 3 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_GEN2_T1_SEL Source selection for PWM generator2 event_t1, take effect immediately, 0:
fault_event0, 1: fault_event1, 2: fault_event2, 3: sync_taken, 4: none. (R/W)
PWM_GEN2_T0_SEL Source selection for PWM generator2 event_t0, take effect immediately, 0:
fault_event0, 1: fault_event1, 2: fault_event2, 3: sync_taken, 4: none. (R/W)
D
HO
DE
DE
ET
CE DE
O
RC OD
M
M
M
O
UP
E_
E_
M
M
E_
E_
RC
RC
E_
E
RC
RC
RC
FO
FO
R
O
FO
TU
TU
IF
IF
IF
IF
TU
PW EN _NC
PW EN _NC
CN
NC
NC
CN
CN
B_
A_
_G _A_
A_
_G _B
_G _B
2_
2_
2_
2_
2
2
PW EN
PW EN
EN
EN
EN
d)
_G
_G
_G
_G
ve
er
M
s
PW
PW
PW
(re
31 16 15 14 13 12 11 10 9 8 7 6 5 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x20 Reset
B
EA
EA
P
Z
EZ
TE
TE
TE
TE
TE
1
0
DT
DT
DT
UT
UT
UT
UT
_D
_D
_D
_U
_U
A_
A_
A_
A_
A_
A_
A_
A
A
2_
2_
2_
2_
2_
2_
2_
2_
2_
2_
2_
2_
EN
EN
EN
EN
EN
EN
EN
EN
EN
EN
EN
EN
)
ed
_G
_G
_G
_G
_G
_G
_G
_G
_G
_G
_G
_G
rv
M
se
PW
PW
PW
PW
PW
PW
PW
PW
PW
PW
PW
PW
(re
31 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_GEN2_A_DT0 Action on PWM2A triggered by event_t0 when the timer decreases. (R/W)
PWM_GEN2_A_DTEB Action on PWM2A triggered by event TEB when the timer decreases. (R/W)
PWM_GEN2_A_DTEA Action on PWM2A triggered by event TEA when the timer decreases. (R/W)
PWM_GEN2_A_DTEP Action on PWM2A triggered by event TEP when the timer decreases. (R/W)
PWM_GEN2_A_DTEZ Action on PWM2A triggered by event TEZ when the timer decreases. (R/W)
PWM_GEN2_A_UT1 Action on PWM2A triggered by event_t1 when the timer increases. (R/W)
PWM_GEN2_A_UT0 Action on PWM2A triggered by event_t0 when the timer increases. (R/W)
PWM_GEN2_A_UTEB Action on PWM2A triggered by event TEB when the timer increases. (R/W)
PWM_GEN2_A_UTEA Action on PWM2A triggered by event TEA when the timer increases. (R/W)
PWM_GEN2_A_UTEP Action on PWM2A triggered by event TEP when the timer increases. (R/W)
PWM_GEN2_A_UTEZ Action on PWM2A triggered by event TEZ when the timer increases. (R/W)
B
EA
EA
P
Z
EZ
TE
TE
TE
TE
TE
1
0
DT
DT
DT
UT
UT
UT
UT
_D
_D
_D
_U
_U
B_
B_
B_
B_
B_
B_
B_
B
B
2_
2_
2_
2_
2_
2_
2_
2_
2_
2_
2_
2_
EN
EN
EN
EN
EN
EN
EN
EN
EN
EN
EN
EN
)
ed
_G
_G
_G
_G
_G
_G
_G
_G
_G
_G
_G
_G
rv
M
se
PW
PW
PW
PW
PW
PW
PW
PW
PW
PW
PW
PW
(re
31 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_GEN2_B_DT0 Action on PWM2B triggered by event_t0 when the timer decreases. (R/W)
PWM_GEN2_B_DTEB Action on PWM2B triggered by event TEB when the timer decreases. (R/W)
PWM_GEN2_B_DTEA Action on PWM2B triggered by event TEA when the timer decreases. (R/W)
PWM_GEN2_B_DTEP Action on PWM2B triggered by event TEP when the timer decreases. (R/W)
PWM_GEN2_B_DTEZ Action on PWM2B triggered by event TEZ when the timer decreases. (R/W)
PWM_GEN2_B_UT1 Action on PWM2B triggered by event_t1 when the timer increases. (R/W)
PWM_GEN2_B_UT0 Action on PWM2B triggered by event_t0 when the timer increases. (R/W)
PWM_GEN2_B_UTEB Action on PWM2B triggered by event TEB when the timer increases. (R/W)
PWM_GEN2_B_UTEA Action on PWM2B triggered by event TEA when the timer increases. (R/W)
PWM_GEN2_B_UTEP Action on PWM2B triggered by event TEP when the timer increases. (R/W)
PWM_GEN2_B_UTEZ Action on PWM2B triggered by event TEZ when the timer increases. (R/W)
D
PW _D _B _IN EL RT
D
PW _D _R _IN TIN RT
HO
HO
M T2 ED BY SS
M T2 ED UT SS
M T2 ED S E
M T2 ED U E
V
EB SW P
O P
PW _D _F _O INV
ET
PW _D _F UT PA
ET
PW _D _R _O PA
_D UT A
DE
_M A
_D A T L
T2 _O SW
M T2_ OU SE
PM
PM
M T2 _O BY
M T2 _O EL
PW _D _A UT
_U
PW _D _B _S
_U
ED
M T2 LK
ED
_
PW _D _C
_R
_F
M T2
T2
T2
)
ed
PW _D
_D
_D
rv
M
se
PW
PW
PW
(re
31 18 17 16 15 14 13 12 11 10 9 8 7 4 3 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 Reset
PWM_DT2_RED_UPMETHOD Updating method for RED (rising edge delay) active register. 0: im-
mediately; when bit0 is set to 1: TEZ; when bit1 is set to 1: TEP; when bit2 is set to 1: sync; when
bit3 is set to 1: disable the update. (R/W)
PWM_DT2_FED_UPMETHOD Updating method for FED (falling edge delay) active register. 0: im-
mediately; when bit0 is set to 1: TEZ; when bit1 is set to 1: TEP; when bit2 is set to 1: sync; when
bit3 is set to 1: disable the update. (R/W)
T
ed
_D
rv
M
se
PW
(re
31 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
D
RE
2_
)
T
ed
_D
rv
M
se
PW
(re
31 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
T
ER
LE
_I T
TH
UT R
NV
CA
O VE
TY
ES
2_ _IN
SH
DU
PR
EN
ER IN
O
RI 2_
2_
2_
2_
2_
AR IER
ER
ER
ER
ER
RI
RI
RI
RI
_C R
M AR
AR
AR
AR
AR
d)
PW _C
_C
_C
_C
_C
r ve
M
se
PW
PW
PW
PW
PW
(re
31 14 13 12 11 8 7 5 4 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_CARRIER2_IN_INVERT When set, invert the input of PWM2A and PWM2B for this submodule.
(R/W)
PWM_CARRIER2_OUT_INVERT When set, invert the output of PWM2A and PWM2B for this sub-
module. (R/W)
PWM_CARRIER2_OSHWTH Width of the first pulse in number of periods of the carrier. (R/W)
PWM_CARRIER2_PRESCALE PWM carrier2 clock (PC_clk) prescale value. Period of PC_clk = pe-
riod of PWM_clk * (PWM_CARRIER2_PRESCALE + 1). (R/W)
PWM_CARRIER2_EN When set, carrier2 function is enabled. When cleared, carrier2 is bypassed.
(R/W)
_D
_U
D
_U
_D
_U
_D
BC
M H2 0_ T
C_
C_
M H2_ 1_C C
H2 2_ C
W C
M H2 1_ T
M H2 2_ T
M H2 W T
PW _F _F _OS
BC
BC
ST
ST
ST
ST
PW _F F S
PW _F _F OS
PW _F _S OS
PW _F _F CB
_F F B
_S CB
_C
CB
CB
M H2_ 0_O
_O
_C
_O
_C
_
A_
_
_B
_B
_B
_B
_A
_A
_A
PW _F _F
_
H2
H2
H2
H2
H2
H2
H2
PW H2
M H2
d)
ve
_F
_F
_F
_F
_F
_F
_F
_F
PW _F
er
M
s
PW
PW
PW
PW
PW
PW
PW
PW
(re
31 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_FH2_B_OST_U One-shot mode action on PWM2B when a fault event occurs and the timer is
increasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH2_B_OST_D One-shot mode action on PWM2B when a fault event occurs and the timer is
decreasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH2_B_CBC_U Cycle-by-cycle mode action on PWM2B when a fault event occurs and the
timer is increasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH2_B_CBC_D Cycle-by-cycle mode action on PWM2B when a fault event occurs and the
timer is decreasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH2_A_OST_U One-shot mode action on PWM2A when a fault event occurs and the timer is
increasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH2_A_OST_D One-shot mode action on PWM2A when a fault event occurs and the timer is
decreasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH2_A_CBC_U Cycle-by-cycle mode action on PWM2A when a fault event occurs and the
timer is increasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH2_A_CBC_D Cycle-by-cycle mode action on PWM2A when a fault event occurs and the
timer is decreasing. 0: do nothing, 1: force low, 2: force high, 3: toggle. (R/W)
PWM_FH2_F0_OST event_f0 will trigger one-shot mode action. 0: disable, 1: enable. (R/W)
PWM_FH2_F1_OST event_f1 will trigger one-shot mode action. 0: disable, 1: enable. (R/W)
PWM_FH2_F2_OST event_f2 will trigger one-shot mode action. 0: disable, 1: enable. (R/W)
PWM_FH2_SW_OST Enable register for software-forced one-shot mode action. 0: disable, 1: en-
able. (R/W)
PWM_FH2_F0_CBC event_f0 will trigger cycle-by-cycle mode action. 0: disable, 1: enable. (R/W)
PWM_FH2_F1_CBC event_f1 will trigger cycle-by-cycle mode action. 0: disable, 1: enable. (R/W)
PWM_FH2_F2_CBC event_f2 will trigger cycle-by-cycle mode action. 0: disable, 1: enable. (R/W)
BC
_C E_C T
LR SE
S
RC O
ST
_C U L
O E_
_O
H2 CP
_F C
PW H2 OR
B
_F F
M H2_
PW H2
)
ed
PW _F
_F
_F
rv
M
se
PW
(re
31 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_FH2_FORCE_OST A toggle (software negation of this bit’s value) triggers a one-shot mode
action. (R/W)
PWM_FH2_CBCPULSE The cycle-by-cycle mode action refresh moment selection. When bit0 is set
to 1: TEZ; when bit1 is set to 1:TEP. (R/W)
N
BC N
_O
_C _O
H2 ST
_F O
M H2_
)
ed
PW _F
rv
M
se
PW
(re
31 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_FH2_OST_ON Set and reset by hardware. If set, a one-shot mode action is on-going. (RO)
PWM_FH2_CBC_ON Set and reset by hardware. If set, a cycle-by-cycle mode action is on-going.
(RO)
PW _E NT 2
PW _F NT 1
PW _F PO 0
M 1_ LE
M 0_ LE
M 2_ LE
M VE _F
M VE _F
M 2_ _F
PW _E NT
PW _F PO
PW _F PO
PW _F EN
_F N
EN
M 1_E
M VE
0_
)
ed
PW _E
rv
M
se
PW
(re
31 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_F2_POLE Set event_f2 trigger polarity on FAULT2 source from GPIO matrix. 0: level low, 1:
level high. (R/W)
PWM_F1_POLE Set event_f1 trigger polarity on FAULT2 source from GPIO matrix. 0: level low, 1:
level high. (R/W)
PWM_F0_POLE Set event_f0 trigger polarity on FAULT2 source from GPIO matrix. 0: level low, 1:
level high. (R/W)
EL
W
ER N
N
_S
IM I_E
_E
_S
CI
NC
_T C
YN
AP YN
SY
_S
_C _S
P_
AP
M AP
)
A
ed
_C
_C
PW _C
rv
M
se
PW
PW
PW
(re
31 6 5 4 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_CAP_SYNC_SW Set this bit to force a capture timer sync; the capture timer is loaded with the
value in the phase register. (WO)
PWM_CAP_TIMER_EN When set, the capture timer incrementing under APB_clk is enabled. (R/W)
31 0
0 Reset
PWM_CAP_TIMER_PHASE_REG Phase value for the capture timer sync operation. (R/W)
LE
RT
CA
E
NV
E
ES
AP OD
_I
AP SW
PR
EN
IN
_C _M
_C 0_
0_
0_
0_
0
M AP
AP
PW AP
d)
PW _C
_C
_C
ver
M
se
PW
PW
PW
(re
31 13 12 11 10 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_CAP0_IN_INVERT When set, CAP0 form GPIO matrix is inverted before prescaling. (R/W)
PWM_CAP0_MODE Edge of capture on channel 0 after prescaling. When bit0 is set to 1: enable
capture on the negative edge; When bit1 is set to 1: enable capture on the positive edge. (R/W)
CA
VE
E
ES
N
AP OD
_I
AP SW
PR
EN
IN
_C _M
_C 1_
1_
1_
1_
1
M AP
AP
PW AP
)
ed
PW _C
_C
_C
rv
M
se
PW
PW
PW
(re
31 13 12 11 10 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_CAP1_IN_INVERT When set, CAP1 form GPIO matrix is inverted before prescaling. (R/W)
PWM_CAP1_MODE Edge of capture on channel 1 after prescaling. When bit0 is set to 1: enable
capture on the negative edge; When bit1 is set to 1: enable capture on the positive edge. (R/W)
LE
RT
CA
E
NV
E
ES
AP OD
_I
AP SW
PR
EN
IN
_C _M
_C 2_
2_
2_
2_
2
M AP
AP
PW AP
)
ed
PW _C
_C
_C
rv
M
se
PW
PW
PW
(re
31 13 12 11 10 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_CAP2_IN_INVERT When set, CAP2 form GPIO matrix is inverted before prescaling. (R/W)
PWM_CAP2_MODE Edge of capture on channel 2 after prescaling. When bit0 is set to 1: enable
capture on the negative edge; when bit1 is set to 1: enable capture on the positive edge. (R/W)
31 0
0 Reset
31 0
0 Reset
31 0
0 Reset
_C 1_ G E
0_ GE
E
G
M AP ED
AP ED
ED
PW _C 2_
M AP
)
ed
PW _C
rv
M
se
PW
(re
31 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PWM_CAP2_EDGE Edge of the last capture trigger on channel 2. 0: posedge; 1: negedge. (RO)
PWM_CAP1_EDGE Edge of the last capture trigger on channel 1. 0: posedge; 1: negedge. (RO)
PWM_CAP0_EDGE Edge of the last capture trigger on channel 0. 0: posedge; 1: negedge. (RO)
_E _UP
UP E
PW _O 1_F _EN UP
PW _O 0_F _EN UP
_G B EN P
N
L_ RC
M LO P_ _U
M P P _
M P P _
PW _O 2_U CE
PW _O 1_U CE
PW _G 0_U CE
BA FO
M P OR
M P OR
M P OR
LO AL_
PW _O _F
M P2
)
ed
PW _O
rv
M
se
PW
(re
31 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 Reset
PWM_OP2_FORCE_UP A toggle (software negation of this bit’s value) will trigger a forced update of
active registers in PWM operator 2. (R/W)
PWM_OP2_UP_EN When set and PWM_GLOBAL_UP_EN is set, update of active registers in PWM
operator 2 are enabled (R/W)
PWM_OP1_FORCE_UP A toggle (software negation of this bit’s value) will trigger a forced update of
active registers in PWM operator 1. (R/W)
PWM_OP1_UP_EN When set and PWM_GLOBAL_UP_EN is set, update of active registers in PWM
operator 1 are enabled. (R/W)
PWM_OP0_FORCE_UP A toggle (software negation of this bit’s value) will trigger a forced update of
active registers in PWM operator 0. (R/W)
PWM_OP0_UP_EN When set and PWM_GLOBAL_UP_EN is set, update of active registers in PWM
operator 0 are enabled. (R/W)
PWM_GLOBAL_FORCE_UP A toggle (software negation of this bit’s value) will trigger a forced update
of all active registers in the MCPWM module. (R/W)
PWM_GLOBAL_UP_EN The global enable of update of all active registers in the MCPWM module.
(R/W)
O NT NA
T_ A
A
IN N
EN
IN FAU T2_ R_ T_E A
IN FAU T1_ T_E T_E A
IN TIM T0_ T_E A A
T _ E T E IN N
T _ E TE IN N
T_ E TE IN N
T_ E TE IN N
T _ E S IN N
M _ P EN
IN AU 0_ R_ T_E
IN OP CB INT NA
IN OP TEB INT NA
IN OP TEB INT NA
0_ OP NT
IN TIM R2_ T_E A
IN TIM R1_ P_ A
T_ 0_ C_ _E
T_ 2_ C_ _E
T_ 1_ _ _E
T_ 0_ _ _E
T_ 2_ _ _E
T_ 1_ _ _E
T_ 0_ T_ _E
T_ 2_ T_ _E
T_ 1_ C_ _E
T_ 0_ _ _E
T _ L _ _E
T _ L C _E
ER ST _I
T_ L C IN
T_ E IN N
T_ E TE N
T_ E TE IN
T_ P0 T_ A
T_ 2_ T_ A
T_ 1_ T_ A
IN CA _IN EN
IN FH _IN EN
IN FH OS EN
IN FH OS INT
L
L
L
T_ P1 T_
IN CA _IN
T
T_ P2
T_ )
d
ve
IN A C
F
er
s
(re
IN
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
INT_CAP2_INT_ENA The enable bit for the interrupt triggered by capture on channel 2. (R/W)
INT_CAP1_INT_ENA The enable bit for the interrupt triggered by capture on channel 1. (R/W)
INT_CAP0_INT_ENA The enable bit for the interrupt triggered by capture on channel 0. (R/W)
INT_FH2_OST_INT_ENA The enable bit for the interrupt triggered by a one-shot mode action on
PWM2. (R/W)
INT_FH1_OST_INT_ENA The enable bit for the interrupt triggered by a one-shot mode action on
PWM0. (R/W)
INT_FH0_OST_INT_ENA The enable bit for the interrupt triggered by a one-shot mode action on
PWM0. (R/W)
INT_FH2_CBC_INT_ENA The enable bit for the interrupt triggered by a cycle-by-cycle mode action
on PWM2. (R/W)
INT_FH1_CBC_INT_ENA The enable bit for the interrupt triggered by a cycle-by-cycle mode action
on PWM1. (R/W)
INT_FH0_CBC_INT_ENA The enable bit for the interrupt triggered by a cycle-by-cycle mode action
on PWM0. (R/W)
INT_OP2_TEB_INT_ENA The enable bit for the interrupt triggered by a PWM operator 2 TEB event
(R/W)
INT_OP1_TEB_INT_ENA The enable bit for the interrupt triggered by a PWM operator 1 TEB event
(R/W)
INT_OP0_TEB_INT_ENA The enable bit for the interrupt triggered by a PWM operator 0 TEB event
(R/W)
INT_OP2_TEA_INT_ENA The enable bit for the interrupt triggered by a PWM operator 2 TEA event
(R/W)
INT_OP1_TEA_INT_ENA The enable bit for the interrupt triggered by a PWM operator 1 TEA event
(R/W)
INT_OP0_TEA_INT_ENA The enable bit for the interrupt triggered by a PWM operator 0 TEA event
(R/W)
INT_FAULT2_CLR_INT_ENA The enable bit for the interrupt triggered when event_f2 ends. (R/W)
INT_FAULT1_CLR_INT_ENA The enable bit for the interrupt triggered when event_f1 ends. (R/W)
INT_FAULT0_CLR_INT_ENA The enable bit for the interrupt triggered when event_f0 ends. (R/W)
INT_FAULT2_INT_ENA The enable bit for the interrupt triggered when event_f2 starts. (R/W)
INT_FAULT1_INT_ENA The enable bit for the interrupt triggered when event_f1 starts. (R/W)
INT_FAULT0_INT_ENA The enable bit for the interrupt triggered when event_f0 starts. (R/W)
INT_TIMER2_TEP_INT_ENA The enable bit for the interrupt triggered by a PWM timer 2 TEP event.
(R/W)
INT_TIMER1_TEP_INT_ENA The enable bit for the interrupt triggered by a PWM timer 1 TEP event.
(R/W)
Continued on the next page...
INT_TIMER0_TEP_INT_ENA The enable bit for the interrupt triggered by a PWM timer 0 TEP event.
(R/W)
INT_TIMER2_TEZ_INT_ENA The enable bit for the interrupt triggered by a PWM timer 2 TEZ event.
(R/W)
INT_TIMER1_TEZ_INT_ENA The enable bit for the interrupt triggered by a PWM timer 1 TEZ event.
(R/W)
INT_TIMER0_TEZ_INT_ENA The enable bit for the interrupt triggered by a PWM timer 0 TEZ event.
(R/W)
INT_TIMER2_STOP_INT_ENA The enable bit for the interrupt triggered when the timer 2 stops. (R/W)
INT_TIMER1_STOP_INT_ENA The enable bit for the interrupt triggered when the timer 1 stops. (R/W)
INT_TIMER0_STOP_INT_ENA The enable bit for the interrupt triggered when the timer 0 stops. (R/W)
O NT AW
T_ W
W
IN FAU T2_ R_ T_R W
IN FAU T1_ T_R T_R W
IN TIM T0_ T_R W W
IN A
RA
ST _I _R
P_ _R
T_ L C IN A
T_ L IN IN A
T_ L IN A A
T _ E T E IN A
T _ E TE IN A
T_ E TE IN A
T_ E TE IN A
T _ E S IN A
IN OP CB INT AW
IN OP TEB INT AW
IN OP TEB INT AW
IN OP TEB INT AW
IN OP TEA INT AW
IN OP TEA INT AW
IN AU 0_ R_ T_R
IN FH OS INT AW
IN FH CB INT AW
IN FH CB INT AW
T_ 0_ _ _R
T _ L _ _R
T _ L C _R
T_ P0 T_ W
T_ 2_ T_ W
T_ 1_ T_ W
T_ L C IN
T_ E IN A
T_ E TE A
T_ E TE IN
IN CA _IN RA
IN FH _IN RA
IN FH OS RA
IN FH OS INT
L
L
L
T_ P1 T_
IN CA _IN
T
T_ P2
T_ )
ed
IN CA
rv
F
se
(re
IN
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
INT_CAP2_INT_RAW The raw status bit for the interrupt triggered by capture on channel 2. (RO)
INT_CAP1_INT_RAW The raw status bit for the interrupt triggered by capture on channel 1. (RO)
INT_CAP0_INT_RAW The raw status bit for the interrupt triggered by capture on channel 0. (RO)
INT_FH2_OST_INT_RAW The raw status bit for the interrupt triggered by a one-shot mode action on
PWM2. (RO)
INT_FH1_OST_INT_RAW The raw status bit for the interrupt triggered by a one-shot mode action on
PWM0. (RO)
INT_FH0_OST_INT_RAW The raw status bit for the interrupt triggered by a one-shot mode action on
PWM0. (RO)
INT_FH2_CBC_INT_RAW The raw status bit for the interrupt triggered by a cycle-by-cycle mode
action on PWM2. (RO)
INT_FH1_CBC_INT_RAW The raw status bit for the interrupt triggered by a cycle-by-cycle mode
action on PWM1. (RO)
INT_FH0_CBC_INT_RAW The raw status bit for the interrupt triggered by a cycle-by-cycle mode
action on PWM0. (RO)
INT_OP2_TEB_INT_RAW The raw status bit for the interrupt triggered by a PWM operator 2 TEB
event. (RO)
INT_OP1_TEB_INT_RAW The raw status bit for the interrupt triggered by a PWM operator 1 TEB
event. (RO)
INT_OP0_TEB_INT_RAW The raw status bit for the interrupt triggered by a PWM operator 0 TEB
event. (RO)
INT_OP2_TEA_INT_RAW The raw status bit for the interrupt triggered by a PWM operator 2 TEA
event. (RO)
INT_OP1_TEA_INT_RAW The raw status bit for the interrupt triggered by a PWM operator 1 TEA
event. (RO)
INT_OP0_TEA_INT_RAW The raw status bit for the interrupt triggered by a PWM operator 0 TEA
event. (RO)
INT_FAULT2_CLR_INT_RAW The raw status bit for the interrupt triggered when event_f2 ends. (RO)
INT_FAULT1_CLR_INT_RAW The raw status bit for the interrupt triggered when event_f1 ends. (RO)
INT_FAULT0_CLR_INT_RAW The raw status bit for the interrupt triggered when event_f0 ends. (RO)
INT_FAULT2_INT_RAW The raw status bit for the interrupt triggered when event_f2 starts. (RO)
INT_FAULT1_INT_RAW The raw status bit for the interrupt triggered when event_f1 starts. (RO)
INT_FAULT0_INT_RAW The raw status bit for the interrupt triggered when event_f0 starts. (RO)
INT_TIMER2_TEP_INT_RAW The raw status bit for the interrupt triggered by a PWM timer 2 TEP
event. (RO)
INT_TIMER1_TEP_INT_RAW The raw status bit for the interrupt triggered by a PWM timer 1 TEP
event. (RO)
Continued on the next page...
INT_TIMER0_TEP_INT_RAW The raw status bit for the interrupt triggered by a PWM timer 0 TEP
event. (RO)
INT_TIMER2_TEZ_INT_RAW The raw status bit for the interrupt triggered by a PWM timer 2 TEZ
event. (RO)
INT_TIMER1_TEZ_INT_RAW The raw status bit for the interrupt triggered by a PWM timer 1 TEZ
event. (RO)
INT_TIMER0_TEZ_INT_RAW The raw status bit for the interrupt triggered by a PWM timer 0 TEZ
event. (RO)
INT_TIMER2_STOP_INT_RAW The raw status bit for the interrupt triggered when the timer 2 stops.
(RO)
INT_TIMER1_STOP_INT_RAW The raw status bit for the interrupt triggered when the timer 1 stops.
(RO)
INT_TIMER0_STOP_INT_RAW The raw status bit for the interrupt triggered when the timer 0 stops.
(RO)
O NT T
IN T
ST
ST _I _S
P_ _S
T_ L C IN T
T_ L IN IN T
T_ L IN T T
T _ E T E IN T
T _ E TE IN T
T_ E TE IN T
T_ E TE IN T
T _ E S IN T
M _ P ST
T_
IN AU 0_ R_ T_S
IN FAU T2_ R_ T_S
IN FAU T1_ T_S T_S
0_ OP NT
TI R1 TO T_
IN OP CB INT T
IN OP TEB INT T
IN OP TEB INT T
IN OP TEB INT T
IN OP TEA INT T
IN OP TEA INT T
IN FH OS INT T
IN FH CB INT T
IN FH CB INT T
T_ 0_ _ _S
T _ L _ _S
T _ L C _S
ER ST _I
T_ L C IN
T_ E TE IN
T_ E IN T
T_ E TE T
IN TIM T0_ T_S
IN TIM R2_ T_S
IN FH OS INT
IN TIM R1_ P_
IN CA _IN ST
IN FH _IN ST
IN FH OS ST
L
L
L
T_ P1 T_
T_ P0 T_
T_ 2_ T_
T_ 1_ T_
IN CA _IN
T
T_ P2
T_ )
ed
IN CA
rv
F
se
(re
IN
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
INT_CAP2_INT_ST The masked status bit for the interrupt triggered by capture on channel 2. (RO)
INT_CAP1_INT_ST The masked status bit for the interrupt triggered by capture on channel 1. (RO)
INT_CAP0_INT_ST The masked status bit for the interrupt triggered by capture on channel 0. (RO)
INT_FH2_OST_INT_ST The masked status bit for the interrupt triggered by a one-shot mode action
on PWM2. (RO)
INT_FH1_OST_INT_ST The masked status bit for the interrupt triggered by a one-shot mode action
on PWM1. (RO)
INT_FH0_OST_INT_ST The masked status bit for the interrupt triggered by a one-shot mode action
on PWM0. (RO)
INT_FH2_CBC_INT_ST The masked status bit for the interrupt triggered by a cycle-by-cycle mode
action on PWM2. (RO)
INT_FH1_CBC_INT_ST The masked status bit for the interrupt triggered by a cycle-by-cycle mode
action on PWM1. (RO)
INT_FH0_CBC_INT_ST The masked status bit for the interrupt triggered by a cycle-by-cycle mode
action on PWM0. (RO)
INT_OP2_TEB_INT_ST The masked status bit for the interrupt triggered by a PWM operator 2 TEB
event. (RO)
INT_OP1_TEB_INT_ST The masked status bit for the interrupt triggered by a PWM operator 1 TEB
event. (RO)
INT_OP0_TEB_INT_ST The masked status bit for the interrupt triggered by a PWM operator 0 TEB
event. (RO)
INT_OP2_TEA_INT_ST The masked status bit for the interrupt triggered by a PWM operator 2 TEA
event. (RO)
INT_OP1_TEA_INT_ST The masked status bit for the interrupt triggered by a PWM operator 1 TEA
event. (RO)
INT_OP0_TEA_INT_ST The masked status bit for the interrupt triggered by a PWM operator 0 TEA
event. (RO)
INT_FAULT2_CLR_INT_ST The masked status bit for the interrupt triggered when event_f2 ends.
(RO)
INT_FAULT1_CLR_INT_ST The masked status bit for the interrupt triggered when event_f1 ends.
(RO)
INT_FAULT0_CLR_INT_ST The masked status bit for the interrupt triggered when event_f0 ends.
(RO)
INT_FAULT2_INT_ST The masked status bit for the interrupt triggered when event_f2 starts. (RO)
Continued on the next page...
INT_FAULT1_INT_ST The masked status bit for the interrupt triggered when event_f1 starts. (RO)
INT_FAULT0_INT_ST The masked status bit for the interrupt triggered when event_f0 starts. (RO)
INT_TIMER2_TEP_INT_ST The masked status bit for the interrupt triggered by a PWM timer 2 TEP
event. (RO)
INT_TIMER1_TEP_INT_ST The masked status bit for the interrupt triggered by a PWM timer 1 TEP
event. (RO)
INT_TIMER0_TEP_INT_ST The masked status bit for the interrupt triggered by a PWM timer 0 TEP
event. (RO)
INT_TIMER2_TEZ_INT_ST The masked status bit for the interrupt triggered by a PWM timer 2 TEZ
event. (RO)
INT_TIMER1_TEZ_INT_ST The masked status bit for the interrupt triggered by a PWM timer 1 TEZ
event. (RO)
INT_TIMER0_TEZ_INT_ST The masked status bit for the interrupt triggered by a PWM timer 0 TEZ
event. (RO)
INT_TIMER2_STOP_INT_ST The masked status bit for the interrupt triggered when the timer 2 stops.
(RO)
INT_TIMER1_STOP_INT_ST The masked status bit for the interrupt triggered when the timer 1 stops.
(RO)
INT_TIMER0_STOP_INT_ST The masked status bit for the interrupt triggered when the timer 0 stops.
(RO)
O NT LR
T_ R
R
IN L
CL
IN FAU T2_ R_ T_C R
IN FAU T1_ T_C T_C R
IN TIM T0_ T_C R R
R
R
R
R
TI R1 TO T_ R
ER ST _I LR
ST _I _C
P_ _C
T_ L C IN L
T_ L IN IN L
T_ L IN L L
T _ E T E IN L
T _ E TE IN L
T_ E TE IN L
T_ E TE IN L
T _ E S IN L
IN AU 0_ R_ T_C
0_ OP NT
IN TIM R2_ T_C R
IN TIM R1_ P_ R
T
T_ 0_ C_ _C
T_ 2_ C_ _C
T_ 1_ _ _C
T_ 0_ _ _C
T_ 2_ _ _C
T_ 1_ _ _C
T_ 0_ T_ _C
T_ 2_ T_ _C
T_ 1_ C_ _C
T_ 0_ _ _C
T _ L _ _C
T _ L C _C
T_ L C IN
T_ E TE IN
T_ E IN L
T_ E TE L
T_ P0 T_ R
T_ 2_ T_ R
T_ 1_ T_ R
IN CA _IN CL
IN FH _IN CL
IN FH OS CL
IN FH OS INT
L
L
L
T_ P1 T_
IN CA _IN
R
T
T_ P2
T_ )
ed
IN CA
rv
F
se
(re
IN
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
INT_CAP2_INT_CLR Set this bit to clear interrupt triggered by capture on channel 2. (WO)
INT_CAP1_INT_CLR Set this bit to clear interrupt triggered by capture on channel 1. (WO)
INT_CAP0_INT_CLR Set this bit to clear interrupt triggered by capture on channel 0. (WO)
INT_FH2_OST_INT_CLR Set this bit to clear interrupt triggered by a one-shot mode action on PWM2.
(WO)
INT_FH1_OST_INT_CLR Set this bit to clear interrupt triggered by a one-shot mode action on PWM1.
(WO)
INT_FH0_OST_INT_CLR Set this bit to clear interrupt triggered by a one-shot mode action on PWM0.
(WO)
INT_FH2_CBC_INT_CLR Set this bit to clear interrupt triggered by a cycle-by-cycle mode action on
PWM2. (WO)
INT_FH1_CBC_INT_CLR Set this bit to clear interrupt triggered by a cycle-by-cycle mode action on
PWM1. (WO)
INT_FH0_CBC_INT_CLR Set this bit to clear interrupt triggered by a cycle-by-cycle mode action on
PWM0. (WO)
INT_OP2_TEB_INT_CLR Set this bit to clear interrupt triggered by a PWM operator 2 TEB event.
(WO)
INT_OP1_TEB_INT_CLR Set this bit to clear interrupt triggered by a PWM operator 1 TEB event.
(WO)
INT_OP0_TEB_INT_CLR Set this bit to clear interrupt triggered by a PWM operator 0 TEB event.
(WO)
INT_OP2_TEA_INT_CLR Set this bit to clear interrupt triggered by a PWM operator 2 TEA event.
(WO)
INT_OP1_TEA_INT_CLR Set this bit to clear interrupt triggered by a PWM operator 1 TEA event.
(WO)
INT_OP0_TEA_INT_CLR Set this bit to clear interrupt triggered by a PWM operator 0 TEA event.
(WO)
INT_FAULT2_CLR_INT_CLR Set this bit to clear interrupt triggered when event_f2 ends. (WO)
INT_FAULT1_CLR_INT_CLR Set this bit to clear interrupt triggered when event_f1 ends. (WO)
INT_FAULT0_CLR_INT_CLR Set this bit to clear interrupt triggered when event_f0 ends. (WO)
INT_FAULT2_INT_CLR Set this bit to clear interrupt triggered when event_f2 starts. (WO)
INT_FAULT1_INT_CLR Set this bit to clear interrupt triggered when event_f1 starts. (WO)
INT_FAULT0_INT_CLR Set this bit to clear interrupt triggered when event_f0 starts. (WO)
INT_TIMER2_TEP_INT_CLR Set this bit to clear interrupt triggered by a PWM timer 2 TEP event.
(WO)
Continued on the next page...
INT_TIMER1_TEP_INT_CLR Set this bit to clear interrupt triggered by a PWM timer 1 TEP event.
(WO)
INT_TIMER0_TEP_INT_CLR Set this bit to clear interrupt triggered by a PWM timer 0 TEP event.
(WO)
INT_TIMER2_TEZ_INT_CLR Set this bit to clear interrupt triggered by a PWM timer 2 TEZ event.
(WO)
INT_TIMER1_TEZ_INT_CLR Set this bit to clear interrupt triggered by a PWM timer 1 TEZ event.
(WO)
INT_TIMER0_TEZ_INT_CLR Set this bit to clear interrupt triggered by a PWM timer 0 TEZ event.
(WO)
INT_TIMER2_STOP_INT_CLR Set this bit to clear interrupt triggered when the timer 2 stops. (WO)
INT_TIMER1_STOP_INT_CLR Set this bit to clear interrupt triggered when the timer 1 stops. (WO)
INT_TIMER0_STOP_INT_CLR Set this bit to clear interrupt triggered when the timer 0 stops. (WO)
17.1 Overview
The pulse counter module is designed to count the number of rising and/or falling edges of an input signal. Each
pulse counter unit has a 16-bit signed counter register and two channels that can be configured to either increment
or decrement the counter. Each channel has a signal input that accepts signal edges to be detected, as well as
a control input that can be used to enable or disable the signal input. The inputs have optional filters that can be
used to discard unwanted glitches in the signal.
The architecture of a pulse counter unit is illustrated in Figure 17-1. Each unit has two channels: ch0 and ch1,
which are functionally equivalent. Each channel has a signal input, as well as a control input, which can both be
connected to I/O pads. The counting behavior on both the positive and negative edge can be configured separately
to increase, decrease, or do nothing to the counter value. Separately, for both control signal levels, the hardware
can be configured to modify the edge action: invert it, disable it, or do nothing. The counter itself is a 16-bit signed
up/down counter. Its value can be read by software directly, but is also monitored by a set of comparators which
can trigger an interrupt.
and NEG_MODE to 1 will increase the counter when an edge is detected, setting them to 2 will decrease the
counter and setting at any other value will neutralize the effect of the edge on the counter. LCTR_MODE and
HCTR_MODE modify this behaviour, when the control input has the corresponding low or high value: 0 does not
modify the NEG_MODE and POS_MODE behaviour, 1 inverts it (setting POS_MODE/NEG_MODE to increase the
counter should now decrease the counter and vice versa) and any other value disables counter effects for that
signal level.
To summarize, a few examples have been considered. In this table, the effect on the counter for a rising edge is
shown for both a low and a high control signal, as well as various other configuration options. For clarity, a short
description in brackets is added after the values. Note: x denotes ’do not care’.
POS_ MODE LCTRL_ MODE HCTRL_ MODE sig l→h when ctrl=0 sig l→h when ctrl=1
1 (inc) 0 (-) 0 (-) Inc ctr Inc ctr
2 (dec) 0 (-) 0 (-) Dec ctr Dec ctr
0 (-) x x No action No action
1 (inc) 0 (-) 1 (inv) Inc ctr Dec ctr
1 (inc) 1 (inv) 0 (-) Dec ctr Inc ctr
2 (dec) 0 (-) 1 (inv) Dec ctr Inc ctr
1 (inc) 0 (-) 2 (dis) Inc ctr No action
1 (inc) 2 (dis) 0 (-) No action Inc ctr
This table is also valid for negative edges (sig h→l) on substituting NEG_MODE for POS_MODE.
Each pulse counter unit also features a filter on each of the four inputs, adding the option to ignore short glitches
in the signals. If a PCNT_FILTER_EN_Un can be set to filter the four input signals of the unit. If this filter is enabled,
any pulses shorter than REG_FILTER_THRES_Un number of APB_CLK clock cycles will be filtered out and will
have no effect on the counter. With the filter disabled, in theory infinitely small glitches could possibly trigger pulse
counter action. However, in practice the signal inputs are sampled on APB_CLK edges and even with the filter
disabled, pulse widths lasting shorter than one APB_CLK cycle may be missed.
Apart from the input channels, software also has some control over the counter. In particular, the counter value
can be frozen to the current value by configuring PCNT_CNT_PAUSE_Un. It can also be reset to 0 by configuring
PCNT_PLUS_CNT_RST_Un.
17.2.3 Watchpoints
The pulse counters have five watchpoints that share one interrupt. Interrupt generation can be enabled or disabled
for each individual watchpoint. The watchpoints are:
• Maximum count value: Triggered when PULSE_CNT >= PCNT_CNT_H_LIM_Un. Additionally, this will reset
the counter to 0. PCNT_CNT_H_LIM_Un should be a positive number.
• Minimum count value: Triggered when PULSE_CNT <= PCNT_CNT_L_LIM_Un. Additionally, this will reset
the counter to 0. PCNT_CNT_L_LIM_Un should be a negative number.
17.2.4 Examples
Figure 17-2 shows channel 0 being used as an up-counter. The configuration of channel 0 is shown below.
Figure 17-3 shows channel 0 decrementing the counter. The configuration of channel 0 differs from that in Figure
17-2 in the following two aspects:
• PCNT_CH0_LCTRL_MODE_Un = 1: invert counter mode when ctrl_ch0_un is at low level, so it will decrease,
rather than increase, the counter.
• PCNT_CNT_H_LIM_Un = –5: PULSE_CNT resets to 0 when the count value decreases to –5.
17.2.5 Interrupts
PCNT_CNT_THR_EVENT_Un_INT: This interrupt gets triggered when one of the five channel comparators detects
a match.
17.4 Registers
Register 17.1. PCNT_Un_CONF0_REG (n: 07) (0x0+0x0C*n)
Un
n
n
_U
_U
_U
Un
Un
n
E_
NT HR _L _EN _U
_U
_U
DE
DE
DE
_E _EN Un
ILT ER _E n
Un Un
N H _L S0 _
D
Un
E_
E_
PC _T _L E EN
DE
DE
O
O
O
ER O N_
N_ _
D
D
S_
_M
_M
_M
NT HR HR S1_
O
O
O
E
_
_M
NT HR G_M
M
M
RL
RL
RL
RL
HR
S_
S_
PC T_T R_T RE
EG
CT
CT
CT
CT
_T
O
N H H
_H
_N
_H
NT 0_N
_P
_P
ER
_L
_L
PC _T _T
H1
H1
H1
H1
H0
H0
H0
LT
PC CH
FI
_C
_C
_C
_C
_C
_C
_C
PC _T
_
_
NT
NT
NT
NT
NT
NT
NT
NT
NT
PC
PC
PC
PC
PC
PC
PC
PC
PC
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 0
0 0 0 0 0 0 0 0 0 0 1 1 1 1 0x010 Reset
PCNT_CH1_POS_MODE_Un This register sets the behaviour when the signal input of channel 1
detects a positive edge. (R/W) 1: Increment the counter; 2: Decrement the counter; 0, 3: No
effect on counter
PCNT_CH1_NEG_MODE_Un This register sets the behaviour when the signal input of channel 1
detects a negative edge. (R/W) 1: Increment the counter; 2: Decrement the counter; 0, 3: No
effect on counter
PCNT_CH0_POS_MODE_Un This register sets the behaviour when the signal input of channel 0
detects a positive edge. (R/W) 1: Increase the counter; 2: Decrease the counter; 0, 3: No effect
on counter
PCNT_CH0_NEG_MODE_Un This register sets the behaviour when the signal input of channel 0
detects a negative edge. (R/W) 1: Increase the counter; 2: Decrease the counter; 0, 3: No effect
on counter
PCNT_THR_THRES1_EN_Un This is the enable bit for unit n’s thres1 comparator. (R/W)
PCNT_THR_THRES0_EN_Un This is the enable bit for unit n’s thres0 comparator. (R/W)
PCNT_THR_L_LIM_EN_Un This is the enable bit for unit n’s thr_l_lim comparator. (R/W)
PCNT_THR_H_LIM_EN_Un This is the enable bit for unit n’s thr_h_lim comparator. (R/W)
PCNT_THR_ZERO_EN_Un This is the enable bit for unit n’s zero comparator. (R/W)
PCNT_FILTER_EN_Un This is the enable bit for unit n’s input filter. (R/W)
PCNT_FILTER_THRES_Un This sets the maximum threshold, in APB_CLK cycles, for the filter. Any
pulses lasting shorter than this will be ignored when the filter is enabled. (R/W)
Un
_U
0_
S1
ES
RE
HR
H
_T
_T
NT
NT
_C
_C
NT
NT
PC
PC
31 16 15 0
PCNT_CNT_THRES1_Un This register is used to configure the thres1 value for unit n. (R/W)
PCNT_CNT_THRES0_Un This register is used to configure the thres0 value for unit n. (R/W)
_U
_U
IM
M
LI
_L
_
_H
_L
NT
NT
_C
_C
NT
NT
PC
PC
31 16 15 0
PCNT_CNT_L_LIM_Un This register is used to configure the thr_l_lim value for unit n. (R/W)
PCNT_CNT_H_LIM_Un This register is used to configure the thr_h_lim value for unit n. (R/W)
31
31
31
0
0
0
0
Espressif Systems
0
0
0
(re
s
0
er
ve
0
d)
17 Pulse Count Controller (PCNT)
0
0
(re (re
0
se se
rv rv
0x0000000
0x0000000
ed ed
) )
0
0
PCNT_CNT_THR_EVENT_Un_INT_ST The
0
16
PCNT_CNT_THR_EVENT_Un_INT_RAW The
15
494
PCNT_CNT_THR_EVENT_Un_INT interrupt. (RO)
PCNT_CNT_THR_EVENT_Un_INT interrupt. (RO)
raw
masked
interrupt
8
8
7
7
0
0
PC PC NT
0x00000
NT NT _
6
6
0
0
PL
PC _C status PC _C
status
US
N N N N _
Register 17.4. PCNT_Un_CNT_REG (n: 07) (0x28+0x0C*n)
5
5
0
0
4
4
0
0
Un
bit
N N H V N N H V
3
3
0
0
PCNT_PLUS_CNT_Un This register stores the current pulse count value for unit n. (RO)
2
2
0
0
for
1
1
0
0
PC T_C T_T R_E EN U6_ T_S PC T_C T_T R_E EN U6_ T_R
N N H V T_ IN T N N H V T_ IN A
0
0
0
PC T_C T_T R_E EN U5_ T_S PC T_C T_T R_E EN U5_ T_R W
NT N HR VE T_U IN T NT N HR VE T_U IN AW
the
the
0 Reset
0 Reset
Reset
_T _E NT 3_ _S _T _E NT 3_ _R
Espressif Systems
interrupt. (WO)
(re
se
0x0000
rv
ed
)
17 Pulse Count Controller (PCNT)
(re (re
se se
r rv
0x0000000
0x0000000
ve ed
d) )
17
PCNT_CNT_THR_EVENT_Un_INT_ENA The
0
16
(re
se
0
15
PC rve
N d)
495
1
14
PC T_C
PCNT_CNT_THR_EVENT_Un_INT interrupt. (R/W)
N N
0
13
PC T_P T_P
N L A
1
12
PC T_C US US
interrupt
NT N _CN E_U
0
11
PC _P T_P T 7
N L A _R
1
8
8
7
7
7
0
0
0
PC T_P T_P NT U5 6 PC PC
N L A _R N N
6
6
6
1
0
0
5
5
5
0
0
0
N L A _R NT N HR NT N HR
4
4
4
1
0
0
3
3
3
0
0
0
2
2
2
1
0
0
for
PC T_C US US ST_ PC T_C T_T R_E EN U7_ PC T_C T_T R_E EN U7_
N N _C E_ U N N H V T_ IN N N H V T_ IN
1
1
1
0
0
0
PC T_P T_P NT U2 3 PC T_C T_T R_E EN U6_ T_C PC T_C T_T R_E EN U6_ T_E
N L A _R N N H V T_ IN L N N H V T_ IN N
0
0
0
PC T_C US US ST_ PC T_C T_T R_E EN U5_ T_C R PC T_C T_T R_E EN U5_ T_E A
NT N _CN E_U U2 NT N HR VE T_U IN LR NT N HR VE T_U IN NA
PCNT_CNT_THR_EVENT_Un_INT_CLR Set this bit to clear the PCNT_CNT_THR_EVENT_Un_INT
the
1 Reset
0 Reset
0 Reset
S_ SE T_ _T _E NT 3_ _C _T _E NT 3_ _E
n
LA Un
n
_U
_M _U
NT R_T RES T_ n
HR RE _LA n
NT HR _L _L Un
_Z S1_ T_
PC TH TH _LA _U
H 0 U
DE
T
PC T_T R_L LIM AT_
_ _ IM AT
O
N H _ _L
PC T_T R_H RO
O
ER
N H E
PC _T _Z
NT HR
)
ed
PC T_T
_T
rv
se
N
PC
(re
31 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 Reset
PCNT_THR_ZERO_LAT_Un The last interrupt happened on counter for unit n reaching 0. (RO)
PCNT_THR_H_LIM_LAT_Un The last interrupt happened on counter for unit n reaching thr_h_lim.
(RO)
PCNT_THR_L_LIM_LAT_Un The last interrupt happened on counter for unit n reaching thr_l_lim. (RO)
PCNT_THR_THRES0_LAT_Un The last interrupt happened on counter for unit n reaching thres0.
(RO)
PCNT_THR_THRES1_LAT_Un The last interrupt happened on counter for unit n reaching thres1.
(RO)
PCNT_THR_ZERO_MODE_Un This register stores the current status of the counter. 0: counting
value is +0 (the counter values are represented by signed binary numbers); 1: counting value is -0;
2: counting value is negative; 3: counting value is positive. (RO)
18.1 Introduction
There are four general-purpose timers embedded in the ESP32. They are all 64-bit generic timers based on 16-bit
prescalers and 64-bit auto-reload-capable up/downcounters.
The ESP32 contains two timer modules, each containing two timers. The two timers in a block are indicated by
an x in TIMGn_Tx; the blocks themselves are indicated by an n.
• Auto-reload at alarm
Counting can be enabled and disabled by setting and clearing TIMGn_Tx_EN. Clearing this bit essentially freezes
the counter, causing it to neither count up nor count down; instead, it retains its value until TIMGn_Tx_EN is set
again. Reloading the counter when TIMGn_Tx_EN is cleared will change its value, but counting will not be resumed
until TIMGn_Tx_EN is set.
Software can set a new counter value by setting registers TIMGn_Tx_LOAD_LO and TIMGn_Tx_LOAD_HI to the in-
tended new value. The hardware will ignore these register settings until a reload; a reload will cause the contents of
these registers to be copied to the counter itself. A reload event can be triggered by an alarm (auto-reload at alarm)
or by software (software instant reload). To enable auto-reload at alarm, the register TIMGn_Tx_AUTORELOAD
should be set. If auto-reload at alarm is not enabled, the time-base counter will continue incrementing or decre-
menting after the alarm. To trigger a software instant reload, any value can be written to the register TIMGn_Tx_
LOAD_REG; this will cause the counter value to change instantly. Software can also change the direction of the
time-base counter instantly by changing the value of TIMGn_Tx_INCREASE.
The time-base counter can also be read by software, but because the counter is 64-bit, the CPU can only get the
value as two 32-bit values, the counter value needs to be latched onto TIMGn_TxLO_REG and TIMGn_TxHI_REG
first. This is done by writing any value to TIMGn_TxUPDATE_REG; this will instantly latch the 64-bit timer value onto
the two registers. Software can then read them at any point in time. This approach stops the timer value being
read erroneously when a carry-over happens between reading the low and high word of the timer value.
18.2.4 MWDT
Each timer module also contains a Main System Watchdog Timer and its associated registers. While these registers
are described here, their functional description can be found in the chapter entitled Watchdog Timer.
18.2.5 Interrupts
• TIMGn_Tx_INT_WDT_INT: Generated when a watchdog timer interrupt stage times out.
18.4 Registers
Register 18.1. TIMGn_TxCONFIG_REG (x: 01) (0x0+0x24*x)
_E EN
AD
LA _IN EN
RM T_
LO
_A EL _
N
O E
Tx V INT
UT AS
RE
n_ LE _
E
_A E
G x_ GE
ID
Tx CR
V
TI n_ EN
TI n_ ED
n_ IN
DI
G x_
G x_
G x_
Tx
M T
M T
M T
M T
TI n_
n_
TI n_
G
G
M
M
TI
TI
TI
31 30 29 28 13 12 11 10
0 1 1 0x00001 0 0 0 Reset
TIMGn_Tx_INCREASE When set, the timer x time-base counter will increment every clock tick. When
cleared, the timer x time-base counter will decrement. (R/W)
TIMGn_Tx_EDGE_INT_EN When set, an alarm will generate an edge type interrupt. (R/W)
TIMGn_Tx_LEVEL_INT_EN When set, an alarm will generate a level type interrupt. (R/W)
TIMGn_Tx_ALARM_EN When set, the alarm is enabled. This bit is automatically cleared once an
alarm occurs. (R/W)
31 0
0x000000000 Reset
TIMGn_TxLO_REG After writing to TIMGn_TxUPDATE_REG, the low 32 bits of the time-base counter
of timer x can be read here. (RO)
31 0
0x000000000 Reset
TIMGn_TxHI_REG After writing to TIMGn_TxUPDATE_REG, the high 32 bits of the time-base counter
of timer x can be read here. (RO)
31 0
0x000000000 Reset
TIMGn_TxUPDATE_REG Write any value to trigger a timer x time-base counter value update (timer x
current value will be stored in registers above). (WO)
31 0
0x000000000 Reset
TIMGn_TxALARMLO_REG Timer x alarm trigger time-base counter value, low 32 bits. (R/W)
31 0
0x000000000 Reset
TIMGn_TxALARMHI_REG Timer x alarm trigger time-base counter value, high 32 bits. (R/W)
31 0
0x000000000 Reset
TIMGn_TxLOADLO_REG Low 32 bits of the value that a reload will load onto timer x time-base
counter. (R/W)
31 0
0x000000000 Reset
TIMGn_TxLOADHI_REG High 32 bits of the value that a reload will load onto timer x time-base
counter. (R/W)
31 0
0x000000000 Reset
TIMGn_TxLOAD_REG Write any value to trigger a timer x time-base counter reload. (WO)
EN
TH
TH
D_
G
NG
EN
O
M
LE
N
_L
_I EN
T_
_E
T_
ET
O
EL T_
SE
NT
BO
ES
EV IN
RE
R
_L E_
SH
U_
0
S_
DT G
TG
TG
TG
TG
LA
P
N
SY
_C
_S
_S
_S
_S
Tx T_E
_F
_W _
_
DT
DT
DT
DT
Tx DT
DT
DT
DT
D
_W
_W
_W
_W
n_ W
_W
_W
_W
_
G x_
Tx
Tx
Tx
Tx
Tx
Tx
Tx
M T
n_
n_
n_
n_
n_
TI n_
n_
n_
n_
G
G
M
M
TI
TI
TI
TI
TI
TI
TI
TI
TI
31 30 29 28 27 26 25 24 23 22 21 20 18 17 15 14
TIMGn_Tx_WDT_EDGE_INT_EN When set, an edge type interrupt will occur at the timeout of a stage
configured to generate an interrupt. (R/W)
TIMGn_Tx_WDT_LEVEL_INT_EN When set, a level type interrupt will occur at the timeout of a stage
configured to generate an interrupt. (R/W)
TIMGn_Tx_WDT_CPU_RESET_LENGTH CPU reset signal length selection. 0: 100 ns, 1: 200 ns,
2: 300 ns, 3: 400 ns, 4: 500 ns, 5: 800 ns, 6: 1.6 µs, 7: 3.2 µs. (R/W)
TIMGn_Tx_WDT_SYS_RESET_LENGTH System reset signal length selection. 0: 100 ns, 1: 200 ns,
2: 300 ns, 3: 400 ns, 4: 500 ns, 5: 800 ns, 6: 1.6 µs, 7: 3.2 µs. (R/W)
E
L
SCA
RE
_P
LK
_C
DT
W_
Tx
n_
G
M
TI
31 16
0x00001 Reset
31 0
26000000 Reset
31 0
0x007FFFFFF Reset
31 0
0x0000FFFFF Reset
31 0
0x0000FFFFF Reset
31 0
0x000000000 Reset
31 0
0x050D83AA1 Reset
TIMGn_Tx_WDTWPROTECT_REG If the register contains a different value than its reset value, write
protection is enabled. (R/W)
G
IN
Y CL
_C
TA L
E
_S
T
RT
R
AX
DY
CA LK
TA
_M
C
C_ I_R
_S
_S
_
LI
LI
RT ALI
LI
L
A
CA
n_ _CA
_C
C
C_
C_
TC
C
RT
RT
RT
)
R
ed
n_
n_
n_
n_
rv
G
se
M
(re
TI
TI
TI
TI
TI
31 30 16 15 14 13 12 11 0
UE
AL
_V
LI
A
_C
TC
)
R
ed
n_
rv
G
se
M
(re
TI
31 7 5 0
0x00000 0 0 0 0 0 0 Reset
0_ _E NA
T_ A
A
_T INT _E
IN N
EN
NT _ T
_I T1 _IN
Tx T_ T
n_ IN D
G x_ W
M T T_
TI n_ _IN
G x
)
ed
M _T
rv
n
G
se
M
(re
TI
TI
31 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
TIMGn_Tx_INT_T1_INT_ENA The interrupt enable bit for the TIMGn_Tx_INT_T1_INT interrupt. (R/W)
(R/W)
TIMGn_Tx_INT_T0_INT_ENA The interrupt enable bit for the TIMGn_Tx_INT_T0_INT interrupt. (R/W)
(R/W)
0_ _R AW
T_ W
W
_T INT _R
IN A
RA
NT _ T
_I T1 _IN
Tx T_ T
n_ IN D
G x_ W
M T T_
TI n_ _IN
G x
d)
M T
ve
TI n_
er
G
M
s
(re
TI
31 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
TIMGn_Tx_INT_WDT_INT_RAW The raw interrupt status bit for the TIMGn_Tx_INT_WDT_INT inter-
rupt. (RO)
TIMGn_Tx_INT_T1_INT_RAW The raw interrupt status bit for the TIMGn_Tx_INT_T1_INT interrupt.
(RO)
TIMGn_Tx_INT_T0_INT_RAW The raw interrupt status bit for the TIMGn_Tx_INT_T0_INT interrupt.
(RO)
0_ _S T
_T INT _S
IN T
ST
NT _ T
T_
_I T1 _IN
Tx T_ T
n_ IN D
G x_ W
M T T_
TI n_ _IN
G x
)
ed
M _T
rv
n
G
se
M
(re
TI
TI
31 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
TIMGn_Tx_INT_WDT_INT_ST The masked interrupt status bit for the TIMGn_Tx_INT_WDT_INT in-
terrupt. (RO)
TIMGn_Tx_INT_T1_INT_ST The masked interrupt status bit for the TIMGn_Tx_INT_T1_INT interrupt.
(RO)
TIMGn_Tx_INT_T0_INT_ST The masked interrupt status bit for the TIMGn_Tx_INT_T0_INT interrupt.
(RO)
0_ _C LR
T_ R
R
_T INT _C
IN L
CL
NT _ T
_I T1 _IN
Tx T_ T
n_ IN D
G x_ W
M T T_
TI n_ IN
G x_
d)
M _T
ve
n
er
G
M
s
(re
TI
TI
31 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
19.1 Introduction
The ESP32 has three watchdog timers: one in each of the two timer modules (called Main System Watchdog Timer,
or MWDT) and one in the RTC module (which is called the RTC Watchdog Timer, or RWDT). These watchdog
timers are intended to recover from an unforeseen fault, causing the application program to abandon its normal
sequence. A watchdog timer has four stages. Each stage may take one out of three or four actions upon the expiry
of a programmed period of time for this stage, unless the watchdog is fed or disabled. The actions are: interrupt,
CPU reset, core reset and system reset. Only the RWDT can trigger the system reset, and is able to reset the entire
chip and the main system including the RTC itself. A timeout value can be set for each stage individually.
During flash boot, the RWDT and the first MWDT start automatically in order to detect and recover from booting
problems.
19.2 Features
• Four stages, each of which can be configured or disabled separately
• One out of three or four possible actions (interrupt, CPU reset, core reset and system reset) upon the expiry
of each stage
• Write protection, to prevent the RWDT and MWDT configuration from being inadvertently altered.
Every stage can be configured for one of the following actions when the expiry timer reaches the stage’s timeout
value:
• Trigger an interrupt
When the stage expires an interrupt is triggered.
CPU. MWDT1 CPU reset only resets the APP CPU. The RWDT CPU reset can reset either of them, or both,
or none, depending on configuration.
• Disabled
This stage will have no effects on the system.
When software feeds the watchdog timer, it returns to stage 0 and its expiry counter restarts from 0.
19.3.1.4 Registers
The MWDT registers are part of the timer submodule and are described in the Timer Registers section. The RWDT
registers are part of the RTC submodule and are described in the RTC Registers section.
20 eFuse Controller
20.1 Introduction
The ESP32 has a number of eFuses which store system parameters. Fundamentally, an eFuse is a single bit of
non-volatile memory with the restriction that once an eFuse bit is programmed to 1, it can never be reverted to 0.
Software can instruct the eFuse Controller to program each bit for each system parameter as needed.
Some of these system parameters can be read by software using the eFuse Controller. Some of the system
parameters are also directly used by hardware modules.
20.2 Features
• Configuration of 33 system parameters
• Optional write-protection
• Optional software-read-protection
Program Software-Read
Name Bit width -Protection by -Protection by Description
efuse_wr_disable efuse_rd_disable
efuse_wr_disable 16 1 - controls the eFuse Controller
efuse_rd_disable 4 0 - controls the eFuse Controller
governs the flash encryption/
flash_crypt_cnt 7 2 -
decryption
WIFI_MAC_Address 56 3 - Wi-Fi MAC address and CRC
configures the SPI I/O to a cer-
SPI_pad_config_hd 5 3 -
tain pad
XPD_SDIO_REG 1 5 - powers up the flash regulator
configures the flash regulator
SDIO_TIEH 1 5 - voltage: set to 1 for 3.3 V
and set to 0 for 1.8 V
determines whether
XPD_SDIO_REG
sdio_force 1 5 -
and SDIO_TIEH can
control the flash regulator
BLK3_part_reserve 2 10 3 controls the eFuse controller
configures the SPI I/O to a cer-
SPI_pad_config_clk 5 6 -
tain pad
Program Software-Read
Name Bit width -Protection by -Protection by Description
efuse_wr_disable efuse_rd_disable
configures the SPI I/O to a cer-
SPI_pad_config_q 5 6 -
tain pad
configures the SPI I/O to a cer-
SPI_pad_config_d 5 6 -
tain pad
configures the SPI I/O to a cer-
SPI_pad_config_cs0 5 6 -
tain pad
governs flash encryption/
flash_crypt_config 4 10 3
decryption
coding_scheme* 2 10 3 controls the eFuse Controller
disables the ROM BASIC
console_debug_disable 1 15 - debug console fallback
mode when set to 1
determines the status of
abstract_done_0 1 12 -
Secure Boot
determines the status of
abstract_done_1 1 13 -
Secure Boot
disables access to the
JTAG controllers so as to
JTAG_disable 1 14 -
effectively disable external
use of JTAG
governs flash encryption/
download_dis_encrypt 1 15 -
decryption
governs flash encryption/
download_dis_decrypt 1 15 -
decryption
disables cache when boot
download_dis_cache 1 15 -
mode is the Download Mode
determines whether BLOCK3
key_status 1 10 3
is deployed for user purposes
governs flash encryption/
BLOCK1* 256/192/128 7 0
decryption
BLOCK2* 256/192/128 8 1 key for Secure Boot
BLOCK3* 256/192/128 9 2 key for user purposes
disable_app_cpu 1 3 - disables APP CPU
disable_bt 1 3 - disables Bluetooth
pkg_version 4 3 - packaging version
disable_cache 1 3 - disables cache
CK8M Frequency 8 4 - RTC8M_CLK frequency
stores the voltage level for
vol_level_hp_inv 2 3 - CPU to run at 240 MHz, or for
flash/PSRAM to run at 80 MHz
Program Software-Read
Name Bit width -Protection by -Protection by Description
efuse_wr_disable efuse_rd_disable
stores the difference between
dig_vol_l6 4 11 - the digital regulator voltage at
level 6 and 1.2 V.
permanently disables Down-
load Boot mode when set to
uart_download_dis 1 2 -
1. Valid only for ESP32 ECO
V3.
If a system parameter is not write-protected, its unprogrammed bits can be programmed from 0 to 1. The bits
previously programmed to 1 will remain 1. When a system parameter is write-protected, none of its bits can be
programmed: The unprogrammed bits will always remain 0 and the programmed bits will always remain 1.
The write-protection status of each system parameter corresponds to a bit in efuse_wr_disable. When the cor-
responding bit is set to 0, the system parameter is not write-protected. When the corresponding bit is set to 1,
the system parameter is write-protected. If a system parameter is already write-protected, it will remain write-
protected. The column entitled “Program-Protection by efuse_wr_disable” in Table 20-1 lists the corresponding
bits that determine the write-protection status of each system parameter.
When not software-read-protected, the other six system parameters can both be read by software and used
by hardware modules. When they are software-read-protected, they can only be used by the hardware mod-
ules.
The column “Software-Read-Protection by efuse_rd_disable” in Table 20-1 lists the corresponding bits in efuse_rd
_disable that determine the software read-protection status of the six system parameters. If a bit in the system
parameter efuse_rd_disable is 0, the system parameter controlled by the bit is not software-read-protected. If a
bit in the system parameter efuse_rd_disable is 1, the system parameter controlled by the bit is software-read-
protected. If a system parameter is software-read-protected, it will remain in this state.
between these three system parameters and their corresponding stored values in eFuse. For details please see
Table 20-2.
• BLOCKN represents any of the following three system parameters: BLOCK1, BLOCK2 or BLOCK3.
• BLOCKN [255 : 0], BLOCKN [191 : 0], and BLOCKN [127 : 0] represent each bit of the three system
parameters in the three encoding schemes.
e
• BLOCKN [255 : 0] represents each corresponding bit of those system parameters in eFuse after being
encoded.
None
e
BLOCKN [255 : 0] = BLOCKN [255 : 0]
3/4
BLOCKNij [7 : 0] j ∈ {0, 1, 2, 3, 4, 5}
BLOCKNi0 [7 : 0] ⊕ BLOCKNi1 [7 : 0]
⊕ BLOCKN 2 [7 : 0] ⊕ BLOCKN 3 [7 : 0]
j i i j ∈ {6}
e
BLOCKN i [7 : 0] = i ∈ {0, 1, 2, 3}
⊕ BLOCKN 4 [7 : 0] ⊕ BLOCKN 5 [7 : 0]
i i
X X
5 7
BLOCKNil [k] j ∈ {7}
(l + 1)
l=0 k=0
Repeat
e e
BLOCKN [255 : 128] = BLOCKN [127 : 0] = BLOCKN [127 : 0]
20.3.1.4 BLK3_part_reserve
System parameters coding_scheme, BLOCK1, BLOCK2, and BLOCK3 are controlled by the parameter BLK3_part
_reserve.
When the value of BLK3_part_reserve is 0, coding_scheme, BLOCK1, BLOCK2, and BLOCK3 can be set to any
value.
When the value of BLK3_part_reserve is 1, coding_scheme�BLOCK1�BLOCK2 and BLOCK3 are controlled by 3/4
e
coding scheme. Meanwhile, BLOCK3[143 : 96], namely, BLOCK3[191 : 128] is unavailable.
Each bit of the 30 fixed-length system parameters and the three encoded variable-length system parameters
corresponds to a program register bit, as shown in Table 20-3. The register bits will be used when programming
system parameters.
2. Set the corresponding register bit of the system parameter bit to be programmed to 1.
The configuration values of the EFUSE_CLK_SEL0 bit, EFUSE_CLK_SEL1 bit of register EFUSE_CLK, and the
EFUSE_DAC_CLK_DIV bit of register EFUSE_DAC_CONF are based on the current APB_CLK frequency, as is
shown in Table 20-4.
The two methods to identify the generation of program/read-done interrupts are as follows:
Method One:
1. Poll bit 1/0 in register EFUSE_INT_RAW until bit 1/0 is 1, which represents the generation of an program/read-
done interrupt.
2. Set the bit 1/0 in register EFUSE_INT_CLR to 1 to clear the program/read-done interrupts.
Method Two:
1. Set bit 1/0 in register EFUSE_INT_ENA to 1 to enable eFuse Controller to post a program/read-done interrupt.
4. Read bit 1/0 in register EFUSE_INT_ST to identify the generation of the program/read-done interrupt.
The programming of different system parameters and even the programming of different bits of the same system
parameter can be completed separately in multiple programmings. It is, however, recommended that users min-
imize programming cycles, and program all the bits that need to be programmed in a system parameter in one
programming action. In addition, after all system parameters controlled by a certain bit of efuse_wr_disable are
programmed, that bit should be immediately programmed. The programming of system parameters controlled
by a certain bit of efuse_wr_disable, and the programming of that bit can even be completed at the same time.
Repeated programming of programmed bits is strictly forbidden.
The bit width of system parameters BLOCK1, BLOCK2, and BLOCK3 is variable. Although 256 register bits have
been assigned to each of the three parameters, as shown in Table 20-5, some of the 256 register bits are useless
in the 3/4 coding and the Repeat coding scheme. In the None coding scheme, the corresponding register bit
of each bit of BLOCKN [255 : 0] is used. In the 3/4 coding scheme, only the corresponding register bits of
BLOCKN [191 : 0] are useful. In Repeat coding scheme, only the corresponding bits of BLOCKN [127 : 0]
are useful. In different coding schemes, the values of useless register bits read by software are invalid. The
values of useful register bits read by software are the system parameters BLOCK1, BLOCK2, and BLOCK3
themselves instead of their values after being encoded.
20.3.5 Interrupts
• EFUSE_PGM_DONE_INT: Triggered when eFuse programming has finished.
20.5 Registers
Register 20.1. EFUSE_BLK0_RDATA0_REG (0x000)
IS
_D
T
AD
CN
O
T_
S
IS
NL
DI
YP
_D
R_
W
CR
RD
O
W
_D
H_
E_
E_
RT
US
S
FU
LA
UA
F
_E
_E
F
D_
D_
RD
RD
)
_R
_R
ed
E_
E_
E
E
rv
US
US
US
US
se
EF
EF
EF
EF
(re
31 28 27 26 20 19 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EFUSE_RD_UART_DOWNLOAD_DIS This bit returns the value of uart_download_dis. Valid only for
ESP32 . (RO)
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EFUSE_BLK0_RDATA1_REG This field returns the value of the lower 32 bits of WIFI_MAC_Address.
(RO)
E_
rv
US
se
EF
(re
31 24 23 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
U
CP
E
D
P_ R_ G H
P_
_H
HI VE PK AC
AP
DI BT
IG
_C IP_ R_ _C
R_ S_
S_
KG
NF
RD H VE DIS
VE DI
CO
_P
E_ _C _ _
ER
R
D_
US RD H VE
_V
PA
EF E_ _C IP_
IP
P
I_
I
CH
US RD H
P
EF E_ _C
_S
D_
US RD
)
_R
_R
ed
EF E_
E
E
rv
US
US
US
se
EF
EF
EF
(re
31 12 11 9 8 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EFUSE_RD_CHIP_VER_PKG These are the first three identification bits of chip packaging version
among the four identification bits. (RO)
EFUSE_RD_CHIP_VER_PKG This is the fourth identification bit of chip packaging version among the
four identification bits. (RO)
EQ
PD TIE E
_X IO_ RC
R
_S H
O
_F
RD D FO
DI
8M
E_ _S IO_
CK
US RD D
EF SE_ D_S
D_
_R
d)
)
U R
ed
SE
EF SE_
ve
rv
FU
r
se
se
U
ES
EF
(re
(re
31 17 16 15 14 13 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
IG
S0
LK
NF
_Q
_C
_C
_D
NV
O
IG
IG
IG
IG
C
_I
T_
NF
NF
NF
NF
_H
P
CO
O
6
RY
EL
_C
_C
_C
L
L_
D_
_C
AD
LE
O
PA
PA
PA
SH
_V
_P
L_
I_
I_
I_
LA
PI
O
SP
P
DI
_S
_S
S
_V
F
D_
D_
D_
D_
RD
RD
d)
_R
_R
_R
_R
_R
E_
E_
ve
E
SE
E
US
US
US
US
US
US
er
U
s
EF
EF
EF
EF
EF
EF
EF
(re
31 28 27 24 23 22 21 20 19 15 14 10 9 5 4 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EFUSE_RD_DIG_VOL_L6 This field stores the difference between the digital regulator voltage at level
6 and 1.2 V. (RO)
EFUSE_RD_VOL_LEVEL_HP_INV This field stores the voltage level for CPU to run at 240 MHz, or
for flash/PSRAM to run at 80 MHz. 0x0: level 7; 0x1: level 6; 0x2: level 5; 0x3: level 4. (RO)
E
BL
EM ISA
T
US d) BS O AG CR T
YP
EF rve D_A S_D _JT EN YP
_D
(re SE_ D_A AB _D DE E
U R IS LE L_ CH
se R B LE L_ CR
UG
E
EF SE_ D_D AB _D CA
NG EB
CH
O _1
0
U R IS LE L_
U R IS LE S
D
_
EF E_ _D AB TU
EF SE_ D_D AB _D
_D NE
NE
E_
_S
US RD IS TA
_C OL
EF SE_ D_D Y_S
RD NS
DI
O
O
U R E
_C
EF SE_ D_K
EF _RD
)
U R
ed
EF SE_
E_
E
rv
US
se
U
EF
(re
31 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
T
AD
CN
O
T_
NL
P
RY
W
O
_C
_D
S
IS
SH
DI
RT
_D
R_
A
RD
UA
FL
W
)
ed
E_
E_
E_
E_
rv
US
US
US
US
se
EF
EF
EF
EF
(re
31 28 27 26 20 19 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EFUSE_UART_DOWNLOAD_DIS This bit programs the value of uart_download_dis. Valid only for
ESP32 ECO V3. (R/W)
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
H
IG
_H
RC
_C
AC
M
I_
IF
W
d)
E_
ve
US
r
se
EF
(re
31 24 23 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PU
E
_C
D
IP ER KG CH
_H
PP
CH _V _P CA
IS T
IG
_D _B
_A
E_ IP ER IS_
G
NF
ER IS
K
US CH _V _D
_V _D
_P
_C
ER
EF E_ IP ER
D
_V
US CH _V
PA
IP
EF E_ IP
I_
CH
US CH
SP
)
ed
E_
E_
EF SE_
rv
US
US
se
U
EF
EF
EF
(re
31 12 11 9 8 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EFUSE_CHIP_VER_PKG These are the first three bits among the four bits to program chip packaging
version. (R/W)
EFUSE_CHIP_VER_PKG This is the fourth bit among the four bits to program chip packaging version.
(R/W)
Q
XP _T CE
RE
D_ IEH
E_ IO OR
IO
_F
SD
M
US SD _F
K8
EF SE_ DIO
_C
)
)
U S
ed
ed
SE
EF SE_
rv
rv
FU
se
se
U
ES
EF
(re
(re
31 17 16 15 14 13 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
LK
NF
_Q
_C
_C
_D
V
CO
IG
IG
IG
IG
_I
T_
HP
NF
NF
NF
NF
YP
O
L_
L6
_C
_C
_C
_C
CR
VE
L_
D
H_
LE
O
PA
PA
PA
PA
_V
L_
S
I_
I_
I_
I_
LA
VO
SP
SP
SP
SP
DI
d)
F
E_
E_
E_
E_
E_
E_
E_
ve
US
US
US
US
US
US
US
r
se
EF
EF
EF
EF
EF
EF
EF
(re
31 28 27 24 23 22 21 20 19 15 14 10 9 5 4 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EFUSE_DIG_VOL_L6 This field stores the difference between the digital regulator voltage at level 6
and 1.2 V. (R/W)
EFUSE_VOL_LEVEL_HP_INV These bits store the voltage level for CPU to run at 240 MHz, or for
flash/PSRAM to run at 80 MHz. 0x0: level 7; 0x1: level 6; 0x2: level 5; 0x3: level 4. (R/W)
E
BL
EM ISA
PT
se A D JTA C PT
_D
EF SE_ ISA E_ _DE HE
EF rve BS_ ON G RY
(re SE_ BS_ E_ _EN RY
UG
E
U D BL DL AC
U A BL DL C
NG EB
EF E_ SA E_ _C
CH
NE 1
_0
U D BL US
_D
US DI BL DL
US d) DO E_
_S
CO LE
EF SE_ ISA AT
EF SE_ ISA E_
U D ST
SO
EF SE_ EY_
DI
US ON
C
d)
U K
EF SE_
E_
E_
ve
er
U
s
EF
EF
(re
31 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0x000000000 Reset
31 0
0x000000000 Reset
31 0
0x000000000 Reset
31 0
0x000000000 Reset
31 0
0x000000000 Reset
31 0
0x000000000 Reset
L0
SE
SE
K_
K_
CL
CL
d)
E_
E_
e
rv
US
US
se
EF
EF
(re
31 16 15 8 7 0
DE
CO
P_
O
d)
E_
ve
US
r
se
EF
(re
31 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x00000 Reset
D
AD MD
M
_C
RE _C
E_ M
US PG
)
ed
EF SE_
rv
se
U
EF
(re
31 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EFUSE_PGM_CMD Set this to 1 to start a program operation. Reverts to 0 when the program op-
eration is done. (R/W)
EFUSE_READ_CMD Set this to 1 to start a read operation. Reverts to 0 when the read operation is
done. (R/W)
AW
NT W
_I RA
_R
NE _
O INT
_D E_
AD ON
RE _D
E_ M
US PG
d)
EF SE_
e
rv
se
U
EF
(re
31 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EFUSE_PGM_DONE_INT_RAW The raw interrupt status bit for the EFUSE_PGM_DONE_INT inter-
rupt. (RO)
EFUSE_READ_DONE_INT_RAW The raw interrupt status bit for the EFUSE_READ_DONE_INT in-
terrupt. (RO)
T
_I ST
_S
NE _
NT
O INT
_D E_
AD ON
RE _D
E_ M
US PG
)
ed
EF SE_
v
er
U
s
EF
(re
31 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EFUSE_PGM_DONE_INT_ST The masked interrupt status bit for the EFUSE_PGM_DONE_INT in-
terrupt. (RO)
EFUSE_READ_DONE_INT_ST The masked interrupt status bit for the EFUSE_READ_DONE_INT in-
terrupt. (RO)
NA
NT A
_I EN
_E
NE _
O INT
_D E_
AD ON
RE _D
E_ M
US PG
d)
EF SE_
e
rv
se
U
EF
(re
31 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EF SE_
rve
se
U
EF
(re
31 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
IV
_D
LK
_C
AC
d)
_D
ve
E
US
er
s
EF
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 40 Reset
S
NG
NI
AR
W
C_
DE
d)
E_
ve
US
r
se
EF
(re
31 12 11 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EFUSE_DEC_WARNINGS If a bit is set in this register, it means some errors were corrected while
decoding the 3/4 encoding scheme. (RO)
21.1 Overview
®
The Two-wire Automotive Interface (TWAI) is a multi-master, multi-cast communication protocol with error de-
tection and signaling and inbuilt message priorities and arbitration.The TWAI protocol is suited for automotive and
industrial applications (Please see TWAI Protocol Description).
ESP32 contains a TWAI controller that can be connected to a TWAI bus via an external transceiver. The TWAI con-
troller contains numerous advanced features, and can be utilized in a wide range of use cases such as automotive
products, industrial automation controls, building automation etc.
21.2 Features
ESP32 TWAI controller supports the following features:
• Supports Standard Frame Format (11-bit ID) and Extended Frame Format (29-bit ID)
– Normal
• Special transmissions
– Self Reception (the TWAI controller transmits and receives messages simultaneously)
– Error counters
Single Channel and NonReturntoZero: The bus consists of a single channel to carry bits, thus communication
is half-duplex. Synchronization is also derived from this channel, thus extra channels (e.g., clock or enable) are not
required. The bit stream of a TWAI message is encoded using the Non-Return-to-Zero (NRZ) method.
Bit Values: The single channel can either be in a Dominant or Recessive state, representing a logical 0 and a
logical 1 respectively. A node transmitting a Dominant state will always override a another node transmitting a
Recessive state. The physical implementation on the bus is left to the application level to decide (e.g., differential
wiring).
BitStuffing: Certain fields of TWAI messages are bit-stuffed. A Transmitter that transmits five consecutive bits of
the same value should automatically insert a complementary bit. Likewise, a Receiver that receives five consecutive
bits should treat the next bit as a stuff bit. Bit stuffing is applied to the following fields: SOF, Arbitration Field, Control
Field, Data Field, and CRC Sequence (see Section 21.3.2 for more details).
Multicast: All nodes receive the same bits as they are connected to the same bus. Data is consistent across all
nodes unless there is a bus error (See Section 21.3.3).
Multimaster: Any node can initiate a transmission. If a transmission is already ongoing, a node will wait until the
current transmission is over before beginning its own transmission.
MessagePriorities and Arbitration: If two or more nodes simultaneously initiate a transmission, the TWAI proto-
col ensures that one node will win arbitration of the bus. The Arbitration Field of the message transmitted by each
node is used to determine which node will win arbitration.
Error Detection and Signaling: Each node will actively monitor the bus for errors, and signal the detection errors
by transmitting an Error Frame.
Fault Confinement: Each node will maintain a set of error counts that are incremented/decremented according
to a set of rules. When the error counts surpass a certain threshold, a node will automatically eliminate itself from
the network by switching itself off.
Configurable Bit Rate: The bit rate for a single TWAI bus is configurable. However, all nodes within the same bus
must operate at the same bit rate.
Transmitters and Receivers: At any point in time, a TWAI node can either be a Transmitter or a Receiver.
• A node originating a message is a Transmitter. The node remains a Transmitter until the bus is idle or until
the node loses arbitration. Note that multiple nodes can be Transmitter if they have yet to lose arbitration.
• Data Frames
• Remote Frames
• Error Frames
• Overload Frames
• Interframe Space
Figure 211. The bit fields of Data Frames and Remote Frames
Arbitration Field
When two or more nodes transmits a Data or Remote Frame simultaneously, the Arbitration Field is used to deter-
mine which node will win arbitration of the bus. During the Arbitration Field, if a node transmits a Recessive bit but
observes a Dominant bit, this indicates that another node has overridden its Recessive bit. Therefore, the node
transmitting the Recessive bit has lost arbitration of the bus and should immediately become a Receiver.
The Arbitration Field primarily consists of the Frame Identifier that is transmitted most significant bit first. Given that
a Dominant bit represents a logical 0, and a Recessive bit represents a logical 1:
• Given the same ID and format, Data Frames will always prevail over RTR Frames.
• Given the same first 11 bits of ID, a Standard Format Data Frame will prevail over an Extended Format Data
Frame due to the SRR being recessive.
Control Field
The control field primarily consists of the DLC (Data Length Code) which indicates the number of payload data
bytes for a Data Frame, or the number of requested data bytes for a Remote Frame. The DLC is transmitted most
significant bit first.
Data Field
The Data Field contains the actual payload data bytes of a Data Frame. Remote Frames do not contain a Data
Field.
CRC Field
The CRC Field primarily consists of a a CRC Sequence. The CRC Sequence is a 15-bit cyclic redundancy code
calculated form the de-stuffed contents (everything from the SOF to the end of the Data Field) of a Data or Remote
Frame.
ACK Field
The ACK Field primarily consists of an ACK Slot and an ACK Delim. The ACK Field is mainly intended for the
receiver to send a message to a transmitter, indicating it has received an effective message.
Table 211. Data Frames and Remote Frames in SFF and EFF
Error Frames are transmitted when a node detects a Bus Error. Error Frames notably consist of an Error Flag which
is made up of 6 consecutive bits of the same value, thus violating the bit-stuffing rule. Therefore, when a particular
node detects a Bus Error and transmits an Error Frame, all other nodes will then detect a Stuff Error and transmit
their own Error Frames in response. This has the effect of propagating the detection of a Bus Error across all nodes
on the bus. When a node detects a Bus Error, it will transmit an Error Frame starting on the next bit. However,
if the type of Bus Error was a CRC Error, then the Error Frame will start at the bit following the ACK Delim (see
Section 21.3.3). The following Figure 21-2 shows the various fields of an Error Frame:
Overload Frames
An Overload Frame has the same bit fields as an Error Frame containing an Active Error Flag. The key difference
is in the conditions that can trigger the transmission of an Overload Frame. Figure 21-3 below shows the bit fields
of an Overload Frame.
1. The internal conditions of a Receiver requires a delay of the next Data or Remote Frame.
3. If a Dominant bit is detected at the eighth (last) bit of an Error Delimeter. Note that in this case, TEC and REC
will not be incremented (See Section 21.3.3).
Transmitting an overload frame due to one of the conditions must also satisfy the following rules:
• Transmitting an Overload Frame due to condition 1 must only be started at the first bit of Intermission.
• Transmitting an Overload Frame due to condition 2 and 3 must start one bit after the detecting the Dominant
bit of the condition.
• A maximum of two Overload frames may be generated in order to delay the next Data or Remote Frame.
Bit Error
A Bit Error occurs when a node transmits a bit value (i.e., Dominant or Recessive) but the opposite bit is detected
(e.g., a Dominant bit is transmitted but a Recessive is detected). However, if the transmitted bit is Recessive
and is located in the Arbitration Field or ACK Slot or Passive Error Flag, then detecting a Dominant bit will not be
considered a Bit Error.
Stuff Error
A stuff error is detected when 6 consecutive bits of the same value are detected (thus violating the bit-stuffing
encoding).
CRC Error
A Receiver of a Data or Remote Frame will calculate a CRC based on the bits it has received. A CRC error occurs
when the CRC calculated by the Receiver does not match the CRC sequence in the received Data or Remote
Frame.
Form Error
A Form Error is detected when a fixed-form bit field of a message contains an illegal bit. For example, the r1 and
r0 fields must be Dominant.
Acknowledgement Error
An Acknowledgment Error occurs when a Transmitter does not detect a Dominant bit at the ACK Slot.
Error Active
An Error Active node is able to participate in bus communication and transmit an Active Error Flag when it detects
an error.
Error Passive
An Error Passive node is able to participate in bus communication, but can only transmit an Passive Error Flag
when it detects an error. Error Passive nodes that have transmitted a Data or Remote Frame must also include
the Suspend Transmission field in the subsequent Interframe Space.
Bus Off
A Bus Off node is not permitted to influence the bus in any way (i.e., is not allowed to transmit anything).
1. When a Receiver detects an error, the REC will be increased by 1, except when the detected error was a Bit
Error during the transmission of an Active Error Flag or an Overload Flag.
2. When a Receiver detects a Dominant bit as the first bit after sending an Error Flag, the REC will be increased
by 8.
3. When a Transmitter sends an Error Flag the TEC is increased by 8. However, the following scenarios are
exempt form this rule:
• If a Transmitter is Error Passive that detects an Acknowledgment Error due to not detecting a Dominant
bit in the ACK slot, it should send a Passive Error Flag. If no Dominant bit is detected in that Passive
Error Flag, the TEC should not be increased.
• A Transmitter transmits an Error Flag due to a Stuff Error during Arbitration. If the offending bit should
have been Recessive but was monitored as Dominant, then the TEC should not be increased.
4. If a Transmitter detects a Bit Error whilst sending an Active Error Flag or Overload Flag, the REC is increased
by 8.
5. If a Receiver detects a Bit Error while sending an Active Error Flag or Overload Flag, the REC is increased by
8.
6. Any node tolerates up to 7 consecutive Dominant bits after sending an Active/Passive Error Flag, or Overload
Flag. After detecting the 14th consecutive Dominant bit (when sending an Active Error Flag or Overload Flag),
or the 8th consecutive Dominant bit following a Passive Error Flag, a Transmitter will increase its TEC by 8
and a Receiver will increase its REC by 8. Each additional eight consecutive Dominant bits will also increase
the TEC (for Transmitters) or REC (for Receivers) by 8 as well.
7. When a Transmitter successfully transmits a message (getting ACK and no errors until the EOF is complete),
the TEC is decremented by 1, unless the TEC is already at 0.
8. When a Receiver successfully receives a message (no errors before ACK Slot, and successful sending of
ACK), the REC is decremented.
• If the REC was greater than 127, the REC is set to 127.
9. A node becomes Error Passive when its TEC and/or REC is greater than or equal to 128. The error condition
that causes a node to become Error Passive will cause the node to send an Active Error Flag. Note that
once the REC has reached to 128, any further increases to its value are irrelevant until the REC returns to a
value less than 128.
10. A node becomes Bus Off when its TEC is greater than or equal to 256.
11. An Error Passive node becomes Error Active when both the TEC and REC are less than or equal to 127.
12. A Bus Off node can become Error Active (with both its TEC and REC reset to 0) after it monitors 128 occur-
rences of 11 consecutive Recessive bits on the bus.
• The Nominal Bit Rate is defined as number of bits transmitted per second from an ideal Transmitter and
without any synchronization.
A single Nominal Bit Time is divided into multiple segments, and each segment is made up of multiple Time Quanta.
A Time Quantum is a fixed unit of time, and is implemented as some form of prescaled clock signal in each node.
Figure 21-5 illustrates the segments within a single Nominal Bit Time.
TWAI Controllers will operate in time steps of one Time Quanta where the state of the TWAI bus is analyzed at
every Time Quanta. If two consecutive Time Quantas have different bus states (i.e., Recessive to Dominant or vice
versa), this will be considered an edge. When the bus is analyzed at the intersection of PBS1 and PBS2, this is
considered the Sample Point and the sampled bus value is considered the value of that bit.
Segment Description
SS The SS (Synchronization Segment) is 1 Time Quantum long. If all nodes are perfectly
synchronized, the edge of a bit will lie in the SS.
PBS1 PBS1 (Phase Buffer Segment 1) can be 1 to 16 Time Quanta long. PBS1 is meant
to compensate for the physical delay times within the network. PBS1 can also be
lengthened for synchronization purposes.
Segment Description
PBS2 PBS2 (Phase Buffer Segment 2) can be 1 to 8 Time Quanta long. PBS2 is meant to
compensate for the information processing time of nodes. PBS2 can also be shortened
for synchronization purposes.
• A positive Phase Error (e > 0) is when the edge lies after the SS and before the Sample Point (i.e., the edge
is late).
• A negative Phase Error (e < 0) is when the edge lies after the Sample Point of the previous bit and before SS
(i.e., the edge is early).
To correct for Phase Errors, there are two forms of synchronization, known as Hard Synchronization and Resyn
chronization. Hard Synchronization and Resynchronization obey the following rules.
Hard Synchronization
Hard Synchronization occurs on the Recessive to Dominant edges during Bus Idle (i.e., the SOF bit). All nodes
will restart their internal bit timings such that the Recessive to Dominant edge lies within the SS of the restarted bit
timing.
Resynchronization
Resynchronization occurs on Recessive to Dominant edges not during Bus Idle. If the edge has a positive Phase
Error (e > 0), PBS1 is lengthened by a certain number of Time Quanta. If the edge has a negative Phase Error (e
< 0), PBS2 will be shortened by a certain number of Time Quanta.
The number of Time Quanta to lengthen or shorten depends on the magnitude of the Phase Error, and is also
limited by the Synchronization Jump Width (SJW) value which is a programmable.
• When the magnitude of the Phase Error is less than or equal to the SJW, PBS1/PBS2 are lengthened/shortened
by e number of Time Quanta. This has a same effect as Hard Synchronization.
• When the magnitude of the Phase Error is greater to the SJW, PBS1/PBS2 are lengthened/shortened by the
SJW number of Time Quanta. This means it may take multiple bits of synchronization before the Phase Error
is entirely corrected.
Configuration Registers
The configuration registers store various configuration options for the TWAI controller such as bit rates, operating
mode, Acceptance Filter etc. Configuration registers can only be modified whilst the TWAI controller is in Reset
Mode (See Section 21.5.1).
Command Register
The command register is used by the CPU to drive the TWAI controller to initiate certain actions such as transmitting
a message or clearing the Receive Buffer. The command register can only be modified when the TWAI controller
is in Operation Mode (see section 21.5.1).
The error management registers include error counters and capture registers. The error counter registers represent
TEC and REC values. The capture registers will record information about instances where TWAI controller detects
a bus error, or when it loses arbitration.
Note that the Transmit Buffer registers, Receive Buffer registers, and the Acceptance Filter registers share the same
address range (offset 0x0040 to 0x0070). Their access is governed by the following rules:
• When the TWAI controller is in Reset Mode, the address range maps to the Acceptance Filter registers.
– All reads to the address range maps to the Receive Buffer registers.
– All writes to the address range maps to the Transmit Buffer registers.
21.5.1 Modes
The ESP32 TWAI controller has two working modes: Reset Mode and Operation Mode. Reset Mode and Operation
Mode are entered by setting the TWAI_RESET_MODE bit to 1 or 0 respectively.
• Normal Mode: The TWAI controller can transmit and receive messages including error signaling (such as
Error and Overload Frames).
• Self Test Mode: Like Normal Mode, but the TWAI controller will consider the transmission of a Data or
RTR Frame successful even if it was not acknowledged. This is commonly used when self testing the TWAI
controller.
• Listen Only Mode: The TWAI controller will be able to receive messages, but will remain completely passive
on the TWAI bus. Thus, the TWAI controller will not be able to transmit any messages, acknowledgments,
or error signals. The error counters will remain frozen. This mode is useful for TWAI bus monitors.
Note that when exiting Reset Mode (i.e., entering Operation Mode), the TWAI controller must wait for 11 consecutive
Recessive bits to occur before being able to fully connect the TWAI bus (i.e., be able to transmit or receive).
Bit 31-8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Reserved SJW.1 SJW.0 BRP.5 BRP.4 BRP.3 BRP.2 BRP.1 BRP.0
Notes:
• SJW: Synchronization Jump Width (SJW) is configured in SJW.0 and SJW.1 where SJW = (2 x SJW.1 +
SJW.0 + 1).
• BRP: The TWAI Time Quanta clock is derived from a prescaled version of the APB clock that is usually 80
MHz. The Baud Rate Prescaler (BRP) field is used to define the prescaler according to the equation below,
where tT q is the Time Quanta clock period and tCLK is APB clock period :
Bit 31-8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Reserved SAM PBS2.2 PBS2.1 PBS2.0 PBS1.3 PBS1.2 PBS1.1 PBS1.0
Notes:
• PBS1: The number of Time Quanta in Phase Buffer Segment 1 is defined according to the following equation:
(8 x PBS1.3 + 4 x PBS1.2 + 2 x PBS1.1 + PBS1.0 + 1).
• PBS2: The number of Time Quanta in Phase Buffer Segment 2 is defined according to the following equation:
(4 x PBS2.2 + 2 x PBS2.1 + PBS2.0 + 1).
• SAM: Enables triple sampling if set to 1. This is useful for low/medium speed buses where filtering spikes on
the bus line is beneficial.
• Receive Interrupt
• Transmit Interrupt
The TWAI controller’s interrupt signal to the interrupt matrix will be asserted whenever one or more interrupt bits are
set in the TWAI_INT_RAW_REG, and deasserted when all bits in TWAI_INT_RAW_REG are cleared. The majority
of interrupt bits in TWAI_INT_RAW_REG are automatically cleared when the register is read. However, the Receive
Interrupt is an exception and can only be cleared the Receive FIFO is empty.
includes valid messages in the Receive FIFO and also overrun messages. The RXI will not be deasserted until all
pending received messages are cleared using the TWAI_RELEASE_BUF command bit.
• A message transmission has completed successfully (i.e., Acknowledged without any errors). Any failed
messages will automatically be retried.
• A single shot transmission has completed (successfully or unsuccessfully, indicated by the TWAI_TX_COMPLETE
bit).
– If the TWAI controller was in the Error Active state, it indicates both the TEC and REC have returned
below the threshold value set by TWAI_ERR_WARNING_LIMIT_REG.
– If the TWAI controller was previously in the Bus Recovery state, it indicates that Bus Recovery has
completed successfully.
• If TWAI_ERR_ST = 1 and TWAI_BUS_OFF_ST = 0: The TEC or REC error counters have exceeded the
threshold value set by TWAI_ERR_WARNING_LIMIT_REG.
• If TWAI_ERR_ST = 1 and TWAI_BUS_OFF_ST = 1: The TWAI controller has entered the BUS_OFF state
(due to the TEC >= 256).
• If TWAI_ERR_ST = 0 and TWAI_BUS_OFF_ST = 1: The TWAI controller’s TEC has dropped below the
threshold value set by TWAI_ERR_WARNING_LIMIT_REG during BUS_OFF recovery.
The DOI is only triggered on the first message that causes the Receive FIFO to overrun (i.e., the transition from the
Receive FIFO not being full to the Receive FIFO overrunning). Any subsequent overrun messages will not trigger
the DOI again. The DOI will only be able to trigger again when all received messages (valid or overrun) have been
cleared.
Table 218. Buffer Layout for Standard Frame Format and Extended Frame Format
Table 21-8 illustrates the layout of the Transmit Buffer and Receive Buffer registers. Both the Transmit and Receive
Buffer registers share the same address space and are only accessible when the TWAI controller is in Operation
Mode. CPU write operations will access the Transmit Buffer registers, and CPU read operations will access the
Receive Buffer registers. However, both buffers share the exact same register layout and fields to represent a
message (received or to be transmitted). The Transmit Buffer registers are used to configure a TWAI message to
be transmitted. The CPU would write to the Transmit Buffer registers specifying the message’s frame type, frame
format, frame ID, and frame data (payload). Once the Transmit Buffer is configured, the CPU would then initiate
the transmission by setting the TWAI_TX_REQ bit in TWAI_CMD_REG.
• For a single-shot transmission, set both the TWAI_TX_REQ and the TWAI_ABORT_TX simultaneously.
The Receive Buffer registers map to the first message in the Receive FIFO. The CPU would read the Receive
Buffer registers to obtain the first message’s frame type, frame format, frame ID, and frame data (payload). Once
the message has been read from the Receive Buffer registers, the CPU can set the TWAI_RELEASE_BUF bit in
TWAI_CMD_REG so that the next message in the Receive FIFO will be loaded in to the Receive Buffer regis-
ters.
Bit 31-8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
1 2 3 3 4 4 4
Reserved FF RTR X X XDLC.3 DLC.2 DLC.1 DLC.04
Notes:
• FF: The Frame Format (FF) bit specifies whether the message is Extended Frame Format (EFF) or Standard
Frame Format (SFF). The message is EFF when FF bit is 1, and SFF when FF bit is 0.
• RTR: The Remote Transmission Request (RTR) bit specifies whether the message is a Data Frame or a
Remote Frame. The message is a Remote Frame when the RTR bit is 1, and a Data Frame when the RTR
bit is 0.
• DLC: The Data Length Code (DLC) field specifies the number of data bytes for a Data Frame, or the number
of data bytes to request in a Remote Frame. TWAI Data Frames are limited to a maximum payload of 8 data
bytes, thus the DLC should range anywhere from 0 to 8.
The Frame Identifier fields for an SFF (11-bits) message is shown in Table 21-10-21-11.
Bit 31-8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Reserved ID.28 ID.27 ID.26 ID.25 ID.24 ID.23 ID.22 ID.21
Bit 31-8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
1 2 2 2
Reserved ID.20 ID.19 ID.18 X X X X X2
The Frame Identifier fields for an EFF (29-bits) message is shown in Table 21-12-21-15.
Bit 31-8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Reserved ID.28 ID.27 ID.26 ID.25 ID.24 ID.23 ID.22 ID.21
Bit 31-8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Reserved ID.20 ID.19 ID.18 ID.17 ID.16 ID.15 ID.14 ID.13
Bit 31-8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Reserved ID.12 ID.11 ID.10 ID.9 ID.8 ID.7 ID.6 ID.5
Bit 31-8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
1 2
Reserved ID.4 ID.3 ID.2 ID.1 ID.0 X X X2
For example, when transmitting a Data Frame with 5 data bytes, the CPU should write a value of 5 to the DLC
field, and then fill in data bytes 1 to 5 in the Frame Data fields. Likewise, when receiving a Data Frame with a DLC
of 5, only data bytes 1 to 5 will contain valid payload data for the CPU to read.
When the TWAI controller receives a message, but the Receive FIFO lacks the adequate free space to store
the received message in its entirety (either due to the message contents being larger than the free space in the
Receive FIFO, or the Receive FIFO being completely full), the Receive FIFO will internally mark overrun messages as
invalid. Subsequent overrun messages will still increment the TWAI_RX_MESSAGE_COUNTER up to a maximum
of 64.
To clear an overrun Receive FIFO, the TWAI_RELEASE_BUF must be called repeatedly called until TWAI_RX_
MESSAGE_COUNTER is 0. This has the effect of freeing all valid messages in the Receive FIFO and clearing all
overrun messages.
The Acceptance Filter configuration registers can only be accessed whilst the TWAI controller is in Reset Mode,
due to those registers sharing the same address space as the Transmit Buffer and Receive Buffer registers.
The registers consist of a 32-bit Acceptance Code Value and a 32-bit Acceptance Mask Value. The Code value
specifies a bit pattern in which each filtered bit of the message must match in order for the message to be accepted.
The Mask value is able to mask out certain bits of the Code value (i.e., set as “Don’t Care” bits). Each filtered bit
of the message must either match the acceptance code or be masked in order for the message to be accepted,
as demonstrated in Figure 21-7.
The TWAI Controller Acceptance Filter allows the 32-bit Code and Mask values to either define a single filter (i.e.,
Single Filter Mode), or two filters (i.e., Dual Filter Mode). How the Acceptance Filter interprets the 32-bit code
and mask values is dependent on whether Single Filter Mode is enabled, and the received message (i.e., SFF or
EFF).
• SFF
– RTR bit
• EFF
– RTR bit
The following Figure 21-8 illustrates how the 32-bit code and mask values will be interpreted under Single Filter
Mode.
The two filters can filter the following bits of a Data or Remote Frame:
• SFF
– RTR bit
• EFF
The following Figure 21-9 illustrates how the 32-bit code and mask values will be interpreted under Dual Filter
Mode.
The current error state of the TWAI controller is indicated via a combination of the following values and status bits:
TEC, REC, TWAI_ERR_ST, and TWAI_BUS_OFF_ST. Certain changes to these values and bits will also trigger
interrupts, thus allowing the users to be notified of error state transitions (see section 21.5.3). The following figure
21-10 shows the relation between the error states, values and bits, and error state related interrupts.
has a default value of 96. When the values of TEC and/or REC are larger than or equal to the EWL value, the
TWAI_ERR_ST bit is immediately set to 1. Likewise, when the values of both the TEC and REC are smaller than
the EWL value, the TWAI_ERR_ST bit is immediately reset to 0. The Error Warning Interrupt is triggered whenever
the value of the TWAI_ERR_ST bit (or the TWAI_BUS_OFF_ST) changes.
• Set REC to 0
The Error Warning Interrupt is triggered whenever the value of the TWAI_BUS_OFF_ST bit (or the TWAI_ERR_ST
bit) changes.
To return to the Error Active state, the TWAI controller must undergo Bus-Off recovery. Bus-Off recovery requires
the TWAI controller to observe 128 occurrences of 11 consecutive Recessive bits on the bus. To initiate Bus-
Off recovery (after entering the Bus-Off state), the TWAI controller should enter Operation Mode by setting the
TWAI_RESET_MODE bit to 0. The TEC tracks the progress of Bus-Off recovery by decrementing the TEC each
time the TWAI controller observes 11 consecutive Recessive bits. When Bus-Off recovery has completed (i.e.,
TEC has decremented from 127 to 0), the TWAI_BUS_OFF_ST bit will automatically be reset to 0, thus triggering
the Error Warning Interrupt.
Bit 31-8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
1 1 2 3 3 3 3
Reserved ERRC.1 ERRC.0 DIR SEG.4 SEG.3 SEG.2 SEG.1 SEG.03
Notes:
• ERRC: The Error Code (ERRC) indicates the type of bus error: 00 for bit error, 01 for form error, 10 for stuff
error, 11 for other type of error.
• DIR: The Direction (DIR) indicates whether the TWAI controller was transmitting or receiving when the bus
error: 0 for Transmitter, 1 for Receiver.
• SEG: The Error Segment (SEG) indicates which segment of the TWAI message (i.e., bit position) the bus
error occurred at.
The following Table 21-17 shows how to interpret the SEG.0 to SEG.4 bits.
Bit SEG.4 Bit SEG.3 Bit SEG.2 Bit SEG.1 Bit SEG.0 Description
0 0 0 1 1 start of frame
0 0 0 1 0 ID.28 to ID.21
0 0 1 1 0 ID.20 to ID.18
0 0 1 0 0 bit SRTR1
0 0 1 0 1 bit IDE2
0 0 1 1 1 ID.17 to ID.13
0 1 1 1 1 ID.12 to ID.5
0 1 1 1 0 ID.4 to ID.0
0 1 1 0 0 bit RTR
0 1 1 0 1 reserved bit 1
0 1 0 0 1 reserved bit 0
0 1 0 1 1 data length code
0 1 0 1 0 data field
0 1 0 0 0 CRC sequence
1 1 0 0 0 CRC delimeter
1 1 0 0 1 acknowledge slot
1 1 0 1 1 acknowledge delimeter
1 1 0 1 0 end of frame
1 0 0 1 0 intermission
Bit SEG.4 Bit SEG.3 Bit SEG.2 Bit SEG.1 Bit SEG.0 Description
1 0 0 0 1 active error flag
1 0 1 1 0 passive error flag
1 0 0 1 1 tolerate dominant bits
1 0 1 1 1 error delimeter
1 1 1 0 0 overload flag
Notes:
Subsequent loses in arbitration will trigger the Arbitration Lost Interrupt, but will not be recorded in the TWAI_ARB
LOST CAP_REG until the current Arbitration Lost Capture is read from the TWAI_ERR_CODE_CAP_REG.
Table 21-18 illustrates the bit fields of the TWAI_ERR_CODE_CAP_REG whilst Figure 21-11 illustrates the bit
positions of a TWAI message.
Table 2118. Bit Information of TWAI_ARB LOST CAP_REG; TWAI Address 0x2c
Notes:
• BITNO: Bit Number (BITNO) indicates the nth bit of a TWAI message where arbitration was lost.
21.7 Registers
Register 21.1. TWAI_MODE_REG (0x0000)
DE
_M LY E
DE O
ES _O _M E
ET N OD
O _M
_R EN T D
AI IST ES MO
TW I_L F_ R_
A EL TE
T
TW I_S FIL
A X_
)
ed
TW I_R
rv
se
A
TW
(re
31 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 Reset
TWAI_RESET_MODE This bit is used to configure the operating mode of the TWAI Controller. 1:
Reset mode; 0: Operating mode (R/W)
TWAI_LISTEN_ONLY_MODE 1: Listen only mode. In this mode the nodes will only receive messages
from the bus, without generating the acknowledge signal nor updating the RX error counter. (R/W)
TWAI_SELF_TEST_MODE 1: Self test mode. In this mode the TX nodes can perform a successful
transmission without receiving the acknowledge signal. This mode is often used to test a single
node with the self reception request command. (R/W)
TWAI_RX_FILTER_MODE This bit is used to configure the filter mode. 0: Dual filter mode; 1: Single
filter mode (R/W)
C
P_
ES
M
R
JU
_P
C_
D
AU
YN
d)
_B
_S
e
rv
AI
AI
se
TW
TW
(re
31 8 7 6 5 0
TWAI_BAUD_PRESC Baud Rate Prescaler, determines the frequency dividing ratio. (RO | R/W)
1
M
G
SA
SE
SE
E_
E_
E_
M
IM
IM
)
ed
I
_T
_T
_T
rv
AI
AI
AI
se
TW
TW
TW
(re
31 8 7 6 4 3 0
TWAI_TIME_SAMP The number of sample points. 0: the bus is sampled once; 1: the bus is sampled
three times (RO | R/W)
IT
IM
_L
NG
NI
AR
W
R_
d)
R
ve
_E
r
AI
se
TW
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x60 Reset
TWAI_ERR_WARNING_LIMIT Error warning threshold. In the case when any of a error counter value
exceeds the threshold, or all the error counter values are below the threshold, an error warning
interrupt will be triggered (given the enable signal is valid). (RO | R/W)
_0
DE
O
E_C
NC
TA
EP
CC
_A
AI
W
|T
0
E_
YT
_B
)
ed
X
_T
rv
AI
se
TW
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 Reset
TWAI_TX_BYTE_0 Stored the 0th byte information of the data to be transmitted under operating
mode. (WO)
TWAI_ACCEPTANCE_CODE_0 Stored the 0th byte of the filter code under reset mode. (R/W)
_1
DE
O
_C
CE
N
TA
EP
CC
_A
AI
W
|T
1
E_
YT
_B
d)
X
ve
_T
r
AI
se
TW
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 Reset
TWAI_TX_BYTE_1 Stored the 1st byte information of the data to be transmitted under operating
mode. (WO)
TWAI_ACCEPTANCE_CODE_1 Stored the 1st byte of the filter code under reset mode. (R/W)
_2
DE
O
E_C
NC
TA
EP
CC
_A
AI
W
|T
2
E_
YT
_B
)
ed
X
_T
rv
AI
se
TW
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 Reset
TWAI_TX_BYTE_2 Stored the 2nd byte information of the data to be transmitted under operating
mode. (WO)
TWAI_ACCEPTANCE_CODE_2 Stored the 2nd byte of the filter code under reset mode. (R/W)
_3
DE
O
_C
CE
N
TA
EP
CC
_A
AI
W
|T
3
E_
YT
_B
d)
X
ve
_T
r
AI
se
TW
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 Reset
TWAI_TX_BYTE_3 Stored the 3rd byte information of the data to be transmitted under operating
mode. (WO)
TWAI_ACCEPTANCE_CODE_3 Stored the 3rd byte of the filter code under reset mode. (R/W)
0
K_
AS
E_M
NC
TA
EP
CC
_A
AI
W
|T
4
E_
YT
_B
d)
X
ve
_T
er
AI
s
TW
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 Reset
TWAI_TX_BYTE_4 Stored the 4th byte information of the data to be transmitted under operating
mode. (WO)
TWAI_ACCEPTANCE_MASK_0 Stored the 0th byte of the filter code under reset mode. (R/W)
1
K_
AS
_M
CE
N
TA
EP
CC
_A
AI
W
|T
5
E_
YT
_B
d)
X
ve
_T
r
AI
se
TW
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 Reset
TWAI_TX_BYTE_5 Stored the 5th byte information of the data to be transmitted under operating
mode. (WO)
TWAI_ACCEPTANCE_MASK_1 Stored the 1st byte of the filter code under reset mode. (R/W)
2
K_
AS
E_M
NC
TA
EP
CC
_A
AI
W
|T
6
E_
YT
_B
d)
X
ve
_T
er
AI
s
TW
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 Reset
TWAI_TX_BYTE_6 Stored the 6th byte information of the data to be transmitted under operating
mode. (WO)
TWAI_ACCEPTANCE_MASK_2 Stored the 2nd byte of the filter code under reset mode. (R/W)
3
K_
AS
_M
CE
N
TA
EP
CC
_A
AI
W
|T
7
E_
YT
_B
d)
X
ve
_T
r
AI
se
TW
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 Reset
TWAI_TX_BYTE_7 Stored the 7th byte information of the data to be transmitted under operating
mode. (WO)
TWAI_ACCEPTANCE_MASK_3 Stored the 3rd byte of the filter code under reset mode. (R/W)
8
E_
YT
_B
d)
X
ve
_T
r
AI
se
TW
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 Reset
TWAI_TX_BYTE_8 Stored the 8th byte information of the data to be transmitted under operating
mode. (WO)
9
E_
YT
_B
d)
X
ve
_T
er
AI
s
TW
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 Reset
TWAI_TX_BYTE_9 Stored the 9th byte information of the data to be transmitted under operating
mode. (WO)
10
E_
YT
_B
d)
X
ve
_T
r
AI
se
TW
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 Reset
TWAI_TX_BYTE_10 Stored the 10th byte information of the data to be transmitted under operating
mode. (WO)
11
E_
YT
_B
)
ed
X
_T
rv
AI
se
TW
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 Reset
TWAI_TX_BYTE_11 Stored the 11th byte information of the data to be transmitted under operating
mode. (WO)
12
E_
YT
_B
d)
X
e
_T
rv
AI
se
TW
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 Reset
TWAI_TX_BYTE_12 Stored the 12th byte information of the data to be transmitted under operating
mode. (WO)
FF
DE
_O
O
CK
M
T_
LO
d)
D
ed
X
_C
_C
ve
_E
v
r
er
AI
AI
AI
se
s
TW
TW
TW
(re
(re
31 8 7 6 4 3 2 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0x0 Reset
TWAI_CD These bits are used to configure frequency dividing coefficients of the external CLKOUT
pin. (R/W)
TWAI_CLOCK_OFF This bit can be configured under reset mode. 1: Disable the external CLKOUT
pin; 0: Enable the external CLKOUT pin (RO | R/W)
TWAI_EXT_MODE This bit can be configured under reset mode. 1: Extended mode, compatiable
with CAN2.0B; 0: Basic mode (RO | R/W)
AI BO SE UN
X_ T_ UF
A L VE Q
E
TW I_A EA RR
_T R _B
TW I_R _O _R
RE TX
A LR X
Q
R
TW _C _
AI ELF
)
E
ed
TW I_S
rv
se
A
TW
(re
31 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
TWAI_TX_REQ Set the bit to 1 to allow the driving nodes start transmission. (WO)
TWAI_CLR_OVERRUN Set the bit to 1 to clear the data overrun status bit. (WO)
TWAI_SELF_RX_REQ Self reception request command. Set the bit to 1 to allow a message be
transmitted and received simultaneously. (WO)
AI VE F_S TE
F_ ST
A X_ T T
TW I_O BU PLE
TW I_T _S _S
ST
_R RR T
BU N_
A RR FF
X_ U
A X_ M
TW I_E _O
TW I_T CO
TW I_T ST
TW I_R ST
A US
A X_
A X_
d)
TW I_B
e
rv
se
A
TW
(re
31 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 Reset
TWAI_RX_BUF_ST 1: The data in the RX buffer is not empty, with at least one received data packet.
(RO)
TWAI_OVERRUN_ST 1: The RX FIFO is full and data overrun has occurred. (RO)
TWAI_TX_BUF_ST 1: The TX buffer is empty, the CPU may write a message into it. (RO)
TWAI_TX_COMPLETE 1: The TWAI controller has successfully received a packet from the bus. (RO)
TWAI_RX_ST 1: The TWAI Controller is receiving a message from the bus. (RO)
TWAI_ERR_ST 1: At least one of the RX/TX error counter has reached or exceeded the value set in
register TWAI_ERR_WARNING_LIMIT_REG. (RO)
TWAI_BUS_OFF_ST 1: In bus-off status, the TWAI Controller is no longer involved in bus activities.
(RO)
AP
_C
ST
O
_L
RB
)
ed
_A
rv
AI
se
TW
(re
31 5 4 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 Reset
TWAI_ARB_LOST_CAP This register contains information about the bit position of lost arbitration.
(RO)
T
O
EN
TI
EC
M
E
EG
_E TYP
IR
_D
_S
_
TW CC
CC
CC
d)
ve
_E
_E
r
AI
AI
AI
se
TW
TW
(re
31 8 7 6 5 4 0
TWAI_ECC_SEGMENT This register contains information about the location of errors, see Table 21-
16 for details. (RO)
TWAI_ECC_DIRECTION This register contains information about transmission direction of the node
when error occurs. 1: Error occurs when receiving a message; 0: Error occurs when transmitting
a message (RO)
TWAI_ECC_TYPE This register contains information about error types: 00: bit error; 01: form error;
10: stuff error; 11: other type of error (RO)
_R
ve
r
AI
se
TW
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 Reset
TWAI_RX_ERR_CNT The RX error counter register, reflects value changes under reception status.
(RO | R/W)
NT
_C
RR
_E
d)
X
ve
_T
er
AI
s
TW
(re
31 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 Reset
TWAI_TX_ERR_CNT The TX error counter register, reflects value changes under transmission status.
(RO | R/W)
R
TE
UN
CO
E_
G
SA
ES
M
X_
d)
_R
e
rv
AI
se
TW
(re
31 7 6 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x0 Reset
TWAI_RX_MESSAGE_COUNTER This register reflects the number of messages available within the
RX FIFO. (RO)
T
_S
ST
VE ST
X_ _S _IN T
NT
TW rve _P T_ _ST
IN T T_
_R T N S
SI _
AI X_I AR NT_
_I
A d) AS INT
se RR OS T
(re I_E _L _IN
TW _T _W _I
ST
AI RR UN
A RB RR
T_
TW _E RR
TW I_A _E
N
A US
AI VE
)
ed
TW I_O
TW I_B
rv
se
A
TW
(re
31 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
TWAI_RX_INT_ST Receive interrupt. If this bit is set to 1, it indicates there are messages to be
handled in the RX FIFO. (RO)
TWAI_TX_INT_ST Transmit interrupt. If this bit is set to 1, it indicates the message transmitting mis-
sion is finished and a new transmission is able to execute. (RO)
TWAI_ERR_WARN_INT_ST Error warning interrupt. If this bit is set to 1, it indicates the error status
signal and the bus-off status signal of Status register have changed (e.g., switched from 0 to 1 or
from 1 to 0). (RO)
TWAI_OVERRUN_INT_ST Data overrun interrupt. If this bit is set to 1, it indicates the data in the RX
FIFO is invalid. (RO)
TWAI_ERR_PASSIVE_INT_ST Error passive interrupt. If this bit is set to 1, it indicates the TWAI
Controller is switched between error active status and error passive status due to the change of
error counters. (RO)
TWAI_BUS_ERR_INT_ST Error interrupt. If this bit is set to 1, it indicates an error is detected on the
bus. (RO)
NA
A
_E
_I A
EN
X_ _E _IN NA
A d) AS INT A
VE EN
NT
TW rve _P T_ _EN
IN N T_
_R T N E
SI _
AI X_I AR NT_
se RR OS T
(re I_E _L _IN
A
T_ A
TW _T _W _I
EN
AI RR UN
A RB RR
TW _E RR
TW I_A _E
N
A US
AI VE
d)
TW I_O
TW I_B
ve
er
A
s
TW
(re
31 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
22.1 Introduction
The AES Accelerator speeds up AES operations significantly, compared to AES algorithms implemented solely
in software. The AES Accelerator supports six algorithms of FIPS PUB 197, specifically AES-128, AES-192 and
AES-256 encryption and decryption.
22.2 Features
• Supports AES-128 encryption and decryption
• Supports four variations of key endianness and four variations of text endianness
AES_MODE_REG[2:0] Operation
0 AES-128 Encryption
1 AES-192 Encryption
2 AES-256 Encryption
4 AES-128 Decryption
5 AES-192 Decryption
6 AES-256 Decryption
Plaintext and ciphertext is stored in the AES_TEXT_m_REG registers. There are four 32-bit registers. To enable
AES-128/192/256 encryption, initialize the AES_TEXT_m_REG registers with plaintext before encryption. When
encryption is finished, the AES Accelerator will store back the resulting ciphertext in the AES_TEXT_m_REG reg-
isters. To enable AES-128/192/256 decryption, initialize the AES_TEXT_m_REG registers with ciphertext be-
fore decryption. When decryption is finished, the AES Accelerator will store back the resulting plaintext in the
AES_TEXT_m_REG registers.
22.3.3 Endianness
Key Endianness
Bit 0 and bit 1 in AES_ENDIAN_REG define the key endianness. For detailed information, please see Table 22-3,
Table 22-4 and Table 22-5. w[0] ~ w[3] in Table 22-3, w[0] ~ w[5] in Table 22-4 and w[0] ~ w[7] in Table 22-5 are
“the first Nk words of the expanded key” as specified in “5.2: Key Expansion” of FIPS PUB 197. “Column Bit”
specifies the bytes in the word from w[0] to w[7]. The bytes of AES_KEY_n_REG comprise “the first Nk words of
the expanded key”.
Text Endianness
Bit 2 and bit 3 in AES_ENDIAN_REG define the endianness of input text, while Bit 4 and Bit 5 define the endianness
of output text. The input text refers to the plaintext in AES-128/192/256 encryption and the ciphertext in decryption.
The output text refers to the ciphertext in AES-128/192/256 encryption and the plaintext in decryption. For details,
please see Table 22-2. “State” in Table 22-2 is defined as that in “3.4: The State” of FIPS PUB 197: “The AES
algorithm operations are performed on a two-dimensional array of bytes called the State”. The ciphertext or
plaintexts stored in each byte of AES_TEXT_m_REG comprise the State.
Table 222. AES Text Endianness
22
AES Accelerator (AES)
AES_ENDIAN_REG[1] AES_ENDIAN_REG[0] Bit w[0] w[1] w[2] w[3]
[31:24] AES_KEY_3_REG[31:24] AES_KEY_2_REG[31:24] AES_KEY_1_REG[31:24] AES_KEY_0_REG[31:24]
[23:16] AES_KEY_3_REG[23:16] AES_KEY_2_REG[23:16] AES_KEY_1_REG[23:16] AES_KEY_0_REG[23:16]
0 0
[15:8] AES_KEY_3_REG[15:8] AES_KEY_2_REG[15:8] AES_KEY_1_REG[15:8] AES_KEY_0_REG[15:8]
[7:0] AES_KEY_3_REG[7:0] AES_KEY_2_REG[7:0] AES_KEY_1_REG[7:0] AES_KEY_0_REG[7:0]
[31:24] AES_KEY_3_REG[7:0] AES_KEY_2_REG[7:0] AES_KEY_1_REG[7:0] AES_KEY_0_REG[7:0]
[23:16] AES_KEY_3_REG[15:8] AES_KEY_2_REG[15:8] AES_KEY_1_REG[15:8] AES_KEY_0_REG[15:8]
0 1
[15:8] AES_KEY_3_REG[23:16] AES_KEY_2_REG[23:16] AES_KEY_1_REG[23:16] AES_KEY_0_REG[23:16]
[7:0] AES_KEY_3_REG[31:24] AES_KEY_2_REG[31:24] AES_KEY_1_REG[31:24] AES_KEY_0_REG[31:24]
[31:24] AES_KEY_0_REG[31:24] AES_KEY_1_REG[31:24] AES_KEY_2_REG[31:24] AES_KEY_3_REG[31:24]
[23:16] AES_KEY_0_REG[23:16] AES_KEY_1_REG[23:16] AES_KEY_2_REG[23:16] AES_KEY_3_REG[23:16]
1 0
[15:8] AES_KEY_0_REG[15:8] AES_KEY_1_REG[15:8] AES_KEY_2_REG[15:8] AES_KEY_3_REG[15:8]
[7:0] AES_KEY_0_REG[7:0] AES_KEY_1_REG[7:0] AES_KEY_2_REG[7:0] AES_KEY_3_REG[7:0]
[31:24] AES_KEY_0_REG[7:0] AES_KEY_1_REG[7:0] AES_KEY_2_REG[7:0] AES_KEY_3_REG[7:0]
[23:16] AES_KEY_0_REG[15:8] AES_KEY_1_REG[15:8] AES_KEY_2_REG[15:8] AES_KEY_3_REG[15:8]
1 1
[15:8] AES_KEY_0_REG[23:16] AES_KEY_1_REG[23:16] AES_KEY_2_REG[23:16] AES_KEY_3_REG[23:16]
[7:0] AES_KEY_0_REG[31:24] AES_KEY_1_REG[31:24] AES_KEY_2_REG[31:24] AES_KEY_3_REG[31:24]
AES_ENDIAN_REG[1] AES_ENDIAN_REG[0] Bit w[0] w[1] w[2] w[3] w[4] w[5] w[6] w[7]
[31:24] AES_KEY_7_REG[31:24] AES_KEY_6_REG[31:24] AES_KEY_5_REG[31:24] AES_KEY_4_REG[31:24] AES_KEY_3_REG[31:24] AES_KEY_2_REG[31:24] AES_KEY_1_REG[31:24] AES_KEY_0_REG[31:24]
[23:16] AES_KEY_7_REG[23:16] AES_KEY_6_REG[23:16] AES_KEY_5_REG[23:16] AES_KEY_4_REG[23:16] AES_KEY_3_REG[23:16] AES_KEY_2_REG[23:16] AES_KEY_1_REG[23:16] AES_KEY_0_REG[23:16]
0 0
[15:8] AES_KEY_7_REG[15:8] AES_KEY_6_REG[15:8] AES_KEY_5_REG[15:8] AES_KEY_4_REG[15:8] AES_KEY_3_REG[15:8] AES_KEY_2_REG[15:8] AES_KEY_1_REG[15:8] AES_KEY_0_REG[15:8]
[7:0] AES_KEY_7_REG[7:0] AES_KEY_6_REG[7:0] AES_KEY_5_REG[7:0] AES_KEY_4_REG[7:0] AES_KEY_3_REG[7:0] AES_KEY_2_REG[7:0] AES_KEY_1_REG[7:0] AES_KEY_0_REG[7:0]
[31:24] AES_KEY_7_REG[7:0] AES_KEY_6_REG[7:0] AES_KEY_5_REG[7:0] AES_KEY_4_REG[7:0] AES_KEY_3_REG[7:0] AES_KEY_2_REG[7:0] AES_KEY_1_REG[7:0] AES_KEY_0_REG[7:0]
[23:16] AES_KEY_7_REG[15:8] AES_KEY_6_REG[15:8] AES_KEY_5_REG[15:8] AES_KEY_4_REG[15:8] AES_KEY_3_REG[15:8] AES_KEY_2_REG[15:8] AES_KEY_1_REG[15:8] AES_KEY_0_REG[15:8]
0 1
[15:8] AES_KEY_7_REG[23:16] AES_KEY_6_REG[23:16] AES_KEY_5_REG[23:16] AES_KEY_4_REG[23:16] AES_KEY_3_REG[23:16] AES_KEY_2_REG[23:16] AES_KEY_1_REG[23:16] AES_KEY_0_REG[23:16]
[7:0] AES_KEY_7_REG[31:24] AES_KEY_6_REG[31:24] AES_KEY_5_REG[31:24] AES_KEY_4_REG[31:24] AES_KEY_3_REG[31:24] AES_KEY_2_REG[31:24] AES_KEY_1_REG[31:24] AES_KEY_0_REG[31:24]
[31:24] AES_KEY_0_REG[31:24] AES_KEY_1_REG[31:24] AES_KEY_2_REG[31:24] AES_KEY_3_REG[31:24] AES_KEY_4_REG[31:24] AES_KEY_5_REG[31:24] AES_KEY_6_REG[31:24] AES_KEY_7_REG[31:24]
[23:16] AES_KEY_0_REG[23:16] AES_KEY_1_REG[23:16] AES_KEY_2_REG[23:16] AES_KEY_3_REG[23:16] AES_KEY_4_REG[23:16] AES_KEY_5_REG[23:16] AES_KEY_6_REG[23:16] AES_KEY_7_REG[23:16]
1 0
[15:8] AES_KEY_0_REG[15:8] AES_KEY_1_REG[15:8] AES_KEY_2_REG[15:8] AES_KEY_3_REG[15:8] AES_KEY_4_REG[15:8] AES_KEY_5_REG[15:8] AES_KEY_6_REG[15:8] AES_KEY_7_REG[15:8]
[7:0] AES_KEY_0_REG[7:0] AES_KEY_1_REG[7:0] AES_KEY_2_REG[7:0] AES_KEY_3_REG[7:0] AES_KEY_4_REG[7:0] AES_KEY_5_REG[7:0] AES_KEY_6_REG[7:0] AES_KEY_7_REG[7:0]
[31:24] AES_KEY_0_REG[7:0] AES_KEY_1_REG[7:0] AES_KEY_2_REG[7:0] AES_KEY_3_REG[7:0] AES_KEY_4_REG[7:0] AES_KEY_5_REG[7:0] AES_KEY_6_REG[7:0] AES_KEY_7_REG[7:0]
[23:16] AES_KEY_0_REG[15:8] AES_KEY_1_REG[15:8] AES_KEY_2_REG[15:8] AES_KEY_3_REG[15:8] AES_KEY_4_REG[15:8] AES_KEY_5_REG[15:8] AES_KEY_6_REG[15:8] AES_KEY_7_REG[15:8]
1 1
[15:8] AES_KEY_0_REG[23:16] AES_KEY_1_REG[23:16] AES_KEY_2_REG[23:16] AES_KEY_3_REG[23:16] AES_KEY_4_REG[23:16] AES_KEY_5_REG[23:16] AES_KEY_6_REG[23:16] AES_KEY_7_REG[23:16]
[7:0] AES_KEY_0_REG[31:24] AES_KEY_1_REG[31:24] AES_KEY_2_REG[31:24] AES_KEY_3_REG[31:24] AES_KEY_4_REG[31:24] AES_KEY_5_REG[31:24] AES_KEY_6_REG[31:24] AES_KEY_7_REG[31:24]
22 AES Accelerator (AES)
2. Write 1 to AES_START_REG.
Consecutive Operations
Every time an operation is completed, only AES_TEXT_m_REG is modified by the AES Accelerator. Initialization
can, therefore, be simplified in a series of consecutive operations.
2. Load AES_TEXT_m_REG.
3. Write 1 to AES_START_REG.
22.3.5 Speed
The AES Accelerator requires 11 to 15 clock cycles to encrypt a message block, and 21 or 22 clock cycles to
decrypt a message block.
22.5 Registers
Register 22.1. AES_START_REG (0x000)
T
AR
d)
ST
ve
er
S_
s
AE
(re
31 1 0
0x00000000 x Reset
LE
)
d
ve
ID
r
S_
se
AE
(re
31 1 0
0x00000000 1 Reset
AES_IDLE AES Idle register. Reads ’zero’ while the AES Accelerator is busy processing; reads ’one’
otherwise. (RO)
DE
)
ed
O
_M
rv
se
S
AE
(re
31 3 2 0
0x00000000 0 Reset
AES_MODE Selects the AES accelerator mode of operation. See Table 22-1 for details. (R/W)
31 0
0x000000000 Reset
31 0
0x000000000 Reset
AN
DI
)
ed
EN
v
er
S_
s
AE
(re
31 6 5 0
0x0000000 1 1 1 1 1 1 Reset
AES_ENDIAN Endianness selection register. See Table 22-2 for details. (R/W)
23.1 Introduction
The SHA Accelerator is included to speed up SHA hashing operations significantly, compared to SHA hashing
algorithms implemented solely in software. The SHA Accelerator supports four algorithms of FIPS PUB 180-4,
specifically SHA-1, SHA-256, SHA-384 and SHA-512.
23.2 Features
Hardware support for popular secure hashing algorithms:
• SHA-1
• SHA-256
• SHA-384
• SHA-512
The SHA Accelerator is unable to perform the padding operation of “5.1 Padding the Message” in FIPS PUB 180-4;
Note that the user software is expected to pad the message before feeding it into the accelerator.
(i) (i)
As described in “2.2.1: Parameters” in FIPS PUB 180-4, “M0 is the leftmost word of message block i”. M0
is stored in SHA_TEXT_0_REG. In the same fashion, the SHA_TEXT_1_REG register stores the second left-most
(N )
word of a message block M1 , etc.
As described in “2.2.1 Parameters” in FIPS PUB 180-4, “H (N ) is the final hash value, and is used to determine
(i) (N )
the message digest”, while “H0 is the leftmost word of hash value i”, so the leftmost word H0 in the message
(N )
digest is stored in SHA_TEXT_0_REG. In the same fashion, the second leftmost word H1 in the message digest
is stored in SHA_TEXT_1_REG, etc.
(c) Wait for SHA_X_BUSY_REG to read 0, indicating that the operation is completed.
(c) Wait for SHA_X_BUSY_REG to read 0, indicating that the operation is completed.
23.3.4 Speed
The SHA Accelerator requires 60 to 100 clock cycles to process a message block and 8 to 20 clock cycles to
calculate the final digest.
23.5 Registers
Register 23.1. SHA_TEXT_n_REG (n: 031) (0x0+4*n)
31 0
0x000000000 Reset
SHA_TEXT_n_REG (n: 031) SHA Message block and hash result register. (R/W)
RT
TA
_S
A1
d)
SH
ve
A_
r
se
SH
(re
31 1 0
0x00000000 0 Reset
SHA_SHA1_START Write 1 to start an SHA-1 operation on the first message block. (WO)
UE
IN
NT
O
_C
A1
)d
SH
ve
A_
er
s
SH
(re
31 1 0
0x00000000 0 Reset
SHA_SHA1_CONTINUE Write 1 to continue the SHA-1 operation with subsequent blocks. (WO)
SH
e
rv
A_
se
SH
(re
31 1 0
0x00000000 0 Reset
SHA_SHA1_LOAD Write 1 to finish the SHA-1 operation to calculate the final message hash. (WO)
Y
US
_B
A1
d)
SH
ve
A_
r
se
SH
(re
31 1 0
0x00000000 0 Reset
SHA_SHA1_BUSY SHA-1 operation status: 1 if the SHA accelerator is processing data, 0 if it is idle.
(RO)
R T
TA
_S
56
A2
d)
SH
e
rv
A_
se
SH
(re
31 1 0
0x00000000 0 Reset
SHA_SHA256_START Write 1 to start an SHA-256 operation on the first message block. (WO)
UE
IN
NT
O
_C
56
A2
d)
SH
ve
A_
r
se
SH
(re
31 1 0
0x00000000 0 Reset
SHA_SHA256_CONTINUE Write 1 to continue the SHA-256 operation with subsequent blocks. (WO)
AD
O
_L
56
A2
d)
SH
ve
A_
er
s
SH
(re
31 1 0
0x00000000 0 Reset
SHA_SHA256_LOAD Write 1 to finish the SHA-256 operation to calculate the final message hash.
(WO)
Y
US
_B
56
A2
d)
SH
ve
A_
r
se
SH
(re
31 1 0
0x00000000 0 Reset
R T
TA
_S
84
A3
d)
SH
e
rv
A_
se
SH
(re
31 1 0
0x00000000 0 Reset
SHA_SHA384_START Write 1 to start an SHA-384 operation on the first message block. (WO)
UE
IN
NT
O
_C
84
A3
d)
SH
ve
A_
er
s
SH
(re
31 1 0
0x00000000 0 Reset
SHA_SHA384_CONTINUE Write 1 to continue the SHA-384 operation with subsequent blocks. (WO)
AD
O
_L
84
A3
)d
SH
ve
A_
er
s
SH
(re
31 1 0
0x00000000 0 Reset
SHA_SHA384_LOAD Write 1 to finish the SHA-384 operation to calculate the final message hash.
(WO)
SY
BU
4_
38
HA
)
ed
S
rv
A_
se
SH
(re
31 1 0
0x00000000 0 Reset
R T
TA
_S
12
A5
d)
SH
ve
A_
er
s
SH
(re
31 1 0
0x00000000 0 Reset
SHA_SHA512_START Write 1 to start an SHA-512 operation on the first message block. (WO)
UE
IN
NT
O
_C
12
A5
d)
SH
e
rv
A_
se
SH
(re
31 1 0
0x00000000 0 Reset
SHA_SHA512_CONTINUE Write 1 to continue the SHA-512 operation with subsequent blocks. (WO)
AD
O
_L
12
A5
d)
SH
ve
A_
r
se
SH
(re
31 1 0
0x00000000 0 Reset
SHA_SHA512_LOAD Write 1 to finish the SHA-512 operation to calculate the final message hash.
(WO)
Y
US
_B
12
A5
d)
SH
ve
A_
er
s
SH
(re
31 1 0
0x00000000 0 Reset
24.1 Introduction
The RSA Accelerator provides hardware support for multiple precision arithmetic operations used in RSA asym-
metric cipher algorithms.
Sometimes, multiple precision arithmetic is also called ”bignum arithmetic”, ”bigint arithmetic” or ”arbitrary precision
arithmetic”.
24.2 Features
• Support for large-number modular exponentiation
When the RSA Accelerator is released from reset, the register RSA_CLEAN_REG reads 0 and an initialization
process begins. Hardware initializes the four memory blocks by setting them to 0. After initialization is complete,
RSA_CLEAN_REG reads 1. For this reason, software should query RSA_CLEAN_REG after being released from
reset, and before writing to any RSA Accelerator memory blocks or registers for the first time.
The RSA Accelerator supports operand lengths of N ∈ {512, 1024, 1536, 2048, 2560, 3072, 3584, 4096} bits. The
bit length of arguments Z, X, Y , M , and r can be any one from the N set, but all numbers in a calculation must
be of the same length. The bit length of M ′ is always 32.
To represent the numbers used as operands, define a base-b positional notation, as follows:
b = 232
In this notation, each number is represented by a sequence of base-b digits, where each base-b digit is a 32-
bit word. Representing an N -bit number requires n base-b digits (all of the possible N lengths are multiples of
32).
N
n=
32
Z = (Zn−1 Zn−2 · · · Z0 )b
X = (Xn−1 Xn−2 · · · X0 )b
Y = (Yn−1 Yn−2 · · · Y0 )b
M = (Mn−1 Mn−2 · · · M0 )b
r = (rn−1 rn−2 · · · r0 )b
Each of the n values in Zn−1 ~ Z0 , Xn−1 ~ X0 , Yn−1 ~ Y0 , Mn−1 ~ M0 , rn−1 ~ r0 represents one base-b digit (a
32-bit word).
Zn−1 , Xn−1 , Yn−1 , Mn−1 and rn−1 are the most significant bits of Z, X, Y , M , while Z0 , X0 , Y0 , M0 and r0 are
the least significant bits.
If we define
R = bn
r = R2 mod M (1)
M ′′ × M + 1 = R × R−1
(2)
M ′ = M ′′ mod b
(Equation 2 is written in a form suitable for calculations using the extended binary GCD algorithm.)
Users need to write data to each memory block only according to the length of the number; data beyond
this length are ignored.
3. Write M ′ to RSA_M_PRIME_REG.
4. Write 1 to RSA_MODEXP_START_REG.
5. Wait for the operation to be completed. Poll RSA_INTERRUPT_REG until it reads 1, or until the RSA_INTR
interrupt is generated.
After the operation, the RSA_MODEXP_MODE_REG register, memory blocks RSA_Y_MEM and RSA_M_MEM,
as well as the RSA_M_PRIME_REG will not have changed. However, Xi in RSA_X_MEM and ri in RSA_Z_MEM
will have been overwritten. In order to perform another operation, refresh the registers and memory blocks, as
required.
The RSA Accelerator supports large-number modular multiplication with eight different operand lengths, which are
the same as in the large-number modular exponentiation. The operation is performed by a combination of software
and hardware. The software performs two hardware operations in sequence.
2. Write Xi , Mi and ri (i ∈ [0, n) ∩ N) to registers RSA_X_MEM, RSA_M_MEM and RSA_Z_MEM. Write data
to each memory block only according to the length of the number. Data beyond this length are ignored.
3. Write M ′ to RSA_M_PRIME_REG.
4. Write 1 to RSA_MULT_START_REG.
5. Wait for the first round of the operation to be completed. Poll RSA_INTERRUPT_REG until it reads 1, or until
the RSA_INTR interrupt is generated.
Users need to write to the memory block only according to the length of the number. Data beyond this length
are ignored.
8. Write 1 to RSA_MULT_START_REG.
9. Wait for the second round of the operation to be completed. Poll RSA_INTERRUPT_REG until it reads 1, or
until the RSA_INTR interrupt is generated.
After the operation, the RSA_MULT_MODE_REG register, and memory blocks RSA_M_MEM and RSA_M_PRIME_REG
remain unchanged. Users do not need to refresh these registers or memory blocks if the values remain the
same.
Operands X and Y need to be extended to form arguments X̂ and Ŷ which have the same length (N̂ bits) as the
2. Write X̂i and Ŷi (i ∈ [0, n̂) ∩ N) to RSA_X_MEM and RSA_Z_MEM, respectively.
Write the valid data into each number’s memory block, according to their lengths. Values beyond this length
are ignored. Half of the base-b positional notations written to the memory are zero (using the derivations
shown above). These zero values are indispensable.
3. Write 1 to RSA_MULT_START_REG.
4. Wait for the operation to be completed. Poll RSA_INTERRUPT_REG until it reads 1, or until the RSA_INTR
interrupt is generated.
24.5 Registers
Register 24.1. RSA_M_PRIME_REG (0x800)
31 0
0x000000000 Reset
DE
O
_M
XP
DE
)
O
ed
M
rv
A_
se
RS
(re
31 3 2 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
TR
TA
_S
XP
DE
d)
O
ve
M
r
A_
se
RS
(re
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
M
r
A_
se
RS
(re
31 4 3 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RSA_MULT_MODE This register contains the mode of modular multiplication and multiplication.
(R/W)
T
AR
ST
T_
UL
d)
ve
M
r
A_
se
RS
(re
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PT
RU
ER
d)
T
e
IN
rv
A_
se
RS
(re
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RSA_INTERRUPT RSA interrupt status register. Will read 1 once an operation has completed. (R/W)
N
EA
d )
CL
ve
er
A_
s
RS
(re
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RSA_CLEAN This bit will read 1 once the memory initialization is completed. (RO)
25.1 Introduction
The ESP32 contains a true random number generator, which generates 32-bit random numbers that can be used
for cryptographical operations, among other things.
25.2 Feature
The random number generator generates true random numbers, which means random number generated from a
physical process, rather than by means of an algorithm. No number generated within the specified range is more
or less likely to appear than any other number.
Thermal noise comes from the high-speed ADC or SAR ADC or both. Whenever the high-speed ADC or SAR ADC
is enabled, bit streams will be generated and fed into the random number generator through an XOR logic gate as
random seeds.
When the RTC8M_CLK clock is enabled for the digital core, the random number generator will also sample
RTC8M_CLK (8 MHz) as a random bit seed. RTC8M_CLK is an asynchronous clock source and it increases
the RNG entropy by introducing circuit metastability. However, to ensure maximum entropy, it’s recommended to
always enable an ADC source as well.
When there is noise coming from the SAR ADC, the random number generator is fed with a 2-bit entropy in one
clock cycle of RTC8M_CLK (8 MHz), which is generated from an internal RC oscillator (see Chapter Reset and
Clock for details). Thus, it is advisable to read the RNG_DATA_REG register at a maximum rate of 500 kHz to
obtain the maximum entropy.
When there is noise coming from the high-speed ADC, the random number generator is fed with a 2-bit entropy
in one APB clock cycle, which is normally 80 MHz. Thus, it is advisable to read the RNG_DATA_REG register at a
maximum rate of 5 MHz to obtain the maximum entropy.
A data sample of 2 GB, which is read from the random number generator at a rate of 5 MHz with only the high-
speed ADC being enabled, has been tested using the Dieharder Random Number Testsuite (version 3.31.1). The
• SAR ADC can be enabled by using the DIG ADC controller. For details, please refer to Chapter 29 On-Chip
Sensors and Analog Signal Processing.
• High-speed ADC is enabled automatically when the Wi-Fi or Bluetooth modules is enabled.
Note:
Note that, when the Wi-Fi module is enabled, the value read from the high-speed ADC can be saturated in some extreme
cases, which lowers the entropy. Thus, it is advisable to also enable the SAR ADC as the noise source for the random
number generator for such cases.
When using the random number generator, read the RNG_DATA_REG register multiple times until sufficient random
numbers have been generated. Ensure the rate at which the register is read does not exceed the frequencies
described in section 25.3 above.
25.6 Register
Register 25.1. RNG_DATA_REG (0x144)
31 0
0x000000000 Reset
26.1 Overview
Many variants of the ESP32 must store programs and data in external flash memory. The external flash memory
chip is likely to contain proprietary firmware and sensitive user data, such as credentials for gaining access to a
private network. The Flash Encryption block can encrypt code and write encrypted code to off-chip flash memory
for enhanced hardware security. When the CPU reads off-chip flash through the cache, the Flash Decryption
block can automatically decrypt instructions and data read from the off-chip flash, thus providing hardware-based
security for application code.
26.2 Features
• Various key generation methods
• Software-based encryption
• Register configuration, system parameters and boot mode jointly determine the flash encryption/decryption
function.
The Flash Encryption/Decryption module consists of three parts, namely the Key Generator, Flash Encryption block
and Flash Decryption block. The structure of these parts is shown in Figure 26-1. The Key Generator is shared by
both the Flash Encryption block and the Flash Decryption block, which can function simultaneously.
In the peripheral DPort Register, the register relevant to Flash Encryption/Decryption is DPORT_SPI_ENCRYPT_ENABLE
Then, according to system parameter flash_crypt_config, and off-chip flash physical addresses Addre and Addrd
accessed by the Flash Encryption block and the Flash Decryption block, the Key Generator will respectively figure
out that:
Keye = g(Keyo , f lash_crypt_conf ig, Addre ),
Keyd = g(Keyo , f lash_crypt_conf ig, Addrd ).
When all values of system parameter flash_crypt_config are 0, Keye and Keyd are not relevant to the physical
address of the off-chip flash. When all values of system parameter flash_crypt_config are not 0, every 8-word
block on the off-chip flash has a dedicated Keye and Keyd .
The Flash Encryption block requires software intervention during operation. The steps are as follows:
2. Write the physical address prepared for the off-chip flash on register FLASH_ENCRYPT_ADDRESS_REG.
The address must be 8-word boundary aligned.
3. The Flash Encryption block must encrypt 8-word long code segments. Write the lowest word to regis-
ter FLASH_ENCRYPT_BUFFER_0_REG, the second-lowest word into FLASH_ENCRYPT_BUFFER_1_REG,
and so on, up to FLASH_ENCRYPT_BUFFER_7_REG.
6. Use this function and write any 8-word code to the 8-word aligned address on the off-chip flash via the
peripheral SPI0.
In Steps 1 to 5, the Flash Encryption block encrypts 8-word long codes. The key encryption algorithm uses Keye .
The encryption result will also be 8-word long. In Step 6, the peripheral SPI0 writes encrypted results of the Flash
Encryption block to the off-chip flash. One parameter of the function used in Step 6 will be the physical address of
the off-chip flash. The physical address must be 8-word boundary aligned. Also, the value must be the same as
the value written into register FLASH_ENCRYPT_ADDRESS_REG during Step 2. Even though the function used
in Step 6 still has a parameter with an 8-word long code, the parameter will be meaningless if Steps 1 to 5 are
executed. The Peripheral SPI0 will use the encrypted result instead. If the Flash Encryption block is not operating,
or has not executed Steps 1 to 5, Step 6 will not use the encrypted result. Instead, the function parameter will be
used.
Even though software participates in the whole process, it cannot directly read the encrypted codes. Instead,
the encrypted codes are integrated into the off-chip flash. Even though the CPU can skip the cache and get the
encrypted code directly by reading the off-chip flash, the software can by no means access Keye .
When the Flash Decryption block is operating, the CPU will read instructions and data from the off-chip flash via
the cache. The Flash Decryption block automatically decrypts the instructions and data in the cache. The entire
decryption process does not need software intervention and is transparent to the cache. The decryption algorithm
can decrypt the code that has been encrypted by the Flash Encryption block. Software cannot access the key
algorithm Keyd used.
When the Flash Encryption block is not operating, it does not have any effect on the contents stored in the off-chip
flash, be they encrypted or unencrypted. What the CPU reads via the cache is the original information stored in
the off-chip flash.
In the efuse system parameter flash_crypt_cnt (7 bits wide), if the number of bits with value 1 is odd, the
Flash Decryption block is operational. Otherwise, it is not.
26.5 Register
Register 26.1. FLASH_ENCRYPTION_BUFFER_n_REG (n: 07) (0x0+4*n)
31 0
0x000000000 Reset
R T
TA
)
_S
d
ve
SH
r
se
A
(re
FL
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
FLASH_START Set this bit to start encryption operation on data buffer. (WO)
31 0
0x000000000 Reset
H_
rv
AS
se
(re
FL
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
27.1 Introduction
Every peripheral and memory section in the ESP32 is accessed through either an MMU (Memory Management
Unit) or an MPU (Memory Protection Unit). An MPU can allow or disallow the access of an application to a memory
range or peripheral, depending on what kind of permission the OS has given to that particular application. An MMU
can perform the same operation, as well as a virtual-to-physical memory address translation. This can be used to
map an internal or external memory range to a certain virtual memory area. These mappings can be application-
specific. Therefore, each application can be adjusted and have the memory configuration that is necessary for
it to run properly. To differentiate between the OS and applications, there are eight Process Identifiers (or PIDs)
that each application, or OS, can run. Furthermore, each application, or OS, is equipped with their own sets of
mappings and rights.
27.2 Features
• Eight processes in each of the PRO_CPU and APP_CPU
• MPU/MMU management of on-chip memories, off-chip memories, and peripherals, based on process ID
There are two peripheral PID controllers in the system, one for each of the two CPUs in the ESP32. Having a PID
controller per CPU allows running different processes on different CPUs, if so desired.
27.3.2 MPU/MMU
The MPU and MMU manage on-chip memories, off-chip memories, and peripherals. To do this they are based
on the process of accessing the peripheral or memory region. More specifically, when a code tries to access a
MMU/MPU-protected memory region or peripheral, the MMU or MPU will receive the PID from the PID generator
that is associated with the CPU on which the process is running.
For on-chip memory and peripherals, the decisions the MMU and MPU make are only based on this PID, whereas
the specific CPU the code is running on is not taken into account. Subsequently, the MMU/MPU configuration
for the internal memory and peripherals allows entries only for the eight different PIDs. In contrast, the MMU
moderating access to the external memory takes not only the PID into account, but also the CPU the request is
coming from. This means that MMUs have configuration options for every PID when running on the APP_CPU, as
well as every PID when running on the PRO_CPU. While, in practice, accesses from both CPUs will be configured
to have the same result for a specific process, doing so is not a hardware requirement.
The decision an MPU can make, based on this information, is to allow or deny a process to access the memory
region or peripheral. An MMU has the same function, but additionally it redirects the virtual memory access, which
the process acquired, into a physical memory access that can possibly reach out an entirely different physical
memory region. This way, MMU-governed memory can be remapped on a process-by-process basis.
Address range
Name Size Governed by
From To
ROM0 384 KB 0x4000_0000 0x4005_FFFF Static MPU
ROM1 64 KB 0x3FF9_0000 0x3FF9_FFFF Static MPU
64 KB 0x4007_0000 0x4007_FFFF Static MPU
SRAM0
128 KB 0x4008_0000 0x4009_FFFF SRAM0 MMU
128 KB 0x3FFE_0000 0x3FFF_FFFF Static MPU
SRAM1 (aliases) 128 KB 0x400A_0000 0x400B_FFFF Static MPU
32 KB 0x4000_0000 0x4000_7FFF Static MPU
72 KB 0x3FFA_E000 0x3FFB_FFFF Static MPU
SRAM2
128 KB 0x3FFC_0000 0x3FFD_FFFF SRAM2 MMU
8 KB 0x3FF8_0000 0x3FF8_1FFF RTC FAST MPU
RTC FAST (aliases)
8 KB 0x400C_0000 0x400C_1FFF RTC FAST MPU
RTC SLOW 8 KB 0x5000_0000 0x5000_1FFF RTC SLOW MPU
Static MPUs
ROM0, ROM1, the lower 64 KB of SRAM0, SRAM1 and the lower 72 KB of SRAM2 are governed by a static MPU.
The behaviour of these MPUs are hardwired and cannot be configured by software. They moderate access to the
memory region solely through the PID of the current process. When the PID of the process is 0 or 1, the memory
can be read (and written when it is RAM) using the addresses specified in Table 27-1. When it is 2 ~ 7, the memory
cannot be accessed.
The 8 KB RTC FAST Memory as well as the 8 KB of RTC SLOW Memory are governed by two configurable MPUs.
The MPUs can be configured to allow or deny access to each individual PID, using the RTC_CNTL_RTC_PID_
CONFIG_REG and DPORT_AHBLITE_MPU_TABLE_RTC_REG registers. Setting a bit in these registers will allow
the corresponding PID to read or write from the memory; clearing the bit disallows access. Access for PID 0 and
1 to RTC SLOW memory cannot be configured and is always enabled. Table 27-2 and 27-3 define the bit-to-PID
mappings of the registers.
Register RTC_CNTL_RTC_PID_CONFIG_REG is part of the RTC peripheral and can only be modified by processes
with a PID of 0; register DPORT_AHBLITE_MPU_TABLE_RTC_REG is a Dport register and can be changed by
processes with a PID of 0 or 1.
Both the upper 128 KB of SRAM0 and the upper 128 KB of SRAM2 are governed by an MMU. Not only can
these MMUs allow or deny access to the memory they govern (just like the MPUs do), but they are also capable
of translating the address a CPU reads from or writes to (which is a virtual address) to a possibly different address
in memory (the physical address).
In order to accomplish this, the internal RAM MMUs divide the memory range they govern into 16 pages. The page
size is configurable as 8 KB, 4 KB and 2 KB. When the page size is 8 KB, the 16 pages span the entire 128 KB
memory region; when the page size is 4 KB or 2 KB, a non-MMU-covered region of 64 or 96 KB, respectively, will
exist at the end of the memory space. Similar to the virtual and physical addresses, it is also possible to imagine
the pages as having a virtual and physical component. The MMU can convert an address within a virtual page to
an address within a physical page.
For PID 0 and 1, this mapping is 1-to-1, meaning that a read from or write to a certain virtual page will always be
converted to a read from or write to the exact same physical page. This allows an operating system, running under
PID 0 and/or 1, to always have access to the entire physical memory range.
For PID 2 to 7, however, every virtual page can be reconfigured, on a per-PID basis, to map to a different physical
page. This way, reads and writes to an offset within a virtual page get translated into reads and writes to the same
offset within a different physical page. This is illustrated in Figure 27-1: the CPU (running a process with a PID
between 2 to 7) tries to access memory address 0x3FFC_2345. This address is within the virtual Page 1 memory
region, at offset 0x0345. The MMU is instructed that for this particular PID, it should translate an access to virtual
page 1 into physical Page 2. This causes the memory access to be redirected to the same offset as the virtual
memory access, yet in Page 2, which results in the effective access of physical memory address 0x3FFC_4345.
The page size in this example is 8 KB.
3FFC_0000 3FFC_0000
PAGE 0 PAGE 0
3FFC_2000 3FFC_2000
3FFC_2345 PAGE 1 PAGE 1
3FFC_4000 3FFC_4000
3FFC_4345
PAGE 2 PAGE 2
3FFC_6000 3FFC_6000
3FFD_E000 3FFD_E000
PAGE 15 PAGE 15
3FFE_0000 3FFE_0000
Table 274. Page Mode of MMU for the Remaining 128 KB of Internal SRAM0 and SRAM2
For the MMU-managed region of SRAM0 and SRAM2, the page size is configurable as 8 KB, 4 KB and 2 KB. The
configuration is done by setting the DPORT_IMMU_PAGE_MODE (for SRAM0) and DPORT_DMMU_PAGE_MODE
(for SRAM2) bits in registers DPORT_IMMU_PAGE_MODE_REG and DPORT_DMMU_PAGE_MODE_REG, as de-
tailed in Table 27-4. Because the number of pages for either region is fixed at 16, the total amount of memory
covered by these pages is 128 KB when 8 KB pages are selected, 64 KB when 4 KB pages are selected, and
32 KB when 2 KB pages are selected. This implies that for 8 KB pages, the entire MMU-managed range is used,
but for the other page sizes there will be a part of the 128 KB memory that will not be governed by the MMU
settings. Concretely, for a page size of 4 KB, these regions are 0x4009_0000 to 0x4009_FFFF and 0x3FFD_0000
to 0x3FFD_FFFF; for a page size of 2 KB, the regions are 0x4008_8000 to 0x4009_FFFF and 0x3FFC_8000 to
0x3FFD_FFFF. These ranges are readable and writable by processes with a PID of 0 or 1; processes with other
PIDs cannot access this memory.
The layout of the pages in memory space is linear, namely, an SRAM0 MMU page n covers address space
0x40080000 + (pagesize ∗ n) to 0x40080000 + (pagesize ∗ (n + 1) − 1); similarily, an SRAM2 MMU page n covers
0x3F F C0000 + (pagesize ∗ n) to 0x3F F C0000 + (pagesize ∗ (n + 1) − 1). Tables 27-5 and 27-6 show the resulting
addresses in full.
MMU Mapping
For each of the SRAM0 and SRAM2 MMUs, access rights and virtual to physical page mapping are done by a
set of 16 registers. In contrast to most of the other MMUs, each register controls a physical page, not a virtual
one. These registers control which of the PIDs have access to the physical memory, as well as which virtual page
maps to this physical page. The bits in the register are described in Table 27-7. Keep in mind that these registers
only govern accesses from processes with PID 2 to 7; PID 0 and 1 always have full read and write access to all
pages and no virtual-to-physical mapping is done. In other words, if a process with a PID of 0 or 1 accesses virtual
page x, the access will always go to physical page x, regardless of these register settings. These registers, as well
as the page size selection registers DPORT_IMMU_PAGE_MODE_REG and DPORT_DMMU_PAGE_MODE_REG,
are only writable from a process with PID 0 or 1.
The memory governed by the SRAM0 MMU is accessed through the processors I-bus, while the processor ac-
cesses the memory governed by the SRAM2 MMU through the D-bus. Thus, the normal envisioned use is for the
code to be stored in the SRAM0 MMU pages and data in the MMU pages of SRAM2. In general, applications
running under a PID of 2 to 7 are not expected to modify their own code, because for these PIDs access to the
MMU pages of SRAM0 is read-only. These applications must, however, be able to modify their data section, so
that they are allowed to read as well as write MMU pages located in SRAM2. As stated before, processes running
under PID 0 or 1 always have full read-and-write access to both memory ranges.
DMA MPU
Applications may want to configure the DMA to send data straight from or to the peripherals they can control. With
access to DMA, a malicious process may also be able to copy data from or to a region it cannot normally access.
In order to be secure against that scenario, there is a DMA MPU which can be used to disallow DMA transfers
For each 8 KB region in the SRAM1 and SRAM2 regions, there is a bit in the DPORT_AHB_MPU_TABLE_n_REG
registers which tells the MPU to either allow or disallow DMA access to this region. The DMA MPU uses only these
bits to decide if a DMA transfer can be started; the PID of the process is not a factor. This means that when the
OS wants to restrict its processes in a heterogenous fashion, it will need to re-load these registers with the values
applicable to the process to be run on every context switch.
The register bits that govern access to the 8 KB regions are detailed in Table 27-8. When a register bit is set, DMA
can read/write the corresponding 8 KB memory range. When the bit is cleared, access to that memory range is
denied.
Note:
In hardware, there are three instruction buses corresponding to V Addr1 , V Addr2 , and V Addr3 , respectively. These
three buses can initiate load or fetch accesses simultaneously, but only one access is true. If more than one unmasked
instruction buses are present, then bit8 of all MMU entries should be set to zero. Otherwise, when an invalid MMU entry
is used by an access, the cache will be stalled even if there is no program at this access.
The MMU entries, as stated before, are used for mapping a virtual memory page access to a physical memory
page access. The MMU controls five regions of virtual address space, detailed in Table 27-9. V Addr1 to V Addr4
are used for accessing external flash, whereas V AddrRAM is used for accessing external RAM. Note that V Addr4
is a subset of V Addr0 .
Boundary address
Name Size Page quantity
Low High
V Addr0 4 MB 0x3F40_0000 0x3F7F_FFFF 64
V Addr1 4 MB 0x4000_0000 0x403F_FFFF 64*
V Addr2 4 MB 0x4040_0000 0x407F_FFFF 64
V Addr3 4 MB 0x4080_0000 0x40BF_FFFF 64
V Addr4 1 MB 0x3F40_0000 0x3F4F_FFFF 16
V AddrRAM 4 MB 0x3F80_0000 0x3FBF_FFFF 128
* The configuration entries for address range 0x4000_0000 ~ 0x403F_FFFF are implemented and docu-
mented as if it were a full 4 MB address range, but it is not accessible as such. Instead, the address range
0x4000_0000 ~ 0x400C_1FFF accesses on-chip memory. This means that some of the configuration entries for
V Addr1 will not be used.
External Flash
For flash, the relationships among entry numbers, virtual memory ranges, and PIDs are detailed in Tables 27-10 and
27-11, which for every memory region and PID combination specify the first MMU entry governing the mapping.
This number refers to the MMU entry governing the very first page; the entire region is described by the amount of
pages specified in the ’count’ column.
These two tables are essentially the same, with the sole difference being that the APP_CPU entry numbers are
2048 higher than the corresponding PRO_CPU numbers. Note that memory regions V Addr0 and V Addr1 are
only accessible using PID 0 and 1, while V Addr4 can only be accessed by PID 2 ~ 7.
As these tables show, virtual address V Addr1 can only be used by processes with a PID of 0 or 1. There is
a special mode to allow processes with a PID of 2 to 7 to read the External Flash via address V Addr1 . When
the DPORT_PRO_SINGLE_IRAM_ENA bit of register DPORT_PRO_CACHE_CTRL_REG is 1, the MMU enters
this special mode for PRO_CPU memory accesses. Similarily, when the DPORT_APP_SINGLE_IRAM_ENA bit of
register DPORT_APP_CACHE_CTRL_REG is 1, the APP_CPU accesses memory using this special mode. In this
mode, the process and virtual address page supported by each configuration entry of MMU are different. For
details please see Table 27-12 and 27-13. As shown in these tables, in this special mode V Addr2 and V Addr3
cannot be used to access External Flash.
Every configuration entry of MMU maps a virtual address page of a CPU process to a physical address page. An
entry is 32 bits wide. Of these, bits 0~7 indicate the physical page the virtual page is mapped to. Bit 8 should be
cleared to indicate that the MMU entry is valid; entries with this bit set will not map any physical address to the
virtual address. Bits 10 to 32 are unused and should be written as zero. Because there are eight address bits in
an MMU entry, and the page size for external flash is 64 KB, a maximum of 256 * 64 KB = 16 MB of external flash
is supported.
Examples
Example 1. A PRO_CPU process, with a PID of 1, needs to read external flash address 0x07_2375 via virtual
address 0x3F70_2375. The MMU is not in the special mode.
• According to Table 27-9, virtual address 0x3F70_2375 resides in the 0x30’th page of V Addr0 .
• According to Table 27-10, the MMU entry for V Addr0 for PID 0/1 for the PRO_CPU starts at 0.
• The modified MMU entry is 0 + 0x30 = 0x30.
• Address 0x07_2375 resides in the 7’th 64 KB-sized page.
• MMU entry 0x30 needs to be set to 7 and marked as valid by setting the 8’th bit to 0. Thus, 0x007 is written
to MMU entry 0x30.
Example 2. An APP_CPU process, with a PID of 4, needs to read external flash address 0x44_048C via virtual
address 0x4044_048C. The MMU is not in special mode.
• According to Table 27-9, virtual address 0x4044_048C resides in the 0x4’th page of V Addr2 .
• According to Table 27-11, the MMU entry for V Addr2 for PID 4 for the APP_CPU starts at 2560.
• The modified MMU entry is 2560 + 0x4 = 2564.
• Address 0x44_048C resides in the 0x44’th 64 KB-sized page.
• MMU entry 2564 needs to be set to 0x44 and marked as valid by setting the 8’th bit to 0. Thus, 0x044 is
written to MMU entry 2564.
External RAM
Processes running on PRO_CPU and APP_CPU can read and write External SRAM via the Cache at virtual address
range V AddrRAM , which is 0x3F80_0000 ~ 0x3FBF_FFFF. As with the flash MMU, the address space and the
physical memory are divided into pages. For the External RAM MMU, the page size is 32 KB and the MMU is able
to map 256 physical pages into the virtual address space, allowing for 32 KB * 256 = 8 MB of physical external
RAM to be mapped.
The mapping of virtual pages into this memory range depends on the mode this MMU is in: Low-High mode, Even-
Odd mode, or Normal mode. In all cases, the DPORT_PRO_DRAM_HL bit and DPORT_PRO_DRAM_SPLIT bit in
register DPORT_PRO_CACHE_CTRL_REG, the DPORT_APP_DRAM_HL bit and DPORT_APP_DRAM_SPLIT bit
in register DPORT_APP_CACHE_CTRL_REG determine the virtual address mode for External SRAM. For details,
please see Table 27-14. If a different mapping for the PRO_CPU and APP_CPU is required, the Normal Mode
should be selected, as it is the only mode that can provide this. If it is allowable for the PRO_CPU and the
APP_CPU to share the same mapping, using either High-Low or Even-Odd mode can give a speed gain when
both CPUs access memory frequently.
In case the APP_CPU cache is disabled, which renders the region of 0x4007_8000 to 0x4007_FFFF usable as
normal internal RAM, the usability of the various cache modes changes. Normal mode will allow PRO_CPU access
to external RAM to keep functioning, but the APP_CPU will be unable to access the external RAM. High-Low mode
allows both CPUs to use external RAM, but only for the 2 MB virtual memory addresses from 0x3F80_0000 to
0x3F9F_FFFF. It is not advised to use Even-Odd mode with the APP_CPU cache region disabled.
DPORT_PRO_DRAM_HL DPORT_PRO_DRAM_SPLIT
Mode
DPORT_APP_DRAM_HL DPORT_APP_DRAM_SPLIT
Low-High 1 0
Even-Odd 0 1
Normal 0 0
In normal mode, the virtual-to-physical page mapping can be different for both CPUs. Page mappings for PRO_CPU
are set using the MMU entries for L V AddrRAM , and page mappings for the APP_CPU can be configured using the
MMU entries for R V AddrRAM . In this mode, all 128 pages of both L V Addr and R V Addr are fully used, allowing
a maximum of 8 MB of memory to be mapped; 4 MB into PRO_CPU address space and a possibly different 4 MB
into the APP_CPU address space, as can be seen in Table 27-15.
PRO_CPU address
Virtual address Size
Low High
L
V AddrRAM 4 MB 0x3F80_0000 0x3FBF_FFFF
APP_CPU address
Virtual address Size
Low High
R
V AddrRAM 4 MB 0x3F80_0000 0x3FBF_FFFF
In Low-High mode, both the PRO_CPU and the APP_CPU use the same mapping entries. In this mode L V AddrRAM
is used for the lower 2 MB of the virtual address space, while R V AddrRAM is used for the upper 2 MB. This also
means that the upper 64 MMU entries for L V AddrRAM , as well as the lower 64 entries for R
V AddrRAM , are
unused. Table 27-16 details these address ranges.
PRO_CPU/APP_CPU address
Virtual address Size
Low High
L
V AddrRAM 2 MB 0x3F80_0000 0x3F9F_FFFF
R
V AddrRAM 2 MB 0x3FA0_0000 0x3FBF_FFFF
In Even-Odd memory, the VRAM is split into 32-byte chunks. The even chunks are resolved through the MMU
entries for L V AddrRAM , the odd chunks through the entries for R
V AddrRAM . Generally, the MMU entries for
L R
V AddrRAM and V AddrRAM are set to the same values, so that the virtual pages map to a contiguous region
of physical memory. Table 27-17 details this mode.
PRO_CPU/APP_CPU address
Virtual address Size
Low High
L
V AddrRAM 32 Bytes 0x3F80_0000 0x3F80_001F
R
V AddrRAM 32 Bytes 0x3F80_0020 0x3F80_003F
L
V AddrRAM 32 Bytes 0x3F80_0040 0x3F80_005F
R
V AddrRAM 32 Bytes 0x3F80_0060 0x3F80_007F
...
L
V AddrRAM 32 Bytes 0x3FBF_FFC0 0x3FBF_FFDF
R
V AddrRAM 32 Bytes 0x3FBF_FFE0 0x3FBF_FFFF
The bit configuration of the External RAM MMU entries is the same as for the flash memory: the entries are 32-bit
registers, with the lower nine bits being used. Bits 0~7 contain the physical page the entry should map its associate
virtual page address to, while bit 8 is cleared when the entry is valid and set when it is not. Table 27-18 details the
first MMU entry number for L V AddrRAM and R V AddrRAM for all PIDs.
Examples
Example 1. A PRO_CPU process, with a PID of 7, needs to read or write external RAM address 0x7F_A375 via
virtual address 0x3FA7_2375. The MMU is in Low-High mode.
• According to Table 27-9, virtual address 0x3FA7_2375 resides in the 0x4E’th 32-KB-page of V AddrRAM .
• According to Table 27-16, virtual address 0x3FA7_2375 is governed by R V AddrRAM .
• According to Table 27-18, the MMU entry for R V AddrRAM for PID 7 for the PRO_CPU starts at 3968.
• The modified MMU entry is 3968 + 0x4E = 4046.
• Address 0x7F_A375 resides in the 255’th 32 KB-sized page.
• MMU entry 4046 needs to be set to 255 and marked as valid by clearing the 8’th bit. Thus, 0x0FF is written
to MMU entry 4046.
Example 2. An APP_CPU process, with a PID of 5, needs to read or write external RAM address 0x55_5805 up
to 0x55_5823 starting at virtual address 0x3F85_5805. The MMU is in Even-Odd mode.
• According to Table 27-9, virtual address 0x3F85_5805 resides in the 0x0A’th 32-KB-page of V AddrRAM .
• According to Table 27-17, the range to be read/written spans both a 32-byte region in R V AddrRAM and
L
V AddrRAM .
• According to Table 27-18, the MMU entry for L V AddrRAM for PID 5 starts at 1664.
• According to Table 27-18, the MMU entry for R V AddrRAM for PID 5 starts at 3712.
• The modified MMU entries are 1664 + 0x0A = 1674 and 3712 + 0x0A = 3722.
• The addresses 0x55_5805 to 0x55_5823 reside in the 0xAA’th 32 KB-sized page.
• MMU entries 1674 and 3722 need to be set to 0xAA and marked as valid by setting the 8’th bit to 0. Thus,
0x0AA is written to MMU entries 1674 and 3722. This mapping applies to both the PRO_CPU and the
APP_CPU.
Example 3. A PRO_CPU process, with a PID of 1, and an APP_CPU process whose PID is also 1, need to read or
write external RAM using virtual address 0x3F80_0876. The PRO_CPU needs this region to access physical ad-
dress 0x10_0876, while the APP_CPU wants to access physical address 0x20_0876 through this virtual address.
The MMU is in Normal mode.
• According to Table 27-9, virtual address 0x3F80_0876 resides in the 0’th 32-KB-page of V AddrRAM .
• According to Table 27-18, the MMU entry for PID 1 for the PRO_CPU starts at 1152.
• According to Table 27-18, the MMU entry for PID 1 for the APP_CPU starts at 3200.
• The MMU entries that are modified are 1152 + 0 = 1152 for the PRO_CPU and 3200 + 0 = 3200 for the
APP_CPU.
• Address 0x10_0876 resides in the 0x20’th 32 KB-sized page.
• Address 0x20_0876 resides in the 0x40’th 32 KB-sized page.
• For the PRO_CPU, MMU entry 1152 needs to be set to 0x20 and marked as valid by clearing the 8’th bit.
Thus, 0x020 is written to MMU entry 1152.
• For the APP_CPU, MMU entry 3200 needs to be set to 0x40 and marked as valid by clearing the 8’th bit.
Thus, 0x040 is written to MMU entry 3200.
• Now, the PRO_CPU and the APP_CPU can access different physical memory regions through the same
virtual address.
27.3.2.3 Peripheral
The Peripheral MPU manages the 41 peripheral modules. This MMU can be configured per peripheral to only allow
access from a process with a certain PID. The registers to configure this are detailed in Table 27-19.
Authority
Peripheral
PID = 0/1 PID = 2 ~ 7
DPort Register Access Forbidden
AES Accelerator Access Forbidden
RSA Accelerator Access Forbidden
SHA Accelerator Access Forbidden
Secure Boot Access Forbidden
Cache MMU Table Access Forbidden
PID Controller Access Forbidden
UART0 Access DPORT_AHBLITE_MPU_TABLE_UART_REG
SPI1 Access DPORT_AHBLITE_MPU_TABLE_SPI1_REG
SPI0 Access DPORT_AHBLITE_MPU_TABLE_SPI0_REG
GPIO Access DPORT_AHBLITE_MPU_TABLE_GPIO_REG
RTC Access DPORT_AHBLITE_MPU_TABLE_RTC_REG
IO MUX Access DPORT_AHBLITE_MPU_TABLE_IO_MUX_REG
SDIO Slave Access DPORT_AHBLITE_MPU_TABLE_HINF_REG
UDMA1 Access DPORT_AHBLITE_MPU_TABLE_UHCI1_REG
I2S0 Access DPORT_AHBLITE_MPU_TABLE_I2S0_REG
UART1 Access DPORT_AHBLITE_MPU_TABLE_UART1_REG
I2C0 Access DPORT_AHBLITE_MPU_TABLE_I2C_EXT0_REG
UDMA0 Access DPORT_AHBLITE_MPU_TABLE_UHCI0_REG
SDIO Slave Access DPORT_AHBLITE_MPU_TABLE_SLCHOST_REG
RMT Access DPORT_AHBLITE_MPU_TABLE_RMT_REG
PCNT Access DPORT_AHBLITE_MPU_TABLE_PCNT_REG
SDIO Slave Access DPORT_AHBLITE_MPU_TABLE_SLC_REG
LED PWM Access DPORT_AHBLITE_MPU_TABLE_LEDC_REG
Efuse Controller Access DPORT_AHBLITE_MPU_TABLE_EFUSE_REG
Flash Encryption Access DPORT_AHBLITE_MPU_TABLE_SPI_ENCRYPT_REG
PWM0 Access DPORT_AHBLITE_MPU_TABLE_PWM0_REG
TIMG0 Access DPORT_AHBLITE_MPU_TABLE_TIMERGROUP_REG
TIMG1 Access DPORT_AHBLITE_MPU_TABLE_TIMERGROUP1_REG
SPI2 Access DPORT_AHBLITE_MPU_TABLE_SPI2_REG
SPI3 Access DPORT_AHBLITE_MPU_TABLE_SPI3_REG
SYSCON Access DPORT_AHBLITE_MPU_TABLE_APB_CTRL_REG
Authority
Peripheral
PID = 0/1 PID = 2 ~ 7
I2C1 Access DPORT_AHBLITE_MPU_TABLE_I2C_EXT1_REG
SDMMC Access DPORT_AHBLITE_MPU_TABLE_SDIO_HOST_REG
EMAC Access DPORT_AHBLITE_MPU_TABLE_EMAC_REG
PWM1 Access DPORT_AHBLITE_MPU_TABLE_PWM1_REG
I2S1 Access DPORT_AHBLITE_MPU_TABLE_I2S1_REG
UART2 Access DPORT_AHBLITE_MPU_TABLE_UART2_REG
PWM2 Access DPORT_AHBLITE_MPU_TABLE_PWM2_REG
PWM3 Access DPORT_AHBLITE_MPU_TABLE_PWM3_REG
RNG Access DPORT_AHBLITE_MPU_TABLE_PWR_REG
Each bit of register DPORT_AHBLITE_MPU_TABLE_X_REG determines whether each process can access the
peripherals managed by the register. For details please see Table 27-20. When a bit of register DPORT_AHBLITE_
MPU_TABLE_X_REG is 1, it means that a process with the corresponding PID can access the corresponding
peripheral of the register. Otherwise, the process cannot access the corresponding peripheral.
PID 234567
DPORT_AHBLITE_MPU_TABLE_X_REG bit 012345
All the DPORT_AHBLITE_MPU_TABLE_X_REG registers are in peripheral DPort Register. Only processes with PID
0/1 can modify these registers.
28.1 Overview
The ESP32 is a dual core device and is capable of running and managing multiple processes. The PID Controller
supports switching of PID when a process switch occurs. In addition to PID management, the PID Controller
also facilitates management of nested interrupts by recording execution status just before an interrupt service
routine is executed. This enables the user application to manage process switches and nested interrupts more
efficiently.
28.2 Features
The PID Controller features:
• An interrupt occurs and the CPU fetches an instruction from the interrupt vector. Instruction fetch or execution
from interrupt vector is always treated as a process with PID of 0, irrespective of which process was being
executed on the CPU when the interrupt occurred.
• A currently active process explicitly performs a process switch. Only elevated processes with PID of 0 or 1
may perform a process switch.
PIDCTRL_INTERRUPT_ENABLE_REG determines whether the PID Controller identifies and registers an inter-
rupt of certain priority. When a bit of register PIDCTRL_INTERRUPT_ENABLE_REG is 1, PID Controller will
take action when CPU fetches instruction from the interrupt vector entry address of the corresponding inter-
rupt. Otherwise, PID Controller performs no action. The registers PIDCTRL_INTERRUPT_ADDR_1_REG ~ PID-
CTRL_INTERRUPT_ADDR_7_REG define the interrupt vector entry address for all the interrupt priority levels. For
details please refer to Table 28-1.
PIDCTRL_INTERRUPT_ENABLE_REG bit
Priority level Interrupt vector entry address
controlling interrupt identification
Level 1 1 PIDCTRL_INTERRUPT_ADDR_1_REG
Level 2 2 PIDCTRL_INTERRUPT_ADDR_2_REG
Level 3 3 PIDCTRL_INTERRUPT_ADDR_3_REG
Level 4 4 PIDCTRL_INTERRUPT_ADDR_4_REG
Level 5 5 PIDCTRL_INTERRUPT_ADDR_5_REG
Level 6 ( Debug ) 6 PIDCTRL_INTERRUPT_ADDR_6_REG
NMI 7 PIDCTRL_INTERRUPT_ADDR_7_REG
PID Controller records the priority level of the current interrupt in register PIDCTRL_LEVEL_REG. For details please
refer to Table 28-2.
PID Controller also records in register PIDCTRL_FROM_n_REG the status of the system before the interrupt oc-
curred. The bit width of register PIDCTRL_FROM_n_REG is 7. The highest four bits represent the interrupt status
of the system before the interrupt indicated by the register occurred. The lowest three bits represent the pro-
cess running on the CPU before the interrupt indicated by the register occurred. For details please refer to Table
28-3.
Though we can deal with interrupt nesting, an elevated process should not be interrupted during the process
switching, and therefore the interrupts have been masked in step 1 and step 2.
In step 3, the configured values of registers PIDCTRL_PID_DELAY_REG and PIDCTRL_NMI_DELAY_REG will affect
step 6.
In step 4, the configured value of register PIDCTRL_PID_NEW_REG will be the new PID after step 6.
If the system is currently in a nested interrupt and needs to revert to the previous interrupt, register PIDCTRL_LEVEL_REG
must be restored based on the information recorded in register PIDCTRL_FROM_n_REG in step 5.
In step 7, other tasks can be implemented as well. To do this, the cost of those tasks should be included when
configuring registers PIDCTRL_PID_DELAY_REG and PIDCTRL_NMI_DELAY_REG in step 3.
28.5 Registers
Register 28.1. PIDCTRL_INTERRUPT_ENABLE_REG (0x000)
LE
AB
EN
T_
UP
RR
TE
IN
L_
)
)
ed
ed
TR
rv
rv
DC
se
se
(re
(re
PI
31 8 7 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PIDCTRL_INTERRUPT_ENABLE These bits are used to enable interrupt identification and process-
ing. (R/W)
31 0
0x040000340 Reset
31 0
0x040000180 Reset
31 0
0x0400001C0 Reset
31 0
0x040000200 Reset
31 0
0x040000240 Reset
31 0
0x040000280 Reset
31 0
0x0400002C0 Reset
AY
EL
_D
PID
L_
d)
TR
ve
r
DC
se
(re
PI
31 12 11 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 20 Reset
TR
rv
DC
se
(re
PI
31 12 11 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16 Reset
PIDCTRL_NMI_DELAY Delay for disabling CPU NMI interrupt mask signal. (R/W)
US
AT
ST
T_
EN
RR
CU
L_
d)
TR
ve
er
DC
s
(re
PI
31 4 3 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
n
S_
TU
TA
_S
US
IO
EV
PR
L_
)
ed
TR
rv
DC
se
(re
PI
31 7 6 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EW
_N
ID
_P
d)
RL
e
rv
CT
se
D
(re
PI
31 3 2 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
M
IR
NF
CO
D_
PI
L_
)
ed
TR
rv
DC
se
(re
PI
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
LE
AB
EN
K_
AS
M
I_
NM
L_
d)
TR
e
rv
DC
se
(re
PI
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PIDCTRL_NMI_MASK_ENABLE This bit is used to enable CPU NMI interrupt mask signal. (WO)
E
BL
SA
DI
K_
AS
M
I_
NM
L_
)
ed
TR
rv
DC
se
(re
PI
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
PIDCTRL_NMI_MASK_DISABLE This bit is used to disable CPU NMI interrupt mask signal. (WO)
29.1 Introduction
ESP32 has two types of built-in sensors for various applications: a capacitive touch sensor with up to 10 inputs,
and a Hall effect sensor.
The processing of analog signals is done by two successive approximation ADCs (SAR ADC). There are five con-
trollers dedicated to operating ADCs. This provides flexibility when it comes to converting analog inputs in both
high-performance and low-power modes, with minimum processor overhead.
ESP32 is also capable of generating analog signals, using two independent DACs and a cosine waveform gener-
ator.
29.2.2 Features
• Up to 10 capacitive touch pads / GPIOs
• The sensing pads can be arranged in different combinations, so that a larger area or more points can be
detected.
• The touch pad sensing process is under the control of a hardware-implemented finite-state machine (FSM)
which is initiated by software or a dedicated hardware timer.
– CPU waiting in deep sleep and saving power until touch detection and subsequent wake up
The capacitance of a touch pad is periodically charged and discharged. The chart ”Pad Voltage” shows the
charge/discharge voltage that swings from DREFH (reference voltage high) to DREFL (reference voltage low). Dur-
ing each swing, the touch sensor generates an output pulse, shown in the chart as ”OUT”. The swing slope is
different when the pad is touched (high capacitance) and when it is not (low capacitance). By comparing the differ-
ence between the output pulse counts during the same time interval, we can conclude whether the touch pad has
been touched. TIE_OPT is used to establish the initial voltage level that starts the charge/discharge cycle.
The Touch FSM can be active in sleep mode. The SENS_SAR_TOUCH_SLEEP_CYCLES register can be
used to set the cycles. The sensor is operated by FAST_CLK, which normally runs at 8 MHz. More informa-
tion on that can be found in chapter Reset and Clock.
The SAR ADC controllers have specialized uses. Two of them support high-performance multiple-channel scan-
ning. Another two are used for low-power operation during deep sleep, and the last one is dedicated to PWDET
/ PKDET (power and peak detection). A diagram of the SAR ADCs is shown in Figure 29-5.
29.3.2 Features
• Two SAR ADCs, with simultaneous sampling and conversion
• Up to five SAR ADC controllers for different purposes (e.g. high performance, low power or PWDET / PKDET).
• One channel for internal voltage vdd33, two for pa_pkdet (available on selected controllers)
A summary of all the analog signals that may be sent to the SAR ADC module for processing by either ADC1 or
ADC2 is presented in Table 29-2.
SAR ADC2
29 On-Chip Sensors and Analog Signal Processing
There are five ADC controllers in ESP32: RTC ADC1 CTRL, RTC ADC2 CTRL, DIG ADC1 CTRL, DIG ADC2 CTRL
and PWDET CTRL. The differences between them are summarized in Table 29-3.
The outline of a single controller’s function is shown in Figure 29-7. For each controller, the start of analog-to-
digital conversion can be triggered by register SENS_SAR_MEASn_START_SAR. The measurement’s result can
be obtained from register SENS_SAR_MEASn_DATA_SAR.
The controllers are intertwined with the ULP coprocessor, as the ULP coprocessor has a built-in instruction to start
an ADC measurement. In many cases, the controllers need to cooperate with the ULP coprocessor, e.g.:
• when periodically monitoring a channel during deep sleep, where the ULP coprocessor is the only trigger
source during this mode;
• when scanning channels continuously in a sequence. Continuous scanning or DMA is not supported by the
controllers. However, it is possible with the help of the ULP coprocessor.
• High performance; the clock is much faster, therefore, the sample rate is highly increased.
• Multiple-channel scanning mode; there is a pattern table that defines the measurement rule for each SAR
ADC. The scanning mode can be configured as a single mode, double mode, or alternate mode.
Note:
We do not use the term “start of conversion” in this section, because there is no direct access to starting a single SAR
analog-to-digital conversion. We use “start of scan” instead, which implies that we expect to scan a sequence of channels
with DIG ADC controllers.
The pattern tables contain the measurement rules mentioned above. Each table has 16 items which store infor-
mation on channel selection, resolution and attenuation. When scanning starts, the controller reads measurement
rules one-by-one from a pattern table. For each controller the scanning sequence includes 16 different rules at
most, before repeating itself.
The 8-bit item (the pattern table register) is composed of three fields that contain channel, resolution and attenuation
information, as shown in Table 29-4.
There are three scanning modes: single mode, double mode and alternate mode.
• Single mode: channels of either SAR ADC1 or SAR ADC2 will be scanned.
• Double mode: channels of SAR ADC1 and SAR ADC2 will be scanned simultaneously.
• Alternate mode: channels of SAR ADC1 and SAR ADC2 will be scanned alternately.
ESP32 supports up to a 12-bit SAR ADC resolution. The 16-bit data in DMA is composed of the ADC result and
some necessary information related to the scanning mode:
• For double mode or alternate mode, 4-bit information on channel selection is added plus one extra bit
indicating which SAR ADC was selected.
For each scanning mode there is a corresponding data format, called Type I and Type II. Both data formats are
described in Tables 29-5 and 29-6.
For Type I the resolution of SAR ADC is up to 12 bits, while for Type II the resolution is 11 bits at most.
DIG SAR ADC Controllers allow the use of I2S for direct memory access. The WS signal of I2S acts as a
measurement-trigger signal. The DATA signal provides the information that the measurement result is ready. Soft-
ware can configure APB_SARADC_DATA_TO_I2S, in order to connect ADC to I2S.
Inside of ESP32 there is a Hall sensor for magnetic field-sensing applications, which is designed to feed voltage
signals to the SAR ADC. It can be controlled by the ULP coprocessor, when low-power operation is required.
Such functionality, which enhances the power-processing and flexibility of ESP32, makes it an attractive solution
for position sensing, proximity detection, speed measurement, etc.
29.4.2 Features
• Built-in Hall element
• Capable of outputting both analog voltage and digital signals related to the strength of the magnetic field
• Powerful and easy-to-implement functionality, due to its integration with built-in ULP coprocessor, GPIOs,
CPU, Wi-Fi, etc.
The configuration of a Hall sensor for reading is done with registers SENS_SAR_TOUCH_CTRL1_REG and RT-
CIO_HALL_SENS_REG, which are used to power up the Hall sensor. The subsequent processing is done by SAR
ADC1. The result is obtained from the RTC ADC1 controller. For more details, please refer to section 29.3.
29.5 DAC
29.5.1 Introduction
Two 8-bit DAC channels can be used to convert digital values into analog output signals (up to two of them). The
design structure is composed of integrated resistor strings and a buffer. This dual DAC supports power supply and
uses it as input voltage reference. The dual DAC also supports independent or simultaneous signal conversions
inside of its channels.
29.5.2 Features
The features of DAC are as follows:
• DMA capability
• Start of conversion can be triggered by software or SAR ADC FSM (please refer to the SAR ADC chapter for
more details)
A diagram showing the DAC channel’s function is presented in Figure 29-10. For a detailed description, see the
sections below.
29.5.3 Structure
The two 8-bit DAC channels can be configured independently. For each DAC channel, the output analog voltage
can be calculated as follows:
The start of conversion is determined by register RTCIO_PAD_PDACn_XPD_DAC. The conversion process itself
is controlled by software or SAR ADC FSM; see Figure 29-10.
• Adjustable frequency
The frequency of CW can be adjusted by register SENS_SAR_SW_FSTEP[15:0]:
• Scaling
Configuring register SENS_SAR_DAC_SCALEn[1:0]; the amplitude of a CW can be multiplied by 1, 1/2, 1/4
or 1/8.
• DC offset
The offset may be introduced by register SENS_SAR_DAC_DCn[7:0]. The result will be saturated.
• Phase shift
A phase-shift of 0 / 90 / 180 / 270 degrees can be added by setting register SENS_SAR_DAC_INVn[1:0].
29.6.1 Sensors
Name Description Address Access
Touch pad setup and control registers
SENS_SAR_TOUCH_CTRL1_REG Touch pad control 0x3FF48858 R/W
SENS_SAR_TOUCH_CTRL2_REG Touch pad control and status 0x3FF48884 RO
SENS_SAR_TOUCH_ENABLE_REG Wakeup interrupt control and working set 0x3FF4888C R/W
SENS_SAR_TOUCH_THRES1_REG Threshold setup for pads 0 and 1 0x3FF4885C R/W
SENS_SAR_TOUCH_THRES2_REG Threshold setup for pads 2 and 3 0x3FF48860 R/W
SENS_SAR_TOUCH_THRES3_REG Threshold setup for pads 4 and 5 0x3FF48864 R/W
SENS_SAR_TOUCH_THRES4_REG Threshold setup for pads 6 and 7 0x3FF48868 R/W
SENS_SAR_TOUCH_THRES5_REG Threshold setup for pads 8 and 9 0x3FF4886C R/W
SENS_SAR_TOUCH_OUT1_REG Counters for pads 0 and 1 0x3FF48870 RO
SENS_SAR_TOUCH_OUT2_REG Counters for pads 2 and 3 0x3FF48874 RO
SENS_SAR_TOUCH_OUT3_REG Counters for pads 4 and 5 0x3FF48878 RO
SENS_SAR_TOUCH_OUT4_REG Counters for pads 6 and 6 0x3FF4887C RO
SENS_SAR_TOUCH_OUT5_REG Counters for pads 8 and 9 0x3FF48880 RO
SAR ADC control register
SENS_SAR_START_FORCE_REG SAR ADC1 and ADC2 control 0x3FF4882C R/W
SAR ADC1 control registers
SENS_SAR_READ_CTRL_REG SAR ADC1 data and sampling control 0x3FF48800 R/W
SENS_SAR_MEAS_START1_REG SAR ADC1 conversion control and status 0x3FF48854 RO
SAR ADC2 control registers
SENS_SAR_READ_CTRL2_REG SAR ADC2 data and sampling control 0x3FF48890 R/W
SENS_SAR_MEAS_START2_REG SAR ADC2 conversion control and status 0x3FF48894 RO
ULP coprocessor configuration register
SENS_ULP_CP_SLEEP_CYC0_REG Sleep cycles for ULP coprocessor 0x3FF48818 R/W
Pad attenuation configuration registers
SENS_SAR_ATTEN1_REG 2-bit attenuation for each pad 0x3FF48834 R/W
SENS_SAR_ATTEN2_REG 2-bit attenuation for each pad 0x3FF48838 R/W
DAC control registers
SENS_SAR_DAC_CTRL1_REG DAC control 0x3FF48898 R/W
SENS_SAR_DAC_CTRL2_REG DAC output control 0x3FF4889C R/W
29.7 Registers
29.7.1 Sensors
Register 29.1. SENS_SAR_READ_CTRL_REG (0x0000)
E
CL
T
CY
E
BI
RC
_F V
E_
E_
IV
DI _IN
O
PL
PL
_D
1_ TA
AM
LK
G
AR DA
_C
S
_S
_S 1_
1_
R1
R1
NS AR
AR
SA
SA
d)
)
ed
SE S_S
_S
ve
_
rv
NS
NS
NS
er
se
N
s
SE
SE
SE
SE
(re
(re
31 29 28 27 26 18 17 16 15 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 9 2 Reset
SENS_SAR1_DIG_FORCE 1: SAR ADC1 controlled by DIG ADC1 CTR, 0: SAR ADC1 controlled by
RTC ADC1 CTRL. (R/W)
SENS_SAR1_SAMPLE_BIT Bit width of SAR ADC1, 00: for 9-bit, 01: for 10-bit, 10: for 11-bit, 11:
for 12-bit. (R/W)
31 0
200 Reset
P
TO
T_
AR
E_ P
ST
RC TO
T
CC
TH
TH
FO T_
BI ST
T_
ID
ID
P_ AR
W
DE
2_ OP
_C ST
_T
T_
T_
O
PW
EN
LP P_
AR ST
ST
BI
T
_U _C
_S 1_
NI
2_
NS R2_
2_
1_
_I
NS AR
AR
AR
AR
NS LP
PC
A
d)
N d)
SE S_U
SE S_S
_S
_S
_S
_S
ve
SE rve
_
NS
NS
NS
NS
er
se
N
s
SE
SE
SE
SE
SE
SE
(re
(re
31 24 23 22 21 11 10 9 8 7 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 Reset
SENS_SAR2_BIT_WIDTH Bit width of SAR ADC2, 00: 9 bits, 01: 10 bits, 10: 11 bits, 11: 12 bits.
(R/W)
SENS_SAR1_BIT_WIDTH Bit width of SAR ADC1, 00: 9 bits, 01: 10 bits, 10: 11 bits, 11: 12 bits.
(R/W)
31 0
0x0FFFFFFFF Reset
SENS_SAR_ATTEN1_REG 2-bit attenuation for each pad, 11: 1 dB, 10: 6 dB, 01: 3 dB, 00: 0 dB,
[1:0] is used for ADC1_CH0, [3:2] is used for ADC1_CH1, etc. (R/W)
31 0
0x0FFFFFFFF Reset
SENS_SAR_ATTEN2_REG 2-bit attenuation for each pad, 11: 1 dB, 10: 6 dB, 01: 3 dB, 00: 0 dB,
[1:0] is used for ADC2_CH0, [3:2] is used for ADC2_CH1, etc (R/W)
O _S CE
E
RC
_D RT OR
_S R
AR
R
NE A
O
SA
S1 TA _F
_F
EA 1_S RT
D
A_
PA
PA
AT
_M AS STA
N_
N_
_D
NS E 1_
_E
_E
S1
SE S_M AS
R1
R1
EA
N E
SA
SA
SE S_M
M
_
_
NS
NS
NS
N
SE
SE
SE
SE
31 30 19 18 17 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SENS_SAR1_EN_PAD_FORCE 1: SAR ADC1 pad enable bitmap is controlled by SW, 0: SAR ADC1
pad enable bitmap is controlled by ULP coprocessor. (R/W)
SENS_SAR1_EN_PAD SAR ADC1 pad enable bitmap; active only when reg_sar1_en_pad_force =
1. (R/W)
SENS_MEAS1_START_FORCE 1: SAR ADC1 controller (in RTC) is started by SW, 0: SAR ADC1
controller is started by ULP coprocessor. (R/W)
SENS_MEAS1_START_SAR SAR ADC1 controller (in RTC) starts conversion; active only when
reg_meas1_start_force = 1. (R/W)
Y
UC O R E
LA
O H_ FO RC
T
H_ UT CE
DE
UT N
EL
AI
_ T C L_ FO
O _1E
S_
_S
NS OU AL E_
D_
EA
SE S_T D_H HAS
XP
M
H_
H_
N P P
SE _X LL_
UC
UC
NS A
TO
)
ed
SE S_H
_T
_
rv
NS
NS
se
N
SE
SE
SE
(re
31 28 27 26 25 24 23 16 15 0
SENS_TOUCH_OUT_SEL 1: the touch pad is considered touched when the value of the counter is
greater than the threshold, 0: the touch pad is considered touched when the value of the counter
is less than the threshold. (R/W)
SENS_TOUCH_XPD_WAIT The waiting time (in 8 MHz cycles) between TOUCH_START and
TOUCH_XPD. (R/W)
H1
_T
_T
UT
UT
O
O
H_
H_
UC
UC
TO
O
_T
S_
NS
N
SE
SE
31 16 15 0
H2
3
TH
_T
_
UT
UT
O
O
H_
H_
UC
UC
O
TO
_T
_
NS
NS
SE
SE
31 16 15 0
H5
H
_T
_T
UT
UT
O
O
H_
H_
UC
UC
O
O
_T
_T
NS
NS
SE
SE
31 16 15 0
H7
_T
_T
UT
UT
O
O
H_
H_
UC
UC
TO
O
_T
S_
NS
N
SE
SE
31 16 15 0
H8
9
TH
_T
_
UT
UT
O
O
H_
H_
UC
UC
O
TO
_T
_
NS
NS
SE
SE
31 16 15 0
1
UT
UT
O
O
S_
S_
EA
EA
M
M
H_
H_
UC
UC
O
O
_T
_T
NS
NS
SE
SE
31 16 15 0
3
UT
UT
O
O
S_
S_
EA
EA
M
M
H_
H_
UC
UC
O
O
_T
_T
NS
NS
SE
SE
31 16 15 0
5
UT
UT
O
O
S_
S_
EA
EA
_M
M
H_
H
UC
UC
TO
TO
_
_
NS
NS
SE
SE
31 16 15 0
7
UT
UT
O
O
S_
S_
EA
EA
M
M
H_
H_
UC
UC
O
O
_T
_T
NS
NS
SE
SE
31 16 15 0
9
UT
UT
O
O
S_
S_
EA
EA
M
M
H_
H_
UC
UC
O
O
_T
_T
NS
NS
SE
SE
31 16 15 0
NE N
ES
R
H_ TAR _EN CE
DO _E
L
CL
_C
S_ SM
UC S T R
CY
O H_ R O
EN
EN
_T C STA T_F
EA F
P_
M T_
S_
S_
NS OU H_ AR
EE
EA
EA
SE S_T UC ST
SL
M
M
H_
H_
N O H_
H_
UC
UC
SE _T C
UC
NS OU
O
O
NS d)
_T
_T
SE S_T
_T
SE rve
NS
NS
se
N
SE
SE
SE
(re
31 30 29 14 13 12 11 10 9 0
SENS_TOUCH_START_FORCE 1: starts the Touch FSM via software; 0: starts the Touch FSM via
timer. (R/W)
SENS_TOUCH_START_EN 1: starts the Touch FSM; this is valid when reg_touch_start_force is set.
(R/W)
EN
1
2
EN
EN
RK
UT
UT
O
_W
_O
_O
D
D
PA
PA
PA
H_
H_
H_
UC
UC
UC
O
O
d)
_T
_T
_T
e
rv
NS
NS
NS
se
SE
SE
SE
(re
31 30 29 20 19 10 9 0
SENS_TOUCH_PAD_OUTEN1 Bitmap defining SET1 for generating a wakeup interrupt; SET1 is con-
sidered touched if at least one of the touch pads in SET1 is touched. (R/W)
SENS_TOUCH_PAD_OUTEN2 Bitmap defining SET2 for generating a wakeup interrupt; SET2 is con-
sidered touched if at least one of the touch pads in SET2 is touched. (R/W)
E
CL
T
CY
E
BI
RC
_F V
E_
E_
IV
DI _IN
O
PL
PL
_D
2_ TA
AM
LK
G
AR DA
_C
S
_S
_S 2_
2_
R2
R2
NS AR
AR
SA
SA
d)
d)
SE _S
_S
ve
ve
_
NS
NS
NS
NS
er
er
s
s
SE
SE
SE
SE
(re
(re
31 30 29 28 27 18 17 16 15 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 9 2 Reset
SENS_SAR2_DIG_FORCE 1: SAR ADC2 controlled by DIG ADC2 CTRL or PWDET CTRL, 0: SAR
ADC2 controlled by RTC ADC2 CTRL (R/W)
SENS_SAR2_SAMPLE_BIT Bit width of SAR ADC2, 00: for 9-bit, 01: for 10-bit, 10: for 11-bit, 11:
for 12-bit. (R/W)
_D RT OR
_S R
AR
R
NE A
O
SA
S2 TA _F
_F
EA 2_S RT
AD
AD
A_
AT
_M AS STA
_P
_P
_D
EN
EN
NS E 2_
S2
2_
2_
SE S_M AS
EA
AR
AR
N E
SE S_M
_M
_S
_S
NS
NS
NS
N
SE
SE
SE
SE
31 30 19 18 17 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SENS_SAR2_EN_PAD_FORCE 1: SAR ADC2 pad enable bitmap is controlled by SW, 0: SAR ADC2
pad enable bitmap is controlled by ULP coprocessor. (R/W)
SENS_SAR2_EN_PAD SAR ADC2 pad enable bitmap; active only when reg_sar2_en_pad_force =
1. (R/W)
SENS_MEAS2_START_FORCE 1: SAR ADC2 controller (in RTC) is started by SW, 0: SAR ADC2
controller is started by ULP coprocessor. (R/W)
SENS_MEAS2_START_SAR SAR ADC2 controller (in RTC) starts conversion; active only when
reg_meas2_start_force = 1. (R/W)
O E_ H
E OW
_F C IG
IG OR _H
RC L
_D _F CE
AC LK OR
NS A CL NV
N
_E
_D C_C K_F
SE _D C_ K_I
EP
NE
NS A CL
ST
O
_T
_F
SE S_D C_
SW
SW
N A
)
)
ed
ed
SE S_D
_
rv
rv
NS
NS
se
se
N
SE
SE
SE
(re
(re
31 26 25 24 23 22 21 17 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SENS_DAC_DIG_FORCE 1: DAC1 & DAC2 use DMA, 0: DAC1 & DAC2 do not use DMA. (R/W)
SENS_SW_FSTEP Frequency step for CW generator; can be used to adjust the frequency. (R/W)
NV 1
1
N
LE
LE
NS C_ _E
AC _E
CA
CA
C1
SE DA CW
NV
C
_D
_D
_S
_S
_I
_I
_ C_
AC
AC
AC
AC
AC
NS A
)
ed
SE S_D
_D
_D
_D
_D
_D
rv
NS
NS
NS
NS
NS
se
N
SE
SE
SE
SE
SE
SE
(re
31 26 25 24 23 22 21 20 19 18 17 16 15 8 7 0
0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SENS_DAC_INV2 DAC2, 00: does not invert any bits, 01: inverts all bits, 10: inverts MSB, 11: inverts
all bits except for MSB. (R/W)
SENS_DAC_INV1 DAC1, 00: does not invert any bits, 01: inverts all bits, 10: inverts MSB, 11: inverts
all bits except for MSB. (R/W)
SENS_DAC_SCALE2 DAC2, 00: no scale; 01: scale to 1/2; 10: scale to 1/4; 11: scale to 1/8. (R/W)
SENS_DAC_SCALE1 DAC1, 00: no scale; 01: scale to 1/2; 10: scale to 1/4; 11: scale to 1/8. (R/W)
_C AR
AR
_ P LE
LE
ED
TT _C
EN
EN
1_ TT L
E
EL AT
AR PA SE
PA _P
IV
DE
_L
_L
RC
DC SA SA 2S
DC R_S K_G
_D
_S R2_ R_
TT
TT
_S R T UX
O
RA C_ TA_ _I
O
LK
M
PA
PA
SA D DA TO
_F
DC STA _M
SA CL
_
_C
2_
1_
RT
RK
B_ RA C_ TA_
RA C_ R2
C_ R_
AR
AR
AR
TA
O
AP SA D DA
B_ AD SA
SA D SA
_W
_S
_S
_S
B_ RA C_
AP AR C_
B_ RA C_
DC
DC
DC
AP _SA AD
S D
AP _SA AD
RA
RA
RA
B_ RA
A
B R
AP AR
B R
d)
AP _SA
SA
SA
SA
AP _SA
AP SA
ve
S
er
B_
B_
B_
B_
B
B
s
AP
AP
AP
AP
AP
(re
31 27 26 25 24 23 22 19 18 15 14 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 15 15 4 1 0 0 0 0 0 Reset
APB_SARADC_DATA_TO_I2S 1: I2S input data is from SAR ADC (for DMA), 0: I2S input data is
from GPIO matrix. (R/W)
APB_SARADC_DATA_SAR_SEL 1: sar_sel will be coded by the MSB of the 16-bit output data, in
this case, the resolution should not contain more than 11 bits; 0: using 12-bit SAR ADC resolution.
(R/W)
APB_SARADC_SAR2_PATT_P_CLEAR Clears the pointer of pattern table for DIG ADC2 CTRL.
(R/W)
APB_SARADC_SAR1_PATT_P_CLEAR Clears the pointer of pattern table for DIG ADC1 CTRL.
(R/W)
APB_SARADC_SAR_SEL 0: SAR1, 1: SAR2, this setting is applicable in the single SAR mode. (R/W)
APB_SARADC_SAR2_MUX 1: SAR ADC2 is controlled by DIG ADC2 CTRL, 0: SAR ADC2 is con-
trolled by PWDET CTRL. (R/W)
IT
M
IM
NU
_L
S_
M
EA
NU
1_ V
V
AR IN
IN
_M
S_
_S R2_
EA
AX
DC SA
_M
_M
RA C_
DC
DC
SA D
B_ RA
RA
RA
d)
AP _SA
SA
SA
ve
er
B_
B_
B
s
AP
AP
AP
(re
31 11 10 9 8 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 Reset
APB_SARADC_SAR2_INV 1: data to DIG ADC2 CTRL is inverted, 0: data is not inverted. (R/W)
APB_SARADC_SAR1_INV 1: data to DIG ADC1 CTRL is inverted, 0: data is not inverted. (R/W)
)
ed
SA
rv
B_
se
AP
(re
31 24 47 24
2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0x00F0F0F0F Reset
APB_SARADC_SAR1_PATT_TAB1_REG Pattern tables 0 - 3 for SAR ADC1, one byte for each
pattern table: [31:28] pattern0_channel, [27:26] pattern0_bit_width, [25:24] pattern0_attenuation,
[23:20] pattern1_channel, etc. (R/W)
31 0
0x00F0F0F0F Reset
APB_SARADC_SAR1_PATT_TAB2_REG Pattern tables 4 - 7 for SAR ADC1, one byte for each
pattern table: [31:28] pattern4_channel, [27:26] pattern4_bit_width, [25:24] pattern4_attenuation,
[23:20] pattern5_channel, etc. (R/W)
31 0
0x00F0F0F0F Reset
APB_SARADC_SAR1_PATT_TAB3_REG Pattern tables 8 - 11 for SAR ADC1, one byte for each
pattern table: [31:28] pattern8_channel, [27:26] pattern8_bit_width, [25:24] pattern8_attenuation,
[23:20] pattern9_channel, etc. (R/W)
31 0
0x00F0F0F0F Reset
31 0
0x00F0F0F0F Reset
APB_SARADC_SAR2_PATT_TAB1_REG Pattern tables 0 - 3 for SAR ADC2, one byte for each
pattern table: [31:28] pattern0_channel, [27:26] pattern0_bit_width, [25:24] pattern0_attenuation,
[23:20] pattern1_channel, etc. (R/W)
31 0
0x00F0F0F0F Reset
APB_SARADC_SAR2_PATT_TAB2_REG Pattern tables 4 - 7 for SAR ADC2, one byte for each
pattern table: [31:28] pattern4_channel, [27:26] pattern4_bit_width, [25:24] pattern4_attenuation,
[23:20] pattern5_channel, etc. (R/W)
31 0
0x00F0F0F0F Reset
APB_SARADC_SAR2_PATT_TAB3_REG Pattern tables 8 - 11 for SAR ADC2, one byte for each
pattern table: [31:28] pattern8_channel, [27:26] pattern8_bit_width, [25:24] pattern8_attenuation,
[23:20] pattern9_channel, etc. (R/W)
31 0
0x00F0F0F0F Reset
30.1 Introduction
The ULP coprocessor is an ultra-low-power processor that remains powered on during the Deep-sleep mode of
the main SoC. Hence, the developer can store in the RTC memory a program for the ULP coprocessor to access
peripheral devices, internal sensors and RTC registers during deep sleep. This is useful for designing applications
where the CPU needs to be woken up by an external event, or timer, or a combination of these, while maintaining
minimal power consumption.
30.2 Features
• Contains up to 8 KB of SRAM for instructions and data
• Contains four 16-bit general-purpose registers (R0, R1, R2, R3) for manipulating data and accessing
memory
• Includes one 8-bit Stage_cnt register which can be manipulated by ALU and used in JUMP instructions
APB Bus
bridge
TSENS CTRL
ULP
RTC Timer
Coprocessor
SAR CTRL
ESP32 RTC
The ULP coprocessor can be started by software or a periodically-triggered timer. The operation of the ULP
coprocessor is ended by executing the HALT instruction. Meanwhile, it can access almost every module in RTC
domain, either through built-in instructions or RTC registers. In many cases the ULP coprocessor can be a good
supplement to, or replacement of, the CPU, especially for power-sensitive applications. Figure 30-1 shows the
overall layout of a ULP coprocessor.
OpCode Operands
An instruction, which has one OpCode, can perform various different operations, depending on the setting of
Operands bits. A good example is the ALU instruction, which is able to perform 10 arithmetic and logic
operations; or the JUMP instruction, which may be conditional or unconditional, absolute or relative.
Each instruction has a fixed width of 32 bits. A series of instructions can make a program be executed by the
ULP coprocessor. The execution flow inside the program uses 32-bit addressing. The program is stored in a
dedicated region called Slow Memory (RTC_SLOW_MEM), which is visible to the main CPUs as one that has an
address range of 0x5000_0000 to 0x5000_1FFF (8 KB).
The OpCode in this chapter is represented by 4’dx, where 4 stands for 4-bit width, ’d is a decimal symbol, x
stands for the value of OpCode (x: 0 ~ 15).
The ALU instruction, which has one OpCode, can perform various different arithmetic and logic operations,
depending on the setting of the instruction’s bits [27:21] accordingly.
When bits [27:25] of the instruction in Figure 30-3 are set to 3’b0, ALU performs operations, using the ULP
coprocessor register R[0-3]. The types of operations depend on the setting of the instruction’s bits [24:21]
presented in Table 30-1.
Operand Description - see Figure 30-3
ALU_sel Type of ALU operation
Rdst Register R[0-3], destination
Rsrc1 Register R[0-3], source
Rsrc2 Register R[0-3], source
Note:
• All ALU operations can be used to set/clear the zero flag in ALU.
Figure 304. Instruction Type — ALU for Operations with Immediate Value
When bits [27:25] of the instruction in Figure 30-4 are set to 3’b1, ALU performs operations, using register R[0-3]
and the immediate value stored in [19:4]. The types of operations depend on the setting of the instruction’s bits
[24:21] presented in Table 30-2.
Operand Description - see Figure 30-4
ALU_sel Type of ALU operation
Rdst Register R[0-3], destination
Rsrc1 Register R[0-3], source
Imm 16-bit signed value
Note:
• All ALU operations can be used to set/clear the zero flag in ALU.
Figure 305. Instruction Type — ALU for Operations with Stage Count Register
ALU is also able to increment/decrement by a given value, or reset the 8-bit register Stage_cnt. To do so, bits
[27:25] of instruction in Figure 30-5 should be set to 3’b2. The type of operation depends on the setting of the
instruction’s bits [24:21] presented in Table 30-3. The Stage_cnt is a separate register and is not a part of the
instruction in Figure 30-5.
Operand Description - see Figure 30-5
ALU_sel Type of ALU operation
Stage_cnt Stage count register, a separate register [7:0] used to store variables, such as loop index
Imm 8-bit value
Note:
• Data from Rsrc is always stored in the lower 16 bits of a memory word. Differently put, it is not possible to
store Rsrc in the upper 16 bits of memory.
• The ”Mem” written is the RTC_SLOW_MEM memory. Address 0, as seen by the ULP coprocessor,
corresponds to address 0x50000000, as seen by the main CPUs.
The instruction loads the lower 16-bit half-word from memory with address Rsrc + offset into the destination
register Rdst:
• In any case, it is always the lower 16 bits of a memory word that are loaded. Differently put, it is not
possible to read the upper 16 bits.
• The ”Mem” loaded is the RTC_SLOW_MEM memory. Address 0, as seen by the ULP coprocessor,
corresponds to address 0x50000000, as seen by the main CPUs.
Note:
All jump addresses are expressed in 32-bit words.
Note:
All jump addresses are expressed in 32-bit words.
30.4.6 JUMPS – Jump to a Relative Address (Conditional upon Stage Count Regis
ter)
31 28 27 25 24 17 16 15 7 0
• A description of how to set the stage count register is provided in section 30.4.1.3.
Description
The instruction prompts a jump to a relative address if the above-mentioned condition is true. The condition itself
is the result of comparing the value of Stage_cnt (stage count register) and the Threshold value.
4’d11
Description
The instruction ends the operation of the processor and puts it into power-down mode.
Note:
After executing this instruction, the ULP coprocessor timer gets started.
1’b1
4’d9 3’b0
Description
This instruction sends an interrupt from the ULP coprocessor to the RTC controller.
• If the SoC is in Deep-sleep mode, and the ULP wake-up is enabled, the above-mentioned interrupt will
wake up the SoC.
• If the SoC is not in Deep-sleep mode, and the ULP interrupt bit (RTC_CNTL_ULP_CP_INT_ENA) is set in
register RTC_CNTL_INT_ENA_REG, a RTC interrupt will be triggered.
4’d4 Cycles
Sel
4’d5 Sar Mux Rdst
Description
The instruction prompts the taking of measurements with the use of ADC. Pads/signals available for ADC
measurement are provided in Table 30-4.
Note:
When working in master mode, RTC_I2C samples the SDA input on the negative edge of SCL.
R0 = REG[Addr][High:Low]
In case of more than 16 bits being requested, i.e. High - Low + 1 > 16, then the instruction will return
[Low+15:Low].
Note:
• This instruction can access registers in RTC_CNTL, RTC_IO, SENS and RTC_I2C peripherals. The address
of the register, as seen from the ULP coprocessor, can be calculated from the address of the same register
on the DPORT bus, as follows:
addr_ulp = (addr_dport - DR_REG_RTCCNTL_BASE)/4
• The addr_ulp is expressed in 32-bit words (not in bytes), and value 0 maps onto the
DR_REG_RTCCNTL_BASE (as seen from the main CPUs). Thus, 10 bits of address cover a 4096-byte
range of peripheral register space, including regions DR_REG_RTCCNTL_BASE, DR_REG_RTCIO_BASE,
DR_REG_SENS_BASE and DR_REG_RTC_I2C_BASE.
REG[Addr][High:Low] = Data
If more than 8 bits are requested, i.e. High - Low + 1 > 8, then the instruction will pad with zeros the bits above
the eighth bit.
Note:
See notes regarding addr_ulp in section 30.4.13 above.
In a typical power-saving scenario, the ULP coprocessor operates while the main CPUs are in deep sleep. To
save power even further, the ULP coprocessor can get into sleep mode, as well. In such a scenario, there is a
specific hardware timer in place to wake up the ULP coprocessor, since there is no software program running at
the same time. This timer should be configured in advance by setting and then selecting one of the
SENS_ULP_CP_SLEEP_CYCn_REG registers that contain the expiration period. This can be done either by the
main program, or the ULP program with the REG_WR and SLEEP instructions. Then, the ULP timer should be
enabled by setting bit RTC_CNTL_ULP_CP_SLP_TIMER_EN in the RTC_CNTL_STATE0_REG register.
The ULP coprocessor puts itself into sleep mode by executing the HALT instruction. This also triggers the ULP
timer to start counting RTC_SLOW_CLK ticks which, by default, originate from an internal 150 kHz RC oscillator.
Once the timer expires, the ULP coprocessor is powered up and runs a program with the program counter (PC)
which is stored in register SENS_PC_INIT. The relationship between the described signals and registers is shown
in Figure 30-19.
On reset or power-up the above-mentioned ULP program may start up only after the expiration of
SENS_ULP_CP_SLEEP_CYC0_REG, which is the default selection period of the ULP timer.
A sample operation sequence of the ULP program is shown in Figure 30-20, where the following steps are
executed:
2. The ULP timer expires and the ULP coprocessor starts running the program at PC = SENS_PC_INIT.
3. The ULP program executes the HALT instruction; the ULP coprocessor is halted and the timer gets
restarted.
4. The ULP program executes the SLEEP instruction to change the sleep timer period register.
5. The ULP program, or software, disables the ULP timer by using bit RTC_CNTL_ULP_CP_SLP_TIMER_EN.
The specific timing of the wakeup, program execution and sleep sequence is governed by the ULP FSM as
follows:
1. On the ULP timer expiration the FSM wakes up the ULP and this process takes two clock cycles.
2. Then, before executing the program, the FSM waits for the number of cycles configured in
RTC_CNTL_ULPCP_TOUCH_START_WAIT field of the RTC_CNTL_TIMER2_REG register. This time is
spent waiting for the 8 MHz clock to get stable.
4. After calling HALT instruction, the program is stopped. The FSM requires additional two clock cycles to put
the ULP to sleep.
1. Set the low and high SCL half-periods by using RTC_I2C_SCL_LOW_PERIOD_REG and
RTC_I2C_SCL_HIGH_PERIOD_REG in RTC_FAST_CLK cycles (e.g. RTC_I2C_SCL_LOW_PERIOD=40,
RTC_I2C_SCL_HIGH_PERIOD=40 for 100 kHz frequency).
2. Set the number of cycles between the SDA switch and the falling edge of SCL by using
RTC_I2C_SDA_DUTY_REG in RTC_FAST_CLK (e.g. RTC_I2C_SDA_DUTY=16).
3. Set the waiting time after the START condition by using RTC_I2C_SCL_START_PERIOD_REG (e.g.
RTC_I2C_SCL_START_PERIOD=30).
4. Set the waiting time before the END condition by using RTC_I2C_SCL_STOP_PERIOD_REG (e.g.
RTC_I2C_SCL_STOP_PERIOD=44).
7. Write the address(es) of external slave(s) to SENS_I2C_SLAVE_ADDRn (n: 0-7). Up to eight slave
addresses can be pre-programmed this way. One of these addresses can then be selected for each
transaction as part of the ULP I²C instruction.
Once RTC_I2C is configured, instructions ULP I2C_RD and I2C_WR can be used.
2. Master sends slave address, with r/w bit set to 0 (“write”). Slave address is obtained from
SENS_I2C_SLAVE_ADDRn, where n is given as an argument to the I2C_RD instruction.
4. Master sends slave register address (given as an argument to the I2C_RD instruction).
1 2 3 4 5 6 7 8 9 10
RSTRT
START
NACK
STOP
ACK
Slave Data
Note:
The RTC_I2C peripheral samples the SDA signals on the falling edge of SCL. If the slave changes SDA in less
than 0.38 microseconds, the master will receive incorrect data.
The byte received from the slave is stored into the R0 register.
2. Master sends slave address, with r/w bit set to 0 (“write”). Slave address is obtained from
SENS_I2C_SLAVE_ADDRn, where n is given as an argument to the I2C_WR instruction.
4. Master sends slave register address (given as an argument to the I2C_WR instruction).
1 2 3 4 5 6 7 8 9 10
RSTRT
START
STOP
Master Slave Address W Reg Address Slave Address W Data
ACK
ACK
ACK
Slave
Note:
Interrupts from RTC_I2C are not connected. The interrupt registers above are listed only for debugging
purposes.
30.8 Registers
30.8.1 SENS_ULP Address Space
Register 30.1. SENS_ULP_CP_SLEEP_CYCn_REG (n: 04) (0x18+0x4*n)
31 0
20 Reset
SENS_ULP_CP_SLEEP_CYCn_REG ULP timer cycles setting n; the ULP coprocessor can select
one of such registers by using the SLEEP instruction. (R/W)
P
TO
T_
AR
E_ P
ST
RC TO
FO T_
P_ AR
_C ST
LP P_
T
_U _C
I
IN
NS LP
C_
d)
N d)
)
ed
SE S_U
_P
ve
SE rve
rv
NS
r
se
se
se
SE
(re
(re
(re
31 22 21 11 10 9 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SENS_ULP_CP_START_TOP Set this bit to start the ULP coprocessor; it is active only when
SENS_ULP_CP_FORCE_START_TOP = 1. (R/W)
R1
DD
DD
_A
_A
VE
VE
LA
LA
_S
_S
2C
2C
d)
ve
_I
_I
NS
NS
r
se
SE
SE
(re
31 22 21 11 10 0
R2
R3
DD
DD
_A
_A
E
VE
AV
LA
L
_S
S
C_
2C
d)
2
ve
_I
_I
NS
NS
er
s
SE
SE
(re
31 22 21 11 10 0
R4
R5
DD
DD
_A
_A
E
E
AV
AV
SL
SL
C_
C_
d)
I2
ve
_I
S_
NS
r
se
N
SE
SE
(re
31 22 21 11 10 0
R7
DD
DD
_A
_A
TA
VE
NE
AV
DA
LA
O
SL
_D
_R
_S
C_
2C
2C
2C
NS d)
2
SE rve
_I
_I
_I
_I
NS
NS
NS
se
SE
SE
SE
(re
31 30 29 22 21 11 10 0
C E
RT OR
TA _F
_S RT
RL
2C A
CT
_I _ST
C_
AR 2C
I2
_S _I
R_
NS AR
SA
)
ed
SE _S
_
rv
NS
NS
se
SE
SE
(re
31 30 29 28 27 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
D
IO
ER
_P
W
O
_L
CL
_S
)
ed
C
I2
rv
C_
se
RT
(re
31 19 18 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
UT
E_ T
RC _OU
O
(re C_ AN _FIR T
DE T
S _S ST
I2 TR B RS
O R
FO E
ed _M TA
A_ RC
C_ C_ LS FI
RT _I2 TX_ SB_
SD FO
M S
C_ L_
C C_ _L
I2 SC
RT _I2 RX
C C_
C_ _
d)
C
ve
RT _I2
RT _I2
rv
er
se
C
C
s
RT
RT
(re
31 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
CH
AT
C C_ B_ SY _M
RT _I2 BU E_A NS
RT _I2 AR BU DR
E
AC E_ T
E
AT
K_ RW
C_ C_ ED ST
C_ AV U
C C_ AV A
C C_ S_ D
AT
L
RT _I2 SL _TR
I2 L _O
ST
RT _I2 TIM LO
VA
ST
N_
C C_ TE
L_
AI
SC
RT _I2 BY
_M
S
C_
C C_
)
d)
ed
e
I2
I2
RT _I2
rv
rv
C_
C_
se
se
C
RT
RT
RT
(re
(re
31 30 28 27 25 24 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTC_I2C_ARB_LOST Indicates the loss of I2C bus control, when in master mode. (R/W)
RTC_I2C_SLAVE_RW Indicates the value of the received R/W bit, when in slave mode. (R/W)
UT
EO
TIM
C_
)
ed
I2
rv
C_
se
RT
(re
31 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTC_I2C_TIMEOUT Maximum number of FAST_CLK cycles that the transmission can take. (R/W)
R
DD
D
_A
_A
E
VE
AV
LA
SL
_S
C_
)
ed
C
I2
I2
rv
C_
C_
se
RT
RT
(re
31 30 15 14 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
LR
R
ET R _C
CL
PL L T
T_
M T_C _IN
IN
E
AN LO M LR
E_
CO _IN T
S_ ST PLE
TR N_ CO _C
E_ IO S_ INT
AV AT AN E_
I2 AR ER MP LR
SL ITR TR LET
C_ C_ ST CO T_C
RT _I2 MA S_ _IN
C C_ AN T
C_ B _
RT _I2 TR _OU
C C_ E
RT I2 TIM
C_ C_
)
)
ed
ed
RT _I2
rv
rv
se
se
C
RT
(re
(re
31 9 8 7 6 5 4 3 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
_E NA
NA
NT _E
ST _IN A
LO MP EN
_I T
N_ O T_
IO _C IN
AT AN E_
BI R_T PL A
AR TE OM EN
TR R ET
C_ S C T_
I2 MA S_ IN
C_ C_ AN T_
RT _I2 TR _OU
C C_ E
RT I2 TIM
C_ C_
)
)
ed
ed
RT _I2
rv
rv
se
se
C
RT
(re
(re
31 9 8 7 6 5 4 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
_S T
NT _S
T
LO MP ST
_I T
ST _IN
N_ O T_
IO _C IN
AT AN E_
AR TE OM ST
TR R ET
C_ S C T_
BI R_T PL
I2 MA S_ IN
C_ C_ AN T_
RT _I2 TR _OU
C C_ E
RT _I2 TIM
C C_
d)
)
ed
ve
RT _I2
rv
er
se
C
s
RT
(re
(re
31 8 7 6 5 4 3 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
TY
DU
A_
SD
C_
d)
ve
I2
r
C_
se
RT
(re
31 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTC_I2C_SDA_DUTY Number of FAST_CLK cycles between the SDA switch and the falling edge of
SCL. (R/W)
I2
rv
C_
se
RT
(re
31 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
D
IO
ER
_P
RT
TA
_S
CL
_S
d)
2C
ve
I
er
C_
s
RT
(re
31 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
D
O
RI
PE
P_
TO
S
L_
SC
C_
)
ed
I2
rv
C_
se
RT
(re
31 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31.1 Introduction
ESP32 offers efficient and flexible power-management technology to achieve the best balance between power
consumption, wakeup latency and available wakeup sources. Users can select out of five predefined power
modes of the main processors to suit specific needs of the application. In addition, to save power in power-
sensitive applications, control may be executed by the Ultra-Low-Power coprocessor (ULP coprocessor), while
the main processors are in Deep-sleep mode.
31.2 Features
• Five predefined power modes to support various applications
• Up to 16 KB of retention memory
31.3.1 Overview
The low-power management unit includes voltage regulators, a power controller, power switch cells, power domain
isolation cells, etc. Figure 31-1 shows the high-level architecture of ESP32’s low-power management.
1. When XPD_DIG_REG == 1, the regulator outputs a 1.1V voltage and the digital core is able to run; when
XPD_DIG_REG == 0, both the regulator and the digital core stop running.
3. The current to the digital core comes from pin VDD3P3_CPU and pin VDD3P3_RTC.
90
1. When the pin CHIP_PU is at a high level, the low-power voltage regulator cannot be turned off. It should be
switched only between normal-work mode and Deep-sleep mode.
3. In Deep-sleep mode, the output voltage of the regulator is fixed at about 0.75V.
90
1. When XPD_SDIO_VREG == 1, the regulator outputs a voltage of 3.3V or 1.8V; when XPD_SDIO_VREG ==
0, the output is high-impedance and, in this case, the voltage is provided by the external power supply.
2. When SDIO_TIEH == 1, the regulator shorts pin VDD_SDIO to pin VDD3P3_RTC. The regulator then outputs
a voltage of 3.3V which is the voltage of pin VDD3P3_RTC. When SDIO_TIEH == 0, the inner loop ties the
regulator output to the voltage of VREF, which is typically 1.8V.
3. DREFH_SDIO, DREFM_SDIO and DREFL_SDIO could be used to tune the reference voltage VREF slightly.
However, it is recommended that users do not change the value of these registers, since it may affect the
stability of the inner loop.
4. When the regulator output is 3.3V or 1.8V, the output current comes from the pin VDD3P3_RTC.
1. As the output of the brownout detector, RTC_CNTL_BROWN_OUT_DET goes high when the voltage of pin
VDD3P3_RTC is lower than the threshold value.
• Digital & analog power controller: generates actual power-gating/clock-gating signals for digital parts and
analog parts.
• Sleep & wakeup controller: handles the entry into & exit from the low-power mode.
• Timers: include RTC main timer, ULP coprocessor timer and touch timer.
• Low-Power processor and sensor controllers: include ULP coprocessor, touch controller, SAR ADC con-
troller, etc.
• Retention memory:
– RTC slow memory: an 8 KB SRAM, mostly used as retention memory or instruction & data memory for
the ULP coprocessor. The CPU accesses it through the APB, starting from address 0x50000000.
– RTC fast memory: an 8 KB SRAM, mostly used as retention memory. The CPU accesses it through
IRAM0/DRAM0. Fast RTC memory is about 10 times faster than the RTC slow memory.
For the RTC core, there are five possible clock sources:
• internal 31.25-kHz clock CK8M_D256_OUT (derived from the internal 8-MHz oscillator divided by 256).
With these clocks, fast_rtc_clk and slow_rtc_clk is derived. By default, fast_rtc_clk is CK8M_OUT while slow_rtc_clk
is SLOW_CK. For details, please see Figure 31-7.
For the digital core, low_power_clk is switched among four sources. For details, please see Figure 31-8.
The switch among power-gating states can be see in Figure 31-9. The actual power-control signals could also be
set by software as force-power-up (FPU) or force-power-down (FPD). Since the power domains can be power-
gated independently, there are many combinations for different applications. Table 31-1 shows how the power
domains in ESP32 are controlled.
• Active mode
– The CPU is clocked at XTAL_DIV_N (40 MHz/26 MHz) or PLL (80 MHz/160 MHz/240 MHz).
• Modem-sleep mode
– The Wi-Fi/Bluetooth baseband is clock-gated or powered down. The radio is turned off.
– Immediate wake-up.
• Light-sleep mode
– The internal 8 MHz oscillator, 40 MHz high-speed crystal, PLL, and radio are disabled.
– The clock in the digital core is gated. The CPUs are stalled.
– The ULP coprocessor and touch controller can be periodically triggered by monitor sensors.
• Deep-sleep mode
– The internal 8 MHz oscillator, 40 MHz high-speed crystal, PLL and radio are disabled.
• Hibernatation mode
– The internal 8 MHz oscillator, 40 MHz high-speed crystal, PLL, and radio are disabled.
– The RTC memory and fast RTC memory are powered down.
By default, the ESP32 is in active mode after a system reset.There are several low-power modes for saving power
when the CPU does not need to be kept running, for example, when waiting for an external event. It is up to the
user to select the mode that best balances power consumption, wake-up latency and available wake-up sources.
For details, please see Figure 31-10.
Please note that the predefined power mode could be further optimized and adapted to any application.
2. EXT1 is especially designed to wake up the chip from any sleep mode, and it also supports multiple pads’ com-
binations. First, RTC_CNTL_EXT_WAKEUP1_SEL[17:0] should be configured with the bitmap of PADS selected
as a wake-up source. Then, if RTC_CNTL_EXT_WAKEUP1_LV is 1, as long as one of the PADs is at high-voltage
level, it can trigger a wake-up. However, if RTC_CNTL_EXT_WAKEUP1_LV is 0, it needs all selected PADs to be
at low-voltage level to trigger a wake-up.
3. In Deep-sleep mode, only RTC GPIOs (not DIGITAL GPIOs) can work as wakeup source.
5. To wake up the chip with a Wi-Fi or BT source, the power mode switches between the Active, Modem- and
Light-sleep modes. The CPU, Wi-Fi, Bluetooth, and radio are woken up at predetermined intervals to keep Wi-
Fi/BT connections active.
6. Wake-up is triggered when the number or positive edges of RxD signal is greater than or equal to (UART_ACTIVE_THRESHOLD
Note that the RxD signal cannot be input through GPIO Matrix but only through IO_MUX.
The RTC timer can be used to wake up the CPU at a designated time, and to wake up TOUCH or the ULP
coprocessor periodically.
3. When the CPU is powered up, the reset vector starts from 0x50000000, instead of 0x40000400. ROM
unpacking & SPI boot are not needed. The code in RTC memory has to do itself some initialization for the C
program environment.
2. Calculate CRC for the fast RTC memory, and save the result in register RTC_CNTL_RTC_STORE6_REG[31:0].
3. Input register RTC_CNTL_RTC_STORE7_REG[31:0] with the entry address in the fast RTC memory.
5. When the CPU is powered up, after ROM unpacking and some necessary initialization, the CRC is calculated
again. If the result matches with register RTC_CNTL_RTC_STORE6_REG[31:0], the CPU will jump to the
entry address.
• The registers listed below have been grouped according to their functionality. This particular grouping does
not reflect the exact sequential order in which they are stored in memory.
• The base address for registers is 0x60008000 when accessed by AHB, and 0x3FF48000 when accessed
by DPORT bus.
31.5 Registers
Register 31.1. RTC_CNTL_OPTIONS0_REG (0x3FF48000)
RS ST
C0
E_ OR
C0
C NT IA I2C _F C U
C NT IA I2C OR W D
T
C NT TL OR P_ EE P
RT NT SW C_ RC CE U
W RO RC PU D
RT _C L_B S_ _F CE _8M
RT _C L_B S_ RE OR E_P
RT _C L_B S_ _F OL E_P
RT _C L_X _F EE SL LEE
U_
C L_ I2 FO R _P
C_ L_S _P FO E_ _P
RT _C L_B PLL CE U _8
U_
RC _N
RT _C L_B S_ _F CE U
RT _C L_B S_ RC W_ D
RT _C L_B _F CE FOL P
C NT IA FO E_ 8M
C NT IA I2C OR _P
C NT IA FO OL _P
PC U_ D
C NT B OR _P W
C_ NT B_ C_ _FO CE
CP
C NT B _I C U
C NT B _I _F D
CP
FO E
C NT IA CO _F C
C NT TL SL E_ S
_S PU ST
ST
TL _AP CP E_P
RT _C L_B PLL OR E_P
RT _C L_B PLL 2C E_P
P_ RC
RT _C L_X S_ RC NO
RT _C L_B S_ RE OR
RT _C L_B _I2 2C OR
O
R
PP
RT _C L_B PLL OR D
_R
PR
C NT B _F _P
RA _FO
C NT IA CO _F
G RA ST
C T B _F C
_A
L_
RT _C L_B S_ RE
_D W R
LL
_W P
TL G_ YS_
AL
C NT IA CO
TA
T
CN L_D _S
_S
RT _C L_B S_
C_ NT W
W
C NT IA
RT C L_B
RT C L_S
_S
_S
TL
C_ NT
C_ NT
)
ed
CN
CN
R T _C
R T _C
rv
C_
se
C
C
RT
RT
RT
(re
31 30 29 28 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTC_CNTL_DG_WRAP_FORCE_RST The digital core can force a reset in deep sleep. (R/W)
31 0
0x000000000 Reset
I
_H
M
L
TI
VA
N_
_
LP
AI
_M
_S
TL
TL
)
ed
CN
CN
rv
C_
C_
se
RT
RT
(re
31 17 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x00000 Reset
VA TE
E_ DA
D
LI
IM UP
_T E_
TL IM
CN L_T
C_ NT
)
ed
R T _C
rv
se
C
RT
(re
31 30 59 30
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0x000000000 Reset
HI
E_
IM
_T
TL
d)
CN
r ve
C_
se
RT
(re
31 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x00000 Reset
ER N
N
M _E
_E
TI R
P_ IME
D
IN
SL _T
E_
CT P
H_ LP
DI A T
_A U
IV
_S _W EC
O KE
UC S
CN L_S _R N
O P_
C_ NT LP _E
TL LP EJ
_T _C
RT _C L_S EEP
TL LP
C NT L
CN _U
RT C L_S
L
C_ NT
C_ NT
)
)
ed
ed
R T _C
RT C
rv
rv
C_
se
se
C
RT
RT
(re
(re
31 30 29 28 27 25 24 23 22 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EN
_
LL
TA
_S
PU
_C
TL
d)
CN
r ve
C_
se
RT
(re
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 Reset
T
AI
W
T_
FF
R
TA
_O
S
M
H_
8
UC
CK
TO
E_
M
_
CP
_TI
P
IN
UL
M
L_
_
TL
T
)
ed
CN
CN
rv
C_
C_
se
RT
RT
(re
31 24 23 15 14 0
AL
_V
LP
_S
IN
_M
TL
d)
)
ed
CN
e
rv
rv
C_
se
se
RT
(re
31 16 15 8 7 (re 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x080 0 0 0 0 0 0 0 0 Reset
RC _PU
PD
M _P U
U
C d) VT I2C _P
E_
_P
O U
FO E
PU
RT rve L_P F_ US
EN PU
A_ RC
2C
N_
se NT XR PB
C d) KG C_
_I
LL FO
RT rve L_C L_I2
(re C _T X_
_P _A
C_ NT FR
TL LL
se NT L
RT _C L_R
(re C L_P
CN L_P
L
C_ NT
C NT
C_ NT
)
ed
R T _C
R T _C
RT _C
rv
se
C
RT
(re
31 30 29 28 27 26 25 24 23 22 0
0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
U
U
EC R
CP
CP
_V TO
RO
AT EC
PP
_A
_P
ST _V
U_ TAT
SE
SE
AU
AU
CP _S
_C
_C
PP PU
ET
ET
_A C
TL RO
ES
ES
_R
_R
CN L_P
TL
TL
C_ NT
)
ed
CN
CN
R T _C
rv
C_
C_
se
C
RT
RT
RT
(re
31 14 13 12 11 6 5 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 x x x x x x x x x x x x Reset
RE
LT
FI
SE
P_
U
A
EU
CA
EN
AK
P_
P_
_W
EU
EU
O
AK
AK
PI
_W
W
_G
L_
TL
TL
T
d)
CN
CN
CN
ve
er
C_
C_
C_
s
RT
RT
RT
(re
31 23 22 21 11 10 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0x000 Reset
A
A
IN NA
RT _C L_T P_C INT _IN NA
EN
RT _C L_W E_ _IN NA EN
AK T_ NA
TL LP IDL NA EN
P_ _E
T_
C NT L H_ T _E
C NT IM P _E T_
EU INT
_ W C _E
CN L_S O_ _E T_
RT _C L_U UC _OU INT
RT _C L_S T_ LID EN
T
C_ T DI NT _IN
C NT O N R_
LP EJ IN
C NT D VA T_
_S _R E_
RT _C L_T OW ME
E
C NT R TI
RT _C L_B IN_
I
C NT A
RT C L_M
C_ NT
d)
N
ve
R T _C
er
C
s
RT
(re
31 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTC_CNTL_WDT_INT_ENA The interrupt enable bit for the RTC_CNTL_WDT_INT interrupt. (R/W)
W
W
IN AW
RT _C L_T P_C INT _IN AW
RA
W
RT _C L_W E_ _IN AW RA
AK T_ AW
TL LP IDL AW RA
P_ _R
C NT L H_ T _R
T_
C NT IM P _R T_
_ W C _R
EU INT
CN L_S O_ _R T_
RT _C L_U UC _OU INT
RT _C L_S T_ LID RA
T
C_ T DI NT _IN
C NT O N R_
LP EJ IN
C NT D VA T_
_S _R E_
RT _C L_T OW ME
E
C NT R TI
RT _C L_B IN_
I
C NT A
RT C L_M
C_ NT
d)
N
ve
R T _C
er
C
s
RT
(re
31 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTC_CNTL_TOUCH_INT_RAW The raw interrupt status bit for the RTC_CNTL_TOUCH_INT inter-
rupt. (RO)
RTC_CNTL_ULP_CP_INT_RAW The raw interrupt status bit for the RTC_CNTL_ULP_CP_INT inter-
rupt. (RO)
RTC_CNTL_WDT_INT_RAW The raw interrupt status bit for the RTC_CNTL_WDT_INT interrupt.
(RO)
ST
RT _C L_W E_ _S T ST
IN T
RT _C L_T R_I INT _IN T
P_ _S
TL LP IDL T ST
C NT A H_ T _S
T_
C NT IM NT _S T_
AK T_ T
_W EC T_S
EU INT
CN L_S O_ _S T_
RT _C L_S UC _OU INT
C_ NT DI INT _IN
C NT O N R_
LP EJ IN
C NT D VA T
RT _C L_S T_ LID
_S _R E_
RT _C L_T OW ME
C NT R TI
RT _C L_B IN_
C NT A
RT _C L_M
C NT
d)
ve
R T _C
er
C
s
RT
(re
31 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTC_CNTL_TOUCH_INT_ST The masked interrupt status bit for the RTC_CNTL_TOUCH_INT inter-
rupt. (RO)
RTC_CNTL_SAR_INT_ST The masked interrupt status bit for the RTC_CNTL_SAR_INT interrupt.
(RO)
RTC_CNTL_WDT_INT_ST The masked interrupt status bit for the RTC_CNTL_WDT_INT interrupt.
(RO)
R
R
IN LR
RT _C L_T R_I INT _IN LR
CL
RT _C L_W E_ _C LR CL
AK T_ LR
P_ _C
TL LP IDL LR CL
C NT A H_ T _C
T_
C NT IM NT _C T_
_ W C _C
EU INT
CN L_S O_ _C T_
RT _C L_S UC _OU INT
T
C_ T DI NT _IN
C NT D VA LR
C NT O N R_
LP EJ IN
RT _CN L_S T_ LID
_S _R E_
RT _C L_T OW ME
E
C NT R TI
RT _C L_B IN_
I
C NT A
RT C L_M
C_ NT
d)
ve
R T _C
er
C
s
RT
(re
31 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x Reset
TR N
V
_C _E
_L
XT TR
_E _C
TL XT
_X _E
TL TL
CN L_X
C_ NT
)
ed
R T _C
rv
se
C
RT
(re
31 30 29 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTC_CNTL_XTL_EXT_CTR_LV 0: power down XTAL at high level, 1: power down XTAL at low level.
(R/W)
)
ed
RT _C
rv
se
C
RT
(re
31 30 29 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
N
_R C E N
EC EN _E
O JE J _E
EJ T_ CT
PI RE RE CT
EN
_G _ P_ JE
E
T_
US
TL DIO _SL RE
CA
CN L_S HT P_
C_ NT IG SL
T_
EC
RT _C L_L EP_
EJ
C T E
RT C _D
L _R
L
NT
C_ NT
)
ed
N
C
RT _C
rv
C_
se
C
RT
RT
(re
31 28 27 26 25 24 23 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
TL
d)
CN
CN
ve
er
C_
C_
s
RT
RT
(re
31 30 29 28 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
_ 8M EN EN
EL L
_R EL
TL K8 K_S SE
NB K K_ 6_
RC PU
PD
LK _S
C_ L_E _C L32 25
_
C L_ _X 8M N
M IV
TC
EL
O E_
E_
_C TC
RT NT ENB TA _D
C_ NT IG LK _E
EQ
_C CK8 _D
_F C
_S
ST _R
RT _C L_D _C 8M
M R
FR
IV
V
K8 _FO
_F CLK
DI
C NT IG LK
_D
_D
CN L_C CL
_
RT C L_D _C
_C M
M
_
_
C
NA
K8
K8
K8
C_ NT IG
O
A
_C
_C
R T C _D
C_ L_A
C_ L_S
L
TL
TL
TL
T
RT NT
RT NT
C_ T
C_ NT
)
C_ )
)
ed
ed
CN
CN
CN
CN
RT rve
C
RT C
RT C
rv
rv
C_
C_
C_
C_
se
se
se
RT
RT
RT
RT
(re
(re
(re
31 30 29 28 27 26 25 24 17 16 15 14 12 11 10 9 8 7 6 5 4 3 0
0 0 0 0 0 0 0 0 2 0 0 1 0 0 0 0 1 0 0 0 0 Reset
RTC_CNTL_DIG_CLK8M_EN Enable CK8M for digital core (no relation to RTC core). (R/W)
RTC_CNTL_DIG_XTAL32K_EN Enable CK_XTAL_32K for digital core (no relation to RTC core). (R/W)
RTC_CNTL_CK8M_DIV CK8M_D256_OUT divider. 00: div128, 01: div256, 10: div512, 11:
div1024. (R/W)
E N
_S EG
D_
_S _ H Y
TL DIO TIE AD
_P
FH VR
RE E
O
RT _C L_S G1P IO
CN L_S O_ RE
_V C
G
DI
DI
RE IO_
O R
_S
C_ NT DI 8_
_S
DI FO
D
FM
_S
L
EF
RE
PD
C NT E
_D
_D
C_ L_D
R T C _R
C_ L_X
TL
TL
L
T
C_ NT
)
ed
CN
CN
CN
CN
RT C
rv
C_
C_
C_
se
RT
RT
RT
RT
RT
(re
31 30 29 28 27 26 25 24 23 22 21 20 0
0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
AK
LP
RC PU
PD
_S
S_
O E_
E_
BO ST CE U
O _FO _PD
AS
_D O R P
A
_F C
TL BO _FO CE_
BI
BI
ST R
_D
_D
AK
LP
P
CN L_D G R
G
A
C_ NT RE _FO
RE
RE
_S
DC
S_
AS
_V
_V
RT _C L_P EG
K_
A
IG
IG
BI
BI
SC
C NT R
_D
_D
_D
_D
RT C L_P
_
TL
TL
TL
TL
TL
C_ NT
)
ed
CN
CN
CN
CN
CN
RT _C
rv
C_
C_
C_
C_
C_
se
C
RT
RT
RT
RT
RT
RT
(re
31 30 29 28 27 25 24 22 21 14 13 11 10 8 7 0
1 0 1 0 4 4 0 4 4 0 0 0 0 0 0 0 0 Reset
RTC_CNTL_VREG_FORCE_PD RTC voltage regulator - force power down (in this case power down
means decreasing the voltage to 0.8V or lower). (R/W)
RC IS O
O
O E_ IS
C NT AS E _F CE PU
C NT AS E FO _ PD
IS
EM FO CE O
C NT O E FO E_ U
_F RC _NO
C NT O E_ FO E_ U
C NT L E_ IS _C D
C NT AS E PD CE U
C NT L E FO N D
E_ O
PU
NO
TM M_ OR _IS
RT _C L_S OW EM RC PU
RT _C L_F OW EM OR PD
RT _C L_F TM M_ RC CP
RT _C L_F RC M_ RC LP
RT _C L_S RC NO LW LP
RT _C L_F TM M_ OR _P
RT _C L_S TM M_ _E _P
RT _C L_F TM EM OR _L
RT _C L_F TM M_ OLW _L
C NT AS E _F CE
C NT AS M _F CE
AS E _F CE
C NT L M FO E_
C NT L M _F E_
C NT AS M _F N
RT _C L_F OW EM D_E
RT _C L_S OW M_ RC
RT _C L_F TM EM OR
_F TM M R
TL AS ME _FO
RT _C L_S OW ISO O
C NT L M _P
RT _C L_S OW EM
CN _F W M
RT _C L_S RC PU
RT _C L_S OW PD
C_ NT LO ME
C NT O E_
C NT L E_
C NT L M
RT _C L_F _EN
RT _C L_F RC
C NT D
C NT O
RT C L_P
L
C_ NT
d)
ve
RT _C
er
C
s
RT
(re
31 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 0 1 0 1 Reset
C NT NT _R 3_ RC PU
C NT NT _R 3_ RC PD
C NT NT _R 2_ RC PU
C NT NT _R 2_ RC PD
C NT NT _R 1_ RC PU
C NT NT _R 1_ RC PD
C NT O _R 0_ RC PU
C_ NT O _F 0_ RC PD
TL SL _FO CE RC PU
SL ME CE U PD
RC PU
PD
RT _C L_I I_F RC RC _PU
RT _C L_I ER RC PU _PD
RT _C L_I ER AM FO E_
RT _C L_I ER AM FO E_
RT _C L_I ER AM FO E_
RT _C L_I ER AM FO E_
RT _C L_I ER AM FO E_
RT _C L_I ER AM FO E_
RT _C L_R ER AM FO E_
RT _C L_R M0 AM FO E_
CN L_L M0 OR FO E_
_L P_ R _P E_
CN L_I ER AM PD N
_R R M PD N
M AM P N
PD _P EN
N EN
O E_
E_
C NT NT _R 4_ RC
C_ NT NT _R 3_ _E
TL NTE _RA 2_ _E
O _R 1_ _E
C NT IF O FO E
C NT NT O E_ E
N
M _F D
0_ 0 D_
_E D_
_F RC
RT _C L_W I_F P_ RC
RT _C L_I ER AM PD
RT _C L_I ER AM FO
RT _C L_I ER _EN _E
P_ M _P
RT _C L_I ER AM PD
EM O
C NT NT D PD
C NT IF RA FO
C T T R _
C NT NT _R 4_
C NT NT _R E_
4
RT _C L_I ER AM
RT _C L_I I_P P_
RT _C L_W _W P_
C NT IF RA
C NT G RA
C NT NT _R
_
RT _C L_W _W
RT _C L_D _W
C NT G
C NT G
N
RT C L_D
RT C L_D
C_ NT
C_ NT
)
)
ed
ed
N
RT _C
R T _C
rv
rv
se
se
C
C
RT
RT
(re
(re
31 30 29 28 27 26 25 24 23 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0
x x x x x x x x 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 Reset
LD
O N
HO
UT _E
_A LD
AD O
_P OH
LD DG UT
C NT NT _R 3_ RC IS O
C NT NT _R 2_ RC IS O
C NT NT _R 1_ RC IS O
C NT O _F 0_ RC IS O
C NT G D CE O IS O
HO L_ A
RT _C L_I ER AM FO E_ OIS
RT _C L_I ER AM FO E_ OIS
RT _C L_I ER AM FO E_ OIS
RT _C L_R M0 AM FO E_ OIS
O T D_
_D _R _C E O D
RT _C L_I ER RC NO _IS O
RT _C L_I ER AM FO E_ O
RT _C L_I ER AM FO E_ O
RT _C L_R ER AM FO E_ O
RT _C L_D M0 OR FO E_ O
TL LR TC RC _IS OL
C NT NT O E_ E IS
AD RT _D ISO
UT CN PA
C NT NT _R 3_ RC N
C NT NT _R 2_ RC N
C NT NT _R 1_ RC N
C NT O _R 0_ RC N
C NT G _F CE RC N
C_ NT EG D R _U D
C NT NT _R E_ ISO O
RT _C L_I I_F RC RC _NO
RT _C L_I ER AM FO E_
CN L_C _R _FO CE NH
RT _C L_R _PA _FO CE OL
_A C_ G_
_P _ TL O
C NT NT _R 4_ RC
C NT G D R _H
G EG N _N
C NT G D R O
C NT IF O FO E
RT _C L_W I_F P_ RC
RT _C L_I ER AM ISO
RT _C L_I ER AM FO
C NT NT _R 4_
RT _C L_W _W P_
C NT G RA
RT _C L_D _W
C NT G
RT C L_D
C_ NT
)
ed
R T _C
rv
se
C
RT
(re
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 0
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 Reset
SE _R ET EN
TH
TH
N_ ET N
P N
AU U ES D_
_I ES _E
G
SL _E
G
EN
_P CP _R O
EN
DT APP PU T_M
_L
_L
ET
ET
_W T_ C O
TL D RO BO
ES
ES
_R
CN L_W T_ SH
0
S_
PU
TG
TG
TG
TG
C_ NT D FLA
N
SY
_C
_S
_S
_S
_S
P
_E
RT _C L_W T_
DT
DT
DT
DT
DT
DT
DT
C T D
_W
_W
_W
_W
_W
RT C L_W
_
L_
TL
TL
TL
TL
TL
TL
T
C_ NT
CN
CN
CN
CN
CN
CN
CN
N
re rved
ed
ed
RT C
rv
rv
C_
C_
C_
C_
C_
C_
C_
C_
e
se
se
RT
RT
RT
RT
RT
RT
RT
RT
s
re
re
31 30 28 27 25 24 22 21 19 18 17 16 14 13 11 10 9 8 7 6 0
0 0 0 0 0 0 0 1 1 1 0 0 1 0 Reset
RTC_CNTL_WDT_STG3 1: interrupt stage enable, 2: CPU reset stage enable, 3: system reset stage
enable, 4: RTC reset stage enable. (R/W)
RTC_CNTL_WDT_STG2 1: interrupt stage enable, 2: CPU reset stage enable, 3: system reset stage
enable, 4: RTC reset stage enable. (R/W)
RTC_CNTL_WDT_STG1 1: interrupt stage enable, 2: CPU reset stage enable, 3: system reset stage
enable, 4: RTC reset stage enable. (R/W)
RTC_CNTL_WDT_STG0 1: interrupt stage enable, 2: CPU reset stage enable, 3: system reset stage
enable, 4: RTC reset stage enable. (R/W)
31 0
0x000000FFF Reset
)
ed
CN
rv
C_
se
RT
(re
31 30 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0x050D83AA1 Reset
C1
1
_C
U_
PU
CP
PC
O
PR
AP
L_
L_
L
L
TA
TA
_S
_S
W
SW
_S
_
TL
TL
)
ed
CN
CN
rv
C_
C_
se
RT
RT
(re
31 26 25 20 19 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
RTC_CNTL_SW_STALL_PROCPU_C1 reg_rtc_cntl_sw_stall_procpu_c1[5:0],
reg_rtc_cntl_sw_stall_procpu_c0[1:0] == 0x86 (100001 10) will stall PRO_CPU, see also
RTC_CNTL_OPTIONS0_REG. (R/W)
RTC_CNTL_SW_STALL_APPCPU_C1 reg_rtc_cntl_sw_stall_appcpu_c1[5:0],
reg_rtc_cntl_sw_stall_appcpu_c0[1:0] == 0x86 (100001 10) will stall APP_CPU, see also
RTC_CNTL_OPTIONS0_REG. (R/W)
31 0
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x Reset
C NT O H_ D4 OL FO E
C NT O H_ D3 OL FO E
C NT O H_ D2 OL FO E
C NT E H_ D1 OL FO E
C NT E 4 D0 OL FO E
C NT E 3 L OL FO E
C NT E 2 L O FO E
C NT D 1 L O E E
RT _C L_T UC PA _H D_ RC
RT _C L_T UC PA _H D_ RC
RT _C L_T UC PA _H D_ RC
RT _C L_S UC PA _H D_ RC
RT _C L_S NSE PA _H D_ RC
RT _C L_S NSE _HO _H D_ RC
RT _C L_S NSE _HO D_F D_ RC
RT _C L_P NSE _HO D_F RC RC
C NT O H_ D5 OL FO
C_ T DA 2_H LD O E
TL DC 1_H LD_ OR E
DC H LD R E
1_ OLD _FO CE
LD FOR CE
RT _CN L_P AC _HO D_F RC
CN L_A C O _F RC
_A 2_ O FO C
RT _C L_T UC PA _H D_
O E
E
RT _C L_T UC PA OR E
RT _C L_T UC PA _H E
_F C
RC
HO _ R
C NT O H_ D6 OL
C NT O H_ _F C
C NT O H_ D7 C
RT _C L_T UC LD FOR
C NT O HO _
RT _C L_T P_ OLD
C NT 32 H
RT _C L_X N_
C NT 32
RT C L_X
C_ NT
d)
ve
RT _C
er
C
s
RT
(re
31 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
R
CL
S_
TU
EL
TA
_S
_S
P1
P1
EU
EU
AK
AK
W
W
T_
T_
EX
X
_E
_
TL
TL
d)
CN
CN
ve
er
C_
C_
s
RT
RT
(re
31 19 18 17 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
S
TU
TA
_S
P1
EU
AK
_W
XT
_E
TL
d)
CN
ve
er
C_
s
RT
(re
31 18 17 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
NA
_E
SH
SE NA
LA
T
NA
_F
LO _E
AI
ES
_W
_ C RF
_E
HR
NA
ST
ST
UT ET
UT _
O _PD
_T
O _D
_R
_R
_E
UT
N_ T
UT
UT
N_ T
W OU
_O
W OU
O
O
N
RO N _
N_
N_
RO N_
W
_B W
_B W
O
TL RO
RO
RO
TL RO
BR
_D
CN L_B
_B
_B
CN _B
TL
TL
TL
L
C_ NT
C_ T
)
ed
CN
CN
CN
N
RT _C
RT C
rv
C_
C_
C_
C_
se
C
RT
RT
RT
RT
RT
(re
31 30 29 27 26 25 16 15 14 13 0
RTC_CNTL_DBROWN_OUT_THRES Brownout threshold. The brownout detector will reset the chip
when the supply voltage is approximately below this level. Note that there may be some variation
of brownout voltage level between each ESP32 chip. 0: 2.43 V ± 0.05; 1: 2.48 V ± 0.05; 2: 2.58
V ± 0.05; 3: 2.62 V ± 0.05; 4: 2.67 V ± 0.05; 5: 2.70 V ± 0.05; 6: 2.77 V ± 0.05; 7: 2.80 V ± 0.05.
(R/W)
Glossary
Revision History