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

Time cost to establish BLE connection

Dear experts, Currently I'm using the peripheral device(s130 softdevice) and central device(s120 softdevice) both base on nrf51822 to evaluate BLE connect time. The connection interval is configured as 30ms. The scan time is 300ms and scan window is 10ms. In my test, I just connect one peripheral to central device and simply measure the time between calling sd_ble_gap_connect() and getting BLE_GAP_EVT_CONNECTED event. Finally I found the connect time is at least 600ms, sometimes up to several seconds. It's confused for me that so long time is needed to establish BLE connection. I think for BLE concept this process should be finished in dozens of milliseconds. Actually I want to write some application like that the peripheral devices keep sleeping in some seconds and then wake up to collect sensor data and send to central device, then back to sleep to save power. But it the previous connect time I mentioned takes so long, then each time the peripheral devices have to wake up for more than 1 seconds. So my question is whether the time I measure is reasonable or not? Thanks!

  • Hi

    Do you know what the advertising interval of the advertising device is?

    With a scan interval of 300ms and a scan window of 10ms you are only scanning 3.3% of the time, and you will surely drop a lot of the advertise packets. Normally an advertiser can not advertise more quickly than every 20ms, which means you are lucky to receive even a single advertise packet in that 10ms scan window. The end result is that you have to wait for multiple periods before you receive an advertise packet that you can send a connection request on.

    If you know that the device is advertising, and you want to establish a connection quickly, I would recommend using a longer scan window and possibly a shorter scanning interval, to increase the chance of receiving an advertise packet quickly.

    Best regards
    Torbjørn

  • Hi, Thanks for your quick reply! The advertising interval is 40ms. Actually the time I measured above has nothing to do with the advertising interval since I just measured the time between calling sd_ble_gap_connect() and getting BLE_GAP_EVT_CONNECTED event. Before this measuring the advertising data is already got. The adv and scan time is not included in this 600ms. Actually now I have got some idea about the cause. After I change the scan interval from 300ms to 30ms, the connect time has been reduced to about 60ms. Looks like after calling sd_ble_gap_connect(), the BLE will trigger the connect events only during scan window, then it means the connect events also have a interval equal to scan interval. I'm not sure whether my understanding is right, but according to the test result it looks like yes.

  • Hi

    The central is not able to discover a device and connect to it based on the same advertise packet.

    When you call sd_ble_gap_connect() the central has to wait for the next advertising packet from the peripheral before it can send the connection request, and that is why the scanning interval/window and the advertising interval makes a difference on the time it takes to connect.

    Put it another way: The time it takes to connect is the time it takes to receive the next advertising packet, plus the time difference between sending the connection request and sending the first poll packet (this delay is quite short, typically a couple of milliseconds).

    Best regards

  • Sounds reasonable! Could you please tell me which part of which spec or protocol document which I can get this kind of information from? Thanks!

  • If I can read some document about this then I will be more clear about it. Is this nordic/nrf51/sd120 special behavior or BLE standard protocol? I tested with some other BLE adapter, looks like this connect time cost does not exist. Looks like The central is not able to discover a device and connect to it based on the same advertise packet. is just nordic special thing?

Related