0

I have an Rpi3 and I want to bond it with nRF which is connected to my laptop via UART. This nRF-laptop connection shows me whether Rpi3 is connected and/or paired with nRF. I am able to connect to the nRF device by running:

    gatttool -t random -b XX:XX:XX:XX:XX:XX -I

I found that to be able to pair it, all I need to do is run the following command after I connected using gattool:

    sec-level medium

However, nRF device only showed "Connected".

Then I tried using bluetoothctl command. I made sure the power is on, agent is on, it's discoverable and etc. After I ran the command pair XX:XX:XX:XX:XX:XX, it said it was successful. This was also confirmed after running info XX:XX:XX:XX:XX:XX. Yet nRF device did not react to the pairing. If I connect to nRF device through my phone using "nRF Connect" app, then nRF shows that my phone is paired.

I am running:

Linux 4.9.13-v7+ #974 SMP Wed Mar 1 20:09:48 GMT 2017 armv7l GNU/Linux
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
Bluez-5.44

I followed tutorials from adafruit and stackoverflow. I read that for Bluez-5.44 I do not need to run bluetooth in the experimental mode.

What am I missing? I would appreciate any help.

Community
  • 1
  • 1
Gabriele
  • 737
  • 2
  • 8
  • 20

1 Answers1

2

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
Gabriele
  • 737
  • 2
  • 8
  • 20