Problem with multiple connection in multirole device

Hello,

In my project, I have a device (nrf52833 custom board) which I want to operate in dual role (central/peripheral). I've followed a ble_app_hrs_rscs_relay example and got it working in some degree which includes:

  • pairing in both central and peripheral role works OK
  • connection securing in both roles works OK (when connecting one at the time)
  • disconnection in both roles works OK

The problem appears when the device is connected in peripheral role (with bonded nrfConnect app on android phone), and trying to connect in central role (another nrf52833 custom board peripheral device). In this case this is the output:

00> <error> peer_manager_sm: Could not perform security procedure. smd_link_secure() returned NRF_ERROR_INVALID_ADDR. conn_handle: 0
00> 
00> <error> peer_manager_handler: Asserting. pm_conn_secure() returned NRF_ERROR_INTERNAL on conn_handle 0.
00> 
00> <error> app: ERROR 3 [NRF_ERROR_INTERNAL] at ../../../../../../../resources/nRF5_SDK_17.0.2_d674dde/components/ble/peer_manager/peer_manager_handler.c:224
00> 
00> PC at: 0x00039603
00> 
00> <error> app: End of error report

I wanted to ask if there is maybe something I'm missing or some obvious reason for that error? 

I'm using SDK 17.0.2 

PS: I'm not sharing the project as it is large and it would be impossible to run it on any devkit as it requires this custom hardware setup to work

Parents
  • Hi Jakub, 

    The error log suggested a bad memory address (NRF_ERROR_INVALID_ADDR) . So we need to look into how you called pm_conn_secure() when you connected to the peripheral.

    You may want to add a breakpoint and step into the code when the central (relay) try to encrypt the link after the connection is established. Double check if the connection handle is correct. 

  • Ok, I've managed to track the issue but I could use some advice. So when until everything is ok, then when link_secure_central is called, p_sec_params are not NULL, but the failure happens when the phone disconnects, and peripheral wants to connect again, then p_sec_params == NULL and therefore return link_secure_authenticate(conn_handle, NULL); in security_dispatcher.c:967 is called. Any idea what can be the cause of the fact that security parameters are not set?

Reply
  • Ok, I've managed to track the issue but I could use some advice. So when until everything is ok, then when link_secure_central is called, p_sec_params are not NULL, but the failure happens when the phone disconnects, and peripheral wants to connect again, then p_sec_params == NULL and therefore return link_secure_authenticate(conn_handle, NULL); in security_dispatcher.c:967 is called. Any idea what can be the cause of the fact that security parameters are not set?

Children
No Data
Related