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

Choppy bluetooth audio #38

Closed
rgilles42 opened this issue Feb 1, 2020 · 8 comments
Closed

Choppy bluetooth audio #38

rgilles42 opened this issue Feb 1, 2020 · 8 comments

Comments

@rgilles42
Copy link

rgilles42 commented Feb 1, 2020

Hi,
I managed to make my Raspberry Pi 3B+ (running latest stable Raspbian) discoverable on Bluetooth and to have an audio stream to it.

However, the audio is very choppy and quite poor.
Moreover, I'm getting these lines in loop in journalctl when there's audio streamed to it.

févr. 01 18:18:40 raspberrypi kernel: Bluetooth: hci0: Frame reassembly failed (-84)
févr. 01 18:18:40 raspberrypi kernel: Bluetooth: hci0: Frame reassembly failed (-84)
févr. 01 18:18:40 raspberrypi kernel: Bluetooth: hci0: Frame reassembly failed (-84)
févr. 01 18:18:40 raspberrypi kernel: Bluetooth: hci0: Frame reassembly failed (-84)
févr. 01 18:18:40 raspberrypi kernel: Bluetooth: hci0: Frame reassembly failed (-84)
févr. 01 18:18:40 raspberrypi kernel: Bluetooth: hci0: Frame reassembly failed (-84)
févr. 01 18:18:40 raspberrypi kernel: Bluetooth: hci0: Frame reassembly failed (-84)
févr. 01 18:18:40 raspberrypi kernel: Bluetooth: hci0: Frame reassembly failed (-84)
févr. 01 18:18:40 raspberrypi kernel: Bluetooth: hci0: Frame reassembly failed (-84)
févr. 01 18:18:40 raspberrypi kernel: Bluetooth: hci0: Frame reassembly failed (-84)
févr. 01 18:18:40 raspberrypi kernel: Bluetooth: hci0: Frame reassembly failed (-84)
févr. 01 18:18:40 raspberrypi kernel: Bluetooth: hci0: Frame reassembly failed (-84)
févr. 01 18:18:40 raspberrypi kernel: Bluetooth: hci0: Frame reassembly failed (-84)
févr. 01 18:18:40 raspberrypi kernel: Bluetooth: hci0: Frame reassembly failed (-84)
févr. 01 18:18:40 raspberrypi bluealsa[340]: /usr/bin/bluealsa: Missing RTP packet: 90 != 89
févr. 01 18:18:41 raspberrypi bluealsa[340]: /usr/bin/bluealsa: SBC decoding error: No such file or directory
févr. 01 18:18:41 raspberrypi kernel: Bluetooth: hci0: Frame reassembly failed (-84)
févr. 01 18:18:41 raspberrypi kernel: Bluetooth: hci0: Frame reassembly failed (-84)
févr. 01 18:18:41 raspberrypi kernel: Bluetooth: hci0: Frame reassembly failed (-84)

Any idea of how to solve that ?

Many thanks in advance

Edit : I had wlan0 pulled down by default

@nicokaiser
Copy link
Owner

See "Limitations" in the README.md:

You might want to use a Bluetooth USB dongle or have the script disable Wi-Fi while connected (see bluetooth-udev), as the BCM43438 (Raspberry Pi 3, Zero W) has severe problems with both switched on, see raspberrypi/linux/#1402.

Depending on your Bluetooth connection (and maybe on some other factors) this may improve the connection, however the internal Bluetooth remains crappy and using an external USB dongle really helps.

@rgilles42
Copy link
Author

rgilles42 commented Feb 1, 2020

As stated in the Edit line at the end of the comment, Wi-Fi is disabled by default on my RPi.
My home WI-Fi network operates fully on the 5GHz and I can't see anything obvious clogging up the 2.4GHz band that Bluetooth uses.

Is it really only due to the crappy nature of the RPi embedded Bluetooth equipement ? Wouldn't you see anything to do in the Bluetooth UART configuration for instance ?

@nicokaiser
Copy link
Owner

This is discussed in raspberrypi/firmware#1150 (among many other places). It may be related to high system load (whatever "high" means, maybe decoding A2DP packages and feeding built in sound card is enough), but after fiddling around many days, I decided to add a dedicated Bluetooth dongle and all those problems disappeared, and since I want to have high quality audio I also replaced the internal sound card by a I2S module (which is also worth it).

I did not try if the Raspberry Pi 4's chip does better, neither did I dive into UART configuration...

HiFiBerry OS does not even try to use BT on the Pi 3: https://github.com/hifiberry/hifiberry-os/blob/master/buildroot/package/btspeaker/checkpi.sh (Which also disables BT on the Pi 3 with dedicated USB dongles, but that's another story).

@rgilles42
Copy link
Author

Alright, that github comment sums up the problem pretty well : raspberrypi/linux#2264 (comment)

"The rev 1.2 Pi3B lacks the flow control signals to the Bluetooth modem (we ran out of pins), but the rev 1.3 board drops the BT PCM interface and hooks up the flow control. I think what you are seeing is occasional data loss when the FIFOs overflow, something which is hard to avoid in all circumstances. You may be able to lessen the problem by reducing the baudrate on the modem - try editing /usr/bin/btuart, replacing the 921600 with 460800 and rebooting."

It seems the 3B+ has the same problem described here for the first revisions of the 3B.

Reducing the baudrate as explained did the trick for me :)

@nicokaiser
Copy link
Owner

Good to know that there is this baudrate trick!

@rgilles42
Copy link
Author

Thank you very much for your efforts and your time 👍

@amo13
Copy link

amo13 commented Apr 11, 2021

For anyone landing here, I can confirm that the bluetooth-udev-trick worked for me on the Pi4 B. No more stuttering or dropouts.
Just uncomment #ifconfig wlan0 down & and #ifconfig wlan0 up & in /usr/local/bin/bluetooth-udev.

Edit: But keep in mind that this trick turns off wifi during bluetooth connection!

@nicokaiser
Copy link
Owner

I can confirm this trick works for some environments, however in general (especially with Bluetooth distances >1m or when there are many Wi-Fi networks around) the Raspberry Pi internal Bluetooth module is not capable enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants