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

Problems interpreting a passkey failure

Hi!

My BLE peripheral needs to change its "static" passkey under certain circumstance.

However, when I attempt to connect after setting it, I get a PM_CONN_SEC_ERROR_PIN_OR_KEY_MISSING failure.

Here is the code fragment from update_advertising (start_advertising does this also.)

ble_opt_t m_static_pin_option;

NRF_LOG_INFO("update_advertising");

if(Current_Mode_Pairing_Passkey != 0)
{
sprintf(passkey,"%06d",Current_Mode_Pairing_Passkey);
}

m_static_pin_option.gap_opt.passkey.p_passkey = &passkey[0];

NRF_LOG_INFO("Passkey in use at update_advertising: %s ",m_static_pin_option.gap_opt.passkey.p_passkey);

err_code = sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &m_static_pin_option);
APP_ERROR_CHECK(err_code);

The key in the log message matches what I expect, and there is nowhere else that I call sd_ble_opt_set with the BLE_GAP_OPT_PASSKEY parameter.

Very baffled.

 

I know you guys are on holiday, and I am grateful for any attention you can give this.

-Ben Burch

BTR Controls, Inc.

Parents
  • Hi Ben

    The description of PM_CONN_SEC_ERROR_PIN_OR_KEY_MISSING states: "Encryption failed because the peripheral has lost the LTK for this bond". It's most likely that the phone was bonded with this device prior to the connection, but that the device has erased the bonding information, meaning that they are using different passkeys. Please try erasing bonding information on both devices and try again. On the nRF side, this can be done by doing an nrfjprog --eraseall in the command line if the device is connected to your computer via a J-Link device.

    Best regards,

    Simon

Reply
  • Hi Ben

    The description of PM_CONN_SEC_ERROR_PIN_OR_KEY_MISSING states: "Encryption failed because the peripheral has lost the LTK for this bond". It's most likely that the phone was bonded with this device prior to the connection, but that the device has erased the bonding information, meaning that they are using different passkeys. Please try erasing bonding information on both devices and try again. On the nRF side, this can be done by doing an nrfjprog --eraseall in the command line if the device is connected to your computer via a J-Link device.

    Best regards,

    Simon

Children
No Data
Related