mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 17:19:09 -04:00
Compare commits
22 Commits
c9063460d6
...
0d0800d9ea
Author | SHA1 | Date | |
---|---|---|---|
|
0d0800d9ea | ||
|
63342e1e82 | ||
|
50e6628089 | ||
|
a28b62e2b9 | ||
|
50e63edc9d | ||
|
618923ccbf | ||
|
c16a2b345d | ||
|
65037d3831 | ||
|
58d722a16f | ||
|
e9bc012184 | ||
|
6df6ab7d2b | ||
|
2feaf5a89c | ||
|
1164033475 | ||
|
1195ce2e59 | ||
|
f4a8aaffcb | ||
|
bf11849a79 | ||
|
2ff9085d4d | ||
|
e71af692b9 | ||
|
286736469d | ||
|
598eff9d27 | ||
|
d3051495a5 | ||
|
24b3a11c65 |
@ -30,11 +30,13 @@ if(CONFIG_BT_ENABLED)
|
||||
set(ldscripts "linker_esp32c2.lf")
|
||||
|
||||
elseif(CONFIG_IDF_TARGET_ESP32C6)
|
||||
list(APPEND srcs "controller/esp32c6/ble.c")
|
||||
list(APPEND srcs "controller/esp32c6/bt.c")
|
||||
list(APPEND include_dirs include/esp32c6/include)
|
||||
list(APPEND ldscripts "linker_esp_ble_controller.lf")
|
||||
|
||||
elseif(CONFIG_IDF_TARGET_ESP32H2)
|
||||
list(APPEND srcs "controller/esp32h2/ble.c")
|
||||
list(APPEND srcs "controller/esp32h2/bt.c")
|
||||
list(APPEND include_dirs include/esp32h2/include)
|
||||
list(APPEND ldscripts "linker_esp_ble_controller.lf")
|
||||
@ -770,11 +772,24 @@ if(CONFIG_BT_ENABLED)
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
set(bt_priv_requires
|
||||
nvs_flash
|
||||
soc
|
||||
esp_pm
|
||||
esp_phy
|
||||
esp_coex
|
||||
mbedtls
|
||||
driver
|
||||
vfs
|
||||
esp_gdbstub
|
||||
)
|
||||
|
||||
idf_component_register(SRCS "${srcs}"
|
||||
INCLUDE_DIRS "${include_dirs}"
|
||||
PRIV_INCLUDE_DIRS "${priv_include_dirs}"
|
||||
REQUIRES esp_timer esp_wifi
|
||||
PRIV_REQUIRES nvs_flash soc esp_pm esp_phy esp_coex mbedtls driver vfs
|
||||
PRIV_REQUIRES "${bt_priv_requires}"
|
||||
LDFRAGMENTS "${ldscripts}")
|
||||
|
||||
if(CONFIG_BT_ENABLED)
|
||||
|
@ -81,6 +81,10 @@ menu "Bluetooth"
|
||||
We cannot split the memory into 3 different regions (IRAM, BLE-IRAM, DRAM).
|
||||
So this option will disable the PMP (ESP_SYSTEM_PMP_IDRAM_SPLIT)
|
||||
|
||||
menu "Common Options"
|
||||
source "$IDF_PATH/components/bt/common/Kconfig.in"
|
||||
endmenu
|
||||
|
||||
config BT_HCI_LOG_DEBUG_EN
|
||||
depends on BT_BLUEDROID_ENABLED || BT_NIMBLE_ENABLED
|
||||
bool "Enable Bluetooth HCI debug mode"
|
||||
@ -106,12 +110,6 @@ menu "Bluetooth"
|
||||
This option is to configure the buffer size of the hci adv report cache in hci debug mode.
|
||||
This is a ring buffer, the new data will overwrite the oldest data if the buffer is full.
|
||||
|
||||
menu "Common Options"
|
||||
visible if (BT_BLUEDROID_ENABLED || BT_NIMBLE_ENABLED)
|
||||
|
||||
source "$IDF_PATH/components/bt/common/Kconfig.in"
|
||||
endmenu
|
||||
|
||||
endmenu
|
||||
|
||||
menuconfig BLE_MESH
|
||||
|
@ -1,6 +1,7 @@
|
||||
config BT_ALARM_MAX_NUM
|
||||
int "Maximum number of Bluetooth alarms"
|
||||
default 50
|
||||
depends on (BT_BLUEDROID_ENABLED || BT_NIMBLE_ENABLED)
|
||||
help
|
||||
This option decides the maximum number of alarms which
|
||||
could be used by Bluetooth host.
|
||||
|
@ -490,6 +490,15 @@ config BTDM_BLE_VS_QA_SUPPORT
|
||||
help
|
||||
This enables BLE vendor HCI command and event for QA.
|
||||
|
||||
config BTDM_CTRL_CONTROLLER_DEBUG_MODE_1
|
||||
bool "Enable Bluetooth controller debugging mode 1 (for internal use only)" if n
|
||||
default n
|
||||
depends on BT_ENABLED
|
||||
help
|
||||
Enables specific debugging features for the Bluetooth controller.
|
||||
This option is strictly for internal debugging purposes and should not be enabled in production environments,
|
||||
as it may impact performance and stability.
|
||||
|
||||
config BTDM_RESERVE_DRAM
|
||||
hex
|
||||
default 0xdb5c if BT_ENABLED
|
||||
|
@ -315,110 +315,126 @@ config BT_LE_CONTROLLER_TASK_STACK_SIZE
|
||||
help
|
||||
This configures stack size of NimBLE controller task
|
||||
|
||||
menuconfig BT_LE_CONTROLLER_LOG_ENABLED
|
||||
bool "Controller log enable"
|
||||
default n
|
||||
help
|
||||
Enable controller log
|
||||
menu "Controller debug features"
|
||||
menuconfig BT_LE_CONTROLLER_LOG_ENABLED
|
||||
bool "Controller log enable"
|
||||
default n
|
||||
help
|
||||
Enable controller log
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
bool "enable controller log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
bool "enable controller log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
Enable controller log module
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
bool "enable HCI log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
bool "enable HCI log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
Enable hci log module
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
bool "Controller log dump mode only"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
bool "Controller log dump mode only"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
Only operate in dump mode
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
bool "Output ble controller logs to SPI bus (Experimental)"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
select BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
default n
|
||||
help
|
||||
Output ble controller logs to SPI bus
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
bool "Output ble controller logs to SPI bus (Experimental)"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
select BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
default n
|
||||
help
|
||||
Output ble controller logs to SPI bus
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
bool "Store ble controller logs to flash(Experimental)"
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
bool "Store ble controller logs to flash(Experimental)"
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Store ble controller logs to flash memory.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
||||
int "size of ble controller log partition(Multiples of 4K)"
|
||||
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
default 65536
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
||||
int "size of ble controller log partition(Multiples of 4K)"
|
||||
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
default 65536
|
||||
help
|
||||
The size of ble controller log partition shall be a multiples of 4K.
|
||||
The name of log partition shall be "bt_ctrl_log".
|
||||
The partition type shall be ESP_PARTITION_TYPE_DATA.
|
||||
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
|
||||
|
||||
config BT_LE_LOG_CTRL_BUF1_SIZE
|
||||
int "size of the first BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
config BT_LE_LOG_CTRL_BUF1_SIZE
|
||||
int "size of the first BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
Configure the size of the first BLE controller LOG buffer.
|
||||
|
||||
config BT_LE_LOG_CTRL_BUF2_SIZE
|
||||
int "size of the second BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 1024
|
||||
help
|
||||
config BT_LE_LOG_CTRL_BUF2_SIZE
|
||||
int "size of the second BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 1024
|
||||
help
|
||||
Configure the size of the second BLE controller LOG buffer.
|
||||
|
||||
config BT_LE_LOG_HCI_BUF_SIZE
|
||||
int "size of the BLE HCI LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
config BT_LE_LOG_HCI_BUF_SIZE
|
||||
int "size of the BLE HCI LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
Configure the size of the BLE HCI LOG buffer.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
|
||||
bool "Enable wrap panic handler"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Wrap esp_panic_handler to get controller logs when PC pointer exception crashes.
|
||||
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
|
||||
bool "Enable wrap panic handler"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Wrap esp_panic_handler to get controller logs when PC pointer exception crashes.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
|
||||
bool "Enable esp_task_wdt_isr_user_handler implementation"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Implement esp_task_wdt_isr_user_handler to get controller logs when task wdt issue is triggered.
|
||||
config BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
|
||||
bool "Enable esp_task_wdt_isr_user_handler implementation"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Implement esp_task_wdt_isr_user_handler to get controller logs when task wdt issue is triggered.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL
|
||||
int "The output level of controller log"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 5
|
||||
default 1
|
||||
help
|
||||
The output level of controller log.
|
||||
config BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL
|
||||
int "The output level of controller log"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 5
|
||||
default 1
|
||||
help
|
||||
The output level of controller log.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH
|
||||
hex "The switch of module log output"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 0xFFFFFFFF
|
||||
default 0xFFFFFFFF
|
||||
help
|
||||
The switch of module log output, this is an unsigned 32-bit hexadecimal value.
|
||||
config BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH
|
||||
hex "The switch of module log output"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 0xFFFFFFFF
|
||||
default 0xFFFFFFFF
|
||||
help
|
||||
The switch of module log output, this is an unsigned 32-bit hexadecimal value.
|
||||
|
||||
config BT_LE_ERROR_SIM_ENABLED
|
||||
bool "Enable controller features for internal testing"
|
||||
default n
|
||||
|
||||
config BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
|
||||
bool "When ACL disconnects abnormally, assertion processing is performed(Experimental)"
|
||||
default n
|
||||
|
||||
config BT_LE_DEBUG_REMAIN_SCENE_ENABLED
|
||||
bool "Remain scene with GDB to capture relevant status info(Experimental)"
|
||||
default n
|
||||
help
|
||||
Retain scene with GDB to capture info, requires disabling WDT (CONFIG_ESP_INT_WDT, CONFIG_ESP_TASK_WDT_EN).
|
||||
endmenu
|
||||
|
||||
config BT_LE_LL_RESOLV_LIST_SIZE
|
||||
int "BLE LL Resolving list size"
|
||||
@ -776,14 +792,14 @@ config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
|
||||
The value of upperlimitmax needs to be a power of 2.
|
||||
|
||||
config BT_LE_CTRL_CHAN_ASS_EN
|
||||
bool "Enable channel assessment"
|
||||
bool "Enable channel assessment(Experimental)"
|
||||
default n
|
||||
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 BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX
|
||||
bool "Enable aux packet when ext adv data length is zero"
|
||||
bool "Enable aux packet when ext adv data length is zero(Experimental)"
|
||||
default y
|
||||
help
|
||||
When this option is enabled, auxiliary packets will be present in the events of
|
||||
|
106
components/bt/controller/esp32c6/ble.c
Normal file
106
components/bt/controller/esp32c6/ble.c
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_bt_cfg.h"
|
||||
|
||||
/* External functions or variables
|
||||
************************************************************************
|
||||
*/
|
||||
int base_stack_initEnv(void);
|
||||
void base_stack_deinitEnv(void);
|
||||
int base_stack_enable(void);
|
||||
void base_stack_disable(void);
|
||||
|
||||
int conn_stack_initEnv(void);
|
||||
void conn_stack_deinitEnv(void);
|
||||
int conn_stack_enable(void);
|
||||
void conn_stack_disable(void);
|
||||
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
int conn_errorSim_initEnv(void);
|
||||
void conn_errorSim_deinitEnv(void);
|
||||
int conn_errorSim_enable(void);
|
||||
void conn_errorSim_disable(void);
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
|
||||
/* Local functions definition
|
||||
***************************************************************************
|
||||
*/
|
||||
int ble_stack_initEnv(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = base_stack_initEnv();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
rc = conn_stack_initEnv();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
rc = conn_errorSim_initEnv();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ble_stack_deinitEnv(void)
|
||||
{
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_errorSim_deinitEnv();
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_stack_deinitEnv();
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
base_stack_deinitEnv();
|
||||
}
|
||||
|
||||
int ble_stack_enable(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = base_stack_enable();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
rc = conn_stack_enable();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
rc = conn_errorSim_enable();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ble_stack_disable(void)
|
||||
{
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_errorSim_disable();
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_stack_disable();
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
base_stack_disable();
|
||||
}
|
12
components/bt/controller/esp32c6/ble_priv.h
Normal file
12
components/bt/controller/esp32c6/ble_priv.h
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
int ble_stack_initEnv(void);
|
||||
|
||||
void ble_stack_deinitEnv(void);
|
||||
|
||||
int ble_stack_enable(void);
|
||||
|
||||
void ble_stack_disable(void);
|
@ -35,6 +35,7 @@
|
||||
|
||||
#include "esp_bt.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
#include "ble_priv.h"
|
||||
#include "esp_sleep.h"
|
||||
#include "esp_pm.h"
|
||||
#include "esp_phy_init.h"
|
||||
@ -115,6 +116,7 @@ typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
|
||||
*/
|
||||
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
|
||||
extern int r_ble_controller_init(esp_bt_controller_config_t *cfg);
|
||||
extern void esp_ble_controller_info_capture(uint32_t cycle_times);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
extern int r_ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
|
||||
extern int r_ble_log_deinit_async(void);
|
||||
@ -956,13 +958,19 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
goto modem_deint;
|
||||
}
|
||||
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble controller commit:[%s]", ble_controller_get_compile_version());
|
||||
|
||||
ret = r_ble_controller_init(cfg);
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "r_ble_controller_init failed %d", ret);
|
||||
goto modem_deint;
|
||||
}
|
||||
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble controller commit:[%s]", ble_controller_get_compile_version());
|
||||
ret = ble_stack_initEnv();
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_stack_initEnv failed %d", ret);
|
||||
goto free_controller;
|
||||
}
|
||||
|
||||
ble_controller_scan_duplicate_config();
|
||||
|
||||
@ -1005,6 +1013,7 @@ free_controller:
|
||||
hci_transport_deinit();
|
||||
controller_sleep_deinit();
|
||||
os_msys_deinit();
|
||||
ble_stack_deinitEnv();
|
||||
r_ble_controller_deinit();
|
||||
modem_deint:
|
||||
esp_ble_unregister_bb_funcs();
|
||||
@ -1042,6 +1051,7 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
|
||||
modem_clock_module_disable(PERIPH_BT_MODULE);
|
||||
|
||||
ble_stack_deinitEnv();
|
||||
r_ble_controller_deinit();
|
||||
esp_ble_unregister_bb_funcs();
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
@ -1095,6 +1105,12 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
r_ble_ll_scan_start_time_init_compensation(500);
|
||||
r_priv_sdk_config_insert_proc_time_set(500);
|
||||
#endif // CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY
|
||||
|
||||
if (ble_stack_enable() != 0) {
|
||||
ret = ESP_FAIL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (r_ble_controller_enable(mode) != 0) {
|
||||
ret = ESP_FAIL;
|
||||
goto error;
|
||||
@ -1103,6 +1119,7 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
return ESP_OK;
|
||||
|
||||
error:
|
||||
ble_stack_disable();
|
||||
#if CONFIG_SW_COEXIST_ENABLE
|
||||
coex_disable();
|
||||
#endif
|
||||
@ -1126,6 +1143,7 @@ esp_err_t esp_bt_controller_disable(void)
|
||||
if (r_ble_controller_disable() != 0) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
ble_stack_disable();
|
||||
#if CONFIG_SW_COEXIST_ENABLE
|
||||
coex_disable();
|
||||
#endif
|
||||
@ -1635,3 +1653,36 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
|
||||
|
||||
#endif // CONFIG_BT_LE_SM_LEGACY || CONFIG_BT_LE_SM_SC
|
||||
#endif // (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
|
||||
|
||||
#if CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
|
||||
#include "esp_gdbstub.h"
|
||||
#endif // CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
|
||||
|
||||
int IRAM_ATTR
|
||||
ble_capture_info_user_handler(uint8_t type, uint32_t reason)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch(type) {
|
||||
case 0:
|
||||
for (i = 0; i < 2; i++) {
|
||||
esp_ble_controller_info_capture(0x010101);
|
||||
}
|
||||
#if CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
|
||||
uintptr_t sp;
|
||||
__asm__ volatile ("mv %0, sp" : "=r" (sp));
|
||||
esp_gdbstub_panic_handler(&sp);
|
||||
#endif // CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
|
||||
break;
|
||||
#if CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
|
||||
case 1:
|
||||
if ((reason == 0x08) || (reason == 0x3d) || (reason == 0x28)) {
|
||||
osi_assert_wrapper(__LINE__,__func__, type, reason);
|
||||
}
|
||||
break;
|
||||
#endif // CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -306,110 +306,126 @@ config BT_LE_CONTROLLER_TASK_STACK_SIZE
|
||||
help
|
||||
This configures stack size of NimBLE controller task
|
||||
|
||||
menuconfig BT_LE_CONTROLLER_LOG_ENABLED
|
||||
bool "Controller log enable"
|
||||
default n
|
||||
help
|
||||
Enable controller log
|
||||
menu "Controller debug features"
|
||||
menuconfig BT_LE_CONTROLLER_LOG_ENABLED
|
||||
bool "Controller log enable"
|
||||
default n
|
||||
help
|
||||
Enable controller log
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
bool "enable controller log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
bool "enable controller log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
Enable controller log module
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
bool "enable HCI log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
bool "enable HCI log module"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
Enable hci log module
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
bool "Controller log dump mode only"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
bool "Controller log dump mode only"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
Only operate in dump mode
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
bool "Output ble controller logs to SPI bus (Experimental)"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
select BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
default n
|
||||
help
|
||||
Output ble controller logs to SPI bus
|
||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||
bool "Output ble controller logs to SPI bus (Experimental)"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
select BT_BLE_LOG_SPI_OUT_ENABLED
|
||||
default n
|
||||
help
|
||||
Output ble controller logs to SPI bus
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
bool "Store ble controller logs to flash(Experimental)"
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
bool "Store ble controller logs to flash(Experimental)"
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Store ble controller logs to flash memory.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
||||
int "size of ble controller log partition(Multiples of 4K)"
|
||||
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
default 65536
|
||||
help
|
||||
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
||||
int "size of ble controller log partition(Multiples of 4K)"
|
||||
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
default 65536
|
||||
help
|
||||
The size of ble controller log partition shall be a multiples of 4K.
|
||||
The name of log partition shall be "bt_ctrl_log".
|
||||
The partition type shall be ESP_PARTITION_TYPE_DATA.
|
||||
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
|
||||
|
||||
config BT_LE_LOG_CTRL_BUF1_SIZE
|
||||
int "size of the first BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
config BT_LE_LOG_CTRL_BUF1_SIZE
|
||||
int "size of the first BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
Configure the size of the first BLE controller LOG buffer.
|
||||
|
||||
config BT_LE_LOG_CTRL_BUF2_SIZE
|
||||
int "size of the second BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 1024
|
||||
help
|
||||
config BT_LE_LOG_CTRL_BUF2_SIZE
|
||||
int "size of the second BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 1024
|
||||
help
|
||||
Configure the size of the second BLE controller LOG buffer.
|
||||
|
||||
config BT_LE_LOG_HCI_BUF_SIZE
|
||||
int "size of the BLE HCI LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
config BT_LE_LOG_HCI_BUF_SIZE
|
||||
int "size of the BLE HCI LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default 4096
|
||||
help
|
||||
Configure the size of the BLE HCI LOG buffer.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
|
||||
bool "Enable wrap panic handler"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Wrap esp_panic_handler to get controller logs when PC pointer exception crashes.
|
||||
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
|
||||
bool "Enable wrap panic handler"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Wrap esp_panic_handler to get controller logs when PC pointer exception crashes.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
|
||||
bool "Enable esp_task_wdt_isr_user_handler implementation"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Implement esp_task_wdt_isr_user_handler to get controller logs when task wdt issue is triggered.
|
||||
config BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
|
||||
bool "Enable esp_task_wdt_isr_user_handler implementation"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Implement esp_task_wdt_isr_user_handler to get controller logs when task wdt issue is triggered.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL
|
||||
int "The output level of controller log"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 5
|
||||
default 1
|
||||
help
|
||||
The output level of controller log.
|
||||
config BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL
|
||||
int "The output level of controller log"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 5
|
||||
default 1
|
||||
help
|
||||
The output level of controller log.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH
|
||||
hex "The switch of module log output"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 0xFFFFFFFF
|
||||
default 0xFFFFFFFF
|
||||
help
|
||||
The switch of module log output, this is an unsigned 32-bit hexadecimal value.
|
||||
config BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH
|
||||
hex "The switch of module log output"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
range 0 0xFFFFFFFF
|
||||
default 0xFFFFFFFF
|
||||
help
|
||||
The switch of module log output, this is an unsigned 32-bit hexadecimal value.
|
||||
|
||||
config BT_LE_ERROR_SIM_ENABLED
|
||||
bool "Enable controller features for internal testing"
|
||||
default n
|
||||
|
||||
config BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
|
||||
bool "When ACL disconnects abnormally, assertion processing is performed(Experimental)"
|
||||
default n
|
||||
|
||||
config BT_LE_DEBUG_REMAIN_SCENE_ENABLED
|
||||
bool "Remain scene with GDB to capture relevant status info(Experimental)"
|
||||
default n
|
||||
help
|
||||
Retain scene with GDB to capture info, requires disabling WDT (CONFIG_ESP_INT_WDT, CONFIG_ESP_TASK_WDT_EN).
|
||||
endmenu
|
||||
|
||||
config BT_LE_LL_RESOLV_LIST_SIZE
|
||||
int "BLE LL Resolving list size"
|
||||
@ -777,14 +793,14 @@ config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
|
||||
The value of upperlimitmax needs to be a power of 2.
|
||||
|
||||
config BT_LE_CTRL_CHAN_ASS_EN
|
||||
bool "Enable channel assessment"
|
||||
bool "Enable channel assessment(Experimental)"
|
||||
default n
|
||||
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 BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX
|
||||
bool "Enable aux packet when ext adv data length is zero"
|
||||
bool "Enable aux packet when ext adv data length is zero(Experimental)"
|
||||
default y
|
||||
help
|
||||
When this option is enabled, auxiliary packets will be present in the events of
|
||||
|
106
components/bt/controller/esp32h2/ble.c
Normal file
106
components/bt/controller/esp32h2/ble.c
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_bt_cfg.h"
|
||||
|
||||
/* External functions or variables
|
||||
************************************************************************
|
||||
*/
|
||||
int base_stack_initEnv(void);
|
||||
void base_stack_deinitEnv(void);
|
||||
int base_stack_enable(void);
|
||||
void base_stack_disable(void);
|
||||
|
||||
int conn_stack_initEnv(void);
|
||||
void conn_stack_deinitEnv(void);
|
||||
int conn_stack_enable(void);
|
||||
void conn_stack_disable(void);
|
||||
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
int conn_errorSim_initEnv(void);
|
||||
void conn_errorSim_deinitEnv(void);
|
||||
int conn_errorSim_enable(void);
|
||||
void conn_errorSim_disable(void);
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
|
||||
/* Local functions definition
|
||||
***************************************************************************
|
||||
*/
|
||||
int ble_stack_initEnv(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = base_stack_initEnv();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
rc = conn_stack_initEnv();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
rc = conn_errorSim_initEnv();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ble_stack_deinitEnv(void)
|
||||
{
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_errorSim_deinitEnv();
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_stack_deinitEnv();
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
base_stack_deinitEnv();
|
||||
}
|
||||
|
||||
int ble_stack_enable(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = base_stack_enable();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
rc = conn_stack_enable();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
rc = conn_errorSim_enable();
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ble_stack_disable(void)
|
||||
{
|
||||
#if DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_errorSim_disable();
|
||||
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
|
||||
conn_stack_disable();
|
||||
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
|
||||
|
||||
base_stack_disable();
|
||||
}
|
12
components/bt/controller/esp32h2/ble_priv.h
Normal file
12
components/bt/controller/esp32h2/ble_priv.h
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
int ble_stack_initEnv(void);
|
||||
|
||||
void ble_stack_deinitEnv(void);
|
||||
|
||||
int ble_stack_enable(void);
|
||||
|
||||
void ble_stack_disable(void);
|
@ -34,6 +34,7 @@
|
||||
#include "os/endian.h"
|
||||
|
||||
#include "esp_bt.h"
|
||||
#include "ble_priv.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
#include "esp_sleep.h"
|
||||
#include "esp_pm.h"
|
||||
@ -109,6 +110,7 @@ typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
|
||||
*/
|
||||
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
|
||||
extern int r_ble_controller_init(esp_bt_controller_config_t *cfg);
|
||||
extern void esp_ble_controller_info_capture(uint32_t cycle_times);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
extern int r_ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
|
||||
extern int r_ble_log_deinit_async(void);
|
||||
@ -939,13 +941,19 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
goto modem_deint;
|
||||
}
|
||||
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble controller commit:[%s]", ble_controller_get_compile_version());
|
||||
|
||||
ret = r_ble_controller_init(cfg);
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "r_ble_controller_init failed %d", ret);
|
||||
goto modem_deint;
|
||||
}
|
||||
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble controller commit:[%s]", ble_controller_get_compile_version());
|
||||
ret = ble_stack_initEnv();
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_stack_initEnv failed %d", ret);
|
||||
goto free_controller;
|
||||
}
|
||||
|
||||
ble_controller_scan_duplicate_config();
|
||||
|
||||
@ -988,6 +996,7 @@ free_controller:
|
||||
hci_transport_deinit();
|
||||
controller_sleep_deinit();
|
||||
os_msys_deinit();
|
||||
ble_stack_deinitEnv();
|
||||
r_ble_controller_deinit();
|
||||
modem_deint:
|
||||
esp_ble_unregister_bb_funcs();
|
||||
@ -1023,6 +1032,7 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
|
||||
modem_clock_module_disable(PERIPH_BT_MODULE);
|
||||
|
||||
ble_stack_deinitEnv();
|
||||
r_ble_controller_deinit();
|
||||
esp_ble_unregister_bb_funcs();
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
@ -1076,6 +1086,12 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
r_ble_ll_scan_start_time_init_compensation(500);
|
||||
r_priv_sdk_config_insert_proc_time_set(500);
|
||||
#endif // CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY
|
||||
|
||||
if (ble_stack_enable() != 0) {
|
||||
ret = ESP_FAIL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (r_ble_controller_enable(mode) != 0) {
|
||||
ret = ESP_FAIL;
|
||||
goto error;
|
||||
@ -1084,6 +1100,7 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
return ESP_OK;
|
||||
|
||||
error:
|
||||
ble_stack_disable();
|
||||
#if CONFIG_SW_COEXIST_ENABLE
|
||||
coex_disable();
|
||||
#endif
|
||||
@ -1107,6 +1124,7 @@ esp_err_t esp_bt_controller_disable(void)
|
||||
if (r_ble_controller_disable() != 0) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
ble_stack_disable();
|
||||
#if CONFIG_SW_COEXIST_ENABLE
|
||||
coex_disable();
|
||||
#endif
|
||||
@ -1615,3 +1633,35 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
|
||||
|
||||
#endif // CONFIG_BT_LE_SM_LEGACY || CONFIG_BT_LE_SM_SC
|
||||
#endif // (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
|
||||
#if CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
|
||||
#include "esp_gdbstub.h"
|
||||
#endif // CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
|
||||
|
||||
int IRAM_ATTR
|
||||
ble_capture_info_user_handler(uint8_t type, uint32_t reason)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch(type) {
|
||||
case 0:
|
||||
for (i = 0; i < 2; i++) {
|
||||
esp_ble_controller_info_capture(0x010101);
|
||||
}
|
||||
#if CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
|
||||
uintptr_t sp;
|
||||
__asm__ volatile ("mv %0, sp" : "=r" (sp));
|
||||
esp_gdbstub_panic_handler(&sp);
|
||||
#endif // CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
|
||||
break;
|
||||
#if CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
|
||||
case 1:
|
||||
if ((reason == 0x08) || (reason == 0x3d) || (reason == 0x28)) {
|
||||
osi_assert_wrapper(__LINE__,__func__, type, reason);
|
||||
}
|
||||
break;
|
||||
#endif // CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 35fb599d3733f50254c056171edebcaa3c57d06b
|
||||
Subproject commit 6093909e01930f8cda6f60510f8a412c6d1814e8
|
@ -1 +1 @@
|
||||
Subproject commit 4cb60b2cd1c560a85effde18465b0412e715b048
|
||||
Subproject commit 08946905ec0dfcbfc7dd2919b27e43cbcbde66ed
|
@ -1 +1 @@
|
||||
Subproject commit 7d35fc30e8cada9567f97378e24608bc63b080e4
|
||||
Subproject commit e755a655979177c9551d5fb3613ebb4885aab3a5
|
@ -4003,7 +4003,6 @@ static void btm_ble_stop_discover(void)
|
||||
|
||||
if (!BTM_BLE_IS_SCAN_ACTIVE(p_ble_cb->scan_activity)) {
|
||||
/* Clear the inquiry callback if set */
|
||||
btm_cb.ble_ctr_cb.inq_var.scan_type = BTM_BLE_SCAN_MODE_NONE;
|
||||
btm_cb.ble_ctr_cb.inq_var.state &= ~BTM_BLE_SCANNING;
|
||||
/* stop discovery now */
|
||||
if(btsnd_hcic_ble_set_scan_enable (BTM_BLE_SCAN_DISABLE, BTM_BLE_DUPLICATE_ENABLE)) {
|
||||
|
@ -205,6 +205,16 @@ the adv packet will be discarded until the memory is restored. */
|
||||
#define BTDM_BLE_CHAN_ASS_EN (0)
|
||||
#endif
|
||||
|
||||
#if CONFIG_BTDM_CTRL_CONTROLLER_DEBUG_MODE_1
|
||||
#define BTDM_CTRL_CONTROLLER_DEBUG_MODE_1 (1 << 1)
|
||||
#else
|
||||
#define BTDM_CTRL_CONTROLLER_DEBUG_MODE_1 0
|
||||
#endif
|
||||
|
||||
#ifndef BTDM_CTRL_CONTROLLER_DEBUG_FLAG
|
||||
#define BTDM_CTRL_CONTROLLER_DEBUG_FLAG (BTDM_CTRL_CONTROLLER_DEBUG_MODE_1 | CONTROLLER_ADV_LOST_DEBUG_BIT)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BTDM_BLE_PING_EN)
|
||||
#define BTDM_BLE_PING_EN (CONFIG_BTDM_BLE_PING_EN)
|
||||
#else
|
||||
@ -224,7 +234,7 @@ the adv packet will be discarded until the memory is restored. */
|
||||
.normal_adv_size = NORMAL_SCAN_DUPLICATE_CACHE_SIZE, \
|
||||
.mesh_adv_size = MESH_DUPLICATE_SCAN_CACHE_SIZE, \
|
||||
.send_adv_reserved_size = SCAN_SEND_ADV_RESERVED_SIZE, \
|
||||
.controller_debug_flag = CONTROLLER_ADV_LOST_DEBUG_BIT, \
|
||||
.controller_debug_flag = BTDM_CTRL_CONTROLLER_DEBUG_FLAG, \
|
||||
.mode = BTDM_CONTROLLER_MODE_EFF, \
|
||||
.ble_max_conn = CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF, \
|
||||
.bt_max_acl_conn = CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF, \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -826,6 +826,13 @@ reset_err:
|
||||
// There is an enabled (active) device. We need to indicate to USBH that the device is gone
|
||||
pass_event_to_usbh = true;
|
||||
break;
|
||||
case ROOT_PORT_STATE_RECOVERY:
|
||||
// In a very rare case of having 2 or more events of type DISCONNECTION/ERROR/OVERCURRENT
|
||||
// in a short time, we can endup here, where the driver has not yet recovered from
|
||||
// the 1st error but already got a 2nd error.
|
||||
// Just check that the RECOVER action is requested and return
|
||||
assert(p_hub_driver_obj->dynamic.port_reqs | PORT_REQ_RECOVER);
|
||||
break;
|
||||
default:
|
||||
abort(); // Should never occur
|
||||
break;
|
||||
|
@ -5,7 +5,7 @@ RF Coexistence
|
||||
Overview
|
||||
---------------
|
||||
|
||||
ESP boards now support three modules: Bluetooth (BT & BLE), IEEE802.15.4, and Wi-Fi. Each type of board has only one 2.4 GHz ISM band RF module, shared by two or three modules. Consequently, a module cannot receive or transmit data while another module is engaged in data transmission or reception. In such scenarios, {IDF_TARGET_NAME} employs the time-division multiplexing method to manage the reception and transmission of packets.
|
||||
ESP boards now support three modules: Bluetooth (BT & BLE), IEEE 802.15.4 (Thread / Zigbee), and Wi-Fi. Each type of board has only one 2.4 GHz ISM band RF module, shared by two or three modules. Consequently, a module cannot receive or transmit data while another module is engaged in data transmission or reception. In such scenarios, {IDF_TARGET_NAME} employs the time-division multiplexing method to manage the reception and transmission of packets.
|
||||
|
||||
|
||||
Supported Coexistence Scenario for {IDF_TARGET_NAME}
|
||||
@ -15,32 +15,32 @@ Supported Coexistence Scenario for {IDF_TARGET_NAME}
|
||||
|
||||
.. table:: Supported Features of Wi-Fi and BLE Coexistence
|
||||
|
||||
+-------+--------+-----------+-----+------------+-----------+----------+
|
||||
| |BLE |
|
||||
+ +-----+------------+-----------+----------+
|
||||
| |Scan |Advertising |Connecting |Connected |
|
||||
+-------+--------+-----------+-----+------------+-----------+----------+
|
||||
| Wi-Fi |STA |Scan |Y |Y |Y |Y |
|
||||
+ + +-----------+-----+------------+-----------+----------+
|
||||
| | |Connecting |Y |Y |Y |Y |
|
||||
+ + +-----------+-----+------------+-----------+----------+
|
||||
| | |Connected |Y |Y |Y |Y |
|
||||
+ +--------+-----------+-----+------------+-----------+----------+
|
||||
| |SOFTAP |TX Beacon |Y |Y |Y |Y |
|
||||
+ + +-----------+-----+------------+-----------+----------+
|
||||
| | |Connecting |C1 |C1 |C1 |C1 |
|
||||
+ + +-----------+-----+------------+-----------+----------+
|
||||
| | |Connected |C1 |C1 |C1 |C1 |
|
||||
+ +--------+-----------+-----+------------+-----------+----------+
|
||||
| |Sniffer |RX |C1 |C1 |C1 |C1 |
|
||||
+ +--------+-----------+-----+------------+-----------+----------+
|
||||
| |ESP-NOW |RX |S |S |S |S |
|
||||
+ + +-----------+-----+------------+-----------+----------+
|
||||
| | |TX |Y |Y |Y |Y |
|
||||
+-------+--------+-----------+-----+------------+-----------+----------+
|
||||
+-------+--------+-----------+-----+------------+----------+
|
||||
| |BLE |
|
||||
+ +-----+------------+----------+
|
||||
| |Scan |Advertising |Connected |
|
||||
+-------+--------+-----------+-----+------------+----------+
|
||||
| Wi-Fi |STA |Scan |Y |Y |Y |
|
||||
+ + +-----------+-----+------------+----------+
|
||||
| | |Connecting |Y |Y |Y |
|
||||
+ + +-----------+-----+------------+----------+
|
||||
| | |Connected |Y |Y |Y |
|
||||
+ +--------+-----------+-----+------------+----------+
|
||||
| |SOFTAP |TX Beacon |Y |Y |Y |
|
||||
+ + +-----------+-----+------------+----------+
|
||||
| | |Connecting |C1 |C1 |C1 |
|
||||
+ + +-----------+-----+------------+----------+
|
||||
| | |Connected |C1 |C1 |C1 |
|
||||
+ +--------+-----------+-----+------------+----------+
|
||||
| |Sniffer |RX |C1 |C1 |C1 |
|
||||
+ +--------+-----------+-----+------------+----------+
|
||||
| |ESP-NOW |RX |S |S |S |
|
||||
+ + +-----------+-----+------------+----------+
|
||||
| | |TX |Y |Y |Y |
|
||||
+-------+--------+-----------+-----+------------+----------+
|
||||
|
||||
|
||||
.. only:: esp32
|
||||
.. only:: SOC_WIFI_SUPPORTED and SOC_BT_CLASSIC_SUPPORTED
|
||||
|
||||
.. table:: Supported Features of Wi-Fi and Classic Bluetooth (BT) Coexistence
|
||||
|
||||
@ -68,31 +68,62 @@ Supported Coexistence Scenario for {IDF_TARGET_NAME}
|
||||
| | |TX |Y |Y |Y |Y |Y |
|
||||
+-------+--------+-----------+--------+-------------+-----+----------+-----------+
|
||||
|
||||
.. only:: SOC_IEEE802154_SUPPORTED
|
||||
.. only:: SOC_WIFI_SUPPORTED and SOC_IEEE802154_SUPPORTED
|
||||
|
||||
.. table:: Supported Features of Thread (IEEE802.15.4) and BLE Coexistence
|
||||
.. table:: Supported Features of Wi-Fi and IEEE 802.15.4 (Thread / Zigbee) Coexistence
|
||||
|
||||
+--------+-----------------+-----+------------+-----------+----------+
|
||||
| |BLE |
|
||||
+ +-----+------------+-----------+----------+
|
||||
| |Scan |Advertising |Connecting |Connected |
|
||||
+--------+-----------------+-----+------------+-----------+----------+
|
||||
| Thread |Scan |X |Y |Y |Y |
|
||||
+ +-----------------+-----+------------+-----------+----------+
|
||||
| |Connecting |X |Y |Y |Y |
|
||||
+ +-----------------+-----+------------+-----------+----------+
|
||||
| |Connected |X |Y |Y |Y |
|
||||
+ +-----------------+-----+------------+-----------+----------+
|
||||
| |Connected | | | | |
|
||||
| |(high throughput)|X |C1 |C1 |C1 |
|
||||
+--------+-----------------+-----+------------+-----------+----------+
|
||||
+-------+--------+-----------+--------+---------+-----------+
|
||||
| |Thread / Zigbee |
|
||||
+ +--------+---------+-----------+
|
||||
| |Scan |Router |End Device |
|
||||
+-------+--------+-----------+--------+---------+-----------+
|
||||
| Wi-Fi |STA |Scan |C1 |C1 |Y |
|
||||
+ + +-----------+--------+---------+-----------+
|
||||
| | |Connecting |C1 |C1 |Y |
|
||||
+ + +-----------+--------+---------+-----------+
|
||||
| | |Connected |C1 |C1 |Y |
|
||||
+ +--------+-----------+--------+---------+-----------+
|
||||
| |SOFTAP |TX Beacon |Y |X |Y |
|
||||
+ + +-----------+--------+---------+-----------+
|
||||
| | |Connecting |C1 |X |C1 |
|
||||
+ + +-----------+--------+---------+-----------+
|
||||
| | |Connected |C1 |X |C1 |
|
||||
+ +--------+-----------+--------+---------+-----------+
|
||||
| |Sniffer |RX |C1 |X |C1 |
|
||||
+-------+--------+-----------+--------+---------+-----------+
|
||||
|
||||
.. only:: SOC_BLE_SUPPORTED and SOC_IEEE802154_SUPPORTED
|
||||
|
||||
.. table:: Supported Features of IEEE 802.15.4 (Thread / Zigbee) and BLE Coexistence
|
||||
|
||||
+-----------------+-------------+-----+------------+----------+
|
||||
| |BLE |
|
||||
+ +-----+------------+----------+
|
||||
| |Scan |Advertising |Connected |
|
||||
+-----------------+-------------+-----+------------+----------+
|
||||
| Thread / Zigbee |Scan |X |Y |Y |
|
||||
+ +-------------+-----+------------+----------+
|
||||
| |Router |X |Y |Y |
|
||||
+ +-------------+-----+------------+----------+
|
||||
| |End Device |C1 |Y |Y |
|
||||
+-----------------+-------------+-----+------------+----------+
|
||||
|
||||
.. note::
|
||||
|
||||
Y: supported and performance is stable
|
||||
C1: supported but the performance is unstable
|
||||
X: not supported
|
||||
S: supported and performance is stable in STA mode, otherwise not supported
|
||||
.. list::
|
||||
|
||||
- Y: supported and the performance is stable
|
||||
- C1: supported but the performance is unstable
|
||||
- X: not supported
|
||||
:SOC_WIFI_SUPPORTED: - S: supported and the performance is stable in STA mode, otherwise not supported
|
||||
|
||||
.. only:: SOC_IEEE802154_SUPPORTED
|
||||
|
||||
.. note::
|
||||
|
||||
Routers in Thread and Zigbee networks maintain unsynchronized links with their neighbors, requiring continuous signal reception. With only a single RF path, increased Wi-Fi or BLE traffic may lead to higher packet loss rates for Thread and Zigbee communications.
|
||||
|
||||
To build a Wi-Fi based Thread Border Router or Zigbee Gateway product, we recommend using a dual-SoC solution (e.g., ESP32-S3 + ESP32-H2) with separate antennas. This setup enables simultaneous reception of Wi-Fi and 802.15.4 signals, ensuring optimal performance.
|
||||
|
||||
Coexistence Mechanism and Policy
|
||||
------------------------------------------------
|
||||
@ -100,7 +131,7 @@ Coexistence Mechanism and Policy
|
||||
Coexistence Mechanism
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The RF resource allocation mechanism is based on priority. As shown below, both Bluetooth module and Wi-Fi module request RF resources from the coexistence module, and the coexistence module decides who will use the RF resource based on their priority.
|
||||
The RF resource allocation mechanism is based on priority. As shown below, Wi-Fi, Bluetooth and 802.15.4 modules request RF resources from the coexistence module, and the coexistence module decides who will use the RF resource based on their priority.
|
||||
|
||||
.. blockdiag::
|
||||
:scale: 100%
|
||||
@ -118,15 +149,17 @@ The RF resource allocation mechanism is based on priority. As shown below, both
|
||||
default_group_color = none;
|
||||
|
||||
# node labels
|
||||
Wi-Fi [shape = box];
|
||||
Bluetooth [shape = box];
|
||||
Coexistence [shape = box, label = 'Coexistence module'];
|
||||
RF [shape = box, label = 'RF module'];
|
||||
Wi-Fi [shape = box];
|
||||
Bluetooth [shape = box];
|
||||
802.15.4 [shape = box];
|
||||
Coexistence [shape = box, label = 'Coexistence module'];
|
||||
RF [shape = box, label = 'RF module'];
|
||||
|
||||
# node connections
|
||||
Wi-Fi -> Coexistence;
|
||||
Bluetooth -> Coexistence;
|
||||
Coexistence -> RF;
|
||||
Wi-Fi -> Coexistence;
|
||||
Bluetooth -> Coexistence;
|
||||
802.15.4 -> Coexistence;
|
||||
Coexistence -> RF;
|
||||
}
|
||||
|
||||
|
||||
@ -135,45 +168,48 @@ The RF resource allocation mechanism is based on priority. As shown below, both
|
||||
Coexistence Policy
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Coexistence Period and Time Slice
|
||||
""""""""""""""""""""""""""""""""""""""""
|
||||
.. only:: SOC_WIFI_SUPPORTED and SOC_BT_SUPPORTED
|
||||
|
||||
.. only:: esp32
|
||||
Coexistence Period and Time Slice
|
||||
""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
Wi-Fi, BT, and BLE have their fixed time slice to use the RF. A coexistence period is divided into 3 time slices in the order of Wi-Fi, BT, and BLE. In the Wi-Fi slice, Wi-Fi's request to the coexistence arbitration module will have higher priority. Similarly, BT/BLE can enjoy higher priority at their own time slices. The duration of the coexistence period and the proportion of each time slice are divided into four categories according to the Wi-Fi status:
|
||||
.. only:: SOC_BLE_SUPPORTED and SOC_BT_CLASSIC_SUPPORTED
|
||||
|
||||
Wi-Fi, BT, and BLE have their fixed time slice to use the RF. A coexistence period is divided into 3 time slices in the order of Wi-Fi, BT, and BLE. In the Wi-Fi slice, Wi-Fi's request to the coexistence arbitration module will have higher priority. Similarly, BT/BLE can enjoy higher priority at their own time slices. The duration of the coexistence period and the proportion of each time slice are divided into four categories according to the Wi-Fi status:
|
||||
|
||||
|
||||
.. only:: SOC_WIFI_SUPPORTED and SOC_BLE_SUPPORTED and not esp32
|
||||
.. only:: not SOC_BT_CLASSIC_SUPPORTED
|
||||
|
||||
Wi-Fi and BLE have their fixed time slice to use the RF. In the Wi-Fi time slice, Wi-Fi will send a higher priority request to the coexistence arbitration module. Similarly, BLE can enjoy higher priority at their own time slice. The duration of the coexistence period and the proportion of each time slice are divided into four categories according to the Wi-Fi status:
|
||||
Wi-Fi and BLE have their fixed time slice to use the RF. In the Wi-Fi time slice, Wi-Fi will send a higher priority request to the coexistence arbitration module. Similarly, BLE can enjoy higher priority at their own time slice. The duration of the coexistence period and the proportion of each time slice are divided into four categories according to the Wi-Fi status:
|
||||
|
||||
.. list::
|
||||
|
||||
:SOC_BLE_SUPPORTED and SOC_BT_CLASSIC_SUPPORTED: 1) IDLE status: the coexistence of BT and BLE is controlled by Bluetooth module.
|
||||
:not SOC_BT_CLASSIC_SUPPORTED: 1) IDLE status: RF module is controlled by Bluetooth module.
|
||||
#) CONNECTED status: the coexistence period starts at the Target Beacon Transmission Time (TBTT) and is more than 100 ms.
|
||||
#) SCAN status: Wi-Fi slice and coexistence period are longer than in the CONNECTED status. To ensure Bluetooth performance, the Bluetooth time slice will also be adjusted accordingly.
|
||||
#) CONNECTING status: Wi-Fi slice is longer than in the CONNECTED status. To ensure Bluetooth performance, the Bluetooth time slice will also be adjusted accordingly.
|
||||
|
||||
|
||||
According to the coexistence logic, different coexistence periods and time slice strategies will be selected based on the Wi-Fi and Bluetooth usage scenarios. A Coexistence policy corresponding to a certain usage scenarios is called a "coexistence scheme". For example, the scenario of Wi-Fi CONNECTED and BLE CONNECTED has a corresponding coexistence scheme. In this scheme, the time slices of Wi-Fi and BLE in a coexistence period each account for 50%. The time allocation is shown in the following figure:
|
||||
|
||||
.. figure:: ../../_static/coexist_wifi_connected_and_ble_connected_time_slice.png
|
||||
:align: center
|
||||
:alt: Time Slice Under the Status of Wi-Fi CONNECTED and BLE CONNECTED
|
||||
:figclass: align-center
|
||||
|
||||
Time Slice Under the Status of Wi-Fi CONNECTED and BLE CONNECTED
|
||||
|
||||
.. only:: SOC_IEEE802154_SUPPORTED
|
||||
|
||||
Currently, the only supported strategy ensures that the priority of BLE always takes precedence over IEEE802.15.4.
|
||||
The IEEE 802.15.4 module requests RF resources based on pre-assigned priorities. Normal receive operations are assigned the lowest priority, meaning Wi-Fi and BLE will take over the RF whenever needed, while 802.15.4 can only receive during the remaining time. Other 802.15.4 operations, such as transmitting or receiving ACKs and transmitting or receiving at given time, are assigned higher priorities. However, their access to RF ultimately depends on the priorities of Wi-Fi and BLE operations at that moment.
|
||||
|
||||
.. list::
|
||||
.. only:: SOC_WIFI_SUPPORTED and SOC_BT_SUPPORTED
|
||||
|
||||
:esp32: 1) IDLE status: the coexistence of BT and BLE is controlled by Bluetooth module.
|
||||
:SOC_WIFI_SUPPORTED and SOC_BLE_SUPPORTED and not esp32: 1) IDLE status: RF module is controlled by Bluetooth module.
|
||||
#) CONNECTED status: the coexistence period starts at the Target Beacon Transmission Time (TBTT) and is more than 100 ms.
|
||||
#) SCAN status: Wi-Fi slice and coexistence period are longer than in the CONNECTED status. To ensure Bluetooth performance, the Bluetooth time slice will also be adjusted accordingly.
|
||||
#) CONNECTING status: Wi-Fi slice is longer than in the CONNECTED status. To ensure Bluetooth performance, the Bluetooth time slice will also be adjusted accordingly.
|
||||
Dynamic Priority
|
||||
""""""""""""""""""""""""""""
|
||||
|
||||
|
||||
According to the coexistence logic, different coexistence periods and time slice strategies will be selected based on the Wi-Fi and Bluetooth usage scenarios. A Coexistence policy corresponding to a certain usage scenarios is called a "coexistence scheme". For example, the scenario of Wi-Fi CONNECTED and BLE CONNECTED has a corresponding coexistence scheme. In this scheme, the time slices of Wi-Fi and BLE in a coexistence period each account for 50%. The time allocation is shown in the following figure:
|
||||
|
||||
.. figure:: ../../_static/coexist_wifi_connected_and_ble_connected_time_slice.png
|
||||
:align: center
|
||||
:alt: Time Slice Under the Status of Wi-Fi CONNECTED and BLE CONNECTED
|
||||
:figclass: align-center
|
||||
|
||||
Time Slice Under the Status of Wi-Fi CONNECTED and BLE CONNECTED
|
||||
|
||||
|
||||
Dynamic Priority
|
||||
""""""""""""""""""""""""""""
|
||||
|
||||
The coexistence module assigns varying priorities to different statuses of each module, and these priorities are dynamic. For example, in every N BLE Advertising events, there is always one event with high priority. If a high-priority BLE Advertising event occurs within the Wi-Fi time slice, the right to use the RF may be preempted by BLE.
|
||||
The coexistence module assigns varying priorities to different statuses of each module, and these priorities are dynamic. For example, in every N BLE Advertising events, there is always one event with high priority. If a high-priority BLE Advertising event occurs within the Wi-Fi time slice, the right to use the RF may be preempted by BLE.
|
||||
|
||||
.. only:: SOC_WIFI_SUPPORTED
|
||||
|
||||
|
@ -5,7 +5,7 @@ RF 共存
|
||||
概览
|
||||
-----
|
||||
|
||||
ESP系列芯片最多支持三种射频收发模块: Bluetooth(BT 和 BLE), IEEE802.15.4 和 Wi-Fi, 而每款芯片只支持一路被多个射频收发模块共享的 RF,不同模块无法同时使用 RF 收发数据,因此采用时分复用的方法调节不同模块的数据包收发。
|
||||
ESP系列芯片最多支持三种射频收发模块: Bluetooth(BT 和 BLE), IEEE 802.15.4 (Thread / Zigbee) 和 Wi-Fi, 而每款芯片只支持一路被多个射频收发模块共享的 RF,不同模块无法同时使用 RF 收发数据,因此采用时分复用的方法调节不同模块的数据包收发。
|
||||
|
||||
|
||||
{IDF_TARGET_NAME} 支持的共存场景
|
||||
@ -13,36 +13,36 @@ ESP系列芯片最多支持三种射频收发模块: Bluetooth(BT 和 BLE),
|
||||
|
||||
.. only:: SOC_WIFI_SUPPORTED and SOC_BLE_SUPPORTED
|
||||
|
||||
.. table:: 表 1 Wi-Fi 和 BLE 共存支持功能
|
||||
.. table:: Wi-Fi 和 BLE 共存支持功能
|
||||
|
||||
+-------+--------+-----------+-----+------------+-----------+----------+
|
||||
| |BLE |
|
||||
+ +-----+------------+-----------+----------+
|
||||
| |Scan |Advertising |Connecting |Connected |
|
||||
+-------+--------+-----------+-----+------------+-----------+----------+
|
||||
| Wi-Fi |STA |Scan |Y |Y |Y |Y |
|
||||
+ + +-----------+-----+------------+-----------+----------+
|
||||
| | |Connecting |Y |Y |Y |Y |
|
||||
+ + +-----------+-----+------------+-----------+----------+
|
||||
| | |Connected |Y |Y |Y |Y |
|
||||
+ +--------+-----------+-----+------------+-----------+----------+
|
||||
| |SOFTAP |TX Beacon |Y |Y |Y |Y |
|
||||
+ + +-----------+-----+------------+-----------+----------+
|
||||
| | |Connecting |C1 |C1 |C1 |C1 |
|
||||
+ + +-----------+-----+------------+-----------+----------+
|
||||
| | |Connected |C1 |C1 |C1 |C1 |
|
||||
+ +--------+-----------+-----+------------+-----------+----------+
|
||||
| |Sniffer |RX |C1 |C1 |C1 |C1 |
|
||||
+ +--------+-----------+-----+------------+-----------+----------+
|
||||
| |ESP-NOW |RX |S |S |S |S |
|
||||
+ + +-----------+-----+------------+-----------+----------+
|
||||
| | |TX |Y |Y |Y |Y |
|
||||
+-------+--------+-----------+-----+------------+-----------+----------+
|
||||
+-------+--------+-----------+-----+------------+----------+
|
||||
| |BLE |
|
||||
+ +-----+------------+----------+
|
||||
| |Scan |Advertising |Connected |
|
||||
+-------+--------+-----------+-----+------------+----------+
|
||||
| Wi-Fi |STA |Scan |Y |Y |Y |
|
||||
+ + +-----------+-----+------------+----------+
|
||||
| | |Connecting |Y |Y |Y |
|
||||
+ + +-----------+-----+------------+----------+
|
||||
| | |Connected |Y |Y |Y |
|
||||
+ +--------+-----------+-----+------------+----------+
|
||||
| |SOFTAP |TX Beacon |Y |Y |Y |
|
||||
+ + +-----------+-----+------------+----------+
|
||||
| | |Connecting |C1 |C1 |C1 |
|
||||
+ + +-----------+-----+------------+----------+
|
||||
| | |Connected |C1 |C1 |C1 |
|
||||
+ +--------+-----------+-----+------------+----------+
|
||||
| |Sniffer |RX |C1 |C1 |C1 |
|
||||
+ +--------+-----------+-----+------------+----------+
|
||||
| |ESP-NOW |RX |S |S |S |
|
||||
+ + +-----------+-----+------------+----------+
|
||||
| | |TX |Y |Y |Y |
|
||||
+-------+--------+-----------+-----+------------+----------+
|
||||
|
||||
|
||||
.. only:: esp32
|
||||
.. only:: SOC_WIFI_SUPPORTED and SOC_BT_CLASSIC_SUPPORTED
|
||||
|
||||
.. table:: 表 2 Wi-Fi 和经典蓝牙 (BT) 共存支持功能
|
||||
.. table:: Wi-Fi 和经典蓝牙 (BT) 共存支持功能
|
||||
|
||||
+-------+--------+-----------+--------+-------------+-----+----------+-----------+
|
||||
| |BR/EDR |
|
||||
@ -68,32 +68,63 @@ ESP系列芯片最多支持三种射频收发模块: Bluetooth(BT 和 BLE),
|
||||
| | |TX |Y |Y |Y |Y |Y |
|
||||
+-------+--------+-----------+--------+-------------+-----+----------+-----------+
|
||||
|
||||
.. only:: SOC_IEEE802154_SUPPORTED
|
||||
.. only:: SOC_WIFI_SUPPORTED and SOC_IEEE802154_SUPPORTED
|
||||
|
||||
.. table:: 表 3 Thread (IEEE802.15.4) 和 BLE 共存支持功能
|
||||
.. table:: Wi-Fi 和 IEEE 802.15.4 (Thread / Zigbee) 共存支持功能
|
||||
|
||||
+--------+-----------------+-----+------------+-----------+----------+
|
||||
| |BLE |
|
||||
+ +-----+------------+-----------+----------+
|
||||
| |Scan |Advertising |Connecting |Connected |
|
||||
+--------+-----------------+-----+------------+-----------+----------+
|
||||
| Thread |Scan |X |Y |Y |Y |
|
||||
+ +-----------------+-----+------------+-----------+----------+
|
||||
| |Connecting |X |Y |Y |Y |
|
||||
+ +-----------------+-----+------------+-----------+----------+
|
||||
| |Connected |X |Y |Y |Y |
|
||||
+ +-----------------+-----+------------+-----------+----------+
|
||||
| |Connected | | | | |
|
||||
| |(high throughput)|X |C1 |C1 |C1 |
|
||||
+--------+-----------------+-----+------------+-----------+----------+
|
||||
+-------+--------+-----------+--------+---------+-----------+
|
||||
| |Thread / Zigbee |
|
||||
+ +--------+---------+-----------+
|
||||
| |Scan |Router |End Device |
|
||||
+-------+--------+-----------+--------+---------+-----------+
|
||||
| Wi-Fi |STA |Scan |C1 |C1 |Y |
|
||||
+ + +-----------+--------+---------+-----------+
|
||||
| | |Connecting |C1 |C1 |Y |
|
||||
+ + +-----------+--------+---------+-----------+
|
||||
| | |Connected |C1 |C1 |Y |
|
||||
+ +--------+-----------+--------+---------+-----------+
|
||||
| |SOFTAP |TX Beacon |Y |X |Y |
|
||||
+ + +-----------+--------+---------+-----------+
|
||||
| | |Connecting |C1 |X |C1 |
|
||||
+ + +-----------+--------+---------+-----------+
|
||||
| | |Connected |C1 |X |C1 |
|
||||
+ +--------+-----------+--------+---------+-----------+
|
||||
| |Sniffer |RX |C1 |X |C1 |
|
||||
+-------+--------+-----------+--------+---------+-----------+
|
||||
|
||||
.. only:: SOC_BLE_SUPPORTED and SOC_IEEE802154_SUPPORTED
|
||||
|
||||
.. table:: IEEE 802.15.4 (Thread / Zigbee) 和 BLE 共存支持功能
|
||||
|
||||
+-----------------+-------------+-----+------------+----------+
|
||||
| |BLE |
|
||||
+ +-----+------------+----------+
|
||||
| |Scan |Advertising |Connected |
|
||||
+-----------------+-------------+-----+------------+----------+
|
||||
| Thread / Zigbee |Scan |X |Y |Y |
|
||||
+ +-------------+-----+------------+----------+
|
||||
| |Router |X |Y |Y |
|
||||
+ +-------------+-----+------------+----------+
|
||||
| |End Device |C1 |Y |Y |
|
||||
+-----------------+-------------+-----+------------+----------+
|
||||
|
||||
.. note::
|
||||
|
||||
Y:支持且性能稳定。
|
||||
C1:不能保证性能处于稳定状态。
|
||||
X:不支持。
|
||||
S:在STA模式下支持且性能稳定,否则不支持。
|
||||
.. list::
|
||||
|
||||
- Y:支持且性能稳定。
|
||||
- C1:不能保证性能处于稳定状态。
|
||||
- X:不支持。
|
||||
:SOC_WIFI_SUPPORTED: - S:在 STA 模式下支持且性能稳定,否则不支持。
|
||||
|
||||
.. only:: SOC_IEEE802154_SUPPORTED
|
||||
|
||||
.. note::
|
||||
|
||||
Thread 和 Zigbee 网络中的路由节点与其邻居保持非同步连接,因此需要持续接收信号。在仅有单一 RF 通路的情况下,Wi-Fi 或 BLE 流量的增加可能导致 Thread 和 Zigbee 通信的丢包率上升。
|
||||
|
||||
为了构建基于 Wi-Fi 的 Thread 边界路由器或 Zigbee 网关产品,我们推荐采用双 SoC 方案(例如 ESP32-S3 + ESP32-H2),使用独立的 RF。这种配置能够同时接收 Wi-Fi 和 802.15.4 信号,确保最佳性能。
|
||||
|
||||
|
||||
共存机制与策略
|
||||
----------------------------------
|
||||
@ -101,7 +132,7 @@ ESP系列芯片最多支持三种射频收发模块: Bluetooth(BT 和 BLE),
|
||||
共存机制
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
基于优先级抢占的 RF 资源分配机制,如下图所示,Bluetooth 模块和 Wi-Fi 模块向共存模块申请 RF 资源,共存模块根据二者的优先级高低裁决 RF 归谁使用。
|
||||
基于优先级抢占的 RF 资源分配机制,如下图所示,Bluetooth,Wi-Fi 和 802.15.4 模块向共存模块申请 RF 资源,共存模块根据三者的优先级高低裁决 RF 归谁使用。
|
||||
|
||||
.. blockdiag::
|
||||
:scale: 100%
|
||||
@ -119,15 +150,17 @@ ESP系列芯片最多支持三种射频收发模块: Bluetooth(BT 和 BLE),
|
||||
default_group_color = none;
|
||||
|
||||
# node labels
|
||||
Wi-Fi [shape = box];
|
||||
Bluetooth [shape = box];
|
||||
Coexistence [shape = box, label = 'Coexistence module'];
|
||||
RF [shape = box, label = 'RF module'];
|
||||
Wi-Fi [shape = box];
|
||||
Bluetooth [shape = box];
|
||||
802.15.4 [shape = box];
|
||||
Coexistence [shape = box, label = 'Coexistence module'];
|
||||
RF [shape = box, label = 'RF module'];
|
||||
|
||||
# node connections
|
||||
Wi-Fi -> Coexistence;
|
||||
Bluetooth -> Coexistence;
|
||||
Coexistence -> RF;
|
||||
Wi-Fi -> Coexistence;
|
||||
Bluetooth -> Coexistence;
|
||||
802.15.4 -> Coexistence;
|
||||
Coexistence -> RF;
|
||||
}
|
||||
|
||||
.. _coexist_policy-cn:
|
||||
@ -135,45 +168,48 @@ ESP系列芯片最多支持三种射频收发模块: Bluetooth(BT 和 BLE),
|
||||
共存策略
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
共存周期和时间片
|
||||
"""""""""""""""""""
|
||||
.. only:: SOC_WIFI_SUPPORTED and SOC_BT_SUPPORTED
|
||||
|
||||
.. only:: esp32
|
||||
共存周期和时间片
|
||||
"""""""""""""""""""
|
||||
|
||||
Wi-Fi、BT、BLE 三者对于 RF 的使用,主要是按照时间片来划分的。在一个共存周期内,按照 Wi-Fi、BT、BLE 的顺序划分时间片。在 Wi-Fi 的时间片内,Wi-Fi 会向共存仲裁模块发出较高优先级的请求,同理,BT/BLE 在自己的时间片内会具有较高优先级。共存周期大小和各个时间片占比根据 Wi-Fi 的状态分成四类:
|
||||
.. only:: SOC_BLE_SUPPORTED and SOC_BT_CLASSIC_SUPPORTED
|
||||
|
||||
Wi-Fi、BT、BLE 三者对于 RF 的使用,主要是按照时间片来划分的。在一个共存周期内,按照 Wi-Fi、BT、BLE 的顺序划分时间片。在 Wi-Fi 的时间片内,Wi-Fi 会向共存仲裁模块发出较高优先级的请求,同理,BT/BLE 在自己的时间片内会具有较高优先级。共存周期大小和各个时间片占比根据 Wi-Fi 的状态分成四类:
|
||||
|
||||
|
||||
.. only:: SOC_WIFI_SUPPORTED and SOC_BLE_SUPPORTED and not esp32
|
||||
.. only:: not SOC_BT_CLASSIC_SUPPORTED
|
||||
|
||||
Wi-Fi、BLE 二者对于 RF 的使用,主要是按照时间片来划分的。在 Wi-Fi 的时间片内,Wi-Fi 会向共存仲裁模块发出较高优先级的请求,在 Bluetooth 的时间片内,BLE 会具有较高优先级。共存周期大小和各个时间片占比根据 Wi-Fi 的状态分成四类:
|
||||
Wi-Fi、BLE 二者对于 RF 的使用,主要是按照时间片来划分的。在 Wi-Fi 的时间片内,Wi-Fi 会向共存仲裁模块发出较高优先级的请求,在 Bluetooth 的时间片内,BLE 会具有较高优先级。共存周期大小和各个时间片占比根据 Wi-Fi 的状态分成四类:
|
||||
|
||||
.. list::
|
||||
|
||||
:SOC_BLE_SUPPORTED and SOC_BT_CLASSIC_SUPPORTED: 1) IDLE 状态:BT 和 BLE 共存由 Bluetooth 模块控制。
|
||||
:not SOC_BT_CLASSIC_SUPPORTED: 1) IDLE 状态:RF 模块由 Bluetooth 模块控制。
|
||||
#) CONNECTED 状态:共存周期以目标信标传输时间 (Target Beacon Transmission Time, TBTT) 点为起始点,周期大于 100 ms。
|
||||
#) SCAN 状态:Wi-Fi 时间片以及共存周期都比在 CONNECTED 状态下的长。为了确保蓝牙的性能,蓝牙的时间片也会做相应的调整。
|
||||
#) CONNECTING 状态:Wi-Fi 时间片比在 CONNECTED 状态下的长。为了确保蓝牙的性能,蓝牙的时间片也会做相应的调整。
|
||||
|
||||
|
||||
共存逻辑会根据当前 Wi-Fi 和 Bluetooth 的使用场景来选取不同的共存周期和共存时间片的划分策略。对应一个使用场景的共存策略,我们称之为“共存模板”。比如,Wi-Fi CONNECTED 与 BLE CONNECTED 的场景,就对应有一个共存模板。在这个共存模板中,一个共存周期内 Wi-Fi 和 BLE 的时间片各占 50%,时间分配如下图所示:
|
||||
|
||||
.. figure:: ../../_static/coexist_wifi_connected_and_ble_connected_time_slice.png
|
||||
:align: center
|
||||
:alt: Wi-Fi CONNECTED 和 BLE CONNECTED 状态下时间片划分图
|
||||
:figclass: align-center
|
||||
|
||||
Wi-Fi CONNECTED 和 BLE CONNECTED 共存状态下时间片划分图
|
||||
|
||||
.. only:: SOC_IEEE802154_SUPPORTED
|
||||
|
||||
目前, 当 BLE 与 IEEE802.15.4 共存时, ESP 芯片使用的策略为 BLE 优先级始终优先于 IEEE802.15.4。
|
||||
IEEE 802.15.4 模块根据预先分配的优先级请求 RF 资源。普通的接收操作被分配为最低优先级,这意味着 Wi-Fi 和 BLE 在需要时会优先占用 RF,而 802.15.4 只能在剩余时间内进行接收。其他 802.15.4 操作,例如发送和接收 ACK 以及在指定时间内的发送和接收,被分配了更高的优先级。然而,它们能否实际获得 RF 资源最终取决于当时 Wi-Fi 和 BLE 操作的优先级。
|
||||
|
||||
.. list::
|
||||
.. only:: SOC_WIFI_SUPPORTED and SOC_BT_SUPPORTED
|
||||
|
||||
:esp32: 1) IDLE 状态:BT 和 BLE 共存由 Bluetooth 模块控制。
|
||||
:SOC_WIFI_SUPPORTED and SOC_BLE_SUPPORTED and not esp32: 1) IDLE 状态:RF 模块由 Bluetooth 模块控制。
|
||||
#) CONNECTED 状态:共存周期以目标信标传输时间 (Target Beacon Transmission Time, TBTT) 点为起始点,周期大于 100 ms。
|
||||
#) SCAN 状态:Wi-Fi 时间片以及共存周期都比在 CONNECTED 状态下的长。为了确保蓝牙的性能,蓝牙的时间片也会做相应的调整。
|
||||
#) CONNECTING 状态:Wi-Fi 时间片比在 CONNECTED 状态下的长。为了确保蓝牙的性能,蓝牙的时间片也会做相应的调整。
|
||||
动态优先级
|
||||
"""""""""""""""""""
|
||||
|
||||
|
||||
共存逻辑会根据当前 Wi-Fi 和 Bluetooth 的使用场景来选取不同的共存周期和共存时间片的划分策略。对应一个使用场景的共存策略,我们称之为“共存模板”。比如,Wi-Fi CONNECTED 与 BLE CONNECTED 的场景,就对应有一个共存模板。在这个共存模板中,一个共存周期内 Wi-Fi 和 BLE 的时间片各占 50%,时间分配如下图所示:
|
||||
|
||||
.. figure:: ../../_static/coexist_wifi_connected_and_ble_connected_time_slice.png
|
||||
:align: center
|
||||
:alt: Wi-Fi CONNECTED 和 BLE CONNECTED 状态下时间片划分图
|
||||
:figclass: align-center
|
||||
|
||||
Wi-Fi CONNECTED 和 BLE CONNECTED 共存状态下时间片划分图
|
||||
|
||||
|
||||
动态优先级
|
||||
"""""""""""""""""""
|
||||
|
||||
共存模块为每个模块的不同状态分配不同的优先级。每种状态下的优先级并不是一成不变的,例如对于 BLE,每 N 个广播事件 (Advertising event) 中会有一个广播事件使用高优先级。如果高优先级的广播事件发生在 Wi-Fi 时间片内,RF 的使用权可能会被 BLE 抢占。
|
||||
共存模块为每个模块的不同状态分配不同的优先级。每种状态下的优先级并不是一成不变的,例如对于 BLE,每 N 个广播事件 (Advertising event) 中会有一个广播事件使用高优先级。如果高优先级的广播事件发生在 Wi-Fi 时间片内,RF 的使用权可能会被 BLE 抢占。
|
||||
|
||||
.. only:: SOC_WIFI_SUPPORTED
|
||||
|
||||
|
@ -30,7 +30,6 @@ void test_panic_extram_stack(void);
|
||||
|
||||
#if !CONFIG_FREERTOS_UNICORE
|
||||
void test_task_wdt_cpu1(void);
|
||||
void test_task_wdt_both_cpus(void);
|
||||
#endif
|
||||
|
||||
void test_storeprohibited(void);
|
||||
|
@ -88,7 +88,6 @@ void app_main(void)
|
||||
#endif
|
||||
#if !CONFIG_FREERTOS_UNICORE
|
||||
HANDLE_TEST(test_name, test_task_wdt_cpu1);
|
||||
HANDLE_TEST(test_name, test_task_wdt_both_cpus);
|
||||
#endif
|
||||
HANDLE_TEST(test_name, test_storeprohibited);
|
||||
HANDLE_TEST(test_name, test_cache_error);
|
||||
|
@ -104,16 +104,6 @@ void test_task_wdt_cpu1(void)
|
||||
}
|
||||
}
|
||||
|
||||
void test_task_wdt_both_cpus(void)
|
||||
{
|
||||
xTaskCreatePinnedToCore(infinite_loop, "Infinite loop", 1024, NULL, 4, NULL, 1);
|
||||
/* Give some time to the task on CPU 1 to be scheduled */
|
||||
vTaskDelay(1);
|
||||
xTaskCreatePinnedToCore(infinite_loop, "Infinite loop", 1024, NULL, 4, NULL, 0);
|
||||
while (true) {
|
||||
;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void __attribute__((no_sanitize_undefined)) test_storeprohibited(void)
|
||||
|
@ -155,42 +155,6 @@ def test_task_wdt_cpu1(dut: PanicTestDut, config: str, test_func_name: str) -> N
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('config', CONFIGS_DUAL_CORE, indirect=True)
|
||||
@pytest.mark.generic
|
||||
def test_task_wdt_both_cpus(dut: PanicTestDut, config: str, test_func_name: str) -> None:
|
||||
if dut.target == 'esp32s3':
|
||||
pytest.xfail(reason='Only prints "Print CPU 1 backtrace", IDF-6560')
|
||||
dut.run_test_func(test_func_name)
|
||||
dut.expect_exact(
|
||||
'Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:'
|
||||
)
|
||||
dut.expect_exact('CPU 0: Infinite loop')
|
||||
dut.expect_exact('CPU 1: Infinite loop')
|
||||
if dut.is_xtensa:
|
||||
# see comment in test_task_wdt_cpu0
|
||||
dut.expect_none('register dump:')
|
||||
dut.expect_exact('Print CPU 0 (current core) backtrace')
|
||||
dut.expect_backtrace()
|
||||
dut.expect_exact('Print CPU 1 backtrace')
|
||||
dut.expect_backtrace()
|
||||
# On Xtensa, we get incorrect backtrace from GDB in this test
|
||||
expected_backtrace = ['infinite_loop', 'vPortTaskWrapper']
|
||||
else:
|
||||
assert False, 'No dual-core RISC-V chips yet, check this test case later'
|
||||
dut.expect_elf_sha256()
|
||||
dut.expect_none('Guru Meditation')
|
||||
|
||||
coredump_pattern = (PANIC_ABORT_PREFIX +
|
||||
'Task watchdog got triggered. '
|
||||
'The following tasks/users did not reset the watchdog in time:\n - IDLE1 (CPU 1)\n - IDLE0 (CPU 0)')
|
||||
common_test(
|
||||
dut,
|
||||
config,
|
||||
expected_backtrace=expected_backtrace,
|
||||
expected_coredump=[coredump_pattern]
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('config', CONFIGS_EXTRAM_STACK, indirect=True)
|
||||
def test_panic_extram_stack(dut: PanicTestDut, config: str, test_func_name: str) -> None:
|
||||
dut.run_test_func(test_func_name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user