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

How can I update my passkey using sd_ble_opt_set() on runtime

Hello everyone, I successfully implemented the static key to access a characteristic now I want the user to udpate the passkey through another characteristic (which is also protected).

I successfully read the value of the passkey entered by the user (through mobile phone app) but unable to find a way how to update the BLE_GAP_OPT_PASSKEY.

What I am currently doing is that I am using sd_ble_opt_set() with updated passkey in the BLE_GAP_EVT_DISCONNECTED event. Which means I am trying to update the passkey whenever the client is disconnected from the server.

But the problem is that whenever the client disconnects from server, my nRF DK52 hangs and all 4 LEDs lit up. No advertisement nothing. I require to restart the program.

I am building my app by doing modification on "ble_tutorial_characteristic"

Can anyone help me how to update the passkey during the program. Thanks

Related