esp32: fix coex bug

1. fix BLE connection missing in coex mode
    2. modify other parameters to make coex priority more reasonable
    3. fix modem sleep procedure trap cause Wifi disable RF when BT is
    working. Such cause that BR/EDR is difficult to be connected, BLE
    connection stability decrease and so on.
    4. modify BR/EDR coexist duration to imrove BR/EDR connect success
    ratio.
    5. Due to the hardware coexist bug, BLE scan interval/window should
    be less than 0x100(about 160ms). Therefore, it will cause BLE cannot
    scan any advertising packet while WiFi have higher priority
    behaviour(such like RX beacon, scan, TX/RX VO packets and etc.).
This commit is contained in:
Tian Hao 2018-06-24 16:38:05 +08:00 committed by Jack
parent b31e16039e
commit 3ad712ba86
4 changed files with 18 additions and 5 deletions

View file

@ -915,7 +915,14 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
esp_phy_load_cal_and_init(PHY_BT_MODULE); esp_phy_load_cal_and_init(PHY_BT_MODULE);
if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_ORIG) { if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_NONE) {
//Just register to sleep module, make the modem sleep modules check BT sleep status when sleep enter.
//Thus, it will prevent WIFI from disabling RF when BT is not in sleep but is using RF.
esp_modem_sleep_register(MODEM_BLE_MODULE);
esp_modem_sleep_register(MODEM_CLASSIC_BT_MODULE);
esp_modem_sleep_exit(MODEM_BLE_MODULE);
esp_modem_sleep_exit(MODEM_CLASSIC_BT_MODULE);
} else if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_ORIG) {
esp_modem_sleep_register(MODEM_BLE_MODULE); esp_modem_sleep_register(MODEM_BLE_MODULE);
esp_modem_sleep_register(MODEM_CLASSIC_BT_MODULE); esp_modem_sleep_register(MODEM_CLASSIC_BT_MODULE);
} else if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_EVED) { } else if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_EVED) {
@ -933,7 +940,8 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
ret = btdm_controller_enable(mode); ret = btdm_controller_enable(mode);
if (ret) { if (ret) {
if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_ORIG) { if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_NONE
|| btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_ORIG) {
esp_modem_sleep_deregister(MODEM_BLE_MODULE); esp_modem_sleep_deregister(MODEM_BLE_MODULE);
esp_modem_sleep_deregister(MODEM_CLASSIC_BT_MODULE); esp_modem_sleep_deregister(MODEM_CLASSIC_BT_MODULE);
} else if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_EVED) { } else if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_EVED) {
@ -973,7 +981,8 @@ esp_err_t esp_bt_controller_disable(void)
} }
if (ret == ESP_BT_MODE_IDLE) { if (ret == ESP_BT_MODE_IDLE) {
if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_ORIG) { if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_NONE
|| btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_ORIG) {
esp_modem_sleep_deregister(MODEM_BLE_MODULE); esp_modem_sleep_deregister(MODEM_BLE_MODULE);
esp_modem_sleep_deregister(MODEM_CLASSIC_BT_MODULE); esp_modem_sleep_deregister(MODEM_CLASSIC_BT_MODULE);
} else if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_EVED) { } else if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_EVED) {

@ -1 +1 @@
Subproject commit e0740ac07b0939bcfc089e580df460ed3cdd950c Subproject commit 48b2459bcb4b9b6d6c64b93a1b8c6c70e25dfbd7

View file

@ -202,6 +202,10 @@ esp_err_t esp_modem_sleep_exit(modem_sleep_module_t module);
/** /**
* @brief Register module to make it be able to require to enter/exit modem sleep * @brief Register module to make it be able to require to enter/exit modem sleep
* Although the module has no sleep function, as long as the module use RF,
* it must call esp_modem_sleep_regsiter. Otherwise, other modules with sleep
* function will disable RF without checking the module which doesn't call
* esp_modem_sleep_regsiter.
*/ */
esp_err_t esp_modem_sleep_register(modem_sleep_module_t module); esp_err_t esp_modem_sleep_register(modem_sleep_module_t module);

@ -1 +1 @@
Subproject commit 534a9b14101af90231d40a4f94924d67bc848d5f Subproject commit 0bfda8bbf6a804298b357614f5f215248c36bce3