From 093a5210486068eb666919cec9424d98c1fd25a7 Mon Sep 17 00:00:00 2001 From: zhiweijian Date: Wed, 22 Apr 2026 19:27:19 +0800 Subject: [PATCH 1/4] feat(ble): Supported blufi on esp32s31 --- components/soc/esp32s31/include/soc/Kconfig.soc_caps.in | 4 ++++ components/soc/esp32s31/include/soc/soc_caps.h | 2 +- examples/bluetooth/blufi/README.md | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/components/soc/esp32s31/include/soc/Kconfig.soc_caps.in b/components/soc/esp32s31/include/soc/Kconfig.soc_caps.in index 14800b09034..2976c50975f 100644 --- a/components/soc/esp32s31/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32s31/include/soc/Kconfig.soc_caps.in @@ -1235,6 +1235,10 @@ config SOC_BLE_PERIODIC_ADV_ENH_SUPPORTED bool default y +config SOC_BLUFI_SUPPORTED + bool + default y + config SOC_BLE_CTE_SUPPORTED bool default y diff --git a/components/soc/esp32s31/include/soc/soc_caps.h b/components/soc/esp32s31/include/soc/soc_caps.h index 7b45d31de55..e4690b6d94f 100644 --- a/components/soc/esp32s31/include/soc/soc_caps.h +++ b/components/soc/esp32s31/include/soc/soc_caps.h @@ -510,7 +510,7 @@ #define SOC_BLE_POWER_CONTROL_SUPPORTED (1) /*!< Support Bluetooth Power Control */ #define SOC_BLE_MULTI_CONN_OPTIMIZATION (1) /*!< Support multiple connections optimization */ #define SOC_BLE_PERIODIC_ADV_ENH_SUPPORTED (1) /*!< Support For BLE Periodic Adv Enhancements */ -// #define SOC_BLUFI_SUPPORTED (1) // TODO: enable this feature coexistence is supported +#define SOC_BLUFI_SUPPORTED (1) /*!< Support BLUFI */ #define SOC_BLE_CTE_SUPPORTED (1) /*!< Support Bluetooth LE Constant Tone Extension (CTE) */ #define SOC_BLE_SUBRATE_SUPPORTED (1) /*!< Support Bluetooth LE Connection Subrating */ #define SOC_BLE_PERIODIC_ADV_WITH_RESPONSE (1) /*!< Support Bluetooth LE Periodic Advertising with Response (PAwR) */ diff --git a/examples/bluetooth/blufi/README.md b/examples/bluetooth/blufi/README.md index 6534187eb95..e99f8ad8a08 100644 --- a/examples/bluetooth/blufi/README.md +++ b/examples/bluetooth/blufi/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S3 | ESP32-S31 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | --------- | # ESP-IDF Blufi Example From 666c1894c5f51b754d8b84050c90c3bd0dcf0f7d Mon Sep 17 00:00:00 2001 From: zhiweijian Date: Wed, 22 Apr 2026 19:33:29 +0800 Subject: [PATCH 2/4] fix(ble/bluedroid): Fixed init crash when bluedroid BLE is enabled in BREDR only mode --- components/bt/host/bluedroid/Kconfig.in | 2 +- components/bt/host/bluedroid/device/controller.c | 9 +++++++-- components/bt/host/bluedroid/stack/btm/btm_ble_privacy.c | 4 ++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/components/bt/host/bluedroid/Kconfig.in b/components/bt/host/bluedroid/Kconfig.in index 3fb9211179a..06c24f6d823 100644 --- a/components/bt/host/bluedroid/Kconfig.in +++ b/components/bt/host/bluedroid/Kconfig.in @@ -272,7 +272,7 @@ config BT_GOEPC_ENABLED config BT_BLE_ENABLED bool "Bluetooth Low Energy" - depends on BT_BLUEDROID_ENABLED + depends on BT_BLUEDROID_ENABLED && (!BTDM_CTRL_MODE_BR_EDR_ONLY) default y help This enables Bluetooth Low Energy diff --git a/components/bt/host/bluedroid/device/controller.c b/components/bt/host/bluedroid/device/controller.c index 0aa677fc558..d2076102e9b 100644 --- a/components/bt/host/bluedroid/device/controller.c +++ b/components/bt/host/bluedroid/device/controller.c @@ -234,7 +234,10 @@ static void start_up(void) #if (BLE_INCLUDED == TRUE) #if (CLASSIC_BT_INCLUDED) controller_param.ble_supported = controller_param.last_features_classic_page_index >= 1 && HCI_LE_HOST_SUPPORTED(controller_param.features_classic[1].as_array); -#else + if (!controller_param.ble_supported) { + LOG_ERROR("Controller does not support BLE, please disable host BLE"); + } + #else controller_param.ble_supported = true; #endif if (controller_param.ble_supported) { @@ -508,7 +511,9 @@ static uint16_t get_acl_packet_size_ble(void) static uint16_t get_ble_suggested_default_data_length(void) { assert(controller_param.readable); - assert(controller_param.ble_supported); + if (!controller_param.ble_supported) { + return 0; + } return controller_param.ble_suggested_default_data_length; } diff --git a/components/bt/host/bluedroid/stack/btm/btm_ble_privacy.c b/components/bt/host/bluedroid/stack/btm/btm_ble_privacy.c index 45f3af5bcd3..8bc6446f50c 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_ble_privacy.c +++ b/components/bt/host/bluedroid/stack/btm/btm_ble_privacy.c @@ -1201,6 +1201,10 @@ void btm_ble_resolving_list_cleanup(void) #if (CONTROLLER_RPA_LIST_ENABLE == TRUE) void btm_ble_add_default_entry_to_resolving_list(void) { + const controller_t *controller = controller_get_interface(); + if (!controller->supports_ble()) { + return; + } /* * Add local IRK entry with 00:00:00:00:00:00 address. This entry will * be used to generate RPA for non-directed advertising if own_addr_type From 730366b0201f3d91f98e3621643a8bc3f0bc495c Mon Sep 17 00:00:00 2001 From: Rahul Tank Date: Fri, 24 Apr 2026 11:37:21 +0530 Subject: [PATCH 3/4] fix(nimble): Fix blufi compilation issue for esp32s31 --- components/bt/host/nimble/nimble | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/host/nimble/nimble b/components/bt/host/nimble/nimble index 44a5bbb58c2..04b35e4069a 160000 --- a/components/bt/host/nimble/nimble +++ b/components/bt/host/nimble/nimble @@ -1 +1 @@ -Subproject commit 44a5bbb58c22b3b6ad2b7773fc96b3a371fa22e6 +Subproject commit 04b35e4069a2670113e3a321eab725c59c6e80c2 From bc43eedc35d59e8bef35356940d1694c20e74de4 Mon Sep 17 00:00:00 2001 From: zhiweijian Date: Fri, 24 Apr 2026 14:43:14 +0800 Subject: [PATCH 4/4] fix(ble/bluedroid): Changed sdkconfig.default in ble_get_started examples --- .../bluedroid/Bluedroid_Beacon/sdkconfig.defaults | 5 +++++ .../bluedroid/Bluedroid_Connection/sdkconfig.defaults | 4 ++++ .../bluedroid/Bluedroid_GATT_Server/sdkconfig.defaults | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/examples/bluetooth/ble_get_started/bluedroid/Bluedroid_Beacon/sdkconfig.defaults b/examples/bluetooth/ble_get_started/bluedroid/Bluedroid_Beacon/sdkconfig.defaults index 73d84284854..72fc4eb4766 100644 --- a/examples/bluetooth/ble_get_started/bluedroid/Bluedroid_Beacon/sdkconfig.defaults +++ b/examples/bluetooth/ble_get_started/bluedroid/Bluedroid_Beacon/sdkconfig.defaults @@ -6,3 +6,8 @@ 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 is not set +# CONFIG_BT_GATTC_ENABLE is not set +# CONFIG_BT_GATTS_ENABLE is not set +# CONFIG_BT_BLE_SMP_ENABLE is not set +# CONFIG_BT_BLE_42_DTM_TEST_EN is not set +# CONFIG_BT_BLE_42_SCAN_EN is not set diff --git a/examples/bluetooth/ble_get_started/bluedroid/Bluedroid_Connection/sdkconfig.defaults b/examples/bluetooth/ble_get_started/bluedroid/Bluedroid_Connection/sdkconfig.defaults index 73d84284854..63060438e9a 100644 --- a/examples/bluetooth/ble_get_started/bluedroid/Bluedroid_Connection/sdkconfig.defaults +++ b/examples/bluetooth/ble_get_started/bluedroid/Bluedroid_Connection/sdkconfig.defaults @@ -6,3 +6,7 @@ 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 is not set +# CONFIG_BT_GATTC_ENABLE is not set +# CONFIG_BT_BLE_SMP_ENABLE is not set +# CONFIG_BT_BLE_42_DTM_TEST_EN is not set +# CONFIG_BT_BLE_42_SCAN_EN is not set diff --git a/examples/bluetooth/ble_get_started/bluedroid/Bluedroid_GATT_Server/sdkconfig.defaults b/examples/bluetooth/ble_get_started/bluedroid/Bluedroid_GATT_Server/sdkconfig.defaults index 8942978335d..fdfbd99ce25 100644 --- a/examples/bluetooth/ble_get_started/bluedroid/Bluedroid_GATT_Server/sdkconfig.defaults +++ b/examples/bluetooth/ble_get_started/bluedroid/Bluedroid_GATT_Server/sdkconfig.defaults @@ -7,3 +7,7 @@ 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 is not set CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y +# CONFIG_BT_GATTC_ENABLE is not set +# CONFIG_BT_BLE_SMP_ENABLE is not set +# CONFIG_BT_BLE_42_DTM_TEST_EN is not set +# CONFIG_BT_BLE_42_SCAN_EN is not set