Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TW#25603] Bluetooth visibility in dual mode #2306

Closed
crespum opened this issue Aug 17, 2018 · 4 comments
Closed

[TW#25603] Bluetooth visibility in dual mode #2306

crespum opened this issue Aug 17, 2018 · 4 comments

Comments

@crespum
Copy link
Contributor

crespum commented Aug 17, 2018

Environment

  • IDF version: I've tried both 53509c7 (v3.1-rc) and latest v3.0.3
  • Development Env: Make
  • Operating System: Fedora
  • Power Supply: USB

Problem Description

My application uses Bluetooth dual mode, to be precise it uses A2DP and a BLE beacon, but I'm experiencing some issues with the visibility of the different modes:

I want the beacon to be always visible but not the A2DP profile. The latter should only be visible for an small amount of time. The A2DP profile should remain connectable for the devices which have already been bond.

To achieve this I've tried the function esp_bt_gap_set_scan_mode, which according to the docs should "set discoverability and connectability mode for legacy bluetooth". However, after calling esp_bt_gap_set_scan_mode(ESP_BT_SCAN_MODE_CONNECTABLE), the BLE advertisement completely disappears.

Why does esp_bt_gap_set_scan_mode affect the BLE stack?

Code to reproduce this issue

To test the issue you can apply the following patch to a2dp_gatts_coex example. The advertisement should be visible the first 30 seconds and disappear right after the logs print Beacon disappears now.

102c102
<     .own_addr_type      = BLE_ADDR_TYPE_PUBLIC,
---
>     .own_addr_type      = BLE_ADDR_TYPE_RANDOM,
258a259
>         esp_ble_gap_config_local_privacy(true);
380,381c381,382
<         // esp_ble_conn_update_params_t conn_params = {0};
<         // memcpy(conn_params.bda, param->connect.remote_bda, sizeof(esp_bd_addr_t));
---
>         esp_ble_conn_update_params_t conn_params = {0};
>         memcpy(conn_params.bda, param->connect.remote_bda, sizeof(esp_bd_addr_t));
623c624
<         esp_bt_gap_set_scan_mode(ESP_BT_SCAN_MODE_NONE);
---
>         esp_bt_gap_set_scan_mode(ESP_BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE);
705,708d705
< 
<     vTaskDelay(30000 / portTICK_PERIOD_MS);
<     ESP_LOGI(BT_BLE_COEX_TAG, "Beacon disappears now");
<     esp_bt_gap_set_scan_mode(ESP_BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE);
@FayeY FayeY changed the title Bluetooth visibility in dual mode [TW#25603] Bluetooth visibility in dual mode Aug 20, 2018
@TianHao-Yoursmake
Copy link

@crespum, thank you. It's real a problem. It's due to that when call esp_bt_gap_set_scan_mode(ESP_BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE), it will also set hci cmd to disable advertising.

We will fix it soon.

igrr pushed a commit that referenced this issue Sep 6, 2018
As the bluedroid original implmentation of BR/EDR and BLE dual mode about discovery mode,
when set discovery mode for BR/EDR, it will stop ble advertising.

Reference to #2306
igrr pushed a commit that referenced this issue Sep 6, 2018
As the bluedroid original implmentation of BR/EDR and BLE dual mode about discovery mode,
when set discovery mode for BR/EDR, it will stop ble advertising.

Reference to #2306
igrr pushed a commit that referenced this issue Sep 16, 2018
As the bluedroid original implmentation of BR/EDR and BLE dual mode about discovery mode,
when set discovery mode for BR/EDR, it will stop ble advertising.

Reference to #2306
@Alvin1Zhang
Copy link
Collaborator

@crespum Have you verified the fix patch? Does the patch resolve your issue? Thanks.

@crespum
Copy link
Contributor Author

crespum commented Sep 20, 2018

No, I'm still experiencing the issue on v3.1.

@crespum
Copy link
Contributor Author

crespum commented Nov 21, 2018

This issue has been fixed in v3.1.1. Thanks @igrr!

@crespum crespum closed this as completed Nov 21, 2018
catalinio pushed a commit to catalinio/pycom-esp-idf that referenced this issue Jun 28, 2019
As the bluedroid original implmentation of BR/EDR and BLE dual mode about discovery mode,
when set discovery mode for BR/EDR, it will stop ble advertising.

Reference to espressif/esp-idf#2306
catalinio pushed a commit to catalinio/pycom-esp-idf that referenced this issue Jun 28, 2019
As the bluedroid original implmentation of BR/EDR and BLE dual mode about discovery mode,
when set discovery mode for BR/EDR, it will stop ble advertising.

Reference to espressif/esp-idf#2306
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants