mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/thread_ethernet_border_router' into 'master'
Feature: add Thread-Ethernet border router option See merge request espressif/esp-idf!20285
This commit is contained in:
commit
6ca5db14fa
@ -10,11 +10,11 @@ This example demonstrates an [OpenThread border router](https://openthread.io/gu
|
||||
## How to use example
|
||||
|
||||
### Hardware Required
|
||||
|
||||
#### **Wi-Fi based Thread Border Router**
|
||||
The following SoCs are required to run this example:
|
||||
* An ESP32 series Wi-Fi SoC (ESP32, ESP32-C, ESP32-S, etc) loaded with this ot_br example.
|
||||
* An ESP32-H2 802.15.4 SoC loaded with [ot_rcp](../ot_rcp) example.
|
||||
* Another ESP32-H2 SoC loaded with [ot_cli](../ot_cli) example. Enable `OPENTHREAD_JOINER` option in menuconfig before compiling the example.
|
||||
* Another ESP32-H2 SoC loaded with [ot_cli](../ot_cli) example.
|
||||
|
||||
Connect the two SoCs via UART, below is an example setup with ESP32 DevKitC and ESP32-H2 DevKitC:
|
||||
![thread_br](image/thread-border-router-esp32-esp32h2.jpg)
|
||||
@ -25,6 +25,9 @@ ESP32 pin | ESP32-H2 pin
|
||||
GPIO4 | TX
|
||||
GPIO5 | RX
|
||||
|
||||
#### **Ethernet based Thread Border Router**
|
||||
Similar to the previous Wi-Fi based Thread Border Route setup, but a device with Ethernet interface is required, such as [ESP32-Ethernet-Kit](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-ethernet-kit.html)
|
||||
|
||||
### Configure the project
|
||||
|
||||
```
|
||||
@ -39,6 +42,8 @@ The device will connect to Wi-Fi and form a Thread network automatically after b
|
||||
- Manual mode
|
||||
Disable `OPENTHREAD_BR_AUTO_START` and enable `OPENTHREAD_CLI_ESP_EXTENSION`. `wifi` command will be added for connecting the device to the Wi-Fi network.
|
||||
|
||||
If the `CONFIG_EXAMPLE_CONNECT_ETHERNET` option is enabled, the device will connect to `Ethernet`, form a Thread network and act as a Ethernet based Thread Border Router.
|
||||
|
||||
### Build, Flash, and Run
|
||||
|
||||
Build the project and flash it to the board, then run monitor tool to view serial output:
|
||||
|
@ -213,6 +213,7 @@ void app_main(void)
|
||||
ESP_ERROR_CHECK(esp_netif_init());
|
||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||
|
||||
#if CONFIG_EXAMPLE_CONNECT_WIFI
|
||||
#if CONFIG_OPENTHREAD_BR_AUTO_START
|
||||
ESP_ERROR_CHECK(example_connect());
|
||||
ESP_ERROR_CHECK(esp_wifi_set_ps(WIFI_PS_NONE));
|
||||
@ -221,6 +222,13 @@ void app_main(void)
|
||||
esp_ot_wifi_netif_init();
|
||||
esp_openthread_set_backbone_netif(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF"));
|
||||
#endif // CONFIG_OPENTHREAD_BR_AUTO_START
|
||||
#elif CONFIG_EXAMPLE_CONNECT_ETHERNET
|
||||
ESP_ERROR_CHECK(example_connect());
|
||||
esp_openthread_set_backbone_netif(get_example_netif());
|
||||
#else
|
||||
ESP_LOGE(TAG, "ESP-Openthread has not set backbone netif");
|
||||
#endif // CONFIG_EXAMPLE_CONNECT_WIFI
|
||||
|
||||
ESP_ERROR_CHECK(mdns_init());
|
||||
ESP_ERROR_CHECK(mdns_hostname_set("esp-ot-br"));
|
||||
xTaskCreate(ot_task_worker, "ot_br_main", 20480, xTaskGetCurrentTaskHandle(), 5, NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user