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

Bluetooth audio #2718

Open
qinzian2000 opened this issue Dec 25, 2024 · 7 comments
Open

Bluetooth audio #2718

qinzian2000 opened this issue Dec 25, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@qinzian2000
Copy link

When using Pico 2W to run sketch A2DPSink.ino, I found that Pico 2W has a lot of noise and can only play one lyric, causing Bluetooth to disconnect. Is there any way to solve this problem

@earlephilhower earlephilhower added the bug Something isn't working label Dec 25, 2024
@earlephilhower
Copy link
Owner

Thanks, I was able to verify this happens on the RPI WiFi module on the SparkFun Thing Plus RP2350 (no Pico 2Ws at Microcenter yet) and verify also the the exact same code works fine on the Pico W (I actually left my phone connected to the PicoW overnight and it was still playing).

Given that IIRC there is no code difference in the code in this repo for A2DP for the Pico vs. Pico 2, my worry is that this is an issue in the Pico SDK. The BT stack has always been fragile, in my experience, and maybe there's just something in the Pico2 driver that's not playing nice with the higher data rates of A2DP.

Have you experienced any issues with standard BT or BLE? Or just the A2DP?

I think the next step is to build the A2DP sample using the raw SDK and see if that also craps out on the Pico2W. If so, it'll be out of our hands but we can open an issue on the SDK repo.

@pschatzmann
Copy link

pschatzmann commented Jan 13, 2025

I just tried the A2DP Sink on a Pico 2W with I2S output and I can confirm that it works w/o any problems!

@earlephilhower
Copy link
Owner

Are you saying the A2DPSink here works or the BTStack example does? And I assume you ran for a few minutes. I think I got something like 3-4 mins of uptime and then things kind of fell apart when trying on the SparkFun RP2350 board with the code here (but I don't remember if it was PWM or I2S).

@pschatzmann
Copy link

pschatzmann commented Jan 13, 2025

I was testing your A2DPSink example on a Pico 2W: I just changed the output from PWM to I2S!
Initially I just played one song (for a couple of minutes).

I therefore repeated the test and let it run for a bit more then 15 minutes w/o having any issues.
I even moved the phone to the next room w/o loosing any connection.
I also made sure that I tested with the latest Arduino core version.

Some additional info: was testing with Android! (On the ESP32 iOS does also strange things with the combination of A2DP and I2S).

So the issue might be maybe PWM or maybe iOS or a bad Pico 2W ?

@earlephilhower
Copy link
Owner

Great, thanks for the info!

I only have what may be preproduction 3rd party boards with RPI-WiFi daughtercards so there's some slight chance they weren't quite up to snuff. I'll give it one more go (I was doing Android streaming as well) when I get a chance and try I2S as well as PWM.

@qinzian2000
Copy link
Author

Thank you all for your help

@earlephilhower
Copy link
Owner

I can confirm that the Pico 2W I2S + A2DPsink runs fine, while the PWMAudio + A2DPSink results in a crash on the Pico2W. There's also a #ifdef issue in the latest master (not in a release yet) but that's orthogonal to this. Even removing the load from the PWMPins (i.e. assuming it's an electrical thing) doesn't change the results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants