This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BLE passkey connection

Hello,

Currently working with Segger 4.42 and SDK 15.0

I've searched around the devzone on doing a passkey connection between my server and central.

I've used the ble_app_gls as an example since most people use this regarding passkey connection.

The problem I'm currently facing is getting the app to work :/

In the beginning when I first compiled and tested I could connect with my phone but because I was stupid and forgot the RTT logging I disconnected, turned it on and recompiled.

This time I could actually see the key I needed to enter for the connection to be established.

After this I searched for a way to add a static key as I am unable to make device A read the serial port of device B in order to get the key.

I've found the following code: 

uint8_t passkey[] = "123456";
ble_opt_t ble_opt;
ble_opt.gap_opt.passkey.p_passkey = &passkey[0];
(void) sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &ble_opt);

This code was added in the gap_params_init() file, I tested it and it failed to make a secured connection. 

All right, I remove the code, upload it again and tested it with a random generated key.

Guess what, <info> app: Failed to secure connection. Disconnecting.

I even re downloaded the SDK and tried it again but it still failed to secure the connection.

What did I do wrong and how do I get it working with a static key?

Parents
  • Have you made sure to do a full flash erase of the DK, as this seems like the behavior of a DK with stored bonding information of a device that doesn't remember it. You can do a full erase by calling nrfjprog --eraseall for example. 

    Would the phone you have, by chance, be the Nokia 8.1. In that case, have one here on my end, so if you could upload your project I can test it here on my side and see if I'm able to reproduce/fix it. This is an alternative if erasing the DK flash doesn't help.

    Best regards,

    Simon

Reply
  • Have you made sure to do a full flash erase of the DK, as this seems like the behavior of a DK with stored bonding information of a device that doesn't remember it. You can do a full erase by calling nrfjprog --eraseall for example. 

    Would the phone you have, by chance, be the Nokia 8.1. In that case, have one here on my end, so if you could upload your project I can test it here on my side and see if I'm able to reproduce/fix it. This is an alternative if erasing the DK flash doesn't help.

    Best regards,

    Simon

Children
  • Well,it happens to be that I have a Nokia 8.1 as well, but I made a discovery...

    When using the nRFConnect app:
    First time connection equals to success, disconnecting and reconnecting are no issue except when I delete bonding information. Then there is no way for me to reconnect to the device without erasing everything.

    When using standard Bluetooth from my phone:

    I can connect, disconnect, delete bonding as much as I want and there is no problem. It all works flawlessly.

    I'm currently still working on the client side to get it up and running, I'm just struggling a bit with the conversion from SDK15.2 in the example you handed over to SDK 15 which I'm using.

Related