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

General questions about notifications, low level BLE packets and SoftDevice (PHY, connection interval, connection event length, ATT MTU and DLE)

Hi,

I have a couple of general questions regarding BLE packets, things that are not completely clear to me. I'm using SD S140 v6.1.0. I hope this doesn't end up in too many questions in one thread. For all the questions, assume a SoftDevice handling a single peripheral link.

First thing: I know that it is possible to send up to 6 notifications in a single connection interval. What if I increase the connection interval and the connection event length? Would it be possible to send more than 6? Or what is the purpose of increasing the connection event length?

I'm guessing it is also possible that the SD sometimes cannot send all 6 notifications in a single connection interval (assume that 6 notifications were already queued using sd_ble_gatts_hvx), depending on the connection parameters. Is this true (assuming a good quality link with no packet losses)? Or is it always possible to send 6? What if you set up something like connection interval of 7.5 ms, with maximum data length and ATT MTU? What if you set up the Coded PHY?

Assuming that the link quality is bad: If a notification can't be sent due to interference, will the SD try to send the same notification 6 times within the same connection interval?

Regarding the Coded PHY: I've read that when you use the Coded PHY, the maximum data length possible is 27 in order to avoid interference. However, it still looks like the nrf_ble_gatt module is accepting the max data length of 251 even when the Coded PHY has already been set up. Does the SoftDevice use a data length of 27 internally anyway?

I know that when the ATT MTU is larger than the supported data length, the data will be broken down in multiple packets. Does this still give better throughput or is it better to always keep the ATT MTU smaller than the data length? I'm not exactly sure whether having ATT MTU > DL introduces more overhead or not.

What happens if the connection event length is set up to be longer than the connection interval? I ask this because the event length must be set up during SD initialization and the connection interval is negotiable at runtime. It looks like the SoftDevice is smart enough to handle this but I just want to be sure and ask this.

I'm asking all these questions because I'm trying to get as much throughput as possible using the Coded PHY, but even following all the threads I could find on this I couldn't manage to achieve a high enough throughput. I need to get around 24 Kbps which is supposedly achievable, but I'm having trouble with that. Any input on that will also be deeply appreciated!

Thanks and sorry for all the questions at once!

  • Hi Andy,

    First thing: I know that it is possible to send up to 6 notifications in a single connection interval. What if I increase the connection interval and the connection event length? Would it be possible to send more than 6? Or what is the purpose of increasing the connection event length?

     Yes, you can send more than 6 packets per connection event. If you set event length == connection interval, you should be able to fill the time between connection events sending/receiving notification packets. 

    I'm guessing it is also possible that the SD sometimes cannot send all 6 notifications in a single connection interval (assume that 6 notifications were already queued using sd_ble_gatts_hvx), depending on the connection parameters. Is this true (assuming a good quality link with no packet losses)? Or is it always possible to send 6? What if you set up something like connection interval of 7.5 ms, with maximum data length and ATT MTU? What if you set up the Coded PHY?

    There is not enough time to send 6 packets with coded PHY at 7.5 ms intervals as the transmission of each packet requires longer time compared to 1M PHY. I guess that you may be able to send 2 at this interval. 

    Assuming that the link quality is bad: If a notification can't be sent due to interference, will the SD try to send the same notification 6 times within the same connection interval?

     No, the re-transmits will be attempted on the following connection event. So the throughput will be heavily impacted by the link quality, especially if you're using long connection intervals. 

    Regarding the Coded PHY: I've read that when you use the Coded PHY, the maximum data length possible is 27 in order to avoid interference. However, it still looks like the nrf_ble_gatt module is accepting the max data length of 251 even when the Coded PHY has already been set up. Does the SoftDevice use a data length of 27 internally anyway?

     Yes, this is a bit confusing. The Softdevice support 251 bytes with coded PHY, but the MaxRXTime/MaxTXTime is 2700 uS (=27 bytes with S=8 encoding). 

    I know that when the ATT MTU is larger than the supported data length, the data will be broken down in multiple packets. Does this still give better throughput or is it better to always keep the ATT MTU smaller than the data length? I'm not exactly sure whether having ATT MTU > DL introduces more overhead or not.

    Larger MTU gives a slightly smaller overhead due to packet encapsulation. The SDS shows the difference in terms of throughput ( under ideal conditions): https://infocenter.nordicsemi.com/topic/sds_s132/SDS/s1xx/ble_data_throughput/ble_data_throughput.html?cp=3_4_1_0_16. The data will still be split into smaller link layer packets. 

    What happens if the connection event length is set up to be longer than the connection interval? I ask this because the event length must be set up during SD initialization and the connection interval is negotiable at runtime. It looks like the SoftDevice is smart enough to handle this but I just want to be sure and ask this.

     The Softdevice is smart enough to handle this:) 

    I'm asking all these questions because I'm trying to get as much throughput as possible using the Coded PHY, but even following all the threads I could find on this I couldn't manage to achieve a high enough throughput. I need to get around 24 Kbps which is supposedly achievable, but I'm having trouble with that. Any input on that will also be deeply appreciated!

     I think 24kbps should be achievable, but only if the link quality is good. I have modified the ble_app_uart and ble_app_uart_c example in SDK 15.2.0 to test this, see attached zip below. Can you try this example and see what you get? 

    nRF5_SDK_15.2.0_mod.zip

    Test with 400 ms interval

  • Hi Vidar,

    Thanks for all the answers! Regarding the example you attached:

    I see that the peripheral is configured with min/max connection interval = 50 ms, and the GAP event length is set to 500 ms (400 * 1.25 ms units). In the central, however, the GAP event length is set to 62.5 ms (50 * 1.25 ms units). How does this affect the connection?

    Btw, unfortunately I only have one DK so I can't really test this here. Someone else is doing the testing with another device and I'm trying to adjust the connection parameters to get more throughput.

    And what program is that in the screenshot?

  • Also, if I understand correctly, you're getting a throughput of 7.31 kB/s? If that's true then that's around 58 kbps and I guess that's counting L2CAP and ATT headers, so in the end I should be able to expect a practical throughput of ~43 kbps (?).

  • I was testing with different connection intervals and forgot to change the event length. The example I provided uses 50 ms connection intervals so event length above 50 ms is just wasted RAM. 

    Are you testing against another Nordic device? The event length may be limited on the other side.

    The screenshot is from an Ellisys BT sniffer. Yes, I did get around 40 kbps, but this was at close range ( < 1M). I think the practical throughput is going to be significantly lower, unfortunately.  

  • I think the practical throughput is going to be significantly lower, unfortunately.  

    Yep, I'm afraid that will be the case.

    The example I provided uses 50 ms connection intervals so event length above 50 ms is just wasted RAM. 

    Why do you say that it is a waste of RAM? How does the connection event length affect the RAM usage? I haven't seen anything like this so far.

    The only thing that I have seen affects the RAM usage is the slave latency.

Related