Skip to content

Commit f982d18

Browse files
lfeltenkartben
authored andcommitted
boards: lilygo: ttgo_t8s3: initial support
adds initial support for Lilygo TTGO T8-S3 board Signed-off-by: Lothar Felten <[email protected]>
1 parent 4875f29 commit f982d18

15 files changed

+578
-0
lines changed

boards/lilygo/ttgo_t8s3/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright (c) 2024 Lothar Felten <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config HEAP_MEM_POOL_ADD_SIZE_BOARD
5+
int
6+
default 4096 if BOARD_TTGO_T8S3_ESP32S3_PROCPU
7+
default 256 if BOARD_TTGO_T8S3_ESP32S3_APPCPU
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd.
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 2024 Lothar Felten <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_TTGO_T8S3
5+
select SOC_ESP32S3_WROOM_N16R8
6+
select SOC_ESP32S3_PROCPU if BOARD_TTGO_T8S3_ESP32S3_PROCPU
7+
select SOC_ESP32S3_APPCPU if BOARD_TTGO_T8S3_ESP32S3_APPCPU

boards/lilygo/ttgo_t8s3/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/ttgo_t8s3/board.yml

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

boards/lilygo/ttgo_t8s3/doc/index.rst

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
.. zephyr:board:: ttgo_t8s3
2+
3+
Overview
4+
********
5+
6+
Lilygo TTGO T8-S3 is an IoT mini development board based on the
7+
Espressif ESP32-S3 WiFi/Bluetooth dual-mode chip.
8+
9+
It features the following integrated components:
10+
11+
- ESP32-S3 chip (240MHz dual core, Bluetooth LE, Wi-Fi)
12+
- on board antenna and IPEX connector
13+
- USB-C connector for power and communication
14+
- MX 1.25mm 2-pin battery connector
15+
- JST SH 1.0mm 4-pin UART connector
16+
- SD card slot
17+
18+
Functional Description
19+
**********************
20+
This board is based on the ESP32-S3 with 16MB of flash, WiFi and BLE support. It
21+
has an USB-C port for programming and debugging, integrated battery charging
22+
and an on-board antenna. The fitted U.FL external antenna connector can be
23+
enabled by moving a 0-ohm resistor.
24+
25+
Connections and IOs
26+
===================
27+
28+
The ``ttgo_t8s3`` board target supports the following hardware features:
29+
30+
+------------+------------+-------------------------------------+
31+
| Interface | Controller | Driver/Component |
32+
+============+============+=====================================+
33+
| UART | on-chip | serial port |
34+
+------------+------------+-------------------------------------+
35+
| GPIO | on-chip | gpio |
36+
+------------+------------+-------------------------------------+
37+
| PINMUX | on-chip | pinmux |
38+
+------------+------------+-------------------------------------+
39+
| USB-JTAG | on-chip | hardware interface |
40+
+------------+------------+-------------------------------------+
41+
| SPI Master | on-chip | spi, sdmmc |
42+
+------------+------------+-------------------------------------+
43+
| TWAI/CAN | on-chip | can |
44+
+------------+------------+-------------------------------------+
45+
| ADC | on-chip | adc |
46+
+------------+------------+-------------------------------------+
47+
| Timers | on-chip | counter |
48+
+------------+------------+-------------------------------------+
49+
| Watchdog | on-chip | watchdog |
50+
+------------+------------+-------------------------------------+
51+
| TRNG | on-chip | entropy |
52+
+------------+------------+-------------------------------------+
53+
| LEDC | on-chip | pwm |
54+
+------------+------------+-------------------------------------+
55+
| MCPWM | on-chip | pwm |
56+
+------------+------------+-------------------------------------+
57+
| PCNT | on-chip | qdec |
58+
+------------+------------+-------------------------------------+
59+
| GDMA | on-chip | dma |
60+
+------------+------------+-------------------------------------+
61+
| USB-CDC | on-chip | serial |
62+
+------------+------------+-------------------------------------+
63+
64+
Start Application Development
65+
*****************************
66+
67+
Before powering up your Lilygo TTGO T8-S3, please make sure that the board is in good
68+
condition with no obvious signs of damage.
69+
70+
System requirements
71+
*******************
72+
73+
Prerequisites
74+
=============
75+
76+
Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command
77+
below to retrieve those files.
78+
79+
.. code-block:: console
80+
81+
west blobs fetch hal_espressif
82+
83+
.. note::
84+
85+
It is recommended running the command above after :file:`west update`.
86+
87+
Building & Flashing
88+
*******************
89+
90+
Simple boot
91+
===========
92+
93+
The board could be loaded using the single binary image, without 2nd stage bootloader.
94+
It is the default option when building the application without additional configuration.
95+
96+
.. note::
97+
98+
Simple boot does not provide any security features nor OTA updates.
99+
100+
MCUboot bootloader
101+
==================
102+
103+
User may choose to use MCUboot bootloader instead. In that case the bootloader
104+
must be built (and flashed) at least once.
105+
106+
There are two options to be used when building an application:
107+
108+
1. Sysbuild
109+
2. Manual build
110+
111+
.. note::
112+
113+
User can select the MCUboot bootloader by adding the following line
114+
to the board default configuration file.
115+
116+
.. code-block:: cfg
117+
118+
CONFIG_BOOTLOADER_MCUBOOT=y
119+
120+
Sysbuild
121+
========
122+
123+
The sysbuild makes possible to build and flash all necessary images needed to
124+
bootstrap the board with the ESP32 SoC.
125+
126+
To build the sample application using sysbuild use the command:
127+
128+
.. zephyr-app-commands::
129+
:tool: west
130+
:zephyr-app: samples/hello_world
131+
:board: ttgo_t8s3/esp32s3/procpu
132+
:goals: build
133+
:west-args: --sysbuild
134+
:compact:
135+
136+
By default, the ESP32 sysbuild creates bootloader (MCUboot) and application
137+
images. But it can be configured to create other kind of images.
138+
139+
Build directory structure created by sysbuild is different from traditional
140+
Zephyr build. Output is structured by the domain subdirectories:
141+
142+
.. code-block::
143+
144+
build/
145+
├── hello_world
146+
│   └── zephyr
147+
│   ├── zephyr.elf
148+
│   └── zephyr.bin
149+
├── mcuboot
150+
│ └── zephyr
151+
│ ├── zephyr.elf
152+
│ └── zephyr.bin
153+
└── domains.yaml
154+
155+
.. note::
156+
157+
With ``--sysbuild`` option the bootloader will be re-build and re-flash
158+
every time the pristine build is used.
159+
160+
For more information about the system build please read the :ref:`sysbuild` documentation.
161+
162+
Manual build
163+
============
164+
165+
During the development cycle, it is intended to build & flash as quickly possible.
166+
For that reason, images can be built one at a time using traditional build.
167+
168+
The instructions following are relevant for both manual build and sysbuild.
169+
The only difference is the structure of the build directory.
170+
171+
.. note::
172+
173+
Remember that bootloader (MCUboot) needs to be flash at least once.
174+
175+
Build and flash applications as usual (see :ref:`build_an_application` and
176+
:ref:`application_run` for more details).
177+
178+
.. zephyr-app-commands::
179+
:zephyr-app: samples/hello_world
180+
:board: ttgo_t8s3/esp32s3/procpu
181+
:goals: build
182+
183+
The usual ``flash`` target will work with the ``ttgo_t8s3`` board target
184+
configuration. Here is an example for the :zephyr:code-sample:`hello_world`
185+
application.
186+
187+
.. zephyr-app-commands::
188+
:zephyr-app: samples/hello_world
189+
:board: ttgo_t8s3/esp32s3/procpu
190+
:goals: flash
191+
192+
The default baud rate for the Lilygo TTGO T8-S3 is set to 1500000bps. If experiencing issues when flashing,
193+
try using different values by using ``--esp-baud-rate <BAUD>`` option during
194+
``west flash`` (e.g. ``west flash --esp-baud-rate 115200``).
195+
196+
You can also open the serial monitor using the following command:
197+
198+
.. code-block:: shell
199+
200+
west espressif monitor
201+
202+
After the board has automatically reset and booted, you should see the following
203+
message in the monitor:
204+
205+
.. code-block:: console
206+
207+
***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx *****
208+
Hello World! ttgo_t8s3
209+
210+
Code samples
211+
============
212+
213+
The following code samples will run out of the box on the TTGO T8-S3 board:
214+
215+
* :zephyr:code-sample:`wifi-shell`
216+
* :zephyr:code-sample:`fs`
217+
218+
219+
References
220+
**********
221+
222+
.. target-notes::
223+
224+
.. _`Lilygo TTGO T8-S3 schematic`: https://github.com/Xinyuan-LilyGO/T8-S3/blob/main/schematic/T8_S3_V1.0.pdf
225+
.. _`Lilygo github repo`: https://github.com/Xinyuan-LilyGo
226+
.. _`ESP32-S3 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-s3-mini-1_mini-1u_datasheet_en.pdf
227+
.. _`ESP32-S3 Technical Reference Manual`: https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf
228+
.. _`OpenOCD ESP32`: https://github.com/espressif/openocd-esp32/releases
229+
.. _`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: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Copyright (c) 2024 Lothar Felten <[email protected]>
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+
uart0_default: uart0_default {
13+
group1 {
14+
pinmux = <UART0_TX_GPIO43>;
15+
output-high;
16+
};
17+
group2 {
18+
pinmux = <UART0_RX_GPIO44>;
19+
bias-pull-up;
20+
};
21+
};
22+
23+
i2c0_default: i2c0_default {
24+
group1 {
25+
pinmux = <I2C0_SDA_GPIO1>,
26+
<I2C0_SCL_GPIO2>;
27+
bias-pull-up;
28+
drive-open-drain;
29+
output-high;
30+
};
31+
};
32+
33+
spim2_default: spim2_default {
34+
group1 {
35+
pinmux = <SPIM2_MISO_GPIO13>,
36+
<SPIM2_SCLK_GPIO12>,
37+
<SPIM2_CSEL_GPIO10>;
38+
};
39+
group2 {
40+
pinmux = <SPIM2_MOSI_GPIO11>;
41+
output-low;
42+
};
43+
};
44+
45+
spim3_default: spim3_default {
46+
group1 {
47+
pinmux = <SPIM3_MISO_GPIO37>,
48+
<SPIM3_SCLK_GPIO36>,
49+
<SPIM3_CSEL_GPIO38>;
50+
};
51+
group2 {
52+
pinmux = <SPIM3_MOSI_GPIO39>;
53+
output-low;
54+
};
55+
};
56+
57+
twai_default: twai_default {
58+
group1 {
59+
pinmux = <TWAI_TX_GPIO5>,
60+
<TWAI_RX_GPIO6>;
61+
};
62+
};
63+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
/dts-v1/;
7+
8+
#include <espressif/esp32s3/esp32s3_wroom_n16r8.dtsi>
9+
#include <espressif/partitions_0x0_amp.dtsi>
10+
11+
/ {
12+
model = "TTGO T8S3 APPCPU";
13+
compatible = "espressif,esp32s3";
14+
15+
chosen {
16+
zephyr,sram = &sram0;
17+
zephyr,ipc_shm = &shm0;
18+
zephyr,ipc = &ipm0;
19+
zephyr,flash = &flash0;
20+
zephyr,code-partition = &slot0_appcpu_partition;
21+
};
22+
};
23+
24+
&trng0 {
25+
status = "okay";
26+
};
27+
28+
&ipm0 {
29+
status = "okay";
30+
};

0 commit comments

Comments
 (0)