|
| 1 | +.. zephyr:board:: xiao_esp32c6 |
| 2 | +
|
| 3 | +Overview |
| 4 | +******** |
| 5 | + |
| 6 | +Seeed Studio XIAO ESP32C6 is powered by the highly-integrated ESP32-C6 SoC. |
| 7 | +It consists of a high-performance (HP) 32-bit RISC-V processor, which can be clocked up to 160 MHz, |
| 8 | +and a low-power (LP) 32-bit RISC-V processor, which can be clocked up to 20 MHz. |
| 9 | +It has a 320KB ROM, a 512KB SRAM, and works with external flash. |
| 10 | +This board integrates complete Wi-Fi, Bluetooth LE, Zigbee, and Thread functions. |
| 11 | +For more information, check `Seeed Studio XIAO ESP32C6`_ . |
| 12 | + |
| 13 | +Hardware |
| 14 | +******** |
| 15 | + |
| 16 | +This board is based on the ESP32-C6 with 4MB of flash, integrating 2.4 GHz Wi-Fi 6, |
| 17 | +Bluetooth 5.3 (LE) and the 802.15.4 protocol. It has an USB-C port for programming |
| 18 | +and debugging, integrated battery charging and an U.FL external antenna connector. |
| 19 | +It is based on a standard XIAO 14 pin pinout. |
| 20 | + |
| 21 | +Supported Features |
| 22 | +================== |
| 23 | + |
| 24 | +The Zephyr ``xiao_esp32c6`` board target supports the following hardware features: |
| 25 | + |
| 26 | ++------------+------------+-------------------------------------+ |
| 27 | +| Interface | Controller | Driver/Component | |
| 28 | ++============+============+=====================================+ |
| 29 | +| UART | on-chip | serial port | |
| 30 | ++------------+------------+-------------------------------------+ |
| 31 | +| GPIO | on-chip | gpio | |
| 32 | ++------------+------------+-------------------------------------+ |
| 33 | +| PINMUX | on-chip | pinmux | |
| 34 | ++------------+------------+-------------------------------------+ |
| 35 | +| USB-JTAG | on-chip | hardware interface | |
| 36 | ++------------+------------+-------------------------------------+ |
| 37 | +| SPI Master | on-chip | spi | |
| 38 | ++------------+------------+-------------------------------------+ |
| 39 | +| Watchdog | on-chip | watchdog | |
| 40 | ++------------+------------+-------------------------------------+ |
| 41 | +| LEDC | on-chip | pwm | |
| 42 | ++------------+------------+-------------------------------------+ |
| 43 | +| SPI DMA | on-chip | spi | |
| 44 | ++------------+------------+-------------------------------------+ |
| 45 | +| GDMA | on-chip | dma | |
| 46 | ++------------+------------+-------------------------------------+ |
| 47 | +| TRNG | on-chip | entropy | |
| 48 | ++------------+------------+-------------------------------------+ |
| 49 | +| USB-CDC | on-chip | serial | |
| 50 | ++------------+------------+-------------------------------------+ |
| 51 | +| Wi-Fi | on-chip | | |
| 52 | ++------------+------------+-------------------------------------+ |
| 53 | + |
| 54 | +The board uses a standard XIAO pinout, the default pin mapping is the following: |
| 55 | + |
| 56 | +.. figure:: img/xiao_esp32c6_pinout.webp |
| 57 | + :align: center |
| 58 | + :alt: XIAO ESP32C6 Pinout |
| 59 | + |
| 60 | + XIAO ESP32C6 Pinout |
| 61 | + |
| 62 | +System requirements |
| 63 | +******************* |
| 64 | + |
| 65 | +Prerequisites |
| 66 | +============= |
| 67 | + |
| 68 | +Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command |
| 69 | +below to retrieve those files. |
| 70 | + |
| 71 | +.. code-block:: console |
| 72 | +
|
| 73 | + west blobs fetch hal_espressif |
| 74 | +
|
| 75 | +.. note:: |
| 76 | + |
| 77 | + It is recommended running the command above after :file:`west update`. |
| 78 | + |
| 79 | +Building & Flashing |
| 80 | +******************* |
| 81 | + |
| 82 | +Simple boot |
| 83 | +=========== |
| 84 | + |
| 85 | +The board could be loaded using the single binary image, without 2nd stage bootloader. |
| 86 | +It is the default option when building the application without additional configuration. |
| 87 | + |
| 88 | +.. note:: |
| 89 | + |
| 90 | + Simple boot does not provide any security features nor OTA updates. |
| 91 | + |
| 92 | +MCUboot bootloader |
| 93 | +================== |
| 94 | + |
| 95 | +User may choose to use MCUboot bootloader instead. In that case the bootloader |
| 96 | +must be built (and flashed) at least once. |
| 97 | + |
| 98 | +There are two options to be used when building an application: |
| 99 | + |
| 100 | +1. Sysbuild |
| 101 | +2. Manual build |
| 102 | + |
| 103 | +.. note:: |
| 104 | + |
| 105 | + User can select the MCUboot bootloader by adding the following line |
| 106 | + to the board default configuration file. |
| 107 | + |
| 108 | + .. code:: cfg |
| 109 | +
|
| 110 | + CONFIG_BOOTLOADER_MCUBOOT=y |
| 111 | +
|
| 112 | +Sysbuild |
| 113 | +======== |
| 114 | + |
| 115 | +The sysbuild makes possible to build and flash all necessary images needed to |
| 116 | +bootstrap the board with the EPS32 SoC. |
| 117 | + |
| 118 | +To build the sample application using sysbuild use the command: |
| 119 | + |
| 120 | +.. zephyr-app-commands:: |
| 121 | + :tool: west |
| 122 | + :zephyr-app: samples/hello_world |
| 123 | + :board: xiao_esp32c6 |
| 124 | + :goals: build |
| 125 | + :west-args: --sysbuild |
| 126 | + :compact: |
| 127 | + |
| 128 | +By default, the ESP32 sysbuild creates bootloader (MCUboot) and application |
| 129 | +images. But it can be configured to create other kind of images. |
| 130 | + |
| 131 | +Build directory structure created by sysbuild is different from traditional |
| 132 | +Zephyr build. Output is structured by the domain subdirectories: |
| 133 | + |
| 134 | +.. code-block:: |
| 135 | +
|
| 136 | + build/ |
| 137 | + ├── hello_world |
| 138 | + │ └── zephyr |
| 139 | + │ ├── zephyr.elf |
| 140 | + │ └── zephyr.bin |
| 141 | + ├── mcuboot |
| 142 | + │ └── zephyr |
| 143 | + │ ├── zephyr.elf |
| 144 | + │ └── zephyr.bin |
| 145 | + └── domains.yaml |
| 146 | +
|
| 147 | +.. note:: |
| 148 | + |
| 149 | + With ``--sysbuild`` option the bootloader will be re-build and re-flash |
| 150 | + every time the pristine build is used. |
| 151 | + |
| 152 | +For more information about the system build please read the :ref:`sysbuild` documentation. |
| 153 | + |
| 154 | +Manual build |
| 155 | +============ |
| 156 | + |
| 157 | +During the development cycle, it is intended to build & flash as quickly possible. |
| 158 | +For that reason, images can be built one at a time using traditional build. |
| 159 | + |
| 160 | +The instructions following are relevant for both manual build and sysbuild. |
| 161 | +The only difference is the structure of the build directory. |
| 162 | + |
| 163 | +.. note:: |
| 164 | + |
| 165 | + Remember that bootloader (MCUboot) needs to be flash at least once. |
| 166 | + |
| 167 | +Build and flash applications as usual (see :ref:`build_an_application` and |
| 168 | +:ref:`application_run` for more details). |
| 169 | + |
| 170 | +.. zephyr-app-commands:: |
| 171 | + :zephyr-app: samples/hello_world |
| 172 | + :board: xiao_esp32c6 |
| 173 | + :goals: build |
| 174 | + |
| 175 | +The usual ``flash`` target will work with the ``xiao_esp32c6`` board |
| 176 | +configuration. Here is an example for the :zephyr:code-sample:`hello_world` |
| 177 | +application. |
| 178 | + |
| 179 | +.. zephyr-app-commands:: |
| 180 | + :zephyr-app: samples/hello_world |
| 181 | + :board: xiao_esp32c6 |
| 182 | + :goals: flash |
| 183 | + |
| 184 | +Since the Zephyr console is by default on the ``usb_serial`` device, we use |
| 185 | +the espressif monitor to view. |
| 186 | + |
| 187 | +.. code-block:: console |
| 188 | +
|
| 189 | + $ west espressif monitor |
| 190 | +
|
| 191 | +After the board has automatically reset and booted, you should see the following |
| 192 | +message in the monitor: |
| 193 | + |
| 194 | +.. code-block:: console |
| 195 | +
|
| 196 | + ***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx ***** |
| 197 | + Hello World! xiao_esp32c6/esp32c6 |
| 198 | +
|
| 199 | +Debugging |
| 200 | +********* |
| 201 | + |
| 202 | +As with much custom hardware, the ESP32-C6 modules require patches to |
| 203 | +OpenOCD that are not upstreamed yet. Espressif maintains their own fork of |
| 204 | +the project. The custom OpenOCD can be obtained at `OpenOCD ESP32`_. |
| 205 | + |
| 206 | +The Zephyr SDK uses a bundled version of OpenOCD by default. You can overwrite that behavior by adding the |
| 207 | +``-DOPENOCD=<path/to/bin/openocd> -DOPENOCD_DEFAULT_PATH=<path/to/openocd/share/openocd/scripts>`` |
| 208 | +parameter when building. |
| 209 | + |
| 210 | +Here is an example for building the :zephyr:code-sample:`hello_world` application. |
| 211 | + |
| 212 | +.. zephyr-app-commands:: |
| 213 | + :zephyr-app: samples/hello_world |
| 214 | + :board: xiao_esp32c6 |
| 215 | + :goals: build flash |
| 216 | + :gen-args: -DOPENOCD=<path/to/bin/openocd> -DOPENOCD_DEFAULT_PATH=<path/to/openocd/share/openocd/scripts> |
| 217 | + |
| 218 | +You can debug an application in the usual way. Here is an example for the :zephyr:code-sample:`hello_world` application. |
| 219 | + |
| 220 | +.. zephyr-app-commands:: |
| 221 | + :zephyr-app: samples/hello_world |
| 222 | + :board: xiao_esp32c6 |
| 223 | + :goals: debug |
| 224 | + |
| 225 | +References |
| 226 | +********** |
| 227 | + |
| 228 | +.. target-notes:: |
| 229 | + |
| 230 | +.. _`Seeed Studio XIAO ESP32C6`: https://wiki.seeedstudio.com/xiao_esp32c6_getting_started/ |
| 231 | +.. _`ESP32-C6 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf |
| 232 | +.. _`ESP32-C6 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32-c6_technical_reference_manual_en.pdf |
| 233 | +.. _`OpenOCD ESP32`: https://github.com/espressif/openocd-esp32/releases |
0 commit comments