boards: xtensa: add support for waveshare esp32-s3-touch-lcd-1.28

Add support for the Waveshare ESP32-S3-Touch-LCD-1.28 board, including
support the LCD and touchscreen controllers. Tested with samples
already available.

Signed-off-by: Joel Guittet <joelguittet@gmail.com>
This commit is contained in:
Joel Guittet 2024-03-20 23:23:01 +01:00 committed by Carles Cufí
parent 666a89221b
commit 6d91c528a0
14 changed files with 554 additions and 0 deletions

View file

@ -0,0 +1,6 @@
# Copyright (c) 2024 Joel Guittet
# SPDX-License-Identifier: Apache-2.0
config BOARD_ESP32S3_TOUCH_LCD_1_28
select SOC_ESP32S3_PROCPU if BOARD_ESP32S3_TOUCH_LCD_1_28_ESP32S3_PROCPU
select SOC_ESP32S3_APPCPU if BOARD_ESP32S3_TOUCH_LCD_1_28_ESP32S3_APPCPU

View file

@ -0,0 +1,36 @@
# Copyright (c) 2024 Joel Guittet
# SPDX-License-Identifier: Apache-2.0
if BOARD_ESP32S3_TOUCH_LCD_1_28_ESP32S3_PROCPU
config HEAP_MEM_POOL_ADD_SIZE_BOARD
int
default 65535 if WIFI && BT
default 51200 if WIFI
default 40960 if BT
default 4096
choice BT_HCI_BUS_TYPE
default BT_ESP32 if BT
endchoice
endif # BOARD_ESP32S3_TOUCH_LCD_1_28_ESP32S3_PROCPU
if BOARD_ESP32S3_TOUCH_LCD_1_28_ESP32S3_APPCPU
config HEAP_MEM_POOL_ADD_SIZE_BOARD
default 256
endif # BOARD_ESP32S3_TOUCH_LCD_1_28_ESP32S3_APPCPU
config ENTROPY_GENERATOR
default y
config KERNEL_MEM_POOL
default y
config PWM
default y if DISPLAY
config LV_COLOR_16_SWAP
default y if LVGL

View file

@ -0,0 +1,5 @@
# Copyright (c) 2024 Joel Guittet
# SPDX-License-Identifier: Apache-2.0
config BOARD_ESP32S3_TOUCH_LCD_1_28
select SOC_ESP32S3_R2

View file

@ -0,0 +1,10 @@
# Copyright (c) 2024 Joel Guittet
# 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,5 @@
board:
name: esp32s3_touch_lcd_1_28
vendor: waveshare
socs:
- name: esp32s3

View file

@ -0,0 +1,123 @@
.. _esp32s3_touch_lcd_1_28:
Waveshare ESP32-S3-Touch-LCD-1.28
#################################
Overview
********
The ESP32-S3-Touch-LCD-1.28 is an ESP32S3 development board from Waveshare with a round LCD,
suitable to build watches or similar projects. This board integrates complete Wi-Fi and Bluetooth
Low Energy functions, an accelerometer and gyroscope, a battery charger and GPIO extension port.
Hardware
********
ESP32-S3 is a low-power MCU-based system on a chip (SoC) with integrated 2.4 GHz Wi-Fi
and Bluetooth® Low Energy (Bluetooth LE). It consists of high-performance dual-core microprocessor
(Xtensa® 32-bit LX7), a low power coprocessor, a Wi-Fi baseband, a Bluetooth LE baseband,
RF module, and numerous peripherals.
ESP32-S3-Touch-LCD-1.28 includes the following features:
- Dual core 32-bit Xtensa Microprocessor (Tensilica LX7), running up to 240MHz
- Additional vector instructions support for AI acceleration
- 2MB of SRAM
- 16MB of FLASH
- Wi-Fi 802.11b/g/n
- Bluetooth LE 5.0 with long-range support and up to 2Mbps data rate
- Round 1.28" LCD with touchscreen controller
- Accelerometer/gyroscope
- Battery charger
Digital interfaces:
- 6 programmable GPIOs
- 2 open-drain outputs
Low Power:
- Power Management Unit with five power modes
- Ultra-Low-Power (ULP) coprocessors: ULP-RISC-V and ULP-FSM
Security:
- Secure boot
- Flash encryption
- 4-Kbit OTP, up to 1792 bits for users
- Cryptographic hardware acceleration: (AES-128/256, Hash, RSA, RNG, HMAC, Digital signature)
Asymmetric Multiprocessing (AMP)
********************************
ESP32-S3 allows 2 different applications to be executed in ESP32-S3 SoC. 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 :ref:`ipc_samples` folder as code reference.
For more information, check the datasheet at `ESP32-S3 Datasheet`_.
Supported Features
==================
Current Zephyr's ESP32-S3-Touch-LCD-1.28 board supports the following features:
+------------+------------+-------------------------------------+
| Interface | Controller | Driver/Component |
+============+============+=====================================+
| UART | on-chip | serial port |
+------------+------------+-------------------------------------+
| GPIO | on-chip | gpio |
+------------+------------+-------------------------------------+
| PINMUX | on-chip | pinmux |
+------------+------------+-------------------------------------+
| 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 |
+------------+------------+-------------------------------------+
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
*******************
ESP-IDF bootloader
==================
The board is using the ESP-IDF bootloader as the default 2nd stage bootloader.
It is build as a subproject at each application build. No further attention
is expected from the user.
References
**********
.. _ESP32-S3-Touch-LCD-1.28 Waveshare Wiki: https://www.waveshare.com/wiki/ESP32-S3-Touch-LCD-1.28
.. _ESP32-S3 Datasheet: https://www.espressif.com/sites/default/files/documentation/esp32-s3-mini-1_mini-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,48 @@
/*
* Copyright (c) 2024 Joel Guittet
* SPDX-License-Identifier: Apache-2.0
*/
#include <dt-bindings/pinctrl/esp32s3-pinctrl.h>
#include <zephyr/dt-bindings/pinctrl/esp-pinctrl-common.h>
#include <zephyr/dt-bindings/pinctrl/esp32s3-gpio-sigmap.h>
&pinctrl {
i2c1_default: i2c1_default {
group1 {
pinmux = <I2C1_SDA_GPIO6>, <I2C1_SCL_GPIO7>;
bias-pull-up;
drive-open-drain;
output-high;
};
};
ledc0_default: ledc0_default {
group1 {
pinmux = <LEDC_CH0_GPIO2>, <LEDC_CH1_GPIO5>, <LEDC_CH2_GPIO4>;
output-enable;
};
};
spim2_default: spim2_default {
group1 {
pinmux = <SPIM2_MISO_GPIO12>, <SPIM2_SCLK_GPIO10>, <SPIM2_CSEL_GPIO9>;
};
group2 {
pinmux = <SPIM2_MOSI_GPIO11>;
output-low;
};
};
uart0_default: uart0_default {
group1 {
pinmux = <UART0_TX_GPIO43>;
output-high;
};
group2 {
pinmux = <UART0_RX_GPIO44>;
bias-pull-up;
};
};
};

View file

@ -0,0 +1,65 @@
/*
* Copyright (c) 2024 Joel Guittet
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <espressif/esp32s3/esp32s3_appcpu.dtsi>
/ {
model = "ESP32-S3-Touch-LCD-1.28 APPCPU";
compatible = "waveshare,esp32-s3-touch-lcd-1.28";
chosen {
zephyr,sram = &sram0;
};
};
&cpu0 {
clock-frequency = <ESP32_CLK_CPU_240M>;
};
&cpu1 {
clock-frequency = <ESP32_CLK_CPU_240M>;
};
&flash0 {
status = "okay";
reg = <0x0 DT_SIZE_M(16)>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0x0000F000>;
read-only;
};
slot0_partition: partition@10000 {
label = "image-0";
reg = <0x00010000 0x00100000>;
};
slot1_partition: partition@110000 {
label = "image-1";
reg = <0x00110000 0x00100000>;
};
scratch_partition: partition@210000 {
label = "image-scratch";
reg = <0x00210000 0x00040000>;
};
storage_partition: partition@250000 {
label = "storage";
reg = <0x00250000 0x00006000>;
};
};
};
&trng0 {
status = "okay";
};

View file

@ -0,0 +1,22 @@
identifier: esp32s3_touch_lcd_1_28/esp32s3/appcpu
name: ESP32-S3-Touch-LCD-1.28 APPCPU
type: mcu
arch: xtensa
toolchain:
- zephyr
supported:
- gpio
- i2c
- spi
- watchdog
- regulator
- uart
- pwm
- pinmux
- nvs
- display
testing:
ignore_tags:
- net
- bluetooth
vendor: waveshare

View file

@ -0,0 +1,6 @@
# Copyright (c) 2024 Joel Guittet
# SPDX-License-Identifier: Apache-2.0
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_CLOCK_CONTROL=y
CONFIG_MINIMAL_LIBC=y

View file

@ -0,0 +1,184 @@
/*
* Copyright (c) 2024 Joel Guittet
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <espressif/esp32s3/esp32s3_r2.dtsi>
#include "esp32s3_touch_lcd_1_28-pinctrl.dtsi"
#include <zephyr/dt-bindings/display/panel.h>
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include <zephyr/dt-bindings/pwm/pwm.h>
/ {
model = "ESP32-S3-Touch-LCD-1.28 PROCPU";
compatible = "waveshare,esp32-s3-touch-lcd-1.28";
aliases {
i2c-1 = &i2c1;
pwm-0 = &ledc0;
pwm-lcd0 = &pwm_lcd0;
sw0 = &button0;
uart-0 = &uart0;
watchdog0 = &wdt0;
};
chosen {
zephyr,sram = &sram0;
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
zephyr,display = &gc9a01;
};
/* Buttons */
buttons {
compatible = "gpio-keys";
button0: button_0 {
gpios = <&gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "BOOT Button";
zephyr,code = <INPUT_KEY_0>;
};
};
/* Touch Controller */
lvgl_pointer {
compatible = "zephyr,lvgl-pointer-input";
input = <&cst816s>;
};
/* PWM */
pwmleds {
compatible = "pwm-leds";
pwm_lcd0: pwm_lcd0 {
pwms = <&ledc0 0 PWM_HZ(250) PWM_POLARITY_NORMAL>;
};
};
};
&cpu0 {
clock-frequency = <ESP32_CLK_CPU_240M>;
};
&cpu1 {
clock-frequency = <ESP32_CLK_CPU_240M>;
};
&flash0 {
status = "okay";
reg = <0x0 DT_SIZE_M(16)>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0x0000F000>;
read-only;
};
slot0_partition: partition@10000 {
label = "image-0";
reg = <0x00010000 0x00100000>;
};
slot1_partition: partition@110000 {
label = "image-1";
reg = <0x00110000 0x00100000>;
};
scratch_partition: partition@210000 {
label = "image-scratch";
reg = <0x00210000 0x00040000>;
};
storage_partition: partition@250000 {
label = "storage";
reg = <0x00250000 0x00006000>;
};
};
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
&i2c1 {
status ="okay";
clock-frequency = <I2C_BITRATE_STANDARD>;
pinctrl-0 = <&i2c1_default>;
pinctrl-names = "default";
/* Hynitron CST816S Capacitive Touch Controller */
cst816s: cst816s@15 {
status = "okay";
compatible = "hynitron,cst816s";
reg = <0x15>;
irq-gpios = <&gpio0 5 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
rst-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
};
};
&ledc0 {
status = "okay";
pinctrl-0 = <&ledc0_default>;
pinctrl-names = "default";
#address-cells = <1>;
#size-cells = <0>;
channel0@0 {
reg = <0x0>;
timer = <0>;
};
channel1@1 {
reg = <0x1>;
timer = <1>;
};
channel2@2 {
reg = <0x2>;
timer = <2>;
};
};
&spi2 {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
pinctrl-0 = <&spim2_default>;
pinctrl-names = "default";
cs-gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
gc9a01: gc9a01@0 {
status = "okay";
compatible = "galaxycore,gc9x01x";
reg = <0>;
spi-max-frequency = <100000000>;
cmd-data-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
reset-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
pixel-format = <PANEL_PIXEL_FORMAT_RGB_888>;
display-inversion;
width = <240>;
height = <240>;
};
};
&trng0 {
status = "okay";
};
&uart0 {
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-names = "default";
};
&wdt0 {
status = "okay";
};

View file

@ -0,0 +1,22 @@
identifier: esp32s3_touch_lcd_1_28/esp32s3/procpu
name: ESP32-S3-Touch-LCD-1.28 PROCPU
type: mcu
arch: xtensa
toolchain:
- zephyr
supported:
- gpio
- i2c
- spi
- watchdog
- regulator
- uart
- pwm
- pinmux
- nvs
- display
testing:
ignore_tags:
- net
- bluetooth
vendor: waveshare

View file

@ -0,0 +1,12 @@
# Copyright (c) 2024 Joel Guittet
# SPDX-License-Identifier: Apache-2.0
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_GPIO=y
CONFIG_REGULATOR=y
CONFIG_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y
CONFIG_CLOCK_CONTROL=y
CONFIG_INPUT=y
CONFIG_INPUT_CST816S_INTERRUPT=n

View file

@ -0,0 +1,10 @@
# Copyright (c) 2024 Joel Guittet
# SPDX-License-Identifier: Apache-2.0
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]