Intermittent Peer Manager Error 4102 on nRF52833 (nRF5 SDK)

Hi,

I am using two nRF52833 devices with the nRF5 SDK. They are paired and bonded to each other. Occasionally, I encounter the following error in peer_manager_handler:

Connection security failed: role: Peripheral, conn_handle: 0x0, procedure: Encryption, error: 4102

From my understanding, error 4102 indicates a bonding mismatch — i.e., the stored bonding information on the two sides is inconsistent.

However, the issue can be resolved simply by power-cycling both nRF52833 devices. After restart, the connection and encryption work normally.

Why does error 4102 occur intermittently, and why does a power cycle fix it? Could this be related to improper handling of bonding recovery, flash corruption, or connection context cleanup in the Peer Manager?

Thank you.

Parents
  • Hello,

    As I know, Error 4102 (BLE_GAP_SEC_STATUS_PIN_OR_KEY_MISSING) means the device trying to start encryption cannot find a matching bonding key for the connection. If it only happens intermittently and a power cycle fixes it, the most likely cause is a temporary state mismatch in the SoftDevice/Peer Manager (e.g., stale connection context, incomplete bonding update, or pending FDS operation), rather than permanent flash corruption. Check that all Peer Manager and FDS operations complete successfully, handle PM_EVT_CONN_SEC_FAILED properly, and avoid reconnecting or rebonding while bond-related operations are still in progress.

Reply
  • Hello,

    As I know, Error 4102 (BLE_GAP_SEC_STATUS_PIN_OR_KEY_MISSING) means the device trying to start encryption cannot find a matching bonding key for the connection. If it only happens intermittently and a power cycle fixes it, the most likely cause is a temporary state mismatch in the SoftDevice/Peer Manager (e.g., stale connection context, incomplete bonding update, or pending FDS operation), rather than permanent flash corruption. Check that all Peer Manager and FDS operations complete successfully, handle PM_EVT_CONN_SEC_FAILED properly, and avoid reconnecting or rebonding while bond-related operations are still in progress.

Children
No Data
Related