Jump to content

no bluetooth on rpi4


DownUnder

Recommended Posts

im on a fresh install of armbian cinnamon for the rpi4. i can not seem to get bluetooth working. there seems to be no bluetooth module loaded by kernel maybe? i tried to enable it using armbian-config, but it doesn't get activated by systemctl even when enabled. any ideas?

Link to comment
Share on other sites

On 3/23/2023 at 11:41 PM, DownUnder said:

thanks for getting back at me. here is the url with the resulting log

 

[    9.384292] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[    9.387030] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43455-sdio.raspberrypi,4-model-b.bin failed with error -2
[    9.411294] usbcore: registered new interface driver brcmfmac

 

If firmware was up-streamed, then

apt install armbian-firmware-full 

 

+ reboot will do. If not, you will need to find those files and install them on hand.

Link to comment
Share on other sites

I'm running into the same issue on my rpi4b (jammy gnome version), same messages in dmesg as DownUnder has, and no hci shown by `hciconfig` (so I assume the problem is indeed kernel-level).

 

 - Installing `armbian-firmware-full` does not help. It contains files named like the requested firmware, but .txt instead of .bin (which I guess might *also* be needed). These txt files are symlinks (which again link to other files):

 

$ ls -l /lib/firmware/brcm/*raspberrypi,4-model-b*
lrwxrwxrwx 1 root root   22 Jul 28  2022 /lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,4-model-b.txt -> brcmfmac43455-sdio.txt
-rw-rw-r-- 1 root root 1883 Feb 17 23:23 /lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,4-model-b.txt.distrib
lrwxrwxrwx 1 root root   22 Jul 28  2022 /lib/firmware/brcm/brcmfmac43456-sdio.raspberrypi,4-model-b.txt -> brcmfmac43456-sdio.txt

 

- I found this thread where someone (for the rpi3) suggests adding rpi symlinks to the generic files, which I adapted for rpi4:

sudo ln -s ../cypress/cyfmac43455-sdio.clm_blob brcmfmac43455-sdio.raspberrypi,4-model-b.clm_blob

sudo ln -s ../cypress/cyfmac43455-sdio.bin brcmfmac43455-sdio.raspberrypi,4-model-b.bin

 

This fixes the error in dmesg, but hciconfig still shows nothing.

 

$ sudo dmesg|grep brcm
[    1.427393] brcm-pcie fd500000.pcie: host bridge /scb/pcie@7d500000 ranges:
[    1.427443] brcm-pcie fd500000.pcie:   No bus range found for /scb/pcie@7d500000, using [bus 00-ff]
[    1.427529] brcm-pcie fd500000.pcie:      MEM 0x0600000000..0x063fffffff -> 0x00c0000000
[    1.427621] brcm-pcie fd500000.pcie:   IB MEM 0x0000000000..0x007fffffff -> 0x0400000000
[    1.492518] brcm-pcie fd500000.pcie: link up, 5.0 GT/s PCIe x1 (SSC)
[    1.492963] brcm-pcie fd500000.pcie: PCI host bridge to bus 0000:00
[    8.509484] brcmfmac: F1 signature read @0x18000000=0x15264345
[    8.530822] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[    8.538523] usbcore: registered new interface driver brcmfmac
[    8.815847] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[    8.823298] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Nov  1 2021 00:37:25 version 7.45.241 (1a2f2fa CY) FWID 01-703fd60

 

- I found this post that suggests you need to run hciattach to set things up (I suspect the bluetooth adapter might be attached to serial and this creates a hci device talking to that serial?). I haven't tried this yet, though.

 

To be continued, but I gotta run now, so this post is a bit rough, sorry for that.

Edited by Matthijs Kooijman
Fix formatting, add link about hciattach
Link to comment
Share on other sites

Turns out running hciattach works:

 

$ sudo hciattach /dev/ttyAMA0 bcm43xx
[sudo] password for matthijs: 
bcm43xx_init
Flash firmware /lib/firmware/brcm/BCM4345C0_003.001.025.0162.0000_Generic_UART_37_4MHz_wlbga_ref_iLNA_iTR_eLG.hcd
Set Controller UART speed to 3000000 bit/s
Device setup complete
$ sudo hciconfig 
hci0:    Type: Primary  Bus: UART
    BD Address: E4:5F:01:3D:8E:21  ACL MTU: 1021:8  SCO MTU: 64:1
    UP RUNNING 
    RX bytes:928 acl:0 sco:0 events:69 errors:0
    TX bytes:5491 acl:0 sco:0 commands:69 errors:0

After that, I can connect to my bluetooth keyboard using gnome settings as normal.

 

What I did:

 - Install bluetooth with armbian-config

 - Install armbian-firmware-full

 - Create firmware symlinks

 - Run the hciattach command

 

I'm not sure if all of these are really needed, I'll try with a clean image to be sure.

 

If I can find the time, I'll also see if we can make this work out of the box somehow, by running the hciconfig command at startup (this pullrequest for sunxi adds a systemd service for this, I was thinking of a udev rule maybe). I also found this pullrequest for sunxi which makes some kernel modules builtin and then claims hciattach is not needed at all. Maybe also see how Raspbian does this...

Edited by Matthijs Kooijman
Link to comment
Share on other sites

Is the pi-bluetooth package installed?

 

The package its self is just a set of scripts, rules and services: https://github.com/RPi-Distro/pi-bluetooth

https://packages.ubuntu.com/jammy/pi-bluetooth

 

Interestingly enough, this isn't required when using a mainline kernel. But that's a topic for another day.

Edited by c0rnelius
Link to comment
Share on other sites

I suspect I do not have this package - it does seem like that package would indeed work, since it calls hciattach using this service and this script. I had seen mention of this package before, but I suspected it was something specific to Raspbian, or maybe Ubuntu itself, hadn't realized it would be available on armbian as well. I'll test to see if installing it helps and if so, we should probably install it by default (in the image, or in the armbian-config bluetooth set of packages maybe).

 

6 hours ago, Matthijs Kooijman said:

I also found this pullrequest for sunxi which makes some kernel modules builtin and then claims hciattach is not needed at all.

I checked the kernel config, and the rpi image (bcm2711) already has those modules builtin, so that apparently does not work here (maybe that's a mainline feature to automatically do the hciattach, as you mention it does work automatically on mainline apparently).

Edited by Matthijs Kooijman
Link to comment
Share on other sites

Although it was initially for use on Raspbian it works on Debian, Devuan and Ubuntu all the same. So it should work fine on Armbian.

 

There is also Bluez hack that the Foundation and Ubuntu use to make sure the firmware is found and loaded during boot, but this can be avoided by simply creating a symlink `ln -s /lib/firmware /etc/firmware`.

Edited by c0rnelius
Link to comment
Share on other sites

I just tested a clean image, installed just `pi-bluetooth` and everything worked right way (hciconfig shows a bluetooth adapter and I can pair devices using gnome-settings right away).


In particular, I do not need armbian-firmware-full, nor the firmware symlinks I discussed above. On closer inspection, I suspect that the firmware error message that we were seeing was just a first attempt at loading a raspberrypi4-specific firmware, but it already falls back to a generic firmware. In particular, looking at the OP's dmesg output (which matches my own), I see the following lines (unrelated lines were snipped):

 

[    9.387030] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43455-sdio.raspberrypi,4-model-b.bin failed with error -2
[    9.658798] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[    9.658998] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[    9.679093] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Nov  1 2021 00:37:25 version 7.45.241 (1a2f2fa CY) FWID 01-703fd60

 

I think this means it first tries brcm/brcmfmac43455-sdio.raspberrypi,4-model-b.bin, that fails, then it tries brcm/brcmfmac43455-sdio which succeeds.

 

Also, I did not need to install bluetooth packages using armbian-config (those probably add support for other bluetooth stuff, basic keyboard and mouse already worked).

 

Concluding: Installing `pi-bluetooth` is enough to make bluetooth work in a pi4, so that should probably be installed by default in this image (it is also a tiny image).

Edited by Matthijs Kooijman
Link to comment
Share on other sites

Absolutely. This has nothing to do with bluetooth.

Quote

brcm/brcmfmac43455-sdio.raspberrypi,4-model-b.bin failed with error -2

 

It's related to wifi and the error can be seen on all modern linux kernels. Creating a symlink will make it go away.

Quote

ln -s brcmfmac43455-sdio.bin brcmfmac43455-sdio.raspberrypi,4-model-b.bin

With that said, the error doesn't break anything and it's just telling you the file is missing.

Edited by c0rnelius
Link to comment
Share on other sites

Quote

Absolutely. This has nothing to do with bluetooth.

 

Right, then the suggestion about this error earlier in the thread was incorrect. I had seen it was wifi-related, but had assumed the same radio is used for wifi and bluetooth, so thought the error might have been related (though I suspected it was just a warning and a second firmware load would succeed, but mentions of it online were a bit confusing). Anyway, thanks for confirming!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines