Skip to content

Commit

Permalink
Merge branch 'feature/add_support_for_c6_br' into 'master'
Browse files Browse the repository at this point in the history
openthread:  enable br for esp32c2 and esp32c6

See merge request espressif/esp-idf!21935
  • Loading branch information
chshu committed Jan 16, 2023
2 parents 1157657 + e38d208 commit 46a1165
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
6 changes: 1 addition & 5 deletions examples/openthread/.build-test-rules.yml
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions examples/openthread/ot_br/README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 5 additions & 0 deletions examples/openthread/ot_br/main/esp_ot_br.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
15 changes: 14 additions & 1 deletion examples/openthread/ot_br/main/esp_ot_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
Expand All @@ -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() \
{ \
Expand All @@ -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, \
Expand Down

0 comments on commit 46a1165

Please sign in to comment.