Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boards: lilygo: tdongle_s3: initial support #86163

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions boards/lilygo/tdongle_s3/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright (c) 2025 Stefan Golinschi <[email protected]>
# SPDX-License-Identifier: Apache-2.0

config HEAP_MEM_POOL_ADD_SIZE_BOARD
int
default 4096 if BOARD_TDONGLE_S3_ESP32S3_PROCPU
default 256 if BOARD_TDONGLE_S3_ESP32S3_APPCPU
10 changes: 10 additions & 0 deletions boards/lilygo/tdongle_s3/Kconfig.sysbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright(c) 2025 Stefan Golinschi < stefan.golinschi @gmail.com>
# SPDX - License - Identifier : Apache - 2.0

choice BOOTLOADER
default BOOTLOADER_MCUBOOT
endchoice

choice BOOT_SIGNATURE_TYPE
default BOOT_SIGNATURE_TYPE_NONE
endchoice
7 changes: 7 additions & 0 deletions boards/lilygo/tdongle_s3/Kconfig.tdongle_s3
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright (c) 2025 Stefan Golinschi <[email protected]>
# SPDX-License-Identifier: Apache-2.0

config BOARD_TDONGLE_S3
select SOC_ESP32S3_WROOM_N16R8
select SOC_ESP32S3_PROCPU if BOARD_TDONGLE_S3_ESP32S3_PROCPU
select SOC_ESP32S3_APPCPU if BOARD_TDONGLE_S3_ESP32S3_APPCPU
10 changes: 10 additions & 0 deletions boards/lilygo/tdongle_s3/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright(c) 2025 Stefan Golinschi < stefan.golinschi @gmail.com>
# 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)
6 changes: 6 additions & 0 deletions boards/lilygo/tdongle_s3/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
board:
name: tdongle_s3
full_name: Lilygo T-Dongle S3
vendor: lilygo
socs:
- name: esp32s3
Binary file added boards/lilygo/tdongle_s3/doc/img/tdongle_s3.webp
Binary file not shown.
233 changes: 233 additions & 0 deletions boards/lilygo/tdongle_s3/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
.. zephyr:board:: tdongle_s3

Overview
********

Lilygo T-Dongle S3 is an IoT mini development board based on the
Espressif ESP32-S3 WiFi/Bluetooth dual-mode chip.

It features the following integrated components:

- ESP32-S3 chip (240MHz dual core, Bluetooth 5, WiFi)
- On-board antenna and IPEX connector
- USB-A connector with integrated TF Card slot
- MX 1.25mm 2-pin battery connector
- APA102 RGB LED
- JST SH 1.0mm 4-pin UART connector
- Transparent plastic case

Functional Description
**********************
This board is based on the ESP32-S3 with 16MB of flash, WiFi and BLE support. It
has an USB-A port for programming and debugging, integrated battery charging
and an on-board antenna. The fitted U.FL external antenna connector can be
enabled by moving a 0-ohm resistor.

Connections and IOs
===================

The ``tdongle_s3`` board target 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, sdmmc |
+------------+------------+-------------------------------------+
| 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 |
+------------+------------+-------------------------------------+
| DISPLAY | on-chip | display |
+------------+------------+-------------------------------------+

Start Application Development
*****************************

Before powering up your Lilygo T-Dongle T8-S3, please make sure that the board is in good
condition with no obvious signs of damage.

System requirements
*******************

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 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-block:: 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::
:tool: west
:zephyr-app: samples/hello_world
:board: tdongle_s3/esp32s3/procpu
: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 (see :ref:`build_an_application` and
:ref:`application_run` for more details).

.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: tdongle_s3/esp32s3/procpu
:goals: build

The usual ``flash`` target will work with the ``tdongle_s3`` board target
configuration. Here is an example for the :zephyr:code-sample:`hello_world`
application.

.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: tdongle_s3/esp32s3/procpu
:goals: flash

The default baud rate for the Lilygo T-Dongle S3 is set to 1500000bps. If experiencing issues when flashing,
try using different values by using ``--esp-baud-rate <BAUD>`` option during
``west flash`` (e.g. ``west flash --esp-baud-rate 115200``).

You can also 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! tdongle_s3

Code samples
============

The following code samples will run out of the box on the T-Dongle S3 board:

* :zephyr:code-sample:`wifi-shell`
* :zephyr:code-sample:`hello-world`
* :zephyr:code-sample:`display`


References
**********

.. target-notes::

.. _`Lilygo T-Dongle S3 schematic`: https://github.com/Xinyuan-LilyGO/T-Dongle-S3/blob/main/shcematic/T-Dongle-S3.pdf
.. _`Lilygo github repo`: https://github.com/Xinyuan-LilyGO/T-Dongle-S3.git
.. _`ESP32-S3 Datasheet`: https://github.com/Xinyuan-LilyGO/T-Dongle-S3/blob/main/doc/esp32-s3_datasheet_en.pdf
.. _`ESP32-S3 Technical Reference Manual`: https://github.com/Xinyuan-LilyGO/T-Dongle-S3/blob/main/doc/esp32-s3_technical_reference_manual_en.pdf
.. _`OpenOCD ESP32`: https://github.com/espressif/openocd-esp32/releases
.. _`JTAG debugging for ESP32-S3`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/jtag-debugging/
7 changes: 7 additions & 0 deletions boards/lilygo/tdongle_s3/support/openocd.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set ESP_RTOS none
set ESP32_ONLYCPU 1

source [find interface/esp_usb_jtag.cfg]

source [find target/esp32s3.cfg]
adapter_khz 5000
51 changes: 51 additions & 0 deletions boards/lilygo/tdongle_s3/tdongle_s3-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright 2025 Stefan Golinschi <[email protected]>
*
* 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;
};
};

spim2_default: spim2_default {
group1 {
pinmux = <SPIM2_SCLK_GPIO5>,
<SPIM2_CSEL_GPIO4>,
<SPIM2_MOSI_GPIO3>;

};
};

spim3_default: spim3_default {
group1 {
pinmux = <SPIM3_SCLK_GPIO39>,
<SPIM3_MOSI_GPIO40>;
};
};

sdhc0_default: sdhc0_default {
group1 {
pinmux = <SDHC0_CLKOUT_GPIO12>,
<SDHC0_CMD_GPIO16>,
<SDHC0_DATA0_GPIO14>,
<SDHC0_DATA1_GPIO17>,
<SDHC0_DATA2_GPIO21>,
<SDHC0_DATA3_GPIO18>;
bias-pull-up;
output-high;
};
};
};
31 changes: 31 additions & 0 deletions boards/lilygo/tdongle_s3/tdongle_s3_appcpu.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2025 Stefan Golinschi <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;

#include <espressif/esp32s3/esp32s3_wroom_n16r8.dtsi>
#include <espressif/partitions_0x0_amp.dtsi>

/ {
model = "TDONGLE S3 APPCPU";
compatible = "espressif,esp32s3";

chosen {
zephyr,sram = &sram0;
zephyr,ipc_shm = &shm0;
zephyr,ipc = &ipm0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_appcpu_partition;
};
};

&trng0 {
status = "okay";
};

&ipm0 {
status = "okay";
};
4 changes: 4 additions & 0 deletions boards/lilygo/tdongle_s3/tdongle_s3_appcpu_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright(c) 2025 Stefan Golinschi < stefan.golinschi @gmail.com>
# SPDX - License - Identifier : Apache - 2.0

CONFIG_CLOCK_CONTROL=y
Loading
Loading