Sfoglia il codice sorgente

Merge branch 'feature/support_c6_single_chip_br' into 'master'

openthread border router: support c6 single chip br

See merge request espressif/esp-idf!22776
Shu Chen 2 anni fa
parent
commit
c43b8f9607

+ 8 - 0
components/esp_coex/include/esp_coexist.h

@@ -201,6 +201,14 @@ esp_err_t esp_external_coex_set_validate_high(bool is_high_valid);
 #endif
 #endif
 
+#if CONFIG_ESP_COEX_SW_COEXIST_ENABLE && CONFIG_SOC_IEEE802154_SUPPORTED
+/**
+ * @brief Enable Wi-Fi and 802.15.4 coexistence.
+ * @return : ESP_OK - success, other - failed
+ */
+esp_err_t esp_coex_wifi_i154_enable(void);
+#endif
+
 #ifdef __cplusplus
 }
 #endif

+ 11 - 0
components/esp_coex/src/coexist.c

@@ -395,3 +395,14 @@ esp_err_t esp_disable_extern_coex_gpio_pin()
     return ESP_OK;
 }
 #endif/*External Coex*/
+
+#if CONFIG_ESP_COEX_SW_COEXIST_ENABLE && CONFIG_SOC_IEEE802154_SUPPORTED
+esp_err_t esp_coex_wifi_i154_enable(void)
+{
+    // TODO: Add a scheme for wifi and 154 coex.
+    // Remove this function if FCC-50 closes.
+    coex_enable();
+    coex_schm_status_bit_set(1, 1);
+    return ESP_OK;
+}
+#endif

+ 10 - 1
examples/openthread/ot_br/README.md

@@ -7,11 +7,16 @@
 
 This example demonstrates an [OpenThread border router](https://openthread.io/guides/border-router).
 
+The ESP Thread Border Router SDK provides extra components and examples for putting the ESP Thread Border Router solution into production:
+
+* [ESP Thread Border Router Docs](https://docs.espressif.com/projects/esp-thread-br)
+* [ESP Thread Border Router Repo](https://github.com/espressif/esp-thread-br)
+
 ## How to use example
 
 ### Hardware Required
 #### **Wi-Fi based Thread Border Router**
-The following SoCs are required to run this example:
+By default, two 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-H4 802.15.4 SoC loaded with [ot_rcp](../ot_rcp) example.
 * Another ESP32-H4 SoC loaded with [ot_cli](../ot_cli) example.
@@ -25,6 +30,8 @@ ESP32 pin | ESP32-H4 pin
    GPIO4  |      TX
    GPIO5  |      RX
 
+The example could also run on a single SoC which supports both Wi-Fi and Thread (e.g., ESP32-C6), but since there is only one RF path in ESP32-C6, which means Wi-Fi and Thread can't receive simultaneously, it has a significant impact on performance. Hence the two SoCs solution is recommended.
+
 #### **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)
 
@@ -33,6 +40,8 @@ Similar to the previous Wi-Fi based Thread Border Route setup, but a device with
 ```
 idf.py menuconfig
 ```
+In order to run the example on single SoC which supports both Wi-Fi and Thread, the option `CONFIG_ESP_COEX_SW_COEXIST_ENABLE` and option `CONFIG_OPENTHREAD_RADIO_NATIVE` should be enabled. The two options are enabled by default for ESP32-C6 target.
+
 Two ways are provided to setup the Thread Border Router in this example:
 
 - Auto Start

+ 6 - 0
examples/openthread/ot_br/main/esp_ot_br.c

@@ -34,6 +34,7 @@
 #include "esp_vfs_dev.h"
 #include "esp_vfs_eventfd.h"
 #include "esp_wifi.h"
+#include "esp_coexist.h"
 #include "mdns.h"
 #include "nvs_flash.h"
 #include "protocol_examples_common.h"
@@ -221,7 +222,12 @@ void app_main(void)
 #if CONFIG_EXAMPLE_CONNECT_WIFI
 #if CONFIG_OPENTHREAD_BR_AUTO_START
     ESP_ERROR_CHECK(example_connect());
+#if CONFIG_ESP_COEX_SW_COEXIST_ENABLE && CONFIG_OPENTHREAD_RADIO_NATIVE
+    ESP_ERROR_CHECK(esp_wifi_set_ps(WIFI_PS_MIN_MODEM));
+    ESP_ERROR_CHECK(esp_coex_wifi_i154_enable());
+#else
     ESP_ERROR_CHECK(esp_wifi_set_ps(WIFI_PS_NONE));
+#endif
     esp_openthread_set_backbone_netif(get_example_netif());
 #else
     esp_ot_wifi_netif_init();

+ 1 - 1
examples/openthread/ot_br/main/idf_component.yml

@@ -1,7 +1,7 @@
 ## IDF Component Manager Manifest File
 dependencies:
   espressif/esp_ot_cli_extension:
-    version: "~0.3.0"
+    version: "~0.4.0"
   espressif/mdns: "^1.0.3"
   ## Required IDF version
   idf:

+ 1 - 1
examples/openthread/ot_cli/main/idf_component.yml

@@ -1,6 +1,6 @@
 ## IDF Component Manager Manifest File
 dependencies:
   espressif/esp_ot_cli_extension:
-    version: "~0.3.0"
+    version: "~0.4.0"
   idf:
     version: ">=4.1.0"