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

Bonding errors in SDK 14

Hello,

I have recently ported our application from SDK 13 to SDK 14. Everything that worked in SDK 13 works in SDK 14. I then added the peer manager according to the ble_hrs example.

Every time I try to initiate bonding (through the nRF connect android app) I get a PM_EVT_ERROR_UNEXPECTED error in the pm_evt_handler() function.

When I trace it, it is originating in the pm_sm_evt_handler() function inside peer_manager.c, where it receives SM_EVT_ERROR_UNEXPECTED.

Do you have any ideas regarding what could cause this and where to check?

Thanks, Michael.

  • It seems SM_EVT_ERROR_UNEXPECTED originates from events_send_from_err_code(), which is called two places, link_secure() and smd_params_reply_perform().

    Maybe you can try to debug and see if you can get any more clues to why you get the error.

  • It originates from smd_params_reply_perform(), where it fails the first if() condition and passes the second. it then calls events_send_from_err_code() with connection_handle==0 and err_code==8

  • In security_dispatcher.c, in smd_params_reply(), function sd_ble_gap_sec_params_reply() in line 643 returns err_code==8 (NRF_ERROR_INVALID_STATE). This is what is triggering the SM_EVT_ERROR_UNEXPECTED error in smd_params_reply_perform(). I'm unable to debug any further.

  • Ok. It seems the reasons for sd_ble_gap_sec_params_reply() returning NRF_ERROR_INVALID_STATE is listed here.

    Does any of those make sense to you?

    If not, would it be possible for you to upload your complete project so I can test it here? Or a project that exhibits the behavior?

  • It doesn't make much sense because this is all happening inside SDK functions that I don't want to modify. I have opened a case on MyPage (case ID 38954). Hopefully you will be able to assist with this. Thanks.

1 2