How to get bluetooth working on Raspberry Pi 3 model B or B+ with Arch Linux ARM

I am not using Raspbian on my Raspberries for a while. I do not like two things about Raspbian and other distributions from Debian family. At first Debian is conservative and tends to older stable versions of software. The other thing I do not like is reinstallation if I want to switch to next release.

Installation of Arch Linux ARM is relatively easy for a Linux user. You can find the official installation manual here.

The one drawback is the lack of official support in Arch Linux while Raspbian is developed together with actual hardware. So when I bought myself Raspberry Pi 3 I found out that Bluetooth is not working with Arch Linux. When the plus version was released the situation was same. So I had to investigate myself and I want to share what I have found out.

There are packages pi-bluetooth and hciattach-rpi3 addressing this in AUR. But I haven’t found solution provided by this package elegant. It is based on compiling older version of Bluez which has deprecated hciattach command.

I found another solution which does not incorporate obsolete Bluez version. The actual problem is that Bluetooth chip does not have firmware loaded after boot. You can imagine Bluetooth chip as a standalone computer connected by serial port which has its own memory and run its own program. So there are two things to be solved. One is getting a firmware for Bluetooth chip and the other is finding utility to load this firmware into chip memory.

The best source of information is Raspbian developers GitHub. There can be found firmwares for both Raspberry Pi 3B and 3B+ in this repository. By little experimenting I found out the BCM43430A1.hcd is for 3B model while BCM4345C0.hcd is for 3B+ model. These files are not part of Arch Linux so it must be downloaded from this repository.

Now the question is how to load these into the chip without using hciattach. Because both chips are manufactured by Broadcom I searched in Arch Linux repository for packages which contains this name. The promising one is brcm-patchram-plus. After checking source code I believe this is exactly what I need. Last remaining piece of the puzzle is the baud rate. This script from official Raspbian GitHub states that baud rate is 921600 for 3B model and 3000000 for 3B+ model.

By fiddling with parameters I found out command to bring Bluetooth to life finally on 3B model.

brcm_patchram_plus --patchram BCM43430A1.hcd --enable_hci --no2bytes --tosleep=1000000 /dev/ttyAMA0 &

After another while I found out command for 3B+ model.

brcm_patchram_plus --patchram BCM4345C0.hcd --baudrate 3000000 --enable_hci --use_baudrate_for_download --no2bytes --tosleep=1000000 /dev/ttyAMA0 &

If you have Bluez installed you should now be able to power up Bluetooth adapter, scan for nearby devices and connect to them using bluetoothctl.

The last thing to solve is how to run this command automatically. I use systemd service to achieve this. The mine loks like this for 3B+ model.

[Unit]
Description=Attach Bluetooth Adapter

[Service]
Type=simple
ExecStart=/usr/bin/brcm_patchram_plus --patchram /lib/firmware/brcm/BCM4345C0.hcd --baudrate 3000000 --enable_hci --use_baudrate_for_download --no2bytes --tosleep=1000000 /dev/ttyAMA0
ExecStop=/usr/bin/killall brcm_patchram_plus

[Install]
WantedBy=multi-user.target

I hope you found this article useful. I tried to explain my solution rather than just yield the result.

Leave a Comment

All fields are required. Your email address will not be published.