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

error with pm_handler_disconnect_on_sec_failure()

Hi noridc, 

I am using the sdk 15.03, s140 and the nrf52840. 

I used as a reference the ble_app_interactive experimental example and the ble_central/ble_app_hrs_c. My intention is to connect to a peripheral based on the user selection as the ble_app_interactive example, but also having the whitelist enable as in the ble_app_hrs_c example.


In my application i can select if it uses or not the whitelist. But i want to connect only through bonding. If i send the connect command to a device that i'm not bonded with, i want it to try to connect and bond, if the peripheral does not support bonding, then i want it to disconnect, for that i'm using the pm_handler_disconnect_on_sec_failure(p_evt);  in the peer manager handler. 

However, once i start the application with the whitelist, it connects automatically to the bonded devices, that's ok.

Next i disable the whitelist and see other devices advertising , i send a connect command to them, but since they don't support the bonding, it  disconnects  but before a proper disconnection, the central application crashes. I am using JLink to debug in eclipse. And even while  debugging i can not see the real reason that is causing the fatal error. 

My question is then, is this a know problem with this sdk? Is it possible that the pm_handler_disconnect_on_sec_failure is not supposed to work with the whitelist? Do i need to add an especial case on the ble_event_handler or in the peer_manager().  

ANY idea would be  great! 

Thanks

  • Hi,

    And even while  debugging i can not see the real reason that is causing the fatal error. 

    Typically a fatal error means that an error check has been hit. If you build the project with DEBUG defined, then the error handler will tell you what the error code what, at which line in which file. Can you check that? In most cases that helps narrow down the issue a lot.

    My question is then, is this a know problem with this sdk? Is it possible that the pm_handler_disconnect_on_sec_failure is not supposed to work with the whitelist? Do i need to add an especial case on the ble_event_handler or in the peer_manager().  

    I suspect you are on to something, and that the error handling in the example does not fit your use case. If a failure to secure the link is not an error in your application, you will need to make sure that y ou do not treat it as an error (handle it specially).

Related