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!

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

  • It means that you already had allocated enough RAM, and that you had some unused RAM before. Slave latency should not affect memory usage.

  • Ok. One last question: If I set the both the connection interval and the connection event length to 50 ms, there's no way that the SD can handle other tasks right? For example scanning for other devices.

  • Good question. The Softdevice will spend nearly 100% of the time sending the packets. However, the Softdevice scheduler may, in some cases, drop events to allow other tasks to be handled. Suggest that you read the section about the scheduler in the SDS for more details: https://infocenter.nordicsemi.com/topic/sds_s140/SDS/s1xx/multilink_scheduling/suggested_intervals_windows_s132.html?cp=3_4_2_0_14_9 

  • Thanks, that was a very interesting read.

    I have a couple of questions though:

    In this paragraph:

    When long Link Layer (LL) Data Channel PDUs are in use, it is recommended to increase the event length of a connection. For example, LL Data Channel PDUs are by default 27 bytes in size. With an event length of 7.5 ms, it is possible to send seven full-sized packet pairs in one connection event. Therefore, when increasing the Link Layer Data Channel PDU size to 251 bytes, the event length should be increased to 33.75 ms. To calculate how much time should be added (in ms), use the following formula: ((size - 27) * 8 * 2 * pairs) / 1000.

    What is pairs? I thought it might be 7 for the LE 1M PHY, 11 for the LE 2M PHY and 1 for the LE Coded PHY, but using 7 I get 25.08 ms. That plus 7.5 ms doesn't give the final 33.75 ms suggested in the spec.

    I also wanted to ask what is t_scanReserved.

    And the final question: it looks like the scanner has a higher priority than the connections. I assume that because of all the talk about dropped packets in order to scan and all that. Where can I see the priorities of the SD?

  • Andy said:
    What is pairs? I thought it might be 7 for the LE 1M PHY, 11 for the LE 2M PHY and 1 for the LE Coded PHY, but using 7 I get 25.08 ms. That plus 7.5 ms doesn't give the final 33.75 ms suggested in the spec.

     The number should be increased to the nearest 1.25 ms unit. 

    Andy said:
    I also wanted to ask what is t_scanReserved.

     It's the reserved time that the Softdevice needs for each Scan window. Table 1 shows the Softdevice scheduling priorities (link).

Reply
  • Andy said:
    What is pairs? I thought it might be 7 for the LE 1M PHY, 11 for the LE 2M PHY and 1 for the LE Coded PHY, but using 7 I get 25.08 ms. That plus 7.5 ms doesn't give the final 33.75 ms suggested in the spec.

     The number should be increased to the nearest 1.25 ms unit. 

    Andy said:
    I also wanted to ask what is t_scanReserved.

     It's the reserved time that the Softdevice needs for each Scan window. Table 1 shows the Softdevice scheduling priorities (link).

Children
Related