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

Peer manager - pm_conn_secure returning invalid state

In the case where connecting to a phone that is paired with my device after my device has cleared pairing information and doesn't remember the pair, I'm observing the following behavior:

When pm_conn_secure is called the first time it returns NRF_SUCCESS and subsequently receive a PM_EVT_CONN_SEC_START and PM_EVT_CONN_SEC_FAILED event.  The (android) phone seems to automatically delete the stored pair. 

Subsequent calls to pm_conn_secure do not return NRF_SUCCESS and instead return NRF_ERROR_INVALID_STATE.  The call produces a PM_EVT_CONN_SEC_PARAMS_REQ event to which I reply with the same ble_gap_sec_params_t I was using before.  This return value isn't really explained anywhere and I'm not sure what I'm doing wrong here.  Thanks for any input

Parents
  • Hi

    To make a secure connection via bonding, I suggest you take a look at one of our examples doing just that, for example ble_app_proximity. (You can also test with an unmodified build of this example to ensure that you are able to bond properly).

    You can check out this case which describes how to check if there is existing bond info on the device you are pairing with already, which might cause errors. 

    Best regards,

    Simon

Reply
  • Hi

    To make a secure connection via bonding, I suggest you take a look at one of our examples doing just that, for example ble_app_proximity. (You can also test with an unmodified build of this example to ensure that you are able to bond properly).

    You can check out this case which describes how to check if there is existing bond info on the device you are pairing with already, which might cause errors. 

    Best regards,

    Simon

Children
No Data
Related