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!

  • 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).

  • 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). 

    Hello Vidar, thank you for the useful information. I have a question about using coded PHY with large packages.

    Situation
    I want to develop systems that can communicate over a long range (around 500 meters, festival/event environment) with messages of around 250 bytes long. Latency up to 500ms is acceptable. I don't have a development kit yet, but I was thinking about using the nRF5340 PDK and nRF52840 Dongle (for testing)

    Question
    Why are the MaxRXTime and MaxTXTime set to 2700 uS? Is there a possibility to set it to 16656 uS (251 bytes) or 17040 uS (257 bytes)? And should that be better in this case?

    If I split a big message over 10 smaller messages, there's a higher chance that the complete message will not arrive, right? Will only the lost messages be resend in that case or all of them?

    Why am I asking this
    I see in your answer and vaguely in other sites that this coded PHY and long packages (DPL) are never used together. However, the Bluetooth specification shows that it is possible. See attached spreadsheet for a simple overview of sources, images and calculations. So everything I find online contradicts the specification.

    I'm asking you, because I have come to a dead end. You help will be very appreciated.

  • Hello,

    The specification allows for longer radio packets as you said, the 27 byte limit is in our stack. The problem with long packets though is that it increases the chance for packet loss. In terms of range it should be better to let the stack split the payload into several 27 packets rather than a few 251 packets.

    Jordy U said:
    Will only the lost messages be resend in that case or all of them?

    The Bluetooth stack handles all re-transmission regardless of the packets size and will never skip a packet. Failing to transmit a packet after x re-transmits will lead to a disconnect (supervision timeout).

     

Related