Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

What is the right procedure to un-bond/unpair nRF52840 from host?

Hi, 

    I tried to erase the bound and start another pairing procedure without rebooting my device. I was not able to remove the bond correctly. The system hangs when I call pm_peers_delete(). The problem is right after I call this function, a PM_EVT_PEERS_DELETE_SUCCEEDED event is sent to event handler and another advertising is started. Down in ble_advertising_start(), when it calls sd_ble_gap_adv_set_configure(), the function returns NRF_ERROR_INVALID_STATE. What is the right procedure to remove the bond properly? Can I temporary shutdown BLE before erase bond and resume it after removal?

Thank you,

Min-Ching

Parents Reply
  • Hi Haakonsh:

        I found there is a advertising_start when event "PM_EVT_PEERS_DELETE_SUCCEEDED" is received. I have moved this from the code. I was able to get rid of "immediately reconnect" problem. Now, I was not able to restart another advertising after delete the previous pairing. 

        What I did for delete bond is 1. call sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION); 2. After disconnect call pm_peers_delete();

        After delete the bond, I manually trigger another advertising and I get error NRF_ERROR_INVALID_STATE when the code execute sd_ble_gap_adv_set_configure(&p_advertising->adv_handle, p_advertising->p_adv_data, &p_advertising->adv_params); in ble_advertising_start().

        I don't have any idea what is wrong here. Any suggestions?

    Thank you,

    Min-Ching

Children
Related