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

Bluetooth connection problem

Hi,

I am working with hid keyboard example on my Windows machine.

Problem 1 : After flashing the code, I make bluetooth connection and the code works properly. Then I remove the bluetooth device and if I try reconnecting, it does not connect. So I have to again flash the code with the soft device (SDK 15) to make it work.

Problem 2 : Bluetooth connection has been made with laptop 1 and the laptop is shut down. Now I try to connect to bluetooth of laptop 2; does not connect although I remove the device from laptop 1.

  • On what have you implemented the hid keyboard example?

    Have you made changes to the example?

    I remove the bluetooth device

    What do you mean by that?

    I have to again flash the code with the soft device (SDK 15) to make it wor

    What else have you tried?

    Does a reset not work? Or power-cycling?

  • I am using nrf52 DK. No changes made to the code. "I remove the bluetooth device" meaning I unpair the connected Nordic device. I tried pressing buttons 1,2,3,4 and the reset button and restarting the computers and the DK.

  • 1. There have been some issues with re-connection in Win 10, you may want to make sure to download the latest build of Win 10, or possible get the preview insider build from Microsoft to test directly that the issue is resolved. Also for testing you should consider using SDKv15.2 since that has a fix regarding directed advertisement that may have an effect on re-connection time.

    2. You will likely need to disable whitelist if you want to connect with a new central, there should be a start advertising without whitelist api call if I remember correctly.

  • Sounds to me that the case then may be that you need to allow repairing. Can you try to add the following to pm_evt_handler() in main.c

    // Insert in pm_evt_handler() in main.c
    
            case PM_EVT_CONN_SEC_CONFIG_REQ:
            {
                // Allow or reject pairing request from an already bonded peer.
                pm_conn_sec_config_t conn_sec_config = {.allow_repairing = true};
                pm_conn_sec_config_reply(p_evt->conn_handle, &conn_sec_config);
            } break; 
    

  • Hi Kenneth,

    As per your suggestion, switching from SDK 15 to SDK 15.2 works for re-connecting the bluetooth device. No issues there. But now what is happening is unless I remove the device from one host machine, I cannot connect to the other machine. So is there any way that if the host machine is shut down, the bond information is erased automatically and I can connect nrf to other machine without removing the bluetooth device from previous machine.

Related