1.. zephyr:board:: ttgo_t8c3 2 3Overview 4******** 5 6Lilygo TTGO T8-C3 is an IoT mini development board based on the 7Espressif ESP32-C3 WiFi/Bluetooth dual-mode chip. 8 9It features the following integrated components: 10 11- ESP32-C3 chip (160MHz single core, 400KB SRAM, Wi-Fi) 12- on board antenna and IPEX connector 13- USB-C connector for power and communication 14- JST GH 2-pin battery connector 15- LED 16 17Functional Description 18********************** 19This board is based on the ESP32-C3 with 4MB of flash, WiFi and BLE support. It 20has an USB-C port for programming and debugging, integrated battery charging 21and an on-board antenna. The fitted U.FL external antenna connector can be 22enabled by moving a 0-ohm resistor. 23 24Connections and IOs 25=================== 26 27The ``ttgo_t8c3`` board target supports the following hardware features: 28 29+-----------+------------+------------------+ 30| Interface | Controller | Driver/Component | 31+===========+============+==================+ 32| PMP | on-chip | arch/riscv | 33+-----------+------------+------------------+ 34| INTMTRX | on-chip | intc_esp32c3 | 35+-----------+------------+------------------+ 36| PINMUX | on-chip | pinctrl_esp32 | 37+-----------+------------+------------------+ 38| USB UART | on-chip | serial_esp32_usb | 39+-----------+------------+------------------+ 40| GPIO | on-chip | gpio_esp32 | 41+-----------+------------+------------------+ 42| UART | on-chip | uart_esp32 | 43+-----------+------------+------------------+ 44| I2C | on-chip | i2c_esp32 | 45+-----------+------------+------------------+ 46| SPI | on-chip | spi_esp32_spim | 47+-----------+------------+------------------+ 48| TWAI | on-chip | can_esp32_twai | 49+-----------+------------+------------------+ 50 51Start Application Development 52***************************** 53 54Before powering up your Lilygo TTGO T8-C3, please make sure that the board is in good 55condition with no obvious signs of damage. 56 57System requirements 58******************* 59 60Prerequisites 61============= 62 63Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command 64below to retrieve those files. 65 66.. code-block:: console 67 68 west blobs fetch hal_espressif 69 70.. note:: 71 72 It is recommended running the command above after :file:`west update`. 73 74Building & Flashing 75******************* 76 77Simple boot 78=========== 79 80The board could be loaded using the single binary image, without 2nd stage bootloader. 81It is the default option when building the application without additional configuration. 82 83.. note:: 84 85 Simple boot does not provide any security features nor OTA updates. 86 87MCUboot bootloader 88================== 89 90User may choose to use MCUboot bootloader instead. In that case the bootloader 91must be built (and flashed) at least once. 92 93There are two options to be used when building an application: 94 951. Sysbuild 962. Manual build 97 98.. note:: 99 100 User can select the MCUboot bootloader by adding the following line 101 to the board default configuration file. 102 103 .. code:: cfg 104 105 CONFIG_BOOTLOADER_MCUBOOT=y 106 107Sysbuild 108======== 109 110The sysbuild makes possible to build and flash all necessary images needed to 111bootstrap the board with the ESP32-C3 SoC. 112 113To build the sample application using sysbuild use the command: 114 115.. zephyr-app-commands:: 116 :tool: west 117 :zephyr-app: samples/hello_world 118 :board: ttgo_t8c3 119 :goals: build 120 :west-args: --sysbuild 121 :compact: 122 123By default, the ESP32-C3 sysbuild creates bootloader (MCUboot) and application 124images. But it can be configured to create other kind of images. 125 126Build directory structure created by sysbuild is different from traditional 127Zephyr build. Output is structured by the domain subdirectories: 128 129.. code-block:: 130 131 build/ 132 ├── hello_world 133 │ └── zephyr 134 │ ├── zephyr.elf 135 │ └── zephyr.bin 136 ├── mcuboot 137 │ └── zephyr 138 │ ├── zephyr.elf 139 │ └── zephyr.bin 140 └── domains.yaml 141 142.. note:: 143 144 With ``--sysbuild`` option the bootloader will be re-build and re-flash 145 every time the pristine build is used. 146 147For more information about the system build please read the :ref:`sysbuild` documentation. 148 149Manual build 150============ 151 152During the development cycle, it is intended to build & flash as quickly possible. 153For that reason, images can be built one at a time using traditional build. 154 155The instructions following are relevant for both manual build and sysbuild. 156The only difference is the structure of the build directory. 157 158.. note:: 159 160 Remember that bootloader (MCUboot) needs to be flash at least once. 161 162Build and flash applications as usual (see :ref:`build_an_application` and 163:ref:`application_run` for more details). 164 165.. zephyr-app-commands:: 166 :zephyr-app: samples/hello_world 167 :board: ttgo_t8c3 168 :goals: build 169 170The usual ``flash`` target will work with the ``ttgo_t8c3`` board target. 171Here is an example for the :zephyr:code-sample:`hello_world` application. 172 173.. zephyr-app-commands:: 174 :zephyr-app: samples/hello_world 175 :board: ttgo_t8c3 176 :goals: flash 177 178The default baud rate for the Lilygo TTGO T8-C3 is set to 1500000bps. If experiencing issues when flashing, 179try using different values by using ``--esp-baud-rate <BAUD>`` option during 180``west flash`` (e.g. ``west flash --esp-baud-rate 115200``). 181 182You can also open the serial monitor using the following command: 183 184.. code-block:: shell 185 186 west espressif monitor 187 188After the board has automatically reset and booted, you should see the following 189message in the monitor: 190 191.. code-block:: console 192 193 ***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx ***** 194 Hello World! ttgo_t8c3 195 196Sample applications 197=================== 198 199The following samples will run out of the box on the TTGO T8-C3 board. 200 201To build the blinky sample: 202 203.. zephyr-app-commands:: 204 :tool: west 205 :zephyr-app: samples/basic/blinky 206 :board: ttgo_t8c3 207 :goals: build 208 209To build the bluetooth beacon sample: 210 211.. zephyr-app-commands:: 212 :tool: west 213 :zephyr-app: samples/bluetooth/beacon 214 :board: ttgo_t8c3 215 :goals: build 216 217 218Related Documents 219***************** 220.. _`Lilygo TTGO T8-C3 schematic`: https://github.com/Xinyuan-LilyGO/T8-C3/blob/main/Schematic/T8-C3_V1.1.pdf 221.. _`Lilygo github repo`: https://github.com/Xinyuan-LilyGo 222.. _`Espressif ESP32-C3 datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf 223.. _`Espressif ESP32-C3 technical reference manual`: https://www.espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf 224.. _`OpenOCD ESP32`: https://github.com/espressif/openocd-esp32/releases 225