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

Peer Manager throws error NRF_ERROR_SOFTDEVICE_NOT_ENABLED when trying to pair

Hi,

I'm currently trying to implement Peer Manager in my existing project, for both pairing and bonding. I'm using the ble_app_template in examples/ble_peripheral in the SDK as a template for implementing it. I can initialize Peer Manager without issues. However when I connect to the device and try to pair and bond the following sequence happens inside the peer manager event handler:

Event 1: PM_EVT_CONN_SEC_START

Event 2: PM_EVT_CONN_SEC_PARAMS_REQ

Event 3: PM_EVT_ERROR_UNEXPECTED

Inside PM_EVT_ERROR_UNEXPECTED I print the error (which is 2, and as a humanreadable description: NRF_ERROR_SOFTDEVICE_NOT_ENABLED).

But clearly the softdevice is enabled since I can see the device advertising and I can connect to it. 

What am I missing here?

Other info:

SDK: V15.0

Hardware: nRF52832 PCA10040

Parents
  • Hard to tell what the cause might be here.

    Maybe you could test this using the newest version of the SDK (At writing time that is nRF5 SDK v.15.3.0). 

    Else, maybe you could upload your code, so that I can test this myself?
    (If you don't want to upload any code in a public thread, we can make this private first).

    Best regards,
    Joakim

  • Hi Joakim, thank you for the reply.

    I found the issue, since this a quite a large and messy code base I missed that we were replying in the BLE event handler that pairing (since it was not used before) was not supported, when removing that I can pair and bond as expected.

    Moving further on the development I could use some advice regarding bonding and pairing as I'm quite new to it. I'm advertising a service that contains 5-6 characteristics that should not be visible to central device before pairing and bonding is complete. Currently it is visible for the central device immediately when it connects.

    How does this procedure normally go? I can think of several "homemade" solutions, such as advertising a dummy service when no device is paired and bonded. And when a device pairs and bond restart the device and add the "real" service.

Reply
  • Hi Joakim, thank you for the reply.

    I found the issue, since this a quite a large and messy code base I missed that we were replying in the BLE event handler that pairing (since it was not used before) was not supported, when removing that I can pair and bond as expected.

    Moving further on the development I could use some advice regarding bonding and pairing as I'm quite new to it. I'm advertising a service that contains 5-6 characteristics that should not be visible to central device before pairing and bonding is complete. Currently it is visible for the central device immediately when it connects.

    How does this procedure normally go? I can think of several "homemade" solutions, such as advertising a dummy service when no device is paired and bonded. And when a device pairs and bond restart the device and add the "real" service.

Children
Related