Adafruit Feather ESP32S2
Overview
The Adafruit Feather ESP32-S2 boards are ESP32-S2 development boards in the Feather standard layout, sharing peripheral placement with other devices labeled as Feathers or FeatherWings. The board is equipped with an ESP32-S2 mini module, a LiPo battery charger, a fuel gauge, a USB-C and SparkFun Qwiic [7]-compatible STEMMA QT [8] connector for the I2C bus.
Hardware
ESP32-S2 mini module, featuring the 240MHz Tensilica processor
320KB SRAM, 4MB flash + 2MB PSRAM
USB-C directly connected to the ESP32-S2 for USB
LiPo connector and built-in battery charging when powered via USB-C
LC709203 or MAX17048 fuel gauge for battery voltage and state-of-charge reporting
Built-in NeoPixel indicator RGB LED
STEMMA QT connector for I2C devices, with switchable power for low-power mode
Note
The Adafruit ESP32-S2 Feather with BME280 Sensor [2] is the same board as the Adafruit ESP32-S2 Feather [1] but with an already equipped BME280 Sensor, but is not stated as a separate board, instead the BME280 needs to be added via a devicetree overlay. All boards, except the Adafruit ESP32-S2 Feather with BME280 Sensor [2] have a space for it, but will not be shipped with.
As of May 31, 2023 - Adafruit has changed the battery monitor chip from the now-discontinued LC709203 to the MAX17048. Check the back silkscreen of your Feather to see which chip you have.
For the MAX17048 a driver in zephyr exists and is supported, but needs to be added via a devicetree overlay.
For the LC709203 a driver does’nt exists yet and the fuel gauge for boards with this IC is not available.
For the Adafruit ESP32-S2 Feather [1] there are two different Revisions
rev B
andrev C
. Therev C
board has revised the power circuitry for the NeoPixel and I2C QT port. Instead of a transistor therev C
has a LDO regulator. To enable the NeoPixel and I2C QT port onrev B
boardsGPIO7
(i2c_reg
) needs to be set to LOW and onrev C
boards it needs to be set HIGH.
Supported Features
The adafruit_feather_esp32s2
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.
Type |
Location |
Description |
Compatible |
---|---|---|---|
CPU |
on-chip |
Espressif Xtensa LX7 CPU1 |
|
ADC |
on-chip |
ESP32 ADC2 |
|
Bluetooth |
on-chip |
Bluetooth HCI for Espressif ESP321 |
|
CAN |
on-chip |
ESP32 Two-Wire Automotive Interface (TWAI)1 |
|
Clock control |
on-chip |
ESP32 RTC (Power & Clock Controller Module) Module1 |
|
Counter |
on-chip |
ESP32 Counter Driver based on RTC Main Timer1 |
|
on-chip |
ESP32 general-purpose timers4 |
||
DAC |
on-chip |
ESP32 Digital to Analog converter (DAC)1 |
|
Flash controller |
on-chip |
ESP32 flash controller1 |
|
GPIO & Headers |
on-chip |
ESP32 GPIO controller2 |
|
on-board |
GPIO pins exposed on Adafruit Feather headers1 |
||
I2C |
on-chip |
||
Input |
on-chip |
ESP32 touch sensor input1 |
|
on-board |
Group of GPIO-bound input keys1 |
||
Interrupt controller |
on-chip |
ESP32 Interrupt controller1 |
|
LED |
on-board |
Group of GPIO-controlled LEDs1 |
|
LED strip |
on-board |
Worldsemi WS2812 LED strip, SPI binding1 |
|
Memory controller |
on-chip |
ESP32 pseudo-static RAM controller1 |
|
MTD |
on-chip |
Flash node1 |
|
on-chip |
Fixed partitions of a flash (or other non-volatile storage) memory1 |
||
Pin control |
on-chip |
ESP32 pin controller1 |
|
Power domain |
on-board |
Simple GPIO controlled power domain1 |
|
PWM |
on-chip |
ESP32 LED Control (LEDC)1 |
|
RNG |
on-chip |
ESP32 TRNG (True Random Number Generator)1 |
|
Sensors |
on-chip |
ESP32 Pulse Counter (PCNT)1 |
|
on-chip |
ESP32 temperature sensor1 |
||
Serial controller |
on-chip |
ESP32 UART2 |
|
SPI |
on-chip |
ESP32 SPI2 |
|
Watchdog |
on-chip |
ESP32 XT Watchdog Timer1 |
|
on-chip |
|||
Wi-Fi |
on-chip |
ESP32 SoC Wi-Fi1 |
Note
USB-OTG is until now not supported see ESP32 development overview [4]. To see a serial output a FTDI-USB-RS232 or similar needs to be connected to the RX/TX pins on the feather connector.
Connections and IOs
The Adafruit ESP32-S2 Feather [1] User Guide has detailed information about the board including pinouts and the schematic.
Programming and Debugging
Prerequisites
Espressif HAL requires WiFi binary blobs in order work. Run the command below to retrieve those files.
west update
west blobs fetch hal_espressif
Building & Flashing
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:
Sysbuild
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:
Rev B
west build -b adafruit_feather_esp32s2@B --sysbuild samples/hello_world
Rev C
west build -b adafruit_feather_esp32s2@C --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:
Rev B
# From the root of the zephyr repository
west build -b adafruit_feather_esp32s2@B samples/hello_world
Rev C
# From the root of the zephyr repository
west build -b adafruit_feather_esp32s2@C samples/hello_world
The usual flash
target will work. Here is an example for the Hello World
application.
To enter ROM bootloader mode, hold down boot-button
while clicking reset button.
When in the ROM bootloader, you can upload code and query the chip using west flash
.
Rev B
# From the root of the zephyr repository west build -b adafruit_feather_esp32s2@B samples/hello_world west flash
Rev C
# From the root of the zephyr repository west build -b adafruit_feather_esp32s2@C samples/hello_world west flash
After the flashing you will receive most likely this Error:
WARNING: ESP32-S2FNR2 (revision v0.0) chip was placed into download mode using GPIO0.
esptool.py can not exit the download mode over USB. To run the app, reset the chip manually.
To suppress this note, set --after option to 'no_reset'.
FATAL ERROR: command exited with status 1: ...
As stated in the Warning-Message esptool
can’t reset the board by itself and this message
can be ignored and the board needs to be reseted via the Reset-Button manually.
Open the serial monitor using the following command:
west espressif monitor
After the board has been manually reseted and booted, you should see the following message in the monitor:
***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx *****
Hello World! adafruit_feather_esp32s2
Debugging
ESP32-S2 support on OpenOCD is available at OpenOCD [3].
ESP32-S2 has a built-in JTAG circuitry and can be debugged without any additional chip. Only an USB cable connected to the D+/D- pins is necessary.
Further documentation can be obtained from the SoC vendor in JTAG debugging for ESP32-S2 [9].
You can debug an application in the usual way. Here is an example for the Hello World application.
Rev B
# From the root of the zephyr repository
west build -b adafruit_feather_esp32s2@B samples/hello_world
west debug
Rev C
# From the root of the zephyr repository
west build -b adafruit_feather_esp32s2@C samples/hello_world
west debug
Testing the On-Board-LED
There is a sample available to verify that the LEDs on the board are functioning correctly with Zephyr:
Rev B
# From the root of the zephyr repository
west build -b adafruit_feather_esp32s2@B samples/basic/blinky
west flash
Rev C
# From the root of the zephyr repository
west build -b adafruit_feather_esp32s2@C samples/basic/blinky
west flash
Testing the NeoPixel
There is a sample available to verify that the NeoPixel on the board are functioning correctly with Zephyr:
Rev B
# From the root of the zephyr repository west build -b adafruit_feather_esp32s2@B samples/drivers/led/led_strip west flash
Rev C
# From the root of the zephyr repository west build -b adafruit_feather_esp32s2@C samples/drivers/led/led_strip west flash
Testing the Fuel Gauge (MAX17048)
There is a sample available to verify that the MAX17048 fuel gauge on the board are functioning correctly with Zephyr:
Note
As of May 31, 2023 Adafruit changed the battery monitor chip from the now-discontinued LC709203 to the MAX17048.
# From the root of the zephyr repository
west build -b adafruit_feather_esp32s2@C samples/fuel_gauge/max17048/
west flash
Testing Wi-Fi
There is a sample available to verify that the Wi-Fi on the board are functioning correctly with Zephyr:
Note
The Prerequisites must be met before testing Wi-Fi.
Rev B
# From the root of the zephyr repository west build -b adafruit_feather_esp32s2@B samples/net/wifi/shell west flash
Rev C
# From the root of the zephyr repository west build -b adafruit_feather_esp32s2@C samples/net/wifi/shell west flash