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

ble central with whitelist cannot connect to peripheral unless selective disabled first

my central application is scanning for, and connecting to, only a single pre assigned peripheral device/address.

This central device is used in a high RF/BLE peripheral advertising environment.

I add the target peripheral address to the whitelist in order to avoid being flooded with advertising event callbacks from up to hundreds of other advertising devices.

This filters those out just fine during scanning, however, when I go to connect to the peripheral with sd_ble_gap_connect() I have to first disable selective scanning in those scan params or I can't connect.

Is this the expected behavior?

  • Hi Bill,

    Yes, it's expected. As you can find in the description of the sd_ble_gap_connect() function,

    [in] p_peer_addr   Pointer to peer address. If the selective bit is set in @ref ble_gap_scan_params_t, then this must be NULL.
    

    So you either set the address in the p_peer_addr, and disable selective scanning or you keep the p_peer_addr NULL and use the whitelist in the scan param to connect to any peripheral that matches the whitelist.

Related