From 15f8e677a289387a1ae797a52718bb7c7aac0838 Mon Sep 17 00:00:00 2001 From: zhiweijian Date: Wed, 31 May 2023 17:00:09 +0800 Subject: [PATCH 1/8] Fixed bluedroid host build warning when log is disabled --- components/bt/host/bluedroid/hci/hci_layer.c | 1 + components/bt/host/bluedroid/stack/l2cap/l2c_ble.c | 1 + 2 files changed, 2 insertions(+) diff --git a/components/bt/host/bluedroid/hci/hci_layer.c b/components/bt/host/bluedroid/hci/hci_layer.c index 3f67b84825..b5c1bab66a 100644 --- a/components/bt/host/bluedroid/hci/hci_layer.c +++ b/components/bt/host/bluedroid/hci/hci_layer.c @@ -405,6 +405,7 @@ static void command_timed_out(void *context) { hci_cmd_metadata_t *metadata = (hci_cmd_metadata_t *)(wait_entry->data); HCI_TRACE_ERROR("%s hci layer timeout waiting for response to a command. opcode: 0x%x", __func__, metadata->opcode); + UNUSED(metadata); } } diff --git a/components/bt/host/bluedroid/stack/l2cap/l2c_ble.c b/components/bt/host/bluedroid/stack/l2cap/l2c_ble.c index ecfb4bc795..4e6c8534ec 100644 --- a/components/bt/host/bluedroid/stack/l2cap/l2c_ble.c +++ b/components/bt/host/bluedroid/stack/l2cap/l2c_ble.c @@ -807,6 +807,7 @@ void l2cble_process_sig_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len) STREAM_TO_UINT16(mps, p); STREAM_TO_UINT16(credits, p); L2CAP_TRACE_DEBUG("%s spsm %x, scid %x", __func__, spsm, scid); + UNUSED(spsm); p_ccb = l2cu_find_ccb_by_remote_cid(p_lcb, scid); if (p_ccb) { From 567bf5780542d2f66713770794b3043a88d8e0bc Mon Sep 17 00:00:00 2001 From: zhiweijian Date: Mon, 4 Sep 2023 20:38:36 +0800 Subject: [PATCH 2/8] Add new mesh types for exception list on ESP32-C3 and ESP32-S3 --- components/bt/controller/lib_esp32c3_family | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/controller/lib_esp32c3_family b/components/bt/controller/lib_esp32c3_family index 0cfac1b21e..9e82ccc6cd 160000 --- a/components/bt/controller/lib_esp32c3_family +++ b/components/bt/controller/lib_esp32c3_family @@ -1 +1 @@ -Subproject commit 0cfac1b21ebc995e8e9aa040ab1ab29deee4f580 +Subproject commit 9e82ccc6cd24923b2e46e5b05064ccbbf1b2ac09 From 0a57fb4183ceb381eaecb12c5bf6fac0a5663a6c Mon Sep 17 00:00:00 2001 From: chenjianhua Date: Fri, 15 Sep 2023 17:49:02 +0800 Subject: [PATCH 3/8] Update bt lib for ESP32-C3 and ESP32-S3(29996e0) - Fixed address resolution for directed adv with RPA when scanning - Fixed resolvable private address renew after timeout --- components/bt/controller/lib_esp32c3_family | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/controller/lib_esp32c3_family b/components/bt/controller/lib_esp32c3_family index 9e82ccc6cd..e9ad3d704f 160000 --- a/components/bt/controller/lib_esp32c3_family +++ b/components/bt/controller/lib_esp32c3_family @@ -1 +1 @@ -Subproject commit 9e82ccc6cd24923b2e46e5b05064ccbbf1b2ac09 +Subproject commit e9ad3d704f1034310de8f747d503ea5443df6b67 From 74a64755ebfd13084f6589a2b8296165dc10ca26 Mon Sep 17 00:00:00 2001 From: chenjianhua Date: Fri, 22 Sep 2023 17:22:13 +0800 Subject: [PATCH 4/8] Update bt lib for ESP32-C3 and ESP32-S3(c8aa206) - Fixed extended adv address setting after adv restart - Fixed scan channel index setting for extended scan - Add API to set aux channel index for extended adv --- components/bt/controller/lib_esp32c3_family | 2 +- components/esp_rom/esp32c3/ld/esp32c3.rom.ld | 6 ++++++ components/esp_rom/esp32s3/ld/esp32s3.rom.ld | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/components/bt/controller/lib_esp32c3_family b/components/bt/controller/lib_esp32c3_family index e9ad3d704f..27af69ccbb 160000 --- a/components/bt/controller/lib_esp32c3_family +++ b/components/bt/controller/lib_esp32c3_family @@ -1 +1 @@ -Subproject commit e9ad3d704f1034310de8f747d503ea5443df6b67 +Subproject commit 27af69ccbb02f3b820436f47eaa0b1cd544edfbc diff --git a/components/esp_rom/esp32c3/ld/esp32c3.rom.ld b/components/esp_rom/esp32c3/ld/esp32c3.rom.ld index c2b132ae80..69939b849a 100644 --- a/components/esp_rom/esp32c3/ld/esp32c3.rom.ld +++ b/components/esp_rom/esp32c3/ld/esp32c3.rom.ld @@ -966,7 +966,9 @@ r_llc_loc_dl_upd_proc_continue = 0x40000f68; r_llc_loc_encrypt_proc_continue = 0x40000f6c; r_llc_loc_encrypt_proc_err_cb = 0x40000f70; r_llc_loc_feats_exch_proc_continue = 0x40000f74; +/* r_llc_loc_phy_upd_proc_continue = 0x40000f78; +*/ r_llc_loc_phy_upd_proc_err_cb = 0x40000f7c; r_llc_msg_handler_tab_p_get = 0x40000f80; r_llc_pref_param_compute = 0x40000f84; @@ -1145,13 +1147,17 @@ r_lld_process_cca_data = 0x4000120c; r_lld_ral_search = 0x40001210; r_lld_read_clock = 0x40001214; r_lld_res_list_add = 0x40001218; +/* r_lld_res_list_clear = 0x4000121c; +*/ r_lld_res_list_is_empty = 0x40001220; r_lld_res_list_local_rpa_get = 0x40001224; r_lld_res_list_peer_rpa_get = 0x40001228; r_lld_res_list_peer_update = 0x4000122c; r_lld_res_list_priv_mode_update = 0x40001230; +/* r_lld_res_list_rem = 0x40001234; +*/ r_lld_reset_reg = 0x40001238; r_lld_rpa_renew = 0x4000123c; r_lld_rpa_renew_evt_canceled_cbk = 0x40001240; diff --git a/components/esp_rom/esp32s3/ld/esp32s3.rom.ld b/components/esp_rom/esp32s3/ld/esp32s3.rom.ld index 45fb53a148..85bf3a7715 100644 --- a/components/esp_rom/esp32s3/ld/esp32s3.rom.ld +++ b/components/esp_rom/esp32s3/ld/esp32s3.rom.ld @@ -1239,7 +1239,9 @@ r_llc_loc_dl_upd_proc_continue = 0x40003e1c; r_llc_loc_encrypt_proc_continue = 0x40003e28; r_llc_loc_encrypt_proc_err_cb = 0x40003e34; r_llc_loc_feats_exch_proc_continue = 0x40003e40; +/* r_llc_loc_phy_upd_proc_continue = 0x40003e4c; +*/ r_llc_loc_phy_upd_proc_err_cb = 0x40003e58; r_llc_msg_handler_tab_p_get = 0x40003e64; r_llc_pref_param_compute = 0x40003e70; @@ -1418,13 +1420,17 @@ r_lld_process_cca_data = 0x40004608; r_lld_ral_search = 0x40004614; r_lld_read_clock = 0x40004620; r_lld_res_list_add = 0x4000462c; +/* r_lld_res_list_clear = 0x40004638; +*/ r_lld_res_list_is_empty = 0x40004644; r_lld_res_list_local_rpa_get = 0x40004650; r_lld_res_list_peer_rpa_get = 0x4000465c; r_lld_res_list_peer_update = 0x40004668; r_lld_res_list_priv_mode_update = 0x40004674; +/* r_lld_res_list_rem = 0x40004680; +*/ r_lld_reset_reg = 0x4000468c; r_lld_rpa_renew = 0x40004698; r_lld_rpa_renew_evt_canceled_cbk = 0x400046a4; From 95e3dbcffeaece0837e670e29d0bd2aa5055c0bc Mon Sep 17 00:00:00 2001 From: zhiweijian Date: Wed, 30 Aug 2023 17:24:26 +0800 Subject: [PATCH 5/8] Add mesh adv type for exception list --- .../bt/host/bluedroid/api/include/api/esp_gap_ble_api.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h b/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h index d09613c99e..284dbc0184 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h @@ -674,6 +674,8 @@ typedef enum { ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_BEACON_TYPE, /*!< BLE mesh beacon AD type, the format is | Len | 0x2B | Beacon Type | Beacon Data | */ ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROV_SRV_ADV, /*!< BLE mesh provisioning service uuid, the format is | 0x02 | 0x01 | flags | 0x03 | 0x03 | 0x1827 | .... |` */ ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROXY_SRV_ADV, /*!< BLE mesh adv with proxy service uuid, the format is | 0x02 | 0x01 | flags | 0x03 | 0x03 | 0x1828 | .... |` */ + ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROXY_SOLIC_ADV, /*!< BLE mesh adv with proxy service uuid, the format is | 0x02 | 0x01 | flags | 0x03 | 0x03 | 0x7fcb | .... |` */ + ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_URI_ADV, /*!< BLE mesh URI adv, the format is ...| Len | 0x24 | data |... */ } esp_ble_duplicate_exceptional_info_type_t; typedef enum { @@ -681,7 +683,9 @@ typedef enum { ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_LINK_ID_LIST = BLE_BIT(1), /*!< duplicate scan exceptional mesh link ID list */ ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_BEACON_TYPE_LIST = BLE_BIT(2), /*!< duplicate scan exceptional mesh beacon type list */ ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_PROV_SRV_ADV_LIST = BLE_BIT(3), /*!< duplicate scan exceptional mesh adv with provisioning service uuid */ - ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_PROXY_SRV_ADV_LIST = BLE_BIT(4), /*!< duplicate scan exceptional mesh adv with provisioning service uuid */ + ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_PROXY_SRV_ADV_LIST = BLE_BIT(4), /*!< duplicate scan exceptional mesh adv with proxy service uuid */ + ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_PROXY_SOLIC_ADV_LIST = BLE_BIT(5), /*!< duplicate scan exceptional mesh adv with proxy solicitation PDU uuid */ + ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_URI_ADV_LIST = BLE_BIT(6), /*!< duplicate scan exceptional URI list */ ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_ALL_LIST = 0xFFFF, /*!< duplicate scan exceptional all list */ } esp_duplicate_scan_exceptional_list_type_t; From 51ebdfcbfa01f936a8e487d4d7777a288feb50fb Mon Sep 17 00:00:00 2001 From: zhiweijian Date: Wed, 6 Sep 2023 16:21:25 +0800 Subject: [PATCH 6/8] change: enable pll track by default on ESP32 --- components/bt/controller/esp32/bt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/bt/controller/esp32/bt.c b/components/bt/controller/esp32/bt.c index be3da74c92..36e82c9bed 100644 --- a/components/bt/controller/esp32/bt.c +++ b/components/bt/controller/esp32/bt.c @@ -220,6 +220,7 @@ extern void bredr_sco_datapath_set(uint8_t data_path); extern void btdm_controller_scan_duplicate_list_clear(void); /* Shutdown */ extern void esp_bt_controller_shutdown(void); +extern void sdk_config_set_bt_pll_track_enable(bool enable); extern char _bss_start_btdm; extern char _bss_end_btdm; @@ -1677,6 +1678,8 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode) btdm_controller_enable_sleep(true); } + sdk_config_set_bt_pll_track_enable(true); + // inititalize bluetooth baseband btdm_check_and_init_bb(); From 56776921879a7e0f1e0fd53e3196c43a59d29bfe Mon Sep 17 00:00:00 2001 From: zhiweijian Date: Fri, 22 Sep 2023 16:14:01 +0800 Subject: [PATCH 7/8] feat: add config to disable ble hci uart flow control --- components/bt/controller/esp32/Kconfig.in | 5 +++++ components/bt/controller/esp32/bt.c | 7 +++++++ .../main/controller_hci_uart_demo.c | 2 +- .../main/Kconfig.projbuild | 6 ++++++ .../main/main.c | 13 ++++++++++++- 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/components/bt/controller/esp32/Kconfig.in b/components/bt/controller/esp32/Kconfig.in index f9a505cf25..f31094116c 100644 --- a/components/bt/controller/esp32/Kconfig.in +++ b/components/bt/controller/esp32/Kconfig.in @@ -205,6 +205,11 @@ menu "HCI UART(H4) Options" help UART Baudrate for HCI. Please use standard baudrate. + config BTDM_CTRL_HCI_UART_FLOW_CTRL_EN + bool "Enable UART flow control" + depends on BTDM_CTRL_HCI_MODE_UART_H4 + default y + endmenu menu "MODEM SLEEP Options" diff --git a/components/bt/controller/esp32/bt.c b/components/bt/controller/esp32/bt.c index 36e82c9bed..8fdad125e7 100644 --- a/components/bt/controller/esp32/bt.c +++ b/components/bt/controller/esp32/bt.c @@ -221,6 +221,7 @@ extern void btdm_controller_scan_duplicate_list_clear(void); /* Shutdown */ extern void esp_bt_controller_shutdown(void); extern void sdk_config_set_bt_pll_track_enable(bool enable); +extern void sdk_config_set_uart_flow_ctrl_enable(bool enable); extern char _bss_start_btdm; extern char _bss_end_btdm; @@ -1527,6 +1528,12 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) btdm_controller_set_sleep_mode(BTDM_MODEM_SLEEP_MODE_NONE); #endif +#if CONFIG_BTDM_CTRL_HCI_UART_FLOW_CTRL_EN + sdk_config_set_uart_flow_ctrl_enable(true); +#else + sdk_config_set_uart_flow_ctrl_enable(false); +#endif + #ifdef CONFIG_PM_ENABLE if (!s_btdm_allow_light_sleep) { if ((err = esp_pm_lock_create(ESP_PM_NO_LIGHT_SLEEP, 0, "btLS", &s_light_sleep_pm_lock)) != ESP_OK) { diff --git a/examples/bluetooth/hci/controller_hci_uart_esp32/main/controller_hci_uart_demo.c b/examples/bluetooth/hci/controller_hci_uart_esp32/main/controller_hci_uart_demo.c index d4459a8d33..7684b7aa69 100644 --- a/examples/bluetooth/hci/controller_hci_uart_esp32/main/controller_hci_uart_demo.c +++ b/examples/bluetooth/hci/controller_hci_uart_esp32/main/controller_hci_uart_demo.c @@ -25,7 +25,7 @@ static void uart_gpio_reset(void) periph_module_enable(PERIPH_UHCI0_MODULE); #ifdef CONFIG_BTDM_CTRL_HCI_UART_NO - ESP_LOGI(tag, "HCI UART%d Pin select: TX 5, RX 18, CTS 23, RTS 19", CONFIG_BTDM_CTRL_HCI_UART_NO); + ESP_LOGI(tag, "HCI UART%d Pin select: TX 5, RX 18, CTS 23, RTS 19 Baudrate:%d", CONFIG_BTDM_CTRL_HCI_UART_NO, CONFIG_BTDM_CTRL_HCI_UART_BAUDRATE); uart_set_pin(CONFIG_BTDM_CTRL_HCI_UART_NO, 5, 18, 19, 23); #endif diff --git a/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/Kconfig.projbuild b/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/Kconfig.projbuild index 395e8bef94..0912aa239a 100644 --- a/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/Kconfig.projbuild +++ b/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/Kconfig.projbuild @@ -7,4 +7,10 @@ menu "Example Configuration" help UART Baudrate for HCI. Please use standard baudrate. + config EXAMPLE_HCI_UART_FLOW_CTRL_ENABLE + bool "Enable HCI UART flow control" + default y + help + Enable/disable HCI UART flow control + endmenu diff --git a/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/main.c b/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/main.c index 8770990c8e..7c1f2b3423 100644 --- a/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/main.c +++ b/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/main.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -29,6 +29,12 @@ static const char *tag = "UHCI"; #define GPIO_OUTPUT_PIN_SEL ((1ULL< Date: Mon, 9 Oct 2023 11:33:59 +0800 Subject: [PATCH 8/8] Update BLE lib on ESP32-C3 and ESP32-S3 - modify mesh proxy solic uuid to 0x18590303 - Fixed DTM payload length cannot be 0 - Added config to enable Hw recorrect eco - report the number of packets sent on the TX end --- components/bt/controller/lib_esp32c3_family | 2 +- components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/bt/controller/lib_esp32c3_family b/components/bt/controller/lib_esp32c3_family index 27af69ccbb..7fb979154b 160000 --- a/components/bt/controller/lib_esp32c3_family +++ b/components/bt/controller/lib_esp32c3_family @@ -1 +1 @@ -Subproject commit 27af69ccbb02f3b820436f47eaa0b1cd544edfbc +Subproject commit 7fb979154bec81163d55aa4e3134425aea0d52ab diff --git a/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h b/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h index 284dbc0184..78e9782f0a 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h @@ -674,7 +674,7 @@ typedef enum { ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_BEACON_TYPE, /*!< BLE mesh beacon AD type, the format is | Len | 0x2B | Beacon Type | Beacon Data | */ ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROV_SRV_ADV, /*!< BLE mesh provisioning service uuid, the format is | 0x02 | 0x01 | flags | 0x03 | 0x03 | 0x1827 | .... |` */ ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROXY_SRV_ADV, /*!< BLE mesh adv with proxy service uuid, the format is | 0x02 | 0x01 | flags | 0x03 | 0x03 | 0x1828 | .... |` */ - ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROXY_SOLIC_ADV, /*!< BLE mesh adv with proxy service uuid, the format is | 0x02 | 0x01 | flags | 0x03 | 0x03 | 0x7fcb | .... |` */ + ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROXY_SOLIC_ADV, /*!< BLE mesh adv with proxy service uuid, the format is | 0x02 | 0x01 | flags | 0x03 | 0x03 | 0x1859 | .... |` */ ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_URI_ADV, /*!< BLE mesh URI adv, the format is ...| Len | 0x24 | data |... */ } esp_ble_duplicate_exceptional_info_type_t;