-
Notifications
You must be signed in to change notification settings - Fork 615
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
ESP32 slave role Multiple SCO connection problem #606
Comments
Hi there. Relay for SCO in a master/slave combination doesn't work in general with any Bluetooth Controller. |
Thanks mringwal for your fast reply. Unfortunately, the requirement is to use only one ESP32 but it works well if the ESP32 is in the master role I tried to disable the link policy and force the ESP32 always to be master and prevent the role switch but some phones force the role switch I managed to write a code to automatically disconnects if the ESP32 is not a master and reconnect until it is master with the phone it works well with android phones but with iPhone 15 it connects for maybe 20 to 30 seconds. For CYW20706, do you mean it can work with slave role with the phone and master role with the headphone unlike the ESP32? |
Just trying to sum up our experience. Some phones, especially iPhone don't want to switch to slave role. If the requirement is to forward SCO traffic using a single ESP32, you can either try to raise an issue on the ESP-IDF github and ask Espressif if that's possible, or change your requirements. My worry here is that even if it works (i.e. it connects and the connection is stable), there's still a chance for higher SCO packet loss due to scheduling issues, which would results in glitches. Yes, I think one customer reported using 20706 successfully for SCO forwarding. We've only tried forwarding A2DP with the ESP32 which worked reasonably well, but SCO is way more sensible to scheduling issues. |
@mringwal Thank you for your clarifications, regarding the second Issue of the ESP32 is unable to connect to modern headphones like Sound Core life Q30 despite I am able to connect with them with my phone but with ESP32 using the HFP_AG example I get an error code 0x04 as if the headphone is not exist. |
If you get error code 0x04 - Page Timeout - the BD ADDR is usually wrong, or the device is not in page scan mode (which means no device could connect at this time). Do you see the device if you make it discoverable and run e.g. the gap_inquiry example? |
@mringwal I got the BD address of the Sound Core life Q30 with a Bluetooth scanner app after connecting to it with my phone and Yes when I use the gap_inquiry example it sometimes detects the headphone with the same BD ADDR I got with the Bluetooth scanner app and when it tries to connect to it I get error code 0x04 I tried many examples HSP_AG and a2dp_source all struggles to connect to this despite they connect smoothly with my old microphone and speaker toy. |
Sound like a hardware problem. Could you try with a different ESP32 or you can try with an USB Bluetooth dongle and port/libusb on macOS or Linux. There are a minimal configuration options to set-up a connection, but I haven't played with them as Classic connections work in general if the device is around and the BD ADDR is correct. |
You tested with HFP_AG example on modern headphones before? I also thought it might be a problem with my ESP32 board but I have a friend also tried an iPhone headset with ESP32 and also faced the same problem he bought another headset and it worked so I don't know what is the problem I also tried the esp-idf examples and also the same problem I bought another headset DL19 and it also gets the error code 0x04 but both connects with my phone easily I think it is a hardware problem or it needs some configurations to be added in the code but I captured the HCI logs and it is the same whether the headphones is on or off as if the ESP32 is not seeing the headphone at all despite it can sometimes query the BD ADDR of it with the gap_inquiry example. |
@mringwal this is the HCI logs when I attempt to connect to the DL19 headset with the HFP_AG example
and this is when I used gap_inquiry example it rarely discover the device once every 20 attempts
|
If you get error 0x04 page timeout, the ESP32 did not get a response to it's paging requests, which would be identical to the device not being around. There's a 'page scan repetition' mode parameter, which is set to 0 by default (hci.c:7253). Please try the other values: 1 and 2 if it makes a difference, Other than that, please try an Broadcom/Cypress/Infineon USB Bluetooth dongle with one of our desktop ports, e.g. with the Laird BT-851 for comparison with the headset. Do you have a links to the headsets that you cannot connect to? A few customers connect to all kinds of headsets, although they mostly use A2DP instead of HFP, but they also need to connect first. |
@mringwal Thanks for your reply, The link to a headset that I cannot connect SoundCore life Q30 |
Describe the bug
I have an ESP32 board and want to make it a Bluetooth relay between a phone and a headphone the problem occurs with phones that force the ESP32 to be in a slave role the phone that doesn't require role change works correctly forces the ESP32 to make only one SCO connection with the phone and when I make a second SCO connection I got error code 0x0A which is from bluetooth.h corresponds to (ERROR_CODE_SYNCHRONOUS_CONNECTION_LIMIT_TO_A_DEVICE_EXCEEDED)
HINT: the ESP32 is in a slave role with the phone but master with the headphone but when it is a slave role with the phone I get an error
code 0x0A with the headphone despite ESP32 being a master with the headphone.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The ESP32 should route audio back and forth between the phone and headphone without any problem as it do when it is a master role
HCI Packet Logs
Unfortunately, I didn't take packet logs as the problem relies only on the ESP32 role.
Environment: (please complete the following information):
issue with this.
Additional context
To Avoid opening another Issue I also face a problem with connection to various headphones such as DL19 and Sound Core life Q30 if you can look at this problem also it will be good but I want to fix the problem of multiple SCO connection as this is the main problem.
The text was updated successfully, but these errors were encountered: