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!

Parents
  • 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.

Reply
  • 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.

Children
No Data
Related