Loading...
Searching...
No Matches
Adafruit Metro ESP32-S2

Support for the Adafruit Metro ESP32-S2 board. More...

Detailed Description

Support for the Adafruit Metro ESP32-S2 board.

Author
Gunar Schorcht gunar.nosp@m.@sch.nosp@m.orcht.nosp@m..net

Adafruit Metro ESP32-S2

Overview

The Adafruit Metro ESP32-S2 is an ESP32-S2 board in the Arduino UNO R3 form factor with 4 MB Flash and 2 MB PSRAM.

Adafruit Metro ESP32-S2

The main features of the board are:

Hardware

MCU

Most features of the board are provided by the ESP32-S2 SoC. For detailed information about the ESP32-S2 SoC variant (family) and ESP32x SoCs, see section ESP32 SoC Series.

The board uses an ESP32-S2-WROVER module with 4 MByte Flash and 2 MByte PSRAM (CPU model esp32s2_wrover_n4r2). The PSRAM can be used with the module esp_spi_ram.

Board Configuration

The default board configuration follows the Arduino UNO R3 compatible pinout of the board and provides:

For flexibility, some GPIOs are used in different peripheral configurations, but they can only be used for one peripheral at a time. For example, GPIO42 is used as LED and as SCK signal of SPI_DEV(1).

This is possible because GPIOs are only used for a specific peripheral interface when either

That is, the purpose for which a GPIO is used depends on which module or function is used first.

The following table shows the default board configuration, which is sorted according to the defined functionality of GPIOs. This configuration can be overridden by application-specific configurations.

Function GPIOs Arduino Remarks Configuration
BTN0 GPIO0 labeled as BOOT button
LED0 GPIO42 D13 Red LED
WS281X GPIO45 RGB LED NeoPixel
ADC_LINE(n) GPIO17, GPIO18, GPIO1, GPIO2, GPIO3, GPIO4 A0 ... A5 A0 and A1 are ADC2 channels ADC Channels
DAC_LINE(n) GPIO17, GPIO18 A0, A1 DAC Channels
PWM_DEV(0) GPIO8, GPIO10, GPIO11, GPIO14 D3, D5, D6, D9 PWM Channels
PWM_DEV(1) GPIO15, GPIO16 D10, D11 PWM Channels
I2C_DEV(0) SCL GPIO34 SCL STEMMA QT I2C Interfaces
I2C_DEV(0) SDA GPIO33 SDA STEMMA QT I2C Interfaces
SPI_DEV(0) SCK GPIO36 ICSP SPI2_HOST (FSPI) SPI Interfaces
SPI_DEV(0) MISO GPIO37 ICSP SPI2_HOST (FSPI) SPI Interfaces
SPI_DEV(0) MOSI GPIO35 ICSP SPI2_HOST (FSPI) SPI Interfaces
SPI_DEV(0) CS0 GPIO15 D10 SPI2_HOST (FSPI) SPI Interfaces
SPI_DEV(1) SCK GPIO42 D13 SPI3_HOST (HSPI) SPI Interfaces
SPI_DEV(1) MISO GPIO21 D12 SPI3_HOST (HSPI) SPI Interfaces
SPI_DEV(1) MOSI GPIO16 D11 SPI3_HOST (HSPI) SPI Interfaces
SPI_DEV(1) CS0 GPIO15 D10 SPI3_HOST (HSPI) SPI Interfaces
UART_DEV(0) TxD GPIO43 Debug header (configuration is fixed) UART interfaces
UART_DEV(0) RxD GPIO44 Debug header (configuration is fixed) UART interfaces
UART_DEV(1) TxD GPIO6 D1 UART interfaces
UART_DEV(1) RxD GPIO5 D0 UART interfaces


Note
  • ADC2 is also used by the WiFi module. The ADC2 channels (A0 and A1) can't be used when WiFi is active.
  • GPIO0, GPIO45 and GPIO46 are strapping pins. GPIO45 (NeoPixel) must not be pulled high during reset.
  • GPIO19 and GPIO20 are used for the USB-C connector and are not available.

For detailed information about the peripheral configurations of ESP32-S2 boards, see section Common Peripherals.

Board Pinout

The following figure shows the pinout as configured by the board definition.

Adafruit Metro ESP32-S2 Pinout

The original pinout of the board is described in the Adafruit Learning Guide, the schematic can be found in the PCB repository.

Flashing the Device

Since the board does not have a USB-to-Serial chip, the board is flashed via the USB OTG interface of the ESP32-S2. Just connect the board to your host computer and use the following command:

BOARD=adafruit-metro-esp32s2 make flash ...

If RIOT is already running on the board and the STDIO is realized via the USB interface, the board automatically enters the download mode before flashing.

Note
The board is shipped with the TinyUF2 bootloader and a factory application that use the native USB interface. Flashing RIOT overwrites the UF2 bootloader. If the board does not enter the download mode automatically, the programmer cannot connect to the board and flashing is aborted with a timeout. In this case, restart the board manually in download mode by pressing and releasing the RESET button while holding down the BOOT button.

Alternatively, an external USB-to-Serial adapter can be connected to TxD (GPIO43) and RxD (GPIO44) of the Debug header. Before RIOT can be flashed, the board has to be switched to download mode as described above.

For detailed information about ESP32-S2 as well as configuring and compiling RIOT for ESP32-S2 boards, see ESP32 SoC Series.

Using STDIO

Since the board does not have a USB-to-Serial chip, the USB OTG interface with the USBUS stack is used by default for the STDIO (module stdio_cdc_acm) which provides an USB CDC ACM interface.

If the tinyUSB stack is used instead, implicitly the module stdio_tinyusb_cdc_acm is used for the STDIO via the USB CDC ACM interface.

Alternatively, the UART interface of the Debug header could be used with an external USB-to-Serial adapter. Simply add stdio_uart to the list of used modules for this purpose:

BOARD=adafruit-metro-esp32s2 USEMODULE=stdio_uart make flash ...

Files

file  arduino_iomap.h
 Mapping from MCU pins to Arduino pins.
 
file  board.h
 Board definitions for the Adafruit Metro ESP32-S2 board.
 
file  gpio_params.h
 Board specific configuration of direct mapped GPIOs.
 
file  periph_conf.h
 Peripheral configurations for the Adafruit Metro ESP32-S2 board.