Skip to content

A2DP Demo on ESP32 WROOM-E Fire Beetle 2 Doesn't Pair on iOS or Android #702

Description

@tpitman

Describe the bug

I did the setup for the esp32.

I open the a2dp_sink_demo project in the ports/esp32/examples folder. I build it without issues and install it on my Fire Beetle 2 dev board.

When I run it my iPhone acts like it is connecting, but never asks to pair with the device. Eventually it times out.

On Android the phone asks if I want to pair and I select "pair". It acts like it has paired, but doesn't connect and won't connect.

I have another project that is the hfp demo and it works great. When I connect using the iPhone a dialog appears asking me if I want to pair and when I select to pair it works. Same on Android.

To Reproduce

Steps to reproduce the behavior:

  1. Run example a2dp_sink_demo
  2. Connect to remove device iPhone 12
  3. Note that the iPhone never asks to pair
  4. Note that eventually it times out

Expected behavior

I would expect it to pair and connect and then be able to receive audio from my iPhone.

HCI Packet Logs

packet_log.pklg.zip

Environment: (please complete the following information):

  • Current BTstack branch: develop
  • Bluetooth Controller DFRobot Fire Beetle 2 esp32-wroom-e
  • Remote device: iPhone 12 with iOS 18.6

Activity

  1. mringwal commented on Aug 11, 2025

    @mringwal
    Member

    Hi. There's just a disconnect in the log shortly after the connect. Maybe it isn't your phone after all, but the ESP32 dev kit - or you're living in a very challenging RF environment.

    Could you try a different ESP32 dev kit? (Sorry, no better idea right now).

  2. tpitman commented on Aug 11, 2025

    @tpitman
    Author

    I have successfully built the hfp_hs_demo and it runs and works and pairs and I can get microphone input to the same phone on the same esp32 dev kit.

    Does that change things at all or is the hfp somehow better able to handle whatever would be causing issues with the a2dp?

  3. mringwal commented on Aug 16, 2025

    @mringwal
    Member

    HSP/HFP actually requires working SCO connections in addition to ACL connections, so in general, if HFP works, A2DP should work as well. In your log, the connection is lazily closed by the remote device after doing a single SDP query. The query is for all L2CAP services, which is basically everything. In our a2dp_sink_demo, there should be 2 SPD Records, one for A2DP/AVDTP and one for AVRCP/AVCTP. Did you make any changes to our demo? Please try to run the a2dp_sink_demo without changes on your ESP32 Wroom board.

  4. tpitman commented on Aug 18, 2025

    @tpitman
    Author

    I did not make a single change. I just built it and flash it and those logs are the result.

  5. mringwal commented on Aug 27, 2025

    @mringwal
    Member

    I've just tried to run the a2dp sink demo on a ESP32 and pretty much got the same error as you - which is quite puzzling. Stay tuned...

  6. winzkigermany commented on Aug 28, 2025

    @winzkigermany

    Seeing the same here. Pairing is working just fine.
    But connecting A2DP does not work, because the connecting client never receives an SDP answer, that announces A2DP capabilities of the esp32.
    The SDP queries (from my pixel9 to the esp32) don't receive an answer (or a complete answer) from the esp32, although the SDP datasets are configured correctly on the btstack side.

    @mringwal: Maybe my dump from our last conversation (by email) helps you to pinpoint the problem...
    Last time, I was able to somehow make it work by erasing all flash of esp32, but not any more now. I'm stuck with the exact same problem again (develop branch).

  7. mringwal commented on Aug 28, 2025

    @mringwal
    Member

    @winzkigermany Thanks for making the connection. Do you have older binaries of your software you can test against to see if there was a change in BTstack and/or ESP-IDF?

    The strange thing is that there is no problem between iPhone and BTstack with an USB dongle. Also, running A2DP Source Demo of BTstack on USB dongle works also fine with the same ESP32 that failed with the iPhone.

    I'll get some HCI traces from the iPhone later and look for differences between ESP32 and USB dongle. In the local logs, there is no error, it's just that iOS does not send the next SDP query. Let's see if the iPhone did actually receive the SDP response.

  8. winzkigermany commented on Aug 28, 2025

    @winzkigermany

    Given I've not failed to use git properly, I just swapped btstack in my project with an older version, and the problem persisted.
    @tpitman : What esp-idf version are you working on? My project is currently on esp-idf 5.4.0

  9. mringwal commented on Aug 28, 2025

    @mringwal
    Member

    This is very confusing. I have the same ESP32 board ( a cheap yellow display), I've used yesterday with the same firmware. I've configure iOS to access the PacketLogs and can connect to ESP32 without problems. Any idea how to go deeper here?

  10. tpitman commented on Aug 28, 2025

    @tpitman
    Author

    @tpitman : What esp-idf version are you working on? My project is currently on esp-idf 5.4.0

    I am pretty sure when I started all of this I was using 4.4.x. I just tried 5.5.0 and it does the same thing.

  11. mringwal commented on Aug 29, 2025

    @mringwal
    Member

    As mentioned, the same board works now, even in the same location I've tested the first time without reflashing it.

    To move forward, we need more sample data: could you test both HFP HF as well as A2DP Sink on different ESP32 boards with different phones/laptops to see if there is some pattern? The HCI Traces from the ESP32 show no error.

    @tpitman Could you get an HCI trace from your Android and/or iPhone? It's easy on iOS following this instructions: https://developer.apple.com/bug-reporting/profiles-and-logs/ (although you probably need a (free) iOS develop account). I was able to get logs from Android the last time directly with Wireshark although it depends on your Android version. Ideal would be logs from ESP32 as well as from the remote that cover the issue.

  12. tpitman commented on Aug 29, 2025

    @tpitman
    Author

    This is a project I was doing for work. Unfortunately I moved on to a different approach and do not have approval to continue working on this route.

    I wish I could continue to help.

  13. mringwal commented on Aug 29, 2025

    @mringwal
    Member

    @tpitman thanks for bringing this up anyways. Feel free to contact us directly for commercial projects.

  14. tpitman commented on Aug 29, 2025

    @tpitman
    Author

    Will do.

  15. winzkigermany commented on Sep 3, 2025

    @winzkigermany

    I am currently going up and down with btstack versions and the esp-idf bt component versions. Nothing changes for the better.
    Pairing works fine. But then when I click "connect" on my phone (because the esp32 is showing as paired, but not connected)
    then my esp32 does not show /any/ incoming packets.
    I'll need to try to get back to some working state, before I can go on juggling with versions.

  16. winzkigermany commented on Sep 5, 2025

    @winzkigermany

    Here is the shocker: The only way to solve this problem for me, was to use a different ESP32 chip! (A WROVER-E module in my case). Using the broken module as an A2DP Source works flawlessly, but using it as an A2DP sink does not work.
    Erasing the flash completely did also not solve the problem.

    This leaves me stumped. And I don't hope there are many ESP32 modules out there with this problem.

  17. mringwal commented on Sep 10, 2025

    @mringwal
    Member

    Hi @winzkigermany The fact that the "bad" ESP32 works with the A2DP Source is really weird. Both send and receive packets. The obvious difference would be which sides initiates the connection. Can you try to open the connection from the opposite side (e.g. open from a2dp sink if you've previously opened it from the a2dp sink).

    As mentioned before, for me, it started working on the same board without any changes: same binary, no re-flash, same environment...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions