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

    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

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

Children
No Data
Related