Skip to content

Commit cd3c660

Browse files
aisunekokartben
andcommitted
boards: lilygo: t_oi_plus: initial support
initial support for the Lilygo TTGO T-OI-PLUS ESP32-C3 board Signed-off-by: aisuneko icecat <iceneko@protonmail.ch> Co-authored-by: Benjamin Cabé <kartben@gmail.com>
1 parent c2f024e commit cd3c660

File tree

12 files changed

+416
-0
lines changed

12 files changed

+416
-0
lines changed

boards/lilygo/ttgo_toiplus/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config HEAP_MEM_POOL_ADD_SIZE_BOARD
5+
int
6+
default 4096
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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright 2025 aisuneko icecat <iceneko@protonmail.ch>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_TTGO_TOIPLUS
5+
select SOC_ESP32C3_FN4
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_toiplus/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_toiplus
3+
full_name: TTGO T-OI-PLUS
4+
vendor: lilygo
5+
socs:
6+
- name: esp32c3
Binary file not shown.
Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
.. zephyr:board:: ttgo_toiplus
2+
3+
Overview
4+
********
5+
6+
Lilygo TTGO T-OI-PLUS is an mini IoT development board based on
7+
Espressif's ESP32-C3 WiFi/Bluetooth dual-mode chip.
8+
9+
It features the following integrated components:
10+
11+
- ESP32-C3 SoC (RISC-V 160MHz single core, 400KB SRAM, Wi-Fi, Bluetooth)
12+
- on board Grove connector
13+
- USB-C connector for power and communication (on board serial)
14+
- optional 18340 Li-ion battery holder
15+
- LED
16+
17+
Functional Description
18+
**********************
19+
This board is based on the ESP32-C3 with 4MB of flash, WiFi and BLE support. It
20+
has an USB-C port for programming and debugging, integrated battery charging
21+
and an Grove connector.
22+
23+
Connections and IOs
24+
===================
25+
26+
.. zephyr:board-supported-hw::
27+
28+
(Note: the above UART interface also supports connecting through USB.)
29+
30+
Start Application Development
31+
*****************************
32+
33+
Before powering up your Lilygo TTGO T-OI-PLUS, please make sure that the board is in good
34+
condition with no obvious signs of damage.
35+
36+
System requirements
37+
*******************
38+
39+
Prerequisites
40+
=============
41+
42+
Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command
43+
below to retrieve those files.
44+
45+
.. code-block:: console
46+
47+
west blobs fetch hal_espressif
48+
49+
.. note::
50+
51+
It is recommended running the command above after :file:`west update`.
52+
53+
Building & Flashing
54+
*******************
55+
56+
Simple boot
57+
===========
58+
59+
The board could be loaded using the single binary image, without 2nd stage bootloader.
60+
It is the default option when building the application without additional configuration.
61+
62+
.. note::
63+
64+
Simple boot does not provide any security features nor OTA updates.
65+
66+
MCUboot bootloader
67+
==================
68+
69+
User may choose to use MCUboot bootloader instead. In that case the bootloader
70+
must be built (and flashed) at least once.
71+
72+
There are two options to be used when building an application:
73+
74+
1. Sysbuild
75+
2. Manual build
76+
77+
.. note::
78+
79+
User can select the MCUboot bootloader by adding the following line
80+
to the board default configuration file.
81+
82+
.. code:: cfg
83+
84+
CONFIG_BOOTLOADER_MCUBOOT=y
85+
86+
Sysbuild
87+
========
88+
89+
The sysbuild makes possible to build and flash all necessary images needed to
90+
bootstrap the board with the ESP32-C3 SoC.
91+
92+
To build the sample application using sysbuild use the command:
93+
94+
.. zephyr-app-commands::
95+
:tool: west
96+
:zephyr-app: samples/hello_world
97+
:board: ttgo_toiplus
98+
:goals: build
99+
:west-args: --sysbuild
100+
:compact:
101+
102+
By default, the ESP32-C3 sysbuild creates bootloader (MCUboot) and application
103+
images. But it can be configured to create other kind of images.
104+
105+
Build directory structure created by sysbuild is different from traditional
106+
Zephyr build. Output is structured by the domain subdirectories:
107+
108+
.. code-block::
109+
110+
build/
111+
├── hello_world
112+
│   └── zephyr
113+
│   ├── zephyr.elf
114+
│   └── zephyr.bin
115+
├── mcuboot
116+
│ └── zephyr
117+
│ ├── zephyr.elf
118+
│ └── zephyr.bin
119+
└── domains.yaml
120+
121+
.. note::
122+
123+
With ``--sysbuild`` option the bootloader will be re-build and re-flash
124+
every time the pristine build is used.
125+
126+
For more information about the system build please read the :ref:`sysbuild` documentation.
127+
128+
Manual build
129+
============
130+
131+
During the development cycle, it is intended to build & flash as quickly possible.
132+
For that reason, images can be built one at a time using traditional build.
133+
134+
The instructions following are relevant for both manual build and sysbuild.
135+
The only difference is the structure of the build directory.
136+
137+
.. note::
138+
139+
Remember that bootloader (MCUboot) needs to be flash at least once.
140+
141+
Build and flash applications as usual (see :ref:`build_an_application` and
142+
:ref:`application_run` for more details).
143+
144+
.. zephyr-app-commands::
145+
:zephyr-app: samples/hello_world
146+
:board: ttgo_toiplus
147+
:goals: build
148+
149+
The usual ``flash`` target will work with the ``ttgo_toiplus`` board target.
150+
Here is an example for the :zephyr:code-sample:`hello_world` application.
151+
152+
.. zephyr-app-commands::
153+
:zephyr-app: samples/hello_world
154+
:board: ttgo_toiplus
155+
:goals: flash
156+
157+
You can also open the serial monitor using the following command:
158+
159+
.. code-block:: shell
160+
161+
west espressif monitor
162+
163+
After the board has automatically reset and booted, you should see the following
164+
message in the monitor:
165+
166+
.. code-block:: console
167+
168+
***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx *****
169+
Hello World! ttgo_toiplus
170+
171+
Sample applications
172+
===================
173+
174+
The following samples will run out of the box on the TTGO T-OI-PLUS board.
175+
176+
To build the blinky sample:
177+
178+
.. zephyr-app-commands::
179+
:tool: west
180+
:zephyr-app: samples/basic/blinky
181+
:board: ttgo_toiplus
182+
:goals: build
183+
184+
To build the bluetooth beacon sample:
185+
186+
.. zephyr-app-commands::
187+
:tool: west
188+
:zephyr-app: samples/bluetooth/beacon
189+
:board: ttgo_toiplus
190+
:goals: build
191+
192+
193+
Related Documents
194+
*****************
195+
.. _`Lilygo TTGO T-OI-PLUS schematic`: https://github.com/Xinyuan-LilyGO/LilyGo-T-OI-PLUS/blob/main/schematic/T-OI_PLUS_Schematic.pdf
196+
.. _`Lilygo github repo`: https://github.com/Xinyuan-LilyGO
197+
.. _`Espressif ESP32-C3 datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf
198+
.. _`Espressif ESP32-C3 technical reference manual`: https://www.espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf
199+
.. _`OpenOCD ESP32`: https://github.com/espressif/openocd-esp32/releases
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
set ESP_RTOS none
2+
3+
source [find interface/esp_usb_jtag.cfg]
4+
5+
source [find target/esp32c3.cfg]
6+
adapter_khz 5000
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright 2024 Lothar Felten <lothar.felten@gmail.com>
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/esp32c3-pinctrl.h>
9+
#include <zephyr/dt-bindings/pinctrl/esp32c3-gpio-sigmap.h>
10+
11+
&pinctrl {
12+
uart0_default: uart0_default {
13+
group1 {
14+
pinmux = <UART0_TX_GPIO21>;
15+
output-high;
16+
};
17+
18+
group2 {
19+
pinmux = <UART0_RX_GPIO20>;
20+
bias-pull-up;
21+
};
22+
};
23+
24+
spim2_default: spim2_default {
25+
group1 {
26+
pinmux = <SPIM2_MISO_GPIO5>,
27+
<SPIM2_SCLK_GPIO4>;
28+
};
29+
30+
/* GPIO6 is CS */
31+
32+
group2 {
33+
pinmux = <SPIM2_MOSI_GPIO7>;
34+
output-low;
35+
};
36+
};
37+
38+
i2c0_default: i2c0_default {
39+
group1 {
40+
pinmux = <I2C0_SDA_GPIO2>,
41+
<I2C0_SCL_GPIO8>;
42+
bias-pull-up;
43+
drive-open-drain;
44+
output-high;
45+
};
46+
};
47+
48+
twai_default: twai_default {
49+
group1 {
50+
pinmux = <TWAI_TX_GPIO0>,
51+
<TWAI_RX_GPIO10>;
52+
};
53+
};
54+
};

0 commit comments

Comments
 (0)