ESP32-S31-Function-CoreBoard-1

Overview

ESP32-S31-Function-CoreBoard-1 is a development board based on the ESP32-S31-WROOM-3 module, which carries the ESP32-S31, a dual-core RISC-V SoC with 2.4 GHz Wi-Fi 6, Bluetooth 5.4 (LE and BR/EDR) and IEEE 802.15.4 connectivity, 16 MB of flash and 16 MB of PSRAM.

For more information, check the ESP32-S31-Function-CoreBoard-1 User Guide [5].

Hardware

The board exposes two USB Type-C ports: a USB-to-UART bridge used for power and serial console, and the ESP32-S31 USB Serial/JTAG port used for power, flashing and debugging. A USB 2.0 Type-A host port is wired to the USB OTG high-speed interface.

Besides the radio interfaces, the board carries a 10/100/1000 Mbps Ethernet port with its PHY and transformer, an ES8311 mono audio codec with an onboard microphone, and an NS4150B class D amplifier. An addressable RGB LED is driven by GPIO60 and the BOOT button is on GPIO61. The serial console runs on GPIO58 (TX) and GPIO59 (RX).

Most of the remaining I/O pins are broken out to the 40-pin J2 header, and the J5 headers allow measuring the module current consumption.

ESP32-S31 Features

ESP32-S31 is a dual-core 32-bit RISC-V SoC integrating 2.4 GHz Wi-Fi 6, Bluetooth 5.4 (LE and Classic), IEEE 802.15.4 and a 1000 Mbps Ethernet MAC. It targets applications with rich human-machine interfaces, audio and multi-protocol connectivity, and adds a low-power (LP) 32-bit RISC-V coprocessor, in-package PSRAM and dedicated image processing hardware.

ESP32-S31 includes the following features:

  • Dual-core 32-bit RISC-V HP processor with a clock speed of up to 320 MHz

  • RV32IMAFC instruction set with Zc and Zb extensions, plus Espressif hardware loop extensions

  • Single-precision floating-point unit (FPU) on each core

  • 128-bit data path with SIMD instructions on one of the cores

  • Private instruction cache per core and a shared data cache

  • 32-bit RISC-V LP processor with a clock speed of up to 40 MHz

  • 320 KB of ROM

  • 512 KB of HP SRAM

  • 32 KB of LP SRAM

  • In-package PSRAM over an 8-bit DDR interface at up to 250 MHz

  • External flash over SPI, Dual SPI, Quad SPI, Octal SPI, QPI and OPI, with concurrent flash and PSRAM access

Wireless connectivity:

  • Wi-Fi 6 (IEEE 802.11ax), 1T1R in the 2.4 GHz band

  • 20 MHz-only non-AP mode for 802.11ax, with uplink and downlink OFDMA and downlink MU-MIMO

  • Compatible with IEEE 802.11b/g/n, 20 MHz and 40 MHz bandwidth, data rate up to 150 Mbps

  • Bluetooth LE: Bluetooth 5.4 certified, 125 Kbps, 500 Kbps, 1 Mbps and 2 Mbps PHYs

  • Bluetooth LE Audio (isochronous channels, BIS and CIS)

  • Bluetooth direction finding (AoA and AoD) and Bluetooth Mesh 1.1

  • Bluetooth Classic (BR/EDR): basic rate 1 Mbps and enhanced data rate 2 Mbps and 3 Mbps

  • Up to 7 ACL links, up to 2 synchronous links and up to 3 piconets simultaneously, for classic audio profiles such as A2DP and HFP

  • IEEE 802.15.4-2015 compliant radio (Thread and Zigbee), O-QPSK PHY at 250 Kbps

  • Internal co-existence mechanism between Wi-Fi, Bluetooth and IEEE 802.15.4 to share the same antenna

Digital interfaces:

  • 60 programmable GPIOs

  • 4x UART

  • 1x Low-power (LP) UART

  • 2x General purpose SPI

  • 1x Low-power (LP) SPI

  • 2x I2C

  • 1x Low-power (LP) I2C

  • 2x I2S, with PDM and TDM support and hardware-level Bluetooth audio

  • 1x SDIO host controller with 2 slots

  • 1x USB 2.0 OTG High-Speed (HS) with embedded PHY

  • 1x USB Serial/JTAG controller

  • 1x 1000 Mbps Ethernet MAC

  • 2x TWAI controllers with CAN FD support, compatible with ISO 11898-1:2015

  • 1x LCD and camera controller: 8 to 24-bit parallel LCD (i80 and RGB) and 8 to 16-bit DVP camera

  • 1x Parallel IO (PARLIO) controller

  • 1x BitScrambler

  • LED PWM controller, up to 8 channels

  • 4x Motor control PWM (MCPWM)

  • 2x Pulse counter, 4 units each

  • 1x Remote control peripheral (RMT), 4 TX and 4 RX channels

  • General DMA controller (GDMA) over AHB and AXI buses

  • 2D-DMA controller

  • Event task matrix (ETM)

Image, audio and math accelerators:

  • 1x JPEG codec (encoder and decoder)

  • 1x 2D Pixel Processing Accelerator (PPA)

  • 1x Audio sample rate converter (ASRC)

  • 1x CORDIC accelerator

Analog interfaces:

  • 2x 12-bit SAR ADC, up to 16 channels

  • 2x DAC

  • 1x Analog voltage comparator (1 reference input and 3 comparison inputs)

  • 14x Capacitive touch sensor channels

  • 1x Temperature sensor

Timers:

  • 1x 52-bit system timer

  • 4x 54-bit general-purpose timers

  • 3x Watchdog timers

  • RTC timer

Low Power:

  • Multiple power modes designed for typical scenarios: Active, Modem-sleep, Light-sleep, Deep-sleep

  • Power Management Unit (PMU) with sleep retention of peripheral registers

  • Brown-out detector

Security:

  • Secure boot

  • Flash and PSRAM encryption (XTS-AES-128 and XTS-AES-256)

  • Cryptographic hardware acceleration: AES-128/256, SHA (up to SHA-512), RSA (up to 4096 bits), ECC (up to P-384), HMAC

  • RSA digital signature (DS) and ECDSA peripherals

  • Key manager with PUF-based key protection

  • True random number generator (TRNG)

  • Trusted Execution Environment (TEE) with Access Permission Management (APM)

  • Secure debug controller

  • Power glitch detector

Low-Power CPU (LP CORE)

The ESP32-S31 SoC has a Low-Power (LP) 32-bit RISC-V coprocessor in addition to the dual HP cores. The LP Core features ultra low power consumption, an interrupt controller, a debug module and a system bus interface for memory and peripheral access.

The LP Core is in sleep mode by default. It has two application scenarios:

  • Power insensitive scenario: When the HP cores are active, the LP Core can assist with some speed and efficiency-insensitive controls and computations.

  • Power sensitive scenario: When the HP cores are in the power-down state to save power, the LP Core can be woken up to handle some external wake-up events.

For more information, check the ESP32-S31 Datasheet [1].

Supported Features

The esp32s31_function_coreboard board supports the hardware features listed below.

on-chip / on-board
Feature integrated in the SoC / present on the board.
2 / 2
Number of instances that are enabled / disabled.
Click on the label to see the first instance of this feature in the board/SoC DTS files.
vnd,foo
Compatible string for the Devicetree binding matching the feature.
Click on the link to view the binding documentation.

esp32s31_function_coreboard/esp32s31/hpcore target

On-target memory for this board target: 512 KiB of RAM, 16 MiB of Flash.

Type

Location

Description

Compatible

CPU

on-chip

Espressif RISC-V CPU2

espressif,riscv

ADC

on-chip

ESP32 ADC2

espressif,esp32-adc

Bluetooth

on-chip

Bluetooth HCI for Espressif ESP321

espressif,esp32-bt-hci

CAN

on-chip

Espressif ESP32 TWAI-FD (CAN-FD capable Two-Wire Automotive Interface) controller11

espressif,esp32-twaifd

Clock control

on-chip

ESP32 Clock (Power & Clock Controller Module) Module1

espressif,esp32-clock

Comparator

on-chip

Espressif Analog Comparator (ana_cmpr)1

espressif,esp32-ana-cmpr

Counter

on-chip

ESP32 general-purpose timers2

espressif,esp32-timer

on-chip

ESP32 counters2

espressif,esp32-counter

on-chip

ESP32 Counter Driver based on RTC Main Timer1

espressif,esp32-rtc-timer

Cryptographic accelerator

on-chip

Espressif ESP32 family AES Hardware Accelerator1

espressif,esp32-aes

on-chip

Espressif ESP32 SHA Hardware Accelerator1

espressif,esp32-sha

DMA

on-chip

ESP32 GDMA (General Direct Memory Access)2

espressif,esp32-gdma

Flash controller

on-chip

ESP32 flash controller1

espressif,esp32-flash-controller

GPIO & Headers

on-chip

ESP32 GPIO controller2

espressif,esp32-gpio

I2C

on-chip

ESP32 I2C11

espressif,esp32-i2c

Input

on-board

Group of GPIO-bound input keys1

gpio-keys

Interrupt controller

on-chip

ESP32 Interrupt controller1

espressif,esp32-intc

LED strip

on-board

Worldsemi WS2812 LED strip, pulse_io binding1

worldsemi,ws2812-pulse-io

Mailbox

on-chip

ESP32 soft mailbox1

espressif,mbox-esp32

Memory controller

on-chip

ESP32 pseudo-static RAM controller1

espressif,esp32-psram

MTD

on-chip

Flash node1

soc-nv-flash

Pin control

on-chip

ESP32 pin controller1

espressif,esp32-pinctrl

Pulse IO

on-chip

Espressif Remote Control Transceiver (RMT) pulse_io controller1

espressif,esp32-rmt

PWM

on-chip

ESP32 Motor Control Pulse Width Modulator (MCPWM)2

espressif,esp32-mcpwm

on-chip

ESP32 LED Control (LEDC)1

espressif,esp32-ledc

Regulator

on-chip

Espressif ESP32 on-chip LDO voltage regulators1

espressif,esp32-regulator

RNG

on-chip

ESP32 TRNG (True Random Number Generator)1

espressif,esp32-trng

Sensors

on-chip

ESP32 Pulse Counter (PCNT)1

espressif,esp32-pcnt

on-chip

ESP32 internal temperature sensor1

espressif,esp32-temp

Serial controller

on-chip

ESP32 UART12

espressif,esp32-uart

on-chip

ESP32 UART1

espressif,esp32-usb-serial

on-chip

ESP32 Low Power UART1

espressif,esp32-lpuart

SPI

on-chip

ESP32 SPI controller2

espressif,esp32-spi

Timer

on-chip

ESP32 System Timer1

espressif,esp32-systimer

USB

on-chip

Espressif USB-OTG high-speed controller (DWC2 compatible) with the internal UTMI PHY1

espressif,esp32-usb-otg-hs

Watchdog

on-chip

ESP32 watchdog11

espressif,esp32-watchdog

Wi-Fi

on-chip

ESP32 SoC Wi-Fi1

espressif,esp32-wifi

esp32s31_function_coreboard/esp32s31/lpcore target

On-target memory for this board target: 30704 B of RAM, 16 MiB of Flash.

Type

Location

Description

Compatible

CPU

on-chip

Espressif RISC-V CPU1

espressif,riscv

Flash controller

on-chip

ESP32 flash controller1

espressif,esp32-flash-controller

GPIO & Headers

on-chip

ESP32 GPIO controller1

espressif,esp32-gpio

Interrupt controller

on-chip

ESP32 Interrupt controller1

espressif,esp32-intc

Mailbox

on-chip

ESP32 soft mailbox1

espressif,mbox-esp32

MTD

on-chip

Flash node1

soc-nv-flash

Serial controller

on-chip

ESP32 Low Power UART1

espressif,esp32-lpuart

SRAM

on-chip

Generic on-chip SRAM1

mmio-sram

System Requirements

Binary Blobs

Espressif HAL requires RF binary blobs in order work. Run the command below to retrieve those files.

west blobs fetch hal_espressif

Note

It is recommended running the command above after west update.

Programming and Debugging

The esp32s31_function_coreboard board supports the runners and associated west commands listed below.

flash debug attach rtt debugserver
esp32 ✅ (default)
openocd ✅ ✅ (default) ✅ ✅ ✅

Simple Boot

The board could be loaded using the single binary image, without 2nd stage bootloader. It is the default option when building the application without additional configuration.

Note

Simple boot does not provide any security features nor OTA updates.

MCUboot Bootloader

User may choose to use MCUboot bootloader instead. In that case the bootloader must be built (and flashed) at least once.

There are two options to be used when building an application:

  1. Sysbuild

  2. Manual build

Note

User can select the MCUboot bootloader by adding the following line to the board default configuration file.

CONFIG_BOOTLOADER_MCUBOOT=y

Sysbuild

The sysbuild makes possible to build and flash all necessary images needed to bootstrap the board with the ESP32 SoC.

To build the sample application using sysbuild use the command:

west build -b <board> --sysbuild samples/hello_world

By default, the ESP32 sysbuild creates bootloader (MCUboot) and application images. But it can be configured to create other kind of images.

Build directory structure created by sysbuild is different from traditional Zephyr build. Output is structured by the domain subdirectories:

build/
├── hello_world
│   └── zephyr
│       ├── zephyr.elf
│       └── zephyr.bin
├── mcuboot
│    └── zephyr
│       ├── zephyr.elf
│       └── zephyr.bin
└── domains.yaml

Note

With --sysbuild option the bootloader will be re-build and re-flash every time the pristine build is used.

For more information about the system build please read the Sysbuild (System build) documentation.

Manual Build

During the development cycle, it is intended to build & flash as quickly possible. For that reason, images can be built one at a time using traditional build.

The instructions following are relevant for both manual build and sysbuild. The only difference is the structure of the build directory.

Note

Remember that bootloader (MCUboot) needs to be flash at least once.

Build and flash applications as usual (see Building an Application and Run an Application for more details).

# From the root of the zephyr repository
west build -b <board> samples/hello_world

The usual flash target will work with the board configuration. Here is an example for the Hello World application.

# From the root of the zephyr repository
west build -b <board> samples/hello_world
west flash

Note

On targets that expose the built-in USB Serial/JTAG controller, the chip can stay in download mode after west flash and will not boot the new image until it is power cycled. If that happens, flash with a watchdog reset so the chip restarts on its own:

west flash --reset-type watchdog-reset

Faster Flashing

To speed up the development cycle, --esp-skip-flashed skips writing the image when the binary already in flash matches the one being flashed, verified with an MD5 check on the device:

west flash --esp-skip-flashed

For an even faster reflash, --esp-diff writes only the regions that differ from the previously flashed image. It compares against a locally cached copy rather than reading the device, so use it only when the flash was not modified by another tool, board, or manual write since the last west flash:

west flash --esp-diff

Progress output can be suppressed for cleaner logs, which is useful in CI:

west flash --esp-no-progress

Open the serial monitor using the following command:

west espressif monitor

After the board has automatically reset and booted, you should see the following message in the monitor:

***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx *****
Hello World! <board>

Board variants using Snippets

ESP32 boards can be assembled with different modules using multiple combinations of SPI flash sizes, PSRAM sizes and PSRAM modes. The snippets under snippets/espressif provide a modular way to apply these variations at build time without duplicating board definitions.

The following snippet-based variants are supported:

Snippet name

Description

Flash memory size

espressif-flash-4M

Board with 4MB of flash

espressif-flash-8M

Board with 8MB of flash

espressif-flash-16M

Board with 16MB of flash

espressif-flash-32M

Board with 32MB of flash

espressif-flash-64M

Board with 64MB of flash

espressif-flash-128M

Board with 128MB of flash

PSRAM memory size

espressif-psram-2M

Board with 2MB of PSRAM

espressif-psram-4M

Board with 4MB of PSRAM

espressif-psram-8M

Board with 8MB of PSRAM

PSRAM utilization

espressif-psram-reloc

Relocate flash to PSRAM

espressif-psram-wifi

Wi-Fi buffers in PSRAM

To apply a board variant, use the -S flag with west build:

west build -b <board> -S espressif-flash-32M -S espressif-psram-4M samples/hello_world

Note

These snippets are only applicable to boards with compatible hardware support for the selected flash/PSRAM configuration.

  • If no FLASH snippet is used, the board default flash size will be used.

  • If no PSRAM snippet is used, the board default psram size will be used.

Debugging

OpenOCD Debugging

Espressif chips require a custom OpenOCD build with ESP32-specific patches. Download the latest release from OpenOCD for ESP32 [2].

For detailed JTAG setup instructions, see JTAG debugging for ESP32 [4].

Zephyr Thread Awareness

OpenOCD supports Zephyr RTOS thread awareness, allowing GDB to:

  • List all threads with info threads

  • Display thread names, priorities, and states

  • Switch between thread contexts

  • Show backtraces for any thread

Requirements:

Example:

# From the root of the zephyr repository
west build -b <board> samples/hello_world -- -DCONFIG_DEBUG_THREAD_INFO=y -DOPENOCD=<path/to/bin/openocd> -DOPENOCD_DEFAULT_PATH=<path/to/openocd/share/openocd/scripts>
west debug

Using a Custom OpenOCD

The Zephyr SDK includes a bundled OpenOCD, but it may not have ESP32 support. To use the Espressif OpenOCD, specify the path when building:

# From the root of the zephyr repository
west build -b <board> samples/hello_world -- -DOPENOCD=/path/to/openocd -DOPENOCD_DEFAULT_PATH=/path/to/openocd/scripts
west debug

References