https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&user=Joneskoo&feedformat=atomAlpine Linux - User contributions [en]2024-03-29T05:41:06ZUser contributionsMediaWiki 1.40.0https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_3_-_Setting_Up_Bluetooth&diff=16235Raspberry Pi 3 - Setting Up Bluetooth2019-08-20T19:13:10Z<p>Joneskoo: Update Bluetooth instructions to use btattach and to reference Zero W model too.</p>
<hr />
<div>The Raspberry Pi Bluetooth chip varies by model.<br />
<br />
* Raspberry Pi 3 has BCM2837 connected to the hardware UART<br />
* Raspberry Pi 3B+ has BCM4345C0 connected to the hardware UART<br />
* Raspberry Pi Zero W has BCM43430A1 connected to the hardware UART<br />
<br />
You can get Bluetooth to work only if you are not using the UART (ttyAMA0) for anything else, for example serial console.<br />
Recent versions of Alpine Linux for Raspberry Pi come with the required Broadcom firmware files.<br />
If you need the UART for something else, you can use an USB Bluetooth adapter instead.<br />
<br />
You'll need the bluez package<br />
<br />
{{cmd|apk add bluez}}<br />
<br />
The Bluetooth controller is not automatically discovered on the UART. Test attaching it and check that the controller is found<br />
<br />
{{cmd|btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &}}<br />
<br />
{{cmd|/etc/init.d/bluetooth start}}<br />
<br />
{{cmd|<nowiki>bluetoothctl list<br />
Controller B8:27:EB:01:02:03 BlueZ 5.50 [default]<br />
</nowiki>}}<br />
<br />
If the interface is discovered after the attach, you can make attaching persistent by uncommenting<br />
the line next to "rpi bluetooth" in ''/etc/mdev.conf''<br />
<br />
Start the bluetooth deamon at boot. This should load the right modules when you next reboot.<br />
<br />
{{cmd|rc-update add bluetooth}}<br />
<br />
{{cmd|lbu commit && reboot}}<br />
<br />
<br />
The output from the btattach above should be<br />
<br />
{{cmd|Attaching Primary controller to /dev/ttyAMA0<br />
Switched line discipline from 0 to 15<br />
Device index 0 attached<br />
}}<br />
<br />
Then it's a matter of doing what you normally do with your Bluetooth stack.<br />
<br />
[[Category:Installation]]</div>Joneskoo