From 01d9a716b919c8ee3aec64b6d6128ad8ee3e6e8a Mon Sep 17 00:00:00 2001 From: chenjianhua Date: Wed, 11 Sep 2024 17:21:36 +0800 Subject: [PATCH 1/5] fix(bt): Update bt lib for ESP32(ba6739f) - Fixed assert in lld_evt.c at line 2353 - Fixed interrupt WDT when shutdown bt controller - Added config for BLE vendor HCI QA command - Added config for BLE channel assessment and ping procedure --- components/bt/controller/esp32/Kconfig.in | 23 +++++++++++++++++++ components/bt/controller/esp32/bt.c | 6 +++++ components/bt/controller/lib_esp32 | 2 +- components/bt/include/esp32/include/esp_bt.h | 18 ++++++++++++++- .../hal/esp32/include/hal/clk_gate_ll.h | 2 ++ 5 files changed, 49 insertions(+), 2 deletions(-) diff --git a/components/bt/controller/esp32/Kconfig.in b/components/bt/controller/esp32/Kconfig.in index 8855fb062f..b93200209a 100644 --- a/components/bt/controller/esp32/Kconfig.in +++ b/components/bt/controller/esp32/Kconfig.in @@ -467,6 +467,29 @@ menu "BLE disconnect when instant passed" when instant passed in channel map update procedure. endmenu +config BTDM_BLE_CHAN_ASS_EN + bool "Enable channel assessment" + depends on (BTDM_CTRL_MODE_BLE_ONLY || BTDM_CTRL_MODE_BTDM) + default y + help + If this option is enabled, The Controller will records the communication quality + for each channel and then start a timer to check and update the channel map every 4 seconds. + +config BTDM_BLE_PING_EN + bool "Enable LE Ping procedure" + depends on (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY) + default y + help + If this option is disabled, The Controller will not start the LE authenticated payload timer. + This option is used for some compatibility problems related to LE ping procedure. + +config BTDM_BLE_VS_QA_SUPPORT + bool "BLE vendor HCI QA support" + depends on (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY) + default n + help + This enables BLE vendor HCI command and event for QA. + config BTDM_RESERVE_DRAM hex default 0xdb5c if BT_ENABLED diff --git a/components/bt/controller/esp32/bt.c b/components/bt/controller/esp32/bt.c index 26e26cf26d..626d9485b2 100644 --- a/components/bt/controller/esp32/bt.c +++ b/components/bt/controller/esp32/bt.c @@ -259,6 +259,7 @@ extern uint32_t _bt_controller_data_end; extern void config_bt_funcs_reset(void); extern void config_ble_funcs_reset(void); extern void config_btdm_funcs_reset(void); +extern void config_ble_vs_qa_funcs_reset(void); /* Local Function Declare ********************************************************************* @@ -1720,6 +1721,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) btdm_controller_mem_init(); periph_module_enable(PERIPH_BT_MODULE); + periph_module_reset(PERIPH_BT_MODULE); #if CONFIG_BTDM_CTRL_HCI_UART_FLOW_CTRL_EN sdk_config_set_uart_flow_ctrl_enable(true); @@ -1851,6 +1853,10 @@ static void patch_apply(void) #ifndef CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY config_ble_funcs_reset(); #endif + +#ifdef CONFIG_BTDM_BLE_VS_QA_SUPPORT + config_ble_vs_qa_funcs_reset(); +#endif } esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode) diff --git a/components/bt/controller/lib_esp32 b/components/bt/controller/lib_esp32 index ffb8fad8e0..daee36fdcf 160000 --- a/components/bt/controller/lib_esp32 +++ b/components/bt/controller/lib_esp32 @@ -1 +1 @@ -Subproject commit ffb8fad8e0ff68f565bae8728cc68ebb49ae33b4 +Subproject commit daee36fdcf0ede5a2083f1de230347e6139ba812 diff --git a/components/bt/include/esp32/include/esp_bt.h b/components/bt/include/esp32/include/esp_bt.h index 5035d2efea..684866f9e2 100644 --- a/components/bt/include/esp32/include/esp_bt.h +++ b/components/bt/include/esp32/include/esp_bt.h @@ -55,7 +55,7 @@ extern "C" { * * @note Please do not modify this value. */ -#define ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL 0x20241015 +#define ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL 0x20241024 /** * @brief Bluetooth Controller mode @@ -199,6 +199,18 @@ the adv packet will be discarded until the memory is restored. */ #define BTDM_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS_ENABLED 0 #endif +#if defined(CONFIG_BTDM_BLE_CHAN_ASS_EN) +#define BTDM_BLE_CHAN_ASS_EN (CONFIG_BTDM_BLE_CHAN_ASS_EN) +#else +#define BTDM_BLE_CHAN_ASS_EN (0) +#endif + +#if defined(CONFIG_BTDM_BLE_PING_EN) +#define BTDM_BLE_PING_EN (CONFIG_BTDM_BLE_PING_EN) +#else +#define BTDM_BLE_PING_EN (0) +#endif + /** * @brief Default Bluetooth Controller configuration */ @@ -229,6 +241,8 @@ the adv packet will be discarded until the memory is restored. */ .ble_scan_backoff = BTDM_CTRL_SCAN_BACKOFF_UPPERLIMITMAX, \ .ble_llcp_disc_flag = BTDM_BLE_LLCP_DISC_FLAG, \ .ble_aa_check = BTDM_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS_ENABLED, \ + .ble_chan_ass_en = BTDM_BLE_CHAN_ASS_EN, \ + .ble_ping_en = BTDM_BLE_PING_EN, \ .magic = ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL, \ } @@ -309,6 +323,8 @@ typedef struct { uint8_t ble_llcp_disc_flag; /*!< Flag indicating whether the Controller disconnects after Instant Passed (0x28) error occurs. Configurable in menuconfig. - The Controller does not disconnect after Instant Passed (0x28) by default. */ bool ble_aa_check; /*!< True if adds a verification step for the Access Address within the `CONNECT_IND` PDU; false otherwise (default). Configurable in menuconfig */ + uint8_t ble_chan_ass_en; /*!< True if BLE channel assessment is enabled (default), false otherwise. Configurable in menuconfig */ + uint8_t ble_ping_en; /*!< True if BLE ping procedure is enabled (default), false otherwise. Configurable in menuconfig */ uint32_t magic; /*!< Magic number */ } esp_bt_controller_config_t; diff --git a/components/hal/esp32/include/hal/clk_gate_ll.h b/components/hal/esp32/include/hal/clk_gate_ll.h index 7afaaf0548..cf63c776e8 100644 --- a/components/hal/esp32/include/hal/clk_gate_ll.h +++ b/components/hal/esp32/include/hal/clk_gate_ll.h @@ -97,6 +97,8 @@ static inline uint32_t periph_ll_get_rst_en_mask(periph_module_t periph, bool en return DPORT_LEDC_RST; case PERIPH_WIFI_MODULE: return DPORT_WIFIMAC_RST; + case PERIPH_BT_MODULE: + return (DPORT_BTBB_RST | DPORT_BTMAC_RST | DPORT_RW_BTMAC_RST | DPORT_RW_BTLP_RST); case PERIPH_UART0_MODULE: return DPORT_UART_RST; case PERIPH_UART1_MODULE: From 13d598d50fdbb5b73dbce2d7025e179e0185b875 Mon Sep 17 00:00:00 2001 From: Jin Cheng Date: Tue, 31 Dec 2024 19:56:28 +0800 Subject: [PATCH 2/5] fix(bt/controller): fixed missing critical protections on linked-list structure of (e)SCO buffers --- components/bt/controller/lib_esp32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/controller/lib_esp32 b/components/bt/controller/lib_esp32 index daee36fdcf..35fb599d37 160000 --- a/components/bt/controller/lib_esp32 +++ b/components/bt/controller/lib_esp32 @@ -1 +1 @@ -Subproject commit daee36fdcf0ede5a2083f1de230347e6139ba812 +Subproject commit 35fb599d3733f50254c056171edebcaa3c57d06b From 7db6f812afcb60af52ad1549c9b6cf60a5a54149 Mon Sep 17 00:00:00 2001 From: linruihao Date: Fri, 3 Jan 2025 14:49:11 +0800 Subject: [PATCH 3/5] feat(bt): add coexist scheme status support for bt page --- components/bt/controller/lib_esp32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/controller/lib_esp32 b/components/bt/controller/lib_esp32 index 35fb599d37..b0b9cff14b 160000 --- a/components/bt/controller/lib_esp32 +++ b/components/bt/controller/lib_esp32 @@ -1 +1 @@ -Subproject commit 35fb599d3733f50254c056171edebcaa3c57d06b +Subproject commit b0b9cff14b4f72482300975368b3b258f30120ac From bb039cc318fffb5cacf4c77b26c79f75b2d61aec Mon Sep 17 00:00:00 2001 From: gongyantao Date: Mon, 20 Jan 2025 20:21:51 +0800 Subject: [PATCH 4/5] feat(bt): add vendor hci command and event to support test - add afh related vendor hci command and event - add vendor event mask command --- components/bt/controller/lib_esp32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/controller/lib_esp32 b/components/bt/controller/lib_esp32 index b0b9cff14b..89ac32e33b 160000 --- a/components/bt/controller/lib_esp32 +++ b/components/bt/controller/lib_esp32 @@ -1 +1 @@ -Subproject commit b0b9cff14b4f72482300975368b3b258f30120ac +Subproject commit 89ac32e33b1d1d8a6d7d9e65d48e7897fd7ba3ad From 770f713e655969c0412a113481b994d4e0f731d2 Mon Sep 17 00:00:00 2001 From: zhanghaipeng Date: Tue, 21 Jan 2025 17:31:29 +0800 Subject: [PATCH 5/5] fix(ble): Update bt lib for ESP32(194dd63) - Fix the issue where disconnection events were not reported as a slave. - Enhance Access Address validation in compatibility mode. --- components/bt/controller/lib_esp32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/controller/lib_esp32 b/components/bt/controller/lib_esp32 index 89ac32e33b..e847faba2d 160000 --- a/components/bt/controller/lib_esp32 +++ b/components/bt/controller/lib_esp32 @@ -1 +1 @@ -Subproject commit 89ac32e33b1d1d8a6d7d9e65d48e7897fd7ba3ad +Subproject commit e847faba2d86e90b5f21d6310bb4723c4e32ba1c