Pi3 bluetooth audio stutters with Wifi enabled · Issue #1402 · raspberrypi/linux · GitHub
Skip to content

Pi3 bluetooth audio stutters with Wifi enabled #1402

Open

Description

@SebastiaanAdamo

Hello,

I'm testing with streaming music using a2dp over bluetooth on the Pi3. When Wifi is enabled, I get constant buffer underruns wit Pulseaudio (Blueman shows a downstream of around 34kB/s). As soon as I disable the Wifi interface (ifdown wlan0), the audio starts to play normally and the downstream is around 42kB/s (which is correct high quality stereo audio if I see http://soundexpert.org/news/-/blogs/bluetooth-audio-quality-a2dp).
Also tried making the buffer much larger, changing resampling type, realtime-scheduling etc. Also tried latest Pulseaudio, no difference. Seems like it is a Raspberry problem.

First thought it was because the Wifi and Bluetooth both use UART, but the is not true (and would be too slow if Wifi was over the 921600 baud if I see it correctly). They still share the same chip (BCM43438). Is there a known reason why I (and also heard others) have this problem?

Activity

  1. pbros commented on Apr 17, 2016

    @pbros

    I've been having the exact same issue. Disabling WLAN0 fixed the audio issues. However, I would very much like to be able to use the wifi...

  2. pbros commented on Apr 19, 2016

    @pbros

    I was able to get A2DP to work by disabling the on-board wifi and using a Wi-Pi USB adapter, without any extension cable.

  3. Ferroin commented on Apr 19, 2016

    @Ferroin
    Contributor

    This brings up a rather interesting question: Does the on-board WiFi chip support Bluetooth co-existence, does the driver support this, and does it work correctly? Based on what I've seen from multiple sources, there's considerably better latency when you either disable the on-board WiFi or disable the on-board Bluetooth and use a USB adapter instead, and that sounds to me like either the on-board chip doesn't correctly implement BT co-existence, or the driver doesn't properly support it.

  4. pelwell commented on Apr 19, 2016

    @pelwell
    Contributor

    The BCM43438 has a co-existence interface between the WiFi and Bluetooth interfaces - no software support is required.

  5. WayneKeenan commented on Apr 19, 2016

    @WayneKeenan

    @Ferroin From my experience I would say /fundamentally/ yes it does, although I'm not an authoritative source and I do not demand much on the Bluetooth side.... Whilst developing Bluetooth LE central and peripheral applications on a Pi 3 I run a VNC X session, 2x SSH sessions and have NFS share mounted all via WiFi and all are ok.

  6. rschulman commented on Oct 7, 2016

    @rschulman

    +1 on this, as I've just discovered tonight. Took wlan0 down and the audio played just fine. Has anyone gotten any new word since August on what's going on here and if there's a fix?

  7. adn77 commented on Nov 14, 2016

    @adn77

    +1 me too, "ifdown wlan0" and pulseaudio streams fine via a2dp

  8. libertineplusplus commented on Dec 12, 2016

    @libertineplusplus

    +1, just updated today, using an Anker Sound Core bluetooth speaker. Plays beautifully if I turn off wifi, but that's a pretty big workaround. It's annoying but workable for this project (OKAY FINE, I'll connect via hdmi instead of vncserver I GUESS ) but I too am waiting on a fix because it seriously limits my ability to make my projects mobile. VNCserver is a must.

  9. vgallissot commented on Jan 7, 2017

    @vgallissot

    +1 that gave me headaches finding this problem out !

    I needed WiFi so I just:

    1. Use a USB dongle as WiFi adapter
    2. Disable onboard WiFi adapter in /etc/network/interfaces

    No more sound problems.

  10. daryltucker commented on Jan 12, 2017

    @daryltucker

    I'm excited to see any progress on this, but as a reminder, you can Subscribe to this thread and add a reaction to the original post. It is not recommended to post a response of +1.

  11. jeffleus commented on Jan 24, 2017

    @jeffleus

    Agreed that no WiFi is crippling to the base Pi3. Adding a usb dongle defeats one of the big gains w/ the Pi3 of onboard WiFi/BT. :-(

  12. mohitkalraniit commented on Jan 24, 2017

    @mohitkalraniit

    I have also tested the behavior and facing same issue as reported here. Planning to add additional USB WiFi adapter to overcome the problem. Hope pi would support second WiFi without much problems.

  13. hurda commented on Feb 28, 2017

    @hurda

    I guess the Zero W will suffer from the same issues regarding Bluetooth and WLAN, as its using the same chip?
    Using USB-devices as workarounds ain't that easy with the Zero W, though.

  14. BaReinhard commented on Mar 3, 2017

    @BaReinhard

    Is this happening to everyones Raspberry Pi? How is the music being played? (Pi hat DACs, sound cards, BCM?) What are you using the Wifi for?

    Because, I haven't had any issues with my Pi3

  15. 126 remaining items

  16. JamesH65 commented on Mar 29, 2019

    @JamesH65
    Contributor

    @pratt-jeremy Is that a wireless keyboard?

  17. gearhead commented on Apr 9, 2019

    @gearhead
    Contributor

    I have the same problem. Running Arch on a Pi B3, B3+ and Zero. All exhibit the same symptoms: Choppy play with a2dp. Arch has not updated the firmware as listed here, but I did that manually first. If I use the onboard BT on these 3 machines, Bluealsa complains of buffer under runs and it plays music in spurts. The journal shows a buffer under run. If I use a USB dongle it all works as expected. Can we try anything else? fwiw, my kernel is 4.19.32

  18. bwims commented on Apr 9, 2019

    @bwims
  19. gearhead commented on Apr 9, 2019

    @gearhead
    Contributor

    Is this the appropriate command to run to get the onboard BT working?
    /usr/bin/btattach -B /dev/ttyAMA0 -P bcm -S 3000000
    This is the command in the service file for Arch Linux with the default install of Bluez 5.50

  20. gearhead commented on Apr 10, 2019

    @gearhead
    Contributor

    So I have streaming audio to a B3+ with wifi enabled and active (I am logged in via ssh). I am running Arch Linux. I had to install bluez-utils-compat to get the hciattach command installed. I believe Raspian has this already...

    cat /proc/asound/card0/pcm0p/sub0/hw_params 
    access: RW_INTERLEAVED
    format: S16_LE
    subformat: STD
    channels: 2
    rate: 44100 (352800/8)
    period_size: 4410
    buffer_size: 22050
    

    The default Bluez 5.50 package has btattach which Arch uses to turn on the BT adapter. This did not work. All I got was stuttering sound. This the Arch pi-bluetooth package calls for the command to be:
    ExecStart=/usr/bin/btattach -B /dev/ttyAMA0 -P bcm -S 3000000
    The command that worked was from an older version of the package:
    ExecStart=/usr/bin/hciattach -n /dev/ttyAMA0 bcm43xx 921600 noflow -
    I do not claim to know if this is 'correct' or whatever, just that this is the first time I have had smooth playing bluetooth using the onboard adapter.

  21. vitaminace33 commented on Oct 29, 2019

    @vitaminace33

    Just to avoid confusions. Broadcom WiFi tech was bought by Cypress back in June 2016. Since then

    • BCM43438 is CYW43438
    • BCM43455 is CYW43455
  22. pratt-jeremy commented on Oct 29, 2019

    @pratt-jeremy

    @pratt-jeremy Is that a wireless keyboard?

    @JamesH65 yes, it's a bluetooth keyboard I see this was for audio, but thought i'd mention it. Once I turned off the wifi the bluetooth keyboard worked perfectly. No repeated characters i didn't press.

  23. JamesH65 commented on Oct 30, 2019

    @JamesH65
    Contributor

    Presumably your distro is fully up to date?

  24. pratt-jeremy commented on Oct 30, 2019

    @pratt-jeremy

    Presumably your distro is fully up to date?

    It was up to date when I posted here, it's probably out of date by now since it was in Mar. I'll update and see if it still is happening.

  25. parkerlreed commented on May 12, 2020

    @parkerlreed

    On an RPI4 with WiFi soft blocked in rfkill. Still choppy on Pulseaudio A2DP.

  26. cipriantrofin commented on Dec 27, 2022

    @cipriantrofin

    A little offtopic, but I'm having the same issue with Raspberry Pi Zero 2 W

  27. vadcx commented on Oct 25, 2024

    @vadcx

    I recommend that you leave your 2.4GHz network set to 20MHz-only. Using 40MHz in 2.4GHz doesn't leave enough room for other uses of the band, such as Bluetooth. All of Apple's N-capable gear limits itself to 20MHz operation in 2.4GHz (even if the third-party Wi-Fi AP is configured to allow 40MHz operation in 2.4GHz), in order to leave room for Bluetooth. So your MacBook Pro is only going to use 40MHz-wide channels in 5GHz. - https://superuser.com/a/362377

    I wonder if it talks about the same phenomenon or the literal spectrum width. Would someone please try to set their AP to only 20 MHz mode OR with newer models that support 5 GHz try to simultaneously use BT and the 5 GHz WiFi AP? That being said, the older chip (CYW43438) is only capable of 2.4GHz and 20 MHz width, so this is just a shot in the dark. The layout shows only one (shared) antenna.

  28. seamusdemora commented on Oct 28, 2024

    @seamusdemora
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

    Bluetooth Issuepelwell_there_is_no_escapeBugWaiting for internal commentWaiting for comment from a member of the Raspberry Pi engineering teamWifi IssueAny issues related to wifi

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions