From 9bfcc762213775718a940a2aa517068aa6189328 Mon Sep 17 00:00:00 2001 From: zhaoweiliang Date: Thu, 9 Apr 2026 10:57:58 +0800 Subject: [PATCH 1/6] change(ble): [AUTO_MR] Update lib_esp32h2 to c9fbba6f --- components/bt/controller/lib_esp32h2/esp32h2-bt-lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/controller/lib_esp32h2/esp32h2-bt-lib b/components/bt/controller/lib_esp32h2/esp32h2-bt-lib index 8b9bd1e73d..ac4eb88080 160000 --- a/components/bt/controller/lib_esp32h2/esp32h2-bt-lib +++ b/components/bt/controller/lib_esp32h2/esp32h2-bt-lib @@ -1 +1 @@ -Subproject commit 8b9bd1e73d4d7d9d7ce08ef3a538edcac10e7235 +Subproject commit ac4eb8808047d82ad361688fdfa1c2f19380a68e From a23c9acab7b433adec5db412912ca8119385693f Mon Sep 17 00:00:00 2001 From: zhaoweiliang Date: Thu, 9 Apr 2026 10:57:58 +0800 Subject: [PATCH 2/6] change(ble): [AUTO_MR] Update lib_esp32c5 to c9fbba6f --- components/bt/controller/lib_esp32c5/esp32c5-bt-lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/controller/lib_esp32c5/esp32c5-bt-lib b/components/bt/controller/lib_esp32c5/esp32c5-bt-lib index 8903f67002..9bdf938613 160000 --- a/components/bt/controller/lib_esp32c5/esp32c5-bt-lib +++ b/components/bt/controller/lib_esp32c5/esp32c5-bt-lib @@ -1 +1 @@ -Subproject commit 8903f670023bff58180abe39431a55a1ea1a67c5 +Subproject commit 9bdf9386131312e5ab41c43cc7eaa0fb9861babe From 24d0f0fad191e6eab15a1c33d2df4e680aafbba2 Mon Sep 17 00:00:00 2001 From: zhaoweiliang Date: Thu, 9 Apr 2026 10:57:58 +0800 Subject: [PATCH 3/6] change(ble): [AUTO_MR] Update lib_esp32c6 to c9fbba6f --- components/bt/controller/lib_esp32c6/esp32c6-bt-lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/controller/lib_esp32c6/esp32c6-bt-lib b/components/bt/controller/lib_esp32c6/esp32c6-bt-lib index 47becdd678..4df5c135ad 160000 --- a/components/bt/controller/lib_esp32c6/esp32c6-bt-lib +++ b/components/bt/controller/lib_esp32c6/esp32c6-bt-lib @@ -1 +1 @@ -Subproject commit 47becdd678e66f2c0cc9aaf301f9196ec27a68f1 +Subproject commit 4df5c135add478292c219a1e2c14e776e238ba4f From e85bb5cca8fed1d666fd5354532c524cfada51e4 Mon Sep 17 00:00:00 2001 From: zhaoweiliang Date: Tue, 31 Mar 2026 17:51:52 +0800 Subject: [PATCH 4/6] feat(ble): add adv tx options on ESP32-C6 --- components/bt/controller/esp32c6/Kconfig.in | 91 +++++++++++++++++++ components/bt/controller/esp32c6/esp_bt_cfg.h | 37 ++++++++ .../bt/include/esp32c6/include/esp_bt.h | 8 +- 3 files changed, 132 insertions(+), 4 deletions(-) diff --git a/components/bt/controller/esp32c6/Kconfig.in b/components/bt/controller/esp32c6/Kconfig.in index 14b274ce37..e8d1747e23 100644 --- a/components/bt/controller/esp32c6/Kconfig.in +++ b/components/bt/controller/esp32c6/Kconfig.in @@ -876,3 +876,94 @@ config BT_LE_CTRL_ADV_FAST_TX_EN and the actual on-air transmission by executing the advertising TX path from IRAM. Note: Enabling this option increases IRAM usage. + +menu "Adv Tx Options" + config BT_LE_CTRL_ADV_EVENT_INC_ON_FULL_TX_EN + bool "Increment advertising event count only on full PDU TX success" + default n + help + When enabled, the advertising event count is incremented only + if all PDUs in an advertising event are transmitted successfully. + If disabled, the event count is incremented regardless of transmission success. + + config BT_LE_CTRL_ADV_CH38_39_TX_AVOID_CONFLICT_EN + bool "Delay advertising TX on channels 38/39 to avoid scheduling conflicts" + default n + help + When enabled, advertising transmissions on channels 38 and 39 + are delayed if a scheduling conflict occurs. + + config BT_LE_ADV_CH39_TXPWR_CONFIG_SEPARATELY_EN + bool "Enable separate TX power for advertising on channel 39" + default n + help + When enabled, the TX power for advertising transmissions + on channel 39 can be configured independently of other channels. + + config BT_LE_CTRL_ADV_TX_CONTINUE_WHEN_EXCEED_ITVL_EN + bool "Allow advertising TX to continue if data TX exceeds interval" + default n + help + When enabled, advertising transmission continues even if the + TX duration for advertising data exceeds the configured advertising interval. + + config BT_LE_CTRL_ADV_RAND_CH_IDX_EN + bool "Enable Randomized Advertising Channel Indexing" + default n + help + When enabled, the advertising channel sequence is randomized + according to the Randomized Advertising Channel Indexing feature. + If disabled, the standard channel sequence is used. + + choice BT_LE_DFT_CH39_TX_POWER_LEVEL_DBM + prompt "BLE default channel 39 Tx power level (dBm)" + depends on BT_LE_ADV_CH39_TXPWR_CONFIG_SEPARATELY_EN + default BT_LE_DFT_CH39_TX_POWER_LEVEL_P9 + help + Default Tx power (dBm) for advertising on channel 39 when separate channel 39 power is enabled. + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N15 + bool "-15dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N12 + bool "-12dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N9 + bool "-9dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N6 + bool "-6dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N3 + bool "-3dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N0 + bool "0dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P3 + bool "+3dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P6 + bool "+6dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P9 + bool "+9dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P12 + bool "+12dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P15 + bool "+15dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P18 + bool "+18dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P20 + bool "+20dBm" + endchoice + + config BT_LE_DFT_CH39_TX_POWER_LEVEL_DBM_EFF + int + depends on BT_LE_ADV_CH39_TXPWR_CONFIG_SEPARATELY_EN + default -15 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N15 + default -12 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N12 + default -9 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N9 + default -6 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N6 + default -3 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N3 + default 0 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N0 + default 3 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P3 + default 6 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P6 + default 9 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P9 + default 12 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P12 + default 15 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P15 + default 18 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P18 + default 20 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P20 + default 0 +endmenu diff --git a/components/bt/controller/esp32c6/esp_bt_cfg.h b/components/bt/controller/esp32c6/esp_bt_cfg.h index eb82f56941..9a07d380c0 100644 --- a/components/bt/controller/esp32c6/esp_bt_cfg.h +++ b/components/bt/controller/esp32c6/esp_bt_cfg.h @@ -315,6 +315,42 @@ extern "C" { #define DEFAULT_BT_LE_CTRL_RXBUF_MEM_RESV (0) #endif +#ifdef CONFIG_BT_LE_CTRL_ADV_EVENT_INC_ON_FULL_TX_EN +#define DEFAULT_BT_LE_CTRL_ADV_EVENT_INC_ON_FULL_TX_EN (1<<0) +#else +#define DEFAULT_BT_LE_CTRL_ADV_EVENT_INC_ON_FULL_TX_EN (0) +#endif + +#ifdef CONFIG_BT_LE_CTRL_ADV_CH38_39_TX_AVOID_CONFLICT_EN +#define DEFAULT_BT_LE_CTRL_ADV_CH38_39_TX_AVOID_CONFLICT_EN (1<<1) +#else +#define DEFAULT_BT_LE_CTRL_ADV_CH38_39_TX_AVOID_CONFLICT_EN (0) +#endif + +#ifdef CONFIG_BT_LE_ADV_CH39_TXPWR_CONFIG_SEPARATELY_EN +#define DEFAULT_BT_LE_ADV_CH39_TXPWR_CONFIG_SEPARATELY_EN (1<<2) +#define BLE_CH39_TX_PWR_DBM_N (CONFIG_BT_LE_DFT_CH39_TX_POWER_LEVEL_DBM_EFF) +#else +#define DEFAULT_BT_LE_ADV_CH39_TXPWR_CONFIG_SEPARATELY_EN (0) +#define BLE_CH39_TX_PWR_DBM_N (CONFIG_BT_LE_DFT_TX_POWER_LEVEL_DBM_EFF) +#endif + +#ifdef CONFIG_BT_LE_CTRL_ADV_TX_CONTINUE_WHEN_EXCEED_ITVL_EN +#define DEFAULT_BT_LE_CTRL_ADV_TX_CONTINUE_WHEN_EXCEED_ITVL_EN (1<<3) +#else +#define DEFAULT_BT_LE_CTRL_ADV_TX_CONTINUE_WHEN_EXCEED_ITVL_EN (0) +#endif + +#ifdef CONFIG_BT_LE_CTRL_ADV_RAND_CH_IDX_EN +#define DEFAULT_BT_LE_CTRL_ADV_RAND_CH_IDX_EN (1<<4) +#else +#define DEFAULT_BT_LE_CTRL_ADV_RAND_CH_IDX_EN (0) +#endif + +#define DEFAULT_BT_LE_ADV_TX_OPTIONS (DEFAULT_BT_LE_CTRL_ADV_EVENT_INC_ON_FULL_TX_EN | \ + DEFAULT_BT_LE_CTRL_ADV_CH38_39_TX_AVOID_CONFLICT_EN | DEFAULT_BT_LE_ADV_CH39_TXPWR_CONFIG_SEPARATELY_EN | \ + DEFAULT_BT_LE_CTRL_ADV_TX_CONTINUE_WHEN_EXCEED_ITVL_EN | DEFAULT_BT_LE_CTRL_ADV_RAND_CH_IDX_EN ) + /* Unchanged configuration */ #define BLE_LL_CTRL_PROC_TIMEOUT_MS_N (40000) /* ms */ @@ -346,6 +382,7 @@ extern "C" { #define RUN_QA_TEST (0) #define NIMBLE_DISABLE_SCAN_BACKOFF (0) #define BT_LL_CTRL_PRIO_LVL_CFG ((CONFIG_BT_LE_DFT_SYNC_SCHED_PRIO_LEVEL << 4) | (CONFIG_BT_LE_DFT_PERIODIC_ADV_SCHED_PRIO_LEVEL << 2) | CONFIG_BT_LE_DFT_ADV_SCHED_PRIO_LEVEL) + #ifdef __cplusplus } #endif diff --git a/components/bt/include/esp32c6/include/esp_bt.h b/components/bt/include/esp32c6/include/esp_bt.h index 9747a07650..27040370cc 100644 --- a/components/bt/include/esp32c6/include/esp_bt.h +++ b/components/bt/include/esp32c6/include/esp_bt.h @@ -298,10 +298,10 @@ typedef struct { .ble_data_lenth_zero_aux = DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX, \ .vhci_enabled = DEFAULT_BT_LE_VHCI_ENABLED, \ .ptr_check_enabled = DEFAULT_BT_LE_PTR_CHECK_ENABLED, \ - .ble_adv_tx_options = 0, \ + .ble_adv_tx_options = DEFAULT_BT_LE_ADV_TX_OPTIONS, \ .skip_unnecessary_checks_en = 0, \ .fast_conn_data_tx_en = DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN, \ - .ch39_txpwr = BLE_LL_TX_PWR_DBM_N, \ + .ch39_txpwr = BLE_CH39_TX_PWR_DBM_N, \ .adv_rsv_cnt = BLE_LL_ADV_SM_RESERVE_CNT_N, \ .conn_rsv_cnt = BLE_LL_CONN_SM_RESERVE_CNT_N, \ .priority_level_cfg = BT_LL_CTRL_PRIO_LVL_CFG, \ @@ -365,10 +365,10 @@ typedef struct { .ble_data_lenth_zero_aux = DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX, \ .vhci_enabled = DEFAULT_BT_LE_VHCI_ENABLED, \ .ptr_check_enabled = DEFAULT_BT_LE_PTR_CHECK_ENABLED, \ - .ble_adv_tx_options = 0, \ + .ble_adv_tx_options = DEFAULT_BT_LE_ADV_TX_OPTIONS, \ .skip_unnecessary_checks_en = 0, \ .fast_conn_data_tx_en = DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN, \ - .ch39_txpwr = BLE_LL_TX_PWR_DBM_N, \ + .ch39_txpwr = BLE_CH39_TX_PWR_DBM_N, \ .adv_rsv_cnt = BLE_LL_ADV_SM_RESERVE_CNT_N, \ .conn_rsv_cnt = BLE_LL_CONN_SM_RESERVE_CNT_N, \ .priority_level_cfg = BT_LL_CTRL_PRIO_LVL_CFG, \ From 8ef46541cd4603e94e01308b95021cfb12f64af2 Mon Sep 17 00:00:00 2001 From: zhaoweiliang Date: Tue, 31 Mar 2026 20:14:30 +0800 Subject: [PATCH 5/6] feat(ble): add adv tx options on ESP32-H2 --- components/bt/controller/esp32h2/Kconfig.in | 99 +++++++++++++++++++ components/bt/controller/esp32h2/esp_bt_cfg.h | 36 +++++++ .../bt/include/esp32h2/include/esp_bt.h | 4 +- 3 files changed, 137 insertions(+), 2 deletions(-) diff --git a/components/bt/controller/esp32h2/Kconfig.in b/components/bt/controller/esp32h2/Kconfig.in index b02a3e97fb..165bacc526 100644 --- a/components/bt/controller/esp32h2/Kconfig.in +++ b/components/bt/controller/esp32h2/Kconfig.in @@ -880,3 +880,102 @@ config BT_LE_CTRL_ADV_FAST_TX_EN and the actual on-air transmission by executing the advertising TX path from IRAM. Note: Enabling this option increases IRAM usage. + +menu "Adv Tx Options" + config BT_LE_CTRL_ADV_EVENT_INC_ON_FULL_TX_EN + bool "Increment advertising event count only on full PDU TX success" + default n + help + When enabled, the advertising event count is incremented only + if all PDUs in an advertising event are transmitted successfully. + If disabled, the event count is incremented regardless of transmission success. + + config BT_LE_CTRL_ADV_CH38_39_TX_AVOID_CONFLICT_EN + bool "Delay advertising TX on channels 38/39 to avoid scheduling conflicts" + default n + help + When enabled, advertising transmissions on channels 38 and 39 + are delayed if a scheduling conflict occurs. + + config BT_LE_ADV_CH39_TXPWR_CONFIG_SEPARATELY_EN + bool "Enable separate TX power for advertising on channel 39" + default n + help + When enabled, the TX power for advertising transmissions + on channel 39 can be configured independently of other channels. + + config BT_LE_CTRL_ADV_TX_CONTINUE_WHEN_EXCEED_ITVL_EN + bool "Allow advertising TX to continue if data TX exceeds interval" + default n + help + When enabled, advertising transmission continues even if the + TX duration for advertising data exceeds the configured advertising interval. + + config BT_LE_CTRL_ADV_RAND_CH_IDX_EN + bool "Enable Randomized Advertising Channel Indexing" + default n + help + When enabled, the advertising channel sequence is randomized + according to the Randomized Advertising Channel Indexing feature. + If disabled, the standard channel sequence is used. + + choice BT_LE_DFT_CH39_TX_POWER_LEVEL_DBM + prompt "BLE default Tx power level(dBm)" + depends on BT_LE_ADV_CH39_TXPWR_CONFIG_SEPARATELY_EN + default BT_LE_DFT_CH39_TX_POWER_LEVEL_P9 + help + Specify default Tx power level(dBm). + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N24 + bool "-24dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N21 + bool "-21dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N18 + bool "-18dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N15 + bool "-15dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N12 + bool "-12dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N9 + bool "-9dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N6 + bool "-6dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N3 + bool "-3dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N0 + bool "0dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P3 + bool "+3dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P6 + bool "+6dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P9 + bool "+9dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P12 + bool "+12dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P15 + bool "+15dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P18 + bool "+18dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P20 + bool "+20dBm" + endchoice + + config BT_LE_DFT_CH39_TX_POWER_LEVEL_DBM_EFF + int + default -24 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N24 + default -21 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N21 + default -18 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N18 + default -15 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N15 + default -12 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N12 + default -9 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N9 + default -6 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N6 + default -3 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N3 + default 0 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N0 + default 3 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P3 + default 6 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P6 + default 9 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P9 + default 12 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P12 + default 15 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P15 + default 18 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P18 + default 20 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P20 + default 0 +endmenu diff --git a/components/bt/controller/esp32h2/esp_bt_cfg.h b/components/bt/controller/esp32h2/esp_bt_cfg.h index 5d547e6ac4..034db10c38 100644 --- a/components/bt/controller/esp32h2/esp_bt_cfg.h +++ b/components/bt/controller/esp32h2/esp_bt_cfg.h @@ -314,6 +314,42 @@ extern "C" { #define DEFAULT_BT_LE_CTRL_RXBUF_MEM_RESV (0) #endif +#ifdef CONFIG_BT_LE_CTRL_ADV_EVENT_INC_ON_FULL_TX_EN +#define DEFAULT_BT_LE_CTRL_ADV_EVENT_INC_ON_FULL_TX_EN (1<<0) +#else +#define DEFAULT_BT_LE_CTRL_ADV_EVENT_INC_ON_FULL_TX_EN (0) +#endif + +#ifdef CONFIG_BT_LE_CTRL_ADV_CH38_39_TX_AVOID_CONFLICT_EN +#define DEFAULT_BT_LE_CTRL_ADV_CH38_39_TX_AVOID_CONFLICT_EN (1<<1) +#else +#define DEFAULT_BT_LE_CTRL_ADV_CH38_39_TX_AVOID_CONFLICT_EN (0) +#endif + +#ifdef CONFIG_BT_LE_ADV_CH39_TXPWR_CONFIG_SEPARATELY_EN +#define DEFAULT_BT_LE_ADV_CH39_TXPWR_CONFIG_SEPARATELY_EN (1<<2) +#define BLE_CH39_TX_PWR_DBM_N (CONFIG_BT_LE_DFT_CH39_TX_POWER_LEVEL_DBM_EFF) +#else +#define DEFAULT_BT_LE_ADV_CH39_TXPWR_CONFIG_SEPARATELY_EN (0) +#define BLE_CH39_TX_PWR_DBM_N (CONFIG_BT_LE_DFT_TX_POWER_LEVEL_DBM_EFF) +#endif + +#ifdef CONFIG_BT_LE_CTRL_ADV_TX_CONTINUE_WHEN_EXCEED_ITVL_EN +#define DEFAULT_BT_LE_CTRL_ADV_TX_CONTINUE_WHEN_EXCEED_ITVL_EN (1<<3) +#else +#define DEFAULT_BT_LE_CTRL_ADV_TX_CONTINUE_WHEN_EXCEED_ITVL_EN (0) +#endif + +#ifdef CONFIG_BT_LE_CTRL_ADV_RAND_CH_IDX_EN +#define DEFAULT_BT_LE_CTRL_ADV_RAND_CH_IDX_EN (1<<4) +#else +#define DEFAULT_BT_LE_CTRL_ADV_RAND_CH_IDX_EN (0) +#endif + +#define DEFAULT_BT_LE_ADV_TX_OPTIONS (DEFAULT_BT_LE_CTRL_ADV_EVENT_INC_ON_FULL_TX_EN | \ + DEFAULT_BT_LE_CTRL_ADV_CH38_39_TX_AVOID_CONFLICT_EN | DEFAULT_BT_LE_ADV_CH39_TXPWR_CONFIG_SEPARATELY_EN | \ + DEFAULT_BT_LE_CTRL_ADV_TX_CONTINUE_WHEN_EXCEED_ITVL_EN | DEFAULT_BT_LE_CTRL_ADV_RAND_CH_IDX_EN ) + /* Unchanged configuration */ #define BLE_LL_CTRL_PROC_TIMEOUT_MS_N (40000) /* ms */ diff --git a/components/bt/include/esp32h2/include/esp_bt.h b/components/bt/include/esp32h2/include/esp_bt.h index fdbda4bfc6..fbe98297db 100644 --- a/components/bt/include/esp32h2/include/esp_bt.h +++ b/components/bt/include/esp32h2/include/esp_bt.h @@ -298,10 +298,10 @@ typedef struct { .ble_data_lenth_zero_aux = DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX, \ .vhci_enabled = DEFAULT_BT_LE_VHCI_ENABLED, \ .ptr_check_enabled = DEFAULT_BT_LE_PTR_CHECK_ENABLED, \ - .ble_adv_tx_options = 0, \ + .ble_adv_tx_options = DEFAULT_BT_LE_ADV_TX_OPTIONS, \ .skip_unnecessary_checks_en = 0, \ .fast_conn_data_tx_en = DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN, \ - .ch39_txpwr = BLE_LL_TX_PWR_DBM_N, \ + .ch39_txpwr = BLE_CH39_TX_PWR_DBM_N, \ .adv_rsv_cnt = BLE_LL_ADV_SM_RESERVE_CNT_N, \ .conn_rsv_cnt = BLE_LL_CONN_SM_RESERVE_CNT_N, \ .priority_level_cfg = BT_LL_CTRL_PRIO_LVL_CFG, \ From d7bfbef8623213ba18facd953e261d182e4bf820 Mon Sep 17 00:00:00 2001 From: zhaoweiliang Date: Tue, 31 Mar 2026 20:19:20 +0800 Subject: [PATCH 6/6] feat(ble): add adv tx options on ESP32-C5 --- components/bt/controller/esp32c5/Kconfig.in | 96 +++++++++++++++++++ components/bt/controller/esp32c5/esp_bt_cfg.h | 36 +++++++ .../bt/include/esp32c5/include/esp_bt.h | 4 +- 3 files changed, 134 insertions(+), 2 deletions(-) diff --git a/components/bt/controller/esp32c5/Kconfig.in b/components/bt/controller/esp32c5/Kconfig.in index 8f9caa610a..64748184b5 100644 --- a/components/bt/controller/esp32c5/Kconfig.in +++ b/components/bt/controller/esp32c5/Kconfig.in @@ -852,3 +852,99 @@ config BT_LE_CTRL_ADV_FAST_TX_EN and the actual on-air transmission by executing the advertising TX path from IRAM. Note: Enabling this option increases IRAM usage. + +menu "Adv Tx Options" + config BT_LE_CTRL_ADV_EVENT_INC_ON_FULL_TX_EN + bool "Increment advertising event count only on full PDU TX success" + default n + help + When enabled, the advertising event count is incremented only + if all PDUs in an advertising event are transmitted successfully. + If disabled, the event count is incremented regardless of transmission success. + + config BT_LE_CTRL_ADV_CH38_39_TX_AVOID_CONFLICT_EN + bool "Delay advertising TX on channels 38/39 to avoid scheduling conflicts" + default n + help + When enabled, advertising transmissions on channels 38 and 39 + are delayed if a scheduling conflict occurs. + + config BT_LE_ADV_CH39_TXPWR_CONFIG_SEPARATELY_EN + bool "Enable separate TX power for advertising on channel 39" + default n + help + When enabled, the TX power for advertising transmissions + on channel 39 can be configured independently of other channels. + + config BT_LE_CTRL_ADV_TX_CONTINUE_WHEN_EXCEED_ITVL_EN + bool "Allow advertising TX to continue if data TX exceeds interval" + default n + help + When enabled, advertising transmission continues even if the + TX duration for advertising data exceeds the configured advertising interval. + + config BT_LE_CTRL_ADV_RAND_CH_IDX_EN + bool "Enable Randomized Advertising Channel Indexing" + default n + help + When enabled, the advertising channel sequence is randomized + according to the Randomized Advertising Channel Indexing feature. + If disabled, the standard channel sequence is used. + + choice BT_LE_DFT_CH39_TX_POWER_LEVEL_DBM + prompt "BLE default Tx power level(dBm)" + depends on BT_LE_ADV_CH39_TXPWR_CONFIG_SEPARATELY_EN + default BT_LE_DFT_CH39_TX_POWER_LEVEL_P9 + help + Specify default Tx power level(dBm). + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N24 + bool "-24dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N21 + bool "-21dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N18 + bool "-18dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N15 + bool "-15dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N12 + bool "-12dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N9 + bool "-9dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N6 + bool "-6dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N3 + bool "-3dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_N0 + bool "0dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P3 + bool "+3dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P6 + bool "+6dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P9 + bool "+9dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P12 + bool "+12dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P15 + bool "+15dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P18 + bool "+18dBm" + config BT_LE_DFT_CH39_TX_POWER_LEVEL_P20 + bool "+20dBm" + endchoice + + config BT_LE_DFT_CH39_TX_POWER_LEVEL_DBM_EFF + int + default -15 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N15 + default -12 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N12 + default -9 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N9 + default -6 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N6 + default -3 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N3 + default 0 if BT_LE_DFT_CH39_TX_POWER_LEVEL_N0 + default 3 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P3 + default 6 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P6 + default 9 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P9 + default 12 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P12 + default 15 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P15 + default 18 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P18 + default 20 if BT_LE_DFT_CH39_TX_POWER_LEVEL_P20 + default 0 +endmenu diff --git a/components/bt/controller/esp32c5/esp_bt_cfg.h b/components/bt/controller/esp32c5/esp_bt_cfg.h index 5d547e6ac4..034db10c38 100644 --- a/components/bt/controller/esp32c5/esp_bt_cfg.h +++ b/components/bt/controller/esp32c5/esp_bt_cfg.h @@ -314,6 +314,42 @@ extern "C" { #define DEFAULT_BT_LE_CTRL_RXBUF_MEM_RESV (0) #endif +#ifdef CONFIG_BT_LE_CTRL_ADV_EVENT_INC_ON_FULL_TX_EN +#define DEFAULT_BT_LE_CTRL_ADV_EVENT_INC_ON_FULL_TX_EN (1<<0) +#else +#define DEFAULT_BT_LE_CTRL_ADV_EVENT_INC_ON_FULL_TX_EN (0) +#endif + +#ifdef CONFIG_BT_LE_CTRL_ADV_CH38_39_TX_AVOID_CONFLICT_EN +#define DEFAULT_BT_LE_CTRL_ADV_CH38_39_TX_AVOID_CONFLICT_EN (1<<1) +#else +#define DEFAULT_BT_LE_CTRL_ADV_CH38_39_TX_AVOID_CONFLICT_EN (0) +#endif + +#ifdef CONFIG_BT_LE_ADV_CH39_TXPWR_CONFIG_SEPARATELY_EN +#define DEFAULT_BT_LE_ADV_CH39_TXPWR_CONFIG_SEPARATELY_EN (1<<2) +#define BLE_CH39_TX_PWR_DBM_N (CONFIG_BT_LE_DFT_CH39_TX_POWER_LEVEL_DBM_EFF) +#else +#define DEFAULT_BT_LE_ADV_CH39_TXPWR_CONFIG_SEPARATELY_EN (0) +#define BLE_CH39_TX_PWR_DBM_N (CONFIG_BT_LE_DFT_TX_POWER_LEVEL_DBM_EFF) +#endif + +#ifdef CONFIG_BT_LE_CTRL_ADV_TX_CONTINUE_WHEN_EXCEED_ITVL_EN +#define DEFAULT_BT_LE_CTRL_ADV_TX_CONTINUE_WHEN_EXCEED_ITVL_EN (1<<3) +#else +#define DEFAULT_BT_LE_CTRL_ADV_TX_CONTINUE_WHEN_EXCEED_ITVL_EN (0) +#endif + +#ifdef CONFIG_BT_LE_CTRL_ADV_RAND_CH_IDX_EN +#define DEFAULT_BT_LE_CTRL_ADV_RAND_CH_IDX_EN (1<<4) +#else +#define DEFAULT_BT_LE_CTRL_ADV_RAND_CH_IDX_EN (0) +#endif + +#define DEFAULT_BT_LE_ADV_TX_OPTIONS (DEFAULT_BT_LE_CTRL_ADV_EVENT_INC_ON_FULL_TX_EN | \ + DEFAULT_BT_LE_CTRL_ADV_CH38_39_TX_AVOID_CONFLICT_EN | DEFAULT_BT_LE_ADV_CH39_TXPWR_CONFIG_SEPARATELY_EN | \ + DEFAULT_BT_LE_CTRL_ADV_TX_CONTINUE_WHEN_EXCEED_ITVL_EN | DEFAULT_BT_LE_CTRL_ADV_RAND_CH_IDX_EN ) + /* Unchanged configuration */ #define BLE_LL_CTRL_PROC_TIMEOUT_MS_N (40000) /* ms */ diff --git a/components/bt/include/esp32c5/include/esp_bt.h b/components/bt/include/esp32c5/include/esp_bt.h index 2f55323117..4576f1638c 100644 --- a/components/bt/include/esp32c5/include/esp_bt.h +++ b/components/bt/include/esp32c5/include/esp_bt.h @@ -295,10 +295,10 @@ typedef struct { .ble_data_lenth_zero_aux = DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX, \ .vhci_enabled = DEFAULT_BT_LE_VHCI_ENABLED, \ .ptr_check_enabled = DEFAULT_BT_LE_PTR_CHECK_ENABLED, \ - .ble_adv_tx_options = 0, \ + .ble_adv_tx_options = DEFAULT_BT_LE_ADV_TX_OPTIONS, \ .skip_unnecessary_checks_en = 0, \ .fast_conn_data_tx_en = DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN, \ - .ch39_txpwr = BLE_LL_TX_PWR_DBM_N, \ + .ch39_txpwr = BLE_CH39_TX_PWR_DBM_N, \ .adv_rsv_cnt = BLE_LL_ADV_SM_RESERVE_CNT_N, \ .conn_rsv_cnt = BLE_LL_CONN_SM_RESERVE_CNT_N, \ .priority_level_cfg = BT_LL_CTRL_PRIO_LVL_CFG, \