Skip to content

Commit 5309e11

Browse files
valeriosettikartben
authored andcommitted
boards: lilygo: add initial support for T-Watch S3
Most of the functionalities of the board are already supported in this commit and they can easily be tested thought various Zephyr's samples and tests. What's still missing are: - LoRA radio - audio amplifier - microphone but these will be added in follow-up commits. Signed-off-by: Valerio Setti <vsetti@baylibre.com>
1 parent 651d6a3 commit 5309e11

16 files changed

+670
-0
lines changed

boards/lilygo/twatch_s3/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright (c) 2025 BayLibre SAS
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config HEAP_MEM_POOL_ADD_SIZE_BOARD
5+
int
6+
default 4096 if BOARD_TWATCH_S3_ESP32S3_PROCPU
7+
default 256 if BOARD_TWATCH_S3_ESP32S3_APPCPU
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2025 BayLibre SAS
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if DISPLAY
5+
6+
choice ST7789V_PIXEL_FORMAT
7+
default ST7789V_BGR565
8+
endchoice
9+
10+
if LVGL
11+
12+
config LV_COLOR_16_SWAP
13+
default y
14+
15+
endif # LVGL
16+
17+
endif # DISPLAY
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2025 BayLibre SAS
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
choice BOOTLOADER
5+
default BOOTLOADER_MCUBOOT
6+
endchoice
7+
8+
choice BOOT_SIGNATURE_TYPE
9+
default BOOT_SIGNATURE_TYPE_NONE
10+
endchoice
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright 2025 BayLibre SAS
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_TWATCH_S3
5+
select SOC_ESP32S3_WROOM_N16R8
6+
select SOC_ESP32S3_PROCPU if BOARD_TWATCH_S3_ESP32S3_PROCPU
7+
select SOC_ESP32S3_APPCPU if BOARD_TWATCH_S3_ESP32S3_APPCPU

boards/lilygo/twatch_s3/board.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
if(NOT "${OPENOCD}" MATCHES "^${ESPRESSIF_TOOLCHAIN_PATH}/.*")
4+
set(OPENOCD OPENOCD-NOTFOUND)
5+
endif()
6+
find_program(OPENOCD openocd PATHS ${ESPRESSIF_TOOLCHAIN_PATH}/openocd-esp32/bin NO_DEFAULT_PATH)
7+
8+
include(${ZEPHYR_BASE}/boards/common/esp32.board.cmake)
9+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

boards/lilygo/twatch_s3/board.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: twatch_s3
3+
full_name: T-Watch S3
4+
vendor: lilygo
5+
socs:
6+
- name: esp32s3
13.4 KB
Binary file not shown.

boards/lilygo/twatch_s3/doc/index.rst

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
.. zephyr:board:: twatch_s3
2+
3+
Overview
4+
********
5+
6+
LILYGO T-Watch S3 is an ESP32-S3 based smartwatch with the following features:
7+
8+
- ESP32-S3-R8 chip
9+
10+
- Dual core Xtensa LX-7 up to 240MHz
11+
- 8 MB of integrated PSRAM
12+
- Bluetooth LE v5.0
13+
- Wi-Fi 802.11 b/g/n
14+
15+
- 16 MB external QSPI flash (Winbond W25Q128JWPIQ)
16+
- Power Management Unit (X-Powers AXP2101) which provides
17+
18+
- Regulators (DC-DCs and LDOs)
19+
- Battery charging
20+
- Fuel gauge
21+
22+
- 470 mAh battery
23+
- RTC (NXP PCF8563)
24+
- Haptic (Texas Instruments DRV2605)
25+
- Accelerometer (Bosch BMA423)
26+
- 240x240 pixels LCD with touchscreen
27+
28+
- ST7789V LCD Controller
29+
- Focaltech FT5336 touch sensor
30+
31+
- Microphone (Knowles SPM1423HM4H-B)
32+
- LoRA radio (Semtech SX1262)
33+
- Audio amplifier (Maxim MAX98357A)
34+
35+
The board features a single micro USB connector which can be used for serial
36+
flashing, debugging and console thanks to the integrated JTAG support in the
37+
chip.
38+
39+
It does not have any GPIO that can easily be connected to something external.
40+
There is only 1 physical button which is connected to the PMU and it's used
41+
to turn on/off the device.
42+
43+
Supported Features
44+
==================
45+
46+
.. zephyr:board-supported-hw::
47+
48+
Building & Flashing
49+
*******************
50+
51+
Prerequisites
52+
=============
53+
54+
Espressif HAL requires WiFi and Bluetooth binary blobs in order to work. Run the command
55+
below to retrieve those files.
56+
57+
.. code-block:: console
58+
59+
west blobs fetch hal_espressif
60+
61+
.. note::
62+
63+
It is recommended running the command above after :file:`west update`.
64+
65+
Simple boot
66+
===========
67+
68+
The board could be loaded using a single binary image, without 2nd stage bootloader.
69+
It is the default option when building the application without additional configuration.
70+
71+
.. note::
72+
73+
Simple boot does not provide any security features nor OTA updates.
74+
75+
MCUboot bootloader
76+
==================
77+
78+
User may choose to use MCUboot bootloader instead. In that case the bootloader
79+
must be built (and flashed) at least once.
80+
81+
There are two options to be used when building an application:
82+
83+
1. Sysbuild
84+
2. Manual build
85+
86+
.. note::
87+
88+
User can select the MCUboot bootloader by adding the following line
89+
to the board default configuration file.
90+
91+
.. code-block:: cfg
92+
93+
CONFIG_BOOTLOADER_MCUBOOT=y
94+
95+
Sysbuild
96+
--------
97+
98+
The sysbuild makes it possible to build and flash all necessary images needed to
99+
bootstrap the board with the ESP32 SoC.
100+
101+
To build the sample application using sysbuild, use the command:
102+
103+
.. zephyr-app-commands::
104+
:tool: west
105+
:zephyr-app: samples/hello_world
106+
:board: twatch_s3/esp32s3/procpu
107+
:goals: build
108+
:west-args: --sysbuild
109+
:compact:
110+
111+
By default, the ESP32-S3 sysbuild creates bootloader (MCUboot) and application
112+
images. But it can be configured to create other kind of images.
113+
114+
Build directory structure created by sysbuild is different from traditional
115+
Zephyr build. Output is structured by the domain subdirectories:
116+
117+
.. code-block::
118+
119+
build/
120+
├── hello_world
121+
│   └── zephyr
122+
│   ├── zephyr.elf
123+
│   └── zephyr.bin
124+
├── mcuboot
125+
│ └── zephyr
126+
│ ├── zephyr.elf
127+
│ └── zephyr.bin
128+
└── domains.yaml
129+
130+
.. note::
131+
132+
With ``--sysbuild`` option the bootloader will be re-built and re-flashed
133+
every time the pristine build is used.
134+
135+
For more information about the system build please read the :ref:`sysbuild` documentation.
136+
137+
Manual build
138+
------------
139+
140+
During the development cycle, it is intended to build & flash as quickly as possible.
141+
For that reason, images can be built one at a time using traditional build.
142+
143+
The instructions following are relevant for both manual build and sysbuild.
144+
The only difference is the structure of the build directory.
145+
146+
.. note::
147+
148+
Remember that bootloader (MCUboot) needs to be flashed at least once.
149+
150+
Build and flash applications as usual (see :ref:`build_an_application` and
151+
:ref:`application_run` for more details).
152+
153+
.. zephyr-app-commands::
154+
:zephyr-app: samples/hello_world
155+
:board: twatch_s3/esp32s3/procpu
156+
:goals: build
157+
158+
The usual ``flash`` target will work with the ``twatch_s3`` board target
159+
configuration. Here is an example for the :zephyr:code-sample:`hello_world`
160+
application.
161+
162+
.. zephyr-app-commands::
163+
:zephyr-app: samples/hello_world
164+
:board: twatch_s3/esp32s3/procpu
165+
:goals: flash
166+
167+
The default baud rate is set to 1500000bps. If experiencing issues when flashing,
168+
try using different values by using ``--esp-baud-rate <BAUD>`` option during
169+
``west flash`` (e.g. ``west flash --esp-baud-rate 115200``).
170+
171+
You can also open the serial monitor using the following command:
172+
173+
.. code-block:: shell
174+
175+
west espressif monitor
176+
177+
After the board has automatically reset and booted, you should see the following
178+
message in the monitor:
179+
180+
.. code-block:: console
181+
182+
***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx *****
183+
Hello World! twatch_s3/esp32s3/procpu
184+
185+
References
186+
**********
187+
188+
.. target-notes::
189+
190+
.. _`Lilygo Twatch S3 schematic`: https://github.com/Xinyuan-LilyGO/TTGO_TWatch_Library/blob/t-watch-s3/schematic/T_WATCH_S3.pdf
191+
.. _`Lilygo T-Watch S3 repo`: https://github.com/Xinyuan-LilyGO/TTGO_TWatch_Library/tree/t-watch-s3
192+
.. _`Lilygo T-Watch Deps repo`: https://github.com/Xinyuan-LilyGO/T-Watch-Deps
193+
.. _`ESP32-S3 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf
194+
.. _`ESP32-S3 Technical Reference Manual`: https://www.espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf
195+
.. _`OpenOCD ESP32`: https://github.com/espressif/openocd-esp32/releases
196+
.. _`JTAG debugging for ESP32-S3`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/jtag-debugging/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
set ESP_RTOS none
2+
set ESP32_ONLYCPU 1
3+
4+
source [find interface/esp_usb_jtag.cfg]
5+
6+
source [find target/esp32s3.cfg]
7+
adapter_khz 5000
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (c) 2025 BayLibre SAS
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/dt-bindings/pinctrl/esp-pinctrl-common.h>
8+
#include <dt-bindings/pinctrl/esp32s3-pinctrl.h>
9+
#include <zephyr/dt-bindings/pinctrl/esp32s3-gpio-sigmap.h>
10+
11+
&pinctrl {
12+
i2c0_default: i2c0_default {
13+
group1 {
14+
pinmux = <I2C0_SCL_GPIO11>,
15+
<I2C0_SDA_GPIO10>;
16+
drive-open-drain;
17+
output-high;
18+
};
19+
};
20+
21+
i2c1_default: i2c1_default {
22+
group1 {
23+
pinmux = <I2C1_SCL_GPIO40>,
24+
<I2C1_SDA_GPIO39>;
25+
drive-open-drain;
26+
output-high;
27+
};
28+
};
29+
30+
spim3_default: spim3_default {
31+
group1 {
32+
pinmux = <SPIM3_SCLK_GPIO18>,
33+
<SPIM3_CSEL_GPIO12>;
34+
};
35+
36+
group2 {
37+
pinmux = <SPIM3_MOSI_GPIO13>;
38+
output-low;
39+
};
40+
};
41+
42+
ledc0_default: ledc0_default {
43+
group1 {
44+
pinmux = <LEDC_CH0_GPIO45>;
45+
output-enable;
46+
};
47+
};
48+
};

0 commit comments

Comments
 (0)