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

How to determine packets per connection supported by connecting device

In my peripheral FW I set the Data Length to 251 and MTU to 247.  I also set the Tx Max time to 16  (16 * 1.25msec),   However I always see the during the connection handshaking that the max caps out at 2120usec.  I'm not sure how I can determine the maximum number of packets a connecting Phone or Device supports so I can actively determine the Maximum Connection Throughput.  This help determine the sampling rates of some sensors which I want to stream over BLE.  Is there a way to determine the packet limits during a connection?

Parents
  • Hello,

    I see that it always says 2120µs, but if you change the NRF_SDH_BLE_GAP_EVENT_LENGTH, it will use the according time of the event. You will see that the throughput is increased when increasing this, and decreased when you lower this value. I think the max time is for each packet, but the devices can send several packets within the NRF_SDH_BLE_GAP_EVENT_LENGTH in each connection event.

    This means that if you set the max TX time to 16 = 20ms, it will only be able to use the radio for 20ms within each connection interval.

    Best regards,

    Edvin

  • Hi Edvin,

    Not sure I understand what you're getting at.  So if I am sending chunks of 247bytes payloads which is the maximum MTU size, how can I determine how many packets can actually be sent per connection event?  In other words how many MTU-size packets?  

    This blog suggests that different phones support different packet amounts: https://www.novelbits.io/bluetooth-5-speed-maximum-throughput/

    What I'm trying to determine in FW is how many packets are supported by a connected phone, so I can determine the maximum through at live run-time.

    Regards,

    DC

  • Dave_couling said:
    So if I am sending chunks of 247bytes payloads which is the maximum MTU size, how can I determine how many packets can actually be sent per connection event?  In other words how many MTU-size packets?  

     You typically don't know, but you can keep queuing packets using sd_ble_gatts_hvx() until it returns NRF_ERROR_RESOURCES. Then the softdevice will send as many of the packets as possible. The amount depends on the connection parameters, and the amount of dropped packets in the connection event.

    Dave_couling said:
    This blog suggests that different phones support different packet amounts:

    That is correct. In BLE there are a lot of parameters (and I believe they are all mentioned in the novelbits blog post). The way that it works is that a BLE connection is started with very basic parameters, and then all the parameters are negotiated, and the limiting device decides (say one device requests MTU 247 and one says I can only do MTU 180, then 180 will be used). 

    You can experiment with what the different parameters does with the throughput using 2 DKs and the examples\ble_central_and_peripheral\experimental\ble_app_att_mtu_throughput example

    The ble_app_uart example will request maximum throughput parameters, so if you tweak the application to send as many packets as possible, and count the number of packets and length of packets that are successfully sent, you will see the throughput for that phone.

    Best regards,

    Edvin

Reply
  • Dave_couling said:
    So if I am sending chunks of 247bytes payloads which is the maximum MTU size, how can I determine how many packets can actually be sent per connection event?  In other words how many MTU-size packets?  

     You typically don't know, but you can keep queuing packets using sd_ble_gatts_hvx() until it returns NRF_ERROR_RESOURCES. Then the softdevice will send as many of the packets as possible. The amount depends on the connection parameters, and the amount of dropped packets in the connection event.

    Dave_couling said:
    This blog suggests that different phones support different packet amounts:

    That is correct. In BLE there are a lot of parameters (and I believe they are all mentioned in the novelbits blog post). The way that it works is that a BLE connection is started with very basic parameters, and then all the parameters are negotiated, and the limiting device decides (say one device requests MTU 247 and one says I can only do MTU 180, then 180 will be used). 

    You can experiment with what the different parameters does with the throughput using 2 DKs and the examples\ble_central_and_peripheral\experimental\ble_app_att_mtu_throughput example

    The ble_app_uart example will request maximum throughput parameters, so if you tweak the application to send as many packets as possible, and count the number of packets and length of packets that are successfully sent, you will see the throughput for that phone.

    Best regards,

    Edvin

Children
No Data
Related