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

Connection Interval and Througput

Hi, 

I am a bit confused about the effect the Connection Interval has on BLE throughput. 

SoftDevice documentation :

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsds_s140%2FSDS%2Fs1xx%2Fmultilink_scheduling%2Fextend_connection_event.html

Claims that higher connection interval increases throughput 

Other have claimed just the opposite 

https://punchthrough.com/maximizing-ble-throughput-on-ios-and-android/

which claims 
" BLE throughput requires context for it to be meaningful and the context starts by determining the connection interval (the smaller generally gets you faster throughput, though there are some interesting exceptions)

my logic is the if device communicate more oftern ( lower connection interval ) we achieve higher throughput. 

So - what is it  ? 

Thanks, 

Ran 

Parents
  • Hi Ran,

    There isn't any contradiction here. With enabled event length extension, SoftDevice can fit as many packets into one event as connection interval permits. The space between consecutive packets within a connection event is 150 usec that is in any case shorter than between connection events - so the longer connection interval, the less time is wasted. To take any gain from this feature, event length extension has to be supported by both sides.
    Android and iOS don't allow long connection events, they have some hardcoded number of packets per connection interval - as second document claims, it's 4 for iOS and 6 for Android (though there may be different values for different phones and OS versions). In this case, shorter connection interval gives more connection events per second -> better throughput.

  • I see.

    So when testing throughput between 2 NRF52840-DK, Conn. Interval = 200 will give a better throughput then conn. Interval =30 .

    When testing throughput between 1 NRF42840-DK and Android , Conn. Interval = 30 give a better throughput then Conn. Interval = 200, this is due to the limited number of packet each connection event can exchange.

    Did I get this right ?  

    If so  - I have a NRF52840 sampling device which connect to an Android phone. 

    Occasionally, I need to send a 2K of data ( containing sampling data ) . 

    My flow is to use Interval=300 in Idle ( to reduce power consumption ) 

    When sending 2K ( 20 chinks of 100 bytes )  , I asking the master to update Connection Interval =75 .

    (for few seconds and then lower back ) 

    Does that sounds right ? 

  • Hi 

    wrani said:
    1.I am using NUS service, so each call to "ble_nus_data_send" ( which calls sd_ble_gatts_hvx ) equals a "packet" ? 

    Each call to ble_nus_data_send constitutes one attribute (host) packet, but the link layer might split this packet into multiple on air packets if the data length is not large enough to send the entire packet in one go. 

    Assuming the data length is larger than your NUS packet + 7 bytes it will be sent in one packet over the air (the 7 bytes is used for the L2CAP and attribute headers). 

    wrani said:

    2.if maximum data buffer I'm sending over NUS is ~160 Bytes, is it still better to set NRF_SDH_BLE_GATT_MAX_MTU_SIZE=247 and  NRF_SDH_BLE_GAP_DATA_LENGTH =251 ? 

    In general there is no drawback having a GATT MTU and data length larger than what you need, but it does increase the RAM consumption of the SoftDevice a bit, so if you are running out of RAM you might consider optimizing this. 

    A GATT MTU of 163 and a data length of 167 is the minimum needed to support 160 bytes of user data in a single on air packet. 

    Regarding question 3, it is correct that waiting for the HVN_TX_COMPLETE_EVENT is the correct way to handle the NRF_ERROR_RESOURCE error. Then you ensure that the SoftDevice buffers are full at all times, which ensures optimal data transfer. 

    wrani said:

    other posts ? 

    4. Is there any reason to change HVN Q size ? I remember reading it will be automatically calculate based on connection params ? 

    In order to maximize data throughput you can increase the SoftDevice buffers through the NRF_SDH_BLE_GAP_DATA_LENGTH parameter in sdk_config.h

    This parameters determines how long you can keep transmitting packets back to back in a single connection event. 

    Best regards
    Torbjørn

  • Thanks. 

    Does any of what we've discussed changes if I am running a multilink setup ? 

    for ex , aggregator for 15 devices, all NRF's .

    What special attention\calculation in need to consider in such case ? 

  • Hi 

    In a multilink scenario you essentially need to divide the available RF time between all the running links. 

    In this case I would probably use a longer connection interval, to ensure that each connection gets a longer connection event before the central has to switch to the next link. 

    On the peripheral side there isn't much you can do in this case, it is mainly up to the central to decide the most efficient connection parameters for multiple links. 

    You could try a connection interval of around 400ms for instance, and use a long GAP event length to maximize throughput. 

    Best regards
    Torbjørn

  • so , the ""GAP event length" is the actual time the radio is on, and conn. interval is the interval in which  "GAP event length " correct ? 

    Do I need to change "GAP event length " in the central \ Peripheral \ Both ? 

    Currently - this are set to 50 in both Master and Peripheral, because I was unsure where to set them. Also - what is the effect "gap length" have on softdevice memory ? 

  • Hi 

    wrani said:
    so , the ""GAP event length" is the actual time the radio is on, and conn. interval is the interval in which  "GAP event length " correct ? 

    The GAP event length is the maximum time the stack can spend sending and receiving packets in one connection event, yes. 

    The connection interval is the time between the start of each connection event. 

    wrani said:
    Do I need to change "GAP event length " in the central \ Peripheral \ Both ? 

    You need to change this on both sides, yes. If one device has a lower GAP event length than the other, then the lower value will set the maximum GAP event length for that connection. 

    wrani said:
    Currently - this are set to 50 in both Master and Peripheral, because I was unsure where to set them. Also - what is the effect "gap length" have on softdevice memory ? 

    I don't know if there is a precise relationship between the GAP event length and memory consumption, since this is affected by many factors. The critical point is that you keep logging enabled when changing these parameters, so that you get a warning message in the log if you don't have enough RAM set aside for the SoftDevice. 

    Best regards
    Torbjørn

Reply
  • Hi 

    wrani said:
    so , the ""GAP event length" is the actual time the radio is on, and conn. interval is the interval in which  "GAP event length " correct ? 

    The GAP event length is the maximum time the stack can spend sending and receiving packets in one connection event, yes. 

    The connection interval is the time between the start of each connection event. 

    wrani said:
    Do I need to change "GAP event length " in the central \ Peripheral \ Both ? 

    You need to change this on both sides, yes. If one device has a lower GAP event length than the other, then the lower value will set the maximum GAP event length for that connection. 

    wrani said:
    Currently - this are set to 50 in both Master and Peripheral, because I was unsure where to set them. Also - what is the effect "gap length" have on softdevice memory ? 

    I don't know if there is a precise relationship between the GAP event length and memory consumption, since this is affected by many factors. The critical point is that you keep logging enabled when changing these parameters, so that you get a warning message in the log if you don't have enough RAM set aside for the SoftDevice. 

    Best regards
    Torbjørn

Children
No Data
Related