diff --git a/components/bt/controller/esp32c2/Kconfig.in b/components/bt/controller/esp32c2/Kconfig.in index 3fc723aed6..eb1fac2331 100644 --- a/components/bt/controller/esp32c2/Kconfig.in +++ b/components/bt/controller/esp32c2/Kconfig.in @@ -689,3 +689,33 @@ config BT_LE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS Enabling this option will add stricter verification of the Access Address in the CONNECT_IND PDU. This improves security by ensuring that only connection requests with valid Access Addresses are accepted. If disabled, only basic checks are applied, improving compatibility. + +menu "BLE disconnects when Instant Passed (0x28) occurs" + config BT_LE_CTRL_LLCP_CONN_UPDATE + bool "BLE ACL connection update procedure" + default n + help + If this option is enabled, Controller will terminate the connection + when Instant Passed (0x28) error occurs during connection update procedure. + + config BT_LE_CTRL_LLCP_CHAN_MAP_UPDATE + bool "BLE ACL channel map update procedure" + default n + help + If this option is enabled, Controller will terminate the connection + when Instant Passed (0x28) error occurs in channel map update procedure. + + config BT_LE_CTRL_LLCP_PHY_UPDATE + bool "BLE ACL PHY update procedure" + default n + help + If this option is enabled, Controller will terminate the connection + when Instant Passed (0x28) error occurs in PHY update procedure. +endmenu + +config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX + int "The value of upperlimitmax during scan backoff procedure" + range 1 256 + default 32 + help + The value of upperlimitmax needs to be a power of 2. diff --git a/components/bt/controller/esp32c2/esp_bt_cfg.h b/components/bt/controller/esp32c2/esp_bt_cfg.h index 74d226a609..95a3c6b2f6 100644 --- a/components/bt/controller/esp32c2/esp_bt_cfg.h +++ b/components/bt/controller/esp32c2/esp_bt_cfg.h @@ -226,6 +226,32 @@ extern "C" { #define DEFAULT_BT_LE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS (0) #endif +#ifdef CONFIG_BT_LE_CTRL_LLCP_CONN_UPDATE +#define BT_CTRL_BLE_LLCP_CONN_UPDATE (1<<0) +#else +#define BT_CTRL_BLE_LLCP_CONN_UPDATE (0<<0) +#endif + +#ifdef CONFIG_BT_LE_CTRL_LLCP_CHAN_MAP_UPDATE +#define BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE (1<<1) +#else +#define BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE (0<<1) +#endif + +#ifdef CONFIG_BT_LE_CTRL_LLCP_PHY_UPDATE +#define BT_CTRL_BLE_LLCP_PHY_UPDATE (1<<2) +#else +#define BT_CTRL_BLE_LLCP_PHY_UPDATE (0<<2) +#endif + +#define BT_LE_CTRL_LLCP_DISC_FLAG (BT_CTRL_BLE_LLCP_CONN_UPDATE | BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE | BT_CTRL_BLE_LLCP_PHY_UPDATE) + +#ifdef CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX +#define BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX (CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX) +#else +#define BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX (256) +#endif + #ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART #define HCI_UART_EN CONFIG_BT_LE_HCI_INTERFACE_USE_UART #else diff --git a/components/bt/include/esp32c2/include/esp_bt.h b/components/bt/include/esp32c2/include/esp_bt.h index fb27def6b0..711849ade2 100644 --- a/components/bt/include/esp32c2/include/esp_bt.h +++ b/components/bt/include/esp32c2/include/esp_bt.h @@ -228,6 +228,9 @@ typedef struct { uint8_t ignore_wl_for_direct_adv; /*!< Ignore the white list for directed advertising */ uint8_t csa2_select; /*!< Select CSA#2 */ uint8_t ble_aa_check; /*!< True if adds a verification step for the Access Address within the CONNECT_IND PDU; false otherwise. Configurable in menuconfig */ + 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. */ + uint16_t scan_backoff_upperlimitmax; /*!< The value of upperlimitmax is 2^n, The maximum value is 256 */ uint8_t vhci_enabled; /*!< VHCI mode is enabled */ uint32_t config_magic; /*!< Configuration magic value */ } esp_bt_controller_config_t; @@ -276,6 +279,8 @@ typedef struct { .ignore_wl_for_direct_adv = 0, \ .csa2_select = DEFAULT_BT_LE_50_FEATURE_SUPPORT, \ .ble_aa_check = DEFAULT_BT_LE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS, \ + .ble_llcp_disc_flag = BT_LE_CTRL_LLCP_DISC_FLAG, \ + .scan_backoff_upperlimitmax = BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX, \ .vhci_enabled = DEFAULT_BT_LE_VHCI_ENABLED, \ .config_magic = CONFIG_MAGIC, \ } diff --git a/components/esp_rom/esp32c2/ld/esp32c2.rom.ble-eco4.ld b/components/esp_rom/esp32c2/ld/esp32c2.rom.ble-eco4.ld index aa4fedcc1f..d4c81556cc 100644 --- a/components/esp_rom/esp32c2/ld/esp32c2.rom.ble-eco4.ld +++ b/components/esp_rom/esp32c2/ld/esp32c2.rom.ble-eco4.ld @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -257,7 +257,7 @@ r_ble_ll_conn_tx_pkt_in = 0x40000e4c; r_ble_ll_conn_update_eff_data_len = 0x40000e50; r_ble_ll_ctrl_chanmap_req_make = 0x40000e54; r_ble_ll_ctrl_chk_proc_start = 0x40000e58; -r_ble_ll_ctrl_conn_param_pdu_make = 0x40000e5c; +//r_ble_ll_ctrl_conn_param_pdu_make = 0x40000e5c; r_ble_ll_ctrl_conn_param_pdu_proc = 0x40000e60; r_ble_ll_ctrl_conn_param_reply = 0x40000e64; r_ble_ll_ctrl_conn_upd_make = 0x40000e68; @@ -284,7 +284,7 @@ r_ble_ll_ctrl_proc_unk_rsp = 0x40000eb8; r_ble_ll_ctrl_proc_with_instant_initiated = 0x40000ebc; r_ble_ll_ctrl_rej_ext_ind_make = 0x40000ec0; r_ble_ll_ctrl_reject_ind_send = 0x40000ec4; -r_ble_ll_ctrl_rx_chanmap_req = 0x40000ec8; +//r_ble_ll_ctrl_rx_chanmap_req = 0x40000ec8; r_ble_ll_ctrl_rx_conn_param_req = 0x40000ecc; //r_ble_ll_ctrl_rx_conn_param_rsp = 0x40000ed0; //r_ble_ll_ctrl_rx_conn_update = 0x40000ed4; @@ -298,7 +298,7 @@ r_ble_ll_ctrl_rx_pdu = 0x40000ef0; r_ble_ll_ctrl_rx_periodic_sync_ind = 0x40000ef4; r_ble_ll_ctrl_rx_phy_req = 0x40000ef8; r_ble_ll_ctrl_rx_phy_rsp = 0x40000efc; -r_ble_ll_ctrl_rx_phy_update_ind = 0x40000f00; +//r_ble_ll_ctrl_rx_phy_update_ind = 0x40000f00; r_ble_ll_ctrl_rx_ping_rsp = 0x40000f04; r_ble_ll_ctrl_rx_reject_ind = 0x40000f08; r_ble_ll_ctrl_rx_sca_req = 0x40000f0c; @@ -346,7 +346,7 @@ r_ble_ll_hci_cmd_rx = 0x40000fb0; r_ble_ll_hci_ctlr_bb_cmd_proc = 0x40000fb4; r_ble_ll_hci_deinit = 0x40000fb8; r_ble_ll_hci_disconnect = 0x40000fbc; -r_ble_ll_hci_env_init = 0x40000fc0; +//r_ble_ll_hci_env_init = 0x40000fc0; r_ble_ll_hci_ev_conn_update = 0x40000fc4; r_ble_ll_hci_ev_databuf_overflow = 0x40000fc8; r_ble_ll_hci_ev_datalen_chg = 0x40000fcc; @@ -805,7 +805,7 @@ r_ble_lll_scan_npl_store = 0x400016dc; r_ble_lll_scan_period_timer_cb = 0x400016e0; r_ble_lll_scan_process_adv_in_isr = 0x400016e4; r_ble_lll_scan_process_rsp_in_isr = 0x400016e8; -r_ble_lll_scan_req_backoff = 0x400016ec; +//r_ble_lll_scan_req_backoff = 0x400016ec; r_ble_lll_scan_restart = 0x400016f0; r_ble_lll_scan_rx_isr_on_aux = 0x400016f4; r_ble_lll_scan_rx_isr_on_legacy = 0x400016f8; @@ -1216,7 +1216,7 @@ r_ble_lll_scan_filter_out_useless_adv = 0x40002ff4; r_ble_hw_whitelist_check_in_wl = 0x40002ff8; r_ble_phy_stats_reset = 0x40002ffc; r_ble_phy_ramup_time_set = 0x40003000; -r_ble_lll_rfmgmt_should_skip_light_sleep_check = 0x40003004; +//r_ble_lll_rfmgmt_should_skip_light_sleep_check = 0x40003004; r_ble_phy_rx_err_record = 0x40003008; r_ble_lll_rfmgmt_wake_up_overhead_set = 0x4000300c; //r_ble_lll_conn_event_delete_and_reschedule = 0x40003010; diff --git a/components/esp_rom/esp32c2/ld/esp32c2.rom.ble.ld b/components/esp_rom/esp32c2/ld/esp32c2.rom.ble.ld index c4e201cc07..36ee9535be 100644 --- a/components/esp_rom/esp32c2/ld/esp32c2.rom.ble.ld +++ b/components/esp_rom/esp32c2/ld/esp32c2.rom.ble.ld @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -202,7 +202,7 @@ r_ble_ll_conn_sm_get = 0x40000e3c; r_ble_ll_conn_tx_pkt_in = 0x40000e4c; r_ble_ll_conn_update_eff_data_len = 0x40000e50; r_ble_ll_ctrl_chanmap_req_make = 0x40000e54; -r_ble_ll_ctrl_conn_param_pdu_make = 0x40000e5c; +//r_ble_ll_ctrl_conn_param_pdu_make = 0x40000e5c; r_ble_ll_ctrl_conn_param_pdu_proc = 0x40000e60; r_ble_ll_ctrl_conn_param_reply = 0x40000e64; r_ble_ll_ctrl_datalen_upd_make = 0x40000e6c; @@ -224,7 +224,7 @@ r_ble_ll_ctrl_proc_stop = 0x40000eb4; r_ble_ll_ctrl_proc_with_instant_initiated = 0x40000ebc; r_ble_ll_ctrl_rej_ext_ind_make = 0x40000ec0; r_ble_ll_ctrl_reject_ind_send = 0x40000ec4; -r_ble_ll_ctrl_rx_chanmap_req = 0x40000ec8; +//r_ble_ll_ctrl_rx_chanmap_req = 0x40000ec8; r_ble_ll_ctrl_rx_conn_param_req = 0x40000ecc; r_ble_ll_ctrl_rx_enc_req = 0x40000ed8; r_ble_ll_ctrl_rx_enc_rsp = 0x40000edc; @@ -234,7 +234,7 @@ r_ble_ll_ctrl_rx_pause_enc_rsp = 0x40000eec; r_ble_ll_ctrl_rx_periodic_sync_ind = 0x40000ef4; r_ble_ll_ctrl_rx_phy_req = 0x40000ef8; r_ble_ll_ctrl_rx_phy_rsp = 0x40000efc; -r_ble_ll_ctrl_rx_phy_update_ind = 0x40000f00; +//r_ble_ll_ctrl_rx_phy_update_ind = 0x40000f00; r_ble_ll_ctrl_rx_ping_rsp = 0x40000f04; r_ble_ll_ctrl_rx_reject_ind = 0x40000f08; r_ble_ll_ctrl_rx_sca_req = 0x40000f0c; @@ -636,7 +636,7 @@ r_ble_lll_scan_npl_restore = 0x400016d8; r_ble_lll_scan_npl_store = 0x400016dc; r_ble_lll_scan_period_timer_cb = 0x400016e0; r_ble_lll_scan_process_adv_in_isr = 0x400016e4; -r_ble_lll_scan_req_backoff = 0x400016ec; +//r_ble_lll_scan_req_backoff = 0x400016ec; r_ble_lll_scan_sched_next_aux = 0x40001700; r_ble_lll_scan_sched_remove = 0x40001704; r_ble_lll_scan_start = 0x40001708;