From 5cf696a7143a645274ff9d3bdbef9ee351003b61 Mon Sep 17 00:00:00 2001 From: xiongweichao Date: Tue, 12 Jul 2022 14:44:46 +0800 Subject: [PATCH] Fix wifi is initialized before bluetooth initialization, bluetooth can't stay connected --- components/bt/controller/esp32c3/bt.c | 2 ++ components/bt/controller/esp32s3/bt.c | 2 ++ components/esp_wifi/src/phy_init.c | 6 ------ 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/components/bt/controller/esp32c3/bt.c b/components/bt/controller/esp32c3/bt.c index 04c35768e4..c6121e3f9e 100644 --- a/components/bt/controller/esp32c3/bt.c +++ b/components/bt/controller/esp32c3/bt.c @@ -241,6 +241,7 @@ extern int ble_txpwr_get(int power_type); extern uint16_t l2c_ble_link_get_tx_buf_num(void); extern int coex_core_ble_conn_dyn_prio_get(bool *low, bool *high); +extern void coex_pti_v2(void); extern bool btdm_deep_sleep_mem_init(void); extern void btdm_deep_sleep_mem_deinit(void); @@ -1113,6 +1114,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) err = ESP_ERR_NO_MEM; goto error; } + coex_pti_v2(); btdm_controller_status = ESP_BT_CONTROLLER_STATUS_INITED; diff --git a/components/bt/controller/esp32s3/bt.c b/components/bt/controller/esp32s3/bt.c index 7d13d62f21..ec25367924 100644 --- a/components/bt/controller/esp32s3/bt.c +++ b/components/bt/controller/esp32s3/bt.c @@ -196,6 +196,7 @@ extern int API_vhci_host_register_callback(const vhci_host_callback_t *callback) extern int ble_txpwr_set(int power_type, int power_level); extern int ble_txpwr_get(int power_type); +extern void coex_pti_v2(void); extern uint16_t l2c_ble_link_get_tx_buf_num(void); extern char _bss_start_btdm; @@ -1019,6 +1020,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) err = ESP_ERR_NO_MEM; goto error; } + coex_pti_v2(); btdm_controller_status = ESP_BT_CONTROLLER_STATUS_INITED; diff --git a/components/esp_wifi/src/phy_init.c b/components/esp_wifi/src/phy_init.c index 82b11f11fe..f2ae82fdc6 100644 --- a/components/esp_wifi/src/phy_init.c +++ b/components/esp_wifi/src/phy_init.c @@ -250,12 +250,6 @@ void esp_phy_enable(void) #if CONFIG_IDF_TARGET_ESP32 coex_bt_high_prio(); #endif - -#if CONFIG_BT_ENABLED && (CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3) - extern void coex_pti_v2(void); - coex_pti_v2(); -#endif - } s_phy_access_ref++;