From 2984e14eba7b7efbbeac8480ff8774c2b5faa912 Mon Sep 17 00:00:00 2001 From: luomanruo Date: Mon, 6 Nov 2023 10:45:50 +0800 Subject: [PATCH 1/6] ble(fix): Fixed the issue of not returning memory to the memory pool after deinit callout ble(fix): Fixed the issue of not returning memory to the memory pool after deinit callout --- components/bt/controller/esp32c2/bt.c | 2 +- components/bt/controller/esp32c6/bt.c | 2 +- components/bt/controller/esp32h2/bt.c | 2 +- components/bt/controller/lib_esp32c2/esp32c2-bt-lib | 2 +- components/bt/porting/npl/freertos/src/npl_os_freertos.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/bt/controller/esp32c2/bt.c b/components/bt/controller/esp32c2/bt.c index 0e1622ab80..50b82a7914 100644 --- a/components/bt/controller/esp32c2/bt.c +++ b/components/bt/controller/esp32c2/bt.c @@ -719,10 +719,10 @@ esp_err_t esp_bt_controller_deinit(void) controller_sleep_deinit(); + ble_controller_deinit(); #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED ble_log_deinit_async(); #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED - ble_controller_deinit(); periph_module_disable(PERIPH_BT_MODULE); diff --git a/components/bt/controller/esp32c6/bt.c b/components/bt/controller/esp32c6/bt.c index 0643b525fe..2d63710f2d 100644 --- a/components/bt/controller/esp32c6/bt.c +++ b/components/bt/controller/esp32c6/bt.c @@ -861,10 +861,10 @@ esp_err_t esp_bt_controller_deinit(void) modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE); modem_clock_module_disable(PERIPH_BT_MODULE); + ble_controller_deinit(); #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED ble_log_deinit_async(); #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED - ble_controller_deinit(); #if CONFIG_BT_NIMBLE_ENABLED /* De-initialize default event queue */ diff --git a/components/bt/controller/esp32h2/bt.c b/components/bt/controller/esp32h2/bt.c index b3361bbb69..e6c033bf63 100644 --- a/components/bt/controller/esp32h2/bt.c +++ b/components/bt/controller/esp32h2/bt.c @@ -840,10 +840,10 @@ esp_err_t esp_bt_controller_deinit(void) modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE); modem_clock_module_disable(PERIPH_BT_MODULE); + ble_controller_deinit(); #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED ble_log_deinit_async(); #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED - ble_controller_deinit(); #if CONFIG_BT_NIMBLE_ENABLED /* De-initialize default event queue */ diff --git a/components/bt/controller/lib_esp32c2/esp32c2-bt-lib b/components/bt/controller/lib_esp32c2/esp32c2-bt-lib index ea33fbad1f..11c11f187f 160000 --- a/components/bt/controller/lib_esp32c2/esp32c2-bt-lib +++ b/components/bt/controller/lib_esp32c2/esp32c2-bt-lib @@ -1 +1 @@ -Subproject commit ea33fbad1fa0879fe0e118359d20463b3e2f126b +Subproject commit 11c11f187fc349df8494305c7b308b4d7783d762 diff --git a/components/bt/porting/npl/freertos/src/npl_os_freertos.c b/components/bt/porting/npl/freertos/src/npl_os_freertos.c index 930889dd35..f93b1fc18c 100644 --- a/components/bt/porting/npl/freertos/src/npl_os_freertos.c +++ b/components/bt/porting/npl/freertos/src/npl_os_freertos.c @@ -720,12 +720,12 @@ npl_freertos_callout_deinit(struct ble_npl_callout *co) } #else xTimerDelete(callout->handle, portMAX_DELAY); +#endif // BLE_NPL_USE_ESP_TIMER #if OS_MEM_ALLOC os_memblock_put(&ble_freertos_co_pool,callout); #else free((void *)callout); #endif // OS_MEM_ALLOC -#endif // BLE_NPL_USE_ESP_TIMER co->co = NULL; memset(co, 0, sizeof(struct ble_npl_callout)); } From fcc8ce5de5cc62d07de82d31e67498b5726778c7 Mon Sep 17 00:00:00 2001 From: luomanruo Date: Fri, 17 Nov 2023 16:44:14 +0800 Subject: [PATCH 2/6] ble: update c6 h2 lib to 5b1dfd2b, c2 lib to db4e1fb2 --- components/bt/controller/lib_esp32c2/esp32c2-bt-lib | 2 +- components/bt/controller/lib_esp32c6/esp32c6-bt-lib | 2 +- components/bt/controller/lib_esp32h2/esp32h2-bt-lib | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/bt/controller/lib_esp32c2/esp32c2-bt-lib b/components/bt/controller/lib_esp32c2/esp32c2-bt-lib index 11c11f187f..1e8bbd6f1a 160000 --- a/components/bt/controller/lib_esp32c2/esp32c2-bt-lib +++ b/components/bt/controller/lib_esp32c2/esp32c2-bt-lib @@ -1 +1 @@ -Subproject commit 11c11f187fc349df8494305c7b308b4d7783d762 +Subproject commit 1e8bbd6f1af71b90a2e8130e77ed49dc799031fe diff --git a/components/bt/controller/lib_esp32c6/esp32c6-bt-lib b/components/bt/controller/lib_esp32c6/esp32c6-bt-lib index c32ea6a0c2..932edd189e 160000 --- a/components/bt/controller/lib_esp32c6/esp32c6-bt-lib +++ b/components/bt/controller/lib_esp32c6/esp32c6-bt-lib @@ -1 +1 @@ -Subproject commit c32ea6a0c26025c1da8019d38216613686b4a139 +Subproject commit 932edd189ed4a39de19fb0e0dfc08b26b8785731 diff --git a/components/bt/controller/lib_esp32h2/esp32h2-bt-lib b/components/bt/controller/lib_esp32h2/esp32h2-bt-lib index e4a8094f28..11aa66e7f3 160000 --- a/components/bt/controller/lib_esp32h2/esp32h2-bt-lib +++ b/components/bt/controller/lib_esp32h2/esp32h2-bt-lib @@ -1 +1 @@ -Subproject commit e4a8094f283e4e477d47f590275f5b33d9c8cf74 +Subproject commit 11aa66e7f39c9402039882acb14a993e390f8893 From 11f26f3319008d5c061af4802fdb8f67ac8273b8 Mon Sep 17 00:00:00 2001 From: luomanruo Date: Fri, 17 Nov 2023 11:05:03 +0800 Subject: [PATCH 3/6] ble: update controller log module --- components/bt/controller/esp32c2/bt.c | 14 +++++++------- components/bt/controller/esp32c6/bt.c | 14 +++++++------- components/bt/controller/esp32h2/bt.c | 14 +++++++------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/components/bt/controller/esp32c2/bt.c b/components/bt/controller/esp32c2/bt.c index 50b82a7914..52d9c15d84 100644 --- a/components/bt/controller/esp32c2/bt.c +++ b/components/bt/controller/esp32c2/bt.c @@ -644,6 +644,12 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) coex_init(); #endif + ret = ble_controller_init(cfg); + if (ret != ESP_OK) { + ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_init failed %d", ret); + goto modem_deint; + } + #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED interface_func_t bt_controller_log_interface; bt_controller_log_interface = esp_bt_controller_log_interface; @@ -665,12 +671,6 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) } #endif // CONFIG_BT_CONTROLLER_LOG_ENABLED - ret = ble_controller_init(cfg); - if (ret != ESP_OK) { - ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_init failed %d", ret); - goto modem_deint; - } - ret = controller_sleep_init(); if (ret != ESP_OK) { ESP_LOGW(NIMBLE_PORT_LOG_TAG, "controller_sleep_init failed %d", ret); @@ -691,11 +691,11 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) return ESP_OK; free_controller: controller_sleep_deinit(); - ble_controller_deinit(); modem_deint: #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED ble_log_deinit_async(); #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED + ble_controller_deinit(); esp_phy_modem_deinit(); periph_module_disable(PERIPH_BT_MODULE); #if CONFIG_BT_NIMBLE_ENABLED diff --git a/components/bt/controller/esp32c6/bt.c b/components/bt/controller/esp32c6/bt.c index 2d63710f2d..7e9afe236e 100644 --- a/components/bt/controller/esp32c6/bt.c +++ b/components/bt/controller/esp32c6/bt.c @@ -771,6 +771,12 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) coex_init(); #endif // CONFIG_SW_COEXIST_ENABLE + ret = ble_controller_init(cfg); + if (ret != ESP_OK) { + ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_init failed %d", ret); + goto modem_deint; + } + #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED interface_func_t bt_controller_log_interface; bt_controller_log_interface = esp_bt_controller_log_interface; @@ -792,12 +798,6 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) } #endif // CONFIG_BT_CONTROLLER_LOG_ENABLED - ret = ble_controller_init(cfg); - if (ret != ESP_OK) { - ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_init failed %d", ret); - goto modem_deint; - } - esp_ble_change_rtc_freq(slow_clk_freq); ble_controller_scan_duplicate_config(); @@ -826,11 +826,11 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) free_controller: controller_sleep_deinit(); os_msys_deinit(); - ble_controller_deinit(); modem_deint: #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED ble_log_deinit_async(); #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED + ble_controller_deinit(); esp_phy_modem_deinit(); modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE); modem_clock_module_disable(PERIPH_BT_MODULE); diff --git a/components/bt/controller/esp32h2/bt.c b/components/bt/controller/esp32h2/bt.c index e6c033bf63..86e3e989e1 100644 --- a/components/bt/controller/esp32h2/bt.c +++ b/components/bt/controller/esp32h2/bt.c @@ -751,6 +751,12 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) coex_init(); #endif // CONFIG_SW_COEXIST_ENABLE + ret = ble_controller_init(cfg); + if (ret != ESP_OK) { + ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_init failed %d", ret); + goto modem_deint; + } + #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED interface_func_t bt_controller_log_interface; bt_controller_log_interface = esp_bt_controller_log_interface; @@ -772,12 +778,6 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) } #endif // CONFIG_BT_CONTROLLER_LOG_ENABLED - ret = ble_controller_init(cfg); - if (ret != ESP_OK) { - ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_init failed %d", ret); - goto modem_deint; - } - esp_ble_change_rtc_freq(slow_clk_freq); ble_controller_scan_duplicate_config(); @@ -807,11 +807,11 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) free_controller: controller_sleep_deinit(); os_msys_deinit(); - ble_controller_deinit(); modem_deint: #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED ble_log_deinit_async(); #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED + ble_controller_deinit(); modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE); modem_clock_module_disable(PERIPH_BT_MODULE); #if CONFIG_BT_NIMBLE_ENABLED From 2cf6c185dcc3c40cc92a2195fd6a8c21290fd704 Mon Sep 17 00:00:00 2001 From: luomanruo Date: Tue, 14 Nov 2023 17:43:22 +0800 Subject: [PATCH 4/6] ci(ble/bluedroid): Add notes in sdkconfig.defaults --- examples/bluetooth/bluedroid/ble/ble_ancs/sdkconfig.defaults | 1 + .../bluedroid/ble/ble_compatibility_test/sdkconfig.defaults | 1 + .../bluetooth/bluedroid/ble/ble_eddystone/sdkconfig.defaults | 1 + .../bluedroid/ble/ble_hid_device_demo/sdkconfig.defaults | 1 + examples/bluetooth/bluedroid/ble/ble_ibeacon/sdkconfig.defaults | 1 + .../bluetooth/bluedroid/ble/ble_spp_client/sdkconfig.defaults | 1 + .../bluetooth/bluedroid/ble/ble_spp_server/sdkconfig.defaults | 1 + .../ble/ble_throughput/throughput_client/sdkconfig.defaults | 1 + .../ble/ble_throughput/throughput_server/sdkconfig.defaults | 1 + examples/bluetooth/bluedroid/ble/gatt_client/sdkconfig.defaults | 1 + .../bluedroid/ble/gatt_security_client/sdkconfig.defaults | 1 + .../bluedroid/ble/gatt_security_server/sdkconfig.defaults | 1 + examples/bluetooth/bluedroid/ble/gatt_server/sdkconfig.defaults | 1 + .../bluedroid/ble/gatt_server_service_table/sdkconfig.defaults | 1 + .../bluedroid/ble/gattc_multi_connect/sdkconfig.defaults | 1 + .../bluetooth/bluedroid/coex/gattc_gatts_coex/sdkconfig.defaults | 1 + 16 files changed, 16 insertions(+) diff --git a/examples/bluetooth/bluedroid/ble/ble_ancs/sdkconfig.defaults b/examples/bluetooth/bluedroid/ble/ble_ancs/sdkconfig.defaults index 9391307bcb..1bf8906ea7 100644 --- a/examples/bluetooth/bluedroid/ble/ble_ancs/sdkconfig.defaults +++ b/examples/bluetooth/bluedroid/ble/ble_ancs/sdkconfig.defaults @@ -4,4 +4,5 @@ CONFIG_BT_ENABLED=y CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +# CONFIG_BT_LE_50_FEATURE_SUPPORT is not used on ESP32, ESP32-C3 and ESP32-S3. CONFIG_BT_LE_50_FEATURE_SUPPORT=n diff --git a/examples/bluetooth/bluedroid/ble/ble_compatibility_test/sdkconfig.defaults b/examples/bluetooth/bluedroid/ble/ble_compatibility_test/sdkconfig.defaults index 9391307bcb..1bf8906ea7 100644 --- a/examples/bluetooth/bluedroid/ble/ble_compatibility_test/sdkconfig.defaults +++ b/examples/bluetooth/bluedroid/ble/ble_compatibility_test/sdkconfig.defaults @@ -4,4 +4,5 @@ CONFIG_BT_ENABLED=y CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +# CONFIG_BT_LE_50_FEATURE_SUPPORT is not used on ESP32, ESP32-C3 and ESP32-S3. CONFIG_BT_LE_50_FEATURE_SUPPORT=n diff --git a/examples/bluetooth/bluedroid/ble/ble_eddystone/sdkconfig.defaults b/examples/bluetooth/bluedroid/ble/ble_eddystone/sdkconfig.defaults index 9391307bcb..1bf8906ea7 100644 --- a/examples/bluetooth/bluedroid/ble/ble_eddystone/sdkconfig.defaults +++ b/examples/bluetooth/bluedroid/ble/ble_eddystone/sdkconfig.defaults @@ -4,4 +4,5 @@ CONFIG_BT_ENABLED=y CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +# CONFIG_BT_LE_50_FEATURE_SUPPORT is not used on ESP32, ESP32-C3 and ESP32-S3. CONFIG_BT_LE_50_FEATURE_SUPPORT=n diff --git a/examples/bluetooth/bluedroid/ble/ble_hid_device_demo/sdkconfig.defaults b/examples/bluetooth/bluedroid/ble/ble_hid_device_demo/sdkconfig.defaults index 9391307bcb..1bf8906ea7 100644 --- a/examples/bluetooth/bluedroid/ble/ble_hid_device_demo/sdkconfig.defaults +++ b/examples/bluetooth/bluedroid/ble/ble_hid_device_demo/sdkconfig.defaults @@ -4,4 +4,5 @@ CONFIG_BT_ENABLED=y CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +# CONFIG_BT_LE_50_FEATURE_SUPPORT is not used on ESP32, ESP32-C3 and ESP32-S3. CONFIG_BT_LE_50_FEATURE_SUPPORT=n diff --git a/examples/bluetooth/bluedroid/ble/ble_ibeacon/sdkconfig.defaults b/examples/bluetooth/bluedroid/ble/ble_ibeacon/sdkconfig.defaults index 9391307bcb..1bf8906ea7 100644 --- a/examples/bluetooth/bluedroid/ble/ble_ibeacon/sdkconfig.defaults +++ b/examples/bluetooth/bluedroid/ble/ble_ibeacon/sdkconfig.defaults @@ -4,4 +4,5 @@ CONFIG_BT_ENABLED=y CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +# CONFIG_BT_LE_50_FEATURE_SUPPORT is not used on ESP32, ESP32-C3 and ESP32-S3. CONFIG_BT_LE_50_FEATURE_SUPPORT=n diff --git a/examples/bluetooth/bluedroid/ble/ble_spp_client/sdkconfig.defaults b/examples/bluetooth/bluedroid/ble/ble_spp_client/sdkconfig.defaults index 9391307bcb..1bf8906ea7 100644 --- a/examples/bluetooth/bluedroid/ble/ble_spp_client/sdkconfig.defaults +++ b/examples/bluetooth/bluedroid/ble/ble_spp_client/sdkconfig.defaults @@ -4,4 +4,5 @@ CONFIG_BT_ENABLED=y CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +# CONFIG_BT_LE_50_FEATURE_SUPPORT is not used on ESP32, ESP32-C3 and ESP32-S3. CONFIG_BT_LE_50_FEATURE_SUPPORT=n diff --git a/examples/bluetooth/bluedroid/ble/ble_spp_server/sdkconfig.defaults b/examples/bluetooth/bluedroid/ble/ble_spp_server/sdkconfig.defaults index 9391307bcb..1bf8906ea7 100644 --- a/examples/bluetooth/bluedroid/ble/ble_spp_server/sdkconfig.defaults +++ b/examples/bluetooth/bluedroid/ble/ble_spp_server/sdkconfig.defaults @@ -4,4 +4,5 @@ CONFIG_BT_ENABLED=y CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +# CONFIG_BT_LE_50_FEATURE_SUPPORT is not used on ESP32, ESP32-C3 and ESP32-S3. CONFIG_BT_LE_50_FEATURE_SUPPORT=n diff --git a/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_client/sdkconfig.defaults b/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_client/sdkconfig.defaults index 8676c818a3..e580bb1529 100644 --- a/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_client/sdkconfig.defaults +++ b/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_client/sdkconfig.defaults @@ -4,6 +4,7 @@ CONFIG_BT_ENABLED=y CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +# CONFIG_BT_LE_50_FEATURE_SUPPORT is not used on ESP32, ESP32-C3 and ESP32-S3. CONFIG_BT_LE_50_FEATURE_SUPPORT=n CONFIG_GATTS_NOTIFY_THROUGHPUT=y CONFIG_GATTC_WRITE_THROUGHPUT=n diff --git a/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_server/sdkconfig.defaults b/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_server/sdkconfig.defaults index 58af7f81e6..1decbd1f1d 100644 --- a/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_server/sdkconfig.defaults +++ b/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_server/sdkconfig.defaults @@ -6,4 +6,5 @@ CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT=n CONFIG_BT_ENABLED=y CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +# CONFIG_BT_LE_50_FEATURE_SUPPORT is not used on ESP32, ESP32-C3 and ESP32-S3. CONFIG_BT_LE_50_FEATURE_SUPPORT=n diff --git a/examples/bluetooth/bluedroid/ble/gatt_client/sdkconfig.defaults b/examples/bluetooth/bluedroid/ble/gatt_client/sdkconfig.defaults index 9391307bcb..1bf8906ea7 100644 --- a/examples/bluetooth/bluedroid/ble/gatt_client/sdkconfig.defaults +++ b/examples/bluetooth/bluedroid/ble/gatt_client/sdkconfig.defaults @@ -4,4 +4,5 @@ CONFIG_BT_ENABLED=y CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +# CONFIG_BT_LE_50_FEATURE_SUPPORT is not used on ESP32, ESP32-C3 and ESP32-S3. CONFIG_BT_LE_50_FEATURE_SUPPORT=n diff --git a/examples/bluetooth/bluedroid/ble/gatt_security_client/sdkconfig.defaults b/examples/bluetooth/bluedroid/ble/gatt_security_client/sdkconfig.defaults index 9391307bcb..1bf8906ea7 100644 --- a/examples/bluetooth/bluedroid/ble/gatt_security_client/sdkconfig.defaults +++ b/examples/bluetooth/bluedroid/ble/gatt_security_client/sdkconfig.defaults @@ -4,4 +4,5 @@ CONFIG_BT_ENABLED=y CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +# CONFIG_BT_LE_50_FEATURE_SUPPORT is not used on ESP32, ESP32-C3 and ESP32-S3. CONFIG_BT_LE_50_FEATURE_SUPPORT=n diff --git a/examples/bluetooth/bluedroid/ble/gatt_security_server/sdkconfig.defaults b/examples/bluetooth/bluedroid/ble/gatt_security_server/sdkconfig.defaults index 9391307bcb..1bf8906ea7 100644 --- a/examples/bluetooth/bluedroid/ble/gatt_security_server/sdkconfig.defaults +++ b/examples/bluetooth/bluedroid/ble/gatt_security_server/sdkconfig.defaults @@ -4,4 +4,5 @@ CONFIG_BT_ENABLED=y CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +# CONFIG_BT_LE_50_FEATURE_SUPPORT is not used on ESP32, ESP32-C3 and ESP32-S3. CONFIG_BT_LE_50_FEATURE_SUPPORT=n diff --git a/examples/bluetooth/bluedroid/ble/gatt_server/sdkconfig.defaults b/examples/bluetooth/bluedroid/ble/gatt_server/sdkconfig.defaults index 9391307bcb..1bf8906ea7 100644 --- a/examples/bluetooth/bluedroid/ble/gatt_server/sdkconfig.defaults +++ b/examples/bluetooth/bluedroid/ble/gatt_server/sdkconfig.defaults @@ -4,4 +4,5 @@ CONFIG_BT_ENABLED=y CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +# CONFIG_BT_LE_50_FEATURE_SUPPORT is not used on ESP32, ESP32-C3 and ESP32-S3. CONFIG_BT_LE_50_FEATURE_SUPPORT=n diff --git a/examples/bluetooth/bluedroid/ble/gatt_server_service_table/sdkconfig.defaults b/examples/bluetooth/bluedroid/ble/gatt_server_service_table/sdkconfig.defaults index 9391307bcb..1bf8906ea7 100644 --- a/examples/bluetooth/bluedroid/ble/gatt_server_service_table/sdkconfig.defaults +++ b/examples/bluetooth/bluedroid/ble/gatt_server_service_table/sdkconfig.defaults @@ -4,4 +4,5 @@ CONFIG_BT_ENABLED=y CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +# CONFIG_BT_LE_50_FEATURE_SUPPORT is not used on ESP32, ESP32-C3 and ESP32-S3. CONFIG_BT_LE_50_FEATURE_SUPPORT=n diff --git a/examples/bluetooth/bluedroid/ble/gattc_multi_connect/sdkconfig.defaults b/examples/bluetooth/bluedroid/ble/gattc_multi_connect/sdkconfig.defaults index 9391307bcb..1bf8906ea7 100644 --- a/examples/bluetooth/bluedroid/ble/gattc_multi_connect/sdkconfig.defaults +++ b/examples/bluetooth/bluedroid/ble/gattc_multi_connect/sdkconfig.defaults @@ -4,4 +4,5 @@ CONFIG_BT_ENABLED=y CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +# CONFIG_BT_LE_50_FEATURE_SUPPORT is not used on ESP32, ESP32-C3 and ESP32-S3. CONFIG_BT_LE_50_FEATURE_SUPPORT=n diff --git a/examples/bluetooth/bluedroid/coex/gattc_gatts_coex/sdkconfig.defaults b/examples/bluetooth/bluedroid/coex/gattc_gatts_coex/sdkconfig.defaults index 9391307bcb..1bf8906ea7 100644 --- a/examples/bluetooth/bluedroid/coex/gattc_gatts_coex/sdkconfig.defaults +++ b/examples/bluetooth/bluedroid/coex/gattc_gatts_coex/sdkconfig.defaults @@ -4,4 +4,5 @@ CONFIG_BT_ENABLED=y CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y +# CONFIG_BT_LE_50_FEATURE_SUPPORT is not used on ESP32, ESP32-C3 and ESP32-S3. CONFIG_BT_LE_50_FEATURE_SUPPORT=n From 9cf6280eeaeadcc1ac89e39076d4a7490c9ae51f Mon Sep 17 00:00:00 2001 From: zwl Date: Fri, 17 Nov 2023 17:30:57 +0800 Subject: [PATCH 5/6] fix(ble): fixed ble occasional rx exception issue --- components/esp_phy/src/phy_init.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/esp_phy/src/phy_init.c b/components/esp_phy/src/phy_init.c index 77971813aa..2c330879ca 100644 --- a/components/esp_phy/src/phy_init.c +++ b/components/esp_phy/src/phy_init.c @@ -781,7 +781,11 @@ void esp_phy_load_cal_and_init(void) // Set PHY whether in combo module // For comode mode, phy enable will be not in WiFi RX state #if SOC_PHY_COMBO_MODULE +#if CONFIG_IDF_TARGET_ESP32C2 + phy_init_param_set(1); +#else phy_init_param_set(0); +#endif #endif esp_phy_calibration_data_t* cal_data = From d24f7d9f12a06726a8bbbe71d0272cd6900b5057 Mon Sep 17 00:00:00 2001 From: luomanruo Date: Fri, 17 Nov 2023 20:35:12 +0800 Subject: [PATCH 6/6] ble(fix): deinit crash issue --- components/bt/controller/esp32c2/bt.c | 7 ++++--- components/bt/controller/esp32c6/bt.c | 9 +++++---- components/bt/controller/esp32h2/bt.c | 9 +++++---- components/bt/controller/lib_esp32c6/esp32c6-bt-lib | 2 +- components/bt/controller/lib_esp32h2/esp32h2-bt-lib | 2 +- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/components/bt/controller/esp32c2/bt.c b/components/bt/controller/esp32c2/bt.c index 52d9c15d84..822cc70323 100644 --- a/components/bt/controller/esp32c2/bt.c +++ b/components/bt/controller/esp32c2/bt.c @@ -667,7 +667,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) #endif // CONFIG_BT_CONTROLLER_LOG_DUMP if (ret != ESP_OK) { ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret); - goto modem_deint; + goto controller_init_err; } #endif // CONFIG_BT_CONTROLLER_LOG_ENABLED @@ -691,11 +691,12 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) return ESP_OK; free_controller: controller_sleep_deinit(); -modem_deint: #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED +controller_init_err: ble_log_deinit_async(); #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED ble_controller_deinit(); +modem_deint: esp_phy_modem_deinit(); periph_module_disable(PERIPH_BT_MODULE); #if CONFIG_BT_NIMBLE_ENABLED @@ -719,10 +720,10 @@ esp_err_t esp_bt_controller_deinit(void) controller_sleep_deinit(); - ble_controller_deinit(); #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED ble_log_deinit_async(); #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED + ble_controller_deinit(); periph_module_disable(PERIPH_BT_MODULE); diff --git a/components/bt/controller/esp32c6/bt.c b/components/bt/controller/esp32c6/bt.c index 7e9afe236e..716337982f 100644 --- a/components/bt/controller/esp32c6/bt.c +++ b/components/bt/controller/esp32c6/bt.c @@ -794,7 +794,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) #endif // CONFIG_BT_CONTROLLER_LOG_DUMP if (ret != ESP_OK) { ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret); - goto modem_deint; + goto controller_init_err; } #endif // CONFIG_BT_CONTROLLER_LOG_ENABLED @@ -825,12 +825,13 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) free_controller: controller_sleep_deinit(); - os_msys_deinit(); -modem_deint: #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED +controller_init_err: ble_log_deinit_async(); #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED + os_msys_deinit(); ble_controller_deinit(); +modem_deint: esp_phy_modem_deinit(); modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE); modem_clock_module_disable(PERIPH_BT_MODULE); @@ -861,10 +862,10 @@ esp_err_t esp_bt_controller_deinit(void) modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE); modem_clock_module_disable(PERIPH_BT_MODULE); - ble_controller_deinit(); #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED ble_log_deinit_async(); #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED + ble_controller_deinit(); #if CONFIG_BT_NIMBLE_ENABLED /* De-initialize default event queue */ diff --git a/components/bt/controller/esp32h2/bt.c b/components/bt/controller/esp32h2/bt.c index 86e3e989e1..d5b0c4bc1a 100644 --- a/components/bt/controller/esp32h2/bt.c +++ b/components/bt/controller/esp32h2/bt.c @@ -774,7 +774,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) #endif // CONFIG_BT_CONTROLLER_LOG_DUMP if (ret != ESP_OK) { ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret); - goto modem_deint; + goto controller_init_err; } #endif // CONFIG_BT_CONTROLLER_LOG_ENABLED @@ -806,12 +806,13 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) free_controller: controller_sleep_deinit(); - os_msys_deinit(); -modem_deint: #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED +controller_init_err: ble_log_deinit_async(); #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED + os_msys_deinit(); ble_controller_deinit(); +modem_deint: modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE); modem_clock_module_disable(PERIPH_BT_MODULE); #if CONFIG_BT_NIMBLE_ENABLED @@ -840,10 +841,10 @@ esp_err_t esp_bt_controller_deinit(void) modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE); modem_clock_module_disable(PERIPH_BT_MODULE); - ble_controller_deinit(); #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED ble_log_deinit_async(); #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED + ble_controller_deinit(); #if CONFIG_BT_NIMBLE_ENABLED /* De-initialize default event queue */ diff --git a/components/bt/controller/lib_esp32c6/esp32c6-bt-lib b/components/bt/controller/lib_esp32c6/esp32c6-bt-lib index 932edd189e..e70c4abbd5 160000 --- a/components/bt/controller/lib_esp32c6/esp32c6-bt-lib +++ b/components/bt/controller/lib_esp32c6/esp32c6-bt-lib @@ -1 +1 @@ -Subproject commit 932edd189ed4a39de19fb0e0dfc08b26b8785731 +Subproject commit e70c4abbd5666afac3b7b3cea1c3d9c59ee33ce9 diff --git a/components/bt/controller/lib_esp32h2/esp32h2-bt-lib b/components/bt/controller/lib_esp32h2/esp32h2-bt-lib index 11aa66e7f3..66303b4a8c 160000 --- a/components/bt/controller/lib_esp32h2/esp32h2-bt-lib +++ b/components/bt/controller/lib_esp32h2/esp32h2-bt-lib @@ -1 +1 @@ -Subproject commit 11aa66e7f39c9402039882acb14a993e390f8893 +Subproject commit 66303b4a8cc8e889a0c9bdd7301582ba2cb8b0eb