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 Peter

    In the ble_app_hrs example project, you can see that the delete_bonds(); function is called in advertising_start()  if the erase_bonds bool is set as it is by default. So upon a power reset the device will erase bonding information when it starts advertising which is why you see this issue on your end I think. 

    Best regards,

    Simon

Reply
  • Hi Peter

    In the ble_app_hrs example project, you can see that the delete_bonds(); function is called in advertising_start()  if the erase_bonds bool is set as it is by default. So upon a power reset the device will erase bonding information when it starts advertising which is why you see this issue on your end I think. 

    Best regards,

    Simon

Children
Related