ESP32-S31 Pinout and IO Resource Guide
The ESP32-S31 has 60 physical GPIO pins (GPIO0–GPIO61, except GPIO29 and GPIO41), including 8 low-power (LP) GPIO pins and 52 high-performance (HP) GPIO pins. Each pin can be used as a general-purpose IO or connected to an internal peripheral signal. Through the GPIO matrix and IO MUX, peripheral inputs can be routed from any IO pin and peripheral outputs can be routed to any IO pin. For details, see the ESP32-S31 Technical Reference Manual > IO MUX and GPIO Matrix (GPIO, IO_MUX) PDF.
Quick Start
If you are new to ESP32-S31 development, start with the recommended pin assignments below.
Basic Communication and Control
-
UART Pins Allocation — Used for code downloading, log monitoring, and basic serial communication.
- The ESP32-S31 chip integrates up to 4 main system UARTs and 1 low-power LP UART.
-
I2C Pin Allocation — Used for audio codec configuration and data interaction with various low-speed sensors.
- ESP32-S31 has two HP_I2C bus interfaces and one LP_I2C bus interface. Depending on the configuration, the HP_I2C bus interface can be used in I2C master or slave mode; the LP_I2C bus interface can only be used in I2C master mode. The bus speed can be configured up to 800 Kbit/s in fast mode.
-
SPI Pin Allocation — Used for high-speed memory read/write and serial screen control.
- The ESP32-S31 chip integrates 6 SPI controllers plus 1 low-power SPI (LP SPI), of which:
- SPI0 and SPI1 are reserved for in-package PSRAM and external flash respectively. By default, they are reserved for system use and cannot be modified by the user.
- 2 general-purpose SPI controllers are available to users (default: SPI2).
- 1 low-power SPI controller is available to users (default: LP SPI).
- The ESP32-S31 chip integrates 6 SPI controllers plus 1 low-power SPI (LP SPI), of which:
-
SDIO Pin Allocation — Used for 4-bit protocol-level transmission of high-speed TF cards and SD devices.
- The ESP32-S31 chip integrates a high-speed SDIO 3.0 host controller, supporting 1-line and 4-line transmission modes for SD memory cards, SDIO card readers, and SDIO peripherals.
-
USB Pin Allocation — Supports USB OTG high-speed bidirectional transmission and USB Serial/JTAG firmware download and debugging.
- ESP32-S31 supports multiple USB communication interfaces: a USB 2.0 OTG controller supporting full-speed/high-speed modes, and a USB Serial/JTAG debugger supporting program downloading, debugging, and CDC-ACM console.
-
Ethernet Pin Allocation — Native 1000 Mbps Gigabit Ethernet MAC, supporting RMII and RGMII.
- ESP32-S31 natively integrates an IEEE 802.3 compliant Gigabit Media Access Controller (EMAC), supporting Hardware Precision Time Protocol (IEEE 1588-2008 PTP). It provides physical channels for external Ethernet physical layer chips (Ethernet PHY, such as IP101G, RTL8211, etc.), supporting 10/100/1000 Mbps ultra-wide data transmission.
-
TWAI Pin Allocation — Used for CAN FD bus automotive and industrial-grade communication.
- ESP32-S31 supports a TWAI (Two-Wire Automotive Interface) controller, fully compatible with the CAN FD protocol specification, supporting communication rates from 1 Kbit/s to 1 Mbit/s.
-
RMT Pin Allocation — Used for infrared codec signal transceiver and driving WS2812 RGB LED strips.
- The RMT (Remote Control) peripheral of ESP32-S31 supports 4 transmit channels (TX) and 4 receive channels (RX).
-
LED PWM Pin Allocation — Pulse Width Modulation (LEDC), used for adjusting LED brightness or controlling motor speed.
- ESP32-S31 supports 2 groups of LED PWM controllers, with a total of 16 independent PWM generation channels and 4 independent hardware timers, supporting high-precision duty cycles (up to 20-bit) and high-frequency square wave output up to 40 MHz.
-
MCPWM Pin Allocation — Dedicated PWM generator for motor control.
- ESP32-S31 contains a Motor Control Pulse Width Modulator (MCPWM), with a total of 4 MCPWM outputs.
Analog Peripherals
-
ADC Pin Allocation — 12-bit high-precision SAR analog-to-digital converter for sampling external analog voltage signals.
- ESP32-S31 has 2 built-in 12-bit high-resolution Successive Approximation Register analog-to-digital converters (SAR ADC), supporting up to 16 analog measurement input channels, multi-channel continuous scanning, and ultra-high-speed, low-latency data transfer via AXI GDMA.
-
DAC Pin Allocation — Hardware digital-to-analog converter, used for outputting analog audio or waveforms.
- ESP32-S31 has 2 built-in 10-bit and 2 12-bit digital-to-analog conversion controllers (DAC), which can generate smooth analog waveforms or analog audio signals through digital algorithms or look-up tables, with an output range of 0V to 3.3V.
-
Touch Pin Allocation — Capacitive touch button, slider, or gesture control detection.
- ESP32-S31 supports up to 14 highly reliable capacitive touch sensing channels, capable of accurately capturing extremely small capacitance transitions through non-conductive cover plates (such as glass, acrylic, plastic), and supports strict EMC immunity testing.
Multimedia Peripherals
-
I2S Pin Allocation — Used to connect audio Codecs for high-quality digital audio capture and output.
- ESP32-S31 has 2 independent built-in I2S controllers, supporting hardware-level Bluetooth audio (LE Audio) synchronization and APLL high-precision clock source.
-
LCD and Camera Pin Allocation — Includes DVP camera, parallel RGB LCD screen.
- The LCD_CAM controller of ESP32-S31 contains an independent LCD control module and a Camera control module. It can connect external LCD and camera devices with flexible and diverse functions.
System Strapping/Boot Pins
- System Strapping/Boot Pin Allocation — Chip boot mode selection pin definitions.
JTAG Debug Pins
- JTAG Debug Pin Allocation — Used to connect external professional hardware debuggers for advanced debugging.
- The ESP32-S31 chip integrates two independent JTAG debug physical sources: a built-in USB Serial/JTAG debugger and a standard external physical JTAG interface.
UART Pin Allocation
1. UART0 Pin Allocation
UART0is the default serial console and firmware download interface. During reset and early boot, the chip outputs boot logs on this interface.
| Signal Name | Default Pin | GPIO Matrix Capability | Direction | Functional Description |
|---|---|---|---|---|
| U0TXD | GPIO58 | Restricted | Output | UART0 data transmit end, connected to external serial tool's RXD |
| U0RXD | GPIO59 | Restricted | Input | UART0 data receive end, connected to external serial tool's TXD |
2. UART1 ~ UART3 Pin Allocation
- All signal lines of
UART1~UART3support remapping to any idle GPIO via the GPIO matrix feature.
3. LP UART Pin Allocation
-
All signal lines of
LP UARTsupport remapping to any idle LP GPIO via the GPIO matrix feature. Meanwhile, LP UART also supports allocation using LP IO MUX pins.- LP UART IO MUX Pin Allocation
UART Signal Name LP IO Name GPIO Matrix Capability LP_UART_DTRN_PAD LP_GPIO2 Supported LP_UART_DTSN_PAD LP_GPIO3 Supported LP_UART_RTSN_PAD LP_GPIO4 Supported LP_UART_CTSN_PAD LP_GPIO5 Supported LP_UART_TXD_PAD LP_GPIO6 Supported LP_UART_RXD_PAD LP_GPIO7 Supported
[!NOTE]
- In scenarios with long hardware wiring, high-speed transmission (e.g., 3 Mbps), or high-frequency interference, it is recommended to keep traces as short as possible and add impedance matching to ensure absolute stability of serial communication.
I2C Pin Allocation
1. HP I2C Pin Allocation
- All signal lines of
HP I2Csupport remapping to any idle GPIO via the GPIO matrix feature.
2. LP I2C Pin Allocation
-
All signal lines of
LP I2Csupport remapping to any idle LP GPIO via the GPIO matrix feature. -
Meanwhile, LP I2C also supports allocation using LP IO MUX pins. LP I2C IO MUX Pin Allocation:
Signal Name LP IO MUX Pin GPIO Matrix Capability Direction Functional Description LP_I2C_SDA LP_GPIO7Supported Input/Output I2C data signal line, requires external 4.7 kΩ pull-up resistor LP_I2C_SCL LP_GPIO6Supported Output I2C clock signal line, requires external 4.7 kΩ pull-up resistor
[!NOTE]
- I2C is an Open-Drain bus. Pull-up resistors (typically 2.2 kΩ to 4.7 kΩ, connected to 3.3V) must be correctly connected on the PCB traces, otherwise it will lead to bus transmission timeouts and unexpected NACK errors.
SPI Pin Allocation
1. SPI0/1 Flash Pin Allocation
[!NOTE]
- SPI0 and SPI1 interfaces are reserved for Flash use and cannot be used by the user.
| Pin Name | GPIO | Flash Signal Pin | GPIO Matrix Capability | Direction | Functional Description |
|---|---|---|---|---|---|
| SPI0_CS | GPIO26 | FLASH_CS | Not Supported | Input/Output | SPI Chip Select signal (CS) |
| SPI0_Q | GPIO27 | FLASH_Q | Not Supported | Input/Output | SPI Data line 1 (MISO / D1) |
| SPI0_WP | GPIO28 | FLASH_WP | Not Supported | Input/Output | SPI Write Protect signal (WP / D2) |
| SPI0_HD | GPIO30 | FLASH_HOLD | Not Supported | Input/Output | SPI Hold signal (HOLD / D3) |
| SPI0_CLK | GPIO31 | CLK/FLASH_CLK | Not Supported | Output | SPI Serial Clock line (CLK) |
| SPI0_D | GPIO32 | FLASH_D | Not Supported | Input/Output | SPI Data line 0 (MOSI / D0) |
2. SPI2 Pin Allocation
General-purpose SPI2 supports remapping to any idle GPIO via the GPIO matrix feature. Meanwhile, general-purpose SPI2 also supports pin allocation via the IO MUX feature to obtain high-speed support.
-
HP SPI2 IO MUX Pin Allocation
-
1-bit HP SPI2 IO MUX Pin Allocation
SPI Signal Pin GPIO GPIO Matrix Capability Direction Functional Description SPI2_CLK GPIO20orGPIO53Supported Output SPI Serial Clock line SPI2_D0 GPIO21orGPIO54Supported Input/Output SPI Data line 0 (MOSI) SPI2_D1 GPIO22orGPIO55Supported Input/Output SPI Data line 1 (MISO) SPI2_CS GPIO23orGPIO52Supported Output (Master) / Input (Slave) SPI Chip Select signal (CS) SPI2_WP GPIO24orGPIO56Supported Input/Output Quad SPI Data line D3 (Legacy HOLD) SPI2_HD GPIO25orGPIO57Supported Input/Output Quad SPI Data line D2 (Legacy WP) -
8-bit HP SPI2 IO MUX Pin Allocation
SPI Signal Pin GPIO GPIO Matrix Capability Direction Functional Description SPI2_CLK GPIO12Supported Output SPI/OPI Clock signal SPI2_CS GPIO10Supported Output SPI Chip Select signal (CS) SPI2_D0 GPIO11Supported Input/Output SPI Data line 0 (MOSI) SPI2_D1 GPIO13Supported Input/Output SPI Data line 1 (MISO) SPI2_D2 GPIO14Supported Input/Output SPI2 Data line 2 (Quad mode) SPI2_D3 GPIO9Supported Input/Output SPI2 Data line 3 (Quad mode) SPI2_D4 GPIO15Supported Input/Output SPI2 Data line 4 (Octal mode) SPI2_D5 GPIO16Supported Input/Output SPI2 Data line 5 (Octal mode) SPI2_D6 GPIO17Supported Input/Output SPI2 Data line 6 (Octal mode) SPI2_D7 GPIO18Supported Input/Output SPI2 Data line 7 (Octal mode) SPI2_DQS GPIO19Supported Input Data Strobe signal in SPI2 high-speed DDR/OPI mode, used for synchronous sampling data at the receiving end
-
3. LP SPI Pin Allocation
-
ESP32-S31's LP SPI supports remapping to any idle LP GPIO via the GPIO matrix feature. Meanwhile, LP SPI also supports pin allocation via the IO MUX feature.
LP SPI IO MUX Pin Allocation
Signal Name Recommended Pin GPIO Matrix Capability Direction Functional Description LP_SPI_CLK LP_GPIO2Supported Output SPI Serial Clock line LP_SPI_CS LP_GPIO3Supported Input/Output SPI Chip Select signal (CS) LP_SPI_D LP_GPIO4Supported Input/Output SPI Data line 0 (MOSI) LP_SPI_Q LP_GPIO5Supported Input/Output SPI Data line 1 (MISO)
4. Recommended SPI Pins for Screen Display Control
If your development board is equipped with an LCD screen, its serial control lines typically use the following pins:
| Signal Name | Recommended Pin | GPIO Matrix Capability | Direction | Functional Description |
|---|---|---|---|---|
| LCD_MOSI | GPIO60 | Supported | Output | LCD screen SPI Data line |
| LCD_SCK | GPIO61 | Supported | Output | LCD screen SPI Clock line |
| LCD_CS | GPIO38 | Supported | Output | LCD screen SPI Chip Select signal |
SDIO Pin Allocation
For the SDIO host controller of ESP32-S31, Card 1 can use GPIO20GPIO25 via IO MUX, and Card 2 can use GPIO35GPIO40 via IO MUX. The GPIO matrix feature is not supported.
- SDIO Card 1 IO MUX Pin Allocation
| Signal Name | Corresponding Pin | GPIO Matrix Capability | Direction | Functional Description |
|---|---|---|---|---|
| SDIO_CLK | GPIO24 | Not Supported | Output | High-speed clock signal line |
| SDIO_CMD | GPIO25 | Not Supported | Input/Output | Command and response multiplexed signal line |
| SDIO_DATA0 | GPIO20 | Not Supported | Input/Output | Bidirectional data line 0 |
| SDIO_DATA1 | GPIO21 | Not Supported | Input/Output | Bidirectional data line 1 |
| SDIO_DATA2 | GPIO22 | Not Supported | Input/Output | Bidirectional data line 2 |
| SDIO_DATA3 | GPIO23 | Not Supported | Input/Output | Bidirectional data line 3 |
- SDIO Card 2 IO MUX Pin Allocation
| Signal Name | Corresponding Pin | GPIO Matrix Capability | Direction | Functional Description |
|---|---|---|---|---|
| SDIO_CLK | GPIO39 | Not Supported | Output | High-speed clock signal line |
| SDIO_CMD | GPIO40 | Not Supported | Input/Output | Command and response multiplexed signal line |
| SDIO_DATA0 | GPIO35 | Not Supported | Input/Output | Bidirectional data line 0 |
| SDIO_DATA1 | GPIO36 | Not Supported | Input/Output | Bidirectional data line 1 |
| SDIO_DATA2 | GPIO37 | Not Supported | Input/Output | Bidirectional data line 2 |
| SDIO_DATA3 | GPIO38 | Not Supported | Input/Output | Bidirectional data line 3 |
[!NOTE]
- SDIO 3.0 supports higher clock frequencies, so high-speed mode has stricter requirements for PCB differential routing and equal-length control. Meanwhile, pull-up resistors of about 10 kΩ are usually required in parallel on the data lines to prevent glitches or packet loss during transmission.
USB Pin Allocation
1. USB 2.0 HS OTG Pin Allocation
The USB OTG module integrates a built-in high-speed USB 2.0 PHY, which only supports dedicated pins directly connected to the USB Type-A or Type-C physical interface. It does not support the GPIO matrix feature.
| Signal Name | Physical Pin | GPIO Matrix Capability | Direction | Functional Description |
|---|---|---|---|---|
| USB2.0_DP | USB_DP | Not Supported | USB D+ | Dedicated high-speed differential data line positive (Pin 44) |
| USB2.0_DM | USB_DM | Not Supported | USB D- | Dedicated high-speed differential data line negative (Pin 45) |
2. USB Serial/JTAG Pin Allocation
The USB serial and JTAG debugger use specific IO MUX pins and do not support the GPIO matrix feature.
| Signal Name | Corresponding GPIO | GPIO Matrix Capability | Functional Description |
|---|---|---|---|
| USB_D+ | GPIO14 | Not Supported | Debugger physical differential signal positive |
| USB_D- | GPIO13 | Not Supported | Debugger physical differential signal negative |
[!NOTE]
- The dedicated debugger pins
GPIO13andGPIO14are also alternative pins for the SDIO interface. When SDIO is in 1-bit single-wire mode, the debugger can perfectly share usage with SDIO; however, once the SDIO interface is upgraded to 4-bit mode, the USB Serial/JTAG debug function cannot be used simultaneously.
Ethernet Pin Allocation
The Ethernet pins of ESP32-S31 can only be configured using dedicated high-speed IO MUX pins and do not support the GPIO matrix feature. Users can only choose one of the following two option groups to use, and they cannot be mixed.
| Physical Option Pin Group | Ethernet Interface Mode | Multiplexed GPIO | GPIO Matrix Capability | Interface Features and Description |
|---|---|---|---|---|
| Option Group A(Low-numbered pins, officially recommended) | RGMII Interface | GPIO8 ~ GPIO19 (Total 12 dedicated high-speed signal lines) | Not Supported | High-speed hard-bound bus, extremely high timing requirements, commonly used for Gigabit Ethernet interface development |
| Option Group A(Low-numbered pins, officially recommended) | RMII Interface | GPIO8, GPIO9, GPIO12, GPIO13, GPIO15, GPIO18, GPIO19 | Not Supported | Classic Fast Ethernet (100 Mbps) interface, significantly saves GPIO pin resources |
| Option Group B(High-numbered pins) | RGMII Interface | GPIO36 ~ GPIO47 (Total 12 dedicated high-speed signal lines) | Not Supported | Alternative Gigabit Ethernet hard-multiplexed pin group |
| Option Group B(High-numbered pins) | RMII Interface | GPIO36, GPIO37, GPIO40, GPIO41, GPIO43, GPIO44, GPIO45 | Not Supported | Alternative Fast Ethernet (100 Mbps) hard-multiplexed pin group |
[!NOTE]
- Compared to highly sensitive high-speed differential clock and data lines, the signal clock of the Ethernet physical control interface MDIO (Management Data Input/Output) is lower and supports remapping to any general-purpose GPIO pin via the GPIO matrix.
TWAI Pin Allocation
All signal lines of the TWAI interface of ESP32-S31 support remapping to any idle GPIO via the GPIO matrix feature.
| Signal Name | Recommended Pin | GPIO Matrix Capability | Direction | Functional Description |
|---|---|---|---|---|
| TWAI_TX (CAN_TX) | GPIO4 | Supported | Output | Transmit bus data, connected to TXD of external CAN transceiver |
| TWAI_RX (CAN_RX) | GPIO5 | Supported | Input | Receive bus data, connected to RXD of external CAN transceiver |
[!NOTE]
- The TWAI chip itself does not integrate a differential physical transceiver, so it is necessary to connect a standard CAN physical transceiver chip (such as TJA1050 or SN65HVD230) in the peripheral circuit design to connect to a real differential two-wire physical CAN bus network segment.
RMT Pin Allocation
All channel signal lines of RMT support remapping to any idle GPIO via the GPIO matrix feature.
| Recommended Peripheral Application | Recommended Pin | GPIO Matrix Capability | Direction | Functional Description |
|---|---|---|---|---|
| Onboard WS2812 Addressable RGB | GPIO60 (CoreBoard) / GPIO37 (Korvo Board) | Supported | Output | Pulse sequence for driving onboard color LED lights |
| IR_TX (Infrared Transmit Pin) | GPIO18 (Recommended) | Supported | Output | Output carrier infrared signal to drive infrared emitting diode |
| IR_RX (Infrared Receive Pin) | GPIO19 (Recommended) | Supported | Input | Capture demodulated pulse wave output by infrared integrated receiver |
LED PWM Pin Allocation
All channel signal lines of LEDC PWM support remapping to any idle GPIO via the GPIO matrix feature.
| Functional Application | Recommended Pin | GPIO Matrix Capability | Direction | Functional Description |
|---|---|---|---|---|
| PWM_RED | GPIO15 (Recommended) | Supported | Output | Drive red channel to achieve gradient/dimming effect |
| PWM_GREEN | GPIO16 (Recommended) | Supported | Output | Drive green channel to achieve gradient/dimming effect |
| PWM_BLUE | GPIO17 (Recommended) | Supported | Output | Drive blue channel to achieve gradient/dimming effect |
MCPWM Pin Allocation
The MCPWM pins of ESP32-S31 support remapping to any idle GPIO via the GPIO matrix feature.
| Signal Name | Recommended Pin | GPIO Matrix Capability | Direction | Functional Description |
|---|---|---|---|---|
| PWM0A | GPIO10 | Supported | Output | Phase A drive complementary output 1 |
| PWM0B | GPIO11 | Supported | Output | Phase A drive complementary output 2 (with dead-time complementary control) |
| PWM1A | GPIO12 | Supported | Output | Phase B drive complementary output 1 |
| PWM1B | GPIO13 | Supported | Output | Phase B drive complementary output 2 |
| PWM_FAULT | GPIO14 | Supported | Input | Hardware overcurrent/fault protection brake trigger line (high-level brake) |
ADC Pin Allocation
All input pins of ESP32-S31 ADC can only be configured via IO MUX pins and do not support the GPIO matrix feature.
| ADC Controller | Signal Channel | ADC Physical Signal Pin | Polarity Type | GPIO | GPIO Matrix Capability | Functional Description |
|---|---|---|---|---|---|---|
| ADC1 | Channel 0 | ADC1_CHANNEL0_N | Negative (N) | GPIO42 | Not Supported | Analog input channel 0 (Negative input terminal) |
| ADC1 | Channel 0 | ADC1_CHANNEL0_P | Positive (P) | GPIO43 | Not Supported | Analog input channel 0 (Positive input terminal) |
| ADC1 | Channel 1 | ADC1_CHANNEL1_N | Negative (N) | GPIO44 | Not Supported | Analog input channel 1 (Negative input terminal) |
| ADC1 | Channel 1 | ADC1_CHANNEL1_P | Positive (P) | GPIO45 | Not Supported | Analog input channel 1 (Positive input terminal) |
| ADC1 | Channel 2 | ADC1_CHANNEL2_N | Negative (N) | GPIO46 | Not Supported | Analog input channel 2 (Negative input terminal) |
| ADC1 | Channel 2 | ADC1_CHANNEL2_P | Positive (P) | GPIO47 | Not Supported | Analog input channel 2 (Positive input terminal) |
| ADC1 | Channel 3 | ADC1_CHANNEL3_N | Negative (N) | GPIO48 | Not Supported | Analog input channel 3 (Negative input terminal) |
| ADC1 | Channel 3 | ADC1_CHANNEL3_P | Positive (P) | GPIO49 | Not Supported | Analog input channel 3 (Positive input terminal) |
| ADC2 | Channel 0 | ADC2_CHANNEL0_N | Negative (N) | GPIO50 | Not Supported | Analog input channel 0 (Negative input terminal) |
| ADC2 | Channel 0 | ADC2_CHANNEL0_P | Positive (P) | GPIO51 | Not Supported | Analog input channel 0 (Positive input terminal) |
| ADC2 | Channel 1 | ADC2_CHANNEL1_N | Negative (N) | GPIO52 | Not Supported | Analog input channel 1 (Negative input terminal) |
| ADC2 | Channel 1 | ADC2_CHANNEL1_P | Positive (P) | GPIO53 | Not Supported | Analog input channel 1 (Positive input terminal) |
| ADC2 | Channel 2 | ADC2_CHANNEL2_N | Negative (N) | GPIO54 | Not Supported | Analog input channel 2 (Negative input terminal) |
| ADC2 | Channel 2 | ADC2_CHANNEL2_P | Positive (P) | GPIO55 | Not Supported | Analog input channel 2 (Positive input terminal) |
| ADC2 | Channel 3 | ADC2_CHANNEL3_N | Negative (N) | GPIO56 | Not Supported | Analog input channel 3 (Negative input terminal) |
| ADC2 | Channel 3 | ADC2_CHANNEL3_P | Positive (P) | GPIO57 | Not Supported | Analog input channel 3 (Positive input terminal) |
DAC Pin Allocation
All analog signal pins of ESP32-S31's DAC can only be configured via IO MUX pins and do not support the GPIO matrix feature.
| Signal Name | Hardware Pin | Output Channel | GPIO Matrix Capability | Functional Description |
|---|---|---|---|---|
| DAC_PAD0 | GPIO4 | Corresponds to DAC Channel 0 | Not Supported | Analog output terminal 0 |
| DAC_PAD1 | GPIO5 | Corresponds to DAC Channel 1 | Not Supported | Analog output terminal 1 |
Touch Pin Allocation
- The touch sensor interface of ESP32-S31 is multiplexed with GPIO2
GPIO15, LP_GPIO2LP_GPIO15, LP_UART interface, and a set of four-wire interface pins of SPI2. When the analog function is configured to be effective, the digital function multiplexed with it is invalid. - The touch sensor interface of ESP32-S31 can only be configured via IO MUX pins and does not support the GPIO matrix feature.
| Touch Channel | Multiplexed GPIO | GPIO Matrix Capability |
|---|---|---|
| TOUCH_CHANNEL0 | GPIO6 | Not Supported |
| TOUCH_CHANNEL1 | GPIO7 | Not Supported |
| TOUCH_CHANNEL2 | GPIO8 | Not Supported |
| TOUCH_CHANNEL3 | GPIO9 | Not Supported |
| TOUCH_CHANNEL4 | GPIO10 | Not Supported |
| TOUCH_CHANNEL5 | GPIO11 | Not Supported |
| TOUCH_CHANNEL6 | GPIO12 | Not Supported |
| TOUCH_CHANNEL7 | GPIO13 | Not Supported |
| TOUCH_CHANNEL8 | GPIO14 | Not Supported |
| TOUCH_CHANNEL9 | GPIO15 | Not Supported |
| TOUCH_CHANNEL10 | GPIO16 | Not Supported |
| TOUCH_CHANNEL11 | GPIO17 | Not Supported |
| TOUCH_CHANNEL12 | GPIO18 | Not Supported |
| TOUCH_CHANNEL13 | GPIO19 | Not Supported |
I2S Pin Allocation
The I2S pins of ESP32-S31 support remapping to any idle GPIO via the GPIO matrix feature.
| Signal Name | Recommended Pin | GPIO Matrix Capability | Direction | Functional Description |
|---|---|---|---|---|
| I2S_MCLK | GPIO2 | Supported | Output | Master clock signal line, used for external audio chip or system synchronization |
| I2S_SCLK (BCLK) | GPIO3 | Supported | Output | Bit clock signal line, controls the transmission of each audio data bit |
| I2S_LRCLK (WS) | GPIO4 | Supported | Output | Frame sync / Left-right channel selection signal line |
| I2S_DSIN | GPIO5 | Supported | Input | Audio data input line (Serial ADC data input) |
| I2S_SDOUT | GPIO6 | Supported | Output | Audio data output line (Serial DAC data output) |
LCD and Camera Pin Allocation
The CAM and LCD interfaces of the Camera-LCD controller of ESP32-S31 can be configured to use any idle GPIO pins via the GPIO matrix. Meanwhile, LCD and Camera controller pins also support allocation using IO MUX pins.
1. DVP Camera (8-bit Parallel DVP) IO MUX Pin Allocation
| Signal Name | Recommended Pin | GPIO Matrix Capability | Functional Description |
|---|---|---|---|
| CAM_D0 ~ CAM_D7 | GPIO46 ~ GPIO53 | Supported | 8-bit parallel video data input lines |
| CAM_PCLK | GPIO54 | Supported | Camera pixel clock signal line |
| CAM_XCLK | GPIO55 | Supported | Camera drive system clock signal line |
| CAM_VSYNC | GPIO56 | Supported | Camera frame sync signal line |
| CAM_HSYNC | GPIO57 | Supported | Camera line sync signal line |
2. 16-bit Parallel RGB LCD Screen IO MUX Pin Allocation
| Signal Name | Recommended Pin | GPIO Matrix Capability | Functional Description |
|---|---|---|---|
| DB0 ~ DB11 | GPIO8 ~ GPIO19 | Supported | Screen display parallel data lines (lower 12 bits) |
| DB12 ~ DB15 | GPIO33 ~ GPIO36 | Supported | Screen display parallel data lines (upper 4 bits) |
| LCD_PCLK | GPIO40 | Supported | LCD pixel clock line |
| LCD_DE (H_EN) | GPIO43 | Supported | LCD data enable control line |
| LCD_HSYNC | GPIO44 | Supported | LCD horizontal line sync signal line |
| LCD_VSYNC | GPIO45 | Supported | LCD vertical frame sync signal line |
System Strapping/Boot Pin Allocation
During chip power-on reset, the system determines the boot mode of the chip based on the voltage levels of the following specific Strapping pins. Avoid attaching external devices to these pins that would change their initial voltage levels.
| Physical Pin Name | Function | Internal Power-on Initial State | Default Level | Boot Mode and Hardware Design Considerations |
|---|---|---|---|---|
| GPIO36 | VDD_SPI Voltage Detection | Weak Pull-Up | 1 | 3.3V Flash requires high level; 1.8V Flash requires low level. |
| GPIO37 | JTAG Signal Source Control | Floating | Floating | Defaults to floating state when there is no strong external interference. |
| GPIO60 | ROM Log Print Control | Weak Pull-Up | 1 | Default pulled high. Together with GPIO61 controls boot behavior, keeps default 1 in boot from Flash (SPI Boot) mode. |
| GPIO61 | Chip Boot Mode Control | Weak Pull-Up | 1 | Core Download/Run Selection Pin. Pulled low to 0 externally at the moment of power-on reset enters firmware download mode, floating/pulled high to 1 boots from Flash. |
JTAG Debug Pin Allocation
1. Built-in USB Serial/JTAG Debug Pins
- Through the built-in USB physical transceiver, developers only need to use a USB cable directly connected to the chip pins to achieve full-speed JTAG downloading and hardware/software online debugging, without any external debugger (such as J-Link or ESP-Prog).
- USB-JTAG debug pins must strictly be called via IO MUX, remapping via GPIO matrix is not supported:
| Signal Name | Hard-bound Pin | GPIO Matrix Capability | Direction | Functional Description |
|---|---|---|---|---|
| USB_D+ | GPIO14 | Not Supported | Input/Output | Built-in debugger physical differential signal positive |
| USB_D- | GPIO13 | Not Supported | Input/Output | Built-in debugger physical differential signal negative |
2. External Physical JTAG Pins (IO MUX)
- If it is necessary to connect an external professional hardware debugger, ESP32-S31 also provides dedicated physical JTAG pins.
- JTAG external physical debug pins are multiplexed with some pins of
ADC2andSPI2, must strictly be configured via IO MUX, remapping via GPIO matrix is not supported:
| Signal Name | Hard-bound Pin | GPIO Matrix Capability | Direction | Chip IO Physical Functional Description |
|---|---|---|---|---|
| MTCK | GPIO55 | Not Supported | Input | Test Clock input line |
| MTDO | GPIO54 | Not Supported | Output | Test Data Out line |
| MTDI | GPIO56 | Not Supported | Input | Test Data In line |
| MTMS | GPIO57 | Not Supported | Input | Test Mode Select line |
JTAG Debug Path Selection and Control Mechanism
The switching between built-in USB JTAG and external physical JTAG is jointly controlled by the initial level state of the Strapping pin GPIO37 at the moment of system power-on reset (RST), and the underlying eFuse:
JTAG Path Switching Control Rules
| Debug Interface Source | GPIO37 Level at Boot Moment | EFUSE_JTAG_SEL_ENABLE Fuse State | Debug Mode Description |
|---|---|---|---|
| Built-in USB JTAG | Pulled Low / 0 | 0 (Default state) | System default state. Debug signals go through built-in USB PHY, GPIO54 ~ GPIO57 can be used as normal GPIOs. |
| External Physical JTAG | Pulled High / 1 | 0 (Default state) | External JTAG enabled. Debug signals switch to physical pins GPIO54 ~ GPIO57, debugging is taken over by external debugger. |
| Permanently Bound Physical JTAG | Any state | 1 | Physical JTAG permanently effective, USB JTAG debugging is hard-shielded. |
[!NOTE]
- Attention: The default state of
GPIO37at the moment of power-on reset is floating (high impedance). To ensure the system defaults to using the most convenient built-in USB Serial/JTAG debugger after power-on, it is recommended to attach a 10 kΩ pull-down resistor to theGPIO37pin, or ensure that external circuits will not pull this pin high at the moment of reset, to prevent accidentally switching the debug path to external physical JTAG causing USB debugging to be unavailable.
Global Physical GPIO and Function Allocation Table
The following table lists pin details. Some GPIOs have usage restrictions; see the notes in the table.
| GPIO Number | Analog Function | LP_GPIO (RTC GPIO) | Notes and Physical Usage Restrictions |
|---|---|---|---|
| GPIO0 | - | LP_GPIO0 | Can be multiplexed as XTAL_32K_N (external low-frequency crystal oscillator negative), providing RTC ultra-low power high-precision clock timing. |
| GPIO1 | - | LP_GPIO1 | Can be multiplexed as XTAL_32K_P (external low-frequency crystal oscillator positive). |
| GPIO2 | - | LP_GPIO2 | LP IO MUX, supports low-power peripherals and sleep wake-up. |
| GPIO3 | - | LP_GPIO3 | LP IO MUX, supports low-power peripherals and sleep wake-up. |
| GPIO4 | DAC0 | LP_GPIO4 | Hardware digital-to-analog converter channel 0, supports analog waveform and audio output under low power consumption. |
| GPIO5 | DAC1 | LP_GPIO5 | Hardware digital-to-analog converter channel 1. |
| GPIO6 | TOUCH0 | LP_GPIO6 | Capacitive touch sensing channel 0, supports Deep-sleep low-power touch button wake-up. |
| GPIO7 | TOUCH1 | LP_GPIO7 | Capacitive touch sensing channel 1, supports Deep-sleep low-power touch button wake-up. |
| GPIO8 | TOUCH2 | - | Capacitive touch sensing channel 2; Gigabit Ethernet (Option Group A) dedicated line. |
| GPIO9 | TOUCH3 | - | Capacitive touch sensing channel 3; Gigabit Ethernet (Option Group A) dedicated line. |
| GPIO10 | TOUCH4 | - | Capacitive touch sensing channel 4. |
| GPIO11 | TOUCH5 | - | Capacitive touch sensing channel 5. |
| GPIO12 | TOUCH6 | - | Capacitive touch sensing channel 6; Gigabit Ethernet (Option Group A) dedicated line. |
| GPIO13 | TOUCH7 | - | Dual Purpose/Conflict: Capacitive touch channel 7; Built-in debugger USB_D-. When SDIO uses 4-bit transmission mode, the debugger will be completely disabled! |
| GPIO14 | TOUCH8 | - | Dual Purpose/Conflict: Capacitive touch channel 8; Built-in debugger USB_D+. Similarly, 4-bit SDIO mode will cause severe physical conflict with the debugger! |
| GPIO15 | TOUCH9 | - | Capacitive touch sensing channel 9; Gigabit Ethernet (Option Group A) dedicated line. |
| GPIO16 | TOUCH10 | - | Capacitive touch sensing channel 10. |
| GPIO17 | TOUCH11 | - | Capacitive touch sensing channel 11. |
| GPIO18 | TOUCH12 | - | Capacitive touch sensing channel 12; Gigabit Ethernet (Option Group A) dedicated line. |
| GPIO19 | TOUCH13 | - | Capacitive touch sensing channel 13; Gigabit Ethernet (Option Group A) dedicated line. |
| GPIO20 | - | - | General-purpose GPIO; Recommended for high-speed SDIO DATA0 or SPI2. |
| GPIO21 | - | - | General-purpose GPIO; Recommended for high-speed SDIO DATA1 or SPI2. |
| GPIO22 | - | - | General-purpose GPIO; Recommended for high-speed SDIO DATA2 or SPI2. |
| GPIO23 | - | - | General-purpose GPIO; Recommended for high-speed SDIO DATA3 or SPI2. |
| GPIO24 | - | - | General-purpose GPIO; Recommended for high-speed SDIO CLK or SPI2. |
| GPIO25 | - | - | General-purpose GPIO; Recommended for high-speed SDIO CMD or SPI2. |
| GPIO26 | - | - | SPI0/1 Dedicated Bus: Connects to Flash chip select pin SPICS / flash_cs_pad, application layer must never reconfigure, strictly forbidden for other uses! |
| GPIO27 | - | - | SPI0/1 Dedicated Bus: Connects to Flash data output pin SPIQ / flash_q_pad (D1), strictly forbidden for other uses! |
| GPIO28 | - | - | SPI0/1 Dedicated Bus: Connects to Flash write protect pin SPIWP / flash_wp_pad (D2), strictly forbidden for other uses! |
| GPIO30 | - | - | SPI0/1 Dedicated Bus: Connects to Flash hold pin SPIHD / flash_hold_pad (D3), strictly forbidden for other uses! |
| GPIO31 | - | - | SPI0/1 Dedicated Bus: Connects to Flash clock pin SPICLK / flash_ck_pad (CLK), strictly forbidden for other uses! |
| GPIO32 | - | - | SPI0/1 Dedicated Bus: Connects to Flash data input pin SPID / flash_d_pad (D0), strictly forbidden for other uses! |
| GPIO33 | - | - | General-purpose GPIO. |
| GPIO34 | - | - | General-purpose GPIO. |
| GPIO35 | - | - | General-purpose GPIO. |
| GPIO36 | - | - | Strapping Pin: System boot selection pin; Gigabit Ethernet (Option Group B) dedicated line. Do not add external strong pull-up/pull-down levels. |
| GPIO37 | - | - | Strapping Pin; Analog comparator input COMP0 channel; Gigabit Ethernet (Option Group B) dedicated line. |
| GPIO38 | - | - | Strapping Pin (Boot Mode 0); Analog comparator input COMP1 channel. |
| GPIO39 | - | - | Strapping Pin (Boot Mode 1); Analog comparator input COMP2 channel. |
| GPIO40 | - | - | Strapping Pin (Boot Mode 2); Analog comparator input COMP3 channel; Gigabit Ethernet (Option Group B) dedicated line. |
| GPIO42 | ADC1_CH0_N | - | 12-bit SAR ADC1 Channel 0 (Negative terminal, hard-bound). |
| GPIO43 | ADC1_CH0_P | - | 12-bit SAR ADC1 Channel 0 (Positive terminal, hard-bound); Gigabit Ethernet (Option Group B) dedicated line. |
| GPIO44 | ADC1_CH1_N | - | Dual Purpose: ADC1 Channel 1 (Negative terminal); Built-in high-speed USB 2.0 HS OTG physical PHY data line DP (Pin 44). |
| GPIO45 | ADC1_CH1_P | - | Dual Purpose: ADC1 Channel 1 (Positive terminal); Built-in high-speed USB 2.0 HS OTG physical PHY data line DM (Pin 45). |
| GPIO46 | ADC1_CH2_N | - | 12-bit SAR ADC1 Channel 2 (Negative terminal, hard-bound). |
| GPIO47 | ADC1_CH2_P | - | 12-bit SAR ADC1 Channel 2 (Positive terminal, hard-bound); Gigabit Ethernet (Option Group B) dedicated line. |
| GPIO48 | ADC1_CH3_N | - | 12-bit SAR ADC1 Channel 3 (Negative terminal, hard-bound). |
| GPIO49 | ADC1_CH3_P | - | 12-bit SAR ADC1 Channel 3 (Positive terminal, hard-bound). |
| GPIO50 | ADC2_CH0_N | - | 12-bit SAR ADC2 Channel 0 (Negative terminal, hard-bound). |
| GPIO51 | ADC2_CH0_P | - | 12-bit SAR ADC2 Channel 0 (Positive terminal, hard-bound). |
| GPIO52 | ADC2_CH1_N | - | 12-bit SAR ADC2 Channel 1 (Negative terminal, hard-bound). |
| GPIO53 | ADC2_CH1_P | - | 12-bit SAR ADC2 Channel 1 (Positive terminal, hard-bound). |
| GPIO54 | ADC2_CH2_N | - | 12-bit SAR ADC2 Channel 2 (Negative terminal, hard-bound). |
| GPIO55 | ADC2_CH2_P | - | 12-bit SAR ADC2 Channel 2 (Positive terminal, hard-bound). |
| GPIO56 | ADC2_CH3_N | - | 12-bit SAR ADC2 Channel 3 (Negative terminal, hard-bound). |
| GPIO57 | ADC2_CH3_P | - | 12-bit SAR ADC2 Channel 3 (Positive terminal, hard-bound). |
| GPIO58 | - | - | UART0 Physical Debug Serial TXD (System default debug terminal log output pin, floating/weak pull-up). |
| GPIO59 | - | - | UART0 Physical Debug Serial RXD (System default receive pin). |
| GPIO60 | - | - | Strapping Pin (Boot Mode 3); Weak pull-up. |
| GPIO61 | - | - | Strapping Pin (Boot Mode 4); System Boot/Firmware Download Mode Selection physical pin, pull low at power-on to enter download mode, floating/pull high to enter Flash execution. |