|
| 1 | +# OpenThread Border Router Example for ESP32-P4 |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +There are 2 ways to run this example on the ESP32-P4: |
| 6 | +- [(Default): P4 main processor (Ethernet) + C6 Thread radio co-processor](#p4-main-processor-ethernet--c6-thread-radio-co-processor) |
| 7 | +- [(Wi-fi): P4 main processor + C6 Wi-Fi co-processor + External H2 Thread radio co-processor](#p4-main-processor--c6-wi-fi-co-processor--external-h2-thread-radio-co-processor) |
| 8 | + |
| 9 | +## How to use example |
| 10 | + |
| 11 | +### Hardware Required |
| 12 | + |
| 13 | +The [ESP32-P4-Function-EV-Board](https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32p4/esp32-p4-function-ev-board/user_guide.html) is recommended for this example. If you wish to use standalone modules, you may refer to the [OpenThread Border Router Example](https://github.com/espressif/esp-idf/tree/master/examples/openthread/ot_br) in esp-idf. |
| 14 | + |
| 15 | +### Set up ESP IDF |
| 16 | + |
| 17 | +Refer to [ESP-IDF Get Started](https://docs.espressif.com/projects/esp-idf/en/latest/esp32p4/get-started/index.html). |
| 18 | + |
| 19 | +Currently, it is recommended to use ESP-IDF [v5.4.2](https://github.com/espressif/esp-idf/tree/v5.4.2) release. |
| 20 | + |
| 21 | +### P4 main processor (Ethernet) + C6 Thread radio co-processor |
| 22 | + |
| 23 | +#### Configure the project |
| 24 | + |
| 25 | +The default configurations in `sdkconfig.defaults.esp32p4` will be applied by using the command: |
| 26 | + |
| 27 | +``` |
| 28 | +idf.py set-target esp32p4 |
| 29 | +``` |
| 30 | + |
| 31 | +#### Create the RCP firmware image |
| 32 | + |
| 33 | +First build the [ot_rcp](https://github.com/espressif/esp-idf/tree/master/examples/openthread/ot_rcp) example in IDF **using the ESP32C6 target**. In the building process, the built RCP image will be automatically packed into the border router firmware. |
| 34 | + |
| 35 | +> ⚠️ **Warning:** Using the default configurations for this example will flash the built-in C6 co-processor with the OT_RCP firmware, replacing the original ESP-Hosted slave firmware. If you wish to use this example with C6 running Wi-Fi, please refer to the [instructions for Wi-Fi](#configure-the-project-wi-fi). |
| 36 | +
|
| 37 | +The border router supports updating the C6 RCP upon boot, with the following header pin connections: |
| 38 | + |
| 39 | +ESP32-P4 pin | ESP32-C6 pin |
| 40 | +--------------------|------------- |
| 41 | + GPIO4 (UART RX) | TX0 |
| 42 | + GPIO5 (UART TX) | RX0 |
| 43 | + GPIO7 | EN |
| 44 | + GPIO8 | BOOT |
| 45 | + |
| 46 | +#### Build, Flash, and Run |
| 47 | + |
| 48 | +> The `OPENTHREAD_BR_AUTO_START` option is enabled by default, you may choose to configure the `Thread Operational Dataset` options in menuconfig before building. |
| 49 | +
|
| 50 | +Build the project and flash it to the board, then run monitor tool to view serial output: |
| 51 | + |
| 52 | +``` |
| 53 | +idf.py -p PORT build erase-flash flash monitor |
| 54 | +``` |
| 55 | + |
| 56 | +### P4 main processor + C6 Wi-Fi co-processor + External H2 Thread radio co-processor |
| 57 | + |
| 58 | +#### Configure the project |
| 59 | + |
| 60 | +Add `esp_wifi_remote` and `esp_hosted` components to the project: |
| 61 | + |
| 62 | +``` |
| 63 | +idf.py add-dependency "espressif/esp_wifi_remote" |
| 64 | +idf.py add-dependency "espressif/esp_hosted" |
| 65 | +``` |
| 66 | + |
| 67 | +The default configurations in `sdkconfig.defaults.esp32p4` will be applied by using the command: |
| 68 | + |
| 69 | +``` |
| 70 | +idf.py -D "SDKCONFIG_DEFAULTS=sdkconfig.defaults;sdkconfig.wifi.esp32p4" set-target esp32p4 |
| 71 | +``` |
| 72 | + |
| 73 | +#### Connect an ESP32-H2 RCP to an ESP32-P4 using UART: |
| 74 | +ESP32-P4 pin | ESP32-H2 pin |
| 75 | +--------------------|------------- |
| 76 | + GND | G |
| 77 | + 5V | 5V |
| 78 | + GPIO4 (UART RX) | TX |
| 79 | + GPIO5 (UART TX) | RX |
| 80 | + GPIO7 | RST |
| 81 | + GPIO8 | GPIO9 (BOOT) |
| 82 | + |
| 83 | +#### Flashing ESP32-C6 Wi-Fi Module (optional) |
| 84 | + |
| 85 | +The ESP32-C6 module in the ESP32-P4-Function-EV-Board is pre-flashed with ESP-Hosted slave firmware, so there is no need to flash any additional firmware to the ESP32-C6. However, you may refer to [these instructions for flashing ESP32-C6](https://github.com/espressif/esp-hosted-mcu/blob/main/docs/esp32_p4_function_ev_board.md#5-flashing-esp32-c6) for more information if you wish to update to a newer version of ESP-Hosted slave firmware. |
| 86 | + |
| 87 | +#### Build, Flash, and Run |
| 88 | + |
| 89 | +Build the project and flash it to the board, then run monitor tool to view serial output: |
| 90 | + |
| 91 | +``` |
| 92 | +idf.py -p PORT build erase-flash flash monitor |
| 93 | +``` |
0 commit comments