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

PEER saved event

Hello,

I am using NRF52840 with SDK 16. In my project I need to restart the chip after a successful pairing but I can't find any event that can make me sure about pairing being done and its data saved. I checked PM_EVT_CONN_SEC_SUCCEEDED and PM_EVT_PEER_DATA_UPDATE_SUCCEEDED however PM_EVT_CONN_SEC_SUCCEEDED happens before pairing data being saved and PM_EVT_PEER_DATA_UPDATE_SUCCEEDED happens many times during the procedure and I don't know if it's OK to restart the chip with this event.

So can you please tell me when can I be sure that the peer is saved successfully? is there another event in Peer manager that I can use or is there a way that I can know which PM_EVT_PEER_DATA_UPDATE_SUCCEEDED event indicates that the peer saving procedure is completed correctly ?

thank you

Parents Reply Children
  • Hi,

    You can see from the debug log which update events you get during a bonding procedure if you set the NRF_LOG_DEFAULT_LEVEL config option to '4' (Debug). Here's from the ble_app_hrs example:

    <info> app: BLE_GAP_EVT_AUTH_STATUS: status=0x0 bond=0x1 lv4: 0 kdist_own:0x3 kdist_peer:0x2
    <info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Bonding data, action: Update
    <info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Peer rank, action: Update
    <info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Local database, action: Update
    <info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Central address resolution, action: Update

    However, I'm not sure if the central address resolution is always going to come last. It may depend on the peer device. Would it be an option to use a timer,etc to delay the reset until a few seconds after the last PM update event?

  • I guess setting a timer is my only option since we don't know what event comes last.


    Thank you for your help

Related