Bluez 5.46 hciuart configuration changes
Update; 2017-08-13 Sunday
I discovered the problem is really in the tools/hciattach_bcm43xx.c file
I have now uploaded a patch to the git repo.
1. The speed cannot be set before the fiimware is uploaded
2. Wait 1 second before the reset command is sent.
Patch information;
git diff tools/hciattach_bcm43xx.c
diff --git a/tools/hciattach_bcm43xx.c b/tools/hciattach_bcm43xx.c
index 81f38cb..13a877c 100644
--- a/tools/hciattach_bcm43xx.c
+++ b/tools/hciattach_bcm43xx.c
@@ -43,7 +43,7 @@
#include "hciattach.h"
#ifndef FIRMWARE_DIR
-#define FIRMWARE_DIR "/etc/firmware"
+#define FIRMWARE_DIR "/lib/firmware"
#endif
#define FW_EXT ".hcd"
@@ -368,8 +368,6 @@ int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti,
if (bcm43xx_locate_patch(FIRMWARE_DIR, chip_name, fw_path)) {
fprintf(stderr, "Patch not found, continue anyway\n");
} else {
- if (bcm43xx_set_speed(fd, ti, speed))
- return -1;
if (bcm43xx_load_firmware(fd, fw_path))
return -1;
@@ -380,6 +378,7 @@ int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti,
return -1;
}
+ sleep(1);
if (bcm43xx_reset(fd))
return -1;
}
Nikolay patch; This has the binary file in it hciattach you can just replace yours with..
https://bugs.launchpad.net/snappy/+bug/1674509/+attachment/4854099/+files/bluez.tar.xz
Nikolay solution Is here;
https://bugs.launchpad.net/snappy/+bug/1674509
Nikolay (2xl) wrote on 2017-04-04:
I did the same patch – modify firmware patch and speed initialization patch… and I got bluetooth working on RPi!
############################## older information
When you upgrade to the latest bluez 5.46-1 everything will work as of 2017-08-12.
goal; that firmware simply loads on boot and bluetooth works.
Indications that firmware loading failed;
the mac address is all AA’s
hciconfig
hci0: Type: Primary Bus: UART
BD Address: AA:AA:AA:AA:AA:AA ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING PSCAN
RX bytes:2095 acl:0 sco:0 events:118 errors:0
TX bytes:1974 acl:0 sco:0 commands:118 errors:0
How does it work to update bluez-5.46 then later not?
The Chip still has its firmware uploaded, until you reboot. Then the firmware needs to be reloaded. And there is the change;
/etc/firmware is expected location from hciattach
BCM43430A1.hcd << one file needed
/var/firmware is where all the RPI’s firmware is located.
/var/firmware/BCM43430A1.hcd << cp this
mkdir /etc/firmware
cp /var/firmware/BCM43430A1.hcd /etc/firmware
Other related files;
/usr/bin/btuart
/lib/systemd/system/hciuart.service
My final analysis in retrospect;
The bluez 5.23 package that is in Jessie has an edit not part of the patches in tools/hciuart_bcm43xx.c, and this lead to a missed non working update to 5.46. All is working in the 5.46-1 release.
Pingback: Bluez 5.46 for RaspberryPi 3 (pi3) – Bill Thompson's Blog
Pingback: Build Bluez 5.46 yourself for your Debian Jessie – Bill Thompson's Blog