Close

Getting a BLE USB dongle to work on Raspbian

A project log for Pi Chart

A wireless nautical chart plotter based on a Raspberry Pi and a sunlight readable screen.

Erland LewinErland Lewin 03/21/2016 at 18:182 Comments

I bought a small USB Bluetooth dongle (Asus USB-BT400) for the Raspberry Pi Zero. I thought I'd try it out instead of the nRF51822 Core board.

I'll follow the instructions here to install the Bluetooth software. I downloaded Bluez version 5.38 which appears to be the latest.

However, while building it, I found a web page that said I could:

sudo apt-get install bluetooth blueman bluez

I'll try to use those while I build the latest Bluez version. Unfortunately it seems to pull in a bunch of xwindows stuff that I don't need. Maybe I should have skipped blueman?

I found this page, which told me to try:

sudo su -
modprobe -v btusb
echo "0b05 17cb" >> /sys/bus/usb/drivers/btusb/new_id

but 'hcitool -scan' still doesn't return anything.

In the system log, I found:

bluetooth hci0: Direct firmware load for brcm/BCM20702A1-0b05-17cb.hcd failed with error -2

I found a page about how to get the file via the Windows driver; I'll look for a simpler way.

I found a comment here, that I could do:

sudo apt-get install firmware-linux-nonfree

I removed and re-inserted the dongle, but now got some kernel errors like:

kernel: [ 3910.964136] Transfer to device 5 endpoint 0x1 frame 666 failed - FIQ reported NYET. Data may have been lost.

Added "dwc_otg.fiq_fsm_mask=0xF" to /boot/cmdline.txt following a comment here. Rebooted.

I can now do 'sudo hcitool -lescan' and see my Wireless Navigation Sensor!

Can you believe people say Linux is hard to use?

Update

And I thought the above was sufficient for things to start working, but no.

After hours of searching, I changed /etc/bluetooth/main.conf and added:

EnableLE = true           // Enable Low Energy support. Default is false.

AttributeServer = true    // Enable the GATT attribute server. Default is false.

This was critical, and hard to Google. Now I could also connect to my device:

pi@raspberrypi:/etc/init.d $ sudo hcitool lescan
LE Scan ...

F4:8C:27:CA:16:7E Wireless_LNS

F4:8C:27:CA:16:7E (unknown)

pi@raspberrypi:/etc/init.d $ sudo gatttool -b F4:8C:27:CA:16:7E -I -t random

[F4:8C:27:CA:16:7E][LE]> sec-level low
[F4:8C:27:CA:16:7E][LE]> connect

Attempting to connect to F4:8C:27:CA:16:7E

Connection successful

[F4:8C:27:CA:16:7E][LE]> primary

attr handle: 0x0001, end grp handle: 0x0007 uuid: 00001800-0000-1000-8000-00805f9b34fb

...

Discussions

Arsenijs wrote 03/25/2016 at 00:50 point

Hello! Thank you for the writeup! I'll be writing a simple Bluetooth app for #pyLCS - Linux Control System tomorrow, this is indispensable knowledge =) AFAIK, there also was a bluez-firmware or firmware-bluez package, which worked for me when other didn't.

  Are you sure? yes | no

Erland Lewin wrote 03/25/2016 at 15:26 point

Glad to be of help!

  Are you sure? yes | no