boards: adafruit: add initial support for esp32s3 feather

The Adafruit Feather ESP32S3 is a development board in the Feather
standard layout, sharing peripheral placement with other devices labeled
as Feathers or FeatherWings. The board is equipped with an ESP32-S3 mini
module, a lithium ion battery charger and a USB-C connector.

Signed-off-by: Leon Rinkel <leon@rinkel.me>
This commit is contained in:
Leon Rinkel 2024-11-13 21:16:36 +01:00 committed by Benjamin Cabé
parent bec4a84749
commit 3caa0b9ed5
18 changed files with 745 additions and 0 deletions

View File

@ -0,0 +1,10 @@
# Adafruit Feather ESP32-S3 board configuration
# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
# Copyright (c) 2024 Leon Rinkel <leon@rinkel.me>
# SPDX-License-Identifier: Apache-2.0
config HEAP_MEM_POOL_ADD_SIZE_BOARD
int
default 4096 if BOARD_ADAFRUIT_FEATHER_ESP32S3_ESP32S3_PROCPU
default 256 if BOARD_ADAFRUIT_FEATHER_ESP32S3_ESP32S3_APPCPU

View File

@ -0,0 +1,8 @@
# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
# Copyright (c) 2024 Leon Rinkel <leon@rinkel.me>
# SPDX-License-Identifier: Apache-2.0
config BOARD_ADAFRUIT_FEATHER_ESP32S3
select SOC_ESP32S3_WROOM_N8
select SOC_ESP32S3_PROCPU if BOARD_ADAFRUIT_FEATHER_ESP32S3_ESP32S3_PROCPU
select SOC_ESP32S3_APPCPU if BOARD_ADAFRUIT_FEATHER_ESP32S3_ESP32S3_APPCPU

View File

@ -0,0 +1,10 @@
# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
choice BOOTLOADER
default BOOTLOADER_MCUBOOT
endchoice
choice BOOT_SIGNATURE_TYPE
default BOOT_SIGNATURE_TYPE_NONE
endchoice

View File

@ -0,0 +1,68 @@
/*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
* Copyright (c) 2024 Leon Rinkel <leon@rinkel.me>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/dt-bindings/pinctrl/esp-pinctrl-common.h>
#include <dt-bindings/pinctrl/esp32s3-pinctrl.h>
#include <zephyr/dt-bindings/pinctrl/esp32s3-gpio-sigmap.h>
&pinctrl {
uart0_default: uart0_default {
group1 {
pinmux = <UART0_TX_GPIO43>;
output-high;
};
group2 {
pinmux = <UART0_RX_GPIO44>;
bias-pull-up;
};
};
uart1_default: uart1_default {
group1 {
pinmux = <UART1_TX_GPIO39>;
output-high;
};
group2 {
pinmux = <UART1_RX_GPIO38>;
bias-pull-up;
};
};
i2c0_default: i2c0_default {
group1 {
pinmux = <I2C0_SDA_GPIO3>,
<I2C0_SCL_GPIO4>;
drive-open-drain;
output-high;
};
};
spim2_default: spim2_default {
group1 {
pinmux = <SPIM2_MISO_GPIO37>,
<SPIM2_SCLK_GPIO36>,
<SPIM2_CSEL_GPIO10>;
};
group2 {
pinmux = <SPIM2_MOSI_GPIO35>;
output-low;
};
};
spim3_default: spim3_default {
group1 {
pinmux = <SPIM3_MOSI_GPIO33>;
};
};
twai_default: twai_default {
group1 {
pinmux = <TWAI_TX_GPIO5>,
<TWAI_RX_GPIO6>;
};
};
};

View File

@ -0,0 +1,32 @@
/*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
* Copyright (c) 2024 Leon Rinkel <leon@rinkel.me>
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <espressif/esp32s3/esp32s3_wroom_n8.dtsi>
#include <espressif/partitions_0x0_amp.dtsi>
#include "adafruit_feather_esp32s3-pinctrl.dtsi"
/ {
model = "Adafruit Feather ESP32S3 APPCPU";
compatible = "adafruit,feather_esp32s3", "espressif,esp32s3";
chosen {
zephyr,sram = &sram1;
zephyr,ipc_shm = &shm0;
zephyr,ipc = &ipm0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_appcpu_partition;
};
};
&trng0 {
status = "okay";
};
&ipm0 {
status = "okay";
};

View File

@ -0,0 +1,27 @@
identifier: adafruit_feather_esp32s3/esp32s3/appcpu
name: Adafruit Feather ESP32-S3 APPCPU
type: mcu
arch: xtensa
toolchain:
- zephyr
supported:
- uart
testing:
ignore_tags:
- net
- bluetooth
- flash
- cpp
- posix
- watchdog
- logging
- kernel
- pm
- gpio
- crypto
- eeprom
- heap
- cmsis_rtos
- jwt
- zdsp
vendor: adafruit

View File

@ -0,0 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_CLOCK_CONTROL=y

View File

@ -0,0 +1,206 @@
/*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
* Copyright (c) 2024 Leon Rinkel <leon@rinkel.me>
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <espressif/esp32s3/esp32s3_wroom_n8.dtsi>
#include <espressif/partitions_0x0_amp.dtsi>
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include <zephyr/dt-bindings/input/esp32-touch-sensor-input.h>
#include <zephyr/dt-bindings/led/led.h>
#include "feather_connector.dtsi"
#include "adafruit_feather_esp32s3-pinctrl.dtsi"
/ {
model = "Adafruit Feather ESP32S3 PROCPU";
compatible = "adafruit,feather_esp32s3", "espressif,esp32s3";
aliases {
i2c-0 = &i2c0;
watchdog0 = &wdt0;
};
chosen {
zephyr,sram = &sram1;
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
zephyr,bt-hci = &esp32_bt_hci;
};
/* These aliases are provided for compatibility with samples */
aliases {
uart-0 = &uart0;
sw0 = &button0;
led0 = &led0;
led-strip = &led_strip;
};
buttons {
compatible = "gpio-keys";
button0: button_0 {
gpios = <&gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "BOOT Button";
zephyr,code = <INPUT_KEY_0>;
};
};
leds {
compatible = "gpio-leds";
led0: led_0 {
gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
};
};
/*
* The neopixel on this board has its positive side hooked up to a GPIO
* pin rather than a positive voltage rail to save on power.
*/
neopixel_pwr: neopixel_pwr {
compatible = "power-domain-gpio";
#power-domain-cells = <0>;
enable-gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>;
};
/*
* On-board regulator powers I2C pull-ups and external devices connected
* via the STEMMA QT connector.
*/
i2c_reg: i2c_reg {
compatible = "power-domain-gpio";
#power-domain-cells = <0>;
enable-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
};
};
&usb_serial {
status = "disabled";
};
&uart0 {
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-names = "default";
};
&uart1 {
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&uart1_default>;
pinctrl-names = "default";
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
&touch {
debounce-interval-ms = <30>;
href-microvolt = <2700000>;
lref-microvolt = <500000>;
href-atten-microvolt = <1000000>;
filter-mode = <ESP32_TOUCH_FILTER_MODE_IIR_16>;
filter-debounce-cnt = <1>;
filter-noise-thr = <ESP32_TOUCH_FILTER_NOISE_THR_4_8TH>;
filter-jitter-step = <4>;
filter-smooth-level = <ESP32_TOUCH_FILTER_SMOOTH_MODE_IIR_2>;
};
&i2c0 {
status = "okay";
clock-frequency = <I2C_BITRATE_STANDARD>;
pinctrl-0 = <&i2c0_default>;
pinctrl-names = "default";
max17048: max17048@36 {
compatible = "maxim,max17048";
status = "okay";
reg = <0x36>;
/*
* The MAX17048 itself is directly powered by the battery, not
* through the on-board regulator. However using this device
* requires I2C pull-ups powered by the regulator.
*/
power-domains = <&i2c_reg>;
};
};
&spi2 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
pinctrl-0 = <&spim2_default>;
pinctrl-names = "default";
};
&spi3 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
pinctrl-0 = <&spim3_default>;
pinctrl-names = "default";
/* Workaround to support WS2812 driver */
line-idle-low;
led_strip: ws2812@0 {
compatible = "worldsemi,ws2812-spi";
power-domains = <&neopixel_pwr>;
/* SPI */
reg = <0>; /* ignored, but necessary for SPI bindings */
spi-max-frequency = <6400000>;
/* WS2812 */
chain-length = <1>;
spi-cpha;
spi-one-frame = <0xf0>; /* 625 ns high and 625 ns low */
spi-zero-frame = <0xc0>; /* 312.5 ns high and 937.5 ns low */
color-mapping = <LED_COLOR_ID_GREEN
LED_COLOR_ID_RED
LED_COLOR_ID_BLUE>;
};
};
&twai {
pinctrl-0 = <&twai_default>;
pinctrl-names = "default";
};
&timer0 {
status = "disabled";
};
&timer1 {
status = "disabled";
};
&timer2 {
status = "disabled";
};
&timer3 {
status = "disabled";
};
&wdt0 {
status = "okay";
};
&trng0 {
status = "okay";
};
&esp32_bt_hci {
status = "okay";
};

View File

@ -0,0 +1,22 @@
identifier: adafruit_feather_esp32s3/esp32s3/procpu
name: Adafruit Feather ESP32-S3 PROCPU
type: mcu
arch: xtensa
toolchain:
- zephyr
supported:
- gpio
- uart
- i2c
- spi
- can
- counter
- watchdog
- entropy
- pwm
- dma
- input
- feather_serial
- feather_i2c
- feather_spi
vendor: adafruit

View File

@ -0,0 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y
CONFIG_GPIO=y
CONFIG_CLOCK_CONTROL=y

View File

@ -0,0 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
if(NOT "${OPENOCD}" MATCHES "^${ESPRESSIF_TOOLCHAIN_PATH}/.*")
set(OPENOCD OPENOCD-NOTFOUND)
endif()
find_program(OPENOCD openocd PATHS ${ESPRESSIF_TOOLCHAIN_PATH}/openocd-esp32/bin NO_DEFAULT_PATH)
include(${ZEPHYR_BASE}/boards/common/esp32.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

View File

@ -0,0 +1,6 @@
board:
name: adafruit_feather_esp32s3
full_name: Adafruit Feather ESP32S3
vendor: adafruit
socs:
- name: esp32s3

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -0,0 +1,279 @@
.. zephyr:board:: adafruit_feather_esp32s3
Overview
********
The Adafruit Feather ESP32-S3 is an ESP32-S3 development board in the Feather
standard layout, sharing peripheral placement with other devices labeled as
Feathers or FeatherWings. The board is equipped with an ESP32-S3 mini module, a
LiPo battery charger, a fuel gauge, a USB-C and Qwiic/STEMMA-QT connector. For
more information, check `Adafruit Feather ESP32-S3`_.
Hardware
********
- ESP32-S3 mini module, featuring the dual core 32-bit Xtensa Microprocessor
(Tensilica LX7), running at up to 240MHz
- 512KB SRAM and either 8MB flash or 4MB flash + 2MB PSRAM, depending on the
module variant
- USB-C directly connected to the ESP32-S3 for USB/UART and JTAG debugging
- LiPo connector and built-in battery charging when powered via USB-C
- MAX17048 fuel gauge for battery voltage and state-of-charge reporting
- Charging indicator LED, user LED, reset and boot buttons
- Built-in NeoPixel indicator RGB LED
- STEMMA QT connector for I2C devices, with switchable power for low-power mode
Asymmetric Multiprocessing (AMP)
================================
The ESP32-S3 SoC allows 2 different applications to be executed in asymmetric
multiprocessing. Due to its dual-core architecture, each core can be enabled to
execute customized tasks in stand-alone mode and/or exchanging data over OpenAMP
framework. See :zephyr:code-sample-category:`ipc` folder as code reference.
For more information, check the datasheet at `ESP32-S3 Datasheet`_.
Supported Features
==================
The current ``adafruit_feather_esp32s3`` board supports the following hardware
features:
+------------+------------+-------------------------------------+
| Interface | Controller | Driver/Component |
+============+============+=====================================+
| UART | on-chip | serial port |
+------------+------------+-------------------------------------+
| GPIO | on-chip | gpio |
+------------+------------+-------------------------------------+
| PINMUX | on-chip | pinmux |
+------------+------------+-------------------------------------+
| USB-JTAG | on-chip | hardware interface |
+------------+------------+-------------------------------------+
| SPI Master | on-chip | spi |
+------------+------------+-------------------------------------+
| TWAI/CAN | on-chip | can |
+------------+------------+-------------------------------------+
| ADC | on-chip | adc |
+------------+------------+-------------------------------------+
| Timers | on-chip | counter |
+------------+------------+-------------------------------------+
| Watchdog | on-chip | watchdog |
+------------+------------+-------------------------------------+
| TRNG | on-chip | entropy |
+------------+------------+-------------------------------------+
| LEDC | on-chip | pwm |
+------------+------------+-------------------------------------+
| MCPWM | on-chip | pwm |
+------------+------------+-------------------------------------+
| PCNT | on-chip | qdec |
+------------+------------+-------------------------------------+
| GDMA | on-chip | dma |
+------------+------------+-------------------------------------+
| USB-CDC | on-chip | serial |
+------------+------------+-------------------------------------+
| Wi-Fi | on-chip | |
+------------+------------+-------------------------------------+
| Bluetooth | on-chip | |
+------------+------------+-------------------------------------+
Connections and IOs
===================
The `Adafruit Feather ESP32-S3 User Guide`_ has detailed information about the
board including `pinouts`_ and the `schematic`_.
Programming and Debugging
*************************
Prerequisites
=============
Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the
command below to retrieve those files.
.. code-block:: console
west blobs fetch hal_espressif
.. note::
It is recommended running the command above after :file:`west update`.
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 build (and flash) 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.
.. code:: cfg
CONFIG_BOOTLOADER_MCUBOOT=y
Sysbuild
--------
The sysbuild makes possible to build and flash all necessary images needed to
bootstrap the board with the ESP32-S3 SoC.
To build the sample application using sysbuild use the command:
.. zephyr-app-commands::
:tool: west
:zephyr-app: samples/hello_world
:board: adafruit_feather_esp32s3/esp32s3/procpu
:goals: build
:west-args: --sysbuild
:compact:
By default, the ESP32-S3 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:
.. code-block::
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 :ref:`sysbuild`
documentation.
Manual build
------------
During the development cycle, it is intended to build & flash as quickly
possible. For that reason, images can be build 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 :ref:`build_an_application` and
:ref:`application_run` for more details).
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: adafruit_feather_esp32s3/esp32s3/procpu
:goals: build
The usual ``flash`` target will work with the ``adafruit_feather_esp32s3`` board
. Here is an example for the :zephyr:code-sample:`hello_world` application.
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: adafruit_feather_esp32s3/esp32s3/procpu
:goals: flash
Open the serial monitor using the following command:
.. code-block:: shell
west espressif monitor
After the board has automatically reset and booted, you should see the following
message in the monitor:
.. code-block:: console
***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx *****
Hello World! adafruit_feather_esp32s3
Debugging
=========
ESP32-S3 support on OpenOCD is available upstream as of version 0.12.0. Download
and install OpenOCD from `OpenOCD`_.
ESP32-S3 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-S3`_.
Here is an example for building the :zephyr:code-sample:`hello_world`
application.
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: adafruit_feather_esp32s3/esp32s3/procpu
:goals: build flash
You can debug an application in the usual way. Here is an example for the
:zephyr:code-sample:`hello_world` application.
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: adafruit_feather_esp32s3/esp32s3/procpu
:goals: debug
References
**********
.. target-notes::
.. _`Adafruit Feather ESP32-S3`:
https://www.adafruit.com/product/5323
.. _`OpenOCD`:
https://github.com/openocd-org/openocd
.. _`JTAG debugging for ESP32-S3`:
https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/jtag-debugging/
.. _Adafruit Feather ESP32-S3 User Guide:
https://learn.adafruit.com/adafruit-esp32-s3-feather
.. _pinouts:
https://learn.adafruit.com/adafruit-esp32-s3-feather/pinouts
.. _schematic:
https://learn.adafruit.com/adafruit-esp32-s3-feather/downloads
.. _ESP32-S3 Datasheet:
https://www.espressif.com/sites/default/files/documentation/esp32-s3-wroom-1_wroom-1u_datasheet_en.pdf
.. _ESP32 Technical Reference Manual:
https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2020 Richard Osterloh <richard.osterloh@gmail.com>
* Copyright (c) 2024 Leon Rinkel <leon@rinkel.me>
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
feather_header: connector {
compatible = "adafruit-feather-header";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map = <0 0 &gpio0 18 0>, /* A0 */
<1 0 &gpio0 17 0>, /* A1 */
<2 0 &gpio0 16 0>, /* A2 */
<3 0 &gpio0 15 0>, /* A3 */
<4 0 &gpio0 14 0>, /* A4 */
<5 0 &gpio0 8 0>, /* A5 */
<6 0 &gpio1 36 0>, /* SCK */
<7 0 &gpio1 35 0>, /* MOSI */
<8 0 &gpio1 37 0>, /* MISO */
<9 0 &gpio1 38 0>, /* RX */
<10 0 &gpio1 39 0>, /* TX */
<11 0 &gpio1 44 0>, /* DB */
<12 0 &gpio0 3 0>, /* SDA */
<13 0 &gpio0 4 0>, /* SCL */
<14 0 &gpio0 5 0>, /* D5 */
<15 0 &gpio0 6 0>, /* D6 */
<16 0 &gpio0 9 0>, /* D9 */
<17 0 &gpio0 10 0>, /* D10 */
<18 0 &gpio0 11 0>, /* D11 */
<19 0 &gpio0 12 0>, /* D12 */
<20 0 &gpio0 13 0>; /* D13 */
};
};
feather_serial: &uart1 {};
feather_i2c: &i2c0 {};
feather_spi: &spi2 {};

View File

@ -0,0 +1,7 @@
set ESP_RTOS none
set ESP32_ONLYCPU 1
# Source the JTAG interface configuration file
source [find interface/esp_usb_jtag.cfg]
# Source the ESP32-S3 configuration file
source [find target/esp32s3.cfg]

View File

@ -0,0 +1,4 @@
CONFIG_POWER_DOMAIN=y
CONFIG_GPIO=y
CONFIG_PM_DEVICE=y
CONFIG_PM_DEVICE_POWER_DOMAIN=y

View File

@ -0,0 +1,4 @@
CONFIG_POWER_DOMAIN=y
CONFIG_GPIO=y
CONFIG_PM_DEVICE=y
CONFIG_PM_DEVICE_POWER_DOMAIN=y