Esp32 Technical Reference Manual en
Esp32 Technical Reference Manual en
www.espressif.com
About This Document
The ESP32 Technical Reference Manual is targeted at developers working on low level software projects that
use the ESP32 SoC. It describes the hardware modules listed below for the ESP32 SoC and other products in
ESP32 series. The modules detailed in this document provide an overview, list of features, hardware
architecture details, any necessary programming procedures, as well as register descriptions.
• Release Status at a Glance on the very next page is a minimal list of all chapters from where you can
directly jump to a specific chapter.
• Use the Bookmarks on the side bar to jump to any specific chapters or sections from anywhere in the
document. Note this PDF document is configured to automatically display Bookmarks when open, which
is necessary for an extensive document like this one. However, some PDF viewers or browsers ignore
this setting, so if you don’t see the Bookmarks by default, try one or more of the following methods:
– Download this document, and view it with your local PDF viewer;
– Set your PDF viewer to always automatically display the Bookmarks on the left side bar when open.
• Use the native Navigation function of your PDF viewer to navigate through the documents. Most PDF
viewers support to go Up, Down, Previous, Next, Back, Forward and Page with buttons, menu, or hot
keys.
• You can also use the built-in GoBack button on the upper right corner on each and every page to go
back to the previous place before you click a link within the document. Note this feature may only work
with some Acrobat-specific PDF viewers (for example, Acrobat Reader and Adobe DC) and browsers with
built-in Acrobat-specific PDF viewers or extensions (for example, Firefox).
Release Status at a Glance GoBack
Note:
Check the link or the QR code to make sure that you use the latest version of this document:
https://www.espressif.com/documentation/esp32_technical_reference_manual_en.pdf
Contents
II Memory Organization 61
5 eFuse Controller 90
5.1 Introduction 90
5.2 Features 90
5.3 Functional Description 90
5.3.1 Structure 90
5.3.1.1 System Parameter efuse_wr_disable 92
Glossary 765
Abbreviations for Peripherals 765
Abbreviations Related to Registers 765
Access Types for Registers 767
List of Tables
1.4-1 ALU Operations Among Registers 32
1.4-2 ALU Operations with Immediate Value 33
1.4-3 ALU Operations with Stage Count Register 33
1.4-4 Input Signals Measured Using the ADC Instruction 38
20.1-1 Mapping Between SPI Bus Signals and Pin Function Signals 353
20.3-1 Command Definitions Supported by GP-SPI Slave in Half-duplex Mode 356
20.4-1 Clock Polarity and Phase, and Corresponding SPI Register Values for SPI Master 358
20.4-2 Clock Polarity and Phase, and Corresponding SPI Register Values for SPI Slave 358
25.3-1 Data Frames and Remote Frames in SFF and EFF 527
25.3-2 Error Frame 529
25.3-3 Overload Frame 529
25.3-4 Interframe Space 530
25.3-5 Segments of a Nominal Bit Time 532
25.5-1 Bit Information of TWAI_CLOCK_DIVIDER_REG; TWAI Address 0x18 537
25.5-2 Bit Information of TWAI_BUS_TIMING_1_REG; TWAI Address 0x1c 537
25.5-3 Buffer Layout for Standard Frame Format and Extended Frame Format 539
25.5-4 TX/RX Frame Information (SFF/EFF); TWAI Address 0x40 540
25.5-5 TX/RX Identifier 1 (SFF); TWAI Address 0x44 541
25.5-6 TX/RX Identifier 2 (SFF); TWAI Address 0x48 541
25.5-7 TX/RX Identifier 1 (EFF); TWAI Address 0x44 541
25.5-8 TX/RX Identifier 2 (EFF); TWAI Address 0x48 541
25.5-9 TX/RX Identifier 3 (EFF); TWAI Address 0x4c 541
25.5-10 TX/RX Identifier 4 (EFF); TWAI Address 0x50 541
25.5-11 Bit Information of TWAI_ERR_CODE_CAP_REG; TWAI Address 0x30 546
25.5-12 Bit Information of Bits SEG.4 - SEG.0 547
25.5-13 Bit Information of TWAI_ARB LOST CAP_REG; TWAI Address 0x2c 548
List of Figures
1.2-1 ULP Coprocessor Diagram 30
1.4-1 The ULP Coprocessor Instruction Format 31
1.4-2 Instruction Type — ALU for Operations Among Registers 31
1.4-3 Instruction Type — ALU for Operations with Immediate Value 32
1.4-4 Instruction Type — ALU for Operations with Stage Count Register 33
1.4-5 Instruction Type — ST 33
1.4-6 Instruction Type — LD 34
1.4-7 Instruction Type — JUMP 35
1.4-8 Instruction Type — JUMPR 35
1.4-9 Instruction Type — JUMP 36
1.4-10 Instruction Type — HALT 36
1.4-11 Instruction Type — WAKE 36
1.4-12 Instruction Type — SLEEP 37
1.4-13 Instruction Type — WAIT 37
1.4-14 Instruction Type — ADC 37
1.4-15 Instruction Type — I2C 38
1.4-16 Instruction Type — REG_RD 39
1.4-17 Instruction Type — REG_WR 39
1.5-1 Control of ULP Program Execution 40
1.5-2 Sample of a ULP Operation Sequence 41
1.6-1 I2C Read Operation 43
1.6-2 I2C Write Operation 43
25.3-1 The bit fields of Data Frames and Remote Frames 527
25.3-2 Various Fields of an Error Frame 528
25.3-3 The Bit Fields of an Overload Frame 529
25.3-4 The Fields within an Interframe Space 530
25.3-5 Layout of a Bit 534
25.4-1 TWAI Overview Diagram 534
25.5-1 Acceptance Filter 543
25.5-2 Single Filter Mode 543
25.5-3 Dual Filter Mode 545
25.5-4 Error State Transition 546
25.5-5 Positions of Arbitration Lost Bits 548
Part I
Chapter 1
1.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.
1.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
RTC CNTL REG
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 1.2-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 1.4-2 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 1.4-1.
Note:
• All ALU operations can be used to set/clear the zero flag in ALU.
Figure 1.4-3. Instruction Type — ALU for Operations with Immediate Value
When bits [27:25] of the instruction in Figure 1.4-3 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 1.4-2.
Note:
• All ALU operations can be used to set/clear the zero flag in ALU.
Figure 1.4-4. 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 1.4-4 should be set to 3’b2. The type of operation depends on the setting of
the instruction’s bits [24:21] presented in Table 1.4-3. The Stage_cnt is a separate register and is not a part of
the instruction in Figure 1.4-4.
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.
• 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.
Sel
4’d8 3’b0 Type ImmAddr Rdst
Note:
All jump addresses are expressed in 32-bit words.
Note:
All jump addresses are expressed in 32-bit words.
• A description of how to set the stage count register is provided in section 1.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.
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
Description
The instruction prompts the taking of measurements with the use of ADC. Pads/signals available for ADC
measurement are provided in Table 1.4-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 1.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 1.5-1.
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 1.5-2, 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 I2C 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
Master Slave Address W Reg Address Slave Address R
ACK
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
ACK
ACK
Slave
Note:
Interrupts from RTC_I2C are not connected. The interrupt registers above are listed only for debugging
purposes.
1.8 Registers
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
RC OP
ST
E_
FO T_T
P_ AR
_C ST
LP P_
T
NI
_U _C
I
C_
NS LP
)
NS d)
)
ed
ed
SE rve
SE _U
_P
rv
rv
NS
se
se
se
(re
(re
(re
SE
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)
R0
R1
DD
DD
_A
_A
E
E
AV
AV
L
L
_S
_S
)
2C
2C
ed
_I
_I
rv
NS
NS
se
(re
SE
SE
31 22 21 11 10 0
R2
R3
DD
DD
_A
_A
E
E
AV
AV
L
SL
_S
C_
)
2C
ed
2
_I
_I
rv
NS
NS
se
(re
SE
SE
31 22 21 11 10 0
R
DD
DD
_A
_A
E
E
AV
AV
L
L
_S
_S
)
2C
2C
ed
_I
rv
S_
NS
se
N
(re
SE
SE
31 22 21 11 10 0
R6
R7
DD
DD
_A
_A
TA
E
E
AV
AV
ON
DA
L
_D
_R
_S
_S
NS d)
2C
2C
2C
2C
SE rve
_I
_I
_I
_I
NS
NS
NS
se
(re
SE
SE
SE
31 30 29 22 21 11 10 0
RL
2C TA
T
_C
_I _S
AR 2C
2C
_S _I
I
R_
NS AR
NS )
ed
A
SE _S
_S
rv
NS
se
(re
SE
SE
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
OD
RI
E
_P
OW
_L
CL
_S
)
ed
2C
rv
I
se
C_
(re
RT
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
T
E_ T
OU
RC OU
(re C_ ANS FIR T
se MS _S ST
OD RT
I2 R B_ RS
FO E_
_M TA
C_ C_T LS FI
A_ RC
E
RT _I2 TX_ SB_
SD FO
C_ L_
C C_ L
RT _I2 RX_
I2 SC
)
RT ed)
C C_
C_ C_
ed
RT _I2
RT I2
rv
rv
se
C_
C
(re
RT
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 AR BU DR_
RT _I2 BU E_A S
E
C C_ V AN
AC E_ T
AT
E
K_ RW
C_ C_ ED T
C C_ S_ D
C_ AV U
AT
L
ST
VA
_
N_
L_
C C_ E
RT _I2 BYT
AI
SC
I2 L
M
S
)
d)
C_
C_
C C_
ed
ve
I2
I2
RT _I2
rv
r
se
se
C_
C_
C
(re
(re
RT
RT
RT
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)
2C
rv
I
se
C_
(re
RT
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 RTC_FAST_CLK cycles that the transmission can take.
(R/W)
T
BI
0
_1
DR
R
DD
AD
_A
E_
E
AV
AV
L
L
_S
_S
d)
2C
2C
ver
I
I
se
C_
C_
(re
RT
RT
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
AN LO MP LR
CO IN TE
E_
TR _ O _C
S_ ST_ LE
E_ ION _C NT
AV AT NS _I
I2 AR ER MP LR
SL TR RA TE
C_ C_ ST O _C
C_ BI _T LE
RT _I2 MA S_C INT
C C_ N T_
RT _I2 TRA OU
C C_ E_
RT _I2 TIM
)
)
C C_
ed
ed
RT _I2
rv
rv
se
se
C
(re
(re
RT
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
_I T_
LO MP EN
N_ O T_
IO _C IN
AT AN E_
BI _T PLE A
AR TER M EN
TR R T
C_ S O _
I2 MA _C INT
C_ C_ NS T_
RT _I2 TRA OU
C C_ E_
RT _I2 TIM
d)
)
C C_
ed
ve
RT _I2
rv
r
se
se
C
(re
(re
RT
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
_I T_
T
LO MP ST
ST _IN
N_ O T_
IO _C IN
AT AN E_
AR TER M ST
TR R T
BI _T PLE
C_ S O _
I2 MA _C INT
C_ C_ NS T_
RT _I2 TRA OU
C C_ E_
RT _I2 TIM
)
)
C C_
ed
ed
RT _I2
rv
rv
se
se
C
(re
(re
RT
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
DA
_S
d)
2C
ver
I
se
C_
(re
RT
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 RTC_FAST_CLK cycles between the SDA switch and the falling
edge of SCL. (R/W)
OD
RI
PE
_
GH
HI
C L_
_S
)
ed
2C
rv
I
se
C_
(re
31 20 19 RT 0
0 0 0 0 0 0 0 0 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
2C
rv
I
se
C_
(re
RT
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
OP
ST
C L_
_S
)
ed
2C
rv
I
se
C_
(re
RT
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
Chapter 2
2.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.
2.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 2.3-1, the RAM represents the internal SRAM
banks available on ESP32. Further details on the SRAM addressing range can be found in Chapter 3 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
descriptor. 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 2.3-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 2.4-1 shows the data transfer in UDMA mode. Before the DMA Engine receives data, software must
initialize the receive-linked-list. UHCI_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
UHCI_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 UHCI_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 separators
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
beginning or end of data. These separators can be configured through UHCI_SEPER_CH, with the default
values being 0xC0. Data that are the same as separators can be replaced with UHCI_ESC_SEQ0_CHAR0
(0xDB by default) and UHCI_ESC_SEQ0_CHAR1 (0xDD by default). After the transmission process is complete,
a UHCI_OUT_TOTAL_EOF_INT interrupt will be generated. After the reception procedure is complete, a
UHCI_IN_
SUC_EOF_INT interrupt will be generated.
Note:
Please note that the buffer address pointer field in in_link descriptors should be word-aligned, and the size field in the
last in_link descriptor should be at least 4 bytes larger than the length of received data.
ESP32 SPI modules can use DMA as well as the CPU for data exchange with peripherals. As can be seen from
Figure 2.5-1, 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 data size for a single transfer must be four bytes aligned. 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
enabling 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 22 I2S Controller
(I2S).
Part II
Memory Organization
This part provides insights into the system’s memory structure, discussing the organization and mapping of
RAM, ROM, eFuse, and external memories, offering a framework for understanding memory-related
subsystems.
Chapter 3
3.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
purposes the two CPUs are interchangeable.
3.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 3.2-1 illustrates the system structure, and the block diagram in Figure 3.2-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
3.3-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 Mem-
ory
Instruction 0x4000_0000 0x400C_1FFF 776 KB Embedded Mem-
ory
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 Mem-
ory
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 3.3-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
information.
3.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 3.3-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
3.3.4 Cache
As shown in Figure 3.3-1, each of the two CPUs in ESP32 has 32 KB of cache featuring a block size of 32
bytes 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 3.3-5 below.
As described in table 3.3-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.
3.3.5 Peripherals
The ESP32 has 41 peripherals. Table 3.3-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
Boundary Address
Bus Type Size Target Comment
Low Address High Address
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
0x3FF5_C000 0x3FF5_DFFF 8 KB Reserved
Data 0x3FF5_E000 0x3FF5_EFFF 4 KB MCPWM0
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
Data 0x3FF6_B000 0x3FF6_BFFF 4KB TWAI
Data 0x3FF6_C000 0x3FF6_CFFF 4 KB MCPWM1
Data 0x3FF6_D000 0x3FF6_DFFF 4 KB I2S1
Data 0x3FF6_E000 0x3FF6_EFFF 4 KB UART2
Data 0x3FF6_F000 0x3FF6_FFFF 4 KB Reserved
Data 0x3FF7_0000 0x3FF7_0FFF 4 KB Reserved
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.
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.
Chapter 4
4.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.
4.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.
4.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 4.3-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 4.3-2 and 4.3-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 4.3-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 4.3-4. 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 detailed in Table 4.3-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 4.3-5 and 4.3-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 4.3-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
accesses 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 from memory regions with sensitive data in them.
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 4.3-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 4.3-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
VAddr0 4 MB 0x3F40_0000 0x3F7F_FFFF 64
VAddr1 4 MB 0x4000_0000 0x403F_FFFF 64*
VAddr2 4 MB 0x4040_0000 0x407F_FFFF 64
VAddr3 4 MB 0x4080_0000 0x40BF_FFFF 64
VAddr4 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 doc-
umented 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
4.3-10 and 4.3-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 Addr1 can only be accessed by PID 2 ~ 7.
As these tables show, virtual address VAddr1 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 VAddr1 . 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 4.3-12 and 4.3-13. As shown in these tables, in this special mode VAddr2 and VAddr3
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 4.3-9, virtual address 0x3F70_2375 resides in the 0x30’th page of .VAddr0
• According to Table 4.3-10, the MMU entry for VAddr0 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 4.3-9, virtual address 0x4044_048C resides in the 0x4’th page of VAddr2 .
• According to Table 4.3-11, the MMU entry for VAddr2 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 4.3-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 VAddrRAM , and page mappings for the APP_CPU can be
configured using the MMU entries for R VAddrRAM . In this mode, all 128 pages of both L VAddr and R VAddr 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 4.3-15.
PRO_CPU address
Virtual address Size
Low High
L
VAddrRAM 4 MB 0x3F80_0000 0x3FBF_FFFF
APP_CPU address
Virtual address Size
Low High
R
VAddrRAM 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
VAddrRAM is used for the lower 2 MB of the virtual address space, while R VAddrRAM is used for the upper 2
MB. This also means that the upper 64 MMU entries for L VAddrRAM , as well as the lower 64 entries for
R
VAddrRAM , are unused. Table 4.3-16 details these address ranges.
PRO_CPU/APP_CPU address
Virtual address Size
Low High
L
VAddrRAM 2 MB 0x3F80_0000 0x3F9F_FFFF
R
VAddrRAM 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 VAddrRAM , the odd chunks through the entries for R VAddrRAM . Generally, the MMU entries for
L
VAddrRAM and R VAddrRAM are set to the same values, so that the virtual pages map to a contiguous region of
physical memory. Table 4.3-17 details this mode.
PRO_CPU/APP_CPU address
Virtual address Size
Low High
L
VAddrRAM 32 Bytes 0x3F80_0000 0x3F80_001F
R
VAddrRAM 32 Bytes 0x3F80_0020 0x3F80_003F
L
VAddrRAM 32 Bytes 0x3F80_0040 0x3F80_005F
R
VAddrRAM 32 Bytes 0x3F80_0060 0x3F80_007F
...
L
VAddrRAM 32 Bytes 0x3FBF_FFC0 0x3FBF_FFDF
R
VAddrRAM 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
4.3-18 details the first MMU entry number for L VAddrRAM and R VAddrRAM 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 4.3-9, virtual address 0x3FA7_2375 resides in the 0x4E’th 32-KB-page of VAddrRAM .
• According to Table 4.3-16, virtual address 0x3FA7_2375 is governed by R VAddrRAM .
• According to Table 4.3-18, the MMU entry for R VAddrRAM 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 4.3-9, virtual address 0x3F85_5805 resides in the 0x0A’th 32-KB-page of VAddrRAM .
• According to Table 4.3-17, the range to be read/written spans both a 32-byte region in R VAddrRAM and
L
VAddrRAM .
• According to Table 4.3-18, the MMU entry for L VAddrRAM for PID 5 starts at 1664.
• According to Table 4.3-18, the MMU entry for R VAddrRAM 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
address 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 4.3-9, virtual address 0x3F80_0876 resides in the 0’th 32-KB-page of VAddrRAM .
• According to Table 4.3-18, the MMU entry for PID 1 for the PRO_CPU starts at 1152.
• According to Table 4.3-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.
4.3.2.3 Peripheral
The Peripheral MPU manages the 39 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
4.3-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
Authority
Peripheral
PID = 0/1 PID = 2 ~ 7
SYSCON Access DPORT_AHBLITE_MPU_TABLE_APB_CTRL_REG
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
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 4.3-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.
Chapter 5
eFuse Controller
5.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.
5.2 Features
• Configuration of 33 system parameters
• Optional write-protection
• Optional software-read-protection
5.3.1 Structure
Thirty-three system parameters with different bit width are stored in the eFuses. The name of each system
parameter and the corresponding bit width are shown in Table 5.3-1. Among those parameters,
efuse_wr_disable, efuse_rd_disable, BLK3_part_reserve and coding_scheme are directly used by the eFuse
Controller.
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 2 -
7 decryption
Program Software-Read
Name Bit width -Protection by -Protection by Description
efuse_wr_disable efuse_rd_disable
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
SPI_pad_config_clk 5 6 -
certain pad
configures the SPI I/O to a
SPI_pad_config_q 5 6 -
certain pad
configures the SPI I/O to a
SPI_pad_config_d 5 6 -
certain pad
configures the SPI I/O to a
SPI_pad_config_cs0 5 6 -
certain 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
Program Software-Read
Name Bit width -Protection by -Protection by Description
efuse_wr_disable efuse_rd_disable
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 - RC_FAST_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
stores the difference be-
dig_vol_l6 4 11 - tween 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
corresponding 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 5.3-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
modules.
The column “Software-Read-Protection by efuse_rd_disable” in Table 5.3-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.
• 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
Repeat
e
BLOCKN [255 : 128] = eBLOCKN [127 : 0] = BLOCKN [127 : 0]
5.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 coding scheme. Meanwhile, BLOCK3[143 : 96], namely, e 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 5.3-3. The register bits will be used when
programming system parameters.
EFUSE_BLK0_WDATA5_REG
Espressif Systems 94 ESP32 TRM (Version 5.5)
Submit Documentation Feedback
Chapter 5 eFuse Controller GoBack
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 5.3-4.
APB_CLK Frequency
Register Configuration Value
26 MHz 40 MHz 80 MHz
EFUSE_CLK_SEL0[7:0] 250 160 80
EFUSE_CLK
EFUSE_CLK_SEL1[7:0] 255 255 128
EFUSE_DAC_CONF EFUSE_DAC_CLK_DIV[7:0] 52 80 100
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 minimize 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 5.3-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.
5.3.5 Interrupts
• EFUSE_PGM_DONE_INT: Triggered when eFuse programming has finished.
5.5 Registers
The addresses in this section are relative to the eFuse Controller base address provided in Table 3.3-6
Peripheral Address Mapping in Chapter 3 System and Memory.
D IS
T
D_
CN
OA
S
T_
DI
I
NL
_D
P
R_
RY
OW
RD
W
_C
E_
E_
_D
SH
US
US
RT
LA
A
F
_U
_E
_E
_F
RD
RD
RD
RD
d)
ve
E_
E_
E_
E_
r
US
US
US
US
se
(re
EF
EF
EF
EF
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)
_R
rv
E
US
se
(re
EF
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
HE
D
P_
_H
HI ER KG AC
AP
DI BT
IG
_C P_V _P _C
NF
R_ S_
S_
G
RD HI ER IS
PK
VE DI
CO
E_ _C _V D
R_
P_ _
D_
US RD HI ER
E
PA
_V
EF E_ _C P_V
IP
P
I_
US RD HI
CH
SP
EF E_ _C
D_
D_
US RD
)
ed
_R
E_
EF E_
rv
SE
US
US
se
U
(re
EF
EF
EF
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)
Q
PD TIE E
RE
_X O_ RC
_S H
O
_F
RD DI FO
DI
8M
E_ _S O_
K
US RD DI
_C
EF SE_ _S
RD
U RD
)
)
ed
ed
E_
EF SE_
rv
rv
S
FU
se
se
U
(re
(re
ES
EF
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
LK
CS
NF
_D
_C
NV
G_
G_
CO
IG
IG
_I
I
HP
NF
NF
NF
NF
T_
P
CO
CO
CO
CO
L_
6
RY
_L
VE
D_
D_
D_
D_
_C
OL
LE
PA
PA
PA
PA
H
_V
L_
AS
I_
I_
I_
I_
IG
SP
P
O
FL
_D
_S
_S
_S
_V
D_
D_
RD
RD
RD
RD
RD
d)
R
R
ve
E_
E_
E_
E_
E_
E_
E_
r
US
US
US
US
US
US
US
se
(re
EF
EF
EF
EF
EF
EF
EF
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
SA
T
EF rve _A S_D _JT ENC YPT
YP
DI
(re SE_ _A AB _DL DEC E
US d) BS O AG R
G_
U RD IS LE _ H
se RD B LE _ R
EF SE_ _D AB _DL CAC
E
G_ BU
M
HE
0
U RD IS LE _
E
ON _1
E_
OD E_D
EF SE_ _D AB _DL
EF SE_ _D AB US
SC
_D NE
U RD IS TAT
U RD IS LE
_C OL
IN
EF E_ _D _S
RD NS
US RD EY
O
_C
EF SE_ _K
U RD
RD
d)
ve
EF SE_
E_
E_
r
US
se
U
(re
EF
EF
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
D_
CN
OA
T_
NL
YP
OW
CR
H_
D
S
IS
DI
T_
D
AS
R_
D_
AR
)
FL
ed
_W
_U
_R
E_
rv
E
US
US
US
US
se
(re
EF
EF
EF
EF
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
H IG
R C_
_C
AC
M
I_
IF
)
ed
W
E_
rv
US
se
(re
EF
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 R_ G CH
_H
PP
IS T
CH _VE PK CA
IG
_D _B
_A
NF
E_ IP R_ S_
KG
ER IS
US CH VE DI
CO
_V D
P
R_
EF E_ IP_ R_
D_
VE
US CH VE
PA
P_
EF E_ IP_
I_
HI
US CH
SP
)
ed
_C
E_
EF SE_
rv
E
US
US
se
U
(re
EF
EF
EF
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)
EQ
XP _T CE
R
D_ IEH
E_ IO OR
IO
_F
SD
US SD _F
M
K8
EF SE_ IO
U SD
_C
)
)
ed
ed
EF SE_
SE
rv
rv
FU
se
se
U
(re
(re
ES
EF
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
S
NF
_D
_Q
_C
_C
NV
CO
IG
IG
IG
IG
I
P_
NF
NF
NF
NF
T_
_H
P
CO
CO
CO
CO
6
RY
EL
_L
D_
D_
D_
D_
_C
EV
L
VO
PA
PA
PA
PA
SH
_L
G_
I_
I_
I_
I_
LA
SP
SP
SP
SP
VO
)
DI
ed
F
E_
E_
E_
E_
E_
E_
E_
rv
US
US
US
US
US
US
US
se
(re
EF
EF
EF
EF
EF
EF
EF
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
T
se AB D TA C T
EF rve S_ ONE G RYP
(re SE_ S_ E_J _EN RYP
CH _D
EF SE_ ISA E_D _DE HE
_S UG
U AB BL L C
U D BL L C
E
EF SE_ ISA E_D _CA
B
_0
DI _DE
US d) DO _1
U D BL L
U D BL S
EF SE_ ISA E_D
NE
EF SE_ ISA ATU
CO LE
NG
U D ST
E_ SO
EF E_ Y_
US ON
US KE
)
ed
C
EF SE_
E_
rv
se
U
(re
EF
EF
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
L
E
SE
_S
K_
LK
L
)
ed
_C
_C
rv
E
US
US
se
(re
EF
EF
31 16 15 8 7 0
DE
CO
P_
d)
_O
ve
E
r
US
se
(re
EF
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
(re
EF
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 oper-
ation 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)
W
IN AW
RA
E_ T_R
T_
ON IN
_D E_
AD ON
RE _D
E_ M
US PG
)
ed
EF SE_
rv
se
U
(re
EF
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 inter-
rupt. (RO)
ST
IN T
E_ T_S
T_
ON IN
_D E_
AD ON
RE _D
E_ M
US PG
)
ed
EF SE_
rv
se
U
(re
EF
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 inter-
rupt. (RO)
EFUSE_READ_DONE_INT_ST The masked interrupt status bit for the EFUSE_READ_DONE_INT in-
terrupt. (RO)
A
IN NA
EN
E_ T_E
T_
ON IN
_D E_
AD ON
RE _D
E_ M
US PG
)
ed
EF SE_
rv
se
U
(re
EF
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_
rv
se
U
(re
EF
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
V
DI
K_
CL
C_
DA
)
ed
E_
rv
US
se
(re
EF
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
EC
)
ed
_D
rv
E
US
se
(re
EF
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)
Part III
System Component
Encompassing a range of system-level functionalities, this part describes components related to clocks, GPIO,
timers, watchdogs, interrupt handling, low-power management, and various system registers.
Chapter 6
6.1 Overview
The ESP32 chip features 34 physical GPIO pins. Each pin 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 pins. Together these systems provide highly configurable
I/O.
Note that the I/O GPIO pins are 0-19, 21-23, 25-27, 32-39, while the output GPIOs are 0-19, 21-23, 25-27,
32-33. GPIO pins 34-39 are input-only.
GPIO20 serves as a valid input and output only on ESP32-PICO-V3 and ESP32-PICO-V3-02. Please refer to
ESP32-PICO Series Datasheet for more information.
This chapter describes the signal selection and connection between the digital pins (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 pin. Each pin can be configured to perform a “GPIO” function
¹MUX: Multiplexer. The ESP32 chip integrates multiple peripherals that require communication with the outside world. To keep the chip
package size reasonably small, the number of available pins has to be limited. So the only way to route all the incoming and outgoing
signals is through pin multiplexing. Pin muxing is controlled via software programmable registers such as IO_MUX_x_REG.
(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 pins directly to the peripheral.)
See Section 6.10 for a list of IO MUX functions for each I/O pin.
2. The GPIO Matrix is a full-switching matrix between the peripheral input/output signals and the pins.
• For input to the chip: Each of the 162 internal peripheral inputs can select any GPIO pin as the input
source.
• For output from the chip: The output signal of each of the 34 GPIO pins can be from one of the 176
peripheral output signals.
3. RTC IO MUX is used to connect GPIO pins to their low-power and analog functions. Only a subset of
GPIO pins have these optional “RTC” functions.
Figure 6.1-2 shows the internal structure of a pad, which is an electrical interface between the chip logic and
the GPIO pin. The structure is applicable to all 31 GPIO pins and can be controlled using IE, OE, WPU, and WPD
signals.
• Bonding pad: a terminal point of the chip logic used to make a physical connection from the chip die to
GPIO pin in the chip package
6.2.1 Summary
To receive a peripheral input signal via the GPIO Matrix, the GPIO Matrix is configured to source the peripheral
signal’s input index (0-18, 23-36, 39-58, 61-90, 95-124, 140-155, 164-181, 190-195, 198-206) from one of the 34
GPIOs (0-19, 21-23, 25-27, 32-39).
The input signal is read from the GPIO pin through the IO MUX. The IO MUX must be configured to set the
chosen pin to “GPIO” function. This causes the GPIO pin input signal to be routed into the GPIO Matrix, which
in turn routes it to the selected peripheral input.
To read GPIO pin X into peripheral signal Y, follow the steps below:
• Set the GPIO_FUNCy_IN_SEL field in this register, corresponding to the GPIO pin X to read from.
• 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
pin X as follows:
• Set the function field (MCU_SEL) to the IO MUX function corresponding to GPIO X (this is Function
2—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 pin. 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 pin X, as mentioned in Section 6.2.2.
6.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 pin to “GPIO” function. This causes the output GPIO signal to be connected to
the pin.
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
• If the signal should always be enabled as an output, set the GPIO_FUNCx_OEN_SEL bit in the
GPIO_FUNCx_OUT_SEL_CFG register and the GPIO_ENABLE_DATA[x] field in the
GPIO_ENABLE_REG register corresponding to GPIO pin 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 pin 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
pin X as follows:
• Set the function field (MCU_SEL) to the IO MUX function corresponding to GPIO X (this is Function
2—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 pins simultaneously.
To configure a pin as simple GPIO output, the GPIO Matrix GPIO_FUNCx_OUT_SEL register is configured with a
special peripheral index value (0x100).
6.4.1 Summary
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 pins directly to the
peripheral.
Selecting this option is less flexible than using the GPIO Matrix, as the IO MUX register for each GPIO pin can
only select from a limited number of functions. However, better high-frequency digital performance will be
maintained.
1. IO MUX for the GPIO pin must be set to the required pin function. (Please refer to section 6.10 for a list of
pin functions.)
2. For inputs, the SIG_IN_SEL register must be cleared to route the input directly to the peripheral.
6.5.1 Summary
18 GPIO pins have low power capabilities (RTC domain) and analog functions which are handled by the RTC
subsystem of ESP32. The IO MUX and GPIO Matrix are not used for these functions; rather, the RTC_MUX is
used to redirect the I/O to the RTC subsystem.
When configured as RTC GPIOs, the output pins can still retain the output level value when the chip is in
Deep-sleep mode, and the input pins can wake up the chip from Deep-sleep.
If SLP_SEL is set to 0, the pin functions remain the same in both normal execution and Light-sleep
mode.
The Hold state of each pin is controlled by the result of OR operation of the pin’s Hold enable signal and the
global Hold enable signal.
• Digital Pins (GPIO18 ~ GPIO19, GPIO21 ~ GPIO23, GPIO25 ~ GPIO27, GPIO32 ~ GPIO39)
– RTCIO_DIG_PAD_HOLD_REG[n], controls the Hold enable signal of each digital pin. See Table 6.13-1
for the bit mapping for the pins.
– Alternatively, set RTC_CNTL_DG_PAD_FORCE_HOLD to hold the values of all digital pins, or set
RTC_CNTL_DG_PAD_FORCE_UNHOLD to disable the hold function of all digital pins.
– RTC_CNTL_HOLD_FORCE_REG[n](n = 0 ~ 17), controls the Hold enable signal of each RTC pins
(GPIO0 ~ GPIO17).
– Alternatively, set RTC_CNTL_DG_PAD_FORCE_HOLD to hold the values of all RTC pins, or set
RTC_CNTL_DG_PAD_FORCE_UNHOLD to disable the hold function of all RTC pins.
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
Figure 6.8-1. ESP32 I/O Pin 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
Figure 6.8-2. ESP32 I/O Pin Power Sources (QFN 5*5, Top View)
• Pins marked blue are RTC pins that have their individual analog function and can also act as normal
digital IO pins. For details, please see Section 6.11.
• Pins 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 pin 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.
• GPIO_FUNCn_OEN_SEL = 0: use the output enable signal from peripheral, for example SPIQ_oe in the column “Output Enable of Output Signals” of Table
6.9-1. Note that the signals such as SPIQ_oe can be 1 (1’d1) or 0 (1’d0), depending on the configuration of corresponding peripherals. If it’s 1’d1 in column
Submit Documentation Feedback
“Output Enable of Output Signals”, it indicates that once GPIO_FUNCn_OEN_SEL is cleared, the output signal is always enabled by default.
Note:
Signals are numbered consecutively, but not all signals are valid.
123
• Only the signals with a name assigned in the column “Input signal” in Table 6.9-1 are valid input signals.
• Only the signals with a name assigned in the column “Output signal” in Table 6.9-1 are valid output signals.
GoBack
4 SPIWP_in 0 yes SPIWP_out SPIWP_oe
5 SPICS0_in 0 yes SPICS0_out SPICS0_oe
Espressif Systems
GoBack
34 pwm0_f0_in 0 no pwm0_out1a 1’d1
35 pwm0_f1_in 0 no pwm0_out1b 1’d1
Espressif Systems
44 pcnt_sig_ch1_in1 0 no — 1’d1
45 pcnt_ctrl_ch0_in1 0 no — 1’d1
46 pcnt_ctrl_ch1_in1 0 no — 1’d1
47 pcnt_sig_ch0_in2 0 no — 1’d1
125
48 pcnt_sig_ch1_in2 0 no — 1’d1
49 pcnt_ctrl_ch0_in2 0 no — 1’d1
50 pcnt_ctrl_ch1_in2 0 no — 1’d1
51 pcnt_sig_ch0_in3 0 no — 1’d1
52 pcnt_sig_ch1_in3 0 no — 1’d1
53 pcnt_ctrl_ch0_in3 0 no — 1’d1
54 pcnt_ctrl_ch1_in3 0 no — 1’d1
55 pcnt_sig_ch0_in4 0 no — 1’d1
ESP32 TRM (Version 5.5)
56 pcnt_sig_ch1_in4 0 no — 1’d1
57 pcnt_ctrl_ch0_in4 0 no — 1’d1
58 pcnt_ctrl_ch1_in4 0 no — 1’d1
61 HSPICS1_in 0 no HSPICS1_out HSPICS1_oe
62 HSPICS2_in 0 no HSPICS2_out HSPICS2_oe
GoBack
63 VSPICLK_in 0 yes VSPICLK_out_mux VSPICLK_oe
64 VSPIQ_in 0 yes VSPIQ_out VSPIQ_oe
Espressif Systems
GoBack
89 rmt_sig_in6 0 no rmt_sig_out2 1’d1
90 rmt_sig_in7 0 no rmt_sig_out3 1’d1
Espressif Systems
91 — — — rmt_sig_out4 1’d1
92 — — — rmt_sig_out6 1’d1
94 twai_rx 1 no rmt_sig_out7 1’d1
95 I2CEXT1_SCL_in 1 no I2CEXT1_SCL_out 1’d1
96 I2CEXT1_SDA_in 1 no I2CEXT1_SDA_out 1’d1
97 host_card_detect_n_1 0 no host_ccmd_od_pullup_en_n 1’d1
98 host_card_detect_n_2 0 no host_rst_n_1 1’d1
Submit Documentation Feedback
GoBack
116 pwm2_fltb 1 no pwm2_out2h 1’d1
117 pwm2_cap1_in 0 no pwm2_out2l 1’d1
Espressif Systems
GoBack
156 — — — I2S0O_DATA_out16 1’d1
157 — — — I2S0O_DATA_out17 1’d1
Espressif Systems
GoBack
182 — — — I2S1O_DATA_out16 1’d1
183 — — — I2S1O_DATA_out17 1’d1
Espressif Systems
GoBack
208 — — — ble_audio1_irq 1’d1
209 — — — ble_audio2_irq 1’d1
Espressif Systems
GoBack
Chapter 6 IO MUX and GPIO Matrix (GPIO, IO MUX) GoBack
GPIO Pin Name Function 0 Function 1 Function 2 Function 3 Function 4 Function 5 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 - Pin can only be configured as input GPIO. These input-only pins do not feature an output driver or
internal pull-up/pull-down circuitry.
Please refer to the ESP32 Pin Lists in ESP32 Series Datasheetor more details.
Note:
For more information on the configuration of sar_i2c_xx, see Section RTC I2C Controller in Chapter 1 ULP Coprocessor
(ULP).
1. GPIO20 is only available for ESP32-PICO-V3 and ESP32-PICO-V3-02. Please refer to ESP32-PICO Series Datasheet
for more information.
6.13 Registers
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)
TA
DA
T_
)
ed
U
_O
rv
se
IO
(re
GP
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
T_
)
ed
U
_O
rv
se
IO
(re
GP
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)
TA
DA
T_
)
ed
U
_O
rv
se
IO
(re
GP
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
ed
_E
rv
se
IO
(re
GP
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
NA
ed
_E
rv
se
IO
(re
GP
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)
A
AT
_D
B LE
)
NA
ed
_E
rv
se
IO
(re
GP
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)
NG
PI
AP
)
TR
ed
_S
rv
se
IO
(re
GP
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 pin input value, 1 for high level and 0 for
low level. (RO)
N_
rv
_I
se
IO
(re
GP
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 pin input value. (RO)
NT
_I
US
AT
ST
IO_
GP
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_INT GPIO0-31 interrupt status register. Each bit can be either of the two interrupt
sources for the two CPUs. The enable bits in GPIO_PINn_INT_ENA, corresponding to the 13-16
bits in GPIO_PINn_REG should be set to 1. (R/W)
S
1T
_W
NT
I
S_
TU
TA
_S
IO
GP
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_INT_W1TS GPIO0-31 interrupt status set register. For every bit that is 1 in the value
written here, the corresponding bit in GPIO_STATUS_INT 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_INT_W1TC GPIO0-31 interrupt status clear register. For every bit that is 1 in the value
written here, the corresponding bit in GPIO_STATUS_INT will be cleared. (WO)
NT
_I
S1
TU
)
TA
ed
_S
rv
se
IO
(re
GP
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_STATUS1_INT GPIO32-39 interrupt status register. Each bit can be either of the two interrupt
sources for the two CPUs. The enable bits in GPIO_PINn_INT_ENA, corresponding to the 13-16
bits in GPIO_PINn_REG should be set to 1. (R/W)
S
1T
_W
NTI
1_
US
AT
)
ed
ST
rv
O_
se
I
(re
GP
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_STATUS1_INT_W1TS GPIO32-39 interrupt status set register. For every bit that is 1 in the value
written here, the corresponding bit in GPIO_STATUS1_INT will be set. (WO)
C
1T
_W
NT
_I
S1
TU
)
TA
ed
_S
rv
se
IO
(re
GP
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_STATUS1_INT_W1TC GPIO32-39 interrupt status clear register. For every bit that is 1 in the
value written here, the corresponding bit in GPIO_STATUS1_INT 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
NT
I
U_
CP
)
PP
ed
_A
rv
se
IO
(re
GP
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
PP
ed
_A
rv
se
IO
(re
GP
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
)
ed
_P
rv
se
IO
(re
GP
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_
N M
U_
CP
RO
)
ed
P
rv
O_
se
I
(re
GP
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
R
EN
VE
P_
PE
RI
A
EN
EU
_D
TY
T_
T_
AK
AD
IN
IN
W
_P
n_
n_
n_
(re INn
d)
GP ed)
)
ed
ed
IN
IN
IN
ve
_P
_P
_P
rv
rv
rv
O_
r
se
se
se
se
IO
IO
IO
I
(re
(re
(re
GP
GP
GP
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 IN_
_I
Cy
_F _
IO IGy
UN
)
ed
GP _S
_F
rv
se
IO
IO
GP
GP
(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 directly
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 n_O _
UT
_F C EN
IO UN _O
_O
GP _F Cn
Cn
d)
IO UN
UN
ve
GP _F
_F
r
se
IO
IO
(re
GP
GP
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
K3
K1
CL
CL
CL
L_
L_
L_
)
ed
R
CT
CT
CT
rv
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 (i.e. I2S0/1_CLK, APLL clock) and clock output pins
(i.e. CLK_OUT1 ~ 3) are possible.
Register 6.34. IO_MUX_x_REG (x: 0-19, 201 , 21-23, 25-27, 32-39) (See Table 6.12-2 for the addresses)
U
P_ PD
)
CU V
N_ PU
CU D
EL
FU RV
ed
CU P
R
E
CU L
P
M _IE
M _W
SL _W
_D
_O
M SE
_S
FU IE
FU _W
W
rv
D
N_
N_
se
CU
CU
N
(re
FU
M
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 0, 1 selects Function 1,
etc. (R/W)
FUN_DRV Select the drive strength of the pin. 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 pin. 1: input enabled; 0: input disabled. (R/W)
FUN_WPU Pull-up enable of the pin. 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)
FUN_WPD Pull-down enable of the pin. 1: internal pull-down enabled, 0: internal pull-down dis-
abled. 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_WPD is always 0. (R/W)
MCU_DRV Select the drive strength of the pin during sleep mode. A higher value corresponds with
a higher strength. (R/W)
MCU_IE Input enable of the pin during sleep mode. 1: input enabled; 0: input disabled. (R/W)
MCU_WPU Pull-up enable of the pin during sleep mode. 1: internal pull-up enabled; 0: internal
pull-up disabled. (R/W)
MCU_WPD Pull-down enable of the pin during sleep mode. 1: internal pull-down enabled; 0: internal
pull-down disabled. (R/W)
SLP_SEL Sleep mode selection of this pin. Set to 1 to put the pin in sleep mode. (R/W)
MCU_OE Output enable of the pin in sleep mode. 1: enable output; 0: disable output. (R/W)
Note:
1. GPIO20 is available only on ESP32-PICO-V3 and ESP32-PICO-V3-02.
A
AT
_D
UT
_O
IO
GP
C_
d)
RT
ve
O_
r
se
CI
(re
RT
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 GPIO0-17 output register. Bit14 is GPIO[0], bit15 is GPIO[1], etc. (R/W)
)
RT
ed
O_
rv
se
CI
(re
RT
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_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)
)
RT
ed
O_
rv
se
CI
(re
RT
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)
B LE
NA
_E
IO
GP
C_
d)
RT
ve
O_
r
se
CI
(re
RT
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 GPIO0-17 output enable. Bit14 is GPIO[0], bit15 is GPIO[1], etc. 1 means
this GPIO pin is output. (R/W)
)
RT
ed
O_
rv
se
CI
(re
RT
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)
)
RT
ed
O_
rv
se
CI
(re
RT
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)
NTI
S_
TU
TA
_S
IO
GP
C_
d)
RT
ve
O_
r
se
CI
(re
RT
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
)
RT
ed
O_
rv
se
CI
(re
RT
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_STATUS_INT_W1TS GPIO0-17 interrupt set register. For every bit that is 1 in the
value written here, the corresponding bit in RTCIO_RTC_GPIO_STATUS_INT will be set. (WO)
)
RT
ed
O_
rv
se
CI
(re
RT
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_STATUS_INT_W1TC GPIO0-17 interrupt clear register. For every bit that is 1 in the
value written here, the corresponding bit in RTCIO_RTC_GPIO_STATUS_INT will be cleared. (WO)
XT
NE
N_
_I
IO
GP
C_
d)
RT
ve
O_
r
se
CI
(re
RT
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 pin input value, 1 for high level, and 0 for low level. (RO)
LE
AB
ER
EN
IV
P_
DR
P
EU
TY
D_
T_
AK
PA
IN
W
n_
n_
n_
IN
IN
IN
_P
_P
_P
IO
IO
ed PIO
GP
GP
se C_G
C_
C_
)
)
RT
RT
(re RT
ed
ed
O_
O_
O_
rv
rv
rv
se
se
CI
CI
CI
(re
(re
RT
RT
RT
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
RTCIO_RTC_GPIO_PINn_WAKEUP_ENABLE GPIO wake-up enable. This will only wake up the ESP32
from Light-sleep. (R/W)
31 0
0 Reset
RTCIO_DIG_PAD_HOLD_REG Selects the digital pins which should be put on hold. While 0 allows
normal operation, 1 puts the pin on hold. (R/W)
Name Description
Bit[0] Set to 1 to enable the Hold function of pin U0RXD
Bit[1] Set to 1 to enable the Hold function of pin U0TXD
Bit[2] Set to 1 to enable the Hold function of pin SD_CLK
Bit[3] Set to 1 to enable the Hold function of pin
SD_DATA0
Bit[4] Set to 1 to enable the Hold function of pin
SD_DATA1
Bit[5] Set to 1 to enable the Hold function of pin
SD_DATA2
Bit[6] Set to 1 to enable the Hold function of pin
SD_DATA3
Bit[7] Set to 1 to enable the Hold function of pin
SD_CMD
Bit[8] Set to 1 to enable the Hold function of pin GPIO5
Bit[9] Set to 1 to enable the Hold function of pin GPIO16
Bit[10] Set to 1 to enable the Hold function of pin GPIO17
Bit[11] Set to 1 to enable the Hold function of pin GPIO18
Bit[12] Set to 1 to enable the Hold function of pin GPIO19
Bit[13] Set to 1 to enable the Hold function of pin
GPIO201
Bit[14] Set to 1 to enable the Hold function of pin GPIO21
Bit[15] Set to 1 to enable the Hold function of pin GPIO22
Bit[16] Set to 1 to enable the Hold function of pin GPIO23
1. GPIO20 is only available for ESP32-PICO-V3 and ESP32-PICO-V3-02. Please refer to ESP32-PICO Series Datasheet
for more information.
R_ SE4 U SEL
UX EL
EL
S E LP L
_S SE SL EL
NS SEN E3_ UX EL
E LP EL
_S E3_ P_ L
4_ P_ L
O_ SOR SEN E2_ _SE
O_ NS _S E3_ _IE
L E
SE SL SE
O_ NS _S E4_ _IE
IE
M _S
_S
S SL E
S
IE
SE 2_F _IE
UN E
_ S M S
FU I E
SO ENS 2_S _S
_S
EN FU E
M _
C SE OR EN 3_ LD
EN 1_ _S
CI SE OR EN 4_ LD
RT SE OR EN 1_M LD
NS _S SE UN_
N_
I
O_ SOR SEN E2_ UX_
C SE OR EN 2_ D
N_
N_
EN 4_ P_
X
UN
SE E3 LP
RT IO_ NS _S SE OL
P
RT IO_ NS _S SE HO
RT IO_ NS _S SE HO
O_ NS _S SE HO
FU
FU
FU
_S SE SL
S
S
F
F
C SE OR EN 1_H
O_ NS _S E2_
_
_
OR EN _
O_ NS _S E1_
OR EN 1_
4
RT IO_ NS _S SE
NS _S SE
N _ S
N _ S
S
NS
N _ S
S
S
NS
C SE OR EN
EN
RT SE OR EN
RT SE OR EN
RT SE OR EN
SE OR EN
E
RT IO_ NS _S
R_
_
C SE OR
CI E R
OR
CI SE OR
CI SE OR
OR
CI SE OR
O
O
RT IO_ NS
RT O_ NS
NS
RT O_ NS
RT IO_ NS
RT _ S
EN
EN
)
C SE
RT SE
CI SE
RT SE
CI SE
C SE
CI SE
ed
S
S
RT IO_
RT _
O_
RT O_
RT _
RT O_
rv
O
se
CI
CI
CI
CI
CI
CI
CI
CI
C
(re
RT
RT
RT
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 oper-
ation. (R/W)
RTCIO_SENSOR_SENSEn_FUN_SEL Select the RTC IO_MUX function for this pin. 0: select Func-
tion 0. (R/W)
RTCIO_SENSOR_SENSEn_SLP_SEL Selection of sleep mode for the pin: set to 1 to put the pin in
sleep mode. (R/W)
EL
AD AD 2_S SEL
UX EL
RT AD AD _SL EL
C2 LP EL
C LP EL
E
_S
_F E
_F _IE
C_ 2_M X_S
AD _S _S
_I
C_ 1_F _IE
AD _M LD
_
AD _S _S
_I
RT AD AD _H D
N_
UN
UN
C_ C2 LP
UN
O_ C_ C OL
C_ C1 P
C_ C1 O
C U
FU
CI AD AD H
RT IO_ C_ C1_
_
2
C2
C1
1
O_ C_ C
O_ C_ C
C AD AD
AD
CI AD AD
AD
CI AD AD
RT O_ C_
RT _ _
RT O_ C_
C
)
CI AD
RT AD
CI AD
RT AD
CI AD
ed
RT IO_
O_
RT O_
O_
RT O_
rv
O
se
CI
CI
CI
CI
C
(re
RT
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 pin; 0 is for normal operation.
(R/W)
RTCIO_ADC_ADCn_FUN_SEL Select the RTC function for this pin. 0: select Function 0; 3: select
Function 1. (R/W)
RTCIO_ADC_ADCn_SLP_SEL Signal selection of pin’s sleep mode. Set this bit to 1 to put the pin to
sleep. (R/W)
RTCIO_ADC_ADCn_SLP_IE Input enable of the pin in sleep mode. 1 enabled; 0 disabled. (R/W)
E
RC
FO
D_
FU EL
AC UX_ C
CI PA PD 1_S SEL
O_ D_ AC L EL
M DA
XP
AC FU E
DA IE
S
D_ AC SL E
PD 1_ P_O
CI PA PD 1_S _S
PD 1_ LD
N_
1_ N_
PA PD 1_ P_I
C_
D_ C1_ D_
C
V
E
1_ E
RT _ _ C LP
D_ AC HO
RU
DR
AC RD
DA
A XP
1_
PA D _
1_
O_ _PD C1_
1_
1
AC
O_ D_ AC
AC
RT O_ D_ AC
D A
A
PD
CI PA PD
PD
RT PA PD
PD
CI PA PD
P
D_
RT _ _
D_
O_ D_
RT O_ D_
D
)
RT PA
CI PA
PA
CI PA
RT PA
CI PA
ed
O_
RT IO_
O_
RT O_
RT O_
rv
O
se
CI
CI
CI
CI
CI
C
(re
RT
RT
RT
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 pin; set to 0 for normal operation.
(R/W)
RTCIO_PAD_PDAC1_SLP_SEL Sleep mode selection signal of the pin. Set this bit to 1 to put the pin
to sleep. (R/W)
RTCIO_PAD_PDAC1_SLP_IE Input enable of the pin in sleep mode. 1: enabled; 0: disabled. (R/W)
E
RC
FO
D_
UN L
DA MU DAC
RT IO_ D_ AC SLP L
PA PD 2_ P_ L
_F SE
XP
AC FU OE
O_ D_ AC SL E
DA IE
_S
D_ AC SL IE
CI PA PD 2_ _S
C2 X_
PD 2_ LD
2_ N_
C_
D_ C2_ PD_
PD 2_ P_
C
O_ D_ AC RV
E
2_ E
D_ AC HO
RU
AC RD
DA
D
A X
2_
PA D _
2_
O_ _PD C2_
C PA PD 2_
2
AC
AC
RT _ _ C
D A
A
PD
CI PA PD
PD
RT PA PD
CI A D
P
P
D_
RT _ _
D_
O_ D_
RT O_ D_
D
)
RT PA
CI PA
PA
CI PA
RT PA
CI PA
ed
P
O_
RT IO_
O_
RT O_
RT _
rv
O
se
CI
CI
CI
CI
CI
C
(re
RT
RT
RT
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 pin; 0 is for normal operation.
(R/W)
RTCIO_PAD_PDAC2_FUN_SEL Select the RTC function for this pin. 0: select Function 0. (R/W)
RTCIO_PAD_PDAC2_SLP_SEL Sleep mode selection signal of the pin. Set this bit to 1 to put the
pin to sleep. (R/W)
RTCIO_PAD_PDAC2_SLP_IE Input enable of the pin in sleep mode. 1: enabled; 0: disabled. (R/W)
K
K
2N X_S L
32
CI XT X3 _S SEL
CI XT X3 FUN L
O_ AL 2 LP L
32
2K
2P U 2K
L_ 2N LP EL
U SE
L_ 2P LP_ L
E
E
X3 FUN E
E
DR UN E
RT XTA X3 _S SE
_X E
L_
X3 _S _IE
_S
_ _O
X3 _S IE
_3
L_
RT XTA _X3 _S _S
_I
X3 M 3
_M X_
_F _O
_I
X3 _R D
_
X3 _R D
TA
L_ 2N OL
CI XT X3 DRV
X3 RUE
2N DE
N P
2N LP
UN
L_ 2P OL
RV
UE
TA
2P DE
CI XT XP TAL
L_ 2N L
2P LP
O_ AL 2 L
A
_X
RT XTA _X3 _H
RT XTA _X3 XT
_D
RT XTA X3 _H
_R
CI XT X3 _S
_F
_
_
X
AS
C_
ES
_
2N
RT _ L_ N
2P
2P
RT O_ L_ 2P
P
O_ AL D
O_ AL 2
O_ AL 2
ed DBI
DA
X3
CI XT X3
X3
CI XT X3
L_
RT _ L_
L_
RT O_ AL_
L_
RT O_ L_
L_
RT O_ L_
L_
RT IO_ AL_
L_
L_
RT XTA
RT XTA
RT XTA
RT XTA
A
A
RT XTA
(re XTA
)
CI XT
CI XT
CI XT
CI XT
C T
XT
X
O_
RT IO_
O_
RT _
O_
RT _
O_
RT _
O_
RT O_
O_
O_
rv
O
se
CI
CI
CI
CI
CI
CI
CI
CI
CI
CI
CI
C
RT
RT
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 pin; 0 is for normal operation.
(R/W)
RTCIO_XTAL_X32P_HOLD Set to 1 to hold the output value on the pin, 0 is for normal operation.
(R/W)
RTCIO_XTAL_X32N_MUX_SEL 0: route X32N pin to the digital IO_MUX; 1: route to RTC block. (R/W)
RTCIO_XTAL_X32P_MUX_SEL 0: route X32P pin 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 pin to sleep. (R/W)
RTCIO_XTAL_X32N_SLP_IE Input enable of the pin 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 pin to sleep. (R/W)
RTCIO_XTAL_X32P_SLP_IE Input enable of the pin in sleep mode. 1: enabled; 0: disabled. (R/W)
GE
FH
UR
AN
EF
UC PD_
DC
DR
DR
X
O_ CH_
H_
H
CH
CH
UC
RT TOU
)
TO
TO
TO
TO
ed
O_
O_
O_
O_
rv
se
CI
CI
CI
CI
CI
(re
RT
RT
RT
RT
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 avail-
able. (R/W)
UN L
RT O_T UC PA _SL EL
TO H D LP EL
_F SE
IO
AD _XP OPT
Dn UN E
O_ E
_S
GP
PA _F _O
P _T T
O_ UC PA _S S
_T _I
Dn X_
n_ D
RT TOU H_ Dn TAR
CI O H_ Dn P_
PA HOL
AC
UE
Dn DE
n_ D
H_ Dn LP
PA MU
DR
_D
PA _R
_R
O_ UC PA _S
_
Dn
Dn
CI O H_ Dn
CI O H_ Dn
D
ed H D
RT TOU PA
rv C PA
PA
RT O_T UC PA
RT O_T C PA
P
O_ CH_
RT IO_T H_
se OU H_
_
H_
CI O H_
RT O_T H_
CI O H_
C
(re _T C
UC
RT O_T C
RT O_T UC
RT TOU
OU
U
)
d)
CI O
TO
CI O
CI O
ve
RT IO_T
T
O_
O_
O
r
se
CI
CI
CI
CI
CI
C
(re
RT
RT
RT
RT
31 30 29 28 27 26 25 23 22 21 20 19 18 17 16 15 14 13 12 11 0
0 1 0 1 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 0 0 Reset
RTCIO_TOUCH_PADn_DRV Selects the drive strength of the pin. A higher value corresponds with a
higher strength. For detailed drive strength, please see ESP32 Datasheet > Appendix A.1 Notes
on ESP32 Pin Lists > Note 8. (R/W)
RTCIO_TOUCH_PADn_DAC Touch sensor slope control. 3-bit for each touch pin. Default is b’100.
(R/W)
RTCIO_TOUCH_PADn_SLP_SEL Sleep mode selection signal of the pin. Set this bit to 1 to put the
pin to sleep. (R/W)
RTCIO_TOUCH_PADn_FUN_IE Input enable of the pin in normal working mode (SLP_SEL = 0).
1: Enabled
0: Disabled
(R/W)
IO
Dm XP PT
GP
UC _PA m_ ART
PA _ _O
AC
_T D
O_
H_ Dm TIE
TO H D ST
_D
O_ UC PA _
Dm
CI O H_ Dm
PA
RT _T C A P
H_
CI O H_
UC
RT O_T UC
U
d)
d)
TO
CI O
ve
ve
RT O_T
O_
O
r
r
se
se
CI
CI
(re
(re
RT
RT
31 26 25 23 22 21 20 19 16 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 0 0 Reset
RTCIO_TOUCH_PADm_DAC Touch sensor slope control. 3-bit for each touch pin. Default b’100.
(R/W)
)
ed
E
O_
rv
se
CI
(re
RT
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 pin source to wake up the chip when the latter is in
deep/light sleep mode. 0: select GPIO0; 1: select GPIO2, etc. (R/W)
S EL
R_
CT
T_
_EX
TL
d)
X
ve
O_
r
se
CI
(re
RT
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)
L
SE
SE
A_
L_
SC
SD
C_
C_
I2
I2
R_
R_
)
SA
SA
ed
O_
O_
rv
se
CI
CI
(re
RT
RT
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 pin as the RTC I2C SDA signal. 0: pin TOUCH_PAD[1];
1: pin TOUCH_PAD[3]. Default value is 0. (R/W)
RTCIO_SAR_I2C_SCL_SEL Selects the other pin as the RTC I2C SCL signal. 0: pin TOUCH_PAD[0];
1: pin TOUCH_PAD[2]. Default value is 0. (R/W)
Chapter 7
7.1.1 Introduction
The ESP32 has three reset levels: CPU reset, Core reset, and System reset. None of these reset levels clear
the RAM. Figure 7.1-1 shows the subsystems included in each reset level.
• 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.
7.2.1 Introduction
The ESP32 integrates multiple clock sources for the CPU cores, the peripherals and the RTC. These clocks
can be configured to meet different requirements. Figure 7.2-1 shows the system clock structure.
– 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.
– RC_FAST_CLK is an internal clock with a default frequency of 8 MHz. This frequency is adjustable.
– RC_FAST_DIV_CLK is divided from RC_FAST_CLK. Its frequency is (RC_FAST_CLK / 256). With the
default RC_FAST_CLK frequency of 8 MHz, this clock runs at 31.250 KHz.
– RC_SLOW_CLK is an internal low power clock with a default frequency of 150 KHz. This frequency is
adjustable.
• 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,
RC_FAST_CLK, and XTL_CLK can be set as the CPU_CLK source; see Table 7.2-1 and 7.2-2.
RMT Y Y N N N
LED PWM Y Y Y N N
PWM Y N N N Y
I2C Y N N N N
SPI Y N N N N
PCNT Y N N N N
eFuse Controller Y N N N N
SDIO Slave Y N N N N
SDMMC Y N N N N
7.2.4.1 APB_CLK
The APB_CLK frequency is determined by CPU_CLK source, as detailed in Table 7.2-4.
7.2.4.2 REF_TICK
REF_TICK is derived from APB_CLK. The APB_CLK frequency is determined by CPU_CLK source. The
REF_TICK frequency should be fixed. When CPU_CLK source changes, users need to make sure the REF_TICK
frequency remains unchanged by setting a correct divider value.
For example, when CPU_CLK source is PLL_CLK and users need to keep the REF_TICK frequency at 1 MHz,
then they should set SYSCON_PLL_TICK_NUM to 79 (0x4F) so that the REF_TICK frequency = 80 MHz /
(79+1) = 1 MHz.
The LED PWM module can use RC_FAST_CLK as a clock source when APB_CLK is disabled. In other words,
when the system is in low-power consumption mode (see Chapter 9 Low-Power Management (RTC_CNTL)),
normal peripherals will be halted (APB_CLK is turned off), but the LED PWM can work normally via
RC_FAST_CLK.
RTC_SLOW_CLK is used to clock the Power Management module. It can be sourced from RC_SLOW_CLK,
XTL32K_CLK or RC_FAST_DIV_CLK.
RTC_FAST_CLK is used to clock the On-chip Sensor module. It can be sourced from a divided XTL_CLK or
from RC_FAST_CLK.
carry jitter and, therefore, they do not support a high-precision clock frequency setting.
Providing an integrated precision clock source can minimize system cost. To this end, ESP32 integrates an
audio PLL.
• The operating frequency range of the numerator is 350 MHz ~ 500 MHz
sdm1 sdm0
350M Hz < fxtal (sdm2 + + + 4) < 500M Hz
28 216
Please note that sdm1 and sdm0 are not available on revision0 of ESP32. Please consult the silicon revision in
ESP32 Series SoC Errata 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.
7.4 Registers
The addresses in this section are relative to the SYSCON base address provided in Table 3.3-6 Peripheral
Address Mapping in Chapter 3 System and Memory.
T
CN
V_
DI
RE_
_P
d)
ve
ON
r
SC
se
(re
SY
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 0x0 Reset
SYSCON_PRE_DIV_CNT Configures the divider value of CPU_CLK when the source of CPU_CLK
is XTL_CLK or RC_FAST_CLK. The value range is 0x0 ~ 0x3FF. CPU_CLK = XTL_CLK ( or
RC_FAST_CLK) / (the value of this field +1). (R/W)
U M
_N
I CK
_T
L
TA
_X
)
ed
ON
rv
SC
se
(re
SY
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 39 Reset
SYSCON_XTAL_TICK_NUM Configures the divider value of REF_TICK when the source of APB_CLK
is XTL_CLK. The value range is 0x0 ~ 0xFF. REF_TICK = APB_CLK /(the value of this field + 1).
(R/W)
ON
rv
SC
se
(re
SY
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 79 Reset
SYSCON_PLL_TICK_NUM Configures the divider value of REF_TICK when the source of APB_CLK
is PLL_CLK. The value range is 0x0 ~ 0xFF. REF_TICK = APB_CLK /(the value of this field + 1).
(R/W)
M
NU
K_
IC
_T
M
K8
_C
)
ed
ON
rv
SC
se
(re
SY
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 11 Reset
SYSCON_CK8M_TICK_NUM Configures the divider value of REF_TICK when the source of APB_CLK
is FOSC_CLK. The value range is 0x0 ~ 0xFF. REF_TICK = APB_CLK /(the value of this field + 1).
(R/W)
UM
_N
I CK
_T
L
PL
_A
)
ed
ON
rv
SC
se
(re
SY
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 99 Reset
SYSCON_APLL_TICK_NUM Configures the divider value of REF_TICK when the source of APB_CLK
is APLL_CLK. The value range is 0x0 ~ 0xFF. REF_TICK = APB_CLK /(the value of this field + 1).
(R/W)
31 0
0x16042000 Reset
SYSCON_DATE Chip revision register. For more information see ESP32 Series SoC Errata. (R/W)
Chapter 8
8.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.
8.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 interrupt sources.
PeripheralInterruptConfigStatusSource.tex
GoBack
DPORT_PRO_I2C_EXT1_INTR_MAP_REG 18 50 I2C_EXT1_INTR 50 18 DPORT_APP_I2C_EXT1_INTR_MAP_REG
DPORT_PRO_RSA_INTR_MAP_REG 19 51 RSA_INTR 51 19 DPORT_APP_RSA_INTR_MAP_REG
DPORT_PRO_SPI1_DMA_INT_MAP_REG 20 52 SPI1_DMA_INT 52 20 DPORT_APP_SPI1_DMA_INT_MAP_REG
Espressif Systems
PRO_CPU APP_CPU
GoBack
Chapter 8 Interrupt Matrix (INTERRUPT) GoBack
• 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 8.3-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.
8.4 Registers
The interrupt matrix registers are part of the DPORT registers and are described in Section 12.4 in Chapter 12
DPort Registers.
Chapter 9
9.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.
9.2 Features
• Five predefined power modes to support various applications
• Up to 16 KB of retention memory
9.3.1 Overview
The low-power management unit includes voltage regulators, a power controller, power switch cells, power
domain isolation cells, etc. Figure 9.2-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
controller, 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 RC_FAST_DIV_CLK (derived from the internal 8-MHz oscillator divided by 256).
Selection Signal
RTC Timer
RC_SLOW_CLK
0
XTL32K_CLK
RTC_SLOW_CLK
1 RTC Main State
RC_FAST_DIV_CLK
2
PMU
RTC Slow Clock
ULP Coprocessor
Selection Signal
XTAL_DIV_CLK
Sensor Controller
0
RTC_FAST_CLK
RC_FAST_CLK ESP32
1 RTC Memory
RTC Clock
For the digital core, LOW_POWERE_CLK is switched among four sources. For details, please see Figure
9.3-7.
Selection Signals
RC_SLOW_CLK
RTC_SLOW_CLK
LP_MUX
LOW_POWER_CLK
Wireless
RC_FAST_CLK
XTL_CLK
Low-power Clock
The switch among power-gating states can be see in Figure 9.3-8. 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 9.3-1 shows how
the power domains in ESP32 are controlled.
5. When the power-domain digital core is powered down, all included in power domains are powered
down.
6. The power-domain Wi-Fi includes the Wi-Fi MAC and BB.
7. Each internal SRAM can be power-gated independently.
• 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, ESP32 first enters the Modem-sleep mode after a system reset and can be configured to Active
mode when transmitting or receiving packets. After the CPU stalls for a while, the chip can enter several
low-power modes. 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 9.3-9.
Please note that the predefined power mode could be further optimized and adapted to any application.
All the wakeup sources specified in Table 9.3-2 (except UART) can also be configured as the causes to reject
sleep.
Users can configure the reject to sleep option via the following registers.
• Configure the RTC_CNTL_SLP_REJECT field to enable or disable the option to reject to sleep:
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.
9.5 Registers
The addresses in parenthesis besides register names are the register addresses relative to the Low-power
Management (RTC) base address provided in Table 3.3-6 Peripheral Address Mapping in Chapter 3 System
and Memory. The absolute register addresses are listed in Section 9.4 Register Summary.
RS T
E_ RS
C0
RT _CN L_B S_I RE_ ORC _PU
RT CN _B S_I _F OLW _PD
RT NTL W_ C_ RC CE_ U
CN SW RO RC PU D
RT _CN L_X _F EEP SLE EEP
_C
RT _CN L_B S_I _F CE 8M
RC NO
C _S I2 FO R _P
_ P FO E_ P
RT _CN L_B S_F _F CE U
RT CN _B S_F RCE W_ D
U_
C T IA O _ 8M
C T TL OR _F EP
PU
C T B OR _P W_
C T IA 2C OR _P
C_ TL IA O OL _P
PC U_ PD
C T TL L _ SL
C T IA O F E
C_ TL IA 2C F E
C T IA 2C OR _
C_ TL B_ C_ FO E
FO E_
C T B _I CE U
C T B _I F D
CP
RT _CN L_B S_C RE_ ORC
ST U_R T
ST
RT _CN L_B PLL OR _P
RT _CN L_B PLL 2C_ _P
OC
RT _CN L_B _F CE OL
RT _CN L_X S_S RCE NO
TL _AP CP E_
P RS
P_ RC
RT CN _B LL OR D
PP
C T B _F CE
C_ TL BP _F _P
R
C T IA O F
RA O
G_ RA T
_P
_A
RT _CN L_B S_C RE_
W P_F
_D W RS
LL
LL
TL G_ S_
C T IA O
TA
RT _CN L_B S_C
CN _D SY
_S
C_ TL W_
_
C T IA
W
RT _CN L_B
RT _CN L_S
_S
_S
TL
)
ed
C T
C T
RT _CN
RT _CN
CN
rv
se
C_
C_
C
C
(re
RT
RT
RT
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
HI
M
L_
TI
VA
N_
P_
AI
SL
M
L_
L_
)
ed
NT
NT
rv
C
se
C_
C_
(re
RT
RT
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 _T
C_ TL
d)
ve
RT _CN
r
se
C
(re
RT
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
31 0
0x000000000 Reset
HI
E_
M
TI
L_
)
ed
NT
rv
C
se
C_
(re
RT
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
IM _E
_E
_T ER
ND
LP IM
_I
_S P_T
AC P
VE
DI AK T
O_ EU
_S _W EC
CH SL
TI
CN _S _R N
OU P_
C_ TL LP _E
TL LP EJ
_T _C
RT _CN L_S EP
TL LP
C T LE
CN _U
RT _CN L_S
C_ TL
)
d)
ed
C T
ve
RT _CN
RT N
rv
r
se
C_
se
C
(re
(re
RT
RT
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
N
_E
LL
A
ST
U_
CP
L_
)
ed
NT
rv
C
se
C_
(re
31 1
RT
0
0 0 0 0 0 0 0 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
F
RT
F
_O
TA
_S
8M
H
CK
UC
E_
TO
M
P_
I
_T
PC
IN
UL
M
L_
L_
)
ed
NT
NT
rv
C
se
C_
C_
(re
RT
RT
31 24 23 15 14 0
L
VA
P_
L
_S
IN
M
L_
)
)
ed
ed
T
CN
rv
rv
se
se
C_
(re
(re
RT
31 16 15 8 7 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 2C _P
FO E_
E_
_P
ON U
U
EN PU
RT rve _P F_I US
A _ RC
_P
2C
C_ d) KG C_
se TL XR PB
LL FO
_I
RT rve L_C _I2
(re CN _T _
_P A _
X
C_ TL FR
se T LL
TL LL
(re _CN L_P
CN _P
RT _CN L_R
C_ TL
RT _CN )
d)
C T
C T
ve
RT _CN
RT CN
r
se
C
(re
RT
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
CP
CP
_V TO
RO
PP
AT C
ST _VE
_P
_A
U_ AT
SE
SE
CP _ST
AU
AU
_C
_C
PP PU
ET
ET
_A C
TL RO
ES
ES
CN _P
_R
_R
C_ TL
TL
TL
)
ed
RT _CN
CN
CN
rv
se
C_
C_
C
(re
RT
RT
RT
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
ER
ILT
F
E
P_
US
NA
EU
CA
E
AK
P_
P_
_W
EU
EU
IO
AK
AK
GP
W
L_
L_
L_
)
ed
NT
T
CN
CN
rv
C
se
C_
C_
C_
(re
RT
RT
RT
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
RT _CN L_T _C NT_ INT NA
IN NA
EN
A
EU INT A
C T IM P_ E _E
TL LP IDL A EN
C T LP _I T_ _E
P_ _E
AK T_ EN
T_
RT _CN L_U CH OU INT
_W EC T_
C_ TL DI T_ IN
C T D AL _E
C T OU N_ _
LP EJ IN
RT _CN L_T W ER
_S _R E_
C T RO TIM
RT _CN L_B IN_
C T A
RT _CN L_M
)
ed
C T
RT _CN
rv
se
C
(re
RT
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
RT _CN L_T _C NT_ INT AW
IN AW
W
RA
AK T_ RAW
C T IM P_ R _R
C T LP _I T_ _R
TL LP IDL W RA
P_ _R
T_
RT _CN L_S T_IN ID_ AW
RT _CN L_U CH OU INT
CN _S O_ RA T_
EU INT
_W EC T_
C_ TL DI T_ IN
C T D AL _R
C T OU N_ _
LP EJ IN
RT _CN L_T W ER
_S _R E_
C T RO TIM
RT _CN L_B IN_
C T A
RT _CN L_M
d)
C T
ve
RT _CN
r
se
C
(re
RT
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 interrupt.
(RO)
RTC_CNTL_ULP_CP_INT_RAW The raw interrupt status bit for the RTC_CNTL_ULP_CP_INT interrupt.
(RO)
RTC_CNTL_WDT_INT_RAW The raw interrupt status bit for the RTC_CNTL_WDT_INT interrupt. (RO)
ST
RT _CN L_T _IN NT_ INT T
IN T
C T IM T_ S _S
C T AR _I T_ _S
ST
P_ _S
AK T_ ST
T_
RT _CN L_S CH OU INT
CN _S O_ ST T_
EU INT
_W EC T_
RT _CN L_W E_V ST T
C_ TL DI T_ IN
C T OU N_ _
LP J N
RT CN _S _IN ID_
RT _CN L_T W ER
I
_S _R E_
C T RO TIM
C_ TL D AL
TL LP IDL
E
RT _CN L_B IN_
T
C T A
RT _CN L_M
d)
C T
ve
RT _CN
r
se
C
(re
RT
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
RT _CN L_T _IN NT_ INT LR
IN LR
CL
TL LP IDL R CLR
AK T_ CLR
C T IM T_ C _C
C T AR _I T_ _C
P_ _C
T_
RT _CN L_S CH OU INT
CN _S O_ CL T_
EU INT
_W EC T_
C_ TL DI T_ IN
C T OU N_ _
LP EJ IN
C T D AL R
RT _CN L_S T_IN ID_
RT _CN L_T W ER
_S _R E_
C T RO TIM
RT _CN L_B IN_
C T A
RT _CN L_M
)
ed
C T
RT _CN
rv
se
C
(re
RT
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
P
EU
L
DE
AK
I
N_
W
R_
I
E_
FO
AT
Y_
ST
RD
N_
C_
AI
RT
M
L_
L_
)
d)
d)
ed
NT
T
ve
ve
CN
rv
r
se
se
se
C_
C_
(re
(re
(re
RT
RT
31 28 27 26 20 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
– in sleep modes.
(RO)
)
ed
RT _CN
rv
se
C
(re
RT
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)
V
P0 V
_L
EU _L
AK P1
_W EU
XT AK
_E _W
T L XT
CN _E
C_ TL
d)
ve
RT _CN
r
se
C
(re
RT
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
_E
SE
TL DI SL REJ
AU
CN _S HT_ P_
_C
C_ TL IG SL
CT
RT CN _L P_
JE
C_ TL EE
RE
RT CN _D
L_
C_ TL
)
ed
NT
RT CN
rv
C
se
C_
C_
(re
RT
RT
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
NF EL
CO _S
L_ IOD
R
PU UPE
P
SE
_C
CN RTC
_C
_
RT NTL
TL
d)
ve
C
r
C_
se
C_
(re
RT
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
_ M EN EN
_S SEL
CE U
D
AS C_S
_ _ 3 25
OR _P
_P
_
M IV
C _E _X 8M N
L
C_ TL C_C CLK
RT NTL NB TAL _D
EL
C_ TL IG LK _E
_C CK8 _D
SE
_F CE
EQ
T
TC K_R
RT _CN L_D _C 8M
IV_
M R
FR
_
V
T
K8 _FO
LK
DI
_D
_D
C T IG LK
L
_
RT NTL A_C
_F
RT CN _D _C
_C M
8M
M
TL K8
K8
K8
C_ TL IG
N
CK
RT CN _D
CN _C
_C
_A
_R
_S
L_
RT NTL
RT NTL
TL
C_ TL
TL
)
C_ d)
)
ed
ed
NT
RT rve
RT CN
CN
RT CN
rv
rv
C
C
se
C_
C_
se
se
C_
C_
C_
C_
C_
(re
(re
(re
RT
RT
RT
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 XTL32K_CLK for digital core (no relation to RTC core). (R/W)
RTC_CNTL_CK8M_DIV RC_FAST_DIV_CLK divider. 00: div128, 01: div256, 10: div512, 11: div1024.
(R/W)
EN
D_
_S EG
_S O_ H Y
TL DI TIE AD
_P
R
O
O
VR E
O
RE O_V
DI
O_ RC
CN _S _ E
DI
DI
EG
R
_S
_S
C_ TL DI 8_
DI FO
_D SDI
FM
FH
C_ TL EFL
RT _CN L_S 1P
_
O
RE
C T EG
CN XPD
R
_D
C_ L_D
RT CN _R
_
RT NTL
TL
TL
)
ed
T
CN
CN
RT N
rv
C
C
C_
se
C_
C_
C_
(re
RT
RT
RT
RT
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
PL
RC PU
PD
_S
S_
_D O RC PU
FO E_
E_
OS FO PD
AS
IA
T_ RC
TL BO FO E_
BO ST_ E_
BI
B
_D
_D
CN _D G_ RC
LP
AP
A
EG
EG
C_ TL RE FO
_S
DC
S_
VR
VR
RT _CN L_P G_
AS
K_
G_
G_
A
C T RE
BI
BI
SC
DI
DI
_D
_D
RT _CN L_P
L_
L_
L_
TL
TL
d)
C T
NT
NT
ve
RT _CN
CN
CN
CN
C
r
se
C_
C_
C_
C_
C_
C
(re
RT
RT
RT
RT
RT
RT
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)
CE SO O
SO
OR _I IS
C T AS EM FO E_ U
C T AS EM O _C D
EM FO CE_ O
RT _CN L_F CE _F RCE LPU
RT _CN L_S CE OI LW_ LPD
_F RCE NO
RT CN _F TM _P RC PU
OI
RT _CN L_F TM M_ RC LP
RT _CN L_F TM _F LW LP
RT CN _S WM M_ RCE PU
PU
RT _CN L_F WM M_ RC PD
TM _ R IS
_N
C_ TL AS EM FO E_
C T AS EM D E_
C T AS E FO E_
AS EM FO E_
C_ TL LO E O _
C T LO E FO _
C T OR EM O _
C T OR _N O _
C T LO _I SO C
C T AS E FO N
_F TM M_ RC
RT _CN L_F WM M_ _E
C T LO E PD
TL AS ME FO
C T LO EM O
RT _CN L_S WM M_
CN _F W M_
RT _CN L_S WM SO
RT CN _S CE U
RT _CN L_S WM D
C_ TL OR _P
C T LO _P
C T LO E
C_ TL LO E
RT _CN L_F EN
RT _CN L_F CE
C T D_
C T OR
RT _CN L_P
)
ed
C T
RT _CN
rv
se
C
(re
RT
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 T NT R 1_ RC PU
TL SL _F CE RC PU
C T NT R 1_ C PD
SL ME CE U PD
C T NT R 2_ RC PU
C T NT R 3_ RC PU
C T NT R 2_ RC PD
C T NT R 3_ RC PD
C T O R 0_ C U
C_ TL OM _F 0_ RC D
CE U
D
RT _CN L_R ER_ AM FOR E_P
RT _CN L_R M0 AM FO E_P
RT _CN L_I ER_ AM FO E_
RT _CN L_I ER_ AM FOR E_
CN _L 0 OR FO E_
_L P_ OR _P E_
RT _CN L_I ER_ AM FO E_
RT _CN L_I ER_ AM FO E_
RT _CN L_I ER_ AM FO E_
RT _CN L_I ER_ AM FO E_
OR _P
_P
RT _CN L_I I_F CE RCE U
RT _CN L_I ER_ CE U D
0_ M D_ N
N
_R ER AM PD N
CN _I ER AM PD N
PD 0_ EN
C T IF OR O _P
C T NT OR _P _P
C T NT R 4_ RC
OM _R 1_ _E
N _E
TL NT _R 2_ _E
C_ TL NT R 3_ _E
_F RCE
M _F D
RT _CN L_I ER_ EN _EN
RT CN _W I_F P_F CE
_E PD
RT _CN L_I ER_ AM PD
P_ M _P
RT _CN L_I ER_ AM D
A P
EM O
C_ TL IF A OR
C T NT R _P
C T NT R 4_
C T NT R 4_
C T NT D_ D
RT CN _I I_P P_P
C T G A
RT _CN L_W _WR
C T G
RT CN _D
RT N _D
C_ TL
C_ TL
)
)
ed
ed
RT _CN
RT CN
rv
rv
C
se
se
C_
C
(re
(re
RT
RT
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
D
OH N
OL
UT _E
_ A LD
AD O
_P OH
LD DG UT
RT _CN L_I ER_ AM FOR E_ ISO
HO L _ _ A
TL LR TC RC IS LD
C T NT R 1_ C ISO
C T G D_ CE OI ISO
C T NT R 2_ RC ISO
C T NT R 3_ RC ISO
C T NT R 1_ RC NO
C T G _F CE RC NO
C T NT R 2_ RC NO
C T NT R 3_ RC NO
C_ TL NT OR _N _I SO
C T O _F 0_ RC SO
TO NT AD
C T O R 0_ C O
D_ TC DG O
RT _CN L_R ER_ AM FOR E_N
CN _C _R FO E_ HO
RT _CN L_R _PA FO E_ LD
AU _C _P
RT _CN L_I I_F CE RCE OI
RT _CN L_D M0 OR FO E_
RT _CN L_I ER_ AM FO E_
RT _CN L_I ER_ AM FO E_
PA _R L_ IS
RT CN _I ER_ CE OI SO
_D _R _C E_ O
G_ EG NT NO
C T G D_ RC HO
C T IF OR O _N
C_ TL EG D_ RC UN
C T NT R 4_ RC
C T NT R _I SO
C T G D_ RC O
RT _CN L_W I_F P_F RCE
)
ed
C T
RT _CN
rv
se
C
(re
RT
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
H
TH
_I ES EN
P N
GT
AU U ES D_
SL _E
NG
EN
_P CP R O
N_ ET
DT PP U_ M
LE
_L
_
T_
_W _A CP OT
ET
SE
ES
TL DT RO BO
RE
_R
CN _W T_P SH
0
_
1
PU
TG
TG
TG
TG
YS
C_ TL D LA
N
_C
_S
_S
_S
_S
_S
_E
RT CN _W _F
DT
DT
DT
DT
DT
DT
DT
T
C_ TL D
W
_W
_W
_W
_W
_W
_W
RT CN _W
L_
TL
TL
TL
TL
TL
TL
C_ TL
NT
se d
ed
ed
CN
CN
CN
CN
CN
CN
RT _CN
re rve
C
rv
rv
C_
C_
C_
C_
C_
C_
C_
se
se
C
RT
RT
RT
RT
RT
RT
RT
RT
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
NT
rv
C
se
C_
(re
RT
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
SW
SW
L_
L_
d)
NT
NT
ve
C
r
se
C_
C_
(re
RT
31 26 25
RT 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
RT CN _T CH AD HO _F CE
RT _CN L_S SE HO HO _F CE
RT _CN L_P SE HO _F CE CE
RT _CN L_T CH AD HO _F CE
RT _CN L_S SE AD HO _F CE
RT _CN L_S CH AD HO _F CE
RT _CN L_S SE HO _F _F CE
RT _CN L_T CH AD HO _F CE
C_ TL OU _P 4_ LD OR
C T EN 4_ 0_ LD OR
C T EN 2_ LD OR OR
C T OU _P 3_ LD OR
C T EN _P 1_ LD OR
C T OU _P 2_ LD OR
C T EN 3_ LD LD OR
C T OU _P 5_ LD R
RT _CN L_T CH AD HO _FO
CN _A C1 O _F CE
RT _CN L_P C2 HO _F CE
_A 2_ OL FO CE
1_ OLD FO E
LD FO E
OR E
DC H D_ RC
C T OU _P _F CE
C_ TL DA _H LD OR
C T DA 1_ LD OR
CE
H O _ RC
C T OU _P 7_ CE
C T OU _P 6_ LD
TL DC _H LD_ OR
_F RC
RT CN _T CH LD OR
RT _CN L_T CH AD OR
RT _CN L_T CH AD HO
C_ TL OU HO _F
RT _CN L_T P_ LD
C T 32 HO
RT _CN L_X N_
C T 32
RT CN _X
C_ TL
d)
ve
RT _CN
r
se
C
(re
RT
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
LR
C
S_
TU
L
TA
E
_S
_S
P1
P1
EU
EU
AK
AK
W
W
T_
T_
EX
EX
L_
L_
d)
T
ve
CN
CN
r
se
C_
C_
(re
RT
RT
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
T_
EX
L_
)
ed
NT
rv
C
se
C_
(re
RT
31 18 17 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
A
EN
H_
AS
E_ A
OS EN
FL
T
A
AI
S
CL F_
EN
W
RE
T_ _R
T_
T_
A
T_ T
TH
OU PD
EN
OU DE
RS
RS
T_
N_ T_
T_
T_
N_ T_
OU
W OU
OU
OU
W OU
N_
RO N_
N_
N_
RO N_
OW
_B W
_B W
TL RO
RO
RO
TL RO
BR
_D
CN _B
_B
_B
CN _B
C_ TL
TL
TL
TL
C_ TL
)
ed
RT _CN
CN
CN
CN
RT CN
rv
se
C_
C_
C_
C_
C
(re
RT
RT
RT
RT
RT
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)
Chapter 10
10.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
intended 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 decrementing 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.
10.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.
10.2.5 Interrupts
• TIMGn_INT_WDT_INT: Generated when a watchdog timer interrupt stage times out.
10.4 Registers
The addresses in parenthesis besides register names are the register addresses relative to the TIMG base
address provided in Table 3.3-6 Peripheral Address Mapping in Chapter 3 System and Memory. The absolute
register addresses are listed in Section 10.3 Register Summary.
_E N
AL L_ EN
AD
M T_E
N
x_ VE T_
LO
TO SE
AR IN
_T LE _IN
RE
ER
AU EA
Gn _ E
ID
x_ R
M Tx G
_T INC
IV
TI _ EN
TI n_ _ED
D
Gn _
Gn _
x_
M Tx
M Tx
M Tx
_T
TI n_
TI n_
Gn
G
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)
N
TH
_E
GT
NG
OD
EN
LE
_M
N
_I EN
_L
_E
T_
OT
ET
EL T_
NT
SE
BO
ES
EV IN
RE
_L E_
SH
_R
_
0
G2
3
1
PU
DT DG
TG
TG
TG
YS
LA
N
ST
_C
_S
_S
_S
_S
Gn T_E
_W T_E
_F
_
DT
DT
DT
DT
DT
DT
DT
D
Gn D
_W
_W
_W
_W
_W
M W
_W
_W
_W
TI n_
Gn
Gn
Gn
Gn
Gn
Gn
Gn
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_WDT_STG0 Stage 0 configuration. 0: off, 1: interrupt, 2: reset CPU, 3: reset system. (R/W)
TIMGn_WDT_STG1 Stage 1 configuration. 0: off, 1: interrupt, 2: reset CPU, 3: reset system. (R/W)
TIMGn_WDT_STG2 Stage 2 configuration. 0: off, 1: interrupt, 2: reset CPU, 3: reset system. (R/W)
TIMGn_WDT_STG3 Stage 3 configuration. 0: off, 1: interrupt, 2: reset CPU, 3: reset system. (R/W)
TIMGn_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_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_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_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
AL
SC
RE
_P
LK
_C
DT
_W
Gn
M
TI
31 16
0x00001 Reset
TIMGn_WDT_CLK_PRESCALE MWDT clock prescale value. MWDT clock period = MWDT’s clock
source period * TIMGn_WDT_CLK_PRESCALE. (R/W)
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_WDTWPROTECT_REG If the register contains a different value than its reset value, write pro-
tection is enabled. (R/W)
G
IN
CL
CY
EL
T_
_S
T
AR
AR
AX
CA DY
_C CLK
ST
ST
M
R
I_
I_
I_
I_
LI
AL
AL
AL
AL
_C
_C
Gn C_C
_
TC
TC
TC
TC
)
T
ed
_R
_R
_R
_R
_R
rv
Gn
Gn
Gn
Gn
se
M
(re
TI
TI
TI
TI
TI
31 30 16 15 14 13 12 11 0
E
LU
VA
L I_
CA
C_
)
RT
ed
_
rv
Gn
se
M
(re
TI
31 7 5 0
0x00000 0 0 0 0 0 0 Reset
0_ _E A
_T NT EN
A
IN NA
EN
NT _I T_
T_
_I _T1 IN
Gn T T_
M IN D
TI _ _W
Gn T
)
M _IN
ed
rv
Gn
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_INT_WDT_INT_ENA The interrupt enable bit for the TIMGn_INT_WDT_INT interrupt. (R/W)
(R/W)
TIMGn_INT_T1_INT_ENA The interrupt enable bit for the TIMGn_INT_T1_INT interrupt. (R/W) (R/W)
TIMGn_INT_T0_INT_ENA The interrupt enable bit for the TIMGn_INT_T0_INT interrupt. (R/W) (R/W)
W
_T NT RA
IN AW
RA
NT _I T_
T_
_I _T1 IN
Gn T T_
M IN D
TI _ _W
Gn T
)
M IN
ed
TI n_
rv
se
G
M
(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_INT_WDT_INT_RAW The raw interrupt status bit for the TIMGn_INT_WDT_INT interrupt. (RO)
TIMGn_INT_T1_INT_RAW The raw interrupt status bit for the TIMGn_INT_T1_INT interrupt. (RO)
TIMGn_INT_T0_INT_RAW The raw interrupt status bit for the TIMGn_INT_T0_INT interrupt. (RO)
_T NT ST
ST
IN T
NT _I T_
0_ _S
T_
_I _T1 IN
Gn T T_
M IN D
TI _ _W
Gn T
d)
M IN
ve
TI n_
r
se
G
M
(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_INT_WDT_INT_ST The masked interrupt status bit for the TIMGn_INT_WDT_INT interrupt.
(RO)
TIMGn_INT_T1_INT_ST The masked interrupt status bit for the TIMGn_INT_T1_INT interrupt. (RO)
TIMGn_INT_T0_INT_ST The masked interrupt status bit for the TIMGn_INT_T0_INT interrupt. (RO)
0_ _C R
_T NT CL
R
IN LR
CL
NT _I T_
T_
_I _T1 IN
Gn T T_
M IN D
TI n_ T_W
)
M IN
ed
TI n_
rv
se
G
G
M
(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
Chapter 11
11.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.
11.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.
11.3.1 Clock
The RWDT is clocked from the RTC slow clock RTC_SLOW_CLK. The MWDT clock source is derived from the
APB clock APB_CLK via a pre-MWDT 16-bit configurable prescaler. For either watchdog, the clock source is
fed into the 32-bit expiry counter. When this counter reaches the timeout value of the current stage, the
action configured for the stage will execute, the expiry counter will be reset and the next stage will become
active.
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.
• 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.
11.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.
Chapter 12
DPort Registers
12.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 management (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.
12.2 Features
DPort registers correspond to different peripheral blocks and core modules:
• Interrupt matrix
• DMA
• MPU/MMU
• APP_CPU controller
• DPORT_PERI_CLK_EN_REG
• DPORT_PERI_RST_EN_REG
• DPORT_PERIP_CLK_EN_REG
• DPORT_PERIP_RST_EN_REG
• DPORT_WIFI_CLK_EN_REG
• DPORT_WIFI_RST_EN_REG
Notice:
• Reset registers cannot be cleared by hardware. Therefore, SW reset clear is required after setting the
reset registers.
• ESP32 features low power consumption. This is why some peripheral clocks are gated (disabled) by
default. Before using any of these peripherals, it is mandatory to enable the clock for the given
peripheral by setting the corresponding CLK_EN bit to 1, and release the peripheral from reset state to
make it operational by setting the RST_EN bit to 0.
12.5 Registers
The addresses in parenthesis besides register names are the register addresses relative to the DPORT base
address provided in Table 3.3-6 Peripheral Address Mapping in Chapter 3 System and Memory. The absolute
register addresses are listed in Section 12.4 Register Summary.
AP
EM
_R
OT
BO
O_
R
d)
_P
ve
RT
r
se
O
(re
DP
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
EM
_R
OOT
_B
PP
)
ed
_A
rv
RT
se
O
(re
DP
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
N_ A
RI N_ A
S
_E SH
PE E S
AE
T_ RI_ _R
OR PE _EN
DP RT_ ERI
)
ed
O P
DP RT_
rv
se
O
(re
DP
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 0 Reset
DPORT_PERI_EN_RSA Set the bit to enable the clock of RSA module. Clear the bit to disable the
clock of RSA module. (R/W)
DPORT_PERI_EN_SHA Set the bit to enable the clock of SHA module. Clear the bit to disable the
clock of SHA module. (R/W)
DPORT_PERI_EN_AES Set the bit to enable the clock of AES module. Clear the bit to disable the
clock of AES module. (R/W)
ST HA
RI ST_ A
ES
PE R RS
_A
_R S
T_ RI_ T_
OR PE _RS
DP RT_ ERI
d)
O P
ve
DP RT_
r
se
O
(re
DP
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 0 Reset
DPORT_PERI_RST_RSA Set the bit to reset RSA module. Clear the bit to release RSA module. (R/W)
DPORT_PERI_RST_SHA Set the bit to reset SHA module. Clear the bit to release SHA module. (R/W)
DPORT_PERI_RST_AES Set the bit to reset AES module. Clear the bit to release AES module. (R/W)
NG
I
E TT
ES
R
U_
CP
PP
)
ed
A
T_
rv
OR
se
(re
DP
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
DPORT_APPCPU_RESETTING Set to 1 to reset APP_CPU. Clear the bit to release APP_CPU. (R/W)
N
E _E
AT
KG
CL
U_
CP
PP
d)
_A
ve
RT
r
se
O
(re
DP
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
DPORT_APPCPU_CLKGATE_EN Set to 1 to enable the clock of APP_CPU. Clear the bit to disable
the clock of APP_CPU. (R/W)
ALL
ST
RUN
U_
CP
PP
d)
_A
ve
RT
r
se
O
(re
DP
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
DPORT_APPCPU_RUNSTALL Set to 1 to put APP_CPU into stalled state. Clear the bit to release
APP_CPU from stalled state. (R/W)
31 0
0x000000000 Reset
L
SE
D_
IO
ER
P UP
_C
PU
)
ed
C
T_
rv
OR
se
(re
DP
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
DPORT_CPU_CPUPERIOD_SEL Select CPU clock. Refer to Table 7.2-2 for details. (R/W)
EN H_ NE
LE A
NA
E_ US DO
AB EN
_E
CH FL H_
M
CA E_ US
LE LIT
RA
O_ CH FL
NG SP
L
_I
_H
PR CA E_
SI _
M
O_ AM
T_ O_ CH
RA
PR DR
OR PR CA
_D
T_ O_
DP T_ O_
RO
OR PR
OR PR
)
)
ed
ed
ed
ed
P
T_
DP RT_
DP T_
rv
rv
rv
rv
OR
OR
se
se
se
se
O
(re
(re
(re
(re
DP
DP
DP
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
DPORT_PRO_DRAM_HL Determines the virtual address mode of the external SRAM. (R/W)
DPORT_PRO_DRAM_SPLIT Determines the virtual address mode of the external SRAM. (R/W)
O_ CH M K_ OM M
PR CA E_ S R A
CA E_ AS DR 0
T_ O_ CH MA _D DR
E_ AS IRO 1
M K_ M0
R
0
CH M K_ AM
IR 1
CL
K_ AM
AM
OR PR CA E_ ASK PS
A_
AS IR
DP RT_ RO_ ACH _M K_O
PD _I
U_ U
O P C E AS
M MM
O P C E
O_ CH
O P C
T_ O_
DP T_ O_
OR PR
OR PR
d)
)
ed
ve
DP RT_
DP RT_
rv
r
se
se
O
O
(re
(re
DP
DP
31 14 13 12 11 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 1 1 1 1 Reset
EN H_ NE
LE A
NA
E_ US DO
AB EN
_E
CH FL H_
M
CA E_ US
LE LIT
RA
P_ CH FL
NG SP
L
_I
_H
AP CA E_
SI _
AM
P_ AM
T_ P_ CH
rv _DR
AP DR
OR AP CA
T_ _
DP T_ P_
P
P
(re _AP
OR AP
OR AP
)
OR )
)
ed
ed
ed
e
DP T_
DP T_
rv
rv
rv
T
OR
OR
se
se
se
se
(re
(re
(re
DP
DP
DP
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
DPORT_APP_DRAM_HL Determines the virtual address mode of the External SRAM. (R/W)
DPORT_APP_DRAM_SPLIT Determines the virtual address mode of the External SRAM. (R/W)
AP CA E_ SK RO AM
CA E_ S R 0
T_ P_ CH MA _D DR
E_ AS IRO 1
M K_ M0
R
0
P_ CH MA _D M
CH M K_ AM
IR 1
CL
K_ AM
AM
OR AP CA E_ SK PS
A_
AS IR
DP RT_ PP_ CH MA K_O
PD _I
U_ U
O A CA E_ S
M MM
DP RT_ PP_ CH MA
CM E_
O A CA E_
P_ CH
DP RT_ PP_ CH
AP CA
O A CA
T_ P_
DP RT_ PP_
OR AP
d)
)
ed
O A
ve
DP RT_
DP RT_
rv
r
se
se
O
O
(re
(re
DP
DP
31 14 13 12 11 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 1 1 1 1 Reset
E
OD
_M
UX
M
E_
CH
CA
)
ed
T_
rv
OR
se
(re
DP
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
DPORT_CACHE_MUX_MODE The mode of the two caches sharing the memory. (R/W)
E
OD
_M
GE
ed _PA
U
M
)
(re _IM
)
ed
rv
rv
T
OR
se
se
(re
DP
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
DPORT_IMMU_PAGE_MODE Page size in the MMU for the internal SRAM 0. (R/W)
E
OD
_M
GE
PA
U_
M
(re _DM
)
)
ed
ed
rv
rv
T
OR
se
se
(re
DP
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
DPORT_DMMU_PAGE_MODE Page size in the MMU for the internal SRAM 2. (R/W)
31 0
0xFFFFFFFF Reset
1
T_
RAN
_G
SS
E
CC
_A
HB
)
ed
A
T_
rv
OR
se
(re
DP
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
DP T_ NT LK N EN
DP RT_ HCI RO EN K_E
DP RT_ S1_ A_ EN EN
OR PC _C _E LK_
se I2 1_ E EN
O TW 1_ EN EN
O TI C K_ EN
O I2 DM K_ _
O U RG K_ L
DP RT_ ME CL 1_C
DP RT_ I_ CL CLK
DP RT_ ME LK_ EN
DP RT_ I3_ CL K_
DP RT_ DC CLK _C
DP RT_ I2 T0_ EN
K_ N
DP RT_ C_ LK_ EN
EN
DP RT_ HCI LK_ N
DP RT_ MT_ LK N
) CL EN
DP RT_ WM T1_ N
EN
DP rve S0 CLK N
DP RT_ US RO N
O d _CL _E
OR I2 0_ EN
O TI E_ UP
O LE 1_ UP
O P CL CL
O U C _E
O R _C _E
O SP 0_ CL
O SP EX K_
O SP 2_ _
O UA _C C
O P EX E
O I2 _C _
O EF RG E
K_
ed 1_ _
DP RT_ RT EM
DP RT_ AI CLK
DP T_ C_ CL
rv I0 LK
O UA _M
se SP _C
DP T_ RT
(re RT_ RT
OR UA
O UA
d)
se d)
DP RT_ )
DP RT_ )
O d
ve
(re rve
DP rve
r
se
se
(re
(re
31 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
11111 0 0 1 1 1 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 0 1 1 1 1 Reset
Set the following bit to enable the clock of the corresponding module. Clear the bit to disable the
clock of the corresponding module.
ST
ST
DP RT_ ME RS 1_R
DP RT_ I_ RS RST
DP RT_ DC RST _R
(re RT_ RT ST ST
DP RT_ WM T T
DP RT_ I3_ RS T
O P RS RS
O TI E_ UP
P
O SP 0_ RS
O SP 2_ _
O UA _R R
U
O U RG T
O I2 DM T
O TI R T
O SP EX T
DP RT_ RT EM
DP rve S0 RST
DP T_ AI ST
DP RT_ I2 T0_
DP RT_ S1_ A_
T
DP RT_ MT_ ST
DP T_ NT ST
DP RT_ WM T1_
DP RT_ US RO
DP RT_ HCI RO
DP RT_ C_ RS
rv I0 ST
DP RT_ C_ ST
T
DP RT_ ME ST
DP T_ CI T
) RS
O d _RS
OR TW 1_R
OR UH RS
O UA _M
R
OR PC _R
se SP _R
O I2 0_
O EF RG
O I2 _R
se I2 1_
O P EX
O LE _
ed 1_
_
1
DP T_ RT
(re RT_ RT
OR UA
O UA
)
se d)
DP RT_ )
DP RT_ )
ed
O d
R
(re rve
DP rve
rv
se
se
O
(re
(re
31 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
00000 0 0 0 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
Set each bit to reset the corresponding module. Clear the bit to release the corresponding module. For the list
of modules, please refer to register 12.19.
N
_E
T_
E
OS
IO EN
AV
_H
SL
SD C_
IO
K_ A
CL EM
SD
I_ _
K_
IF K
W CL
CL
T_ FI_
I_
IF
)
)
OR WI
W
ed
ed
ed
DP RT_
T_
rv
rv
rv
OR
se
se
se
O
(re
(re
(re
DP
DP
31 15 14 13 12 5 4 3 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 Reset
DPORT_WIFI_CLK_EMAC_EN Set the bit to enable the clock of Ethernet MAC module. Clear the bit
to disable the clock of Ethernet MAC module. (R/W)
DPORT_WIFI_CLK_SDIO_HOST_EN Set the bit to enable the clock of SD/MMC module. Clear the
bit to disable the clock of SD/MMC module. (R/W)
DPORT_WIFI_CLK_SDIOSLAVE_EN Set the bit to enable the clock of SDIO module. Clear the bit to
disable the clock of SDIO module. (R/W)
T
ST RS
_R T_
T_ IO ST
IO OS
OR SD _R
SD _H
DP T_ AC
OR EM
d)
)
ed
ve
DP RT_
rv
r
se
se
O
(re
(re
DP
31 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
DPORT_EMAC_RST Set the bit to reset Ethernet MAC module. Clear the bit to release Ethernet MAC
module. (R/W)
DPORT_SDIO_HOST_RST Set the bit to reset SD/MMC module. Clear the bit to release SD/MMC
module. (R/W)
DPORT_SDIO_RST Set the bit to reset SDIO module. Clear the bit to release SDIO module. (R/W)
n
PU_
_C
M
RO
_F
TR
IN
U_
P
)
ed
_C
rv
RT
se
O
(re
DP
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
AP
M
*_
O_
PR
d)
ve
T_
r
OR
se
(re
DP
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 10000 Reset
AP
_M
_*
PP
d)
A
ve
T_
r
OR
se
(re
DP
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 10000 Reset
IG
NF
CO
T_
AN
GR
S_
ES
C
AC
*_
E_
T
LI
HB
)
ed
A
T_
rv
OR
se
(re
DP
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
AL
IT
_H
EG
Y
EN
TI
LL
UL
D
I
S_
S_
M
ES
ES
U_
CC
CC
M
_M
_A
_A
EM
EM
EM
d)
d)
M
M
ve
ve
T_
T_
T_
r
r
OR
OR
OR
se
se
(re
(re
DP
DP
DP
31 30 29 26 25 14 13 10 9 0
0 0 0 0 0 0 0 0 0 0 Reset
L
D_ NY
S
GA
IS
E
LE
M
S_ _D
S_
IL
SS
ES
CE
PI
CC
T_ _AC
_A
S
CE
EM
OR MA
AC
d)
M
ed
D
ve
T_
T_
rv
r
OR
OR
se
se
(re
(re
DP
DP
DP
31 9 8 7 6 5 4 3 0
0 0 0 0 0 Reset
L
GA
L
LE
A
EG
IL
S_
ILL
ES
U_
CC
M
_M
_A
HE
HE
AC
AC
_C
_C
RO
RO
)
ed
P
T_
T_
rv
OR
OR
se
(re
DP
DP
30 6 6 1 0
0 0 0 Reset
L
GA
L
LE
GA
IL
LE
S_
IL
ES
U_
CC
M
_M
_A
HE
HE
AC
AC
_C
_C
PP
PP
d)
_A
ve
T_
RT
r
OR
se
O
(re
DP
DP
30 6 6 1 0
0 0 0 Reset
En
BL
TA
U_
M
M
)
ed
I
T_
rv
OR
se
(re
DP
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
En
BL
TA
U_
M
M
d)
D
ve
T_
r
OR
se
(re
DP
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
DPORT_DMMU_TABLEn Configures Internal SRAM MMU. When n is 0 ~ 15, reset values are 0 ~ 15,
respectively. (R/W)
N
N
_E
EG T_E
NT
N
_I
_I
AL
NY
_P DE
LL
SS S_
_I
S
ID
CE
T_ _AC
CE
A
DP _DM
AC
)
)
ed
ed
rv
rv
T
OR
OR
se
se
(re
(re
DP
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
DPORT_ACCESS_PID_ILLEGAL_INT_EN Enables the CPU’s illegal access to the PID controller in-
terrupt.
Bit 0: Enables the APP CPU’s illegal access to the PID controller interrupt
Bit 1: Enables the PRO CPU’s illegal access to the PID controller interrupt
(R/W)
EN
N
_E
T_
EN
NT
IN
T_
I
L_
T_
IN
A
HI
Y_
EG
_
EN
TI
LL
UL
_D
_I
M
SS
SS
U_
E
CC
CC
M
_M
_A
_A
EM
EM
EM
)
d)
M
_M
M
ed
ve
T_
T_
rv
RT
r
OR
OR
se
se
O
(re
(re
DP
DP
DP
31 24 23 20 19 8 7 4 3 0
0 0 0 0 0 0 0 0 0 0 Reset
EN
E
T_
T_
EN
_E
IN
IN
T_
NT
L_
L_
IN
_I
A
GA
L_
EG
AL
LE
GA
LL
EG
IL
LE
I
S_
S_
IL
IL
S
U_
ES
U_
CE
CC
M
M
AC
_M
_M
_A
E_
HE
HE
HE
H
AC
AC
AC
AC
_C
_C
_C
_C
RO
RO
PP
PP
d)
d)
)
ed
P
A
ve
ve
T_
T_
T_
T_
rv
r
r
OR
OR
OR
OR
se
se
se
(re
(re
(re
DP
DP
DP
DP
31 28 27 22 21 20 14 13 8 7 6 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
M
DM
D
_D
2_
I1_
I3
PI
P
SP
_S
_S
I_
PI
PI
SP
d)
S
ve
T_
T_
T_
r
OR
OR
OR
se
(re
DP
DP
DP
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
Chapter 13
13.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.
13.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 interrupt
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 interrupt.
Otherwise, PID Controller performs no action. The registers PIDCTRL_INTERRUPT_ADDR_1_REG ~
PIDCTRL_INTERRUPT_ADDR_7_REG define the interrupt vector entry address for all the interrupt priority levels.
For details please refer to Table 13.3-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 13.3-2.
PID Controller also records in register PIDCTRL_FROM_n_REG the status of the system before the interrupt
occurred. 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 process running on the CPU before the interrupt indicated by the register occurred. For details please
refer to Table 13.3-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 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.