jonathanCCC
Posts: 23
Joined: Thu Apr 21, 2016 7:56 am

Update Bluez version PI 3

Thu Apr 21, 2016 8:05 am

Hello,

I am trying to update the bluez version 5.23 to 5.39 on the raspberry 3 with raspbian-jessie image installed but it's not working. The command : "sudo apt-get install pi-bluetooth" will install bluez version 5.23. If I uninstall bluez 5.23 and install the version 5.39, hciconfig returns nothing and hcitool dev neiter.
I followed this post without success : http://raspberrypi.stackexchange.com/qu ... -5-23-5-36

Is there a way to upgrade bluez on the raspberry 3 ?

Thanks for your help,

texy
Forum Moderator
Forum Moderator
Posts: 5155
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Update Bluez version PI 3

Thu Apr 21, 2016 12:10 pm

Hi and welcome to the forum.
You should be able to download and compile bluez on the pi :

Code: Select all

cd ~
wget www.kernel.org/pub/linux/bluetooth/bluez-5.23.tar.xz
tar xvf bluez-5.39.tar.xz
Follow the step 3 onwards in this post :

viewtopic.php?f=29&t=87138#p619713

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
Douglas6
Posts: 4711
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Update Bluez version PI 3

Thu Apr 21, 2016 12:53 pm

texy wrote:

Code: Select all

cd ~
wget www.kernel.org/pub/linux/bluetooth/bluez-5.23.tar.xz
tar xvf bluez-5.39.tar.xz
Well, you'll want to wget version 5.39 also.
texy wrote:Follow the step 3 onwards in this post :

viewtopic.php?f=29&t=87138#p619713
I'm not so sure of those instructions any more, particularly for a Pi3. I would try installing bluez-firmware as well, and build with systemd now. Haven't tried this; will post if I get it working.

jonathanCCC
Posts: 23
Joined: Thu Apr 21, 2016 7:56 am

Re: Update Bluez version PI 3

Thu Apr 21, 2016 1:27 pm

Hi, Thanks for your answers,
texy wrote:
Follow the step 3 onwards in this post :

view ... 38#p619713
I tried the instructions and it doesn't work with the embedded bluetooth of the Pi3 but it is only working with a dongle bluetooth.
Douglas6 wrote:
I would try installing bluez-firmware as well, and build with systemd now.
I tried this also without success.

Thanks for your help.

texy
Forum Moderator
Forum Moderator
Posts: 5155
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Update Bluez version PI 3

Thu Apr 21, 2016 2:22 pm

Douglas6 wrote:
texy wrote:

Code: Select all

cd ~
wget www.kernel.org/pub/linux/bluetooth/bluez-5.23.tar.xz
tar xvf bluez-5.39.tar.xz
Well, you'll want to wget version 5.39 also.
texy wrote:Follow the step 3 onwards in this post :

viewtopic.php?f=29&t=87138#p619713
I'm not so sure of those instructions any more, particularly for a Pi3. I would try installing bluez-firmware as well, and build with systemd now. Haven't tried this; will post if I get it working.
Yeah sorry - it was a cut & paste from your post, which I only edited 1 part of it :roll:
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

texy
Forum Moderator
Forum Moderator
Posts: 5155
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Update Bluez version PI 3

Thu Apr 21, 2016 2:23 pm

The goal posts have been moved :lol:
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

jonathanCCC
Posts: 23
Joined: Thu Apr 21, 2016 7:56 am

Re: Update Bluez version PI 3

Fri Apr 22, 2016 12:30 pm

Good news, I get it working with bluez-5.35 !

jonathanCCC
Posts: 23
Joined: Thu Apr 21, 2016 7:56 am

Re: Update Bluez version PI 3

Fri Apr 22, 2016 12:57 pm

Ohh noooo :(
I reinstalled the kernel and bluez 5.35 but I forgot that bluez 5.23 was installed by default... The working version was 5.23 :(
Sorry for the false hope !

jimmylee0407
Posts: 1
Joined: Sun May 29, 2016 2:56 am

Re: Update Bluez version PI 3

Sun May 29, 2016 3:04 am

Hi, I got the same problem here. hciconfig returned nothing when I uninstall bluez 5.23 and updated to bluez 5.39. Does anyone upgrade the bluez successfully?

jonathanCCC
Posts: 23
Joined: Thu Apr 21, 2016 7:56 am

Re: Update Bluez version PI 3

Fri Jun 10, 2016 9:18 am

Hi jimmylee,

I upgraded successfully bluez 5.39 on my pi 3.
You can follow the section "Patch Bluez source" of this link to install bluez 5.39 and the patch : https://github.com/ukBaz/python-bluezero/issues/30

Then check the bluetooth service with the following command :

Code: Select all

sudo systemctl status bluetooth
if the service is masked, you can unmask it and start it with :

Code: Select all

sudo systemctl unmask bluetooth.service
sudo systemctl start bluetooth.service
After configured, compiled and installed bluez, download the fw required for the BCM module and drop the files in /lib/firmware/brcm. Here is the link for the files : http://forums.openmediavault.org/index. ... /?pageNo=2
Then attach the module with this commad :

Code: Select all

hciattach /dev/ttyAMA0 bcm43xx 921600 noflow -
You should see this message :
bcm43xx_init
Flash firmware /lib/firmware/brcm/BCM43430A1.hcd
Set Controller UART speed to 921600 bit/s
Device setup complete

And bluetooth is finally working with bluez 5.39 !

jonny1947
Posts: 15
Joined: Fri Aug 19, 2016 12:41 pm

Re: Update Bluez version PI 3

Mon Aug 22, 2016 3:30 pm

Hi,

I'm trying to get Bluez 5.41 running on my Pi3. I tried http://blog.mrgibbs.io/bluez-5-39-ble-s ... pberry-pi/ link, but when i check the version of bluez it says 5.23 and hcitool is not working. Also when I try run the bluetoothctl it says waiting for bluetoothd to connect. Any idea why its not connecting to bluetoothd?

I tried many times to update the bluez with various tutorials but none of them seems to work well enough.

So i applied the patch to bluez as mentioned in this thread and recompiled bluez and all. after that i'm supposed to put some firmware files. When i go to /lib/firmware/brcm I see brcmfmac43430-sdio.bin and brcmfmac43430-sdio.txt but i dont see the BCM43430A1.hcd.

My question is should I just replace all the files from this link or just add the BCM43430A1.hcd file to current firmware files?

JonathanCCC : Can you confirm that when you run the dpkg --status bluez | grep '^Version:' command, you see the 5.39 version and not the 5.23? And also updating to 5.39, does hcitool and bluetoothctl works?

User avatar
Douglas6
Posts: 4711
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Update Bluez version PI 3

Mon Aug 22, 2016 3:51 pm

What does

Code: Select all

hciconfig -a
show? Also

Code: Select all

sudo bluetoothd -v

jonny1947
Posts: 15
Joined: Fri Aug 19, 2016 12:41 pm

Re: Update Bluez version PI 3

Mon Aug 22, 2016 3:58 pm

Hi,

hciconfig -a returns nothing.

bluetoothd -v shows 5.23

Not sure what the problem here is. Do you know how much stable is 5.23 for BLE applications?

jonathanCCC
Posts: 23
Joined: Thu Apr 21, 2016 7:56 am

Re: Update Bluez version PI 3

Mon Aug 22, 2016 4:19 pm

Hi jonny,

You have to download the files BCM43430A1.hcd, brcmfmac43430-sdio.bin and brcmfmac43430-sdio.txt and put them in /lib/firmware/brcm. I posted the link where you can find them.
JonathanCCC : Can you confirm that when you run the dpkg --status bluez | grep '^Version:' command, you see the 5.39 version and not the 5.23? And also updating to 5.39, does hcitool and bluetoothctl works?
When I run dpkg, I get 5.23 because raspbian does not have the last version of bluez. But I uninstalled 5.23 before installing 5.39.
hcitool and bluetoothctl are working with bluez 5.39.

jonny1947
Posts: 15
Joined: Fri Aug 19, 2016 12:41 pm

Re: Update Bluez version PI 3

Mon Aug 22, 2016 4:26 pm

Hi

Thanks jonathanCCC for the confirmation. So how do we know that which bluetooth stack we are using while developing BLE application?

I'll notify here if I can make your solution work for me. Thanks again.

jonny1947
Posts: 15
Joined: Fri Aug 19, 2016 12:41 pm

Re: Update Bluez version PI 3

Mon Aug 22, 2016 6:14 pm

Hi,

I'm not able to take a backup of the current firmware files. It says permission denied. I created a new directory called oldFW and then tried copying bcmfmac43430-sdio.bin andbcmfmac43430-sdio.txt files to oldFW. I even tried copying as root user. Any idea how can I take backup?

jonathanCCC
Posts: 23
Joined: Thu Apr 21, 2016 7:56 am

Re: Update Bluez version PI 3

Tue Aug 23, 2016 7:24 am

Hi,
So how do we know that which bluetooth stack we are using while developing BLE application?
It is better to uninstall bluez 5.23 : sudo apt-get autoremove pi-bluetooth before installing bluez 5.39.

You don't need to take a backup of the current firmware files, you just have to copy the new files in the directory.

jonny1947
Posts: 15
Joined: Fri Aug 19, 2016 12:41 pm

Re: Update Bluez version PI 3

Tue Aug 23, 2016 1:00 pm

Hi,

Thanks for clarification. So finally I should do as follows:

1. uninstall bluez 5.23 ==> sudo apt-get purge bluez
2. Download the bluez 5.39 (because the patch is for 5.39 only, right?)
3. Download the patch for 5.39
4. unzip or untar the bluez 5.39
5. before configuring and compiling bluez 5.39, apply patch
6. configure, compile and install bluez 5.39
7. make appropriate changes to bluetooth.conf file
8. sudo reboot
9. Hopefully it should work. Check by running command bluetoothd -v or dpkg --status bluez | grep '^Version:'

I guess for step 9, it will show 5.23 only, right?

JonathanCCC : are the above steps correct? is this what you did?

If this steps works for me then I will write a blog post about upgrading to 5.39 on Pi 3

Thanks

jonathanCCC
Posts: 23
Joined: Thu Apr 21, 2016 7:56 am

Re: Update Bluez version PI 3

Tue Aug 23, 2016 1:19 pm

Hi jonny,

I think it's not necessary to change bluetooth.conf file. The steps are the following :

1. uninstall bluez 5.23 ==> sudo apt-get purge bluez
2. Download the bluez 5.39 (it works with 5.41)
3. Download the patch for 5.39
4. unzip or untar the bluez 5.39
5. before configuring and compiling bluez 5.39, apply patch
6. configure, compile and install bluez 5.39
7. Run the commands : sudo systemctl unmask bluetooth.service and sudo systemctl start bluetooth
8. Paste the fw for the BCM module in /lib/firmware/brcm
9. reboot
10. Run the commands : /usr/bin/hciattach /dev/ttyAMA0 bcm43xx 921600 noflow -
sudo hciconfig hci0 up

And that's all. I hope it will work for you.

jonny1947
Posts: 15
Joined: Fri Aug 19, 2016 12:41 pm

Re: Update Bluez version PI 3

Tue Aug 23, 2016 1:37 pm

Hi,

Whats the last command for? I understand sudo hciconfig hci0 up, but not the earlier one? do you mean change directory to the path you showed? i dont understand "/usr/bin/hciattach /dev/ttyAMA0 bcm43xx 921600 noflow"

jonathanCCC
Posts: 23
Joined: Thu Apr 21, 2016 7:56 am

Re: Update Bluez version PI 3

Tue Aug 23, 2016 2:12 pm

Honestly I don't know what it does exactly, but without this command hciattach won't grab the device.

jonny1947
Posts: 15
Joined: Fri Aug 19, 2016 12:41 pm

Re: Update Bluez version PI 3

Tue Aug 23, 2016 2:17 pm

Hi

but that doesnt look like command to me. should I just type "/usr/bin/hciattach /dev/ttyAMA0 bcm43xx 921600 noflow -" as it is? something is wrong here. please clarify.

Also once I copy the firmware files into /lib/firmware/brcm, there would be two copies of brcmfmac43430-sdio.bin and brcmfmac43430-sdio.txt. is that fine?

jonathanCCC
Posts: 23
Joined: Thu Apr 21, 2016 7:56 am

Re: Update Bluez version PI 3

Tue Aug 23, 2016 2:37 pm

It's a command, you should just type it as it is.

On my pi3 I think I didn't have brcmfmac43430-sdio.bin and brcmfmac43430-sdio.txt, so if you already have them maybe you don't need to copy these files but you need BCM43430A1.hcd.

jonny1947
Posts: 15
Joined: Fri Aug 19, 2016 12:41 pm

Re: Update Bluez version PI 3

Tue Aug 23, 2016 2:56 pm

Hi,

I tired the steps exactly and looks like hci commands are working fine. I can scan my iphone from terminal. But cant connect to it. Also it grabs the BLE adapter and shows me the info and all.

Strangely when i check if the bluez pkg is installed or not , it says bluez is not installed. I can locate the bluetoothd at /usr/libexec/bluetooth path. but when i run bluetoothd it says command not found and when I try bluetoothctl it says waiting to connect to bluetoothd.

So I dont know whats happening here. it seems like bluetooth is working but not really. According to this post, http://blog.mrgibbs.io/bluez-5-39-ble-s ... pberry-pi/, i should have two copies of bluetoothd. but i dont. Do you have two copies of bluetoothd ? Are you able to run bluetoothctl and bluetoothd -v ?

I'll try these steps one more time. This time i'll have one copy of each brcmfmac43430-sdio.bin and .txt

Thanks

jonathanCCC
Posts: 23
Joined: Thu Apr 21, 2016 7:56 am

Re: Update Bluez version PI 3

Tue Aug 23, 2016 3:07 pm

Ok it's already a good news if you can scan your iPhone.
Can you connect to it with gatttool ?

Return to “General discussion”