Back to Riot

Doc Esp32s3.Doc

cpu/esp32/doc_esp32s3.doc.md

2026.07-devel17.6 KB
Original Source
<!-- SPDX-FileCopyrightText: 2025 Gunar Schorcht SPDX-License-Identifier: LGPL-2.1-only -->

@defgroup cpu_esp32_esp32s3 ESP32-S3 family @ingroup cpu_esp32 @brief Specific properties of ESP32-S3 variant (family) @author Gunar Schorcht [email protected]

\section esp32_riot_esp32s3 Specific properties of ESP32-S3 variant (family)

Embedded Flash and SPI RAM {#esp32_embedded_flash_ram_esp32s3}

There are many different versions of the ESP32-S3 chip and ESP32-S3 modules used on ESP32-S3 boards. They differ in the size of embedded Flash and SPI RAM as well as used SPI mode for Flash and SPI RAM. These differences allow dozens of different versions of a board. For example, there are 8 versions of the ESP32-S3 DevKitC-1 board with different flash and SPI RAM sizes.

<center> | Chip | Flash (Mode) | SPI RAM (Mode) | SPI Voltage |:--------------|:---------------:|:----------------:|:----------- | ESP32-S3 | - | - | 3.3 V/1.8 V | ESP32-S3FN8 | 8 MB (Quad SPI) | - | 3.3 V | ESP32-S3R2 | - | 2 MB (Quad SPI) | 3.3 V | ESP32-S3R8 | - | 8 MB (Octal SPI) | 3.3 V | ESP32-S3R8V | - | 8 MB (Octal SPI) | 1.8 V | ESP32-S3FH4R2 | 4 MB (Quad SPI) | 2 MB (Quad SPI) | 3.3 V </center> <center> | Module | Chip | Flash (Mode) | SPI RAM (Mode) |:-------------------------|:--------------|:-----------------:|:-------------- | ESP32-S3-WROOM-1x-N4 | ESP32-S3 | 4 MB (Quad SPI) | - | ESP32-S3-WROOM-1x-N8 | ESP32-S3 | 8 MB (Quad SPI) | - | ESP32-S3-WROOM-1x-N16 | ESP32-S3 | 16 MB (Quad SPI) | - | ESP32-S3-WROOM-1x-H4 | ESP32-S3 | 4 MB (Quad SPI) | - | ESP32-S3-WROOM-1x-N4R2 | ESP32-S3R2 | 4 MB (Quad SPI) | 2 MB (Quad SPI) | ESP32-S3-WROOM-1x-N8R2 | ESP32-S3R2 | 8 MB (Quad SPI) | 2 MB (Quad SPI) | ESP32-S3-WROOM-1x-N16R2 | ESP32-S3R2 | 16 MB (Quad SPI) | 2 MB (Quad SPI) | ESP32-S3-WROOM-1x-N4R8 | ESP32-S3R8 | 4 MB (Quad SPI) | 8 MB (Octal SPI) | ESP32-S3-WROOM-1x-N8R8 | ESP32-S3R8 | 8 MB (Quad SPI) | 8 MB (Octal SPI) | ESP32-S3-WROOM-1x-N16R8 | ESP32-S3R8 | 16 MB (Quad SPI) | 8 MB (Octal SPI) | ESP32-S3-WROOM-2-N16R8V | ESP32-S3R8V | 16 MB (Octal SPI) | 8 MB (Octal SPI) | ESP32-S3-WROOM-2-N32R8V | ESP32-S3R8V | 32 MB (Octal SPI) | 8 MB (Octal SPI) | ESP32-S3-MINI-1x-N8 | ESP32-S3FN8 | 8 MB (Quad SPI) | - | ESP32-S3-MINI-1x-N4R2 | ESP32-S3FH4R2 | 4 MB (Quad SPI) | 2 MB (Quad SPI) | ESP32-S3-MINI-1x-H4R2 | ESP32-S3FH4R2 | 4 MB (Quad SPI) | 2 MB (Quad SPI) </center> <b>x</b> Stands for the module versions with and without U (external antenna connector).

Depending on the chip or module used, it has to be specified as a feature in the board definition whether SPI RAM is available (feature \ref esp32_spi_ram "esp_spi_ram") and whether Octal SPI Mode is used for the SPI RAM (feature \ref esp32_spi_ram "esp_spi_oct").

If the feature esp_spi_ram is given, the SPI RAM can be used as heap by using the pseudo module esp_spi_ram.

If Quad SPI mode is used, GPIO26 ... GPIO32 are occupied and cannot be used for other purposes. In case of Octal SPI mode, the pseudomodule esp_spi_oct is additionally enabled and GPIO33 ... GPIO37 are occupied if the SPI RAM is enabled by using the pseudomodule esp_spi_ram. GPIO33 ... GPIO37 are then not available for other purposes. Conflicts may occur when using these GPIOs.

GPIO pins {#esp32_gpio_pins_esp32s3}

ESP32-S3 has 45 GPIO pins, where a subset can be used as ADC channel and as low-power digital input/output in deep-sleep mode, the so-called RTC GPIOs. Some of them are used by special SoC components and are not broken out on all ESP32-S3 modules. The following table gives a short overview.

<center>
PinTypeADCRTCPU / PDSpecial functionRemarks
GPIO0In/Out-XX-Bootstrapping
GPIO1In/OutXXX--
GPIO2In/OutXXX--
GPIO3In/OutXXX-Bootstrapping
GPIO4In/OutXXX--
GPIO5In/OutXXX--
GPIO6In/OutXXX--
GPIO7In/OutXXX--
GPIO8In/OutXXX--
GPIO9In/OutXXX--
GPIO10In/OutXXX--
GPIO11In/OutXXX--
GPIO12In/OutXXX--
GPIO13In/OutXXX--
GPIO14In/OutXXX--
GPIO15In/OutXXXXTAL_32K_PExternal 32k crystal
GPIO16In/OutXXXXTAL_32K_NExternal 32k crystal
GPIO17In/OutXXX--
GPIO18In/OutXXX--
GPIO19In/OutXXXUSB D-USB 2.0 OTG / USB-JTAG bridge
GPIO20In/OutXXXUSB D+USB 2.0 OTG / USB-JTAG bridge
GPIO21In/Out-XX--
GPIO26In/Out--XFlash/PSRAM SPICS1not available if SPI RAM is used
GPIO27In/Out--XFlash/PSRAM SPIHDnot available
GPIO28In/Out--XFlash/PSRAM SPIWPnot available
GPIO29In/Out--XFlash/PSRAM SPICS0not available
GPIO30In/Out--XFlash/PSRAM SPICLKnot available
GPIO31In/Out--XFlash/PSRAM SPIQnot available
GPIO32In/Out--XFlash/PSRAM SPIDnot available
GPIO33In/Out--XFlash/PSRAM SPIQ4not available if octal Flash or SPI RAM is used
GPIO34In/Out--XFlash/PSRAM SPIQ5not available if octal Flash or SPI RAM is used
GPIO35In/Out--XFlash/PSRAM SPIQ6not available if octal Flash or SPI RAM is used
GPIO36In/Out--XFlash/PSRAM SPIQ7not available if octal Flash or SPI RAM is used
GPIO37In/Out--XFlash/PSRAM SPIQ8not available if octal Flash or SPI RAM is used
GPIO38In/Out--XFlash/PSRAM SPIDQSnot available if octal Flash or SPI RAM is used
GPIO39In/Out--XMTCKJTAG interface
GPIO40In/Out--XMTDOJTAG interface
GPIO41In/Out--XMTDIJTAG interface
GPIO42In/Out--XMTMSJTAG interface
GPIO43In/Out--XUART0 TXConsole
GPIO44In/Out--XUART0 RXConsole
GPIO45In/Out--X-Bootstrapping (0 - 3.3V, 1 - 1.8V)
GPIO46In/Out--X-Bootstrapping
GPIO47In/Out--XSPICLK_P-
GPIO48In/Out--XSPICLK_N-
</center> <b>PSRAM</b> - Stands for pseudo-static RAM and refers to the SPI RAM.

<b>ADC:</b> Pins that can be used as ADC channels.

<b>RTC:</b> Pins that are RTC GPIOs and can be used in deep-sleep mode.

<b>PU/PD:</b> Pins that have software configurable pull-up/pull-down functionality.

Strapping pins {#esp32_gpio_pins_esp32s3_strapping}

GPIO0, GPIO3, GPIO45 and GPIO46 are bootstrapping. GPIO0 and GPIO46 pins are used to boot ESP32-S3 in different modes:

<center>
GPIO0GPIO46Mode
1XSPI Boot mode to boot the firmware from flash (default mode)
01Download Boot mode for flashing the firmware
</center>

If EFUSE_STRAP_JTAG_SEL is set, GPIO3 is used to select the interface that is used as JTAG interface.

<center>
GPIO3Mode
1USB-JTAG bridge at GPIO19 and GPIO20 is used as JTAG interface
0GPIO39 to GPIO42 are used as JTAG interface
</center>

@note If EFUSE_DIS_USB_JTAG or EFUSE_DIS_PAD_JTAG are set, the interface selection is fixed and GPIO3 is not used as bootstrapping pin.

GPIO45 is used to select the voltage VDD_SPI for the Flash/PSRAM interfaces SPI0 and SPI1.

ADC Channels {#esp32_adc_channels_esp32s3}

ESP32-S3 integrates two 12-bit ADCs (ADC1 and ADC2) with 20 channels in total:

  • ADC1 supports 10 channels: GPIO1 ... GPIO10
  • ADC2 supports 10 channels: GPIO11 ... GPIO20

@note

  • ADC2 is also used by the WiFi module. The GPIOs connected to ADC2 are therefore not available as ADC channels if the modules esp_wifi or esp_now are used.
  • GPIO3 is a strapping pin und shouldn't be used as ADC channel

I2C Interfaces {#esp32_i2c_interfaces_esp32s3}

ESP32-S3 has two built-in I2C interfaces.

The following table shows the default configuration of I2C interfaces used for ESP32-S3 boards. It can be overridden by application-specific configurations.

<center>
DeviceSignalPinSymbolRemarks
I2C_DEV(0)#I2C0_SPEEDdefault is I2C_SPEED_FAST
I2C_DEV(0)SCLGPIO9#I2C0_SCL-
I2C_DEV(0)SDAGPIO8#I2C0_SDA-
</center>

PWM Channels {#esp32_pwm_channels_esp32s3}

The ESP32-S3 LEDC module has 1 channel group with 8 channels. Each of these channels can be clocked by one of the 4 timers.

SDMMC Interfaces {#esp32_sdmmc_interfaces_esp32s3}

The ESP32-S3 variant uses the GPIO matrix (i.e. SOC_SDMMC_USE_GPIO_MATRIX is defined in the SoC Capabilities file) to route the SDMMC signals to arbitrary pins. The GPIOs used for the SDMMC signals are therefore configurable and have to be defined in the board-specific configuration in array @ref sdmmc_config in addition to the used slot.

The width of the data bus used is determined by the GPIOs defined for the DAT lines. To use a 1-bit data bus, only DAT0 (@ref sdmmc_conf_t::dat0) must be defined. All other GPIOs for the DAT lines must be set undefined (@ref GPIO_UNDEF). For a 4-bit data bus, the GPIOs for pins DAT1 to DAT3 (@ref sdmmc_conf_t::dat1 ... @ref sdmmc_conf_t::dat3) must also be defined. An 8-bit data bus width requires the definition of DAT4 to DAT7 (@ref sdmmc_conf_t::dat4 ... @ref sdmmc_conf_t::dat7) and the enabling of the periph_sdmmc_8bit module.

The following example shows a configuration with 4-bit or 8-bit data bus width dependent on whether the periph_sdmmc_8bit module is enabled.

{.c}
static const sdmmc_conf_t sdmmc_config[] = {
    {
        .slot = SDMMC_SLOT_0,
        .cd = GPIO16,
        .wp = GPIO_UNDEF,
        .clk = GPIO14,
        .cmd = GPIO15,
        .dat0 = GPIO2,
        .dat1 = GPIO4,
        .dat2 = GPIO12,
        .dat3 = GPIO13,
#if IS_USED(MODULE_PERIPH_SMMC_8BIT)
        .dat4 = GPIO33,
        .dat5 = GPIO33,
        .dat6 = GPIO33,
        .dat7 = GPIO33,
#endif
    },
};

#define SDMMC_NUMOF 1

If the board supports a Card Detect pin or a Write Protect pin, the corresponding GPIOs have to be defined in @ref sdmmc_conf_t::cd and @ref sdmmc_conf_t::wp. Otherwise they have to be set to undefined (@ref GPIO_UNDEF).

SPI Interfaces {#esp32_spi_interfaces_esp32s3}

ESP32-S3 has four SPI controllers where SPI0 and SPI1 share the same bus and can only operate in memory mode while SPI2 and SPI3 can be used as general purpose SPI:

  • controller SPI0 is reserved for external memories like Flash and PSRAM
  • controller SPI1 is reserved for external memories like Flash and PSRAM
  • controller SPI2 can be used for peripherals (also called FSPI)
  • controller SPI3 can be used for peripherals

Thus, SPI2 (FSPI) and SPI3 can be used as general purpose SPI in RIOT as SPI_DEV(0) and SPI_DEV(1) by defining the symbols SPI0_* and SPI1_*.

The following table shows the pin configuration used by default, even though it can vary from board to board.

<center>
DeviceSignalPinSymbolRemarks
SPI0_HOST/SPI1_HOSTSPICS0GPIO29-reserved for flash and PSRAM
SPI0_HOST/SPI1_HOSTSPICS1GPIO26-reserved for flash and PSRAM
SPI0_HOST/SPI1_HOSTSPICLKGPIO30-reserved for flash and PSRAM
SPI0_HOST/SPI1_HOSTSPIDGPIO32-reserved for flash and PSRAM
SPI0_HOST/SPI1_HOSTSPIQGPIO31-reserved for flash and PSRAM
SPI0_HOST/SPI1_HOSTSPIHDGPIO27-reserved for flash and PSRAM (only in qio or qout mode)
SPI0_HOST/SPI1_HOSTSPIWPGPIO28-reserved for flash and PSRAM (only in qio or qout mode)
SPI0_HOST/SPI1_HOSTSPIIO4GPIO33-reserved for Flash and PSRAM (only in octal mode)
SPI0_HOST/SPI1_HOSTSPIIO5GPIO34-reserved for Flash and PSRAM (only in octal mode)
SPI0_HOST/SPI1_HOSTSPIIO6GPIO35-reserved for Flash and PSRAM (only in octal mode)
SPI0_HOST/SPI1_HOSTSPIIO7GPIO36-reserved for Flash and PSRAM (only in octal mode)
SPI0_HOST/SPI1_HOSTSPIDQAGPIO37-reserved for Flash and PSRAM (only in octal mode)
SPI2_HOST (FSPI)SCKGPIO12#SPI0_SCKcan be used
SPI2_HOST (FSPI)MOSIGPIO11#SPI0_MOSIcan be used
SPI2_HOST (FSPI)MISOGPIO13#SPI0_MISOcan be used
SPI2_HOST (FSPI)CS0GPIO10#SPI0_CS0can be used
</center>

Timers {#esp32_timers_esp32s3}

ESP32-S3 has two timer groups with two timers each, resulting in a total of four timers. Since one timer is used as system timer, up to three timers with one channel each can be used in RIOT as timer devices TIMER_DEV(0) ... TIMER_DEV(2).

Additionally ESP32-S3 has three CCOMPARE registers which can be used alternatively as timer devices TIMER_DEV(0) ... TIMER_DEV(2) can be used in RIOT if the module esp_hw_counter is enabled.

UART Interfaces {#esp32_uart_interfaces_esp32s3}

ESP32 integrates three UART interfaces. The following default pin configuration of UART interfaces as used by a most boards can be overridden by the application, see section [Application-Specific Configurations] (#esp32_application_specific_configurations).

<center>
DeviceSignalPinSymbolRemarks
UART_DEV(0)TxDGPIO43#UART0_TXDcannot be changed
UART_DEV(0)RxDGPIO44#UART0_RXDcannot be changed
UART_DEV(1)TxDGPIO17#UART1_TXDoptional, can be overridden
UART_DEV(1)RxDGPIO18#UART1_RXDoptional, can be overridden
UART_DEV(2)TxD-UART2_TXDoptional, can be overridden
UART_DEV(2)RxD-UART2_RXDoptional, can be overridden
</center>

JTAG Interface {#esp32_jtag_interface_esp32s3}

There are two options on how to use the JTAG interface on ESP32-S3:

  1. Using the built-in USB-to-JTAG bridge connected to an USB cable as follows:

    USB SignalESP32-S3 Pin
    D- (white)GPIO19
    D+ (green)GPIO20
    V_Bus (red)5V
    Ground (black)GND

    @note This option requires that the USB D- and USB D+ signals are connected to the ESP32-S3 USB interface at GPIO19 and GPIO20.

  2. Using an external JTAG adapter connected to the JTAG interface exposed to GPIOs as follows:

    JTAG SignalESP32S3 Pin
    TRST_NCHIP_PU
    TDOGPIO40 (MTDO)
    TDIGPIO41 (MTDI)
    TCKGPIO39 (MTCK)
    TMSGPIO42 (MTMS)
    GNDGND

Using the built-in USB-to-JTAG is the default option, i.e. the JTAG interface of the ESP32-S3 is connected to the built-in USB-to-JTAG bridge. To use an external JTAG adapter, the JTAG interface of the ESP32-S3 has to be connected to the GPIOs as shown above. For this purpose eFuses have to be burned with the following command:

espefuse.py burn_efuse JTAG_SEL_ENABLE --port /dev/ttyUSB0

Once the eFuses are burned with this command and option JTAG_SEL_ENABLE, GPIO3 is used as a bootstrapping pin to choose between the two options. If GPIO3 is HIGH when ESP32-S3 is reset, the JTAG interface is connected to the built-in USB to JTAG bridge and the USB cable can be used for on-chip debugging. Otherwise, the JTAG interface is exposed to GPIO39 ... GPIO42 and an external JTAG adapter has to be used.

Alternatively, the integrated USB-to-JTAG bridge can be permanently disabled with the following command:

espefuse.py burn_efuse DIS_USB_JTAG --port /dev/ttyUSB0

Once the eFuses are burned with this command and option DIS_USB_JTAG, the JTAG interface is always exposed to GPIO4 ... GPIO7 and an external JTAG adapter has to be used.

@note Burning eFuses is an irreversible operation.

For more information about JTAG configuration for ESP32-S3, refer to the section [Configure Other JTAG Interface] (https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/jtag-debugging/configure-other-jtag.html) in the ESP-IDF documentation.