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

Multilink advertising packets while connecting

I'm experimenting with BLE multilink central S120 softdevice on pca10028 and several of my custom BLE devices based on S110 softdevice.

Is S120 multilink central capable of receiving advertising packets from BLE devices while establising connection with another BLE device? BLE devices advertising period is 10 secs, so the connection procedure takes at least 10 secs and I don't want to lose advertising packets from the rest of BLE devices in range.

Also is S120 multilink central capable of starting establishing connections to multiple BLE devices at the same time?

  • Hi gaminn,

    Once the sd_ble_gap_connect have been called, you will stop receiving advertising packets.

    To start connection procedure to multiple devices at one time, you would have to use the whitelist instead of specifying a device to connect to.

    ble_gap_addr_r dev_1 = {{0}, {0x55, 0x44, 0x33, 0x22, 0x11, 0x00}}; // Public device with address 0x001122334455
    ble_gap_addr_r dev_2 = {{1}, {0x00, 0x11, 0x22, 0x33, 0x44, 0x55}}; // Random Static device with address 0x554433221100
    ble_gap_addr_t *pp_addrs[] = {&dev_1, &dev_2};
    
    ble_gap_whitelist_t whitelist;
    memset(&whitelist, 0, sizeof(whitelist));
    whitelist.pp_addrs   = pp_addrs;
    whitelist.addr_count = sizeof(pp_addrs)/sizeof(void *);
    
    ble_gap_scan_params_t scan_params;
    memset(&scan_params, 0, sizeof(scan_params));
    scan_params.selective   = 1;
    scan_params.p_whitelist = &whitelist;
    scan_params.interval    = ...
    scan_params.window      = ...
    scan_params.timeout     = ...
    
    uint32_t errcode = sd_ble_gap_connect(NULL, &scan_params, &conn_params);
    

    something like this might work, I have not compiled or tested it, so there might be errors

    [update] when you have received the first connection event, you would have to call the same connect again, but would have to remove the device that connected from the whitelist in case it continues to advertise with the same address.

  • Hi Pal, thank you, I'll give it a try later today. Is there any solution to "Once the sd_ble_gap_connect have been called, you will stop receiving advertising packets."? Minimizing the loss of advertising packets is quite important in our application.

  • I can think of a solution where there will be actually two S120 centrals in our "central" physical device. One will act as advertising receiver, the second one as the device which establishes connections to peripherals. But that's not optimal solution of course. Software solution would be much better.

  • What you could do is to have a short timeout on the connect, and if you receive a timeout you can alternate between scanning and connecting

  • With quite long advertising period (10 secs) of our peripheral devices, the short timeout (short = <1 sec) is not possible... We would need to decrease advertising period.

Related