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

Peer manager issue: bond, rank & delete

Hi, I'm using SDK15.3 on a NRF52840 chip and have some questions wrt to the peer manager and its ranking system. Once we bond with a peer, we print the full list of peers using:

void PrintBondList()
{
    pm_peer_id_t currentPeerId = pm_next_peer_id_get(PM_PEER_ID_INVALID);
    uint8_t i = 1;
    while (currentPeerId != PM_PEER_ID_INVALID)
    {
        pm_peer_data_bonding_t peerData;
        pm_peer_data_bonding_load(currentPeerId, &peerData);

        uint32_t rank;
        uint16_t rankLenght = sizeof(rank);
        pm_peer_data_load(currentPeerId, PM_PEER_DATA_ID_PEER_RANK, &rank, &rankLenght);

        // Print mac address and rank here.

        currentPeerId = pm_next_peer_id_get(currentPeerId);
    }
}

Each time, we get a new device to be bonded, we rank this peer ID as highest in the event coming from the peer manager:

case PM_EVT_PEER_DATA_UPDATE_SUCCEEDED:
{
    if ( event.params.peer_data_update_succeeded.action == PM_PEER_DATA_OP_UPDATE &&
         event.params.peer_data_update_succeeded.data_id == PM_PEER_DATA_ID_BONDING)
        {
            ret_code_t result = pm_peer_rank_highest(event.peer_id);
            assert(result == NRF_SUCCESS);
        }
}

When we execute the following scenario:

- Bond with peer

- Disconnect

- Print list of peers - this gives us a total of one bond with rank '1'

- Delete all peers using pm_peers_delete

- Bond with SAME peer

- Disconnect

- Print list of peers - this shows a single peer but the rank is a unexpected number (e.g. 537132104). Once we trigger a system reset, the peer address (mac address) is still OK, but the rank is changed. 

Is there anything we miss here, or are we facing an issue in the SDK?

Parents
  • Hi,

    It seems to be correct the way you do it. Have you tried bond with another peer after you delete all peers? Does the same issue occur? Does it only happen when you bond with the same peer after deleting?

    Does pm_peers_delete return success?

  • Hello, i am answering on behalf of my colleague Roy,

    It happens with any peer, not necessarily the same. We observe that the very first peer to bond after deleting all the bonds is assigned with rank with an unexpected value. If we restart the device after deleting all the bonds and then bond with a peer, then we don't observe the issue.

    pm_peers_delete returns success and after that we see the following SDK logs(for 2 bonds):

    NRF_LOG: <info> peer_manager_handler: Peer deleted successfully: peer_id: 0

    NRF_LOG: <info> peer_manager_handler: Peer deleted successfully: peer_id: 1

    NRF_LOG: <info> peer_manager_handler: All peers deleted.

    NRF_LOG: <info> peer_manager_handler: Peer deleted successfully: peer_id: 1

Reply
  • Hello, i am answering on behalf of my colleague Roy,

    It happens with any peer, not necessarily the same. We observe that the very first peer to bond after deleting all the bonds is assigned with rank with an unexpected value. If we restart the device after deleting all the bonds and then bond with a peer, then we don't observe the issue.

    pm_peers_delete returns success and after that we see the following SDK logs(for 2 bonds):

    NRF_LOG: <info> peer_manager_handler: Peer deleted successfully: peer_id: 0

    NRF_LOG: <info> peer_manager_handler: Peer deleted successfully: peer_id: 1

    NRF_LOG: <info> peer_manager_handler: All peers deleted.

    NRF_LOG: <info> peer_manager_handler: Peer deleted successfully: peer_id: 1

Children
No Data
Related