Skip to content

Commit

Permalink
Attempt to fix bluetooth communication problem on rpi3b
Browse files Browse the repository at this point in the history
This problem is referenced in many different issues, some of them:
Bluetooth: hci0: Frame reassembly failed (-84)
raspberrypi/firmware#1150

Error communicating with local bluetooth adapter (RPi3)
home-assistant/core#30147

Xiaomi BLE Temperature and Humidity sensor no longer working after update from 0.95.4 to .096.5
home-assistant/core#25704

Xiaomi BLE Temperature and Humidity sensor
home-assistant/core#24313 (comment)

Solution seemed to reeduce the boud rate of the serial connection to BT
on rpi3b where flow control is missing.

The patch to the original btuart file is to reduce the baudrate only for
rpi3b models where flow control is missing:

-		$HCIATTACH /dev/serial1 bcm43xx 921600 noflow - $BDADDR
+		$HCIATTACH /dev/serial1 bcm43xx 460800 noflow - $BDADDR

I'm not a buildroot expert but the best way seemed to move the
upstream btuart download in a PRE_PATCH_HOOK so that standard
buildroot way of patching can be applied.
  • Loading branch information
lucagiove committed Mar 25, 2020
1 parent 6c58a94 commit da9f84c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Bluetooth: hci0: Frame reassembly failed (-84)
https://github.com/raspberrypi/firmware/issues/1150

Signed-off-by: Luca Giovenzana <[email protected]>

--- btuart.orig 2020-03-25 03:05:24.491176583 +0100
+++ btuart 2020-03-25 03:05:43.603107833 +0100
@@ -19,7 +19,7 @@ if [ "$uart0" = "$serial1" ] ; then
if [ "$uart0_pins" = "16" ] ; then
$HCIATTACH /dev/serial1 bcm43xx 3000000 flow - $BDADDR
else
- $HCIATTACH /dev/serial1 bcm43xx 921600 noflow - $BDADDR
+ $HCIATTACH /dev/serial1 bcm43xx 460800 noflow - $BDADDR
fi
else
$HCIATTACH /dev/serial1 bcm43xx 460800 noflow - $BDADDR
2 changes: 1 addition & 1 deletion buildroot-external/package/bluetooth-bcm43xx/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ config BR2_PACKAGE_BLUETOOTH_BCM43XX
depends on BR2_PACKAGE_BLUEZ5_UTILS_CLIENT
select BR2_PACKAGE_BLUEZ5_UTILS_DEPRECATED
help
Install bluetooth for bcm43xx.
Install bluetooth for bcm43xx.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ BLUETOOTH_BCM43XX_LICENSE_FILES = $(BR2_EXTERNAL_HASSOS_PATH)/../LICENSE
BLUETOOTH_BCM43XX_SITE = $(BR2_EXTERNAL_HASSOS_PATH)/package/bluetooth-bcm43xx
BLUETOOTH_BCM43XX_SITE_METHOD = local

define BLUETOOTH_BCM43XX_BUILD_CMDS
define BLUETOOTH_BCM43XX_FIRMWARE_AND_HELPERS_DOWNLOAD
curl -L -o $(@D)/BCM43430A1.hcd https://raw.githubusercontent.com/RPi-Distro/bluez-firmware/fff76cb15527c435ce99a9787848eacd6288282c/broadcom/BCM43430A1.hcd
curl -L -o $(@D)/BCM4345C0.hcd https://raw.githubusercontent.com/RPi-Distro/bluez-firmware/fff76cb15527c435ce99a9787848eacd6288282c/broadcom/BCM4345C0.hcd
curl -L -o $(@D)/btuart https://raw.githubusercontent.com/RPi-Distro/pi-bluetooth/cbdbcb66bcc5b9af05f1a9fffe2254c872bb0ace/usr/bin/btuart
curl -L -o $(@D)/bthelper https://raw.githubusercontent.com/RPi-Distro/pi-bluetooth/cbdbcb66bcc5b9af05f1a9fffe2254c872bb0ace/usr/bin/bthelper
curl -L -o $(@D)/90-pi-bluetooth.rules https://raw.githubusercontent.com/RPi-Distro/pi-bluetooth/cbdbcb66bcc5b9af05f1a9fffe2254c872bb0ace/lib/udev/rules.d/90-pi-bluetooth.rules
endef

BLUETOOTH_BCM43XX_PRE_PATCH_HOOKS += BLUETOOTH_BCM43XX_FIRMWARE_AND_HELPERS_DOWNLOAD

define BLUETOOTH_BCM43XX_INSTALL_TARGET_CMDS
$(INSTALL) -d $(TARGET_DIR)/etc/systemd/system/hassos-hardware.target.wants
$(INSTALL) -m 0644 $(@D)/bluetooth-bcm43xx.service $(TARGET_DIR)/usr/lib/systemd/system/
Expand Down

0 comments on commit da9f84c

Please sign in to comment.