|
| 1 | +# Matter ESP32 Thread Border Router Example |
| 2 | + |
| 3 | +A prototype application that demonstrates OpenThread Border Router on ESP32-S3 + |
| 4 | +ESP32-H2 Thread Border Router DevKit Board. |
| 5 | + |
| 6 | +Please |
| 7 | +[setup ESP-IDF and CHIP Environment](../../../docs/guides/esp32/setup_idf_chip.md) |
| 8 | +and refer |
| 9 | +[building and commissioning](../../../docs/guides/esp32/build_app_and_commission.md) |
| 10 | +guides to get started. |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +- [OpenThread Border Router Board](#openthread-border-router-board) |
| 15 | +- [OpenThread RCP](#openthread-rcp) |
| 16 | +- [OpenThread CLI](#openthread-cli) |
| 17 | +- [Setup Thread Network](#setup-thread-network) |
| 18 | +- [Commissioning Thread End Devices](#commissioning-thread-end-devices) |
| 19 | + |
| 20 | +--- |
| 21 | + |
| 22 | +### OpenThread Border Router Board |
| 23 | + |
| 24 | +The ESP Thread border router board provides an integrated module of an ESP32-S3 |
| 25 | +and an ESP32-H2. |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +### OpenThread RCP |
| 30 | + |
| 31 | +We need to build an OpenThread RCP(Radio Co-Processor) firmware for ESP32-H2 of |
| 32 | +the Border Router Board before building this Thread Border example. |
| 33 | + |
| 34 | +``` |
| 35 | +cd $IDF_PATH/examples/openthread/ot_rcp |
| 36 | +idf.py set-target esp32h2 |
| 37 | +idf.py build |
| 38 | +``` |
| 39 | + |
| 40 | +Then we need to connect the USB2 port(ESP32-S3) of the Border Router Board to |
| 41 | +your host machine. Build and flash this example. |
| 42 | + |
| 43 | +``` |
| 44 | +cd ${CHIP_ROOT}/examples/thread-br-app/esp32 |
| 45 | +idf.py set-target esp32s3 |
| 46 | +idf.py build |
| 47 | +idf.py -p {port} erase-flash flash monitor |
| 48 | +``` |
| 49 | + |
| 50 | +This example will detect the RCP firmware built in ESP-IDF path and flash it to |
| 51 | +the spiffs partition. When starting this example, the ESP32-S3 will compare the |
| 52 | +versions of both the RCP firmware in the spiffs partition and the firmware on |
| 53 | +ESP32-H2. if the spiffs RCP firmware is newer than the firmware on ESP32-H2, the |
| 54 | +Thread BR will flash the RCP firmware to ESP32-H2 automatically. |
| 55 | + |
| 56 | +### OpenThread CLI |
| 57 | + |
| 58 | +After you build this example and flash it to the ESP32-S3 of Border Router |
| 59 | +Board, you can access a standard OpenThread CLI via the device console with a |
| 60 | +`matter otcli` prefix. |
| 61 | + |
| 62 | +For instance, you can get the state: |
| 63 | + |
| 64 | +``` |
| 65 | +> matter otcli state |
| 66 | +Detached |
| 67 | +Done |
| 68 | +``` |
| 69 | + |
| 70 | +### Setup Thread Network |
| 71 | + |
| 72 | +You can send SetActiveDatasetRequest command to the Thread BR after |
| 73 | +commissioning it as a Matter-Over-Wi-Fi device to setup the Thread network or |
| 74 | +join an existing Thread network. |
| 75 | + |
| 76 | +``` |
| 77 | +./chip-tool pairing ble-wifi 1 <ssid> <password> 20202021 3840 |
| 78 | +./chip-tool generalcommissioning arm-fail-safe 180 1 1 0 |
| 79 | +./chip-tool threadborderroutermanagement set-active-dataset-request hex:<dataset-tlvs> 1 1 1 |
| 80 | +./chip-tool generalcommissioning commissioning-complete 1 0 |
| 81 | +``` |
| 82 | + |
| 83 | +The Thread BR with enable the Thread network interface and start Thread network |
| 84 | +after it receives SetActiveDatasetRequest command. And after the Thread BR sets |
| 85 | +up or join a Thread network, it will send the success response. |
| 86 | + |
| 87 | +### Commissioning Thread End Devices |
| 88 | + |
| 89 | +After setting up the Thread network, you can commission a Thread End-device to |
| 90 | +the Thread network. |
| 91 | + |
| 92 | +``` |
| 93 | +./chip-tool pairing ble-wifi 2 hex:<dataset_tlvs> <pincode> <discriminator> |
| 94 | +``` |
0 commit comments