Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Instruction Guide Pi Zero 2 W: Fix choppy bluetooth playback (updated firmware package now available)
#1
Update: The Zero 2 W bluetooth issue is finally fixed in Moode version 8.3.6 (fresh install) which contains an updated version of the package firmware-brcm80211 (1:20230210-5~bpo11+1+rpt1). For older Moode versions you can run "sudo apt update" followed by "sudo apt install firmware-brcm80211" to solve the issue. No need to follow the guide anymore.

Many users of the Raspberry Pi Zero 2 W (including myself) have experienced choppy audio playback using its internal bluetooth adapter to connect to a speaker/headset. Fortunately a Support thread started by @citro recently came up with a solution (https://moodeaudio.org/forum/showthread.php?tid=4937).

The problem turns out to be caused by internal WLAN and bluetooth interfering with each other and can easily be fixed (or at least greatly improved) by adding coexistence parameters to a firmware configuration file (https://github.com/RPi-Distro/firmware-n.../issues/33). Interestingly the same coexistence parameters have already been in place for virtually all other Raspberry Pi variants - just the Zero 2 W was missing. Note also that the fix has already been added to the source of the respective Pi OS firmware package firmware-brcm80211 (see https://github.com/RPi-Distro/firmware-n...80211/brcm). So the issue should automatically be fixed in a future upgrade of Raspberry Pi OS.


The following guide shows how to fix the bluetooth settings in Moode already today (and spares you the time to browse through the quite long original thread):

1) After logging into Moode via ssh, first check which chip variant your 2 W is using (there are two versions with separate configuration files):

Code:
dmesg | grep brcmfmac43436

This shows either "using brcm/brcmfmac43436s-sdio for chip BCM43430/1" or "using brcm/brcmfmac43436-sdio for chip BCM43430/2".

2) Open the respective firmware configuration file in an editor (e.g. nano):

Code:
# For chip variant BCM43430/1 run
sudo nano /lib/firmware/brcm/brcmfmac43436s-sdio.txt

# For chip variant BCM43430/2 run
sudo nano /lib/firmware/brcm/brcmfmac43436-sdio.txt

3) Add the following lines at the end of the firmware configuration file (same parameters for both variants):

Code:
# Improved Bluetooth coexistence parameters
btc_mode=1
btc_params8=0x4e20
btc_params1=0x7530

4) Finally reboot:

Code:
sudo reboot

Bluetooth audio transmission should be clean now (yet at the cost of reduced WLAN throughput while there is bluetooth traffic).


Best regards
Jens
Reply
#2
Just a quick update: The Zero 2 W bluetooth issue is indeed fixed in the recently released Raspberry Pi OS based on Debian 12 (Bookworm), which contains the coexistence parameters out of the box. Moode Audio should therefore automatically pick up the fix when the underlying OS changes from Bullseye to Bookworm in a future Moode version.
Reply
#3
(10-11-2023, 10:36 PM)jenzd Wrote: Just a quick update: The Zero 2 W bluetooth issue is indeed fixed in the recently released Raspberry Pi OS based on Debian 12 (Bookworm), which contains the coexistence parameters out of the box. Moode Audio should therefore automatically pick up the fix when the underyling OS changes from Bullseye to Bookworm in a future Moode version.

Nice :-)
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#4
Interesting, I just learned that a fresh installation of Moode 8.3.6 contains the updated firmware-brcm80211 package as well. So does a usual Bullseye-based Raspberry Pi OS installation with all updates installed (20230210-5~bpo11+1+rpt1 is the new package version with the fix, the previous version 20221012-1~bpo11+1+rpt1 still had the issue). Note, however, that older versions of Moode stay on the previous firmware package version when they are upraded to 8.3.6.

Anyway, nice to see that the Zero 2 W bluetooth issue is finally fixed - even for Bullseye (and in the latest Moode version). No need to wait for Bookworm here. :-)
Reply
#5
Whats the apt name of the package?

I can prolly include it in the upcoming 8.3.7 in-place update.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#6
The apt name of the package is "firmware-brcm80211", the specific (latest) version is "firmware-brcm80211=1:20230210-5~bpo11+1+rpt1"

Thanks & best regards
Jens
Reply
#7
I am having audio stuttering when I am connected to Bluetooth speaker with Moode Audio 8.3.6 installed on both RPi 0W and RPi 3B. It also affects 8.3.5. After I have returned to 8.3.2 problem disappeared.
I have also applied fix as per main post.
Is there anything I can provide to help debug?
Michal
Reply
#8
The only other recent item related to Bluetooth audio glitches is
https://moodeaudio.org/forum/showthread....6#pid48936
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#9
(11-28-2023, 03:07 PM)Mikka123T Wrote: I am having audio stuttering when I am connected to Bluetooth speaker with Moode Audio 8.3.6 installed on both RPi 0W and RPi 3B. It also affects 8.3.5. After I have returned to 8.3.2 problem disappeared.

Hi Michal,

Since version 8.3.2 is working fine for you, the issue might be related to the additional bluetooth codec support which was added in version 8.3.3 (aptX, aptX-HD, LDAC) or the enhanced SBC encoding quality which was added in version 8.3.4 (SBC XQ+). My actual guess is that the latter change might cause the issue with your specific bluetooth device.

Could you please try to modifiy the file /etc/systemd/system/bluealsa.service in version 8.3.6 to spot the issue? The file contains the following line, where both the additional codecs and the SBC XQ+ mode are activated:

Code:
ExecStart=/usr/bin/bluealsa -p a2dp-source -p a2dp-sink -c aptx -c aptx-hd -c ldac --sbc-quality=xq+


  1. Try to remove just the last switch "--sbc-quality=xq+" and see if this already solves the issue (after a final reboot). If this is the case, it would be interesting if "--sbc-quality=xq" (without the "+") would work instead.

  2. If step 1 didn't help, try to remove the switches "-c aptx -c aptx-hd -c ldac" as well (and reboot again). Now the configuration should be the same as in version 8.3.2

Could you please also post the results of the following command? (After you connected the device to Moode version 8.3.6, yet before any of the modifications):


Code:
# check codec of connected bluetooth device
bluealsa-cli --verbose list-pcms



Regards
Jens
Reply
#10
Newbie alert... have had moodeaudio running for only an hour or so.

S Y S T E M   P A R A M E T E R S
moOde release   = 8.3.7 2023-12-07
RaspiOS         = 11.8
Linux kernel    = 6.1.21-v8+ #1642
Platform        = Pi-Zero 2 W 1.0 512MB
Architecture    = aarch64 (64-bit)

I had the same stuttering audio when using a bluetooth loudspeaker or a pair of bluetooth headphones.   The stutter was once every half second.

@jenzd
Quote:Try to remove just the last switch "--sbc-quality=xq+" and see if this already solves the issue (after a final reboot).
No effect at all.

@jenzd
Quote:If this is the case, it would be interesting if "--sbc-quality=xq" (without the "+") would work instead.
Next, I tried this line.   It made a massive improvement, with stutters now once every 1 - 5 minutes.   Almost solved the problem.

Interesting if frustrating.
Reply


Forum Jump: