1.. zephyr:board:: esp32c3_rust 2 3Overview 4******** 5 6ESP32-C3-DevKit-RUST is based on the ESP32-C3, a single-core Wi-Fi and Bluetooth 5 (LE) microcontroller SoC, 7based on the open-source RISC-V architecture. This special board also includes the ESP32-C3-MINI-1 module, 8a 6DoF IMU, a temperature and humidity sensor, a Li-Ion battery charger, and a Type-C USB. The board is designed 9to be easily used in training sessions, demonstrating its capabilities with all the board peripherals. 10For more information, check `ESP32-C3-DevKit-RUST`_. 11 12Hardware 13******** 14 15SoC Features: 16 17- IEEE 802.11 b/g/n-compliant 18- Bluetooth 5, Bluetooth mesh 19- 32-bit RISC-V single-core processor, up to 160MHz 20- 384 KB ROM 21- 400 KB SRAM (16 KB for cache) 22- 8 KB SRAM in RTC 23- 22 x programmable GPIOs 24- 3 x SPI 25- 2 x UART 26- 1 x I2C 27- 1 x I2S 28- 2 x 54-bit general-purpose timers 29- 3 x watchdog timers 30- 1 x 52-bit system timer 31- Remote Control Peripheral (RMT) 32- LED PWM controller (LEDC) 33- Full-speed USB Serial/JTAG controller 34- General DMA controller (GDMA) 35- 1 x TWAI® 36- 2 x 12-bit SAR ADCs, up to 6 channels 37- 1 x temperature sensor 38 39For more information, check the datasheet at `ESP32-C3 Datasheet`_ or the technical reference 40manual at `ESP32-C3 Technical Reference Manual`_. 41 42Supported Features 43================== 44 45Current Zephyr's ESP32-C3-DevKit-RUST board supports the following features: 46 47+------------+------------+-------------------------------------+ 48| Interface | Controller | Driver/Component | 49+============+============+=====================================+ 50| UART | on-chip | serial port | 51+------------+------------+-------------------------------------+ 52| GPIO | on-chip | gpio | 53+------------+------------+-------------------------------------+ 54| PINMUX | on-chip | pinmux | 55+------------+------------+-------------------------------------+ 56| USB-JTAG | on-chip | hardware interface | 57+------------+------------+-------------------------------------+ 58| SPI Master | on-chip | spi | 59+------------+------------+-------------------------------------+ 60| Timers | on-chip | counter | 61+------------+------------+-------------------------------------+ 62| Watchdog | on-chip | watchdog | 63+------------+------------+-------------------------------------+ 64| TRNG | on-chip | entropy | 65+------------+------------+-------------------------------------+ 66| LEDC | on-chip | pwm | 67+------------+------------+-------------------------------------+ 68| SPI DMA | on-chip | spi | 69+------------+------------+-------------------------------------+ 70| TWAI | on-chip | can | 71+------------+------------+-------------------------------------+ 72| USB-CDC | on-chip | serial | 73+------------+------------+-------------------------------------+ 74| ADC | on-chip | adc | 75+------------+------------+-------------------------------------+ 76| Wi-Fi | on-chip | | 77+------------+------------+-------------------------------------+ 78| Bluetooth | on-chip | | 79+------------+------------+-------------------------------------+ 80 81I2C Peripherals 82=============== 83 84This board includes the following peripherals over the I2C bus: 85 86+---------------------------+--------------+---------+ 87| Peripheral | Part number | Address | 88+===========================+==============+=========+ 89| IMU | ICM-42670-P | 0x68 | 90+---------------------------+--------------+---------+ 91| Temperature and Humidity | SHTC3 | 0x70 | 92+---------------------------+--------------+---------+ 93 94I2C Bus Connection 95================== 96 97+---------+--------+ 98| Signal | GPIO | 99+=========+========+ 100| SDA | GPIO10 | 101+---------+--------+ 102| SCL | GPIO8 | 103+---------+--------+ 104 105I/Os 106==== 107 108The following devices are connected through GPIO: 109 110+--------------+--------+ 111| I/O Devices | GPIO | 112+==============+========+ 113| WS2812 LED | GPIO2 | 114+--------------+--------+ 115| LED | GPIO7 | 116+--------------+--------+ 117| Button/Boot | GPIO9 | 118+--------------+--------+ 119 120Power 121===== 122 123* USB type-C (*no PD compatibility*). 124* Li-Ion battery charger. 125 126System requirements 127******************* 128 129Prerequisites 130============= 131 132Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command 133below to retrieve those files. 134 135.. code-block:: console 136 137 west blobs fetch hal_espressif 138 139.. note:: 140 141 It is recommended running the command above after :file:`west update`. 142 143Building & Flashing 144******************* 145 146Simple boot 147=========== 148 149The board could be loaded using the single binary image, without 2nd stage bootloader. 150It is the default option when building the application without additional configuration. 151 152.. note:: 153 154 Simple boot does not provide any security features nor OTA updates. 155 156MCUboot bootloader 157================== 158 159User may choose to use MCUboot bootloader instead. In that case the bootloader 160must be built (and flashed) at least once. 161 162There are two options to be used when building an application: 163 1641. Sysbuild 1652. Manual build 166 167.. note:: 168 169 User can select the MCUboot bootloader by adding the following line 170 to the board default configuration file. 171 172 .. code:: cfg 173 174 CONFIG_BOOTLOADER_MCUBOOT=y 175 176Sysbuild 177======== 178 179The sysbuild makes possible to build and flash all necessary images needed to 180bootstrap the board with the ESP32 SoC. 181 182To build the sample application using sysbuild use the command: 183 184.. zephyr-app-commands:: 185 :tool: west 186 :zephyr-app: samples/hello_world 187 :board: esp32c3_rust 188 :goals: build 189 :west-args: --sysbuild 190 :compact: 191 192By default, the ESP32 sysbuild creates bootloader (MCUboot) and application 193images. But it can be configured to create other kind of images. 194 195Build directory structure created by sysbuild is different from traditional 196Zephyr build. Output is structured by the domain subdirectories: 197 198.. code-block:: 199 200 build/ 201 ├── hello_world 202 │ └── zephyr 203 │ ├── zephyr.elf 204 │ └── zephyr.bin 205 ├── mcuboot 206 │ └── zephyr 207 │ ├── zephyr.elf 208 │ └── zephyr.bin 209 └── domains.yaml 210 211.. note:: 212 213 With ``--sysbuild`` option the bootloader will be re-build and re-flash 214 every time the pristine build is used. 215 216For more information about the system build please read the :ref:`sysbuild` documentation. 217 218Manual build 219============ 220 221During the development cycle, it is intended to build & flash as quickly possible. 222For that reason, images can be built one at a time using traditional build. 223 224The instructions following are relevant for both manual build and sysbuild. 225The only difference is the structure of the build directory. 226 227.. note:: 228 229 Remember that bootloader (MCUboot) needs to be flash at least once. 230 231Build and flash applications as usual (see :ref:`build_an_application` and 232:ref:`application_run` for more details). 233 234.. zephyr-app-commands:: 235 :zephyr-app: samples/hello_world 236 :board: esp32c3_rust 237 :goals: build 238 239The usual ``flash`` target will work with the ``esp32c3_rust`` 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: esp32c3_rust 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! esp32c3_rust 261 262Debugging 263********* 264 265As with much custom hardware, the ESP32-C3 modules require patches to 266OpenOCD that are not upstreamed yet. Espressif maintains their own fork of 267the project. The custom OpenOCD can be obtained at `OpenOCD ESP32`_. 268 269The Zephyr SDK uses a bundled version of OpenOCD by default. You can overwrite that behavior by adding the 270``-DOPENOCD=<path/to/bin/openocd> -DOPENOCD_DEFAULT_PATH=<path/to/openocd/share/openocd/scripts>`` 271parameter when building. 272 273Here is an example for building the :zephyr:code-sample:`hello_world` application. 274 275.. zephyr-app-commands:: 276 :zephyr-app: samples/hello_world 277 :board: esp32c3_rust 278 :goals: build flash 279 :gen-args: -DOPENOCD=<path/to/bin/openocd> -DOPENOCD_DEFAULT_PATH=<path/to/openocd/share/openocd/scripts> 280 281You can debug an application in the usual way. Here is an example for the :zephyr:code-sample:`hello_world` application. 282 283.. zephyr-app-commands:: 284 :zephyr-app: samples/hello_world 285 :board: esp32c3_rust 286 :goals: debug 287 288References 289********** 290 291.. target-notes:: 292 293.. _`ESP32-C3-DevKit-RUST`: https://github.com/esp-rs/esp-rust-board/tree/v1.2 294.. _`ESP32-C3 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf 295.. _`ESP32-C3 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf 296.. _`OpenOCD ESP32`: https://github.com/espressif/openocd-esp32/releases 297