I am developing a Central/Peripheral application with SDK 15.2.0 for s132 device on nRF52 development kits. I switch back and forth between my application and the example "ble_app_hrs_rscs_relay" on my nRF52 development boards. In doing so, eventually my nRF52 development boards will throw the error PM_EVT_CONN_SEC_FAILED when running on my application firmware and connecting to a peripheral device. I can never get PM_EVT_CONN_SEC_SUCCEEDED again on this nRF52 development board operating as a Central and Peripheral. When I put my application firmware on a new nRF52 DK, it runs fine and gets PM_EVT_CONN_SEC_SUCCEEDED every time it connects to a peripheral BLE device. This has happened to me with two nRF DKs and now I'm working with a 3rd, but I have not cycled between the "ble_app_hrs_rscs_relay" and my application firmware. I have only been programming it with my application firmware and it has been running fine. I have tried "erase all" on the problem DKs and this didn't help.
Are you able to reproduce the error? If so, take a look at the log in pm_handler_pm_evt_log(..) (In the peer_manager_handler.c) and check which procedure failed (pm_conn_sec_procedure_t) and the error code (pm_sec_error_code_t).
<info> peer_manager_handler: Connection security failed: role: Central, conn_handle: 0x0, procedure: Bonding, error: 133
Is this what you asked for?
What command did you run in order to erase the content of the chip, did you use nrfjprog --eraseall?
I'm using Segger Embedded Studio and used Target -> Erase All from the menu.
After bonding, the bonding information is stored in flash, and my suspicion is that this data prevents you from bonding again somehow. But, this should get resolved by erasing all the content of the chip.
I haven't been able to get a full grasp of your problem, and need some more time.
I'll be gone for some days due to easter break, but will be back the 23.04 and will look further into your issue then.