This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

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

SDK16.0

nRF52DK

HTS example

I got this error msg in the RTT log while running the example:

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

What shall I do to fix it?

Thanks,

  • Hello,

    Searching though this forum, it seems like most of these error messages with error code 0x4102 comes from one of the devices that already has stored bonding information, while the other one does not. 

    Can you please try to delete the flash entirely (you can use "nrfjprog -e"), and reprogram it, and then delete the bonding information on your other device. What sort of the device is your other device? And the device that print this error message, is that the central or the peripheral?

    If that doesn't work, please try to set the log level to debug by changing:

    #define NRF_LOG_DEFAULT_LEVEL 3

    to

    #define NRF_LOG_DEFAULT_LEVEL 4

    What does the log say then?

    Best regards,

    Edvin

  • There is NO other device connecting my DK. Maybe its the USB driver coz I keep receiving msgs says that the disk is not ejected properly. Anyway, I change the LOG LEVEL to 4 by changing sdk_config.h, and now I see nothing in the RTTClient. I don't know what's happened. You sure the level 4 work?

    Thanks,

  • Sorry my bad. Now I can see my log. bug there is only one debug info. I put it here: 

    <debug> nrf_ble_gq: Registering connection handle: 0x0000

    <info> app: Connected.

    <info> app: start timer here

    <info> app: pm_evt_handler, event id: 0x1

    <info> app: pm_evt_handler, event id: 0x3

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

    I don't see its helpful. Maybe as you said, its just because other device. Anyway it doesn't stop the mobile connect to the app.

    Thanks,

  • This event is coming after a BLE_GAP_EVT_CONNECTED event, right? Are you trying to connect to it?

    Regarding the LOG LEVEL 4, please check that app_timer_init() is called before log_init() in your main() function. I believe that there is a bug in some of the SDK examples from SDK16.0.0 that has this in the reverse order.

    Best regards,

    Edvin

  • From the log below: 

    <debug> nrf_ble_gq: Registering connection handle: 0x0000

    <info> app: Connected.

    <info> app: start timer here

    <info> app: pm_evt_handler, event id: 0x1

    <info> app: pm_evt_handler, event id: 0x3

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

    <info> app: ble_cube_on_ble_evt, evt: 0x14

    We can see that the error happened after the ble connected. When the p_evt ->evt_id is 0x3, it reported this error.

    Please give me some hints on how to fix it. 

    Thanks,

Related