This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

One device (central or peripheral) deletes bonding. How to repairing again?

Hi Sir/Miss,

I use nRF52832-QFAB

SDK 17.0.2

SoftDevice s112

nRF connect APP

I limit max bonding as 5 PCS central device.

There are two conditions. 

Central device deletes bonding, but peripheral not. When they re-connect, central device displays disconnect.

I add below code in pm_evt_handler of main.c

case PM_EVT_CONN_SEC_CONFIG_REQ:

    {
        pm_conn_sec_config_t conn_sec_config = {.allow_repairing = true};

        pm_conn_sec_config_reply(p_evt->conn_handle, &conn_sec_config);

    } break;

It can repairing and bonding. My question is which will peripheral device storage new peers?

If yes, should I add whitelist or find same peers to avoid storing duplicated peer?

Another condition, when max limitation is reached, peripheral will delete oldest one.

But, that oldest one wants to connect again. I refer this link to do this and try to add below code in pm_evt_handler

case PM_EVT_CONN_SEC_FAILED:

    {
        if (p_evt->params.conn_sec_failed.procedure == PM_LINK_SECURED_PROCEDURE_ENCRYPTION &&
            p_evt->params.conn_sec_failed.error == PM_CONN_SEC_ERROR_PIN_OR_KEY_MISSING)
        {


        }
        else
        {
            (void)sd_ble_gap_disconnect(p_evt->conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
        }
   } break;

I found out when they connect, nRF connect display connecting. Peripheral device doesn't force repairing or bonding. And, I see that FW always enters this code.

Please help.

Thank you.

Parents
  • Hi,

    It can repairing and bonding. My question is which will peripheral device storage new peers?

    If yes, should I add whitelist or find same peers to avoid storing duplicated peer?

    When you do re-pairing the peer manager overwrites the existing bonding information, so there is no risk of duplication.

    Another condition, when max limitation is reached, peripheral will delete oldest one.

    In this case, the bond is lost on the nRF but not on the phone. So there is no re-pairing seen from the nRF, only from the phone side. And phones (at least iOS or Android) never allows re-pairing. So to recover from this situation you need to delete the bond also on the phone side, and then try to pair/bond again.

Reply
  • Hi,

    It can repairing and bonding. My question is which will peripheral device storage new peers?

    If yes, should I add whitelist or find same peers to avoid storing duplicated peer?

    When you do re-pairing the peer manager overwrites the existing bonding information, so there is no risk of duplication.

    Another condition, when max limitation is reached, peripheral will delete oldest one.

    In this case, the bond is lost on the nRF but not on the phone. So there is no re-pairing seen from the nRF, only from the phone side. And phones (at least iOS or Android) never allows re-pairing. So to recover from this situation you need to delete the bond also on the phone side, and then try to pair/bond again.

Children
Related