From e38d20849e848672b938248982b09f72423344f3 Mon Sep 17 00:00:00 2001 From: Xu Si Yu Date: Wed, 4 Jan 2023 17:29:06 +0800 Subject: [PATCH] openthread: enable br for esp32c2 and esp32c6 --- components/openthread/lib | 2 +- examples/openthread/.build-test-rules.yml | 6 +----- examples/openthread/ot_br/README.md | 4 ++-- examples/openthread/ot_br/main/esp_ot_br.c | 5 +++++ examples/openthread/ot_br/main/esp_ot_config.h | 15 ++++++++++++++- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/components/openthread/lib b/components/openthread/lib index 31136c18c6..7d57b18006 160000 --- a/components/openthread/lib +++ b/components/openthread/lib @@ -1 +1 @@ -Subproject commit 31136c18c6ed890f4a100f7713e3b04ae07702c6 +Subproject commit 7d57b18006da6e182ddb87698abdced1566f3b56 diff --git a/examples/openthread/.build-test-rules.yml b/examples/openthread/.build-test-rules.yml index 069989ac1d..c43a8e5efe 100644 --- a/examples/openthread/.build-test-rules.yml +++ b/examples/openthread/.build-test-rules.yml @@ -1,12 +1,8 @@ # Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps examples/openthread/ot_br: - disable: - - if: IDF_TARGET == "esp32c2" or IDF_TARGET == "esp32c6" - temporary: true - reason: target(s) not supported yet disable_test: - - if: IDF_TARGET in ["esp32", "esp32c3", "esp32s2", "esp32c6"] + - if: IDF_TARGET in ["esp32", "esp32c3", "esp32c2", "esp32c6", "esp32s2"] temporary: true reason: only test on esp32s3 diff --git a/examples/openthread/ot_br/README.md b/examples/openthread/ot_br/README.md index 7e07ddd856..2286a01489 100644 --- a/examples/openthread/ot_br/README.md +++ b/examples/openthread/ot_br/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C3 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | # OpenThread Border Router Example diff --git a/examples/openthread/ot_br/main/esp_ot_br.c b/examples/openthread/ot_br/main/esp_ot_br.c index 8bbb44ed86..6d50eedbbf 100644 --- a/examples/openthread/ot_br/main/esp_ot_br.c +++ b/examples/openthread/ot_br/main/esp_ot_br.c @@ -205,7 +205,12 @@ void app_main(void) // * task queue // * border router esp_vfs_eventfd_config_t eventfd_config = { +#if CONFIG_OPENTHREAD_RADIO_NATIVE + // * radio driver (A native radio device needs a eventfd for radio driver.) + .max_fds = 4, +#else .max_fds = 3, +#endif }; ESP_ERROR_CHECK(esp_vfs_eventfd_register(&eventfd_config)); diff --git a/examples/openthread/ot_br/main/esp_ot_config.h b/examples/openthread/ot_br/main/esp_ot_config.h index 71c961e370..cdf033f985 100644 --- a/examples/openthread/ot_br/main/esp_ot_config.h +++ b/examples/openthread/ot_br/main/esp_ot_config.h @@ -16,6 +16,12 @@ #include "esp_openthread_types.h" +#if CONFIG_OPENTHREAD_RADIO_NATIVE +#define ESP_OPENTHREAD_DEFAULT_RADIO_CONFIG() \ + { \ + .radio_mode = RADIO_MODE_NATIVE, \ + } +#else #define ESP_OPENTHREAD_DEFAULT_RADIO_CONFIG() \ { \ .radio_mode = RADIO_MODE_UART_RCP, \ @@ -35,6 +41,13 @@ .tx_pin = 5, \ }, \ } +#endif + +#if CONFIG_IDF_TARGET_ESP32C2 && CONFIG_XTAL_FREQ_26 +#define HOST_BAUD_RATE 74880 +#else +#define HOST_BAUD_RATE 115200 +#endif #define ESP_OPENTHREAD_DEFAULT_HOST_CONFIG() \ { \ @@ -43,7 +56,7 @@ .port = 0, \ .uart_config = \ { \ - .baud_rate = 115200, \ + .baud_rate = HOST_BAUD_RATE, \ .data_bits = UART_DATA_8_BITS, \ .parity = UART_PARITY_DISABLE, \ .stop_bits = UART_STOP_BITS_1, \