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`_.
79
80.. image:: img/esp32s3_luatos_core_pinout.jpg
81     :align: center
82     :alt: esp32s3_luatos_core_pinout
83
84Supported Features
85==================
86
87Current Zephyr's ESP32S3-LUATOS-Core board supports the following features:
88
89+------------+------------+-------------------------------------+
90| Interface  | Controller | Driver/Component                    |
91+============+============+=====================================+
92| UART       | on-chip    | serial port                         |
93+------------+------------+-------------------------------------+
94| GPIO       | on-chip    | gpio                                |
95+------------+------------+-------------------------------------+
96| PINMUX     | on-chip    | pinmux                              |
97+------------+------------+-------------------------------------+
98| USB-JTAG   | on-chip    | hardware interface                  |
99+------------+------------+-------------------------------------+
100| SPI Master | on-chip    | spi                                 |
101+------------+------------+-------------------------------------+
102| TWAI/CAN   | on-chip    | can                                 |
103+------------+------------+-------------------------------------+
104| Timers     | on-chip    | counter                             |
105+------------+------------+-------------------------------------+
106| Watchdog   | on-chip    | watchdog                            |
107+------------+------------+-------------------------------------+
108| TRNG       | on-chip    | entropy                             |
109+------------+------------+-------------------------------------+
110| LEDC       | on-chip    | pwm                                 |
111+------------+------------+-------------------------------------+
112| MCPWM      | on-chip    | pwm                                 |
113+------------+------------+-------------------------------------+
114| PCNT       | on-chip    | qdec                                |
115+------------+------------+-------------------------------------+
116| GDMA       | on-chip    | dma                                 |
117+------------+------------+-------------------------------------+
118| USB-CDC    | on-chip    | serial                              |
119+------------+------------+-------------------------------------+
120
121Prerequisites
122-------------
123
124Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command
125below to retrieve those files.
126
127.. code-block:: console
128
129   west blobs fetch hal_espressif
130
131.. note::
132
133   It is recommended running the command above after :file:`west update`.
134
135Building & Flashing
136*******************
137
138Simple boot
139===========
140
141The board could be loaded using the single binary image, without 2nd stage bootloader.
142It is the default option when building the application without additional configuration.
143
144.. note::
145
146   Simple boot does not provide any security features nor OTA updates.
147
148MCUboot bootloader
149==================
150
151User may choose to use MCUboot bootloader instead. In that case the bootloader
152must be build (and flash) at least once.
153
154There are two options to be used when building an application:
155
1561. Sysbuild
1572. Manual build
158
159.. note::
160
161   User can select the MCUboot bootloader by adding the following line
162   to the board default configuration file.
163
164   .. code:: cfg
165
166      CONFIG_BOOTLOADER_MCUBOOT=y
167
168Sysbuild
169========
170
171The sysbuild makes possible to build and flash all necessary images needed to
172bootstrap the board with the ESP32 SoC.
173
174To build the sample application using sysbuild use the command:
175
176.. zephyr-app-commands::
177   :tool: west
178   :app: samples/hello_world
179   :board: esp32s3_luatos_core
180   :goals: build
181   :west-args: --sysbuild
182   :compact:
183
184By default, the ESP32 sysbuild creates bootloader (MCUboot) and application
185images. But it can be configured to create other kind of images.
186
187Build directory structure created by sysbuild is different from traditional
188Zephyr build. Output is structured by the domain subdirectories:
189
190.. code-block::
191
192  build/
193  ├── hello_world
194  │   └── zephyr
195  │       ├── zephyr.elf
196  │       └── zephyr.bin
197  ├── mcuboot
198  │    └── zephyr
199  │       ├── zephyr.elf
200  │       └── zephyr.bin
201  └── domains.yaml
202
203.. note::
204
205   With ``--sysbuild`` option the bootloader will be re-build and re-flash
206   every time the pristine build is used.
207
208For more information about the system build please read the :ref:`sysbuild` documentation.
209
210Manual build
211============
212
213During the development cycle, it is intended to build & flash as quickly possible.
214For that reason, images can be build one at a time using traditional build.
215
216The instructions following are relevant for both manual build and sysbuild.
217The only difference is the structure of the build directory.
218
219.. note::
220
221   Remember that bootloader (MCUboot) needs to be flash at least once.
222
223Build and flash applications as usual (see :ref:`build_an_application` and
224:ref:`application_run` for more details).
225
226.. zephyr-app-commands::
227   :zephyr-app: samples/hello_world
228   :board: esp32s3_luatos_core/esp32s3/procpu
229   :goals: build
230
231If CH343 chip is disabled, You need use the following command to build:
232
233.. zephyr-app-commands::
234   :zephyr-app: samples/hello_world
235   :board: esp32s3_luatos_core/esp32s3/procpu/usb
236   :goals: build
237
238The usual ``flash`` target will work with the ``esp32s3_luatos_core`` board
239configuration. Here is an example for the :ref:`hello_world`
240application.
241
242.. zephyr-app-commands::
243   :zephyr-app: samples/hello_world
244   :board: esp32s3_luatos_core/esp32s3/procpu
245   :goals: flash
246
247Open the serial monitor using the following command:
248
249.. code-block:: shell
250
251   west espressif monitor
252
253After the board has automatically reset and booted, you should see the following
254message in the monitor:
255
256.. code-block:: console
257
258   ***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx *****
259   Hello World! esp32s3_luatos_core
260
261Debugging
262*********
263
264ESP32-S3 support on OpenOCD is available upstream as of version 0.12.0.
265Download and install OpenOCD from `OpenOCD`_.
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
270for ESP32-S3`_.
271
272Here is an example for building the :ref:`hello_world` application.
273
274.. zephyr-app-commands::
275   :zephyr-app: samples/hello_world
276   :board: esp32s3_luatos_core/esp32s3/procpu
277   :goals: build flash
278
279You can debug an application in the usual way. Here is an example for the :ref:`hello_world` application.
280
281.. zephyr-app-commands::
282   :zephyr-app: samples/hello_world
283   :board: esp32s3_luatos_core/esp32s3/procpu
284   :goals: debug
285
286.. _`JTAG debugging for ESP32-S3`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/jtag-debugging/
287.. _`OpenOCD`: https://github.com/openocd-org/openocd
288.. _`ESP32S3-LUATOS-CORE`: https://wiki.luatos.com/chips/esp32s3/board.html
289
290References
291**********
292
293.. _ESP32S3-LUATOS-CORE User Guide: https://wiki.luatos.com/chips/esp32s3/board.html
294.. _ESP32-S3 Datasheet: https://www.espressif.com/sites/default/files/documentation/esp32-s3-mini-1_mini-1u_datasheet_en.pdf
295.. _ESP32 Technical Reference Manual: https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf
296