1.. zephyr:board:: esp32c6_devkitc
2
3Overview
4********
5
6ESP32-C6-DevKitC is an entry-level development board based on ESP32-C6-WROOM-1(U),
7a general-purpose module with a 8 MB SPI flash. This board integrates complete Wi-Fi,
8Bluetooth LE, Zigbee, and Thread functions. For more information, check `ESP32-C6-DevKitC`_.
9
10Hardware
11********
12
13ESP32-C6 is Espressif's first Wi-Fi 6 SoC integrating 2.4 GHz Wi-Fi 6, Bluetooth 5.3 (LE) and the
14802.15.4 protocol. ESP32-C6 achieves an industry-leading RF performance, with reliable security
15features and multiple memory resources for IoT products.
16It consists of a high-performance (HP) 32-bit RISC-V processor, which can be clocked up to 160 MHz,
17and a low-power (LP) 32-bit RISC-V processor, which can be clocked up to 20 MHz.
18It has a 320KB ROM, a 512KB SRAM, and works with external flash.
19
20ESP32-C6-DevKitC is an entry-level development board based on ESP32-C6-WROOM-1(U),
21a general-purpose module with a 8 MB SPI flash.
22
23Most of the I/O pins are broken out to the pin headers on both sides for easy interfacing.
24Developers can either connect peripherals with jumper wires or mount ESP32-C6-DevKitC on
25a breadboard.
26
27ESP32-C6 includes the following features:
28
29- 32-bit core RISC-V microcontroller with a clock speed of up to 160 MHz
30- 400 KB of internal RAM
31- WiFi 802.11 ax 2.4GHz
32- Fully compatible with IEEE 802.11b/g/n protocol
33- Bluetooth LE: Bluetooth 5.3 certified
34- Internal co-existence mechanism between Wi-Fi and Bluetooth to share the same antenna
35- IEEE 802.15.4 (Zigbee and Thread)
36
37Digital interfaces:
38
39- 30x GPIOs (QFN40), or 22x GPIOs (QFN32)
40- 2x UART
41- 1x Low-power (LP) UART
42- 1x General purpose SPI
43- 1x I2C
44- 1x Low-power (LP) I2C
45- 1x I2S
46- 1x Pulse counter
47- 1x USB Serial/JTAG controller
48- 1x TWAI® controller, compatible with ISO 11898-1 (CAN Specification 2.0)
49- 1x SDIO 2.0 slave controller
50- LED PWM controller, up to 6 channels
51- 1x Motor control PWM (MCPWM)
52- 1x Remote control peripehral
53- 1x Parallel IO interface (PARLIO)
54- General DMA controller (GDMA), with 3 transmit channels and 3 receive channels
55- Event task matrix (ETM)
56
57Analog interfaces:
58
59- 1x 12-bit SAR ADCs, up to 7 channels
60- 1x temperature sensor
61
62Timers:
63
64- 1x 52-bit system timer
65- 1x 54-bit general-purpose timers
66- 3x Watchdog timers
67- 1x Analog watchdog timer
68
69Low Power:
70
71- Four power modes designed for typical scenarios: Active, Modem-sleep, Light-sleep, Deep-sleep
72
73Security:
74
75- Secure boot
76- Flash encryption
77- 4-Kbit OTP, up to 1792 bits for users
78- Cryptographic hardware acceleration: (AES-128/256, ECC, HMAC, RSA, SHA, Digital signature, Hash)
79- Random number generator (RNG)
80
81For more information, check the datasheet at `ESP32-C6 Datasheet`_ or the technical reference
82manual at `ESP32-C6 Technical Reference Manual`_.
83
84Supported Features
85==================
86
87Current Zephyr's ESP32-C6-DevKitC 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| I2C        | on-chip    | i2c                                 |
103+------------+------------+-------------------------------------+
104| Timers     | on-chip    | counter                             |
105+------------+------------+-------------------------------------+
106| Watchdog   | on-chip    | watchdog                            |
107+------------+------------+-------------------------------------+
108| LEDC       | on-chip    | pwm                                 |
109+------------+------------+-------------------------------------+
110| MCPWM      | on-chip    | pwm                                 |
111+------------+------------+-------------------------------------+
112| SPI DMA    | on-chip    | spi                                 |
113+------------+------------+-------------------------------------+
114| GDMA       | on-chip    | dma                                 |
115+------------+------------+-------------------------------------+
116| TRNG       | on-chip    | entropy                             |
117+------------+------------+-------------------------------------+
118| USB-CDC    | on-chip    | serial                              |
119+------------+------------+-------------------------------------+
120| Wi-Fi      | on-chip    |                                     |
121+------------+------------+-------------------------------------+
122
123System requirements
124*******************
125
126Prerequisites
127=============
128
129Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command
130below to retrieve those files.
131
132.. code-block:: console
133
134   west blobs fetch hal_espressif
135
136.. note::
137
138   It is recommended running the command above after :file:`west update`.
139
140Building & Flashing
141*******************
142
143Simple boot
144===========
145
146The board could be loaded using the single binary image, without 2nd stage bootloader.
147It is the default option when building the application without additional configuration.
148
149.. note::
150
151   Simple boot does not provide any security features nor OTA updates.
152
153MCUboot bootloader
154==================
155
156User may choose to use MCUboot bootloader instead. In that case the bootloader
157must be built (and flashed) at least once.
158
159There are two options to be used when building an application:
160
1611. Sysbuild
1622. Manual build
163
164.. note::
165
166   User can select the MCUboot bootloader by adding the following line
167   to the board default configuration file.
168
169   .. code:: cfg
170
171      CONFIG_BOOTLOADER_MCUBOOT=y
172
173Sysbuild
174========
175
176The sysbuild makes possible to build and flash all necessary images needed to
177bootstrap the board with the EPS32 SoC.
178
179To build the sample application using sysbuild use the command:
180
181.. zephyr-app-commands::
182   :tool: west
183   :zephyr-app: samples/hello_world
184   :board: esp32c6_devkitc
185   :goals: build
186   :west-args: --sysbuild
187   :compact:
188
189By default, the ESP32 sysbuild creates bootloader (MCUboot) and application
190images. But it can be configured to create other kind of images.
191
192Build directory structure created by sysbuild is different from traditional
193Zephyr build. Output is structured by the domain subdirectories:
194
195.. code-block::
196
197  build/
198  ├── hello_world
199  │   └── zephyr
200  │       ├── zephyr.elf
201  │       └── zephyr.bin
202  ├── mcuboot
203  │    └── zephyr
204  │       ├── zephyr.elf
205  │       └── zephyr.bin
206  └── domains.yaml
207
208.. note::
209
210   With ``--sysbuild`` option the bootloader will be re-build and re-flash
211   every time the pristine build is used.
212
213For more information about the system build please read the :ref:`sysbuild` documentation.
214
215Manual build
216============
217
218During the development cycle, it is intended to build & flash as quickly possible.
219For that reason, images can be built one at a time using traditional build.
220
221The instructions following are relevant for both manual build and sysbuild.
222The only difference is the structure of the build directory.
223
224.. note::
225
226   Remember that bootloader (MCUboot) needs to be flash at least once.
227
228Build and flash applications as usual (see :ref:`build_an_application` and
229:ref:`application_run` for more details).
230
231.. zephyr-app-commands::
232   :zephyr-app: samples/hello_world
233   :board: esp32c6_devkitc
234   :goals: build
235
236The usual ``flash`` target will work with the ``esp32c6_devkitc`` board
237configuration. Here is an example for the :zephyr:code-sample:`hello_world`
238application.
239
240.. zephyr-app-commands::
241   :zephyr-app: samples/hello_world
242   :board: esp32c6_devkitc
243   :goals: flash
244
245Open the serial monitor using the following command:
246
247.. code-block:: shell
248
249   west espressif monitor
250
251After the board has automatically reset and booted, you should see the following
252message in the monitor:
253
254.. code-block:: console
255
256   ***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx *****
257   Hello World! esp32c6_devkitc
258
259Debugging
260*********
261
262As with much custom hardware, the ESP32-C6 modules require patches to
263OpenOCD that are not upstreamed yet. Espressif maintains their own fork of
264the project. The custom OpenOCD can be obtained at `OpenOCD ESP32`_.
265
266The Zephyr SDK uses a bundled version of OpenOCD by default. You can overwrite that behavior by adding the
267``-DOPENOCD=<path/to/bin/openocd> -DOPENOCD_DEFAULT_PATH=<path/to/openocd/share/openocd/scripts>``
268parameter when building.
269
270Here is an example for building the :zephyr:code-sample:`hello_world` application.
271
272.. zephyr-app-commands::
273   :zephyr-app: samples/hello_world
274   :board: esp32c6_devkitc
275   :goals: build flash
276   :gen-args: -DOPENOCD=<path/to/bin/openocd> -DOPENOCD_DEFAULT_PATH=<path/to/openocd/share/openocd/scripts>
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: esp32c6_devkitc
283   :goals: debug
284
285
286References
287**********
288
289.. target-notes::
290
291.. _`ESP32-C6-DevKitC`: https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitc-1/user_guide.html
292.. _`ESP32-C6 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf
293.. _`ESP32-C6 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32-c6_technical_reference_manual_en.pdf
294.. _`OpenOCD ESP32`: https://github.com/espressif/openocd-esp32/releases
295