Bluetooth Le on Raspbian

Bluetooth LE on Raspbian

First off, I spoke with a colleague about my configuration and for Raspbian (or more specifically, Debian) he recommended the following configuration settings:

./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var --enable-library --with-systemdsystemunitdir=/lib/systemd/system --with-systemduserunitdir=/usr/lib/systemd

Afterward, upon further inspection, here is how I was able to successfully connect. So what was happening was that the device I was trying to connect to (an NRF-based BLE device) required the LE address flag to be set to 'random'. See below:

gatttool -t random -b EA:FB:B5:CE:B0:13 -I

Then the result:

[EA:FB:B5:CE:B0:13][LE]> connect
Attempting to connect to EA:FB:B5:CE:B0:13
Connection successful
[EA:FB:B5:CE:B0:13][LE]> characteristics
handle: 0x0002, char properties: 0x0a, char value handle: 0x0003, uuid: 00002a00
-0000-1000-8000-00805f9b34fb

Huzzah! Also, there may be a need to set the security level to something lower than high:

[EA:FB:B5:CE:B0:13][LE]> sec-level medium

Bluetooth LE on Raspbian does not bond with nRF

To any lost souls who might have also been stuck in this situation, here is how I solved it (you need to run sudo for the following commands):

$ service bluetooth stop

$ /etc/init.d/bluetooth start

If the nRF device has been paired once and then restarted, that means the pairing key is still on Pi's side which needs to be removed and can be done by:

$ bluetoothctl
$ remove XX:XX:XX:XX:XX:XX
$ exit

After this you need to start bluetooth device:

$ hciconfig hci0 up

Bluetooth connection failed from Raspberry Pi at LE Read Remote Used Features

It seems like for some reason your Bluetooth mode was set to bredr, and because your device is a BLE device that does not support Bluetooth Classic -> BR/EDR Not Supported, you were not able to connect. Thus, setting it to dual does the trick. You can set it to dual mode via editing etc/bluetooth/main.conf. I would expect a same behaviour, if you set it to le as well.

# Restricts all controllers to the specified transport. Default value
# is "dual", i.e. both BR/EDR and LE enabled (when supported by the HW).
# Possible values: "dual", "bredr", "le"
ControllerMode = dual

Cannot connect to BLE device on Raspberry Pi

I had to disable the plugin pnat in /etc/bluetooth/main.conf -> DisablePlugins=pnat. I read that it's unstable, but I don't know much about this plugin.



Related Topics



Leave a reply



Submit