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

Double pairing request with android

I am testing several phones with a specific App that I connect to my nRF52832. Some phones pair nicely but others do not pair as expected. They display two pairing requests.

- I have checked that my BLE device only sends one pairing request which is the case
- I tried increasing the PM_HANDLER_SEC_DELAY_MS and also setting it to zero but in both cases we would still get two pairing requests

- I allow repairing of already bonded peers

- As described here: https://devzone.nordicsemi.com/f/nordic-q-a/76912/double-pairing-prompt-in-android this behavior might be due to having several services and being peripheral. In my setting the nRF acts as central and connects to the phone which is in peripheral role. Then the phone exposes services as server which the nRF discovers as client. The nRF also exposes services. 

What could be the reason we get two pairing requests with some android phones?

When I log the connection trace I get the following messages:

Parents Reply Children
  • what I do is to bond immediately when a new device that I connected to is found with the function below. do you see an issue with that?

    ret_code_t pm_conn_secure(uint16_t conn_handle, bool force_repairing)
    {
        VERIFY_MODULE_INITIALIZED();
    
        ret_code_t err_code;
    
        err_code = sm_link_secure(conn_handle, force_repairing);
    
        if (err_code == NRF_ERROR_INVALID_STATE)
        {
            err_code = NRF_ERROR_BUSY;
        }
    
        return err_code;
    }

  • Hi 

    Do you mean that this is a device with which you have previously bonded?

    This is a bit different from the way it is normally done if you are doing it after connecting to a new device that you haven't previously bonded with. Then it is customary to wait for the client (normally the phone) to try to access a protected characteristic, and have it start pairing and bonding when the access fails with the INSUFICIENT_AUTHENTICATION error. 

    Best regards
    Torbjørn

Related