Esp32-C6 Technical Reference Manual en - Pdf#riscvcpu
Esp32-C6 Technical Reference Manual en - Pdf#riscvcpu
Version 1.0
Espressif Systems
Copyright © 2024
www.espressif.com
About This Document
The ESP32-C6 Technical Reference Manual is targeted at developers working on low level software projects
that use the ESP32-C6 SoC. It describes the hardware modules listed below for the ESP32-C6 SoC and other
products in ESP32-C6 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-c6_technical_reference_manual_en.pdf
Contents
1 High-Performance CPU 36
1.1 Overview 36
1.2 Features 36
1.3 Terminology 37
1.4 Address Map 37
1.5 Configuration and Status Registers (CSRs) 37
1.5.1 Register Summary 37
1.5.2 Register Description 39
1.6 Interrupt Controller 52
1.6.1 Features 52
1.6.2 Functional Description 52
1.6.3 Suggested Operation 54
1.6.3.1 Latency Aspects 54
1.6.3.2 Configuration Procedure 55
1.6.4 Registers 56
1.7 Core Local Interrupts (CLINT) 57
1.7.1 Overview 57
1.7.2 Features 57
1.7.3 Software Interrupt 57
1.7.4 Timer Counter and Interrupt 57
1.7.5 Register Summary 58
1.7.6 Register Description 58
1.8 Physical Memory Protection 62
1.8.1 Overview 62
1.8.2 Features 62
1.8.3 Functional Description 62
1.8.4 Register Summary 63
1.8.5 Register Description 63
1.9 Physical Memory Attribute (PMA) Checker 64
1.9.1 Overview 64
1.9.2 Features 64
1.9.3 Functional Description 64
1.9.4 Register Summary 65
1.9.5 Register Description 66
1.10 Debug 67
1.10.1 Overview 67
1.10.2 Features 68
1.10.3 Functional Description 68
1.10.4 JTAG Control 68
1.10.5 Register Summary 69
1.10.6 Register Description 69
1.11 Hardware Trigger 72
1.11.1 Features 72
1.11.2 Functional Description 72
1.11.3 Trigger Execution Flow 73
1.11.4 Register Summary 73
1.11.5 Register Description 74
1.12 Trace 78
1.12.1 Overview 78
1.12.2 Features 78
1.12.3 Functional Description 78
1.13 Debug Cross-Triggering 79
1.13.1 Overview 79
1.13.2 Features 79
1.13.3 Functional Description 79
1.13.4 Register Summary 80
1.13.5 Register Description 80
1.14 Dedicated IO 81
1.14.1 Overview 81
1.14.2 Features 81
1.14.3 Functional Description 81
1.14.4 Register Summary 82
1.14.5 Register Description 82
1.15 Atomic (A) Extension 84
1.15.1 Overview 84
1.15.2 Functional Description 84
1.15.2.1 Load Reserve (LR.W) Instruction 84
1.15.2.2 Store Conditional (SC.W) Instruction 84
1.15.2.3 AMO Instructions 85
Glossary 1352
Abbreviations for Peripherals 1352
Abbreviations Related to Registers 1352
Access Types for Registers 1354
List of Tables
1-2 CPU Address Map 37
1-4 Core Local Interrupt (CLINT) Sources 57
1-10 NAPOT encoding for maddress 73
2-2 Trace Encoder Parameters 88
2-3 Header Format 90
2-4 Index Format 91
2-5 Packet format 3 subformat 0 91
2-6 Packet format 3 subformat 1 91
2-7 Packet format 3 subformat 3 92
2-8 Packet format 2 92
2-9 Packet format 1 with address 93
2-10 Packet format 1 without address 94
3-2 LP CPU Exception Causes 111
3-5 Performance Counter 118
3-6 Wake Sources 122
4-1 Selecting Peripherals via Register Configuration 127
4-2 Descriptor Field Alignment Requirements 130
5-1 Memory Address Mapping 163
5-2 Module/Peripheral Address Mapping 167
6-1 Parameters in eFuse BLOCK0 172
6-2 Secure Key Purpose Values 175
6-3 Parameters in BLOCK1 to BLOCK10 176
6-4 Registers Information 181
6-5 Configuration of Default VDDQ Timing Parameters 182
7-1 Bit Used to Control IO MUX Functions in Light-sleep Mode 244
7-2 Peripheral Signals via GPIO Matrix 247
7-3 IO MUX Functions List 252
7-4 LP IO MUX Functions List 253
7-5 Analog Functions of IO MUX Pins 254
8-1 Reset Source 294
8-2 CPU_CLK Clock Source 296
8-3 Frequency of CPU_CLK, AHB_CLK and HP_ROOT_CLK 297
8-4 Derived Clock Source 299
8-5 HP Clocks Used by Each Peripheral 299
8-6 LP Clocks Used by Each Peripheral 300
8-7 Mapping Between PMU Register Bits and the Clock Gating of Peripherals’ Register R/W Operations302
8-8 Mapping Between PMU Register Bits and the Gating of Peripherals’ Operating Clock 303
9-1 Default Configuration of Strapping Pins 363
9-2 Boot Mode Control 363
9-3 ROM Message Printing Control 365
9-4 JTAG Signal Source Control 366
9-5 SDIO Input Sampling Edge/Output Driving Edge Control 366
10-1 CPU Peripheral Interrupt Source Mapping/Status Registers and Peripheral Interrupt Sources 369
List of Figures
1-1 CPU Block Diagram 36
1-2 Debug System Overview 67
2-1 Trace Encoder Overview 86
2-2 Trace Overview 87
2-3 Trace packet Format 90
3-1 LP CPU Overview 102
3-2 Wake-Up and Sleep Flow of LP CPU 120
4-1 Modules with GDMA Feature and GDMA Channels 124
4-2 GDMA controller Architecture 125
4-3 Structure of a Linked List 126
4-4 Relationship among Linked Lists 128
5-1 System Structure and Address Mapping 162
5-2 Cache Structure 165
5-3 Modules/peripherals that can work with GDMA 166
6-1 Data Flow in eFuse 171
6-2 Shift Register Circuit (first 32 output) 178
6-3 Shift Register Circuit (last 12 output) 178
7-1 Architecture of IO MUX, LP IO MUX, and GPIO Matrix 236
7-2 Internal Structure of a Pad 237
7-3 GPIO Input Synchronized on Rising Edge or on Falling Edge of IO MUX Operating Clock 238
7-4 GPIO Filter Timing of GPIO Input Signals 239
7-5 Glitch Filter Timing Example 239
8-1 Reset Types 293
8-2 System Clock 295
8-3 Clock Configuration Example 305
9-1 Chip Boot Flow 364
10-1 Interrupt Matrix Structure 367
11-1 Event Task Matrix Architecture 386
11-2 ETM Channeln Architecture 387
11-3 Event Task Matrix Clock Architecture 394
12-1 ESP32-C6 Power Scheme 405
12-2 PMU Workflow 407
12-3 Brownout Reset Workflow 417
12-4 ESP32-C6 Boot Flow 419
13-1 System Timer Structure 482
13-2 System Timer Alarm Generation 483
14-1 Timer Group Overview 505
14-2 Timer Group Architecture 506
15-1 Watchdog Timers Overview 529
15-2 Digital Watchdog Timers in ESP32-C6 531
15-3 Super Watchdog Controller Structure 534
16-1 PMP-APM Management Relation 544
16-2 APM Controller Structure 546
1 High-Performance CPU
1.1 Overview
ESP-RISC-V CPU is a 32-bit core based upon RISC-V instruction set architecture (ISA) comprising base integer
(I), multiplication/division (M), atomic (A) and compressed (C) standard extensions. The core has 4-stage,
in-order, scalar pipeline optimized for area, power and performance. CPU core complex has a debug module
(DM), interrupt-controller (INTC), core local interrupts (CLINT) and system bus (SYS BUS) interfaces for
memory and peripheral access.
ESP-RISC-V CPU
INTC IRQ
RV32IMAC
CORE
DM JTAG
IBUS DBUS
SBA
SYS BUS
1.2 Features
• RISC-V RV32IMAC ISA with four-stage pipeline that supports an operating clock frequency up to 160 MHz
• Compatible with RISC-V ISA Manual Volume I: Unprivileged ISA Version 2.2 and RISC-V ISA Manual,
Volume II: Privileged Architecture, Version 1.10
• Zero wait cycle access to on-chip SRAM and Cache for program and data access over IRAM/DRAM
interface
• Interrupt controller with up to 28 external vectored interrupts for both M and U modes with 16
programmable priority and threshold levels
• Debug module (DM) compliant with the specification RISC-V External Debug Support Version 0.13 with
external debugger support over an industry-standard JTAG/USB port
• Debugger with a direct system bus access (SBA) to memory and peripherals
• Hardware trigger compliant to the specification RISC-V External Debug Support Version 0.13 with up to 4
breakpoints/watchpoints
• Physical memory protection (PMP) and attributes (PMA) for up to 16 configurable regions
1.3 Terminology
*default: Address not matching any of the specified ranges (IRAM, DRAM, CPU) are accessed using AHB
bus.
¹Although misa is specified as having both read and write access (R/W), its fields are hardwired and thus write has no effect. This is
what would be termed WARL (Write Any Read Legal) in RISC-V terminology
²mtvec only provides configuration for trap handling in vectored mode with the base address aligned to 256 bytes
³External interrupt IDs reflected in mcause include even those IDs which have been reserved by RISC-V standard for core internal sources.
Note that if write/set/clear operation is attempted on any of the CSRs which are read-only (RO), as indicated in
the above table, the CPU will generate illegal instruction exception.
31 0
0x00000612 Reset
⁴These custom CSRs have been implemented in the address space reserved by RISC-V standard for custom use
ID
CH
AR
M
31 0
0x80000002 Reset
D
PI
IM
M
31 0
0x00000002 Reset
31 0
0x00000000 Reset
UP ed)
)
ed
ed
ed
ed
rv
rv
rv
rv
rv
se
se
se
se
se
E
IE
PP
PI
IE
E
(re
TW
(re
(re
(re
(re
UI
M
M
31 22 21 20 13 12 11 10 8 7 6 5 4 3 2 1 0
UPIE Write 1 to enable the user previous interrupt (before trap). (R/W)
MPIE Write 1 to enable the machine previous interrupt (before trap). (R/W)
TW Configures whether to cause illegal instruction exception when WFI (Wait-for-Interrupt) instruc-
tion is executed in U mode.
0: Not cause illegal exception in U mode
1: Cause illegal instruction exception
(R/W)
)
ed
rv
se
XL
(re
M
M
W
O
U
G
N
C
H
B
Z
P
R
V
A
T
Y
E
F
X
J
L
I
31 30 29 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
Z Reserved = 0. (RO)
Y Reserved = 0. (RO)
W Reserved = 0. (RO)
V Reserved = 0. (RO)
T Reserved = 0. (RO)
R Reserved = 0. (RO)
P Reserved = 0. (RO)
O Reserved = 0. (RO)
L Reserved = 0. (RO)
K Reserved = 0. (RO)
J Reserved = 0. (RO)
B Reserved = 0. (RO)
EG
EL
ID
M
31 0
0x00000111 Reset
MIDELEG Configures the U mode delegation state for each interrupt ID. Below interrupts are dele-
gated to U mode by default:
Bit 0: User software interrupt (CLINT)
Bit 4: User timer interrupt (CLINT)
Bit 8: User external interrupt
The default delegation can be modified at run-time if required.
(R/W)
5]
:8
US :1]
31
6:
2
E[
E[
E[
E
E
IE
IE
XI
XI
XI
SI
TI
UT
M
M
M
M
31 8 7 6 5 4 3 2 1 0
E
se
SE
OD
(re
BA
31 8 7 2 1 0
MODE Represents whether machine mode interrupts are vectored. Only vectored mode 0x1 is
available. (RO)
BASE Configures the higher 24 bits of trap vector base address aligned to 256 bytes. (R/W)
H
TC
RA
SC
M
31 0
0x00000000 Reset
C
EP
M
31 0
0x00000000 Reset
MEPC Configures the machine trap/exception program counter. This is automatically updated with
address of the instruction which was about to be executed while CPU encountered the most
recent trap. (R/W)
de
Co
g
la
)
F
n
ed
io
pt
rv
pt
rru
se
ce
te
(re
Ex
In
31 30 5 4 0
Exception Code This field is automatically updated with unique ID of the most recent exception or
interrupt due to which CPU entered trap. Possible exception IDs are:
0x1: PMP instruction access fault
0x2: Illegal instruction
0x3: Hardware breakpoint/watchpoint or EBREAK
0x5: PMP load access fault
0x6: Misaligned store address or AMO address
0x7: PMP store access or AMO access fault
0x8: ECALL from U mode
0xb: ECALL from M mode
Other values: reserved
Note: Exception ID 0x0 (instruction access misaligned) is not present because CPU always
masks the lowest bit of the address during instruction fetch.
(R/W)
Interrupt Flag This flag is automatically updated when CPU enters trap.
If this is found to be set, indicates that the latest trap occurred due to an interrupt. For exceptions
it remains unset.
Note: The interrupt controller is using up IDs in range 1-2, 5-6 and 8-31 for all external interrupt
sources. This is different from the RISC-V standard which has reserved IDs in range 0-15 for core
local interrupts only. Although local interrupt sources (CLINT) do use the reserved IDs 0, 3, 4
and 7.
(R/W)
AL
TV
M
31 0
0x00000000 Reset
MTVAL Configures machine trap value. This is automatically updated with an exception dependent
data which may be useful for handling that exception.
Data is to be interpreted depending upon exception IDs:
0x1: Faulting virtual address of instruction
0x2: Faulting instruction opcode
0x5: Faulting data address of load operation
0x7: Faulting data address of store operation
Note: The value of this register is not valid for other exception IDs and interrupts.
(R/W)
UT :5]
:8
US :1]
31
2
P[
P[
P[
P
P
IP
IP
XI
XI
XI
SI
TI
M
M
M
M
31 8 7 6 5 4 3 2 1 0
)
ed
ed
rv
rv
se
se
IE
E
(re
(re
UP
UI
31 5 4 3 1 0
UPIE Write 1 to enable the user previous interrupt (before trap). (R/W)
UX ed)
UX ed)
]
]
:8
US 1]
:5
31
:
rv
rv
[6
[2
E[
se
se
IE
IE
IE
IE
I
(re
(re
UX
UT
31 8 7 6 5 4 3 2 1 0
)
ed
rv
E
se
SE
OD
(re
BA
M
31 8 7 2 1 0
MODE Represents if user mode interrupts are vectored. Only vectored mode 0x1 is available. (RO)
BASE Configures the higher 24 bits of trap vector base address aligned to 256 bytes. (R/W)
31 0
0x00000000 Reset
31 0
0x00000000 Reset
UEPC Configures the user trap program counter. This is automatically updated with address of the
instruction which was about to be executed in User mode while CPU encountered the most
recent user mode interrupt. (R/W)
de
Co
g
la
)
F
n
ed
io
pt
rv
pt
rru
se
ce
te
(re
Ex
In
31 30 5 4 0
Interrupt ID This field is automatically updated with the unique ID of the most recent user mode
interrupt due to which CPU entered trap. (R/W)
Interrupt Flag This flag would always be set because CPU can only enter trap due to user mode
interrupts as exception delegation is unsupported. (R/W)
UX ed)
UX ed)
]
1:8
:1]
:4
rv
rv
[2
[3
[5
se
se
IP
IP
IP
IP
IP
(re
(re
UX
US
UT
31 8 7 6 5 4 3 2 1 0
UXIP Configures the pending status of the 28 external interrupts delegated to user mode.
0: Not pending
1: Pending
(R/W)
P H KEN
IN AZ ARD
JM NC _TA
LO RE ON
RD
BR NC P
)
RA M
O C
_H Z
ed
A H
ST A
(B _CO
ST _UN
LD _HA
rv
E
se
ID D
CL
ST
P
LE
A
JM
(re
CY
IN
31 11 10 9 8 7 6 5 4 3 2 1 0
0x000 0 0 0 0 0 0 0 0 0 0 0 Reset
CYCLE Count Clock Cycles. Cycle count does not increment during WFI mode.
Note: Each bit selects a specific event for counter to increment. If more than one event is
selected and occurs simultaneously, then counter increments by one only.
(R/W)
CO NT_
rv
se
U
CO
(re
31 2 1 0
0 1 1 Reset
CR
PC
M
31 0
0x00000000 Reset
• Up to 28 external asynchronous interrupts and 4 core local interrupt sources (CLINT) with unique IDs
(0-31)
For the complete list of interrupt registers and detailed configuration information, please refer to Chapter 10
Interrupt Matrix (INTMTX) > Section 10.4.2.
1. Mode (M/U):
• If the bit is cleared for an interrupt in mideleg CSR, then that interrupt will be captured in M mode.
• If the bit is set for an interrupt in mideleg CSR, then it will be delegated to U mode.
• Local CLINT interrupts have the corresponding bits reserved in the memory mapped registers thus
they are always enabled at the INTC level.
• An M mode interrupt (external or local) further needs to be unmasked at core level by setting the
corresponding bit in mie CSR.
• A U mode interrupt (external or local) further needs to be unmasked at core level by setting the
corresponding bits in uie CSR.
3. Type (0-1):
• Local CLINT interrupts are always ’level’ type and thus have the corresponding bits reserved in the
above register.
4. Priority (0-15):
• Determines which interrupt, among multiple pending interrupts, the CPU will service first.
• Enabled external interrupts with priorities less than the threshold value in
INTPRI_CORE0_CPU_INT_THRESH_REG are masked.
• Interrupts with same priority are statically prioritized by their IDs, lowest ID having highest priority.
• Local CLINT interrupts have static priorities associated with them, and thus have the corresponding
priority registers to be reserved.
• Local CLINT interrupts cannot be masked using the threshold values for either modes.
• Reflects the captured state of an enabled and unmasked external interrupt signal.
• For each interrupt ID (local or external), the corresponding bit in the mip CSR for M mode interrupts
or uip CSR for U mode interrupts, also gives its pending state.
• A pending interrupt will cause CPU to enter trap if no other pending interrupt has higher priority.
• A pending interrupt is said to be ’claimed’ if it preempts the CPU and causes it to jump to the
corresponding trap vector address.
• All pending interrupts which are yet to be serviced are termed as ’unclaimed’.
• Toggling this will clear the pending state of claimed edge-type interrupts only.
• Pending state of a level type interrupt is unaffected by this and must be cleared from source.
• Pending state of an unclaimed edge type interrupt can be flushed, if required, by first clearing the
corresponding bit in INTPRI_CORE0_CPU_INT_ENABLE_REG and then toggling same bit in
INTPRI_CORE0_CPU_INT_CLEAR_REG.
For detailed description of the core local interrupt sources, please refer to Section 1.7.
• saves the address of the current un-executed instruction in mepc/uepc for resuming execution later.
• updates the value of mcause/ucause with the ID of the interrupt being serviced.
• copies the state of MIE/UIE into MPIE/UPIE, and subsequently clears MIE/UIE, thereby disabling
interrupts globally.
The word aligned trap address for an M mode interrupt with a certain ID = i can be calculated as (mtvec + 4i).
Similarly, the word aligned trap address for a U mode interrupt can be calculated as (utvec + 4i).
After jumping to the trap vector for the corresponding mode, the execution flow is dependent on software
implementation, although it can be presumed that the interrupt will get handled (and cleared) in some interrupt
service routine (ISR) and later the normal execution will resume once the CPU encounters MRET/URET
instruction for that mode.
• copies the state of MPIE/UPIE back into MIE/UIE, and subsequently clears MPIE/UPIE. This means that
if previously MPIE/UPIE was set, then, after MRET/URET, MIE/UIE will be set, thereby enabling interrupts
globally.
It is possible to perform software assisted nesting of interrupts inside an ISR as explained in Section
1.6.3.
The below listed points outline the functional behavior of the controller:
• Only if an interrupt has priority higher or equal to the value in the threshold register, will it be reflected in
INTPRI_CORE0_CPU_INT_EIP_STATUS_REG.
In steady state operation, the Interrupt Controller has a fixed latency of 4 cycles. Steady state means that no
changes have been made to the Interrupt Controller registers recently. This implies that any interrupt that is
asserted to the controller will take exactly 4 cycles before the CPU starts processing the interrupt. This further
implies that CPU may execute up to 5 instructions before the preemption happens.
Whenever any of its registers are modified, the Interrupt Controller enters into transient state, which may take
up to 4 cycles for it to settle down into steady state again. During this transient state, the ordering of interrupts
may not be predictable, and therefore, a few safety measures need to be taken in software to avoid any
synchronization issues.
Also, it must be noted that the Interrupt Controller configuration registers lie in the APB address range, hence
any R/W access to these registers may take multiple cycles to complete.
In consideration of above mentioned characteristics, users are advised to follow the sequence described
below, whenever modifying any of the Interrupt Controller registers:
3. execute FENCE instruction to wait for any pending write operations to complete
Due to its critical nature, it is recommended to disable interrupts globally (MIE=0) beforehand, whenever
configuring interrupt controller registers, and then restore MIE right after, as shown in the sequence
above.
After execution of the sequence above, the Interrupt Controller will resume operation in steady state.
By default, interrupts are disabled globally, since the reset value of MIE bit in mstatus is 0. Software must set
MIE=1 after initialization of the interrupt stack (including setting mtvec to the interrupt vector address) is
done.
During normal execution, if an external interrupt n is to be enabled, the below sequence may be
followed:
2. depending upon the type of the interrupt (edge/level), set/unset the nth bit of
INTPRI_CORE0_CPU_INT_TYPE_REG
When one or more interrupts become pending, the CPU acknowledges (claims) the interrupt with the highest
priority and jumps to the trap vector address corresponding to the interrupt’s ID. Software implementation may
read mcause to infer the type of trap (mcause(31) is 1 for interrupts and 0 for exceptions) and then the ID of
the interrupt (mcause(4-0) gives ID of interrupt or exception). This inference may not be necessary if each
entry in the trap vector are jump instructions to different trap handlers. Ultimately, the trap handler(s) will
redirect execution to the appropriate ISR for this interrupt.
Upon entering into an ISR, software must toggle the nth bit of INTPRI_CORE0_CPU_INT_CLEAR_REG if the
interrupt is of edge type, or clear the source of the interrupt if it is of level type.
Software may also update the value of INTPRI_CORE0_CPU_INT_THRESH_REG and program MIE=1 for allowing
higher priority interrupts to preempt the current ISR (nesting), however, before doing so, all the state CSRs
must be saved (mepc, mstatus, mcause, etc.) since they will get overwritten due to occurrence of such an
interrupt. Later, when exiting the ISR, the values of these CSRs must be restored.
Finally, after the execution returns from the ISR back to the trap handler, MRET instruction is used to resume
normal execution.
Later, if the n interrupt is no longer needed and needs to be disabled, the following sequence may be
followed:
4. if the interrupt is of edge type and was found to be pending in step 2 above, nth bit of
INTPRI_CORE0_CPU_INT_CLEAR_REG must be toggled, so that its pending status gets flushed
Above is only a suggested scheme of operation. Actual software implementation may vary.
1.6.4 Registers
For the complete list of interrupt registers and configuration information, please refer to Section 10.4.2 and
Section 10.5.2 respectively.
ID Description Priority
0 U mode software interrupt 1
3 M mode software interrupt 3
4 U mode timer interrupt 0
7 M mode timer interrupt 2
These interrupt sources have reserved IDs and fixed priorities which cannot be masked via the interrupt
controller threshold registers for either modes.
Two of these interrupts (0 and 4) are by-default delegated to U mode as per the reset values of corresponding
bits in mideleg CSR.
It must be noted that regardless of the fixed priority of CLINT interrupts, pending external interrupt sources
always have higher priority over CLINT sources.
1.7.2 Features
• 4 local level-type interrupt sources with static priorities and IDs
• Software interrupts
The MSIE/USIE bit must be set in mie/uie CSR for enabling the interrupt at core level for a particular
mode.
Pending state of this interrupt can be checked for either mode by reading the corresponding bit MSIP/USIP in
mip/uip CSR.
Note that by default U mode software interrupt with ID 0 has the corresponding bit set in mideleg CSR. This bit
can be toggled for using the interrupt in M mode instead. Similarly the bit corresponding to M mode software
interrupt can be set for using it in U mode.
A read-only memory mapped UTIME is also provided for reading the timer counter from U mode, although it
always reflects the same value as in the corresponding M mode counter MTIME register.
Timer interrupt for M/U mode is enabled by setting the MTIE/UTIE bit in MTIMECTL/UTIMECTL. Also, the
MTIE/UTIE bit must be set in mie CSR for enabling the interrupt at core level for a particular mode.
Interrupt for M/U mode is asserted when the 64b timer value exceeds the 64b timer-compare value
programmed in MTIMECMP/UTIMECMP.
Pending state of M/U mode timer interrupt is reflected as the read-only MTIP/UTIP bit in
MTIMECTL/UTIMECTL.
For de-asserting the pending timer interrupt in M/U mode, either the MTIE/UTIE bit has to be cleared or the
value of the MTIMECMP/UTIMECMP register needs to be updated.
Pending state of this interrupt can be checked at core level for either mode by reading the corresponding bit
MTIP/UTIP in mip/uip.
Upon overflow of the 64b timer counter, the MTOF/UTOF bit in MTIMECTL/UTIMECTL gets set. It can be
cleared after appropriate handling of the overflow situation.
Note that by default U mode timer interrupt with ID 4 has the corresponding bit set in mideleg CSR. This bit
can be toggled for using the interrupt in M mode instead. Similarly the bit corresponding to M mode timer
interrupt can be set for using it in U mode.
d)
rve
se
P
SI
(re
M
31 1 0
0x00000000 0 Reset
M F
E
se
P
E
TO
TC
TI
TI
(re
M
M
31 4 3 2 1 0
0x0000000 0 0 0 0 Reset
]
:32
63
E[
M
TI
M
63 32
0 Reset
]
:0
31
E[
M
TI
M
31 0
0 Reset
]
32
3:
6
P[
M
EC
M
TI
M
63 32
0 Reset
]
:0
31
P[
M
EC
M
TI
M
31 0
0 Reset
I P
(re
US
31 1 0
0x00000000 0 Reset
)
ed
ed
rv
rv
se
se
UT F
IP
IE
O
(re
(re
UT
UT
31 4 3 2 1 0
0x0000000 0 0 0 0 Reset
UTIP Represents the pending status of the user timer interrupt. (RO)
63 32
0 Reset
]
:0
31
E[
I M
UT
31 0
0 Reset
UTIME Represents the read-only 64-bit CLINT timer counter value. (RO)
63 32
0 Reset
]
:0
31
P[
M
EC
I M
UT
31 0
0 Reset
1.8.2 Features
The PMP unit can be used to restrict access to physical memory. It supports 16 regions and a minimum
granularity of 4 bytes. Maximum supported NAPOT range is 4 GB.
By default, PMP grants permission to all accesses in machine-mode and revokes permission of all access in
user-mode. This implies that it is mandatory to program the address range and valid permissions in pmpcfg
and pmpaddr registers (refer to the Register Summary) for any valid access to pass through in user-mode.
However, it is not required for machine-mode as PMP permits all accesses to go through by default. In cases
where PMP checks are also required in machine-mode, software can set the lock bit of required PMP entry to
enable permission checks on it. Once the lock bit is set, it can only be cleared through CPU reset.
When any instruction is being fetched from a memory region without execute permissions, an exception is
generated at processor level and exception cause is set as instruction access fault in mcause CSR. Similarly,
any load/store access without valid read/write permissions, will result in an exception generation with mcause
updated as load access and store access fault respectively. In case of load/store access faults, violating
address is captured in mtval CSR.
1.9.2 Features
PMAC supports below features:
Exception generation and handling for PMAC related faults will be handled in similar way to PMP checks. When
any instruction is being fetched from a memory region configured as null or invalid memory region, an
exception is generated at processor level and exception cause is set as instruction access fault in mcause
CSR. Similarly, any load/store access to null or invalid memory region, will result in an exception generation
with mcause updated as load access and store access fault respectively. In case of load/store access faults,
violating address is captured in mtval CSR. For the PMAC entries configured as valid memory, the handling is
same as for PMP checks.
A lock bit per entry is also provided in case software wants to disable programming of PMAC registers. Once
the lock bit in any pma_cfgX register is set, respective pma_cfgX and pma_addrX registers can not be
programmed further, unless a CPU reset cycle is applied.
A 4-bit field in PMAC CSRs is also provided to define attributes for memory regions. These bits are not used
internally by CPU core for any purpose. Based on address match, these attributes are provided on load/store
interface as side-band signals and are used by cache controller block for its internal operation.
TE
se E
ed
ed
PE d
U
re UT
TY rve
IB
EX E
rv
rv
re K
W D
EC
T
TR
se
se
C
A
RI
LO
RE
AT
re
A
31 30 29 28 27 24 23 5 4 3 2 1 0
2 0 0 0 0 0 0 0 0 0 Reset
A Configures address type. The functionality is the same as pmpcfg register’s A field. (R/W)
0x0: OFF
0x1: TOR
0x2: NA4
0x3: NAPOT
LOCK Configures whether to lock the corresponding pma_cfgX and pma_addrX. (R/W)
0: Not locked
1: Locked. The write permission to the corresponding pma_cfgX and pma_addrX is revoked.
It can only be unlocked by core reset.
31 0
0 Reset
1.10 Debug
1.10.1 Overview
This section describes how to debug software running on HP and LP CPU cores. Debug support is provided
through standard JTAG pins and complies to RISC-V External Debug Support Specification Version 0.13.
Figure 1-2 below shows the main components of External Debug Support.
The user interacts with the Debug Host (e.g. laptop), which is running a debugger (e.g. gdb). The debugger
communicates with a Debug Translator (e.g. OpenOCD, which may include a hardware driver) to communicate
with Debug Transport Hardware (e.g. ESP-Prog adapter). The Debug Transport Hardware connects the Debug
Host to the ESP-RISC-V Core’s Debug Transport Module (DTM) through standard JTAG interface. The DTM
provides access to the Debug Module (DM) using the Debug Module Interface (DMI).
The DM allows the debugger to halt selected cores. Abstract commands provide access to GPRs (general
purpose registers). The Program Buffer allows the debugger to execute arbitrary code on the core, which
allows access to additional CPU core state. Alternatively, additional abstract commands can provide access to
additional CPU core state. ESP-RISC-V core contains Trigger Module supporting 4 triggers. When trigger
conditions are met, core will halt spontaneously and inform the debug module that they have halted.
System bus access block allows memory and peripheral register access without using the core.
1.10.2 Features
Basic debug functionality supports below features:
• CPU can be debugged from the first instruction executed after reset.
• Hardware single-stepping.
• Execute arbitrary instructions in the halted CPU by means of the program buffer. 16-word program buffer
is supported.
• Supports four Hardware Triggers (can be used as breakpoints/watchpoints) as described in Section 1.11.
• PAD_to_JTAG : means that the JTAG’s signal source comes from IO.
• USB_to_JTAG : means that the JTAG’s signal source comes from USB Serial/JTAG Controller.
Which JTAG method to use depends on many factors. The following table shows the configuration
method.
Temporary EFUSE_DIS_ EFUSE_DIS_ EFUSE_DIS_ EFUSE_JTAG_ Strapping USB JTAG PAD JTAG
disable USB_JTAG USB_SERIAL_ PAD_JTAG 4 SEL_ENABLE Pin Status Status
JTAG 3,4 4 JTAG 4 4 GPIO15 5
0 0 0 0 0 x2 Available 1 Unavailable 1
0 0 0 0 1 1 Available Unavailable
Temporary EFUSE_DIS_ EFUSE_DIS_ EFUSE_DIS_ EFUSE_JTAG_ Strapping USB JTAG PAD JTAG
disable USB_JTAG USB_SERIAL_ PAD_JTAG 4 SEL_ENABLE Pin Status Status
JTAG 3 4 JTAG 4 4 GPIO15 5
0 0 0 0 1 0 Unavailable Available
0 0 1 0 x x Unavailable Available
0 1 0 0 x x Unavailable Available
0 1 1 0 x x Unavailable Available
0 0 0 1 x x Available Unavailable
0 0 1 1 x x Unavailable Unavailable
0 1 0 1 x x Unavailable Unavailable
0 1 1 1 x x Unavailable Unavailable
1 x x x x x Unavailable Unavailable
Note:
2. x: do not care.
3. ”Temporary disable JTAG” means that if there are an even number of bits ”1” in EFUSE_SOFT_DIS_JTAG[2:0], the
JTAG function is turned on (the corresponding value in the table is 1), otherwise it is turned off (the corresponding
value in the table is 0). However, under certain special conditions of the HMAC Accelerator in ESP32-C6, the
JTAG function may be turned on even if there is an odd number of bits ”1” in EFUSE_SOFT_DIS_JTAG[2:0]. For
information on how HMAC affects JTAG functionality, please refer to Chapter HMAC Accelerator.
4. Please refer to Chapter eFuse Controller to get more information about eFuse.
5. Please refer to Chip Boot Control to get more information about the strapping pin GPIO15.
All the debug module registers are implemented in conformance to the specification RISC-V External Debug
Support Version 0.13. Please refer to it for more details.
er
tim t
op n
e
gv
ed
eb d
op d
ed
st cou
m
re aku
e
st rve
ak
bu
rv
rv
rv
e
ep
us
re
re
se
se
se
se
e
v
xd
eb
pr
ca
st
re
re
re
31 28 27 16 15 14 13 12 11 10 9 8 6 5 3 2 1 0
4 0 0 0 0 0 0 0 0 0 0 0 Reset
ebreakm When 1, ebreak instructions in Machine Mode enter Debug Mode. (R/W)
ebreaku When 1, ebreak instructions in User/Application Mode enter Debug Mode. (R/W)
stopcount This feature is not implemented. Debugger will always read this bit as 0. (RO)
stoptime This feature is not implemented. Debugger will always read this bit as 0. (RO)
cause Explains why Debug Mode was entered. When there are multiple reasons to enter Debug
Mode in a single cycle, the cause with the highest priority number is the one written.
1: An ebreak instruction was executed. (priority 3)
2: The Trigger Module caused a halt. (priority 4)
3: haltreq was set. (priority 2)
4: The CPU core single stepped because step was set. (priority 1)
Other values are reserved for future use.
(RO)
step When set and not in Debug Mode, the core will only execute a single instruction and then
enter Debug Mode.
If the instruction does not complete due to an exception, the core will immediately enter Debug
Mode before executing the trap handler, with appropriate exception registers set.
Setting this bit does not mask interrupts. This is a deviation from the RISC-V External Debug
Support Specification Version 0.13.
(R/W)
prv Contains the privilege level the core was operating in when Debug Mode was entered. A de-
bugger can change this value to change the core’s privilege level when exiting Debug Mode.
Only 0x3 (machine mode) and 0x0 (user mode) are supported. (R/W)
c
dp
31 0
0 Reset
dpc Upon entry to debug mode, dpc is written with the virtual address of the instruction that en-
countered the exception. When resuming, the CPU core’s PC is updated to the virtual address
stored in dpc. A debugger may write dpc to change where the CPU resumes. (R/W)
0
ch
at
cr
ds
31 0
0 Reset
31 0
0 Reset
• each unit can be configured for matching the address of program counter or load-store accesses
To choose a particular trigger unit write the index (0-3) of that unit into tselect CSR. When tselect is written
with a valid index, the abstract CSRs tdata1 and tdata2 are automatically mapped to reflect internal registers of
that trigger unit. Each trigger unit has two internal registers, namely mcontrol and maddress, which are
mapped to tdata1 and tdata2, respectively.
Writing larger than allowed indexes to tselect will clip the written value to the largest valid index, which can be
read back. This property may be used for enumerating the number of available triggers during initialization or
when using a debugger.
Since software or debugger may need to know the type of the selected trigger to correctly interpret tdata1 and
tdata2, the 4 bits (31-28) of tdata1 encodes the type of the selected trigger. This type field is read-only and
always provides a value of 0x2 for every trigger, which stands for match type trigger, hence, it is inferred that
tdata1 and tdata2 are to be interpreted as mcontrol and maddress. The information regarding other possible
values can be found in the specification RISC-V External Debug Support Version 0.13, but this trigger module
only supports type 0x2.
Once a trigger unit has been chosen by writing its index to tselect, it will become possible to configure it by
setting the appropriate bits in mcontrol CSR (tdata1) and writing the target address to maddress CSR
(tdata2).
Each trigger unit can be configured to either cause breakpoint exception or enter debug mode, by writing to
the action field of mcontrol. This bit can only be written from debugger, thus by default a trigger, if enabled,
will cause breakpoint exception.
mcontrol for each trigger unit has a hit bit which may be read, after CPU halts or enters exception, to find out if
this was the trigger unit that fired. This bit is set as soon as the corresponding trigger fires, but it has to be
manually cleared before resuming operation. Although, failing to clear it does not affect normal execution in
any way.
Each trigger unit only supports match on address, although this address could either be that of a load/store
access or the virtual address of an instruction. The address and size of a region are specified by writing to
maddress (tdata2) CSR for the selected trigger unit. Larger than 1 byte region sizes are specified through
NAPOT (naturally aligned power-of-two) encoding (see Table 1-10) and enabled by setting match bit in
mcontrol. Note that for NAPOT encoded addresses, by definition, the start address is constrained to be
aligned to (i.e. an integer multiple of) the region size.
tcontrol CSR is common to all trigger units. It is used for preventing triggers from causing repeated exceptions
in machine-mode while execution is happening inside a trap handler. This also disables breakpoint exceptions
inside ISRs by default, although, it is possible to manually enable this right before entering an ISR, for
debugging purposes. This CSR is not relevant if a trigger is configured to enter debug mode.
When hart goes into trap due to the firing of a trigger (action = 0) :
• mte is set to 0
Note: If two different triggers fire at the same time, one with action = 0 and another with action = 1, then hart
is halted and enters debug mode.
)
ed
rv
t
ec
se
el
(re
ts
30 2 1 0
tselect Configures the index (0-3) of the selected trigger unit. (R/W)
ta
dm
da
ty
31 28 27 26 0
type Represents the trigger type. This field is reserved since only match type (0x2) triggers are
supported. (RO)
data Configures the abstract tdata1 content. This will always be interpreted as fields of mcontrol
since only match type (0x2) triggers are supported. (R/W)
31 0
0x00000000 Reset
tdata2 Configures the abstract tdata2 content. This will always be interpreted as maddress since
only match type (0x2) triggers are supported. (R/W)
)
ed
ed
rv
rv
se
se
e
pt
te
(re
(re
m
m
31 8 7 6 1 0
)
ed
ed
ed
ed
ed
st ute
rv
rv
rv
rv
rv
e
ch
od
se
se
se
se
se
e
tio
ec
ad
or
at
dm
(re
(re
(re
(re
(re
ac
t
ex
m
lo
hi
u
31 28 27 26 21 20 19 16 15 12 11 10 7 6 5 4 3 2 1 0
hit This is found to be 1 if the selected trigger had fired previously. This bit is to be cleared manually.
(R/W)
action Configures the selected trigger to perform one of the available actions when firing. Valid
options are:
0x0: cause breakpoint exception.
0x1: enter debug mode (only valid when dmode = 1)
Note: Writing an invalid value will set this to the default value 0x0.
(R/W)
match Configures the selected trigger to perform one of the available matching operations on a
data/instruction address. Valid options are:
0x0: exact byte match, i.e. address corresponding to one of the bytes in an access must match
the value of maddress exactly.
0x1: NAPOT match, i.e. at least one of the bytes of an access must lie in the NAPOT region
specified in maddress.
Note: Writing a larger value will clip it to the largest possible value 0x1.
(R/W)
m Set this for enabling selected trigger to operate in machine mode. (R/W)
u Set this for enabling selected trigger to operate in user mode. (R/W)
execute Set this for configuring the selected trigger to fire right before an instruction with matching
virtual address is executed by the CPU. (R/W)
store Set this for configuring the selected trigger to fire right before a store operation with matching
data address is executed by the CPU. (R/W)
load Set this for configuring the selected trigger to fire right before a load operation with matching
data address is executed by the CPU. (R/W)
ss
re
d
ad
m
31 0
0x00000000 Reset
maddress Configures the address used by the selected trigger when performing match operation.
This is decoded as NAPOT when match=1 in mcontrol. (R/W)
1.12 Trace
1.12.1 Overview
In order to support non-intrusive software debug, the CPU core provides an instruction trace interface which
provides relevant information for offline debug purpose. This interface provides relevant information to Trace
Encoder block, which compresses the information and stores in memory allocated for it. Software decoders
can read this information from trace memory without interrupting the CPU core and re-generate the actual
program execution by the CPU core.
1.12.2 Features
The CPU core supports instruction trace feature and provides below information to Trace Encoder as
mandated in RISC-V Processor Trace Version 1.0:
• Occurrence of exception and interrupt along with cause and trap values.
• Instruction address for instructions retired before and after program counter changes.
The core does not have any internal registers to provide control over instruction trace interface. All register
controls are available in 2 RISC-V Trace Encoder (TRACE) block.
1.13.2 Features
• Control register to enable or disable cross-trigger between cores
d)
ve
r
n
se
_e
(re
xt
31 1 0
0 0 Reset
1.14 Dedicated IO
1.14.1 Overview
Normally, GPIOs are an APB peripheral, which means that changes to outputs and reads from inputs can get
stuck in write buffers or behind other transfers, and in general are slower because generally the APB bus runs
at a lower speed than the CPU. As an alternative, the CPU core implements I/O processors specific CPU
registers (CSRs) which are directly connected to the GPIO matrix or IO pads. As these registers can get
accessed in one instruction, speed is fast.
1.14.2 Features
• 8 dedicated IOs directly mapped on GPIOs
• GPIO_OUT is R/W and reflects the output value for the GPIOs.
• GPIO_OEN is R/W and reflects the output enable state for the GPIOs. It controls the pad direction.
Programming high would mean the pad should be configured in output mode. Programming low means
it should be configured in input mode.
]
CP GP _O [6]
GP _O [2]
CP _GP _O [3]
CP _GP _O [5]
CP _GP _O [4]
CP _GP _O [7]
EN ]
[0
_O [1
U IO EN
U_ IO EN
U IO EN
U IO EN
U IO EN
U_ IO EN
I O EN
CP GP _O
U_ IO
)
ed
CP _GP
rv
se
U
CP
(re
31 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 Reset
CPU_GPIO_OEN Configures whether to enable GPIOn (n=0 ~ 21) output. CPU_GPIO_OEN[7:0] cor-
respond to output enable signals cpu_gpio_out_oen[7:0] in Table 7-2 Peripheral Signals via
GPIO Matrix. CPU_GPIO_OEN value matches that of cpu_gpio_out_oen. CPU_GPIO_OEN is the
enable signal of CPU_GPIO_OUT.
0: Disable GPIO output
1: Enable GPIO output
(R/W)
0]
CP GP _IN ]
GP _IN ]
CP _GP _IN ]
CP _GP _IN ]
CP _GP _IN ]
CP _GP _IN ]
IO [1]
U_ IO [6
U_ IO [2
U IO [3
U IO [5
U IO [4
U IO [7
N[
CP GP _IN
_I
U_ IO
)
ed
CP _GP
rv
se
U
CP
(re
31 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 Reset
CPU_GPIO_IN Represents GPIOn (n=0 ~ 21) input value. It is a CPU CSR to read input value (1=high,
0=low) from SoC GPIO pin.
CPU_GPIO_IN[7:0] correspond to input signals cpu_gpio_in[7:0] in Table 7-2 Peripheral Signals
via GPIO Matrix.
CPU_GPIO_IN[7:0] can only be mapped to GPIO pins through GPIO matrix. For details please
refer to Section 7.4 in Chapter IO MUX and GPIO Matrix (GPIO, IO MUX).
(RO)
]
CP GP _O [6]
GP _O [2]
CP _GP _O [3]
CP _GP _O [5]
CP _GP _O [4]
CP _GP _O [7]
UT ]
[0
_O [1
U IO UT
U_ IO UT
U IO UT
U IO UT
U IO UT
U_ IO UT
IO UT
CP _GP _O
U IO
)
ed
CP _GP
rv
se
U
CP
(re
31 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 Reset
CPU_GPIO_OUT Configures GPIOn (n=0 ~ 21) output value. It is a CPU CSR to write value (1=high,
0=low) to SoC GPIO pin. The value takes effect only when CPU_GPIO_OEN is set.
CPU_GPIO_OUT[7:0] correspond to output signals cpu_gpio_out[7:0] in Table 7-2 Peripheral
Signals via GPIO Matrix.
CPU_GPIO_OUT[7:0] can only be mapped to GPIO pins through GPIO matrix. For details please
refer to Section 7.5 in Chapter IO MUX and GPIO Matrix (GPIO, IO MUX).
(R/W)
The atomic instructions currently ignore the aq (acquire) and rl (release) bits as they are irrelevant to the
current architecture in which memory ordering is always guaranteed.
The LR.W instruction simply locks a 32-bit aligned memory address to which the load access is being
performed. Once a 4-byte memory region is locked, it will remain locked, i.e. other harts won’t be able to
access this same memory location, until any of the following scenarios is encountered during
execution:
• any interrupts/exceptions
• JALR
• ECALL/EBREAK/MRET/URET
• FENCE/FENCE.I
• debug mode
If any of the above happens, except SC.W, the memory lock will be released immediately. If an SC instruction
is encountered instead, the lock will be released eventually (not immediately) in the manner described in
Section 1.15.2.2.
The SC.W instruction first checks if the memory lock is still valid, and the address is the same as specified
during the last LR.W instruction. If so, only then will it perform the store to memory, and later release the lock
as soon as it gets an acknowledgement of operation completion from the memory.
On the other hand, if the lock is found to have been invalidated (due to any of the situations as described in
Section 1.15.2.1), it will set a fail code (currently always 1) in the destination register rd.
1. Read data from memory address given by rs1, and save it to destination register rd.
2. Combine the data in rd and rs2 according to the operation type and keep the result for Step 3 below.
3. Write the result obtained in Step 2 above to memory address given by rs1.
There are 9 different AMO operations: SWAP, ADD, AND, OR, XOR, MAX, MIN, MAXU and MINU.
During this whole process, the memory address is kept locked from being accessed by other harts. If a
misaligned address is encountered, it will cause an exception with mcause = 6.
For AMO operations both load and store access faults (PMP/PMA) are checked in the 1st step itself. For such
cases mcause = 7.
HP
CPU
APB AHB
Transmission
Config
Control
2.1 Terminology
To better illustrate the functions of the RISC-V Trace Encoder, the following terms are used in this
chapter.
2.2 Introduction
In complex systems, understanding program execution flow is not straightforward. This may be due to a
number of factors, for example, interactions with other cores, peripherals, real-time events, poor
implementations, or some combination of all of the above.
It is hard to use a debugger to monitor the program execution flow of a running system in real time, as this is
intrusive and might affect the running state. But providing visibility of program execution is important.
That is where instruction trace comes in, which provides trace of the program execution.
ESP Chip
Debug Host
Instruction Trace
Interface
JTAG Trace Encoder
DTM
Debug
Translator JTAG/
USB-JTAG adapter
DMI HP CPU Core
BUS
Trace
Decoder System
DM Memory
• The HP CPU core provides an instruction trace interface that outputs the instruction information executed
by the HP CPU. Such information includes instruction address, instruction type, etc. For more details
about ESP32-C6 HP CPU’s instruction trace interface, please refer to Chapter 1 High-Performance CPU.
• The trace encoder connects to the HP CPU’s instruction trace interface and compresses the information
into lower bandwidth packets, and then stores the packets in system memory.
• The debugger can dump the trace packets from the system memory via JTAG or USB Serial/JTAG, and
use a decoder to decompress and reconstruct the program execution flow. The Trace Decoder, usually
software on an external PC, takes in the trace packets and reconstructs the program instruction flow with
the program binary that runs on the originating hart. This decoding step can be done offline or in
real-time while the hart is executing.
This chapter mainly introduces the implementation details of ESP32-C6’s trace encoder.
2.3 Features
• Compatible with RISC-V Processor Trace Version 1.0. See Table 2-2 for the implemented parameters
• Two interrupts:
– Triggered when the packet size exceeds the configured memory space
For detailed descriptions of the above parameters, please refer to the RISC-V Processor Trace Version 1.0 >
Chapter Parameters and Discovery.
The encoder receives HP CPU’s instruction information via the instruction trace interface, compresses it into
different packets, and writes it to the internal FIFO.
The transmission control module writes the data in the FIFO to the internal SRAM through the AHB bus.
The FIFO is 128 deep and 8-bit wide. When the memory bandwidth is insufficient, the FIFO may overflow and
packet loss occurs. If a packet is lost, the encoder will send a packet to tell that a packet is lost, and will stop
working until the FIFO is empty.
You can adjust the trace bandwidth by increasing the value of TRACE_RESYNC_PROLONGED_REG to reduce
the frequency of sending synchronization packets, thereby reducing the bandwidth occupied by
packets.
• The maximum packet length is 13 bytes, so a sequence of at least 14 zero bytes cannot occur within a
packet. Therefore, the first non-zero byte seen after a sequence of at least 14 zero bytes must be the
first byte of a packet.
• Every time when 128 packets are transmitted, the encoder writes 14 zero bytes to the memory partition
boundary as anchor tags.
• Loop mode: When the size of the trace packets exceeds the capacity of the trace memory (namely
when TRACE_MEM_CURRENT_ADDR_REG reaches the value of TRACE_MEM_END_ADDR_REG), the
trace memory is wrapped around, so that the encoder loops back to the memory’s starting address
TRACE_MEM_START_ADDR_REG, and old data in the memory will be overwritten by new data.
• Non-loop mode: When the size of the trace packets exceeds the capacity of the trace memory, the
trace memory is not wrapped around. The encoder stops at TRACE_MEM_END_ADDR_REG, and old
data will be retained.
If the automatic restart feature is enabled, the encoder will be restarted in any case. Therefore, to disable the
encoder, the automatic restart feature must be disabled first by clearing the TRACE_RESTART_ENA bit of the
TRACE_TRIGGER_REG register.
For details about the above features, please refer RISC-V Processor Trace Version 1.0 (referred to below as the
specification).
A packet includes header, index and payload. Header, index and payload are transmitted sequentially in bit
stream form, from the fields listed at the top of tables below to the fields listed at the bottom. If a field consists
of multiple bits, then the least significant bit is transmitted first.
2.6.1 Header
Header is 1-byte long. The format of header is shown in Table 2-3.
2.6.2 Index
Index has 2 bytes. The format of index is shown in Table 2-4.
2.6.3 Payload
The length of payload ranges from 1 byte to 10 bytes.
Format 3 packets are used for synchronization, and report supporting information. There are 4 subformats
defined in the specification. ESP32-C6 only supports 3 of them.
This packet contains all the information the decoder needs to fully identify an instruction. It is sent for the first
traced instruction (unless that instruction also happens to be a first in an exception handler), and when
synchronization has been scheduled by expiry of the synchronization timer. The payload length is 5
bytes.
This packet also contains all the information the decoder needs to fully identify an instruction. It is sent
following an exception or interrupt, and includes the cause, the ’trap value’ (for exceptions), and the address
of the trap handler or of the exception itself. The length is 10 bytes.
This packet provides supporting information to aid the decoder. It is issued when the trace is ended. The
length is 1 byte.
This packet contains only an instruction address, and is used when the address of an instruction must be
reported, and there is no reported branch information. The length is 5 bytes.
This packet includes branch information, and is used when either the branch information must be reported (for
example because the branch map is full), or when the address of instruction must be reported, and there has
must been at least one branch since the previous packet. This packet only supports full address mode.
2.7 Interrupt
• TRACE_MEM_FULL_INTR: Triggered when the packet size exceeds the capacity of the trace memory,
namely when TRACE_MEM_CURRENT_ADDR_REG reaches the value of TRACE_MEM_END_ADDR_REG.
If necessary, this interrupt can be enabled to notify the HP CPU for processing, such as applying for a
new memory space again.
• TRACE_FIFO_OVERFLOW_INTR: Triggered when the internal FIFO overflows and one or more packets
have been lost.
After enabling the trace encoder interrupts, map them to numbered CPU interrupts through the Interrupt
Matrix, so that the HP CPU can respond to these trace encoder interrupts. For details, please refer to Chapter
10 Interrupt Matrix (INTMTX).
• (Optional) Configure the memory writing mode via the TRACE_MEM_LOOP bit of TRACE_TRIGGER_REG
– 0: Non-loop mode
– 1: count by packet
• (Optional) Configures the threshold for the synchronization counter (default value is 128) via
TRACE_RESYNC_PROLONGED_REG
Once the encoder is enabled, it will keep tracing the HP CPU’s instruction trace interface and writing packets
to the trace memory.
• Confirm whether all data in the FIFO have been written into the memory by reading the
TRACE_FIFO_EMPTY bit
* if read 0, and the loop mode is enabled, then the old trace packets are overwritten. In this
case, read the TRACE_MEM_CURRENT_ADDR_REG to know the last writing address, and use
this address as the first address to decode
– The decoder reads all data packets starting from the first address, and reconstructs the data stream
with the binary file
– As mentioned in 2.6, the encoder writes 14 zero bytes to the memory partition boundary every time
when 128 packets are transmitted. Given this fact, the first non-zero byte after 14 zero bytes should
be the header of a new packet
The abbreviations given in Column Access are explained in Section Access Types for Registers.
2.10 Registers
The addresses in this section are relative to RISC-V Trace Encoder base address provided in Table 5-2 in
Chapter 5 System and Memory.
R
DD
_A
RT
TA
_S
EM
M
E_
AC
TR
31 0
0x000000 Reset
31 0
0xffffffff Reset
31 0
0x000000 Reset
AT
UPD
R_
DD
_A
NT
RE
UR
_C
EM
d)
M
ve
E_
r
AC
se
(re
TR
31 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
M US
Y
_E AT
PT
FO ST
FI K_
E_ R
AC WO
)
ed
TR CE_
rv
se
A
(re
TR
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 1 Reset
A
EN
R_
W NA
NT
LO _E
_I
RF TR
VE _IN
_O LL
FO U
FI _F
E_ EM
d)
AC M
ve
TR CE_
r
se
A
(re
TR
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
W
RA
R_
W AW
NT
LO _R
_I
RF TR
VE _IN
_O LL
FO U
FI _F
E_ EM
)
AC M
ed
TR CE_
rv
se
A
(re
TR
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
AC M
ed
TR CE_
rv
se
A
(re
TR
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
E_ IGG OO A
R_ F
ON
AC TR _L N
GE OF
TR E P
TR CE_ EM T_E
IG R_
A M AR
TR E_ ST
AC RE
)
ed
TR CE_
rv
se
A
(re
TR
31 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 Reset
TRACE_RESTART_ENA Configures whether or not to enable the automatic restart function for the
encoder.
0: Disable
1: Enable
(R/W)
RO
M
_P
C_
NC
YN
SY
ES
E
)
ed
_R
_R
rv
E
AC
AC
se
(re
TR
TR
31 25 24 23 0
0 0 0 0 0 0 0 0 128 Reset
N
K _E
CL
d)
ve
E_
r
AC
se
(re
TR
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
TRACE_CLK_EN Configures register clock gating. 0: Support clock only when the application
writes registers to save power.
1: Always force the clock on for registers.
This bit doesn’t affect register access.
(R/W)
E
AT
)
ed
_D
rv
E
AC
se
(re
TR
31 28 27 0
0 0 0 0 0x2203030 Reset
3 Low-Power CPU
The ESP32-C6 Low-Power CPU (LP CPU) is a 32-bit processor based upon RISC-V ISA comprising integer (I),
multiplication/division (M), atomic (A), and compressed (C) standard extensions. It features ultra-low power
consumption and has a 2-stage, in-order, and scalar pipeline. The LP CPU core complex has an interrupt
controller (INTC), a debug module (DM), and system bus (SYS BUS) interfaces for memory and peripheral
access.
The LP CPU is in sleep mode by default (see Section 3.9). It can stay powered on when the chip enters
Deep-sleep mode (see Chapter 12 Low-Power Management for details) and can access most peripherals and
memories (see Chapter 5 System and Memory for details). It has two application scenarios:
• Power insensitive scenario: When the High-Performance CPU (HP CPU) is active, the LP CPU can assist
the HP CPU with some speed- and efficiency-insensitive controls and computations.
• Power sensitive scenario: When the HP CPU is in the power-down state to save power, the LP CPU can
be woken up to handle some external wake-up events.
HP CPU LP CPU
3.1 Features
The LP CPU has the following features:
• 1 vector interrupts
• Debug module compliant with RISC-V External Debug Support Version 0.13 with external debugger
support over an industry-standard JTAG/USB port
• Hardware trigger compliant with RISC-V External Debug Support Version 0.13 with up to 2
breakpoints/watchpoints
⁵Although misa is specified as having both read and write access (R/W), its fields are hardwired and thus write has no effect. This is
what would be termed WARL (Write Any Read Legal) in RISC-V terminology.
⁶mtvec only provides configuration for trap handling in vectored mode with the base address aligned to 256 bytes.
⁷External interrupt IDs reflected in mcause include even those IDs which have been reserved by RISC-V standard for core internal sources.
Note that if write, set, or clear operation is attempted on any of the read-only (RO) CSRs indicated in the above
table, the CPU will generate an illegal instruction exception.
3.2.2 Registers
ID
RT
HA
M
31 0
0x00000001 Reset
)
ed
ed
ed
ed
ed
rv
rv
rv
rv
rv
se
se
se
se
se
E
PP
PI
IE
(re
TW
(re
(re
(re
(re
M
M
31 22 21 20 13 12 11 10 8 7 6 4 3 2 0
MPIE Write 1 to enable the machine previous interrupt (before trap). (R/W)
TW Configures whether to cause illegal instruction exception when WFI (Wait-for-Interrupt) instruc-
tion is executed in User mode.
0: Not cause illegal exception in User mode
1: Cause illegal instruction exception
(R/W)
)
ed
rv
se
XL
(re
M
M
W
O
U
G
N
C
H
B
Z
P
R
V
A
T
Y
E
F
X
J
L
I
31 30 29 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
Z Reserved = 0. (RO)
Y Reserved = 0. (RO)
W Reserved = 0. (RO)
V Reserved = 0. (RO)
T Reserved = 0. (RO)
R Reserved = 0. (RO)
P Reserved = 0. (RO)
O Reserved = 0. (RO)
L Reserved = 0. (RO)
K Reserved = 0. (RO)
J Reserved = 0. (RO)
B Reserved = 0. (RO)
d)
)
ed
IE rve
rv
se
se
(re
(re
31 30 29 0
)
ed
rv
E
se
SE
OD
(re
BA
M
31 8 7 2 1 0
MODE Represents whether machine mode interrupts are vectored. Only vectored mode 0x1 is
available. (RO)
BASE Configures the higher 24 bits of trap vector base address aligned to 256 bytes. (R/W)
31 0
0x00000000 Reset
31 0
0x00000000 Reset
MEPC Configures the machine trap/exception program counter. This is automatically updated with
address of the instruction which was about to be executed while CPU encountered the most
recent trap. (R/W)
de
Co
g
la
)
F
n
ed
io
pt
rv
pt
rru
se
ce
te
(re
Ex
In
31 30 5 4 0
Exception Code This field is automatically updated with unique ID of the most recent exception or
interrupt due to which CPU entered trap. Possible exception IDs are:
0x2: Illegal instruction
0x3: Hardware breakpoint/watchpoint or EBREAK
0x6: Misaligned atomic instructions
Note: Exception ID 0x0 (instruction access misaligned) is not present because CPU always
masks the lowest bit of the address during instruction fetch.
(R/W)
Interrupt Flag This flag is automatically updated when CPU enters trap. If this is found to be set,
it indicates that the latest trap occurred due to an interrupt. For exceptions it remains unset.
(R/W)
31 0
0x00000000 Reset
MTVAL Configures machine trap value. This is automatically updated with an exception dependent
data which may be useful for handling that exception. Data is to be interpreted depending upon
exception IDs:
0x1: Faulting virtual address of instruction
0x2: Faulting instruction opcode
0x5: Faulting data address of load operation
0x7: Faulting data address of store operation
Note: The value of this register is not valid for other exception IDs and interrupts.
(R/W)
d)
)
ed
IP rve
rv
se
se
(re
(re
31 30 29 0
e
cl
cy
m
31 0
0x0 Reset
MCYCLE Configures the lower 32 bits of the clock cycle counter. (R/W)
31 0
0x0 Reset
31 0
0x0 Reset
eh
cl
cy
m
31 0
0x0 Reset
MCYCLEH Configures the higher 32 bits of the clock cycle counter. (R/W)
th
re
st
in
m
31 0
0x0 Reset
31 0
0x0 Reset
d )
CY rve
se
M
(re
HP
IR
31 3 2 1 0
• Saves the current program counter (PC) value to the mepc CSR
– For exceptions, the handler address is the base address of the vector table in the mtvec CSR.
After the mret instruction is executed, the core jumps to the PC saved in the mepc CSR and restores the
value of MPIE of mstatus to MIE of mstatus .
When the core starts up, the base address of the vector table is initialized to the boot address 0x50000000.
After startup, the base address can be changed by writing to the mtvec CSR. For more information about
CSRs, see Section 3.2.1.
3.3.1 Interrupts
The ESP32-C6 LP CPU supports only one interrupt entry, to which all interrupt events jump. The LP CPU
supports the following peripheral interrupt sources:
For more information on those peripheral interrupts, please refer to the corresponding chapter.
1. Enable interrupts
2. After interrupts are enabled, the LP CPU can respond to interrupts. It also needs to configure interrupts
of the peripherals so that they can send an interrupt signal to the LP CPU.
4. After enterring the interrupt handler, users need to read LPPERI_INTERRUPT_SOURCE_REG to get the
peripheral that triggered the interrupt and process the interrupt. Note that if the interrupts are triggered
by multiple peripherals, the CPU will process them one by one in sequence until none is left. If not all
interrupts are processed, the CPU will enter the interrupt handler again.
3.3.3 Exceptions
The LP CPU supports the RISC-V standard exceptions and can trigger the following exceptions:
Exception ID Description
2 Illegal instructions
3 Breakpoints (EBREAK)
6 Misaligned atomic instructions
3.4 Debugging
This section describes how to debug and test the LP CPU. Debug support is provided through standard JTAG
pins and complies with RISC-V External Debug Support Version 0.13.
For ESP32-C6 system debugging overview, please refer to Section 1.10 Debug > Figure 1-2.
The user interacts with the Debug Host (e.g. laptop), which is running a debugger (e.g., gdb). The debugger
communicates with a Debug Translator (e.g. OpenOCD, which may include a hardware driver) to communicate
with Debug Transport Hardware (e.g. ESP-Prog adapter). The Debug Transport Hardware connects the Debug
Host to the CPU’s Debug Transport Module (DTM) through a standard JTAG interface. The DTM provides
access to the debug module (DM) using the Debug Module Interface (DMI).
DM supports multi-core debugging in compliance with the specification RISC-V External Debug Support
Version 0.13, and can control the HP CPU and the LP CPU simultaneously. Hart 1 represents the LP CPU. Users
can use OpenOCD to select a hart (0: HP CPU, 1: LP CPU) for debugging.
The LP CPU implements four registers for core debugging: dcsr, dpc, dscratch0, and dscratch1. All of those
registers can only be accessed from debug mode. If software attempts to access them when the LP CPU is
not in debug mode, an illegal instruction exception will be triggered.
3.4.1 Features
The Low-Power CPU has the following debugging features:
• Hardware single-stepping.
• Two hardware triggers (which can be used as breakpoints/watchpoints). See Section 3.5 for details.
According to the specification, a hart can be in the following states: nonexistent, unavail, running, and halted.
By default, the LP CPU is in the unavail state. To connect the LP CPU for debugging, users need to clear the
state by configuring the LPPERI_CPU_REG register.
All debug module registers are implemented in accordance with the specification RISC-V External Debug
3.4.4 Registers
The following is a detailed description of the debug CSR supported by the LP CPU.
d)
eb ed)
)
ed
ed
gv
ve
(re m
u
rv
rv
rv
ak
ak
bu
e
se
se
se
se
ep
us
re
re
e
v
(re
(re
(re
xd
eb
pr
ca
st
31 28 27 16 15 14 13 12 11 9 8 6 5 3 2 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 0 0 0 1 1 Reset
cause Represents the reason why debug mode was entered. When there are multiple reasons to
enter debug mode in a single cycle, the cause with the highest priority number is the one written.
1: An EBREAK instruction was executed. (priority 3)
2: The Trigger Module caused a halt. (priority 4)
3: haltreq was set. (priority 2)
4: The CPU core single stepped because step was set. (priority 1)
Other values: reserved for future use
(RO)
step When set and not in Debug Mode, the core will only execute a single instruction and then
enter Debug Mode.
If the instruction does not complete due to an exception, the core will immediately enter Debug
Mode before executing the trap handler, with appropriate exception registers set.
Setting this bit does not mask interrupts. This is a deviation from the RISC-V External Debug
Support Specification Version 0.13.
(R/W)
prv Contains the privilege level the core is operating in when debug mode is entered. A debugger
can change this value to change the core’s privilege level when exiting debug mode. Only 0x3
(machine mode) and 0x0 (user mode) are supported. (RO)
c
dp
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
dpc Upon entry to debug mode, dpc is written with the address of the next instruction that will be
executed. When resuming, the CPU core’s PC is updated to the address stored in dpc. In debug
mode, dpc can be modified. This field can be accessed in debug mode. (R/W)
0
ch
at
cr
ds
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
To select a specific trigger unit, the corresponding number (0-1) needs to be written to the tselect CSR. When
a valid value is written, the abstract CSRs, tdata1 and tdata2, automatically match the internal registers of the
trigger unit. Each trigger unit has two internal registers, namely mcontrol and maddress, which are mapped to
tdata1 and tdata2, respectively.
Since software or debugger may need to know the type of the selected trigger to correctly interpret tdata1 and
tdata2, the 4-bit field (31-28) of tdata1 encodes the type of the selected trigger. This type field is read-only
and always provides a value of 0x2 for every trigger, which stands for support for address and data matching.
Hence, it is inferred that tdata1 and tdata2 are to be interpreted as fields of mcontrol and maddress,
respectively. The specification RISC-V External Debug Support Version 0.13 provides information on other
possible values, but the trigger module only supports the 0x2 type.
Once a trigger unit has been chosen by writing its index to tselect, it will become possible to configure it by
setting the appropriate bits in mcontrol CSR (tdata1) and writing the target address to maddress CSR
(tdata2).
• The cause field in dcsr is set to 2, which means halt due to trigger
3.5.5 Registers
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
e
od
pe
ta
dm
da
ty
31 28 27 26 0
0 0 1 0 1 0 x 1 0 4 0 Reset
type Represents the trigger type. This field is reserved since only match type (0x2) triggers are
supported. (RO)
dmode This is set to 1 if a trigger is being used by the debugger. This field is reserved since it is
only supported in debug mode. (RO)
data Configures the abstract tdata1 content. This will always be interpreted as fields of mcontrol
since only match type (0x2) triggers are supported. (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
tdata2 Configures the abstract tdata2 content. This will always be interpreted as maddress since
only match type (0x2) triggers are supported. (R/W)
d)
ed
ax
s rve
st ute
rv
km
ch
tim ct
od
o
se
se
n
in
e
tio
ec
el
ad
le
ai
as
or
at
dm
(re
(re
siz
ch
se
ac
t
ex
m
lo
hi
u
31 28 27 26 21 20 19 18 17 16 15 12 11 10 7 6 5 4 3 2 1 0
sizelo Only match of any size is supported. This field remains 0. (RO)
match Configures the trigger to perform the matching operation of the lower data/instruction ad-
dress.
0x0: Exact match. Namely, the address corresponding to a certain byte during the access must
exactly match the value of maddress.
0x1: NAPOT match. Namely, at least one byte during the access is in the NAPOT region specified
in maddress.
Note: Only exact byte match is supported. This field remains 0.
(R/W)
m Set this field to make the selected trigger operate in machine mode. (RO)
S Set this field to make the selected trigger operate in supervisor mode. Operation in supervisor
mode is not supported. This field is always 0. (RO)
U Set this field to make the selected trigger operate in user mode. Operation in user mode is not
supported. This field is always 0. (RO)
execute Configures whether to enable the selected trigger to match the virtual address of instruc-
tions.
0: Not enable
1: Enable
(R/W)
store Set this field to make the selected trigger match the virtual address of the memory write
operation. Not supported by hardware. This field is always 0. (RO)
load Set this field to make the selected trigger match the virtual address of a memory read operation.
Not supported by hardware. This field is always 0. (RO)
31 0
0x00000000 Reset
maddress Configures the address used by the selected trigger when performing match operation.
(R/W)
By default, all counters are enabled after reset. A counter can be enabled or disabled individually via the
corresponding bit in the mcountinhibit CSR.
• LP SRAM: 16 KB starting from 0x5000_0000 to 0x5000_3FFF, where you can fetch instructions, read
data, write data, etc.
• HP SRAM: 512 KB starting from 0x4080_0000 to 0x4087_FFFF, where you can fetch instructions, read
data, write data, etc.
Note:
The LP CPU has a high latency to access the HP SRAM, but can access the LP SRAM with no latency.
The LP CPU supports the atomic instruction set. Both the LP CPU and the HP CPU can access memory
through atomic instructions, thus achieving atomicity of memory access. For details on the atomic instruction
set, please refer to RISC-V Instruction Set Manual Volume I: Unprivileged ISA, Version 2.2.
• Able to actively configure registers to enter the sleep status based on software operating status
• Wake-up events:
– ETM events
3.9.2 Process
The LP CPU is in sleep by default and its wake-up module follows the process below to wake it up for work
and make it sleep.
stall PMU_LP_CPU_SLP_STALL_EN == 1
Stall stall unstall
unstall PMU_LP_CPU_SLP_STALL_EN == 0
disable PMU_LP_CPU_SLP_BYPASS_INTR_EN == 1
Interrupt disable enable
enable PMU_LP_CPU_SLP_BYPASS_INTR_EN == 0
enable PMU_LP_CPU_SLP_RESET_EN == 1
Reset enable disable
disable PMU_LP_CPU_SLP_RESET_EN == 0
PMU_LP_CPU_SLP_STALL_WAIT
The first startup of the LP CPU after power-up depends on the wake-up enable and wake-up source
configuration by the HP CPU.
– Start the LP CPU. Since the startup of the LP CPU depends on the wake-up process, it is
recommended to use the PMU_HP_TRIGGER_LP register to start the initialization of the LP CPU in
the following way:
• Wake-up process:
– The wake-up module receives a wake-up signal and sends a power-up request to the PMU.
– If the current power consumption state (clock, power supply, etc.) meets the requirements of the
LP CPU, the PMU will immediately reply with the completion signal. Otherwise, it will adjust the
power consumption state before replying with the completion signal.
– The wake-up module disables the STALL state of the LP CPU and enables interrupt receiving.
– The wake-up module starts the clock, releases reset (ignore this step if reset is not enabled for
sleep), and starts working.
• Sleep process:
– The LP CPU configures the register PMU_LP_CPU_SLEEP_REQ to enable the wake-up module to
start the sleep process.
– If PMU_LP_CPU_SLP_STALL_EN is 1, the wake-up module enables the STALL state of the LP CPU. If
it is 0, the module does not enable that state.
– The wake-up module waits for PMU_LP_CPU_SLP_STALL_WAIT LP CPU clock cycles, and then
turns off the LP CPU clock. If PMU_LP_CPU_SLP_RESET_EN is 1, the module enables reset of the
LP CPU.
3.11 Registers
The addresses in this section are relative to Low-Power Peripheral base address provided in Table 5-2 in
Chapter 5 System and Memory.
E
BL
IA
AL
AV
N
_U
M
BG
_D
RE
CO
P
d)
_L
ve
RI
r
se
PE
(re
LP
31 30 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 0 0 0 0 0 0 Reset
CE
O UR
_S
PT
RU
ER
NT
_I
LP
)
ed
I_
rv
ER
se
P
(re
LP
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 0x0 Reset
4.1 Overview
General Direct Memory Access (GDMA) is a feature that allows peripheral-to-memory, memory-to-peripheral,
and memory-to-memory data transfer at high speed. The CPU is not involved in the GDMA transfer and
therefore is more efficient with less workload.
The GDMA controller in ESP32-C6 has six independent channels, i.e. three transmit channels and three
receive channels. These six channels are shared by peripherals with the GDMA feature, and can be assigned
to any of such peripherals, including SPI2, UHCI (UART0/UART1), I2S, AES, SHA, ADC, and PARLIO. UART0 and
UART1 use UHCI together.
The GDMA controller uses fixed-priority and round-robin channel arbitration schemes to manage peripherals’
needs for bandwidth.
Rx channel 0 SPI2
I2S
Rx channel 1
AES
Tx channel 1
SHA
Rx channel 2
ADC
Tx channel 2 PARLIO
4.2 Features
The GDMA controller has the following features:
4.3 Architecture
In ESP32-C6, all modules that need high-speed data transfer support GDMA. The GDMA controller and CPU
data bus have access to the same address space in internal RAM. Figure 4-2 shows the basic architecture of
the GDMA controller.
GDMA Controller
Rx Channel 0 Peri 0
Tx Channel 0 Peri 1
Internal Rx Channel 1
RAM Peri Peri 2
Arbiter
Select
Tx Channel 1
Rx Channel 2
Tx Channel 2 Peri n
The GDMA controller has six independent channels, i.e. three transmit channels and three receive channels.
Every channel can be connected to different peripherals. In other words, channels are general-purpose,
shared by peripherals.
The GDMA controller reads data from or writes data to internal RAM via AHB_BUS. Before this, the GDMA
controller uses fixed-priority arbitration scheme for channels requesting read or write access. For available
address range of Internal RAM, please see Chapter 5 System and Memory.
Software can use the GDMA controller through linked lists. These linked lists, stored in internal RAM, consist of
outlinkn and inlinkn, where n indicates the channel number (ranging from 0 to 2). The GDMA controller reads
an outlinkn (i.e. a linked list of transmit descriptors) from internal RAM and transmits data in corresponding
RAM according to the outlinkn, or reads an inlinkn (i.e. a linked list of receive descriptors) and stores received
data into specific address space in RAM according to the inlinkn.
Figure 4-3 shows the structure of a linked list. An outlink and an inlink have the same structure. A linked list is
formed by one or more descriptors, and each descriptor consists of three words. Linked lists should be in
internal RAM for the GDMA controller to be able to use them. The meanings of a descriptor’s fields are as
follows:
• owner (DW0) [31]: Specifies who is allowed to access the buffer that this descriptor points to.
0: CPU can access the buffer.
1: The GDMA controller can access the buffer.
When the GDMA controller stops using the buffer, this bit in a receive descriptor is automatically cleared
by hardware, and this bit in a transmit descriptor can only be automatically cleared by hardware if
GDMA_OUT_AUTO_WRBACK_CHn is set to 1. Software can disable automatic clearing by hardware by
setting GDMA_OUT_LOOP_TEST_CHn or GDMA_IN_LOOP_TEST_CHn bit. When software loads a linked
list, this bit should be set to 1.
Note: GDMA_OUT is the prefix of transmit channel registers, and GDMA_IN is the prefix of receive
channel registers.
• reserved (DW0) [29]: Reserved. Value of this bit does not matter.
• err_eof (DW0) [28]: Specifies whether the received data has errors.
0: The received data does not have errors.
1: The received data has errors.
This bit is used only when UHCI or PARLIO uses GDMA to receive data. When an error is detected in the
received data segment corresponding to a descriptor, this bit in the receive descriptor is set to 1 by
hardware.
• length (DW0) [23:12]: Specifies the number of valid bytes in the buffer that this descriptor points to. This
field in a transmit descriptor is written by software and indicates how many bytes can be read from the
buffer; this field in a receive descriptor is written by hardware automatically and indicates how many valid
bytes have been stored into the buffer.
• size (DW0) [11:0]: Specifies the size of the buffer that this descriptor points to.
• buffer address pointer (DW1): Address of the buffer. This field can only point to internal RAM.
• next descriptor address (DW2): Address of the next descriptor. If the current descriptor is the last one,
this value is 0. This field can only point to internal RAM.
If the length of data received is smaller than the size of the buffer, the GDMA controller will not use available
space of the buffer in the next transaction.
Every transmit and receive channel can be connected to any peripheral with GDMA feature. Table 4-1 illustrates
how to select the peripheral to be connected via registers. “Dummy-n” corresponds to register values for
memory-to-memory data transfer. When a channel is connected to a peripheral, the rest channels cannot be
connected to that peripheral.
GDMA_PERI_IN_SEL_CHn
Peripheral
GDMA_PERI_OUT_SEL_CHn
0 SPI2
1 Dummy-1
2 UHCI
3 I2S
4 Dummy-4
5 Dummy-5
6 AES
7 SHA
8 ADC
9 PARLIO
10 ~ 15 Dummy-10 ~ 15
16 ~ 63 Invalid
In some cases, you may want to append more descriptors to a DMA transfer that is already started. Naively, it
would seem to be possible to do this by clearing the EOF bit of the final descriptor in the existing list and
setting its next descriptor address pointer field (DW2) to the first descriptor of the to-be-added list. However,
this strategy fails if the existing DMA transfer is almost or entirely finished. Instead, the GDMA controller has
specialized logic to make sure a DMA transfer can be continued or restarted: if the transfer is ongoing, the
controller will make sure to take the appended descriptors into account; if the transfer has already finished,
the controller will restart with the new descriptors. This is implemented by the Restart function.
When using the Restart function, software needs to rewrite address of the first descriptor in the new list to
DW2 of the last descriptor in the loaded list, and set GDMA_INLINK_RESTART_CHn bit or
GDMA_OUTLINK_RESTART_CHn bit (these two bits are cleared automatically by hardware). As shown in Figure
4-4, by doing so hardware can obtain the address of the first descriptor in the new list when reading the last
descriptor in the loaded list, and then read the new list.
• Buffer address pointer (DW1) check. If the buffer address pointer points to 0x40800000 ~ 0x4087FFFF
(please refer to Section 4.4.7), it passes the check. Otherwise it fails the check.
After software detects a descriptor error interrupt, it must reset the corresponding channel, and enable GDMA
by setting GDMA_OUTLINK_START_CHn or GDMA_INLINK_START_CHn bit.
Note: The third word (DW2) in a descriptor can only point to a location in internal RAM, given that the third
word points to the next descriptor to use and that all descriptors must be in internal memory.
4.4.6 EOF
The GDMA controller uses EOF (end of frame) flags to indicate the end of data segment transfer
corresponding to a specific descriptor.
Before the GDMA controller transmits data, GDMA_OUT_TOTAL_EOF_CHn_INT_ENA bit should be set to enable
GDMA_OUT_TOTAL_EOF_CHn_INT interrupt. If data in the buffer pointed by the last descriptor (with EOF) has
been transmitted, a GDMA_OUT_TOTAL_EOF_CHn_INT interrupt is generated.
Before the GDMA controller receives data, GDMA_IN_SUC_EOF_CHn_INT_ENA bit should be set to enable
GDMA_IN_SUC_EOF_CHn_INT interrupt. If a data segment with an EOF flag has been received successfully, a
GDMA_IN_SUC_EOF_CHn_INT interrupt is generated. In addition, when GDMA channel is connected to UHCI
or PARLIO, the GDMA controller also supports GDMA_IN_ERR_CHn_EOF_INT interrupt. This interrupt is
enabled by setting GDMA_IN_ERR_EOF_CHn_INT_ENA bit, and it indicates that a data segment corresponding
to a descriptor has been received with errors.
Note: In this chapter, EOF of transmit descriptors refers to suc_eof, while EOF of receive descriptors refers to
both suc_eof and err_eof.
is enabled for receive channels by setting GDMA_IN_DATA_BURST_EN_CHn, and enabled for transmit
channels by setting GDMA_OUT_DATA_BURST_EN_CHn.
Table 4-2 lists the requirements for descriptor field alignment when accessing internal RAM.
When burst mode is disabled, size, length, and buffer address pointer in both transmit and receive descriptors
do not need to be word-aligned. That is, for a descriptor, GDMA can read data of specified length (1 ~ 4095
bytes) from any start addresses in the accessible address range, or write received data of the specified length
(1 ~ 4095 bytes) to any contiguous addresses in the accessible address range.
When burst mode is enabled, size, length, and buffer address pointer in transmit descriptors are also not
necessarily word-aligned. However, size and buffer address pointer in receive descriptors except length
should be word-aligned.
4.4.8 Arbitration
To ensure timely response to peripherals running at a high speed with low latency (such as SPI), the GDMA
controller implements a fixed-priority channel arbitration scheme. That is to say, each channel can be
assigned a priority from 0 ~ 5 (in total 6 levels). The larger the number, the higher the priority, and the more
timely the response. When several channels are assigned the same priority, the GDMA controller adopts a
round-robin arbitration scheme.
Note:
Above ETM tasks can achieve the same functions as CPU configuring GDMA_INLNIK_START_CHn and GDMA_OUTLINK_START_CHn.
When GDMA_IN_ETM_EN_CHn or GDMA_OUT_ETM_EN_CHn is 1, only ETM tasks can be used to configure the transfer
direction and enable the corresponding GDMA channel. When GDMA_IN_ETM_EN_CHn or GDMA_OUT_ETM_EN_CHn
is 0, only CPU can be used to enable the corresponding GDMA channel.
• GDMA_EVT_IN_DONE_CHn: Indicates that the data has been received according to the receive
descriptor via channel n.
• GDMA_EVT_IN_SUC_EOF_CHn: Indicates that the data corresponding to a receive descriptor has been
received via channel n and the EOF bit of this descriptor is 1.
• GDMA_EVT_OUT_DONE_CHn: Indicates that the data has been transmitted according to the transmit
descriptor via channel n.
• GDMA_EVT_OUT_TOTAL_EOF_CHn: Indicates that the data corresponding to the last transmit descriptors
has been sent via transmit channel n and the EOF bit of this descriptor is 1.
In practical applications, GDMA’s ETM events can trigger its own ETM tasks. For example, the
GDMA_EVT_OUT_TOTAL_EOF_CH0 event can trigger the GDMA_TASK_IN_START_CH1 task, and in this way
trigger a new round of GDMA operations.
• GDMA_IN_DSCR_EMPTY_CHn_INT: Triggered when the size of the buffer pointed by receive descriptors
is smaller than the length of data to be received via receive channel n.
• GDMA_OUT_DONE_CHn_INT: Triggered when all data corresponding to a transmit descriptor has been
sent via transmit channel n.
• GDMA_IN_SUC_EOF_CHn_INT: Triggered when the suc_eof bit in a receive descriptor is 1 and the data
corresponding to this receive descriptor has been received via receive channel n.
• GDMA_IN_DONE_CHn_INT: Triggered when all data corresponding to a receive descriptor has been
received via receive channel n.
1. Set GDMA_OUT_RST_CHn first to 1 and then to 0, to reset the state machine of GDMA’s transmit channel
and FIFO pointer.
2. Load an outlink, and configure GDMA_OUTLINK_ADDR_CHn with address of the first transmit descriptor.
5. Configure and enable the corresponding peripheral (SPI2, UHCI (UART0 or UART1), I2S, AES, SHA, and
ADC). See details in individual chapters of these peripherals.
6. Wait for GDMA_OUT_TOTAL_EOF_CHn_INT interrupt, which indicates the completion of data transfer.
1. Set GDMA_IN_RST_CHn first to 1 and then to 0, to reset the state machine of GDMA’s receive channel
and FIFO pointer.
2. Load an inlink, and configure GDMA_INLINK_ADDR_CHn with address of the first receive descriptor.
5. Configure and enable the corresponding peripheral (SPI2, UHCI (UART0 or UART1), I2S, AES, SHA, and
ADC). See details in individual chapters of these peripherals.
1. Set GDMA_OUT_RST_CHn first to 1 and then to 0, to reset the state machine of GDMA’s transmit channel
and FIFO pointer.
2. Set GDMA_IN_RST_CHn first to 1 and then to 0, to reset the state machine of GDMA’s receive channel
and FIFO pointer.
3. Load an outlink, and configure GDMA_OUTLINK_ADDR_CHn with address of the first transmit descriptor.
4. Load an inlink, and configure GDMA_INLINK_ADDR_CHn with address of the first receive descriptor.
The abbreviations given in Column Access are explained in Section Access Types for Registers.
4.8 Registers
The addresses in this section are relative to GDMA base address provided in Table 5-2 in Chapter 5 System
and Memory.
RA AW
ON OF H0 IN T_
IN T_ W
GD A_ _ER R_E PT INT AW
A_ S E _ H W
0_ _IN RA
_D _E C 0_ IN
M IN_ R_ RR Y_C _RA
T_ R
W
M IN C M _ _R
IN UC OF_ CH 0_
GD A_ _DS R_E CH0 INT
M IN C F_ _
GD A_ _DS OV CH0
M IN O_ F_
GD A_ FIF UD
M IN O_
GD A_ IF
M INF
)
ed
GD A _
rv
se
M
GD
(re
31 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
E_ _C _IN T_S T
ON OF H0 IN T_S
CH H0 T_ T
T_ ST
0_ _IN ST
_D _E C 0_ IN
GD A_ _ER R_E PT INT T
M IN_ R_ RR Y_C _ST
M IN C M _ _S
IN UC OF_ CH 0_
IN T_
ST
GD A_ _DS R_E CH0 INT
A_ S E _ H
M IN C F_ _
GD A_ _DS OV CH0
M IN O_ F_
GD A_ FIF UD
M IN O_
GD A_ IF
M INF
d)
ve
GD A_
r
se
M
GD
(re
31 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
EN NA
IN T_ A
GD A_ _ER R_E PT INT NA
A_ S E _ H A
0_ _IN EN
_D _E C 0_ IN
M IN_ R_ RR Y_C _EN
T_ E
A
M IN C M _ _E
IN UC OF_ CH 0_
GD A_ _DS R_E CH0 INT
M IN C F_ _
GD A_ _DS OV CH0
M IN O_ F_
GD A_ FIF UD
M IN O_
GD A_ FIF
)
ed
M IN
GD A _
rv
se
M
GD
(re
31 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
E_ _C _IN T_C LR
ON OF H0 IN T_C
CH H0 T_ LR
CL LR
IN T_ R
GD A_ _ER R_E PT INT LR
A_ S E _ H R
0_ _IN CL
_D _E C 0_ IN
T_ C
M IN_ R_ RR Y_C _CL
R
M IN C M _ _C
IN UC OF_ CH 0_
GD A_ _DS R_E CH0 INT
M IN C F_ _
GD A_ _DS OV CH0
M IN O_ F_
GD A_ FIF UD
M IN O_
GD A_ IF
M INF
d)
ve
GD A_
r
se
M
GD
(re
31 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
H0 _R NT_ W
W
_C INT _I RA
_I AW RA
OU EO _E F_C NT AW
DO CH _C _I W
T_ F_ RR H0 _RA
NE 0_ H0 NT_
AW
A_ T_ CR O _I R
M OU DS _E H0 T_
_R
GD A_ T_ TAL _C _IN
NT
M OU O VF H0
GD A_ T_T _O F_C
M OU IFO D
GD A_ TF _U
M OU IFO
GD A _ TF
M OU
d)
ve
GD A _
r
se
M
GD
(re
31 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
_C INT _I ST
_I T ST
OU EO _E F_C NT T
NE 0_ H0 NT_
T_ F_ RR H0 _ST
H0 _S NT_
A_ T_ CR O _I S
M OU DS _E H0 T_
T
DO CH _C _I
_S
GD A_ T_ TAL _C _IN
NT
M OU O VF H0
GD A_ T_T _O F_C
M OU IFO D
GD A_ TF _U
M OU IFO
GD A _ TF
M OU
d)
ve
GD A _
r
se
M
GD
(re
31 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
H0 _E NT_ A
A
_C INT _I EN
_I NA EN
OU EO _E F_C NT NA
DO CH _C _I A
T_ F_ RR H0 _EN
NE 0_ H0 NT_
A_ T_ CR O _I E
NA
M OU DS _E H0 T_
_E
GD A_ T_ TAL _C _IN
NT
M OU O VF H0
GD A_ T_T _O F_C
M OU IFO D
GD A_ TF _U
M OU IFO
GD A _ TF
M OU
d)
ve
GD A _
r
se
M
GD
(re
31 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
H0 _C NT_ R
R
_C INT _I CL
_I LR CL
OU EO _E F_C NT LR
DO CH _C _I R
NE 0_ H0 NT_
T_ F_ RR H0 _CL
A_ T_ CR O _I C
LR
M OU DS _E H0 T_
_C
GD A_ T_ TAL _C _IN
NT
M OU O VF H0
GD A_ T_T _O F_C
M OU IFO D
GD A_ TF _U
M OU IFO
GD A_ TF
M OU
)
ed
GD A _
rv
se
M
GD
(re
31 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
E
DR
OD
AD
M
ST
ST
rv _TE
TE
B_
B
d)
)
(re AH
AH
ed
ve
A_
A_
r
se
se
M
M
GD
GD
(re
31 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 0 0 Reset
ER
NT
S
_I
DI
ST
I_
_R
M d ) PR
se AR EN
BM
GD rve B_
(re A_ K_
)
AH
M CL
ed
GD A_
A_
rv
se
M
GD
(re
31 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
GDMA_AHBM_RST_INTER Write 1 and then 0 to reset the internal AHB FSM. (R/W)
_C ST N H0
H0 H0
ST TE _E _C
IN OO UR _E 0
H0 _C _C
A_ L B ST H
_R P_ ST N
M IN_ R_ UR _C
M IN TA S 0
GD A_ DSC _B _EN
GD A_ _DA RAN CH
M IN _T N_
GD A_ EM _E
M M M
GD A_ ET
M IN_
d)
ve
GD A _
r
se
M
GD
(re
31 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
GDMA_IN_RST_CHn Write 1 and then 0 to reset GDMA channel 0 RX FSM and RX FIFO pointer.(R/W)
0
CH
R_
NE
W
_O
CK
HE
_C
)
d)
ed
IN
ve
A_
rv
r
se
se
M
GD
(re
(re
31 13 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
GDMA_IN_CHECK_OWNER_CHn Configures whether or not to enable owner bit check for RX chan-
nel n.
0: Disable
1: Enable
(R/W)
H0
0
_C
H
_C
TA
OP
DA
_P
_R
FO
FO
FI
FI
)
ed
IN
IN
A_
A_
rv
se
M
GD
GD
(re
31 13 12 11 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x800 Reset
0
CH
NK TO C 0
LI S T_ H
T_
_A P_ H0
IN K_ AR T_C
0
M INL K_S STA H0
O_ 0
CH
RE
UT CH
GD A_ LIN RE _C
A _ IN T R
R_
M IN K_ RK
DD
GD A_ LIN PA
_A
M IN K_
NK
GD A_ IN
LI
M INL
d)
IN
ve
GD A_
A_
r
se
M
GD
GD
(re
31 25 24 23 22 21 20 19 0
0 0 0 0 0 0 0 1 0 0 0 1 0x000 Reset
GDMA_INLINK_ADDR_CHn Represents the lower 20 bits of the first receive descriptor’s address.
(R/W)
OU LO _W _C _C n
T_ OP RB Hn Hn
A_ T_ TO DE EN H
n CH Hn
M OU AU O T_ _C
CH T_ _C
GD A_ T_ F_M RS EN
n
T_ ES K
M OU EO BU T_
M OU SC B Hn
RS _T AC
GD A_ T_ R_ URS
GD A_ TD TA_ _C
M OU DA EN
GD A_ T_ M_
M OU ET
GD A_ T_
M OU
)
ed
GD A_
rv
se
M
GD
(re
31 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 Reset
GDMA_OUT_RST_CHn Configures the reset state of GDMA channel n TX FSM and TX FIFO pointer.
0: Release reset
1: Reset
(R/W)
0
CH
R_
NE
OW
K_
EC
CH
T_
OU
d)
d)
ve
ve
A_
r
r
se
se
M
GD
(re
(re
31 13 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
0
0
H
CH
_C
H_
TA
DA
US
W
P
O_
O_
IF
IF
TF
TF
OU
OU
)
ed
A_
A_
rv
se
M
GD
GD
(re
31 10 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 0x0 Reset
GDMA_OUTFIFO_WDATA_CHn Represents the data that need to be pushed into GDMA FIFO. (R/W)
OP CH 0
ST T_ H
_C 0
K_ R _C
0
TL K_ STA H0
H0
H
IN STA RT
_C
OU IN RE _C
DR
A _ TL _ K
M OU INK AR
AD
GD A_ TL K_P
K_
M OU IN
IN
GD A_ TL
TL
M OU
OU
d)
ve
GD A_
A_
r
se
M
GD
GD
(re
31 24 23 22 21 20 19 0
0 0 0 0 0 0 0 0 1 0 0 0 0x000 Reset
GDMA_OUTLINK_ADDR_CHn Represents the lower 20 bits of the first transmit descriptor’s address.
(R/W)
31 0
0x2202250 Reset
_C 0
DE 2B H0
UN ER_ _C 0
H0
1B H
N_ D 3B H
R_ _C
AI UN R_ _C
EM IN_ DE 4B
IN EM _ DE 0
A_ R AIN N H
_R A UN R_
L _ H0
M IN_ M _U Y_C
0
0
UL Y_C
CH
GD A_ _RE AIN GR
H
_C
_F PT
M IN M N
NT
GD A_ _RE _HU
FI EM
_C
IN O_
M IN F
FO
FO
GD A_ _BU
A_ IF
FI
M INF
)
d)
ed
M IN
IN
ve
GD A_
A_
GD A_
rv
r
se
se
M
M
GD
GD
GD
(re
(re
31 28 27 26 25 24 23 22 8 7 2 1 0
0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 Reset
GDMA_INFIFO_CNT_CHn Represents the number of data bytes in L1 RX FIFO for RX channel n. (RO)
0
CH
0
R_
CH
DD
E_
A
AT
H0
R_
ST
SC
_C
R_
_D
TE
C
TA
NK
DS
_S
LI
_
d)
IN
IN
IN
ve
A_
A_
A_
r
se
M
GD
GD
GD
(re
31 23 22 20 19 18 17 0
0 0 0 0 0 0 0 0 0 0 0 0 Reset
GDMA_INLINK_DSCR_ADDR_CHn Represents the lower 18 bits of the next receive descriptor ad-
dress that is pre-read (but not processed yet). If the current receive descriptor is the last de-
scriptor, then this field represents the address of the current receive descriptor. (RO)
0
CH
R_
DD
_A
ES
_D
OF
_E
UC
_S
IN
A_
M
GD
31 0
0x000000 Reset
0
CH
R_
A DD
S_
DE
F_
EO
R_
_ ER
IN
A_
M
GD
31 0
0x000000 Reset
H0
_C
CR
DS
K_
N
LI
IN
A_
M
GD
31 0
0 Reset
GDMA_INLINK_DSCR_CHn Represents the address of the next receive descriptor x+1 pointed by
the current receive descriptor that is pre-read. (RO)
31 0
0 Reset
0
CH
F 1_
_B
SCR
K _D
IN
L
IN
A_
M
GD
31 0
0 Reset
GDMA_INLINK_DSCR_BF1_CHn Represents the address of the previous receive descriptor x-1 that
is pre-read. (RO)
H0
1B H
N_ D 3B H
R_ _C
AI N _ C
M _U ER B_
RE IN ND _4
_C 0
T_ MA _U ER
LL CH
H0
0
OU RE IN ND
FU TY_
CH
A_ T_ A U
T_
O_ P
M OU REM IN_
IF EM
N
_C
GD A_ T_ MA
TF O_
FO
M OU RE
OU IF
FI
A_ TF
GD A_ T_
T
M OU
OU
M U
)
)
ed
ed
O
GD A_
A_
GD A_
rv
rv
se
se
M
M
GD
GD
GD
(re
(re
31 27 26 25 24 23 22 8 7 2 1 0
0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 Reset
0
CH
R_
0
CH
DD
E_
_A
AT
0
CR
CH
ST
S
E_
R_
_D
AT
SC
NK
ST
LI
T_
T_
T
OU
OU
OU
)
ed
A_
A_
A_
rv
se
M
GD
GD
GD
(re
31 23 22 20 19 18 17 0
0 0 0 0 0 0 0 0 0 0 0 0 Reset
31 0
0x000000 Reset
0
CH
R_
DD
A
S_
DE
R_
BF
F_
EO
T_
OU
A_
M
GD
31 0
0x000000 Reset
H 0
_C
CR
DS
K_
IN
TL
OU
A_
M
GD
31 0
0 Reset
GDMA_OUTLINK_DSCR_CHn Represents the address of the next transmit descriptor y+1 pointed
by the current transmit descriptor that is pre-read. (RO)
31 0
0 Reset
0
CH
1_
F
_B
S CR
_D
K
IN
TL
OU
A_
M
GD
31 0
0 Reset
H0
_C
RI
_P
)
RX
ed
A_
rv
se
M
GD
(re
31 4 3 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
TX
ed
A_
rv
se
M
GD
(re
31 4 3 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
0
CH
L_
SE
N_
_I
RI
d)
PE
ve
A_
r
se
M
GD
(re
31 6 5 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x3f Reset
H0
_C
EL
_S
UT
_O
RI
d)
PE
ve
A_
r
se
M
GD
(re
31 6 5 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x3f Reset
5.1 Overview
ESP32-C6 is an ultra-low power and highly-integrated system that integrates:
• a high-performance 32-bit RISC-V single-core processor (HP CPU), four-stage pipeline, clock frequency
up to 160 MHz
• a low-power 32-bit RISC-V single-core processor (LP CPU), two-stage pipeline, clock frequency up to
20 MHz
All internal memory, external memory, and peripherals are located on the HP CPU and LP CPU buses.
5.2 Features
• Address Space
– 832 KB of internal memory address space accessed from the instruction bus or data bus
– 16 MB of external memory virtual address space accessed from the instruction bus or the data bus
• Internal Memory
– 512 KB HP SRAM
– 16 KB LP SRAM
• External Memory
• Peripheral Space
– 51 modules/peripherals in total
• GDMA
– 8 GDMA-supported modules/peripherals
Note:
• The range of addresses available in the address space may be larger than the actual available memory of a
particular type.
Both data bus and instruction bus of the HP CPU and LP CPU are little-endian. The HP CPU and LP CPU can
access data via the data bus using single-byte, double-byte, and 4-byte alignment.
• directly access the internal memory via both data bus and instruction bus.
• (for HP CPU only) directly access the external memory which is mapped into the address space via
cache.
Table 5-1 lists the address ranges on the data bus and instruction bus and their corresponding target
memories.
Boundary Address
Bus Type Size Target
Low Address High Address
0x0000_0000 0x3FFF_FFFF Reserved
Data/Instruction bus 0x4000_0000 0x4004_FFFF 320 KB ROM*
0x4005_0000 0x407F_FFFF Reserved
Data/Instruction bus 0x4080_0000 0x4087_FFFF 512 KB HP SRAM*
0x4088_0000 0x41FF_FFFF Reserved
Data/Instruction bus 0x4200_0000 0x42FF_FFFF 16 MB External memory
0x4300_0000 0x4FFF_FFFF Reserved
Data/Instruction bus 0x5000_0000 0x5000_3FFF 16 KB LP SRAM*
0x5000_4000 0x5FFF_FFFF Reserved
Data/Instruction bus 0x6000_0000 0x600C_FFFF 832 KB Peripherals
0x600D_0000 0xFFFF_FFFF Reserved
* All of the internal memories are managed by Permission Control module. An internal
memory can only be accessed when it is allowed by Permission Control, then the in-
ternal memory can be available to the HP CPU and LP CPU. For more information about
Permission Control, please refer to Chapter 16 Permission Control (PMS).
• ROM (320 KB): The ROM is a read-only memory and can not be programmed. It contains the ROM code
of some low-level system software and read-only data.
• HP SRAM (512 KB): The HP SRAM is a volatile memory that can be quickly accessed by the HP CPU or
LP CPU (generally within a single HP CPU clock cycle for HP CPU).
• LP SRAM (16 KB): LP SRAM is also a volatile memory, however, in Deep-sleep mode, data stored in the
LP SRAM will not be lost. The LP SRAM can be accessed by the HP CPU or LP CPU and is usually used
to store program instructions and data that need to be kept in sleep mode.
1. ROM
This 320 KB ROM is a read-only memory, addressed by the HP CPU through the instruction bus or through the
data bus via 0x4000_0000 ~ 0x4004_FFFF, as shown in Table 5-1.
2. HP SRAM
This 512 KB HP SRAM is a read-and-write memory, accessed by the HP CPU or LP CPU through the instruction
bus or through the data bus as shown in Table 5-1.
3. LP SRAM
This 16 KB LP SRAM is a read-and-write memory, accessed by the HP CPU or LP CPU through the instruction
bus or through the data bus via their shared address 0x5000_0000 ~ 0x5000_3FFF as shown in Table
5-1.
• high-speed mode, i.e., the LP SRAM is accessed in HP CPU clock frequency. In this case:
– But the latency of LP CPU accessing LP SRAM ranges from a few dozen to dozens of LP CPU
cycles.
• low-speed mode, i.e., the LP SRAM is accessed in LP CPU clock frequency. In this case:
– But the latency of HP CPU accessing LP SRAM ranges from a few dozen to dozens of HP CPU
cycles.
• If the LP CPU is not working, you can switch to high-speed mode to improve the access speed of the
HP CPU.
• If the LP CPU is executing code in the LP SRAM, you can switch to the low-speed mode.
When the HP CPU is in sleep mode, you must switch to the low-speed mode.
– 1: high-speed mode
– 0: low-speed mode
– 0: mode is switched
The HP CPU accesses the external memory via the cache. According to information inside the MMU (Memory
Management Unit), the cache maps the HP CPU’s address (0x4200_0000 ~ 0x42FF_FFFF) into a physical
address of the external memory. Due to this address mapping, ESP32-C6 can address up to 16 MB external
flash. Note that the instruction bus shares the same address space (16 MB) with the data bus to access the
external memory.
5.3.3.2 Cache
As shown in Figure 5-2, ESP32-C6 has a read-only uniform cache which is four-way set-associative. Its size is
32 KB and its block size is 32 bytes. The cache is accessible by the instruction bus and the data bus at the
same time, but can only respond to one of them at a time. When a cache miss occurs, the cache controller
will initiate a request to the external memory.
1. Invalidate: This operation is used to remove valid data in the cache. Once this operation is done, the
deleted data is stored only in the external memory. If the HP CPU wants to access the data again, it
needs to access the external memory. There are two types of invalidate operation: Invalidate-All and
Manual-Invalidate. Manual-Invalidate is performed only on data in the specified area in the cache, while
Invalidate-All is performed on all data in the cache.
2. Preload: This operation is to load instructions and data into the cache in advance. The minimum unit of
preload-operation is one block. There are two types of preload-operation: manual preload
(Manual-Preload) and automatic preload (Auto-Preload). Manual-Preload means that the hardware
prefetches a piece of continuous data according to the virtual address specified by the software.
Auto-Preload means the hardware prefetches a piece of continuous data according to the current
address where the cache hits or misses (depending on configuration).
3. Lock/Unlock: The lock operation is used to prevent the data in the cache from being easily replaced.
There are two types of lock: prelock and manual lock. When prelock is enabled, the cache locks the
data in the specified area when filling the missing data to cache memory, while the data outside the
specified area will not be locked. When manual lock is enabled, the cache checks the data that is
already in the cache memory and locks the data only if it falls in the specified area, and leaves the data
outside the specified area unlocked. When there are missing data, the cache will replace the data in the
unlocked way first, so the data in the locked way is always stored in the cache and will not be replaced.
But when all ways within the cache are locked, the cache will replace data, as if it was not locked.
Unlocking is the reverse of locking, except that it only can be done manually.
Please note that Invalidate-All operation only works on the unlocked data. If you expect to perform such
operation on the locked data, please unlock them first.
GDMA uses the same addresses as the data bus to access HP SRAM, i.e., GDMA uses address range
0x4080_0000 ~ 0x4087_FFFF to access HP SRAM.
Eight modules/peripherals in ESP32-C6 work together with GDMA. As shown in Figure 5-3, eight vertical lines
correspond to these eight modules/peripherals with GDMA function. The horizontal line represents a certain
channel of GDMA (can be any channel), and the intersection of the vertical line and the horizontal line
indicates that a module/peripheral has the ability to access the corresponding channel of GDMA. If there are
multiple intersections on the same line, it means that these peripherals/modules can not enable the GDMA
function at the same time.
These modules/peripherals can access any memory available to GDMA. For more information, please refer to
Chapter 4 GDMA Controller (GDMA).
Note:
When accessing a memory via GDMA, a corresponding access permission is needed, otherwise this access may fail.
For more information about permission control, please refer to Chapter 16 Permission Control (PMS).
Address).
Boundary Address
Target Size (KB)
Low Address High Address
UART Controller 0 (UART0) 0x6000_0000 0x6000_0FFF 4
UART Controller 1 (UART1) 0x6000_1000 0x6000_1FFF 4
External Memory Encryption and Decryption 0x6000_2000 0x6000_2FFF 4
(XTS_AES)
Reserved 0x6000_3000 0x6000_3FFF
I2C Controller (I2C) 0x6000_4000 0x6000_4FFF 4
UHCI Controller (UHCI) 0x6000_5000 0x6000_5FFF 4
Remote Control Peripheral (RMT) 0x6000_6000 0x6000_6FFF 4
LED PWM Controller (LEDC) 0x6000_7000 0x6000_7FFF 4
Timer Group 0 (TIMG0) 0x6000_8000 0x6000_8FFF 4
Timer Group 1 (TIMG1) 0x6000_9000 0x6000_9FFF 4
System Timer (SYSTIMER) 0x6000_A000 0x6000_AFFF 4
Two-wire Automotive Interface 0 (TWAI0) 0x6000_B000 0x6000_BFFF 4
I2S Controller (I2S) 0x6000_C000 0x6000_CFFF 4
Two-wire Automotive Interface 1 (TWAI1) 0x6000_D000 0x6000_DFFF 4
Successive Approximation ADC (SAR ADC) 0x6000_E000 0x6000_EFFF 4
USB Serial/JTAG Controller 0x6000_F000 0x6000_FFFF 4
Interrupt Matrix (INTMTX) 0x6001_0000 0x6001_0FFF 4
Reserved 0x6001_1000 0x6001_1FFF
Pulse Count Controller (PCNT) 0x6001_2000 0x6001_2FFF 4
Event Task Matrix (SOC_ETM) 0x6001_3000 0x6001_3FFF 4
Motor Control PWM (MCPWM) 0x6001_4000 0x6001_4FFF 4
Parallel IO Controller (PARL_IO) 0x6001_5000 0x6001_5FFF 4
SDIO HINF* 0x6001_6000 0x6001_6FFF 4
SDIO SLC* 0x6001_7000 0x6001_7FFF 4
SDIO SLCHOST * 0x6001_8000 0x6001_8FFF 4
Reserved 0x6001_9000 0x6007_FFFF
GDMA Controller (GDMA) 0x6008_0000 0x6008_0FFF 4
General Purpose SPI2 (GP-SPI2) 0x6008_1000 0x6008_1FFF 4
Reserved 0x6008_2000 0x6008_7FFF
AES Accelerator (AES) 0x6008_8000 0x6008_8FFF 4
SHA Accelerator (SHA) 0x6008_9000 0x6008_9FFF 4
RSA Accelerator (RSA) 0x6008_A000 0x6008_AFFF 4
ECC Accelerator (ECC) 0x6008_B000 0x6008_BFFF 4
Digital Signature (DS) 0x6008_C000 0x6008_CFFF 4
HMAC Accelerator (HMAC) 0x6008_D000 0x6008_DFFF 4
Reserved 0x6008_E000 0x6008_FFFF
IO MUX 0x6009_0000 0x6009_0FFF 4
GPIO Matrix 0x6009_1000 0x6009_1FFF 4
Cont’d on next page
Note:
As shown in the figure 5-1�
• LP CPU can access all peripherals listed in the table 5-2 except RISC-V Trace Encoder (TRACE), DEBUG ASSIST
(ASSIST_DEBUG) and Interrupt Priority Register (INTPRI).
6 eFuse Controller
6.1 Overview
ESP32-C6 contains a 4096-bit eFuse memory to store parameters and user data. The parameters include
control parameters for some hardware modules, system data parameters and keys used for the decryption
module. Once an eFuse bit is programmed to 1, it can never be reverted to 0. The eFuse controller programs
individual bits of parameters in eFuse according to user configurations. From outside the chip, eFuse data can
only be read via the eFuse controller. For some data, such as some keys stored in eFuse for internal use by
hardware cryptography modules (e.g., digital signature, HMAC), if read protection is not enabled, the data can
be read from outside the chip; if read protection is enabled, the data cannot be read from outside the
chip.
6.2 Features
• 4096-bit one-time programmable storage including 1792 bits reserved for custom use
Users can program bits in the eFuse memory via the eFuse controller by writing the data to be programmed to
the programming register and executing the programming instruction. For detailed programming steps, please
refer to Section 6.3.2.
Users cannot directly read the data programmed in the eFuse memory, so they need to read the programmed
data into the Reading Data Register of the corresponding address segment through the eFuse controller.
During the reading process, if the data is inconsistent with that in the eFuse memory, the eFuse controller can
automatically correct it through the hardware encoding mechanism (see Section 6.3.1.3 for details), and send
the error message to the error report register. For detailed steps to read parameters, please refer to the
Section 6.3.3.
Table 6-1 lists all the parameters accessible (readable and usable) to users in BLOCK0 and their offsets, bit
widths, accessibility by hardware, write protection, and brief function description. For more description on the
parameters, please click the link of the corresponding parameter in the table.
The EFUSE_WR_DIS parameter is used to disable write protection of other parameters. EFUSE_RD_DIS is
used to disable read protection of BLOCK4 ~ BLOCK10. For more information on these two parameters, please
see Section 6.3.1.1 and Section 6.3.1.2.
6 eFuse Controller
Table 6-1. Parameters in eFuse BLOCK0
Write Protection
Bit Accessible
Parameters by EFUSE_WR_DIS Description
Width by Hardware
Bit Number
EFUSE_DIS_USB_SERIAL_JTAG 1 Y 2
abled.
Represents whether the function to force the chip into
EFUSE_DIS_FORCE_DOWNLOAD 1 Y 2
Download mode is disabled.
Represents whether the SPI0 controller is disabled in
EFUSE_SPI_DOWNLOAD_MSPI_DIS 1 Y 17
boot_mode_download.
EFUSE_DIS_TWAI 1 Y 2 Represents whether the TWAI controller is disabled.
Represents whether the selection of a JTAG signal source
through the strapping value of GPIO15 is enabled when
ESP32-C6 TRM (Version 1.0)
EFUSE_JTAG_SEL_ENABLE 1 Y 2
both EFUSE_DIS_PAD_JTAG and EFUSE_DIS_USB_JTAG
are configured to 0.
EFUSE_SOFT_DIS_JTAG 3 Y 31 Represents whether JTAG is disabled in the soft way.
Represents whether JTAG is disabled in the hard way (per-
EFUSE_DIS_PAD_JTAG 1 Y 2
manently).
GoBack
Cont’d on next page
Espressif Systems
6 eFuse Controller
Table 6-1 – cont’d from previous page
Write Protection
Bit Accessible
Parameters by EFUSE_WR_DIS Description
Width by Hardware
Bit Number
EFUSE_SPI_BOOT_CRYPT_CNT 3 Y 4
abled.
Represents whether revoking the first Secure Boot key is
EFUSE_SECURE_BOOT_KEY_REVOKE0 1 N 5
enabled.
173
GoBack
abled.
EFUSE_SECURE_BOOT_EN 1 N 16 Represents whether Secure Boot is enabled or disabled.
Cont’d on next page
Espressif Systems
6 eFuse Controller
Table 6-1 – cont’d from previous page
Write Protection
Bit Accessible
Parameters by EFUSE_WR_DIS Description
Width by Hardware
Bit Number
EFUSE_DIS_USB_SERIAL_JTAG_DOWNLOAD_MODE 1 N 18
tion is disabled.
EFUSE_ENABLE_SECURITY_DOWNLOAD 1 N 18 Represents whether security download is enabled.
EFUSE_UART_PRINT_CONTROL 2 N 18 Represents the type of UART printing.
174
GoBack
6 eFuse Controller GoBack
Table 6-2 lists all key purposes and their values. Setting the eFuse parameter EFUSE_KEY_PURPOSE_n
declares the purpose of KEYn (n: 0 ~ 5).
Key
Purpose Purposes
Values
0 User purposes
1 Reserved
2 Reserved
3 Reserved
4 XTS_AES_128_KEY (flash/SRAM encryption and decryption)
5 HMAC Downstream mode (both JTAG and DS)
6 JTAG in HMAC Downstream mode
7 Digital Signature peripheral in HMAC Downstream mode
8 HMAC Upstream mode
9 SECURE_BOOT_DIGEST0 (secure boot key digest)
10 SECURE_BOOT_DIGEST1 (secure boot key digest)
11 SECURE_BOOT_DIGEST2 (secure boot key digest)
6 eFuse Controller
Table 6-3. Parameters in BLOCK1 to BLOCK10
GoBack
6 eFuse Controller GoBack
Among these blocks, BLOCK4 ~ 9 can be used to store KEY0 ~ 5. Up to six 256-bit keys can be written into
eFuse. Whenever a key is written, its purpose value should also be written (see table 6-2). For example, when
a key for the JTAG function in HMAC Downstream mode is written to KEY3 (i.e., BLOCK7), its key purpose value
6 should also be written to EFUSE_KEY_PURPOSE_3.
Note:
Do not program the XTS-AES key into the KEY5 block, i.e., BLOCK9. Otherwise, the key may be unreadable. Instead,
program it into the preceding blocks, i.e., BLOCK4 ~ BLOCK8. The last block, BLOCK9, is used to program other keys.
BLOCK1 ~ BLOCK10 use the RS coding scheme, so there are some limitations on writing to these parameters.
For more detailed information, please refer to Section 6.3.1.3 and Section 6.3.2.
6.3.1.1 EFUSE_WR_DIS
Parameter EFUSE_WR_DIS determines whether individual eFuse parameters are write-protected. After
EFUSE_WR_DIS has been programmed, execute an eFuse read operation so the new values would take
effect.
Column “Write Protection by EFUSE_WR_DIS Bit Number” in Table 6-1 and Table 6-3 list the specific bits in
EFUSE_WR_DIS that disable writing.
When the write protection bit of a parameter is set to 0, it means that this parameter is not write-protected and
can be programmed, unless it has been programmed before.
When the write protection bit of a parameter is set to 1, it means that this parameter is write-protected and
none of its bits can be modified, with non-programmed bits always remaining 0 and programmed bits always
remaining 1. That is to say, if a parameter is write-protected, it will always remain in this state and cannot be
changed.
6.3.1.2 EFUSE_RD_DIS
Only the parameters in BLOCK4 ~ BLOCK10 can be set to be read-protected from users, as shown in column
“Read Protection by EFUSE_RD_DIS Bit Number” of Table 6-3. After EFUSE_RD_DIS has been programmed,
execute an eFuse read operation so the new values would take effect.
If the corresponding EFUSE_RD_DIS bit is 0, the parameter controlled by this bit is not read-protected from
users. If it is 1, the parameter controlled by it is read-protected from users.
Other parameters that are not in BLOCK4 ~ BLOCK10 can always be read by users.
When BLOCK4 ~ BLOCK10 are set to be read-protected, the data in them can still be read by hardware
cryptography modules if the EFUSE_KEY_PURPOSE_n bit is set accordingly.
Internally, eFuse uses the hardware encoding scheme to protect data from corruption. The scheme and the
encoding process are invisible to users.
All BLOCK0 parameters except for EFUSE_WR_DIS are stored with four backups, meaning each bit is stored
four times. This backup scheme is not visible to users.
In BLOCK0, EFUSE_WR_DIS occupies 32 bits, and other parameters takes 152 bits each. So, the eFuse
memory space occupied by BLOCK0 is 32 + 152 * 4 = 640 bits.
BLOCK1 ~ BLOCK10 use RS (44, 32) coding scheme that supports up to 6 bytes of automatic error correction.
The primitive polynomial of RS (44, 32) is p(x) = x8 + x4 + x3 + x2 + 1.
The shift register circuit shown in Figure 6-2 and 6-3 processes 32 data bytes using RS (44, 32). This coding
scheme encodes 32 bytes of data into 44 bytes:
• Bytes [32:43] are the encoded parity bytes stored in 8-bit flip-flops DFF1, DFF2, ..., DFF12 (gf_mul_n is
the result of multiplying a byte of data in GF (28 ) by αn , where n is an integer).
After that, the hardware programs into eFuse the 44-byte codeword consisting of the data bytes and the parity
bytes. When the eFuse block is read, the eFuse controller automatically decodes the codeword and applies
error correction if needed.
Because the RS check codes are generated on the entire 32-byte eFuse block, each block can only be
written once.
Since the size of BLOCK1 is less than 32 bytes, the unused bits will be treated as 0 by hardware during the RS
(44, 32) encoding. Thus, the final coding result will not be affected.
Among blocks using the RS (44, 32) coding scheme, the parameters in BLOCK1 is 24 bytes, and the RS check
code is 12 bytes, so BLOCK1 occupies 24 + 12 = 36 bytes in eFuse memory.
The parameter in other blocks (Block2 ~ 10) is 32 bytes respectively, and the RS check code is 12 bytes, so
they occupy (32 + 12) * 9 = 396 bytes in eFuse memory.
Since there is a one-to-one correspondence between the reading data registers and the programming data
registers (see table 6-4 for details), users can find out where the data to be programmed is located in
programming registers by checking the parameter description and the parameter location in the corresponding
read registers.
For example, if the user wants to program the parameter EFUSE_DIS_ICACHE in BLOCK0 to 1, they can first
search the reading data registers EFUSE_RD_REPEAT_DATA0 ~ 4_REG in BLOCK0 for where the parameter is
located, namely, the 8th bit in EFUSE_RD_REPEAT_DATA0_REG. So, the user can set the 8th bit of
EFUSE_PGM_DATA1_REG to 1 and follow the programming steps below. After the steps are completed, the
corresponding bit in the eFuse memory will be programmed to 1.
Programming preparation
• Programming BLOCK0
1. Set EFUSE_BLK_NUM to 0.
• Programming BLOCK1
1. Set EFUSE_BLK_NUM to 1.
• Programming BLOCK2 ~ 10
Programming process
3. Make sure the eFuse programming voltage VDDQ is configured correctly as described in Section 6.3.4.
6. Poll register EFUSE_CMD_REG until it is 0x0, or wait for a PGM_DONE interrupt. For more information on
how to identify a PGM_DONE or READ_DONE interrupt, please see the end of Section 6.3.3.
8. Trigger an eFuse read operation (see Section 6.3.3) to update eFuse registers with the new values.
9. Check error record registers. If the values read in error record registers are not 0, the programming
process should be performed again following above steps 1 ~ 7. Please check the following error record
registers for different eFuse blocks:
Limitations
In BLOCK0, each bit can be programmed separately. However, we recommend to minimize programming
cycles and program all the bits of a parameter in one programming action. In addition, after all parameters
controlled by a certain bit of EFUSE_WR_DIS are programmed, that bit should be immediately programmed.
The programming of parameters controlled by a certain bit of EFUSE_WR_DIS, and the programming of the bit
itself can even be completed at the same time in one programming action.
The eFuse controller reads eFuse memory to update corresponding registers. This read operation happens at
system reset and can also be triggered manually by users as needed (e.g., if new eFuse values have been
programmed). The process of triggering a read operation by users is as follows:
3. Poll register EFUSE_CMD_REG until it is 0x0, or wait for a READ_DONE interrupt. Information on how to
identify a PGM_DONE or READ_DONE interrupt is provided below in this section.
The eFuse read registers will hold all values until the next read operation.
Error detection
Error record registers allow users to detect if there is any inconsistency between the parameter read by eFuse
controller and that in eFuse memory.
Registers EFUSE_RD_REPEAT_ERR0 ~ 3_REG indicate if there are any errors in programming parameters
(except EFUSE_WR_DIS) to BLOCK0. The value 1 indicates an error is detected in programming the
corresponding bit. The value 0 indicates no error.
Registers EFUSE_RD_RS_ERR0 ~ 1_REG store the number of corrected bytes as well as the result of RS
decoding when eFuse controller reads BLOCK1 ~ BLOCK10.
The values of the above registers will be updated every time the reading data registers of eFuse controller
have been updated.
The methods to identify the completion of a program/read operation are described below. Please note that bit
1 corresponds to a program operation, and bit 0 corresponds to a read operation.
• Method one: Poll bit 1/0 in register EFUSE_INT_RAW_REG until it becomes 1, which represents the
completion of a program/read operation.
• Method two:
1. Set bit 1/0 in register EFUSE_INT_ENA_REG to 1 to enable the eFuse controller to post a
PGM_DONE or READ_DONE interrupt.
2. Configure the Interrupt Matrix to enable the CPU to respond to eFuse interrupt signals. See Chapter
10 Interrupt Matrix (INTMTX).
4. Set bit 1/0 in register EFUSE_INT_CLR_REG to 1 to clear the PGM_DONE or READ_DONE interrupt.
Note
When eFuse controller is updating its registers, it will use EFUSE_PGM_DATAn_REG (n=0, 1, ... ,7) again to
store data. So please do not write important data into these registers before this updating process is
initiated.
During the chip boot process, eFuse controller will automatically update data from eFuse memory into the
registers that can be accessed by users. Users can get programmed eFuse data by reading corresponding
registers. Thus, there is no need to update the reading data registers in such case.
• EFUSE_DAC_NUM (the rising period of VDDQ): The default value of VDDQ is 2.5 V and the voltage
increases by 0.01 V in each clock cycle. The default value of this parameter is 255.
• EFUSE_DAC_CLK_DIV (the clock divisor of VDDQ): The clock period to program VDDQ should be larger
than 1 µs.
• EFUSE_PWR_ON_NUM (the power-up time for VDDQ): The programming voltage should be stabilized
after this time, which means the value of this parameter should be configured to exceed the result of
EFUSE_DAC_CLK_DIV times EFUSE_DAC_NUM.
• EFUSE_PWR_OFF_NUM (the power-out time for VDDQ): The value of this parameter should be larger
than 10 µs.
6.3.6 Interrupts
• PGM_DONE interrupt: Triggered when eFuse programming has finished. To enable this interrupt, set the
EFUSE_PGM_DONE_INT_ENA field of register EFUSE_INT_ENA_REG to 1.
• READ_DONE interrupt: Triggered when eFuse reading has finished. To enable this interrupt, set the
EFUSE_READ_DONE_INT_ENA field of register EFUSE_INT_ENA_REG to 1.
The abbreviations given in Column Access are explained in Section Access Types for Registers.
6.5 Registers
The addresses in this section are relative to eFuse controller base address provided in Table 5-2 in Chapter 5
System and Memory.
_0
A
AT
_D
GM
_P
SE
U
EF
31 0
0x000000 Reset
31 0
0x000000 Reset
31 0
0x000000 Reset
_3
A
AT
_D
GM
_P
SE
U
EF
31 0
0x000000 Reset
_4
A
AT
_D
M
PG
E_
US
EF
31 0
0x000000 Reset
31 0
0x000000 Reset
31 0
0x000000 Reset
A _7
AT
_D
GM
_P
SE
U
EF
31 0
0x000000 Reset
_0
TA
DA
S_
_R
GM
_P
SE
U
EF
31 0
0x000000 Reset
31 0
0x000000 Reset
_2
TA
DA
S_
_R
GM
_P
SE
U
EF
31 0
0x000000 Reset
IS
D
R_
E_W
US
EF
31 0
0x000000 Reset
T
YP
CR
EN
L_
HE
UA
US DI US LO L_ AD
U D DO SE WN I_
SW ICA JTA _I G
AN
AP CH G CAC
EF E_ S_ B_ DO SP
E_ S_ B_ AD JTA
N
EX AS_ _2
RV _0
_E
RV _1
AG M
US DI US E_ _M
LE
G_ PIO
D0
NS
IO
JT D_
ED
ED
AB
EF SE_ IS_ RC AD
G
SD
VE
PI
CH G
D_ OA
TA
U D O LO
T_
ER
US SP W E
PA NL
_J
_U E
SE
SE
EF E_ S_T EL_
EF SE_ IS_ WN
AR
ES
B_ I_
IS
S_ W
EF E_ _ I
RE
RE
A
US SP
_D
_R
DI DO
U D DO
US DI _S
IS
_
_D
FT
E_ D_
US PT4
T4
T4
EF E_ AG
E_ S_
I
SO
RD
RP
RP
)
US VD
US JT
US DI
ed
_R
E_
E_
EF E_
EF SE_
E_
EF E_
E_
rv
SE
US
US
US
US
US
se
U
U
(re
EF
EF
EF
EF
EF
EF
EF
EF
31 30 29 28 27 26 25 24 21 20 19 18 16 15 14 13 12 11 10 9 8 7 6 0
EFUSE_RD_DIS Represents whether reading of individual eFuse block (BLOCK4 ~ BLOCK10) is dis-
abled.
1: Disabled
0: Enabled
(RO)
EFUSE_SWAP_UART_SDIO_EN Represents whether the pads of UART and SDIO are swapped or
not.
1: Swapped
0: Not swapped
(RO)
EFUSE_DIS_FORCE_DOWNLOAD Represents whether the function that forces chip into download
mode is disabled.
1: Disabled
0: Enabled
(RO)
EFUSE_SOFT_DIS_JTAG Represents whether JTAG is disabled in the soft way. It can be restarted
via HMAC.
Odd count of bits with a value of 1: Disabled
Even count of bits with a value of 1: Enabled
(RO)
0
Y_ VO 2
VO 1
KE RE KE
RE KE
KE
T_ Y_ VO
OO KE RE
T
CN
_B T_ Y_
_0
T_
RE OO KE
D1
_0
YP
_1
EL
CU _B T_
E
SE
SE
RV
CR
SE RE OO
_S
PO
PO
SE
AY
T_
E_ CU _B
EL
E
OO
UR
UR
US SE RE
_R
_D
P
B
EF E_ CU
T4
Y_
Y_
I_
DT
RP
SP
KE
KE
US SE
W
E_
E_
EF E_
E_
E_
E_
US
US
US
US
US
US
EF
EF
EF
EF
EF
EF
31 28 27 24 23 22 21 20 18 17 16 15 0
E
OK
EV
_R
VE
SI
T_ ER EN ES
US RYP ES OT_ GR
0
LE
EN _1
2_
C _R O AG
AB
A _ D2
2
3
4
5
ED
L
E_ T4 _B T_
E_
E_
E_
E_
VE
DP VE
RV
US RP RE OO
UW
OS
OS
OS
OS
LE
SE
EF E_ CU _B
A_
RP
RP
RP
RP
P
RE
_T
US SE RE
DP
PU
PU
PU
PU
H
EF E_ CU
C_
T4
AS
Y_
Y_
Y_
Y_
RP
KE
KE
KE
KE
US SE
SE
FL
E_
E_
EF E_
E_
E_
E_
E_
E_
US
US
US
US
US
US
US
EF
EF
EF
EF
EF
EF
EF
EF
31 28 27 22 21 20 19 18 17 16 15 12 11 8 7 4 3 0
EFUSE_FLASH_TPUW Represents the flash waiting time after power-up. Measurement unit: ms.
When the value is less than 15, the waiting time is the programmed value. Otherwise, the waiting
time is a fixed value, i.e. 30 ms. (RO)
E
OD
M
D_
E
NT
AK
OA
RI
_W
NL
_P
S_ E RI _5 D AD
ST
OW
M
DI DIR SE D3 G_ LO
FA
RO
E_ S_ B_ VE JTA N
E_
US DI US ER L_ OW
OA T _
E
D ME
NL O AG
BL
OD
US RP US EC TRO
VE _3
_4
W BO JT
SA
VE SU
ER 3_1
3_
M
DO CT_ AL_
OO D3
ER D3
D3
DI
ON
U D _R SE IT
N
D_
ER RE
ED
EF E_ T4 _ R
_B VE
ES VE
ES D_
SI
U
C
V
T_
ER
RE ER
_R ER
_R N
N
US PT4 _SE
EF E_ S_ _S
_V
CU ES
ES
US PT4 ES
RI
B
RE
US DI LE
SE _R
_R
R _R
_P
R E
E_ RC
EF E_ AB
U
RT
E_ T4
T4
E_ T4
EC
US EN
US FO
US RP
RP
US RP
UA
_S
EF SE_
EF SE_
E_
EF E_
E_
EF E_
SE
US
US
U
U
EF
EF
EF
EF
EF
EF
EF
31 30 29 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
_1
D4
D4
E
E
RV
RV
SE
SE
RE
RE
4_
4_
PT
PT
_R
_R
E
E
US
US
EF
EF
31 24 23 0
_0
AC
E _M
US
EF
31 0
0x000000 Reset
_1
AC
AC
M
_M
E_
E
US
US
EF
EF
31 16 15 0
D
E
RV
_1
SE
NF
RE
CO
I_
D_
P
_S
PA
AC
I_
SP
_M
E_
E
US
US
EF
EF
31 14 13 0
_0
T0
_2
NF
AR
_P
CO
TA
D_
DA
PA
S_
I_
SP
SY
E_
E_
US
US
EF
EF
31 18 17 0
EFUSE_SYS_DATA_PART0_0 Represents the first 14 bits of the zeroth part of system data. (RO)
1
0_
RT
PA
_
TA
DA
_
YS
_S
SE
U
EF
31 0
0x000000 Reset
EFUSE_SYS_DATA_PART0_1 Represents the first 32 bits of the zeroth part of system data. (RO)
31 0
0x000000 Reset
EFUSE_SYS_DATA_PART0_2 Represents the second 32 bits of the zeroth part of system data. (RO)
0
1_
RT
PA
_
TA
DA
_
YS
_S
SE
U
EF
31 0
0x000000 Reset
EFUSE_SYS_DATA_PART1_0 Represents the zeroth 32 bits of the first part of system data. (RO)
1
1_
RT
PA
_
TA
DA
_
YS
E_S
US
EF
31 0
0x000000 Reset
EFUSE_SYS_DATA_PART1_1 Represents the first 32 bits of the first part of system data. (RO)
31 0
0x000000 Reset
EFUSE_SYS_DATA_PART1_2 Represents the second 32 bits of the first part of system data. (RO)
3
1_
RT
PA
_
TA
DA
_
YS
_S
SE
U
EF
31 0
0x000000 Reset
EFUSE_SYS_DATA_PART1_3 Represents the third 32 bits of the first part of system data. (RO)
4
1_
RT
PA
_
TA
DA
_
YS
E_S
US
EF
31 0
0x000000 Reset
EFUSE_SYS_DATA_PART1_4 Represents the fourth 32 bits of the first part of system data. (RO)
31 0
0x000000 Reset
EFUSE_SYS_DATA_PART1_5 Represents the fifth 32 bits of the first part of system data. (RO)
6
1_
RT
PA
_
TA
_ DA
YS
_S
SE
U
EF
31 0
0x000000 Reset
EFUSE_SYS_DATA_PART1_6 Represents the sixth 32 bits of the first part of system data. (RO)
_7
T1
AR
_P
TA
DA
S_
SY
E_
US
EF
31 0
0x000000 Reset
EFUSE_SYS_DATA_PART1_7 Represents the seventh 32 bits of the first part of system data. (RO)
31 0
0x000000 Reset
1A
AT
_D
SR
E _U
US
EF
31 0
0x000000 Reset
2
TA
DA
R_
US
E_
US
EF
31 0
0x000000 Reset
31 0
0x000000 Reset
31 0
0x000000 Reset
A5
AT
_D
SR
_U
E
US
EF
31 0
0x000000 Reset
6
TA
DA
R_
US
E_
US
EF
31 0
0x000000 Reset
31 0
0x000000 Reset
31 0
0x000000 Reset
1
TA
DA
0_
EY
E_K
US
EF
31 0
0x000000 Reset
A2
AT
_D
Y0
KE
E_
US
EF
31 0
0x000000 Reset
31 0
0x000000 Reset
31 0
0x000000 Reset
5
TA
DA
0_
EY
_K
SE
U
EF
31 0
0x000000 Reset
6
TA
DA
0_
EY
E_K
US
EF
31 0
0x000000 Reset
31 0
0x000000 Reset
31 0
0x000000 Reset
1
TA
DA
1_
EY
E_K
US
EF
31 0
0x000000 Reset
2
TA
DA
1_
K EY
E_
US
EF
31 0
0x000000 Reset
31 0
0x000000 Reset
31 0
0x000000 Reset
5
TA
DA
1_
EY
E _K
US
EF
31 0
0x000000 Reset
A6
AT
_D
Y1
KE
E_
US
EF
31 0
0x000000 Reset
31 0
0x000000 Reset
31 0
0x000000 Reset
A1
AT
_D
2
EY
_K
E
US
EF
31 0
0x000000 Reset
2
TA
DA
2_
EY
_K
E
US
EF
31 0
0x000000 Reset
31 0
0x000000 Reset
31 0
0x000000 Reset
A5
AT
_D
Y2
KE
E_
US
EF
31 0
0x000000 Reset
6
A
AT
_D
Y2
KE
E_
US
EF
31 0
0x000000 Reset
31 0
0x000000 Reset
31 0
0x000000 Reset
1
TA
DA
3_
EY
_K
E
US
EF
31 0
0x000000 Reset
A2
AT
_D
Y3
KE
E_
US
EF
31 0
0x000000 Reset
31 0
0x000000 Reset
31 0
0x000000 Reset
5
TA
DA
3_
EY
_K
E
US
EF
31 0
0x000000 Reset
6
TA
DA
3_
EY
_K
E
US
EF
31 0
0x000000 Reset
31 0
0x000000 Reset
31 0
0x000000 Reset
1
TA
DA
4_
EY
E_K
US
EF
31 0
0x000000 Reset
2
TA
DA
4_
EY
E_K
US
EF
31 0
0x000000 Reset
31 0
0x000000 Reset
31 0
0x000000 Reset
5
TA
DA
4_
EY
E_K
US
EF
31 0
0x000000 Reset
6
TA
DA
4_
EY
_K
SE
U
EF
31 0
0x000000 Reset
31 0
0x000000 Reset
31 0
0x000000 Reset
A1
AT
_D
5
EY
_K
E
US
EF
31 0
0x000000 Reset
A2
AT
_D
Y5
KE
E_
US
EF
31 0
0x000000 Reset
31 0
0x000000 Reset
31 0
0x000000 Reset
A 5
AT
_D
5
EY
_K
SE
U
EF
31 0
0x000000 Reset
6
TA
DA
5_
EY
E_K
US
EF
31 0
0x000000 Reset
31 0
0x000000 Reset
31 0
0x000000 Reset
EFUSE_SYS_DATA_PART2_0 Represents the 0th 32 bits of the 2nd part of system data. (RO)
_1
2
RT
PA
_
TA
DA
_
YS
_S
SE
U
EF
31 0
0x000000 Reset
EFUSE_SYS_DATA_PART2_1 Represents the 1st 32 bits of the 2nd part of system data. (RO)
_2
2
RT
PA
_
TA
DA
_
YS
_S
SE
U
EF
31 0
0x000000 Reset
EFUSE_SYS_DATA_PART2_2 Represents the 2nd 32 bits of the 2nd part of system data. (RO)
31 0
0x000000 Reset
EFUSE_SYS_DATA_PART2_3 Represents the 3rd 32 bits of the 2nd part of system data. (RO)
_4
2
RT
PA
_
TA
DA
_
YS
_S
SE
U
EF
31 0
0x000000 Reset
EFUSE_SYS_DATA_PART2_4 Represents the 4th 32 bits of the 2nd part of system data. (RO)
_5
T2
AR
_P
TA
DA
S_
SY
E_
US
EF
31 0
0x000000 Reset
EFUSE_SYS_DATA_PART2_5 Represents the 5th 32 bits of the 2nd part of system data. (RO)
31 0
0x000000 Reset
EFUSE_SYS_DATA_PART2_6 Represents the 6th 32 bits of the 2nd part of system data. (RO)
_7
2
RT
PA
_
TA
DA
_
YS
_S
SE
U
EF
31 0
0x000000 Reset
EFUSE_SYS_DATA_PART2_7 Represents the 7th 32 bits of the 2nd part of system data. (RO)
R
ER
T_
YP
CR
E_ S_ B_ AD JTA _E RR
EN
R
US DI US LO L_ AD _E
SW ICA JTA _I G_ RR
ER
_U E_ ER H R
L_
AP CH G_ CAC ER
RR
AR ER R E_
_2
0_ _0
1
ED RR_
RR UA
RR
_E
U D DO SE WN I_
NS RR
R
RR
RR
RV _ER
_E AN
EF E_ S_ B_ DO SP
EN
EF E_ _ WN R _E
RR
PI _E
E
EX S_ _E
_E
AG M
US DI US E_ _M
E
O_
G_ PIO
_E
D0
US DI DO ER L
JT D_
T_ R
ED
EF E_ _ I_ AB
I
EF SE_ IS_ RC AD
G
SD
VE
CH G
D_ OA
TA
RV
U D FO LO
ER
RR
US SP W E
PA NL
_J
SE
SE
EF E_ S_T EL_
A
ES
_E
B_ I_
IS
S_ W
RE
RE
A
US SP
_D
_R
DI DO
US DI _S
IS
_
_D
FT
E_ D_
US PT4
T4
T4
EF E_ AG
E_ S_
S
I
SO
RD
RP
RP
)
US VD
US JT
US DI
ed
_R
E_
E_
EF E_
EF E_
E_
EF E_
E_
rv
SE
US
US
US
US
US
US
se
U
(re
EF
EF
EF
EF
EF
EF
EF
EF
31 30 29 28 27 26 25 24 21 20 19 18 16 15 14 13 12 11 10 9 8 7 6 0
EFUSE_RD_DIS_ERR Any bit of this field being 1 represents a programming error of RD_DIS. (RO)
VO 1_ R
R
0_ R
RE KE ER
ER
KE ER
Y_ VO 2_
KE RE KE
R
ER
T_ Y_ VO
0
R_
_
OO KE RE
NT
R
R
RR
RR
ER
_B T_ Y_
_E
_C
_E
_E
RE OO KE
0_
D1
PT
_1
EL
CU _B T_
E_
E
Y
SE
RV
CR
SE RE OO
_S
OS
PO
SE
AY
T_
E_ CU _B
RP
EL
E
OO
UR
US SE RE
_R
PU
_D
P
B
EF SE_ CU
T4
Y_
Y_
I_
DT
RP
SP
KE
KE
U SE
W
E_
E_
EF E_
E_
E_
E_
US
US
US
US
US
US
EF
EF
EF
EF
EF
EF
31 28 27 24 23 22 21 20 18 17 16 15 0
R
ER
E_
OK
EV
_R
C_ SER AB ERR IVE
0
_E RR
E EN _ S
_1
R_
_R A_ EN ES
RR
D2 _E
R
R
R
R
ER
RR
US PT4 DP OT_ GR
ER
ER
ER
ER
VE LE
2_
E
R T_ O AG
RR
2_
4_
5_
3_
L_
ED
E_ YP _B T_
_E
E_
E_
E_
E_
VE
RV
US CR RE OO
UW
OS
OS
OS
OS
LE
SE
EF E_ U B
A_
RP
RP
RP
RP
P
_
RE
_T
US SE RE
DP
PU
PU
PU
PU
H
EF E_ CU
T4
AS
Y_
Y_
Y_
Y_
C
RP
KE
KE
KE
KE
US SE
SE
FL
E_
E_
EF E_
E_
E_
E_
E_
E_
US
US
US
US
US
US
US
EF
EF
EF
EF
EF
EF
EF
EF
31 28 27 22 21 20 19 18 17 16 15 12 11 8 7 4 3 0
R
ER
E_
OD
_M
_5 N RR
AD
DO CT_ R RR OW _E
LO
S_ E ER _E D AD
DI DIR T_ D3 G_ LO
R
ED RR_ R
ER
R
ER
E_ _ IN E TA N
_2
0
ER 3
4
ER 3_E _E
1
E_
US DI PR R _ OW
R_
NT 3_ R_
ON R_
L_
RR
M R
D ME
RR
OD
ER
D R
D_ R
U RP US EC TRO
VE _E
E
_E
VE SU
3_
OA T_
J
3
3
N
U U _R SE IT
ER RE
NL O
ED
L
IO
EF SE_ T4 B_ UR
W BO
ES VE
ES D_
_C
RS
RV
V
_R ER
R
_R N
VE
SE
E
US PT4 _SE
EF SE_ IS_ _S
ES
US PT4 ES
RI
E_
RE
U D LE
_R
R _R
_P
R
R E
4_
E_ RC
EF SE_ AB
CU
RT
T4
E_ T4
PT
S
U EN
US FO
RP
US RP
UA
SE
_R
E_
EF SE_
E_
EF E_
E_
EF E_
SE
US
US
US
U
U
EF
EF
EF
EF
EF
EF
EF
31 30 29 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
EFUSE_SECURE_VERSION_ERR Any bit of this field being 1 represents a programming error of SE-
CURE_VERSION. (RO)
_0
1
R_
RR
ER
_E
4_
4
ED
ED
RV
RV
SE
SE
RE
E
_R
_
T4
T4
RP
RP
E_
E_
US
US
EF
EF
31 24 23 0
U M
M
M
_N
NU
NU
RR
AI
R_
R_
UM
M
UM
IL
M
_E
_F
UM
ER
NU
FA
AI
NU
ER
8M
M
_N
_N
_F
_N
1_
1_
R_
_8
A_
R_
IL
L
L
RR
I_
RR
L
TA
RT
RT
IL
RR
AI
AI
I
T
ER
PI
A
ER
FA
P
FA
DA
DA
_E
_F
_F
_E
_F
PA
PA
_E
_S
_S
0_
_
4_
R_
R_
Y0
Y2
Y2
Y3
Y3
S_
S_
Y4
Y1
Y1
AC
AC
EY
US
US
KE
KE
KE
KE
KE
KE
KE
KE
KE
SY
SY
M
K
E_
E_
E_
E_
E_
E_
E_
E_
E_
E_
E_
E_
E_
E_
E_
E_
US
US
US
US
US
US
US
US
US
US
US
US
US
US
US
US
EF
EF
EF
EF
EF
EF
EF
EF
EF
EF
EF
EF
EF
EF
EF
EF
31 30 28 27 26 24 23 22 20 19 18 16 15 14 12 11 10 8 7 6 4 3 2 0
UM
_N
IL
RR
UM
FA
_E
_N
2_
T2
RR
RT
AI
AR
_E
_F
PA
Y5
Y5
_
_
YS
YS
KE
KE
)
ed
_S
_S
E_
E_
rv
SE
SE
US
US
se
U
(re
EF
EF
EF
EF
31 8 7 6 4 3 2 0
D N
_P _O
CE CE
_F _F PU
OR OR
EM LK _
M _C CE
E_ EM OR
N
US M _F
_E
EF SE_ EM
K
CL
)
d)
U M
ed
ve
E_
EF SE_
rv
r
US
se
se
U
(re
(re
EF
EF
31 17 16 15 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 Reset
EFUSE_MEM_FORCE_PD Configures whether or not to force eFuse SRAM into power-saving mode.
1: Force
0: No effect
(R/W)
EFUSE_MEM_FORCE_PU Configures whether or not to force eFuse SRAM into working mode.
1: Force
0: No effect
(R/W)
EFUSE_CLK_EN Configures whether or not to force enable eFuse register configuration clock sig-
nal.
1: Force
0: The clock is enabled only during the reading and writing of registers
(R/W)
_O
rv
E
US
se
(re
EF
31 16 15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x00 Reset
T
CN
T_
BI
D_
LI
A
_V
E
K0
AT
BL
d)
d)
ST
ve
ve
E_
E_
r
r
US
US
se
se
(re
(re
EF
EF
31 20 19 10 9 4 3 0
D
AD MD
UM
M
_C
RE _C
_N
E_ M
LK
US PG
)
ed
B
E_
EF E_
rv
US
US
se
(re
EF
EF
31 6 5 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 0x0 0 0 Reset
EFUSE_BLK_NUM Represents the serial number of the block to be programmed. Value 0-10 cor-
responds to block number 0-10, respectively. (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
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
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
R
IN LR
CL
E_ T_C
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
L
SE
D_
IV
PA
_D
_
UM
LK
LK
R
_C
_C
L
_C
C_
AC
AC
DA
OE
)
ed
_D
_D
E_
E_
rv
E
US
US
US
US
se
(re
EF
EF
EF
EF
31 18 17 16 9 8 7 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 28 Reset
EFUSE_DAC_CLK_DIV Configures the division factor of the rising clock of the programming voltage.
(R/W)
EFUSE_DAC_NUM Configures the rising period of the programming voltage. Measurement unit:
Divided clock frequency by EFUSE_DAC_CLK_DIV. (R/W)
M
NU
T_
NI
_A
I
D_
A
UR
R_
A
D
RE
TH
TR
S
_T
E_
E_
E_
SE
US
US
US
U
EF
EF
EF
EF
31 24 23 16 15 8 7 0
EFUSE_THR_A Configures the read hold time. Measurement unit: One cycle of the eFuse core
clock. (R/W)
EFUSE_TRD Configures the read time. Measurement unit: One cycle of the eFuse core clock.
(R/W)
EFUSE_TSUR_A Configures the read setup time. Measurement unit: One cycle of the eFuse core
clock. (R/W)
EFUSE_READ_INIT_NUM Configures the waiting time of reading eFuse memory. Measurement unit:
One cycle of the eFuse core clock. (R/W)
_A
O
A
R_
UP
P_
PW
TH
TS
E_
E_
E_
US
US
US
EF
EF
EF
31 24 23 8 7 0
EFUSE_TSUP_A Configures the programming setup time. Measurement unit: One cycle of the
eFuse core clock.(R/W)
EFUSE_PWR_ON_NUM Configures the power up time for VDDQ. Measurement unit: One cycle of
the eFuse core clock. (R/W)
EFUSE_THP_A Configures the programming hold time. Measurement unit: One cycle of the eFuse
core clock. (R/W)
UM
_N
O FF
R_
GM
PW
TP
E_
E_
US
US
EF
EF
31 16 15 0
EFUSE_PWR_OFF_NUM Configures the power outage time for VDDQ. Measurement unit: One cycle
of the eFuse core clock. (R/W)
EFUSE_TPGM Configures the active programming time. Measurement unit: One cycle of the eFuse
core clock. (R/W)
TE
_I
GM
DA
UP
)
)
P
ed
ed
ed
_T
E_
rv
rv
rv
E
US
US
se
se
se
(re
(re
(re
EF
EF
31 21 20 13 12 11 1 0
EFUSE_TPGM_INACTIVE Configures the inactive programming time. Measurement unit: One cycle
of the eFuse core clock. (R/W)
E_
rv
US
se
(re
EF
31 28 27 0
0 0 0 0 0x2206300 Reset
7.1 Overview
The ESP32-C6 chip features 31 GPIO pins. Each pin can be used as a general-purpose I/O, or be connected
to an internal peripheral signal. Through GPIO matrix, IO MUX, and low-power (LP) IO MUX, peripheral input
signals can be from any IO pins, and peripheral output signals can be routed to any IO pins. Together these
modules provide highly configurable I/O.
Note:
• For chip variants without an in-package flash, GPIO14 is not led out to any chip pins, so GPIO14 is not available
to users.
• For chip variants with an in-package flash, GPIO24 ~ GPIO30 are dedicated to connecting the in-package flash,
not for other uses. GPIO10 ~ GPIO11 are not led out to any chip pins, thus not available to users. The remaining
22 GPIO pins (numbered GPIO0 ~ GPIO9, GPIO12 ~ GPIO23) are configurable by users.
7.2 Features
GPIO matrix has the following features:
• A full-switching matrix between the peripheral input/output signals and the GPIO pins.
• 85 peripheral input signals sourced from the input of any GPIO pins.
• Signal synchronization for peripheral inputs based on IO MUX operating clock. For more information
about the operating clock of IO MUX, please refer to Section 8 Reset and Clock.
• Better high-frequency digital performance achieved by some digital signals (SPI, JTAG, UART) bypassing
GPIO matrix. In this case, IO MUX is used to connect these pins directly to peripherals.
• A configuration register IO_MUX_GPIOn_REG provided for each GPIO pin. The pin can be configured to
• Control of eight LP GPIO pins (GPIO0 ~ GPIO7) that can be used by the peripherals in ULP and LP system.
1. Only part of peripheral input signals (marked “yes” in column “Direct input through IO MUX” in Table 7-2)
can bypass GPIO matrix. The other input signals can only be routed to peripherals via GPIO matrix.
2. There are only 31 inputs from GPIO SYNC to GPIO matrix, since ESP32-C6 provides 31 GPIO pins in total.
Note:
• For chip variants without an in-package flash, there are 30 inputs from GPIO SYNC to GPIO matrix in
total. GPIO14 is not led out to any chip pins.
• For chip variants with an in-package flash, there are only 22 inputs from GPIO SYNC to GPIO matrix
in total. GPIO10 ∼ GPIO11 are not let out to chip pins, and GPIO24 ∼ GPIO30 are used to connect
the in-package flash.
3. The pins supplied by VDDPST1 or by VDDPST2 are controlled by the signals: IE, OE, WPU, and WPD.
4. Only part of peripheral outputs (marked “yes” in column “Direct output through IO MUX” in Table 7-2) can
be routed to pins bypassing GPIO matrix. The other output signals can only be routed to pins via GPIO
matrix.
5. There are 31 outputs (corresponding to GPIO pin X: 0 ~ 30) from GPIO matrix to IO MUX. Note:
• For chip variants without an in-package flash, there are 30 outputs (corresponding to GPIO X: 0 ~
13, 15 ~ 30) from GPIO matrix to IO MUX in total.
• For chip variants with an in-package flash, there are only 22 outputs (corresponding to GPIO X: 0 ~
9, 12 ~ 23) from GPIO matrix to IO MUX in total.
Figure 7-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
As shown in Figure 7-1, when GPIO matrix is used to input a signal from the pin, all external input signals are
sourced from the GPIO pins and then filtered by the GPIO Filter, as shown in Step 2 in Section 7.4.3.
The Glitch Filter hardware can filter eight of the output signals from the GPIO Filter, and the other unselected
signals go directly to the GPIO SYNC hardware, as shown in Step 3 in Section 7.4.3.
All signals filtered by the GPIO Filter hardware or the Glitch Filter hardware are synchronized by the GPIO SYNC
hardware to IO MUX operating clock and then enter the GPIO matrix, see Section 7.4.2. Such signal filtering
and synchronization features apply to all GPIO matrix signals but do not apply when using the IO MUX.
GPIO_PINx_SYNC1_BYPASS[0]
GPIO_PINx_SYNC1_BYPASS[1]
GPIO Input
0
GPIO_PINx_SYNC2_BYPASS[0]
0
negative GPIO_PINx_SYNC2_BYPASS[1]
1
sync
0
positive 1 0
sync
negative 1
sync
positive 1
sync
First-level synchronizer
Second-level synchronizer
Figure 7-3. GPIO Input Synchronized on Rising Edge or on Falling Edge of IO MUX Operating Clock
Figure 7-3 shows the functionality of GPIO SYNC. In the figure, negative sync and positive sync mean GPIO
input is synchronized on falling edge and on rising edge of IO MUX operating clock respectively.
Note that some peripheral signals have no valid GPIO_SIGy_IN_SEL bit, namely, these peripherals can
only receive input signals via GPIO matrix.
2. Optionally enable the GPIO Filter for pin input signals by setting IO_MUX_GPIOx_FILTER_EN. Only the
signals with a valid width of more than two clock cycles can be sampled, see Figure 7-4.
3. Glitch filter hardware supports eight channels, each of which selects one signal from the 31 (0~30)
output signals from the GPIO Filter hardware and conducts the second-time filtering on the selected
signal. This Glitch Filter hardware can be used to filter slow-speed signals. To enable this feature, follow
the steps below:
4. Synchronize GPIO input signals. To do so, please set GPIO_PINx_REG corresponding to GPIO pin X as
follows:
5. Configure IO MUX register to enable pin input. For this end, please set IO_MUX_GPIOx_REG
corresponding to GPIO pin X as follows:
For example, to connect I2S MSCK input signal 3 (I2S_MCLK_in, signal index 12) to GPIO7, please follow the
steps below. Note that GPIO7 is also named as MTDO pin.
Note:
3. 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:
• When GPIO_FUNCy_IN_SEL is set to 0x3C, input signal is always 0.
• When GPIO_FUNCy_IN_SEL is set to 0x38, input signal is always 1.
• For chip variants without an in-package flash, output signals can be mapped to 30 GPIO pins, i.e., GPIO0
~ GPIO13, GPIO15 ~ GPIO30.
• For chip variants with an in-package flash, output signals can only be mapped to 22 GPIO pins, i.e.,
GPIO0 ~ GPIO9, GPIO12 ~ GPIO23.
The output signal is routed from the peripheral into GPIO matrix and then into IO MUX. IO MUX must be
configured to set the chosen pin to GPIO function. This enables the GPIO output signal to be connected to
the pin.
Note:
There is a range of peripheral output signals (97 ~ 100 in Table 7-2) which are not connected to any peripheral, but to
the input signals (97 ~ 100) directly.
To output peripheral signal Y to a particular GPIO pin X1 , follow the steps below:
• If the signal should always be enabled as an output, set the GPIO_FUNCx_OEN_SEL bit in register
GPIO_FUNCx_OUT_SEL_CFG_REG and the bit in register GPIO_ENABLE_W1TS_REG, corresponding
to GPIO pin X. To have the output enable signal decided by internal logic (for example, the SPIQ_oe
in column “Output enable signal when GPIO_FUNCn_OEN_SEL = 0” in Table 7-2), clear the
GPIO_FUNCx_OEN_SEL bit instead.
• Set the corresponding bit in register GPIO_ENABLE_W1TC_REG to disable the output from the GPIO
pin.
2. For an open drain output, set the GPIO_PINx_PAD_DRIVER bit in register GPIO_PINx_REG corresponding
to GPIO pin X.
3. Configure IO MUX register to enable output via GPIO matrix. Set IO_MUX_GPIOx_REG corresponding to
GPIO pin X as follows:
• Set the field IO_MUX_GPIOx_MCU_SEL to desired IO MUX function corresponding to GPIO pin X.
This is Function 1 (GPIO function), numeric value 1, for all pins.
• Set the IO_MUX_GPIOx_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.
– 0: ~5 mA
– 1: ~10 mA
– 2: ~20 mA (default)
– 3: ~40 mA
Note:
1. The output signal from a single peripheral can be sent to multiple pins simultaneously.
• Set GPIO matrix GPIO_FUNCn_OUT_SEL with a special peripheral index 128 (0x80);
• Set the corresponding bit in GPIO_OUT_REG register to the desired GPIO output value.
Note:
Four out of the 93 peripheral output signals (index: 83 ~ 86 in Table 7-2 support 1-bit second-order sigma delta
modulation. By default the output is enabled for these four channels. This Sigma Delta modulator can also
output PDM (pulse density modulation) signal with configurable duty cycle. The transfer function is:
After scaling, the clock cycle is equal to one pulse output cycle from the modulator.
GPIO_EXT_SDn_IN is a signed number with a range of [-128, 127] and is used to control the duty cycle 1 of
PDM output signal.
• GPIO_EXT_SDn_IN = 127, the duty cycle of the output signal is near 100%.
The formula for calculating PDM signal duty cycle is shown as below:
Note:
For PDM signals, duty cycle refers to the percentage of high level cycles to the whole statistical period (several pulse
cycles, for example, 256 pulse cycles).
• Route one of SDM outputs to a pin via GPIO matrix, see Section 7.5.2.
This option is less flexible than routing signals via GPIO matrix, as the IO MUX register for each GPIO pin can
only select from a limited number of functions, but high-frequency digital performance can be
improved.
1. IO_MUX_GPIOn_MCU_SEL for the GPIO pin must be set to the required pin function. For the list of pin
functions, please refer to Section 7.12.
To bypass GPIO matrix for peripheral output signals, IO_MUX_GPIOn_MCU_SEL for the GPIO pin must be set to
the required pin function.
Note:
Not all signals can be directly connected to peripheral via IO MUX. Some input/output signals can only be connected
to peripheral via GPIO matrix.
If controlled by LP IO MUX, these pins will bypass IO MUX and GPIO matrix for the use by ULP and peripherals
in LP system.
When configured as LP GPIOs, the pins can still be controlled by ULP or the peripherals in LP system during
chip Deep-sleep, and wake up the chip from Deep-sleep.
If LP_AON_GPIO_MUX_SEL[n] is set to 1, then input/output signals are controlled by LP IO MUX. In this mode,
LP_IO_GPIOn_REG is used to control the LP GPIO pins. See 7-4 for the LP functions of each LP GPIO pin. Note
that LP_IO_GPIOn_REG applies the LP GPIO pin numbering, not the GPIO pin numbering.
Note:
If IO_MUX_GPIOn_SLP_SEL is set to 0, pin functions remain the same in both normal execution and in Light-sleep
mode. Please refer to Section 7.5.2 for how to enable output in normal execution.
– LP_AON_GPIO_HOLD0_REG[n] (n = 0 ~ 7), controls the Hold signal of each pin of GPIO0 ~ GPIO7.
– Or users can set PMU_TIE_HIGH_LP_PAD_HOLD_ALL to hold the values of all LP pins, and set
PMU_TIE_LOW_LP_PAD_HOLD_ALL to disable the hold function of all LP pins.
• GPIO_FUNCn_OEN_SEL = 0: use the output enable signal from peripheral, for example SPIQ_oe in the
column “Output enable signal when GPIO_FUNCn_OEN_SEL = 0” of Table 7-2. 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 “Output enable signal when GPIO_FUNCn_OEN_SEL = 0”, 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.
• Only the signals with a name assigned in the column “Input signal” in Table 7-2 are valid input signals.
• Only the signals with a name assigned in the column “Output signal” in Table 7-2 are valid output signals.
Signal Default Direct Input via Output enable signal when Direct Output
Input Signal Output Signal
No. value IO MUX GPIO_FUNCn_OEN_SEL = 0 via IO MUX
0 ext_adc_start 0 no ledc_ls_sig_out0 1’d1 no
1 - - - ledc_ls_sig_out1 1’d1 no
2 - - - ledc_ls_sig_out2 1’d1 no
3 - - - ledc_ls_sig_out3 1’d1 no
4 - - - ledc_ls_sig_out4 1’d1 no
5 - - - ledc_ls_sig_out5 1’d1 no
6 U0RXD_in 0 yes U0TXD_out 1’d1 yes
7 U0CTS_in 0 no U0RTS_out 1’d1 no
Submit Documentation Feedback
GoBack
24 - - - - - -
25 - - - - - -
Espressif Systems
39 - - - - - -
40 - - - - - -
41 - - - - - -
42 - - - - - -
43 - - - - - -
44 - - - - - -
45 I2CEXT0_SCL_in 1 no I2CEXT0_SCL_out I2CEXT0_SCL_oe no
46 I2CEXT0_SDA_in 1 no I2CEXT0_SDA_out I2CEXT0_SDA_oe no
ESP32-C6 TRM (Version 1.0)
GoBack
52 parl_rx_data5 0 no parl_tx_data5 1’d1 no
53 parl_rx_data6 0 no parl_tx_data6 1’d1 no
Espressif Systems
69 parl_rx_clk_in 0 no 1’d1 no
sdio_tohost_int_out
70 parl_tx_clk_in 0 no parl_tx_clk_out 1’d1 no
71 rmt_sig_in0 0 no rmt_sig_out0 1’d1 no
72 rmt_sig_in1 0 no rmt_sig_out1 1’d1 no
73 twai0_rx 1 no twai0_tx 1’d1 no
ESP32-C6 TRM (Version 1.0)
74 - - - twai0_bus_off_on 1’d1 no
75 - - - twai0_clkout 1’d1 no
76 - - - twai0_standby 1’d1 no
77 twai1_rx 1 no twai1_tx 1’d1 no
78 - - - twai1_bus_off_on 1’d1 no
GoBack
79 - - - twai1_clkout 1’d1 no
80 - - - twai1_standby 1’d1 no
Espressif Systems
94 pwm0_cap1_in 0 no - - -
95 pwm0_cap2_in 0 no - - -
96 - - - - - -
97 sig_in_func_97 0 no sig_in_func97 1’d1 no
98 sig_in_func_98 0 no sig_in_func98 1’d1 no
99 sig_in_func_99 0 no sig_in_func99 1’d1 no
100 sig_in_func_100 0 no sig_in_func100 1’d1 no
101 pcnt_sig_ch0_in0 0 no FSPICS1_out FSPICS1_oe yes
ESP32-C6 TRM (Version 1.0)
GoBack
107 pcnt_ctrl_ch0_in1 0 no - - -
108 pcnt_ctrl_ch1_in1 0 no - - -
Espressif Systems
118 - - - - - -
119 - - - - - -
120 - - - - - -
121 SPIQ_in 0 yes SPIQ_out SPIQ_oe yes
251
GoBack
7 IO MUX and GPIO Matrix (GPIO, IO MUX) GoBack
GPIO Pin Name Function 0 Function 1 Function 2 Function 3 DRV Reset Notes
0 XTAL_32K_P GPIO0 GPIO0 — — 2 0 R
1 XTAL_32K_N GPIO1 GPIO1 — — 2 0 R
2 GPIO2 GPIO2 GPIO2 FSPIQ — 2 1 R
3 GPIO3 GPIO3 GPIO3 — — 2 1 R
4 MTMS MTMS GPIO4 FSPIHD — 2 1 R
5 MTDI MTDI GPIO5 FSPIWP — 2 1 R
6 MTCK MTCK GPIO6 FSPICLK — 2 1* R
7 MTDO MTDO GPIO7 FSPID — 2 1 R
8 GPIO8 GPIO8 GPIO8 — — 2 1 —
9 GPIO9 GPIO9 GPIO9 — — 2 3 —
10 GPIO10 GPIO10 GPIO10 — — 2 1 S1
11 GPIO11 GPIO11 GPIO11 — — 2 1 S1
12 GPIO12 GPIO12 GPIO12 — — 3 1 USB
13 GPIO13 GPIO13 GPIO13 — — 3 3 USB
14 GPIO14 GPIO14 GPIO14 — — 2 1 S0
15 GPIO15 GPIO15 GPIO15 — — 2 1 —
16 U0TXD U0TXD GPIO16 FSPICS0 — 2 4 —
17 U0RXD U0RXD GPIO17 FSPICS1 — 2 3 —
18 SDIO_CMD SDIO_CMD GPIO18 FSPICS2 — 2 3 —
19 SDIO_CLK SDIO_CLK GPIO19 FSPICS3 — 2 3 —
20 SDIO_DATA0 SDIO_DATA0 GPIO20 FSPICS4 — 2 3 —
21 SDIO_DATA1 SDIO_DATA1 GPIO21 FSPICS5 — 2 3 —
22 SDIO_DATA2 SDIO_DATA2 GPIO22 — — 2 3 —
23 SDIO_DATA3 SDIO_DATA3 GPIO23 — — 2 3 —
24 SPICS0 SPICS0 GPIO24 — — 2 3 S1, S2
25 SPIQ SPIQ GPIO25 — — 2 3 S1, S2
26 SPIWP SPIWP GPIO26 — — 2 3 S1, S2
27 VDD_SPI GPIO27 GPIO27 — — 2 0 S1, S2
28 SPIHD SPIHD GPIO28 — — 2 3 S1, S2
29 SPICLK SPICLK GPIO29 — — 2 3 S1, S2
30 SPID SPID GPIO30 — — 2 3 S1, S2
Drive Strength
“DRV” column shows the drive strength of each pin after reset:
• 0 - Drive current = ~5 mA
Reset Configurations
“Reset” column shows the default configuration of each pin after reset:
• 0 - IE = 0 (input disabled)
• 1 - IE = 1 (input enabled)
Note:
• R - Pins in VDDPST1 domain, and part of them have analog functions, see Table 7-5.
• USB - GPIO12 and GPIO13 are USB pins. The pull-up value of the two pins are controlled by the pins’
pull-up value together with USB pull-up value. If any one of the pull-up value is 1, the pin’s pull-up resistor
will be enabled. The pull-up resistors of USB pins are controlled by USB_SERIAL_JTAG_DP_PULLUP.
• S0 - For chip variants without an in-package flash, this pin can not be used.
• S1 - For chip variants with an in-package flash, this pin can not be used.
• S2 - For chip variants with an in-package flash, this pin can only be used to connect the in-package
flash, i.e., only Function 0 is available. For chip variants without an in-package flash, this pin can be used
as a normal pin, i.e., all the functions are available.
LP Functions
LP GPIO No. GPIO No. GPIO Pin
0 1
0 0 XTAL_32K_P LP_GPIO0 lp_uart_dtrn1
1 1 XTAL_32K_N LP_GPIO1 lp_uart_dsrn1
2 2 GPIO2 LP_GPIO2 lp_uart_rtsn1
3 3 GPIO3 LP_GPIO3 lp_uart_ctsn1
4 4 MTMS LP_GPIO4 lp_uart_rxd1
5 5 MTDI LP_GPIO5 lp_uart_txd1
6 6 MTCK LP_GPIO6 lp_i2c_sda2
7 7 MTDO LP_GPIO7 lp_i2c_scl2
1 For the configuration of lp_uart_xx, please refer to Section: LP UART Controller in
Chapter 3 Low-Power CPU.
2 For the configuration of sar_i2c_xx, please refer to Section: LP I2C Controller in
Chapter 3 Low-Power CPU.
Table 7-5 shows the LP GPIO pins and how they correspond to GPIO pins and analog functions.
The GPIO ETM provides eight task channels x (0 ~ 7). The ETM tasks that each task channel can receive
are:
• Configure GPIO_ENABLE_REG[y] to 1;
• Configure GPIO_EXT_ETM_TASK_GPIOy_SEL to x;
Note:
• When GPIOy is controlled by ETM task channel, the values of GPIO_OUT_REG, GPIO_FUNCn_OUT_INV_SEL, and
GPIO_FUNCn_OUT_SEL may be modified by the hardware. For such reason, it’s recommended to reconfigure
these registers when the GPIO is free from the control of ETM task channel.
GPIO has eight event channels, and the ETM events that each event channel can generate are:
• GPIO_EVT_CHx_RISE_EDGE: Indicates that the output signal of the corresponding GPIO filter (see Figure
7-1) has a rising edge;
• GPIO_EVT_CHx_FALL_EDGE: Indicates that the output signal of the corresponding GPIO filter (see
Figure 7-1) has a falling edge;
• GPIO_EVT_CHx_ANY_EDGE: Indicates that the output signal of the corresponding GPIO filter (see Figure
7-1) is reversed.
Note:
One GPIO can be selected by one or more event channels.
In specific applications, GPIO ETM events can be used to trigger GPIO ETM tasks. For example, event channel
0 selects GPIO0, GPIO1 selects task channel 0, and the GPIO_EVT_CH0_RISE_EDGE event is used to trigger
the GPIO_TASK_CH0_TOGGLE task. When a square wave signal is input to the chip through GPIO0, the chip
outputs a square wave signal with a frequency divided by 2 through GPIO1.
The abbreviations given in Column Access are explained in Section Access Types for Registers.
Note: For chip variants with an in-package flash, 22 GPIO pins are available, i.e., GPIO0 ~ GPIO9 and GPIO12 ~
GPIO23. For this case:
• Configuration Registers: can only be configured for GPIO0 ~ GPIO9 and GPIO12 ~ GPIO23.
• Input Configuration Registers: can only be configured for GPIO0 ~ GPIO9 and GPIO12 ~ GPIO23.
Note: For chip variants with an in-package flash, only 22 GPIO pins are available, i.e., GPIO0 ~ GPIO9 and
GPIO12 ~ GPIO23. For this case, Configuration Registers of IO_MUX_GPIO10_REG ~ IO_MUX_GPIO11_REG and
IO_MUX_GPIO24_REG ~ IO_MUX_GPIO30_REG are not configurable.
The abbreviations given in Column Access are explained in Section Access Types for Registers.
The addresses in this section are relative to (GPIO base address + 0x0F00). GPIO base address is provided in
Table 5-2 in Chapter 5 System and Memory.
The abbreviations given in Column Access are explained in Section Access Types for Registers.
The abbreviations given in Column Access are explained in Section Access Types for Registers.
7.16 Registers
7.16.1 GPIO Matrix Registers
The addresses in this section are relative to GPIO base address provided in Table 5-2 in Chapter 5 System and
Memory.
G
RI
_O
TA
DA
UT_
_O
IO
GP
31 0
0x000000 Reset
GPIO_OUT_DATA_ORIG Configures the output value of GPIO0 ~ 30 output in simple GPIO output
mode.
0: Low level
1: High level
The value of bit0 ~ bit30 correspond to the output value of GPIO0 ~ GPIO30 respectively. Bit31
is invalid.
(R/W/SC/WTC)
31 0
0x000000 Reset
GPIO_OUT_W1TS Configures whether or not to set the output register GPIO_OUT_REG of GPIO0 ~
GPIO30.
0: Not set
1: The corresponding bit in GPIO_OUT_REG will be set to 1
Bit0 ~ bit30 are corresponding to GPIO0 ~ GPIO30. Bit31 is invalid. Recommended operation:
use this register to set GPIO_OUT_REG.
(WT)
C
1T
_W
UT
_O
IO
GP
31 0
0x000000 Reset
GPIO_OUT_W1TC Configures whether or not to clear the output register GPIO_OUT_REG of GPIO0
~ GPIO30 output.
0: Not clear
1: The corresponding bit in GPIO_OUT_REG will be cleared.
Bit0 ~ bit30 are corresponding to GPIO0 ~ GPIO30. Bit31 is invalid. Recommended operation:
use this register to clear GPIO_OUT_REG.
(WT)
31 0
0x000000 Reset
S
1T
_W
LE
B
NA
_E
IO
GP
31 0
0x000000 Reset
31 0
0x000000 Reset
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 0x00 Reset
• bit2: GPIO8
• bit3: GPIO9
• bit4: GPIO15
• bit5: MTMS
• bit6: MTDI
(RO)
31 0
0x000000 Reset
GPIO_IN_DATA_NEXT Represents the input value of GPIO0 ~ GPIO30. Each bit represents a pin
input value:
0: Low level
1: High level
Bit0 ~ bit30 are corresponding to GPIO0 ~ GPIO30. Bit31 is invalid.
(RO)
PT
RU
ER
NT
I
S_
TU
TA
_S
IO
GP
31 0
0x000000 Reset
GPIO_STATUS_INTERRUPT The interrupt status of GPIO0 ~ GPIO30, can be configured by the soft-
ware.
(R/W/WTC)
31 0
0x000000 Reset
• If the value 1 is written to a bit here, the corresponding bit in GPIO_STATUS_INTERRUPT will
be set to 1.
(WT)
C
1T
W
S_
TU
TA
_S
IO
GP
31 0
0x000000 Reset
• If the value 1 is written to a bit here, the corresponding bit in GPIO_STATUS_INTERRUPT will
be cleared.
(WT)
31 0
0x000000 Reset
GPIO_PROCPU_INT Represents the CPU interrupt status of GPIO0 ~ GPIO30. Each bit represents:
0: Represents CPU interrupt is not enabled, or the GPIO does not generate the interrupt config-
ured by GPIO_PINn_INT_TYPE.
1: Represents the GPIO generates an interrupt configured by GPIO_PINn_INT_TYPE after the CPU
interrupt is enabled.
Bit0 ~ bit30 are corresponding to GPIO0 ~ GPIO30. Bit31 is invalid. This interrupt status
is corresponding to the bit in GPIO_STATUS_REG when assert (high) enable signal (bit13 of
GPIO_PINn_REG).
(RO)
LE
SS
S
AB
_D AS
PA
NC ER
EN
YP
BY
SY RIV
P_
PE
IO n_P 1_B
A
2_
EN
EU
TY
NC
T_
T_
AK
AD
_P SY
IN
IN
W
n_
n_
n_
n_
GP INn
d)
GP ed)
)
ed
IN
IN
IN
IN
ve
I
P
_P
_P
_P
_P
rv
rv
O_
r
se
se
se
IO
IO
IO
IO
I
(re
(re
(re
GP
GP
GP
GP
31 18 17 13 12 11 10 9 7 6 5 4 3 2 1 0
GPIO_PINn_INT_ENA Configures whether or not to enable CPU interrupt or CPU non-maskable in-
terrupt.
(R/W)
31 0
0x000000 Reset
L
SE
V_
L
SE
IN
_I L
Cn SE
N_
N_
UN IN_
_I
Cn
_F _
IO IGn
)
UN
ed
GP _S
_F
rv
se
IO
IO
(re
GP
GP
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 0 0 0x0 Reset
GPIO_FUNCn_IN_SEL Configures to select a pin from the 31 GPIO pins to connect the input signal
n.
0: Select GPIO0
1: Select GPIO1
......
29: Select GPIO29
30: Select GPIO30
Or
0x38: A constantly high input
0x3C: A constantly low input
(R/W)
UT EL EL
EL
_O _S _S
_S
EL
C0 OEN INV
NV
_S
_I
UN 0_ _
UT
_F C EN
IO UN _O
_O
GP _F C0
C0
d)
IO U N
UN
ve
GP _F
_F
r
se
IO
IO
(re
GP
GP
31 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 0x80 Reset
GPIO_FUNCn_OUT_SEL Configures to select a signal Y (0 <= Y < 128) from 128 peripheral signals to
be output from GPIOn.
0: Select signal 0
1: Select signal 1
......
126: Select signal 126
127: Select signal 127
Or
128: Bit n of GPIO_OUT_REG and GPIO_ENABLE_REG are selected as the output value and output
enable.
(R/W/SC)
EN
K_
d)
L
ve
_C
r
se
IO
(re
GP
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
E
)
AT
ed
_D
rv
se
IO
(re
GP
31 28 27 0
0 0 0 0 0x1907040 Reset
T1
U
OU
U
_O
_O
K_
LK
LK
L
_C
_C
_C
)
ed
UX
UX
UX
rv
se
_M
_M
_M
(re
IO
IO
IO
31 15 14 10 9 5 4 0
_G On CU PU
_M _S D
V
_ U
D
EL
V
_E
On LP P
DR
E
UN P
_M WP
CU EL
DR
IO UX PI _M _IE
UX GPI _M U_W
PI _S _W
_O
_S
PI _F _IE
IO X_G _F _W
ER
_M _ On U_
N_
U
U
_G On UN
On UN
LT
_M _ On C
_M _ On C
FU
M
IO UX PI _M
FI
UX GPI _F
n_
n_
On
_M _ On
IO UX On
IO
O
PI
IO UX PI
PI
IO UX PI
P
_M GP
_G
_G
G
G
G
)
ed
_M _
_M _
UX
UX
UX
IO UX
rv
U
se
_M
_M
_M
_M
_M
(re
IO
IO
IO
IO
IO
31 16 15 14 12 11 10 9 8 7 6 5 4 3 2 1 0
IO_MUX_GPIOn_MCU_OE Configures whether or not to enable the output of GPIOn in sleep mode.
0: Disable
1: Enable
(R/W)
IO_MUX_GPIOn_MCU_IE Configures whether or not to enable the input of GPIOn during sleep
mode.
0: Disable
1: Enable
(R/W)
IO_MUX_GPIOn_FILTER_EN Configures whether or not to enable filter for pin input signals.
0: Disable
1: Enable
(R/W)
_
UX
rv
se
_M
(re
IO
31 28 27 0
0 0 0 0 0x2006050 Reset
E
AL
SC
RE
N
_P
I
n_
Dn
SD
_S
T_
d)
XT
X
ve
_E
_E
r
se
IO
IO
(re
GP
GP
31 16 15 8 7 0
GPIO_EXT_SDn_IN (n: 0 - 3) Configures the duty cycle of sigma delta modulation output.
(R/W)
)
XT
ed
GP rve
_E
rv
se
se
(re
(re
31 30 29 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Reset
GPIO_EXT_SD_FUNCTION_CLK_EN Configures whether or not to enable the clock for sigma delta
modulation.
0: Not enable
1: Enable
(R/W)
S
TH
M
RE
NU
ID
H
_W
_T
O_
W
_I
DO
DO
UT
IN
IN
N
IN
_W
_W
_E
n_
Hn
Hn
n
CH
CH
_C
_C
R_
R_
ER
ER
E
ILT
ILT
LT
LT
FI
FI
_F
_F
T_
T_
)
XT
XT
ed
X
E
_E
_E
_E
rv
O_
se
IO
IO
IO
I
(re
GP
GP
GP
GP
31 19 18 13 12 7 6 1 0
GPIO_EXT_FILTER_CHn_WINDOW_WIDTH Configures the window width for Glitch Filter. The effec-
tive value of window width is 0 ~ 62. 63 is a reserved value and cannot be used.
Measurement unit: IO MUX operating clock cycle
(R/W)
L
N
E
_S
_E
NT
NT
VE
VE
E
_E
n_
Hn
CH
_C
ed M_
M
ET
T
_E
(re XT_
)
XT
ed
_E
_E
rv
rv
se
se
IO
IO
(re
GP
GP
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 0x0 Reset
L
L
L
EN
EN
N
SE
SE
SE
N
SE
_E
_E
2_
2_
0_
0_
3_
1_
O3
O1
IO
IO
IO
IO
IO
IO
PI
PI
GP
GP
GP
GP
GP
GP
_G
_G
K_
K_
K_
K_
K_
K_
SK
K
AS
AS
AS
AS
AS
AS
AS
A
_T
_T
_T
_T
_T
_T
_T
_T
M
TM
TM
TM
TM
TM
TM
T
T
_E
_E
_E
_E
_E
_E
_E
T_
d)
)
XT
XT
XT
XT
XT
XT
XT
ed
ed
ed
EX
ve
_E
_E
_E
_E
_E
_E
_E
rv
rv
rv
O_
r
se
se
se
se
IO
IO
IO
IO
IO
IO
IO
I
(re
(re
(re
(re
GP
GP
GP
GP
GP
GP
GP
GP
31 28 27 25 24 23 20 19 17 16 15 12 11 9 8 7 4 3 1 0
L
L
EN
EN
SE
SE
SE
N
SE
_E
_E
6_
6_
5_
4_
4_
7_
O5
O7
IO
IO
IO
IO
IO
IO
PI
PI
GP
GP
GP
GP
GP
GP
_G
_G
K_
K_
K_
K_
K_
K_
SK
K
AS
AS
AS
AS
AS
AS
AS
A
_T
_T
_T
_T
_T
_T
_T
_T
TM
TM
TM
TM
TM
TM
TM
T
_E
_E
_E
_E
_E
_E
_E
T_
)
)
XT
XT
XT
XT
XT
XT
XT
ed
ed
ed
ed
EX
_E
_E
_E
_E
_E
_E
_E
rv
rv
rv
rv
O_
se
se
se
se
IO
IO
IO
IO
IO
IO
IO
I
(re
(re
(re
(re
GP
GP
GP
GP
GP
GP
GP
GP
31 28 27 25 24 23 20 19 17 16 15 12 11 9 8 7 4 3 1 0
EL
L
L
N
L
EN
SE
EN
N
SE
SE
_S
_E
_E
11_
1_
8_
8_
9_
10
10
O9
O1
IO
IO
IO
IO
IO
IO
PI
PI
GP
GP
GP
GP
GP
GP
_G
_G
K_
K_
K_
K_
K_
K_
SK
K
AS
AS
AS
AS
AS
AS
AS
A
_T
_T
_T
_T
_T
_T
_T
_T
M
TM
TM
TM
TM
TM
TM
T
T
_E
_E
_E
_E
_E
_E
_E
_E
)
)
XT
XT
XT
XT
XT
XT
XT
XT
ed
ed
ed
ed
_E
_E
_E
_E
_E
_E
_E
_E
rv<