case about nRF52840 ble_app_hrs Encryption, error: 4102

Hi,

1.How to resolve this error:

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

2.Test DK: PCA10056 3.0.0

Test SDK:nRF5 SDK\nRF5_SDK_17.1.0_ddde560\examples\ble_peripheral\ble_app_hrs\pca10056\s140\arm5_no_packs\ble_app_hrs_pca10056_s140.uvprojx

Test app: Android nRF Connect

3.Test steps:

1. Erase nRF52840

2. Programmer example hex : ble_app_hrs (log level DEBUG)

3. Use nRF Connect to the DK to pair and bind

4. Power off the DK

5. Tap the disconnect button in nRF Connect

6. Power on the DK

7. Click the Connect button in nRF Connect

8. View the serial port log. The error is as follows:

Test all logs

[16:57:16.722]收←◆<info> app_timer: RTC: initialized.
<debug> nrf_ble_lesc: Initialized nrf_crypto.
<debug> nrf_ble_lesc: Initialized nrf_ble_lesc.
<debug> nrf_ble_lesc: Generating ECC key pair
<info> app: Heart Rate Sensor example started.
<info> app: Erase bonds!
<info> peer_manager_handler: All peers deleted.
<info> app: Fast advertising.

[16:57:45.366]收←◆<debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.
<debug> nrf_ble_gatt: Updating data length to 251 on connection 0x0.
<info> app: Connected.

[16:57:45.508]收←◆<debug> nrf_ble_gatt: ATT MTU updated to 247 bytes on connection 0x0 (response).
<info> app: GATT ATT MTU on connection 0x0 changed to 247.

[16:57:45.708]收←◆<debug> nrf_ble_gatt: Data length updated to 27 on connection 0x0.
<debug> nrf_ble_gatt: max_rx_octets: 27
<debug> nrf_ble_gatt: max_tx_octets: 27
<debug> nrf_ble_gatt: max_rx_time: 328
<debug> nrf_ble_gatt: max_tx_time: 328

[16:57:47.447]收←◆<debug> app: BLE_GAP_EVT_SEC_PARAMS_REQUEST

[16:57:47.715]收←◆<debug> nrf_ble_lesc: BLE_GAP_EVT_LESC_DHKEY_REQUEST
<info> app: BLE_GAP_EVT_LESC_DHKEY_REQUEST
<info> nrf_ble_lesc: Calling sd_ble_gap_lesc_dhkey_reply on conn_handle: 0

[16:57:49.917]收←◆<info> peer_manager_handler: Connection secured: role: Peripheral, conn_handle: 0, procedure: Bonding
<debug> nrf_ble_lesc: Generating ECC key pair
<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

[16:57:50.248]收←◆<info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Central address resolution, action: Update

[16:58:00.806]收←◆<info> app_timer: RTC: initialized.
<debug> nrf_ble_lesc: Initialized nrf_crypto.
<debug> nrf_ble_lesc: Initialized nrf_ble_lesc.
<debug> nrf_ble_lesc: Generating ECC key pair
<info> app: Heart Rate Sensor example started.
<info> app: Erase bonds!
<error> peer_manager_handler: Peer deleted successfully: peer_id: 0
<info> peer_manager_handler: All peers deleted.
<info> app: Fast advertising.

[16:58:03.120]收←◆<debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.
<debug> nrf_ble_gatt: Updating data length to 251 on connection 0x0.
<info> app: Connected.

[16:58:03.348]收←◆<debug> nrf_ble_gatt: ATT MTU updated to 247 bytes on connection 0x0 (response).
<info> app: GATT ATT MTU on connection 0x0 changed to 247.

[16:58:03.548]收←◆<debug> nrf_ble_gatt: Data length updated to 27 on connection 0x0.
<debug> nrf_ble_gatt: max_rx_octets: 27
<debug> nrf_ble_gatt: max_tx_octets: 27
<debug> nrf_ble_gatt: max_rx_time: 328
<debug> nrf_ble_gatt: max_tx_time: 328

[16:58:03.707]收←◆<info> peer_manager_handler: Connection security failed: role: Peripheral, conn_handle: 0x0, procedure: Encryption, error: 4102
<warning> peer_manager_handler: Disconnecting conn_handle 0.
<info> app: Fast advertising.
<info> app: Disconnected, reason 22.

[16:58:16.249]收←◆<debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.
<debug> nrf_ble_gatt: Updating data length to 251 on connection 0x0.
<info> app: Connected.

[16:58:16.395]收←◆<debug> nrf_ble_gatt: ATT MTU updated to 247 bytes on connection 0x0 (response).
<info> app: GATT ATT MTU on connection 0x0 changed to 247.

[16:58:16.645]收←◆<debug> nrf_ble_gatt: Data length updated to 27 on connection 0x0.
<debug> nrf_ble_gatt: max_rx_octets: 27
<debug> nrf_ble_gatt: max_tx_octets: 27
<debug> nrf_ble_gatt: max_rx_time: 328
<debug> nrf_ble_gatt: max_tx_time: 328

[16:58:16.755]收←◆<info> peer_manager_handler: Connection security failed: role: Peripheral, conn_handle: 0x0, procedure: Encryption, error: 4102
<warning> peer_manager_handler: Disconnecting conn_handle 0.
<info> app: Fast advertising.
<info> app: Disconnected, reason 22.

[16:58:20.243]收←◆<debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.
<debug> nrf_ble_gatt: Updating data length to 251 on connection 0x0.
<info> app: Connected.

[16:58:20.371]收←◆<debug> nrf_ble_gatt: ATT MTU updated to 247 bytes on connection 0x0 (response).
<info> app: GATT ATT MTU on connection 0x0 changed to 247.

[16:58:20.572]收←◆<debug> nrf_ble_gatt: Data length updated to 27 on connection 0x0.
<debug> nrf_ble_gatt: max_rx_octets: 27
<debug> nrf_ble_gatt: max_tx_octets: 27
<debug> nrf_ble_gatt: max_rx_time: 328
<debug> nrf_ble_gatt: max_tx_time: 328

[16:58:20.746]收←◆<info> peer_manager_handler: Connection security failed: role: Peripheral, conn_handle: 0x0, procedure: Encryption, error: 4102
<warning> peer_manager_handler: Disconnecting conn_handle 0.
<info> app: Fast advertising.
<info> app: Disconnected, reason 22.

Test example

Thank you for all your assistance.
Kind regards,
Peter.Min

Parents
  • Hi

    Error message 0x4102 comes from one of the devices indicating that it already has stored bonding information on the other device, while the other does not. Either the nRF52840 or the phone has stored bonding information on the other device already, and you need to erase bonding information on that device to resolve this. On the nRF side you can do so by doing an nrfjprog --recover or --eraseall, and on the phone side (in the nRF Connect app) you must select the device in the "BONDED" tab and press "Delete bond information" for the device you're trying to bond to now.

    More details on this error message is discussed in this ticket:  peer_manager_handler: Connection security failed: role: Peripheral, conn_handle: 0x0, procedure: Encryption, error: 4102  

    Best regards,

    Simon

  • Hi Simonr,

    1. I know the method you provided can solve this problem.

    2. I provide a method for problem recurrence here.

    3. What I want to investigate is why the binding information is dropped here and whether it is a bug in the sdk.

    4. If this is not a bug in the sdk, how can the customer use the pairing and binding information to avoid interrupting the user's use?

    5.In the past, I have set up the program to allow repairing, but this is not a good experience for interrupted customers

    Thank you for all your assistance.
    Kind regards,
    Peter.Min

Reply
  • Hi Simonr,

    1. I know the method you provided can solve this problem.

    2. I provide a method for problem recurrence here.

    3. What I want to investigate is why the binding information is dropped here and whether it is a bug in the sdk.

    4. If this is not a bug in the sdk, how can the customer use the pairing and binding information to avoid interrupting the user's use?

    5.In the past, I have set up the program to allow repairing, but this is not a good experience for interrupted customers

    Thank you for all your assistance.
    Kind regards,
    Peter.Min

Children
No Data
Related