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

Update passkey after bonding

Hello,

I would like to know the best practices to update a passkey for bonding.

For the moment, I have a static passkey that I set during ble initialization and I can bond to my device with the default password "123456". I have a characteristic with MITM secure access to save a passkey. After bonding, I can set this characteristic.

I would like to take this value and then set a new passkey. During the initialisation I used this function sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &sOpt); to set my key.

My question is how update this key with the new value. I need to set the value after disconnect or I can do this during connexion. I test to recall the function sd_ble_opt_set with the new value but doesn't work.