[nRF52840 / Peer Manager] NRF_ERROR_INVALID_ADDR on pm_conn_secure() – Connection Handle = 0

Hi Nordic Team,

I'm currently working on a BLE project using the nRF52840 DK with the nRF5 SDK (not using SoftDevice Controller), and I’ve run into a critical issue related to BLE security and the Peer Manager.

After successfully connecting to a central device (a mobile phone), my application attempts to initiate a security procedure using pm_conn_secure() inside the BLE_GAP_EVT_CONNECTED event handler. However, I consistently receive the following runtime error:

<info> app_timer: RTC: initialized.
<info> app: Debug logging for UART over RTT started.
<info> app: Fast advertising

<info> app: Connected
<error> peer_manager_sm: Could not perform security procedure. smd_params_reply() or smd_link_secure() returned NRF_ERROR_INVALID_ADDR. conn_handle: 0
<error> peer_manager_handler: Unexpected fatal error occurred: error: NRF_ERROR_INVALID_ADDR
<error> peer_manager_handler: Asserting.
<error> app: Fatal error
<warning> app: System reset

Key notes:

  • I verified that the connection handle (m_conn_handle) is being set during BLE_GAP_EVT_CONNECTED, but it shows as 0 in the error log, which seems invalid or not expected.

  • The Peer Manager has been initialized and pm_register() is called.

  • I have security parameters set, similar to the BLE NUS and GLS examples.

  • My application uses LE Secure Connections and sets sec_param.lesc = 1, sec_param.io_caps = BLE_GAP_IO_CAPS_DISPLAY_ONLY.

  • RNG_ENABLED is set to 1, and NRF_CRYPTO is enabled in sdk_config.h.

 During pairing with the nRF Connect mobile app, I receive the pairing notification, but the passkey input window never appears, and the connection fails shortly afterward.

This issue doesn't happen when I run the original ble_gls example with the same central device.

  • A timing issue or race condition with connection handle assignment?

  • Missing configuration or improper initialization of a required module like nrf_ble_gq or nrf_queue?

  • Something specific to LESC pairing with mobile phones?

    I am using SDK17.0.1

Any help in identifying what might be going wrong or what I should double-check in my configuration would be greatly appreciated.

Parents Reply Children
No Data
Related