| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | | ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | # Thread Radio Encapsulation Link Example This example demonstrates a Thread Radio Encapsulation Link (TREL) Example. ## How to use example ### Hardware Required To run this example, a board with Wi-Fi module (for example ESP32-S3) is required. ### Configure the project ``` idf.py menuconfig ``` The Wi-Fi ssid and password should be set through the menuconfig: ``` Component config → → Example Connection Configuration → → WiFi SSID Component config → → Example Connection Configuration → → WiFi Password ``` The example can run with the default configuration. OpenThread Command Line is enabled with UART as the default interface. Additionally, USB JTAG is also supported and can be activated through the menuconfig: ``` Component config → ESP System Settings → Channel for console output → USB Serial/JTAG Controller ``` ### Build, Flash, and Run Build the project and flash it to the board, then run monitor tool to view serial output: ``` idf.py build idf.py -p PORT erase-flash flash monitor ``` Now you'll get an OpenThread command line shell. ### Example Output The `help` command will print all of the supported commands. ```bash > help I(7058) OPENTHREAD:[INFO]-CLI-----: execute command: help bbr bufferinfo ccathreshold channel child childip childmax childsupervision childtimeout coap contextreusedelay counters dataset delaytimermin diag discover dns domainname eidcache eui64 extaddr extpanid factoryreset ... ``` ## Set Up Network To run this example, at least two ESP32-S3 boards flashed with this ot_trel example are required. And they must connect to the same wifi AP. On the first device, run the following commands: ```bash > factoryreset ... # the device will reboot > dataset init new Done > dataset commit active Done > ifconfig up Done > thread start Done # After some seconds > state leader Done ``` Now the first device has formed a Thread network as a leader. Get some information which will be used in next steps: ```bash > ipaddr fdde:ad00:beef:0:0:ff:fe00:fc00 fdde:ad00:beef:0:0:ff:fe00:8000 fdde:ad00:beef:0:a7c6:6311:9c8c:271b fe80:0:0:0:5c27:a723:7115:c8f8 # Get the Active Dataset > dataset active -x 0e080000000000010000000300001835060004001fffe00208fe7bb701f5f1125d0708fd75cbde7c6647bd0510b3914792d44f45b6c7d76eb9306eec94030f4f70656e5468726561642d35383332010258320410e35c581af5029b054fc904a24c2b27700c0402a0fff8 ``` On the second device, set the active dataset from leader, and start Thread interface: ```bash > factoryreset ... # the device will reboot > dataset set active 0e080000000000010000000300001835060004001fffe00208fe7bb701f5f1125d0708fd75cbde7c6647bd0510b3914792d44f45b6c7d76eb9306eec94030f4f70656e5468726561642d35383332010258320410e35c581af5029b054fc904a24c2b27700c0402a0fff8 > ifconfig up Done > thread start Done # After some seconds > state router # child is also a valid state Done ``` The second device has joined the Thread network as a router (or a child). ## Extension commands You can refer to the [extension command](https://github.com/espressif/esp-thread-br/blob/main/components/esp_ot_cli_extension/README.md) about the extension commands.