1.. _esp32s3_luatos_core:
2
3ESP32S3-Luatos-Core
4###################
5
6Overview
7********
8
9The ESP32S3-Luatos-Core development board is a compact board based on Espressif ESP32-S3.
10The board comes equipped with a 2.4GHz antenna and supports both Wi-Fi and Bluetooth functionalities.
11For more information, check `ESP32S3-Luatos-Core`_ (chinese)
12
13.. image:: img/esp32s3_luatos_core.jpg
14     :align: center
15     :alt: esp32s3_luatos_core
16
17Hardware
18********
19
20ESP32-S3 is a low-power MCU-based system on a chip (SoC) with integrated 2.4 GHz Wi-Fi
21and Bluetooth® Low Energy (Bluetooth LE). It consists of high-performance dual-core microprocessor
22(Xtensa® 32-bit LX7), a low power coprocessor, a Wi-Fi baseband, a Bluetooth LE baseband,
23RF module, and numerous peripherals.
24
25ESP32S3-Luatos-Core includes the following features:
26
27- Dual core 32-bit Xtensa Microprocessor (Tensilica LX7), running up to 240MHz
28- Additional vector instructions support for AI acceleration
29- 512KB of SRAM
30- 384KB of ROM
31- 8MB of PSRAM
32- 16MB of FLASH
33- Wi-Fi 802.11b/g/n
34- Bluetooth LE 5.0 with long-range support and up to 2Mbps data rate
35
36Digital interfaces:
37
38- 4x SPI
39- 1x LCD interface (8-bit ~16-bit parallel RGB, I8080 and MOTO6800), supporting conversion between RGB565, YUV422, YUV420 and YUV411
40- 1x DVP 8-bit ~16-bit camera interface
41- 3x UART
42- 2x I2C
43- 2x I2S
44- 1x RMT (TX/RX)
45- 1x pulse counter
46- LED PWM controller, up to 8 channels
47- 1x USB Port with USB switcher, supporting following modes:
48  - 1x full-speed USB OTG or 1x USB Serial/JTAG controller
49  - USB to serial chip CH343
50- 2x MCPWM
51- 1x SDIO host controller with 2 slots
52- General DMA controller (GDMA), with 5 transmit channels and 5 receive channels
53- 1x TWAI® controller, compatible with ISO 11898-1 (CAN Specification 2.0)
54- 2x Blue LED
55
56Analog interfaces:
57
58- 2x 12-bit SAR ADCs, up to 20 channels
59
60Timers:
61
62- 4x 54-bit general-purpose timers
63- 1x 52-bit system timer
64- 3x watchdog timers
65
66Low Power:
67
68- Power Management Unit with five power modes
69- Ultra-Low-Power (ULP) coprocessors: ULP-RISC-V and ULP-FSM
70
71Security:
72
73- Secure boot
74- Flash encryption
75- 4-Kbit OTP, up to 1792 bits for users
76- Cryptographic hardware acceleration: (AES-128/256, Hash, RSA, RNG, HMAC, Digital signature)
77
78For more information, check the datasheet at `ESP32-S3 Datasheet`_ or the technical reference
79manual at `ESP32-S3 Technical Reference Manual`_.
80
81.. image:: img/esp32s3_luatos_core_pinout.jpg
82     :align: center
83     :alt: esp32s3_luatos_core_pinout
84
85Supported Features
86==================
87
88Current Zephyr's ESP32S3-Luatos-Core board supports the following features:
89
90+------------+------------+-------------------------------------+
91| Interface  | Controller | Driver/Component                    |
92+============+============+=====================================+
93| UART       | on-chip    | serial port                         |
94+------------+------------+-------------------------------------+
95| GPIO       | on-chip    | gpio                                |
96+------------+------------+-------------------------------------+
97| PINMUX     | on-chip    | pinmux                              |
98+------------+------------+-------------------------------------+
99| USB-JTAG   | on-chip    | hardware interface                  |
100+------------+------------+-------------------------------------+
101| SPI Master | on-chip    | spi                                 |
102+------------+------------+-------------------------------------+
103| TWAI/CAN   | on-chip    | can                                 |
104+------------+------------+-------------------------------------+
105| Timers     | on-chip    | counter                             |
106+------------+------------+-------------------------------------+
107| Watchdog   | on-chip    | watchdog                            |
108+------------+------------+-------------------------------------+
109| TRNG       | on-chip    | entropy                             |
110+------------+------------+-------------------------------------+
111| LEDC       | on-chip    | pwm                                 |
112+------------+------------+-------------------------------------+
113| MCPWM      | on-chip    | pwm                                 |
114+------------+------------+-------------------------------------+
115| PCNT       | on-chip    | qdec                                |
116+------------+------------+-------------------------------------+
117| GDMA       | on-chip    | dma                                 |
118+------------+------------+-------------------------------------+
119| USB-CDC    | on-chip    | serial                              |
120+------------+------------+-------------------------------------+
121
122Prerequisites
123-------------
124
125Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command
126below to retrieve those files.
127
128.. code-block:: console
129
130   west blobs fetch hal_espressif
131
132.. note::
133
134   It is recommended running the command above after :file:`west update`.
135
136Building & Flashing
137*******************
138
139Simple boot
140===========
141
142The board could be loaded using the single binary image, without 2nd stage bootloader.
143It is the default option when building the application without additional configuration.
144
145.. note::
146
147   Simple boot does not provide any security features nor OTA updates.
148
149MCUboot bootloader
150==================
151
152User may choose to use MCUboot bootloader instead. In that case the bootloader
153must be built (and flashed) at least once.
154
155There are two options to be used when building an application:
156
1571. Sysbuild
1582. Manual build
159
160.. note::
161
162   User can select the MCUboot bootloader by adding the following line
163   to the board default configuration file.
164
165   .. code:: cfg
166
167      CONFIG_BOOTLOADER_MCUBOOT=y
168
169Sysbuild
170========
171
172The sysbuild makes possible to build and flash all necessary images needed to
173bootstrap the board with the ESP32 SoC.
174
175To build the sample application using sysbuild use the command:
176
177.. zephyr-app-commands::
178   :tool: west
179   :zephyr-app: samples/hello_world
180   :board: esp32s3_luatos_core
181   :goals: build
182   :west-args: --sysbuild
183   :compact:
184
185By default, the ESP32 sysbuild creates bootloader (MCUboot) and application
186images. But it can be configured to create other kind of images.
187
188Build directory structure created by sysbuild is different from traditional
189Zephyr build. Output is structured by the domain subdirectories:
190
191.. code-block::
192
193  build/
194  ├── hello_world
195  │   └── zephyr
196  │       ├── zephyr.elf
197  │       └── zephyr.bin
198  ├── mcuboot
199  │    └── zephyr
200  │       ├── zephyr.elf
201  │       └── zephyr.bin
202  └── domains.yaml
203
204.. note::
205
206   With ``--sysbuild`` option the bootloader will be re-build and re-flash
207   every time the pristine build is used.
208
209For more information about the system build please read the :ref:`sysbuild` documentation.
210
211Manual build
212============
213
214During the development cycle, it is intended to build & flash as quickly possible.
215For that reason, images can be built one at a time using traditional build.
216
217The instructions following are relevant for both manual build and sysbuild.
218The only difference is the structure of the build directory.
219
220.. note::
221
222   Remember that bootloader (MCUboot) needs to be flash at least once.
223
224Build and flash applications as usual (see :ref:`build_an_application` and
225:ref:`application_run` for more details).
226
227.. zephyr-app-commands::
228   :zephyr-app: samples/hello_world
229   :board: esp32s3_luatos_core/esp32s3/procpu
230   :goals: build
231
232If CH343 chip is disabled, You need use the following command to build:
233
234.. zephyr-app-commands::
235   :zephyr-app: samples/hello_world
236   :board: esp32s3_luatos_core/esp32s3/procpu/usb
237   :goals: build
238
239The usual ``flash`` target will work with the ``esp32s3_luatos_core`` board
240configuration. Here is an example for the :zephyr:code-sample:`hello_world`
241application.
242
243.. zephyr-app-commands::
244   :zephyr-app: samples/hello_world
245   :board: esp32s3_luatos_core/esp32s3/procpu
246   :goals: flash
247
248Open the serial monitor using the following command:
249
250.. code-block:: shell
251
252   west espressif monitor
253
254After the board has automatically reset and booted, you should see the following
255message in the monitor:
256
257.. code-block:: console
258
259   ***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx *****
260   Hello World! esp32s3_luatos_core
261
262Debugging
263*********
264
265ESP32-S3 support on OpenOCD is available at `OpenOCD ESP32`_.
266
267ESP32-S3 has a built-in JTAG circuitry and can be debugged without any additional chip. Only an USB cable connected to the D+/D- pins is necessary.
268
269Further documentation can be obtained from the SoC vendor in `JTAG debugging for ESP32-S3`_.
270
271Here is an example for building the :zephyr:code-sample:`hello_world` application.
272
273.. zephyr-app-commands::
274   :zephyr-app: samples/hello_world
275   :board: esp32s3_luatos_core/esp32s3/procpu
276   :goals: build flash
277
278You can debug an application in the usual way. Here is an example for the :zephyr:code-sample:`hello_world` application.
279
280.. zephyr-app-commands::
281   :zephyr-app: samples/hello_world
282   :board: esp32s3_luatos_core/esp32s3/procpu
283   :goals: debug
284
285
286References
287**********
288
289.. target-notes::
290
291.. _`ESP32S3-Luatos-Core`: https://wiki.luatos.com/chips/esp32s3/board.html
292.. _`ESP32-S3 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-s3-mini-1_mini-1u_datasheet_en.pdf
293.. _`ESP32-S3 Technical Reference Manual`: https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf
294.. _`JTAG debugging for ESP32-S3`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/jtag-debugging/
295.. _`OpenOCD ESP32`: https://github.com/espressif/openocd-esp32/releases
296