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 Reply Children
No Data
Related