diff --git a/boards/adafruit/feather_esp32s2/CMakeLists.txt b/boards/adafruit/feather_esp32s2/CMakeLists.txt new file mode 100644 index 0000000000000..218a0602483ab --- /dev/null +++ b/boards/adafruit/feather_esp32s2/CMakeLists.txt @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library() +zephyr_library_sources(board.c) diff --git a/boards/adafruit/feather_esp32s2/Kconfig b/boards/adafruit/feather_esp32s2/Kconfig new file mode 100644 index 0000000000000..272e4c39ee9f3 --- /dev/null +++ b/boards/adafruit/feather_esp32s2/Kconfig @@ -0,0 +1,11 @@ +# Copyright (c) 2023 Google, LLC +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 + +config BOARD_NEEDS_LATE_HOOK + bool + default y if BOARD_ADAFRUIT_FEATHER_ESP32S2_TFT || BOARD_ADAFRUIT_FEATHER_ESP32S2_TFT_REVERSE + select BOARD_LATE_INIT_HOOK diff --git a/boards/adafruit/feather_esp32s2/Kconfig.adafruit_feather_esp32s2 b/boards/adafruit/feather_esp32s2/Kconfig.adafruit_feather_esp32s2 new file mode 100644 index 0000000000000..63f45c11300ec --- /dev/null +++ b/boards/adafruit/feather_esp32s2/Kconfig.adafruit_feather_esp32s2 @@ -0,0 +1,5 @@ +# Copyright (c) 2025 Philipp Steiner +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_ADAFRUIT_FEATHER_ESP32S2 + select SOC_ESP32S2_R2 diff --git a/boards/adafruit/feather_esp32s2/Kconfig.adafruit_feather_esp32s2_tft b/boards/adafruit/feather_esp32s2/Kconfig.adafruit_feather_esp32s2_tft new file mode 100644 index 0000000000000..e54cad03d4221 --- /dev/null +++ b/boards/adafruit/feather_esp32s2/Kconfig.adafruit_feather_esp32s2_tft @@ -0,0 +1,5 @@ +# Copyright (c) 2025 Philipp Steiner +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_ADAFRUIT_FEATHER_ESP32S2_TFT + select SOC_ESP32S2_R2 diff --git a/boards/adafruit/feather_esp32s2/Kconfig.adafruit_feather_esp32s2_tft_reverse b/boards/adafruit/feather_esp32s2/Kconfig.adafruit_feather_esp32s2_tft_reverse new file mode 100644 index 0000000000000..1d470f8749063 --- /dev/null +++ b/boards/adafruit/feather_esp32s2/Kconfig.adafruit_feather_esp32s2_tft_reverse @@ -0,0 +1,5 @@ +# Copyright (c) 2025 Philipp Steiner +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_ADAFRUIT_FEATHER_ESP32S2_TFT_REVERSE + select SOC_ESP32S2_R2 diff --git a/boards/adafruit/feather_esp32s2/Kconfig.defconfig b/boards/adafruit/feather_esp32s2/Kconfig.defconfig new file mode 100644 index 0000000000000..734863a6654b1 --- /dev/null +++ b/boards/adafruit/feather_esp32s2/Kconfig.defconfig @@ -0,0 +1,28 @@ +# Copyright (c) 2025 Philipp Steiner +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_ADAFRUIT_FEATHER_ESP32S2_TFT || BOARD_ADAFRUIT_FEATHER_ESP32S2_TFT_REVERSE + +if DISPLAY + +choice ST7789V_PIXEL_FORMAT + default ST7789V_RGB565 +endchoice + +if LVGL + +config LV_Z_BITS_PER_PIXEL + default 16 + +choice LV_COLOR_DEPTH + default LV_COLOR_DEPTH_16 +endchoice + +config LV_COLOR_16_SWAP + default y + +endif # LVGL + +endif # DISPLAY + +endif # BOARD_ADAFRUIT_FEATHER_ESP32S2_TFT || BOARD_ADAFRUIT_FEATHER_ESP32S2_TFT_REVERSE diff --git a/boards/adafruit/feather_esp32s2/Kconfig.sysbuild b/boards/adafruit/feather_esp32s2/Kconfig.sysbuild new file mode 100644 index 0000000000000..3a2d17ac5cfd0 --- /dev/null +++ b/boards/adafruit/feather_esp32s2/Kconfig.sysbuild @@ -0,0 +1,10 @@ +# Copyright (c) 2023 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 diff --git a/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2-pinctrl.dtsi b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2-pinctrl.dtsi new file mode 100644 index 0000000000000..a6c67847bbb3f --- /dev/null +++ b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2-pinctrl.dtsi @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2025 Philipp Steiner . + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +&pinctrl { + /* Debug TX (DBG) - This is the hardware UART debug pin */ + uart0_default: uart0_default { + group1 { + pinmux = ; + output-high; + }; + }; + + uart1_default: uart1_default { + group1 { + pinmux = ; + output-high; + }; + + group2 { + pinmux = ; + bias-pull-up; + }; + }; + + spim2_default: spim2_default { + group1 { + pinmux = , + , + ; + }; + + group2 { + pinmux = ; + output-low; + }; + }; + + spim3_ws2812_led: spim3_ws2812_led { + group1 { + pinmux = ; + }; + }; + + i2c0_default: i2c0_default { + group1 { + pinmux = , + ; + drive-open-drain; + output-high; + }; + }; + + twai_default: twai_default { + group1 { + pinmux = , + ; + }; + }; +}; diff --git a/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2.dts b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2.dts new file mode 100644 index 0000000000000..e7e3f8efb7b50 --- /dev/null +++ b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2.dts @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2025 Philipp Steiner + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include "adafruit_feather_esp32s2_common.dtsi" +#include "feather_connector.dtsi" + +/ { + model = "Adafruit Feather ESP32-S2"; + compatible = "espressif,esp32s2"; +}; diff --git a/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_B.overlay b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_B.overlay new file mode 100644 index 0000000000000..096357d93eb77 --- /dev/null +++ b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_B.overlay @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2025 Philipp Steiner + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + /* + * On-board transistor powers I2C pull-ups and external devices connected + * via the STEMMA QT connector. + */ + i2c_reg: i2c_reg { + label = "I2C Power"; + compatible = "power-domain-gpio"; + #power-domain-cells = <0>; + enable-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; + startup-delay-us = <10>; + }; +}; diff --git a/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_B.yaml b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_B.yaml new file mode 100644 index 0000000000000..7246420988f85 --- /dev/null +++ b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_B.yaml @@ -0,0 +1,20 @@ +identifier: adafruit_feather_esp32s2@B +name: Adafruit Feather ESP32-S2 Rev B +type: mcu +arch: xtensa +toolchain: + - zephyr +supported: + - gpio + - uart + - i2c + - spi + - counter + - watchdog + - entropy + - pwm + - dma +vendor: adafruit +testing: + ignore_tags: + - bluetooth diff --git a/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_C.overlay b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_C.overlay new file mode 100644 index 0000000000000..94550a53acda4 --- /dev/null +++ b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_C.overlay @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2025 Philipp Steiner + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + /* + * On-board regulator powers I2C pull-ups and external devices connected + * via the STEMMA QT connector. + */ + i2c_reg: i2c_reg { + label = "I2C Power"; + compatible = "power-domain-gpio"; + #power-domain-cells = <0>; + enable-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; + startup-delay-us = <10>; + }; +}; diff --git a/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_C.yaml b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_C.yaml new file mode 100644 index 0000000000000..86ca59f5965d4 --- /dev/null +++ b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_C.yaml @@ -0,0 +1,20 @@ +identifier: adafruit_feather_esp32s2@C +name: Adafruit Feather ESP32-S2 Rev C +type: mcu +arch: xtensa +toolchain: + - zephyr +supported: + - gpio + - uart + - i2c + - spi + - counter + - watchdog + - entropy + - pwm + - dma +vendor: adafruit +testing: + ignore_tags: + - bluetooth diff --git a/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_common.dtsi b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_common.dtsi new file mode 100644 index 0000000000000..257ea650a298b --- /dev/null +++ b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_common.dtsi @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2025 Philipp Steiner + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include "adafruit_feather_esp32s2-pinctrl.dtsi" +#include +#include +#include +#include +#include + +/ { + compatible = "espressif,esp32s2"; + + chosen { + zephyr,sram = &sram1; + /* + * uart1 is used as the default uart for zephyr,console and zephyr,shell, + * because USB-OTG is until now not supported and USB-CDC is not available + * for ESP32-S2. + * See issue #29394 - ESP32 development overview + * To use uart1 a FTDI-USB-RS232 or similar needs to be connected to the RX/TX pins. + * See feather_connector.dtsi + */ + zephyr,console = &uart1; + zephyr,shell-uart = &uart1; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_partition; + }; + + aliases { + led0 = &led0; + i2c-0 = &i2c0; + sw0 = &user_button; + led-strip = &led_strip; + watchdog0 = &wdt0; + }; + + leds { + compatible = "gpio-leds"; + status = "okay"; + + led0: led_0 { + label = "Red-LED"; + gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + status = "okay"; + + user_button: user_button { + label = "BOOT Button"; + gpios = <&gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + zephyr,code = ; + }; + }; +}; + +&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"; + + neopixel_power_enable { + gpio-hog; + gpios = <21 GPIO_ACTIVE_HIGH>; + output-high; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&timer0 { + status = "okay"; +}; + +&timer1 { + status = "okay"; +}; + +&timer2 { + status = "okay"; +}; + +&timer3 { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + clock-frequency = ; + pinctrl-0 = <&i2c0_default>; + pinctrl-names = "default"; +}; + +&trng0 { + status = "okay"; +}; + +&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_ws2812_led>; + pinctrl-names = "default"; + + line-idle-low; + + led_strip: ws2812@0 { + compatible = "worldsemi,ws2812-spi"; + + /* WS2812 */ + reg = <0>; + spi-max-frequency = <6400000>; + chain-length = <1>; + spi-cpha; + spi-one-frame = ; /* 11110000: 625ns high and 625ns low */ + spi-zero-frame = ; /* 11000000: 312.5ns high and 937.5ns low */ + color-mapping = , + , + ; + }; +}; + +&twai { + pinctrl-0 = <&twai_default>; + pinctrl-names = "default"; +}; + +&wdt0 { + status = "okay"; +}; diff --git a/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_defconfig b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_defconfig new file mode 100644 index 0000000000000..d8fbaa879257b --- /dev/null +++ b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_defconfig @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_UART_CONSOLE=y +CONFIG_GPIO=y +CONFIG_CLOCK_CONTROL=y diff --git a/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft.dts b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft.dts new file mode 100644 index 0000000000000..c57ebdc8b8b97 --- /dev/null +++ b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft.dts @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2025 Philipp Steiner + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include "adafruit_feather_esp32s2_common.dtsi" +#include "feather_connector_tft.dtsi" + +/ { + model = "Adafruit Feather ESP32-S2 TFT"; + compatible = "espressif,esp32s2"; + + chosen { + zephyr,display = &st7789v_tft; + }; + + aliases { + backlight = &led1; + }; + + leds { + compatible = "gpio-leds"; + status = "okay"; + + led1: led_1 { + label = "TFT Backlight"; + gpios = <&gpio1 45 GPIO_ACTIVE_HIGH>; + }; + }; + + /* + * On-board regulator powers I2C pull-ups and external devices connected + * via the STEMMA QT connector. + */ + i2c_reg: i2c_reg { + label = "I2C Power"; + compatible = "power-domain-gpio"; + #power-domain-cells = <0>; + enable-gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>; + startup-delay-us = <10>; + }; + + mipi_dbi { + compatible = "zephyr,mipi-dbi-spi"; + spi-dev = <&spi2>; + dc-gpios = <&gpio1 39 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio1 40 GPIO_ACTIVE_LOW>; + write-only; + #address-cells = <1>; + #size-cells = <0>; + + st7789v_tft: st7789v_tft@0 { + compatible = "sitronix,st7789v"; + status = "disabled"; + + /* Also powered by i2c_reg */ + power-domains = <&i2c_reg>; + + mipi-max-frequency = ; + reg = <0>; + width = <135>; + height = <240>; + x-offset = <52>; + y-offset = <40>; + vcom = <0x20>; + gctrl = <0x35>; + vrhs = <0x0b>; + vdvs = <0x20>; + mdac = <0x08>; + gamma = <0x01>; + colmod = <0x55>; + lcm = <0x2c>; + porch-param = [0c 0c 00 33 33]; + cmd2en-param = [5a 69 02 01]; + pwctrl1-param = [a4 a1]; + pvgam-param = [70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25]; + nvgam-param = [70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25]; + ram-param = [00 F0]; + rgb-param = [40 02 14]; + mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE"; + }; + }; +}; + +&gpio0 { + status = "okay"; + + neopixel_power_enable { + gpio-hog; + gpios = <34 GPIO_ACTIVE_HIGH>; + output-high; + }; +}; + +&pinctrl { + uart1_default: uart1_default { + group1 { + pinmux = ; + output-high; + }; + + group2 { + pinmux = ; + bias-pull-up; + }; + }; + + i2c0_default: i2c0_default { + group1 { + pinmux = , + ; + drive-open-drain; + output-high; + }; + }; +}; diff --git a/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft.yaml b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft.yaml new file mode 100644 index 0000000000000..99ca5778e7a03 --- /dev/null +++ b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft.yaml @@ -0,0 +1,21 @@ +identifier: adafruit_feather_esp32s2_tft +name: Adafruit ESP32-S2 TFT Feather +type: mcu +arch: xtensa +toolchain: + - zephyr +supported: + - gpio + - uart + - i2c + - spi + - counter + - watchdog + - entropy + - pwm + - dma + - display +vendor: adafruit +testing: + ignore_tags: + - bluetooth diff --git a/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft_defconfig b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft_defconfig new file mode 100644 index 0000000000000..d8fbaa879257b --- /dev/null +++ b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft_defconfig @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_UART_CONSOLE=y +CONFIG_GPIO=y +CONFIG_CLOCK_CONTROL=y diff --git a/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft_reverse.dts b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft_reverse.dts new file mode 100644 index 0000000000000..fbb4b0993ae1c --- /dev/null +++ b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft_reverse.dts @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2025 Philipp Steiner + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include "adafruit_feather_esp32s2_common.dtsi" +#include "feather_connector.dtsi" + +/ { + model = "Adafruit Feather ESP32-S2 TFT Reverse"; + compatible = "espressif,esp32s2"; + + chosen { + zephyr,display = &st7789v_tft; + }; + + aliases { + backlight = &led1; + }; + + leds { + compatible = "gpio-leds"; + status = "okay"; + + led1: led_1 { + label = "TFT Backlight"; + gpios = <&gpio1 45 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + status = "okay"; + + d1_button: d1_button { + label = "D1 Button"; + gpios = <&gpio0 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + zephyr,code = ; + }; + + d2_button: d2_button { + label = "D3 Button"; + gpios = <&gpio0 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + zephyr,code = ; + }; + }; + + i2c_reg: i2c_reg { + label = "TFT I2C Power"; + compatible = "power-domain-gpio"; + #power-domain-cells = <0>; + enable-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; + startup-delay-us = <10>; + }; + + mipi_dbi { + compatible = "zephyr,mipi-dbi-spi"; + spi-dev = <&spi2>; + dc-gpios = <&gpio1 40 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio1 41 GPIO_ACTIVE_LOW>; + write-only; + #address-cells = <1>; + #size-cells = <0>; + + st7789v_tft: st7789v_tft@0 { + compatible = "sitronix,st7789v"; + status = "disabled"; + + /* Also powered by i2c_reg */ + power-domains = <&i2c_reg>; + + mipi-max-frequency = ; + reg = <0>; + width = <135>; + height = <240>; + x-offset = <52>; + y-offset = <40>; + vcom = <0x20>; + gctrl = <0x35>; + vrhs = <0x0b>; + vdvs = <0x20>; + mdac = <0x08>; + gamma = <0x01>; + colmod = <0x55>; + lcm = <0x2c>; + porch-param = [0c 0c 00 33 33]; + cmd2en-param = [5a 69 02 01]; + pwctrl1-param = [a4 a1]; + pvgam-param = [70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25]; + nvgam-param = [70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25]; + ram-param = [00 F0]; + rgb-param = [40 02 14]; + mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE"; + }; + }; +}; + +&pinctrl { + spim2_default: spim2_default { + group1 { + pinmux = , + , + ; + }; + + group2 { + pinmux = ; + output-low; + }; + }; +}; + +&i2c0 { + max17048: max17048@36 { + compatible = "maxim,max17048"; + status = "disabled"; + reg = <0x36 >; + power-domains = <&i2c_reg>; + }; +}; diff --git a/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft_reverse.yaml b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft_reverse.yaml new file mode 100644 index 0000000000000..f5c673e211bef --- /dev/null +++ b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft_reverse.yaml @@ -0,0 +1,22 @@ +identifier: adafruit_feather_esp32s2_tft_reverse/esp32s2 +name: Adafruit ESP32-S2 TFT Feather Reverse +type: mcu +arch: xtensa +toolchain: + - zephyr +supported: + - gpio + - uart + - i2c + - spi + - counter + - watchdog + - entropy + - pwm + - dma + - display + - fuel_gauge +vendor: adafruit +testing: + ignore_tags: + - bluetooth diff --git a/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft_reverse_defconfig b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft_reverse_defconfig new file mode 100644 index 0000000000000..d8fbaa879257b --- /dev/null +++ b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft_reverse_defconfig @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_UART_CONSOLE=y +CONFIG_GPIO=y +CONFIG_CLOCK_CONTROL=y diff --git a/boards/adafruit/feather_esp32s2/board.c b/boards/adafruit/feather_esp32s2/board.c new file mode 100644 index 0000000000000..e7f65a4ba537a --- /dev/null +++ b/boards/adafruit/feather_esp32s2/board.c @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2024 Leon Rinkel + * Copyright (c) 2025 Philipp Steiner + * + * SPDX-License-Identifier: Apache-2.0 + * + * Automatically turns on backlight if display is configured, i.e. display DT + * node has status okay. + */ + +#include +#include +#include + +#define DISPLAY_NODE DT_CHOSEN(zephyr_display) + +#if DT_NODE_HAS_STATUS(DISPLAY_NODE, okay) +static const struct gpio_dt_spec backlight = GPIO_DT_SPEC_GET(DT_ALIAS(backlight), gpios); +#endif + +void board_late_init_hook(void) +{ +#if DT_NODE_HAS_STATUS(DISPLAY_NODE, okay) + if (gpio_is_ready_dt(&backlight)) { + gpio_pin_configure_dt(&backlight, GPIO_OUTPUT_ACTIVE); + } +#endif +} diff --git a/boards/adafruit/feather_esp32s2/board.cmake b/boards/adafruit/feather_esp32s2/board.cmake new file mode 100644 index 0000000000000..2f04d1fe8861e --- /dev/null +++ b/boards/adafruit/feather_esp32s2/board.cmake @@ -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) diff --git a/boards/adafruit/feather_esp32s2/board.yml b/boards/adafruit/feather_esp32s2/board.yml new file mode 100644 index 0000000000000..fda3bf5e8556b --- /dev/null +++ b/boards/adafruit/feather_esp32s2/board.yml @@ -0,0 +1,22 @@ +boards: +- name: adafruit_feather_esp32s2 + full_name: Adafruit Feather ESP32S2 + vendor: adafruit + socs: + - name: esp32s2 + revision: + format: "letter" + default: "C" + revisions: + - name: "B" + - name: "C" +- name: adafruit_feather_esp32s2_tft + full_name: Adafruit Feather ESP32S2 TFT + vendor: adafruit + socs: + - name: esp32s2 +- name: adafruit_feather_esp32s2_tft_reverse + full_name: Adafruit Feather ESP32S2 TFT Reverse + vendor: adafruit + socs: + - name: esp32s2 diff --git a/boards/adafruit/feather_esp32s2/doc/adafruit_feather_esp32s2.rst b/boards/adafruit/feather_esp32s2/doc/adafruit_feather_esp32s2.rst new file mode 100644 index 0000000000000..b8bc0d90333cf --- /dev/null +++ b/boards/adafruit/feather_esp32s2/doc/adafruit_feather_esp32s2.rst @@ -0,0 +1,356 @@ +.. zephyr:board:: 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`_-compatible +`STEMMA QT`_ 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`_ is the same board as the + `Adafruit ESP32-S2 Feather`_ 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`_ 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`_ there are two different Revisions ``rev B`` and + ``rev C``. The ``rev C`` board has revised the power circuitry for the NeoPixel and I2C + QT port. Instead of a transistor the ``rev C`` has a LDO regulator. To enable the + NeoPixel and I2C QT port on ``rev B`` boards ``GPIO7`` (``i2c_reg``) needs to be set to + LOW and on ``rev C`` boards it needs to be set HIGH. + +Supported Features +================== + +.. zephyr:board-supported-hw:: + +.. note:: + USB-OTG is until now not supported see `ESP32 development overview`_. 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`_ User Guide has detailed information about the board including +pinouts and the schematic. + +- `Adafruit ESP32-S2 Feather Pinouts`_ +- `Adafruit ESP32-S2 Feather Schematic`_ + +Programming and Debugging +************************* + +Prerequisites +============= + +Espressif HAL requires WiFi binary blobs in order work. Run the command below +to retrieve those files. + +.. code-block:: console + + 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: + +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 SoC. + +To build the sample application using sysbuild use the command: + +**Rev B** + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: adafruit_feather_esp32s2@B + :goals: build + :west-args: --sysbuild + :compact: + +**Rev C** + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: adafruit_feather_esp32s2@C + :goals: build + :west-args: --sysbuild + :compact: + +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: + +.. 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 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** + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: adafruit_feather_esp32s2@B + :goals: build + +**Rev C** + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: adafruit_feather_esp32s2@C + :goals: build + +The usual ``flash`` target will work. Here is an example for the :zephyr:code-sample:`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** + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: adafruit_feather_esp32s2@B + :goals: flash + +**Rev C** + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: adafruit_feather_esp32s2@C + :goals: flash + +After the flashing you will receive most likely this Error: + +.. code-block:: console + + 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: + +.. code-block:: shell + + west espressif monitor + +After the board has been manually reseted 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_esp32s2 + +Debugging +********* + +ESP32-S2 support on OpenOCD is available at `OpenOCD`_. + +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`_. + +You can debug an application in the usual way. Here is an example for +the :zephyr:code-sample:`hello_world` application. + +**Rev B** + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: adafruit_feather_esp32s2@B + :goals: debug + +**Rev C** + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: adafruit_feather_esp32s2@C + :goals: 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** + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: adafruit_feather_esp32s2@B + :goals: build flash + +**Rev C** + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: adafruit_feather_esp32s2@C + :goals: build flash + +Testing the NeoPixel +******************** + +There is a sample available to verify that the NeoPixel on the board are +functioning correctly with Zephyr: + +**Rev B** + + .. zephyr-app-commands:: + :zephyr-app: samples/drivers/led/led_strip + :board: adafruit_feather_esp32s2@B + :goals: build flash + +**Rev C** + + .. zephyr-app-commands:: + :zephyr-app: samples/drivers/led/led_strip + :board: adafruit_feather_esp32s2@C + :goals: build 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. + +.. zephyr-app-commands:: + :zephyr-app: samples/fuel_gauge/max17048/ + :board: adafruit_feather_esp32s2@C + :goals: build 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** + + .. zephyr-app-commands:: + :zephyr-app: samples/net/wifi/shell + :board: adafruit_feather_esp32s2@B + :goals: build flash + +**Rev C** + + .. zephyr-app-commands:: + :zephyr-app: samples/net/wifi/shell + :board: adafruit_feather_esp32s2@C + :goals: build flash + +References +********** + +.. target-notes:: + +.. _`Adafruit ESP32-S2 Feather`: https://www.adafruit.com/product/5000 +.. _`Adafruit ESP32-S2 Feather with BME280 Sensor`: https://www.adafruit.com/product/5303 +.. _`OpenOCD`: https://github.com/openocd-org/openocd +.. _`ESP32 development overview`: https://github.com/zephyrproject-rtos/zephyr/issues/29394#issuecomment-2635037831 +.. _`Adafruit ESP32-S2 Feather Pinouts`: https://learn.adafruit.com/adafruit-esp32-s2-feather/pinouts +.. _`Adafruit ESP32-S2 Feather Schematic`: https://learn.adafruit.com/adafruit-esp32-s2-feather/downloads +.. _`SparkFun Qwiic`: https://www.sparkfun.com/qwiic +.. _`STEMMA QT`: https://learn.adafruit.com/introducing-adafruit-stemma-qt +.. _`JTAG debugging for ESP32-S2`: https://docs.espressif.com/projects/esp-idf/en/stable/esp32s2/api-guides/jtag-debugging/index.html diff --git a/boards/adafruit/feather_esp32s2/doc/adafruit_feather_esp32s2_tft.rst b/boards/adafruit/feather_esp32s2/doc/adafruit_feather_esp32s2_tft.rst new file mode 100644 index 0000000000000..963ff82634588 --- /dev/null +++ b/boards/adafruit/feather_esp32s2/doc/adafruit_feather_esp32s2_tft.rst @@ -0,0 +1,294 @@ +.. zephyr:board:: adafruit_feather_esp32s2_tft + +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`_-compatible +`STEMMA QT`_ 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 +- 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 +- 240x135 pixel IPS TFT color display with 1.14" diagonal and ST7789 chipset + +.. note:: + + - The board has a space for a BME280, 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. + +Supported Features +================== + +.. zephyr:board-supported-hw:: + +.. note:: + USB-OTG is until now not supported see `ESP32 development overview`_. 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 TFT Feather`_ User Guide has detailed information about the board including +pinouts and the schematic. + +- `Adafruit ESP32-S2 TFT Feather Pinouts`_ +- `Adafruit ESP32-S2 TFT Feather Schematic`_ + +Programming and Debugging +************************* + +Prerequisites +============= + +Espressif HAL requires WiFi binary blobs in order work. Run the command below +to retrieve those files. + +.. code-block:: console + + 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: + +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 SoC. + +To build the sample application using sysbuild use the command: + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: adafruit_feather_esp32s2_tft + :goals: build + :west-args: --sysbuild + :compact: + +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: + +.. 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 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: + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: adafruit_feather_esp32s2_tft + :goals: build + +The usual ``flash`` target will work. Here is an example for the :zephyr:code-sample:`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``. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: adafruit_feather_esp32s2_tft + :goals: flash + +After the flashing you will receive most likely this Error: + +.. code-block:: console + + 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: + +.. code-block:: shell + + west espressif monitor + +After the board has been manually reseted 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_esp32s2_tft + +Debugging +********* + +ESP32-S2 support on OpenOCD is available at `OpenOCD`_. + +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`_. + +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_esp32s2_tft + :goals: debug + +Testing the On-Board-LED +************************ + +There is a sample available to verify that the LEDs on the board are +functioning correctly with Zephyr: + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: adafruit_feather_esp32s2_tft + :goals: build flash + +Testing the NeoPixel +******************** + +There is a sample available to verify that the NeoPixel on the board are +functioning correctly with Zephyr: + +.. zephyr-app-commands:: + :zephyr-app: samples/drivers/led/led_strip + :board: adafruit_feather_esp32s2_tft + :goals: build flash + +Testing the TFT +*************** + +.. note:: + To activate the backlight of the display ``GPIO45`` (``backlight``) needs to be set to HIGH. + This will be done automatically via ``board_late_init_hook()``. + +.. zephyr-app-commands:: + :zephyr-app: samples/subsys/display/lvgl + :board: adafruit_feather_esp32s2_tft + :goals: build 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. + +.. zephyr-app-commands:: + :zephyr-app: samples/fuel_gauge/max17048/ + :board: adafruit_feather_esp32s2_tft + :goals: build 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. + +.. zephyr-app-commands:: + :zephyr-app: samples/net/wifi/shell + :board: adafruit_feather_esp32s2_tft + :goals: build flash + +References +********** + +.. target-notes:: + +.. _`Adafruit ESP32-S2 TFT Feather`: https://www.adafruit.com/product/5300 +.. _`OpenOCD`: https://github.com/openocd-org/openocd +.. _`ESP32 development overview`: https://github.com/zephyrproject-rtos/zephyr/issues/29394#issuecomment-2635037831 +.. _`Adafruit ESP32-S2 TFT Feather Pinouts`: https://learn.adafruit.com/adafruit-esp32-s2-tft-feather/pinouts +.. _`Adafruit ESP32-S2 TFT Feather Schematic`: https://learn.adafruit.com/adafruit-esp32-s2-tft-feather/downloads +.. _`SparkFun Qwiic`: https://www.sparkfun.com/qwiic +.. _`STEMMA QT`: https://learn.adafruit.com/introducing-adafruit-stemma-qt +.. _`JTAG debugging for ESP32-S2`: https://docs.espressif.com/projects/esp-idf/en/stable/esp32s2/api-guides/jtag-debugging/index.html diff --git a/boards/adafruit/feather_esp32s2/doc/adafruit_feather_esp32s2_tft_reverse.rst b/boards/adafruit/feather_esp32s2/doc/adafruit_feather_esp32s2_tft_reverse.rst new file mode 100644 index 0000000000000..3a7bc541c61fd --- /dev/null +++ b/boards/adafruit/feather_esp32s2/doc/adafruit_feather_esp32s2_tft_reverse.rst @@ -0,0 +1,291 @@ +.. zephyr:board:: adafruit_feather_esp32s2_tft_reverse + +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`_-compatible +`STEMMA QT`_ 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 +- Charging indicator LED, user LED, reset and boot buttons and has 2 additional buttons. +- Built-in NeoPixel indicator RGB LED +- 240x135 pixel IPS TFT color display with 1.14" diagonal and ST7789 chipset. + +.. note:: + + - The board has a space for a BME280, but will not be shipped with. + - For the MAX17048 a driver in zephyr exists and is supported, but needs to be added via + a devicetree overlay. + +Supported Features +================== + +.. zephyr:board-supported-hw:: + +.. note:: + USB-OTG is until now not supported see `ESP32 development overview`_. 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 Reverse TFT Feather`_ User Guide has detailed information about the board +including pinouts and the schematic. + +- `Adafruit ESP32-S2 Reverse TFT Feather Pinouts`_ +- `Adafruit ESP32-S2 Reverse TFT Feather Schematic`_ + +Programming and Debugging +************************* + +Prerequisites +============= + +Espressif HAL requires WiFi binary blobs in order work. Run the command below +to retrieve those files. + +.. code-block:: console + + 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: + +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 SoC. + +To build the sample application using sysbuild use the command: + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: adafruit_feather_esp32s2_tft_reverse + :goals: build + :west-args: --sysbuild + :compact: + +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: + +.. 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 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: + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: adafruit_feather_esp32s2_tft_reverse + :goals: build + +The usual ``flash`` target will work. Here is an example for the :zephyr:code-sample:`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``. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: adafruit_feather_esp32s2_tft_reverse + :goals: flash + +After the flashing you will receive most likely this Error: + +.. code-block:: console + + 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: + +.. code-block:: shell + + west espressif monitor + +After the board has been manually reseted 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_esp32s2_tft_reverse + +Debugging +********* + +ESP32-S2 support on OpenOCD is available at `OpenOCD`_. + +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`_. + +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_esp32s2_tft_reverse + :goals: debug + +Testing the On-Board-LED +************************ + +There is a sample available to verify that the LEDs on the board are +functioning correctly with Zephyr: + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: adafruit_feather_esp32s2_tft_reverse + :goals: build flash + +Testing the NeoPixel +******************** + +There is a sample available to verify that the NeoPixel on the board are +functioning correctly with Zephyr: + +.. zephyr-app-commands:: + :zephyr-app: samples/drivers/led/led_strip + :board: adafruit_feather_esp32s2_tft_reverse + :goals: build flash + +Testing the TFT +*************** + +There is a sample available to verify that the TFT on the board are +functioning correctly with Zephyr: + +.. note:: + To activated the backlight of the display ``GPIO45`` (``backlight``) needs to be set to HIGH. + This will be done automatically via ``board_late_init_hook()``. + +.. zephyr-app-commands:: + :zephyr-app: samples/subsys/display/lvgl + :board: adafruit_feather_esp32s2_tft_reverse + :goals: build 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. + +.. zephyr-app-commands:: + :zephyr-app: samples/fuel_gauge/max17048/ + :board: adafruit_feather_esp32s2_tft_reverse + :goals: build 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. + +.. zephyr-app-commands:: + :zephyr-app: samples/net/wifi/shell + :board: adafruit_feather_esp32s2_tft_reverse + :goals: build flash + +References +********** + +.. target-notes:: + +.. _`Adafruit ESP32-S2 Reverse TFT Feather`: https://www.adafruit.com/product/5345 +.. _`OpenOCD`: https://github.com/openocd-org/openocd +.. _`ESP32 development overview`: https://github.com/zephyrproject-rtos/zephyr/issues/29394#issuecomment-2635037831 +.. _`Adafruit ESP32-S2 Reverse TFT Feather Pinouts`: https://learn.adafruit.com/esp32-s2-reverse-tft-feather/pinouts +.. _`Adafruit ESP32-S2 Reverse TFT Feather Schematic`: https://learn.adafruit.com/esp32-s2-reverse-tft-feather/downloads +.. _`SparkFun Qwiic`: https://www.sparkfun.com/qwiic +.. _`STEMMA QT`: https://learn.adafruit.com/introducing-adafruit-stemma-qt +.. _`JTAG debugging for ESP32-S2`: https://docs.espressif.com/projects/esp-idf/en/stable/esp32s2/api-guides/jtag-debugging/index.html diff --git a/boards/adafruit/feather_esp32s2/doc/img/adafruit_feather_esp32s2.webp b/boards/adafruit/feather_esp32s2/doc/img/adafruit_feather_esp32s2.webp new file mode 100644 index 0000000000000..b63d6c73977c6 Binary files /dev/null and b/boards/adafruit/feather_esp32s2/doc/img/adafruit_feather_esp32s2.webp differ diff --git a/boards/adafruit/feather_esp32s2/doc/img/adafruit_feather_esp32s2_tft.webp b/boards/adafruit/feather_esp32s2/doc/img/adafruit_feather_esp32s2_tft.webp new file mode 100644 index 0000000000000..a1b9d091218e6 Binary files /dev/null and b/boards/adafruit/feather_esp32s2/doc/img/adafruit_feather_esp32s2_tft.webp differ diff --git a/boards/adafruit/feather_esp32s2/doc/img/adafruit_feather_esp32s2_tft_reverse.webp b/boards/adafruit/feather_esp32s2/doc/img/adafruit_feather_esp32s2_tft_reverse.webp new file mode 100644 index 0000000000000..8b607c89f858f Binary files /dev/null and b/boards/adafruit/feather_esp32s2/doc/img/adafruit_feather_esp32s2_tft_reverse.webp differ diff --git a/boards/adafruit/feather_esp32s2/feather_connector.dtsi b/boards/adafruit/feather_esp32s2/feather_connector.dtsi new file mode 100644 index 0000000000000..8414fbbfb106c --- /dev/null +++ b/boards/adafruit/feather_esp32s2/feather_connector.dtsi @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2020 Richard Osterloh + * Copyright (c) 2024 Leon Rinkel + * Copyright (c) 2025 Philipp Steiner + * + * 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 43 0>, /* DB */ + <12 0 &gpio1 3 0>, /* SDA */ + <13 0 &gpio1 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 {}; diff --git a/boards/adafruit/feather_esp32s2/feather_connector_tft.dtsi b/boards/adafruit/feather_esp32s2/feather_connector_tft.dtsi new file mode 100644 index 0000000000000..3a2eb8c3e0da8 --- /dev/null +++ b/boards/adafruit/feather_esp32s2/feather_connector_tft.dtsi @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2020 Richard Osterloh + * Copyright (c) 2024 Leon Rinkel + * Copyright (c) 2025 Philipp Steiner + * + * 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 &gpio0 2 0>, /* RX */ + <10 0 &gpio0 1 0>, /* TX */ + <11 0 &gpio1 43 0>, /* DB */ + <12 0 &gpio1 42 0>, /* SDA */ + <13 0 &gpio1 41 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 {}; diff --git a/boards/adafruit/feather_esp32s2/support/openocd.cfg b/boards/adafruit/feather_esp32s2/support/openocd.cfg new file mode 100644 index 0000000000000..2f740b4a36ab1 --- /dev/null +++ b/boards/adafruit/feather_esp32s2/support/openocd.cfg @@ -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] diff --git a/samples/drivers/led/led_strip/boards/adafruit_feather_esp32s2.conf b/samples/drivers/led/led_strip/boards/adafruit_feather_esp32s2.conf new file mode 100644 index 0000000000000..8230eb9896b4f --- /dev/null +++ b/samples/drivers/led/led_strip/boards/adafruit_feather_esp32s2.conf @@ -0,0 +1,2 @@ +CONFIG_GPIO=y +CONFIG_GPIO_HOGS=y diff --git a/samples/drivers/led/led_strip/boards/adafruit_feather_esp32s2_tft.conf b/samples/drivers/led/led_strip/boards/adafruit_feather_esp32s2_tft.conf new file mode 100644 index 0000000000000..8230eb9896b4f --- /dev/null +++ b/samples/drivers/led/led_strip/boards/adafruit_feather_esp32s2_tft.conf @@ -0,0 +1,2 @@ +CONFIG_GPIO=y +CONFIG_GPIO_HOGS=y diff --git a/samples/drivers/led/led_strip/boards/adafruit_feather_esp32s2_tft_reverse.conf b/samples/drivers/led/led_strip/boards/adafruit_feather_esp32s2_tft_reverse.conf new file mode 100644 index 0000000000000..8230eb9896b4f --- /dev/null +++ b/samples/drivers/led/led_strip/boards/adafruit_feather_esp32s2_tft_reverse.conf @@ -0,0 +1,2 @@ +CONFIG_GPIO=y +CONFIG_GPIO_HOGS=y diff --git a/samples/fuel_gauge/max17048/boards/adafruit_feather_esp32s2_C.conf b/samples/fuel_gauge/max17048/boards/adafruit_feather_esp32s2_C.conf new file mode 100644 index 0000000000000..0968fb220e006 --- /dev/null +++ b/samples/fuel_gauge/max17048/boards/adafruit_feather_esp32s2_C.conf @@ -0,0 +1,4 @@ +CONFIG_POWER_DOMAIN=y +CONFIG_GPIO=y +CONFIG_PM_DEVICE=y +CONFIG_PM_DEVICE_POWER_DOMAIN=y diff --git a/samples/fuel_gauge/max17048/boards/adafruit_feather_esp32s2_C.overlay b/samples/fuel_gauge/max17048/boards/adafruit_feather_esp32s2_C.overlay new file mode 100644 index 0000000000000..66298554285cb --- /dev/null +++ b/samples/fuel_gauge/max17048/boards/adafruit_feather_esp32s2_C.overlay @@ -0,0 +1,8 @@ +&i2c0 { + max17048: max17048@36 { + compatible = "maxim,max17048"; + status = "okay"; + reg = <0x36 >; + power-domains = <&i2c_reg>; + }; +}; diff --git a/samples/fuel_gauge/max17048/boards/adafruit_feather_esp32s2_tft.conf b/samples/fuel_gauge/max17048/boards/adafruit_feather_esp32s2_tft.conf new file mode 100644 index 0000000000000..0968fb220e006 --- /dev/null +++ b/samples/fuel_gauge/max17048/boards/adafruit_feather_esp32s2_tft.conf @@ -0,0 +1,4 @@ +CONFIG_POWER_DOMAIN=y +CONFIG_GPIO=y +CONFIG_PM_DEVICE=y +CONFIG_PM_DEVICE_POWER_DOMAIN=y diff --git a/samples/fuel_gauge/max17048/boards/adafruit_feather_esp32s2_tft.overlay b/samples/fuel_gauge/max17048/boards/adafruit_feather_esp32s2_tft.overlay new file mode 100644 index 0000000000000..66298554285cb --- /dev/null +++ b/samples/fuel_gauge/max17048/boards/adafruit_feather_esp32s2_tft.overlay @@ -0,0 +1,8 @@ +&i2c0 { + max17048: max17048@36 { + compatible = "maxim,max17048"; + status = "okay"; + reg = <0x36 >; + power-domains = <&i2c_reg>; + }; +}; diff --git a/samples/fuel_gauge/max17048/boards/adafruit_feather_esp32s2_tft_reverse.conf b/samples/fuel_gauge/max17048/boards/adafruit_feather_esp32s2_tft_reverse.conf new file mode 100644 index 0000000000000..0968fb220e006 --- /dev/null +++ b/samples/fuel_gauge/max17048/boards/adafruit_feather_esp32s2_tft_reverse.conf @@ -0,0 +1,4 @@ +CONFIG_POWER_DOMAIN=y +CONFIG_GPIO=y +CONFIG_PM_DEVICE=y +CONFIG_PM_DEVICE_POWER_DOMAIN=y diff --git a/samples/sensor/bme280/boards/adafruit_feather_esp32s2.overlay b/samples/sensor/bme280/boards/adafruit_feather_esp32s2.overlay new file mode 100644 index 0000000000000..7259b070ebb79 --- /dev/null +++ b/samples/sensor/bme280/boards/adafruit_feather_esp32s2.overlay @@ -0,0 +1,6 @@ +&i2c0 { + bme280: bme280@77 { + compatible = "bosch,bme280"; + reg = <0x77>; + }; +}; diff --git a/samples/sensor/bme280/boards/adafruit_feather_esp32s2_tft.overlay b/samples/sensor/bme280/boards/adafruit_feather_esp32s2_tft.overlay new file mode 100644 index 0000000000000..7259b070ebb79 --- /dev/null +++ b/samples/sensor/bme280/boards/adafruit_feather_esp32s2_tft.overlay @@ -0,0 +1,6 @@ +&i2c0 { + bme280: bme280@77 { + compatible = "bosch,bme280"; + reg = <0x77>; + }; +}; diff --git a/samples/sensor/bme280/boards/adafruit_feather_esp32s2_tft_reverse.overlay b/samples/sensor/bme280/boards/adafruit_feather_esp32s2_tft_reverse.overlay new file mode 100644 index 0000000000000..7259b070ebb79 --- /dev/null +++ b/samples/sensor/bme280/boards/adafruit_feather_esp32s2_tft_reverse.overlay @@ -0,0 +1,6 @@ +&i2c0 { + bme280: bme280@77 { + compatible = "bosch,bme280"; + reg = <0x77>; + }; +}; diff --git a/samples/subsys/display/lvgl/boards/adafruit_feather_esp32s2_tft.conf b/samples/subsys/display/lvgl/boards/adafruit_feather_esp32s2_tft.conf new file mode 100644 index 0000000000000..cf023663fe53a --- /dev/null +++ b/samples/subsys/display/lvgl/boards/adafruit_feather_esp32s2_tft.conf @@ -0,0 +1,6 @@ +CONFIG_POWER_DOMAIN=y +CONFIG_GPIO=y +CONFIG_PM_DEVICE=y +CONFIG_PM_DEVICE_POWER_DOMAIN=y + +CONFIG_MAIN_STACK_SIZE=4096 diff --git a/samples/subsys/display/lvgl/boards/adafruit_feather_esp32s2_tft.overlay b/samples/subsys/display/lvgl/boards/adafruit_feather_esp32s2_tft.overlay new file mode 100644 index 0000000000000..bf62c27670add --- /dev/null +++ b/samples/subsys/display/lvgl/boards/adafruit_feather_esp32s2_tft.overlay @@ -0,0 +1,3 @@ +&st7789v_tft { + status = "okay"; +}; diff --git a/samples/subsys/display/lvgl/boards/adafruit_feather_esp32s2_tft_reverse.conf b/samples/subsys/display/lvgl/boards/adafruit_feather_esp32s2_tft_reverse.conf new file mode 100644 index 0000000000000..cf023663fe53a --- /dev/null +++ b/samples/subsys/display/lvgl/boards/adafruit_feather_esp32s2_tft_reverse.conf @@ -0,0 +1,6 @@ +CONFIG_POWER_DOMAIN=y +CONFIG_GPIO=y +CONFIG_PM_DEVICE=y +CONFIG_PM_DEVICE_POWER_DOMAIN=y + +CONFIG_MAIN_STACK_SIZE=4096 diff --git a/samples/subsys/display/lvgl/boards/adafruit_feather_esp32s2_tft_reverse.overlay b/samples/subsys/display/lvgl/boards/adafruit_feather_esp32s2_tft_reverse.overlay new file mode 100644 index 0000000000000..bf62c27670add --- /dev/null +++ b/samples/subsys/display/lvgl/boards/adafruit_feather_esp32s2_tft_reverse.overlay @@ -0,0 +1,3 @@ +&st7789v_tft { + status = "okay"; +};