Hi,
I am using SDK13 and have noticed some critical issue with peer manager while bonding. The problem is that after performing dfu of my device (which was bonded with two phones before update) when I try to connect to device with first bonded device everything goes ok, but when I try to connect with the second phone device reset due to catching error inside pm_evt_handlerpm_evt_handler(...)
{
...
case PM_EVT_PEER_DATA_UPDATE_FAILED:
{
APP_ERROR_CHECK(p_evt->params.peer_data_update_failed.error);
}
...
}
This error is caused by fds which try to find record with function:
peer_data_find(...)
{
...
ret = fds_record_find(file_id, record_key, p_desc, &ftok);
if (ret != FDS_SUCCESS)
{
return NRF_ERROR_NOT_FOUND; <--- CALLED ERROR
}
...
}
After my analysis error is caused by trying to find record which was recently invalidated (fds record keys overwritten with 0x0000). This error reproduce each time following steps below:
- Program device with FW (bootloader + application) over JLink
- In application perform bonding procedure for 2 phones (1st one HUAWEI HONOR 5X, 2nd Xiaomi Redmi Note 4)
- Enter bootloader and perform application dfu (same application as in 1st step)
- After DFU in application perform connection of 1st phone -> works perfectly
- Perform connection with 2nd phone -> cause error in code shown abowe.
After spending some time with that problem I suggest that it is caused by some race condition in updating peer manager bonding records.
What shall I do to prevent situation because it cause brick of all of my production devices?