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:
pm_peer_id_t currentPeerId = pm_next_peer_id_get(PM_PEER_ID_INVALID);
uint8_t i = 1;
while (currentPeerId != PM_PEER_ID_INVALID)
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:
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
- 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
- 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?
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?
Could you check the return value of pm_peer_data_load()?
It seems to be a bug. I have reported this and we are looking into it.