diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig b/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig new file mode 100644 index 0000000000..e6b26bf1d6 --- /dev/null +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig @@ -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 diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig.defconfig b/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig.defconfig new file mode 100644 index 0000000000..33296a8e52 --- /dev/null +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig.defconfig @@ -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 diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig.esp32s3_touch_lcd_1_28 b/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig.esp32s3_touch_lcd_1_28 new file mode 100644 index 0000000000..b62dd557d2 --- /dev/null +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig.esp32s3_touch_lcd_1_28 @@ -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 diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/board.cmake b/boards/waveshare/esp32s3_touch_lcd_1_28/board.cmake new file mode 100644 index 0000000000..b822d4b083 --- /dev/null +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/board.cmake @@ -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) diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/board.yml b/boards/waveshare/esp32s3_touch_lcd_1_28/board.yml new file mode 100644 index 0000000000..821fd36782 --- /dev/null +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/board.yml @@ -0,0 +1,5 @@ +board: + name: esp32s3_touch_lcd_1_28 + vendor: waveshare + socs: + - name: esp32s3 diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/doc/index.rst b/boards/waveshare/esp32s3_touch_lcd_1_28/doc/index.rst new file mode 100644 index 0000000000..3395bcff2e --- /dev/null +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/doc/index.rst @@ -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 diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28-pinctrl.dtsi b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28-pinctrl.dtsi new file mode 100644 index 0000000000..8bb1a06d8b --- /dev/null +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28-pinctrl.dtsi @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Joel Guittet + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +&pinctrl { + + i2c1_default: i2c1_default { + group1 { + pinmux = , ; + bias-pull-up; + drive-open-drain; + output-high; + }; + }; + + ledc0_default: ledc0_default { + group1 { + pinmux = , , ; + output-enable; + }; + }; + + spim2_default: spim2_default { + group1 { + pinmux = , , ; + }; + group2 { + pinmux = ; + output-low; + }; + }; + + uart0_default: uart0_default { + group1 { + pinmux = ; + output-high; + }; + group2 { + pinmux = ; + bias-pull-up; + }; + }; +}; diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_appcpu.dts b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_appcpu.dts new file mode 100644 index 0000000000..50301f22c2 --- /dev/null +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_appcpu.dts @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2024 Joel Guittet + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include + +/ { + model = "ESP32-S3-Touch-LCD-1.28 APPCPU"; + compatible = "waveshare,esp32-s3-touch-lcd-1.28"; + + chosen { + zephyr,sram = &sram0; + }; +}; + +&cpu0 { + clock-frequency = ; +}; + +&cpu1 { + clock-frequency = ; +}; + +&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"; +}; diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_appcpu.yaml b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_appcpu.yaml new file mode 100644 index 0000000000..bd677cef70 --- /dev/null +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_appcpu.yaml @@ -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 diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_appcpu_defconfig b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_appcpu_defconfig new file mode 100644 index 0000000000..a219641438 --- /dev/null +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_appcpu_defconfig @@ -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 diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_procpu.dts b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_procpu.dts new file mode 100644 index 0000000000..346c522142 --- /dev/null +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_procpu.dts @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2024 Joel Guittet + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "esp32s3_touch_lcd_1_28-pinctrl.dtsi" +#include +#include +#include + +/ { + 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 = ; + }; + }; + + /* 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 = ; +}; + +&cpu1 { + clock-frequency = ; +}; + +&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 = ; + 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 = ; + 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"; +}; diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_procpu.yaml b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_procpu.yaml new file mode 100644 index 0000000000..5c81ff792a --- /dev/null +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_procpu.yaml @@ -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 diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_procpu_defconfig b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_procpu_defconfig new file mode 100644 index 0000000000..50c7db4746 --- /dev/null +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_procpu_defconfig @@ -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 diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/support/openocd.cfg b/boards/waveshare/esp32s3_touch_lcd_1_28/support/openocd.cfg new file mode 100644 index 0000000000..625341a5aa --- /dev/null +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/support/openocd.cfg @@ -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]