LE Data Length Extension

Summary

The data length extension feature allows the LE controller to send data channel packet data units (PDUs) with payloads of up to 251 bytes of application data, while in the connected state. Furthermore, a new PDU size can be negotiated by either side at any time during a connection.

Previously, the controller’s largest data channel payload was 27 bytes. This increases the data rate by around 2.5*, compared to Bluetooth Core Specification Versions 4.0 and 4.1 devices (if both devices support extended packet length and are configured properly).

Data Length Update Procedure

Once a connection is formed, the controller will behave in one of two possible ways:

  • If prior to the connection, the suggested PDU size and time are set to the defaults for both TX and RX (27B, 328 us) then the CC2640R2F will not initiate a data length exchange (i.e. a LL_LENGTH_REQ will not be sent).

    If the peer device sends a LL_LENGTH_REQ then the controller of the device will send a LL_LENGTH_RSP corresponding to the default sizes of 4.0 devices autonomously.

    Note

    See Utilizing the Feature at Run Time for information on how to get this behavior.

  • If prior to the connection, the PDU size or the maximum time for RX or TX are not default, then the LE controller of the device will use the LL_LENGTH_REQ and LL_LENGTH_RSP control PDUs to negotiate a larger payload size for data channel PDUs.

    A data length update may be initiated by the host or performed autonomously by the controller. Either the master or the slave can initiate the procedure.

After the data length update procedure is complete, both controllers select a new data length based on two parameters: PDU size and time. The largest size supported by both local and remote controller is selected; time is taken into account to support different data rates. These parameters are defined below:

  • PDU size
    The largest application data payload size supported by the controller. This size does not include packet overhead, such as access address or preamble.
  • Time
    The maximum number of microseconds that the device takes to transmit or receive a PDU at the PHY rate. This parameter uses units of microseconds (us).

Note

Reference the Data Length Update Procedure section ([Vol 6], Part B, Section 5.1.9) of the Bluetooth Core Specification Version 5.0 for more information about the data length update procedure.

See Table 13. for reference to the maximum sizes and times supported. The CC2640R2F supports these maximum values.

Table 13. LE And PDU Size and Transmit Time.
LE Data Packet Length Extensions Feature Supported PDU Size in Octets PDU Transmit Time (us)
Minimum Maximum Minimum Maximum
No 27 27 328 328
Yes 27 251 328 2120

Initial Values

The controller defaults to using TX PDU sizes compatible with 4.0 and 4.1 devices. It uses 27 bytes as its initial maximum PDU size, and 328 us as the maximum PDU transmit time.

On the RX side, the controller defaults to the maximum PDU size and the maximum PDU transit time for a LE Data Packet Length Extension enabled device. In other words, the RX PDU size will be 251, and the RX PDU transmit time will be 2120 us.

Note

As mentioned in Data Length Update Procedure, by default a LL_LENGTH_REQ control packet will be sent by the device due to the RX max PDU size and max PDU transmit time not being default 4.0 PDU sizes and timings.

The application can update the data length in two ways.

  1. the application can set the connection initial max octets to cause the controller to request a larger size for every connection.
  2. the controller can initialize the connection with the default values of 27 octets and 328 us, then dynamically negotiate the data length at a later time in the connection.

For maximum throughput, high layer protocols such as the BLE host should also use a larger PDU size (see Maximum Transmission Unit (MTU)). Figure 61. illustrates various PDU sizes in the stack.

../_images/l2cap_pdu_sizes.jpg

Figure 61. Various PDUs within the Stack

Data Length Extension HCI Commands and Events

The following HCI commands can be used to interact with the controller related to the data length extension feature:

The above commands may generate:

  • LE Data Length Change Event

Note

For more information about these HCI commands and their fields, see the LE Controller Commands and Events sections ([Vol 2], Part E, Section 7.7-7.8) of the Bluetooth Core Specification Version 5.0. Additionally, the APIs for these commands are documented under BLE Stack API Reference.

In addition to the Bluetooth SIG defined HCI commands, the following TI Vendor Specific command also interact with the controller related to the data length extension feature:

  • HCI_EXT_SetMaxDataLenCmd

Utilizing the Feature at Run Time

As discussed in Initial Values, the LE controller initially uses packet length values compatible with 4.0 and 4.1 devices in new connections for TX. The controller will automatically attempt to negotiate a higher data length at the beginning of every new connection. To disable this feature, add the following call to the application task’s initialization routine (such as simple_peripheral_init).

1
2
3
4
5
6
7
8
#define APP_TX_PDU_SIZE 27
#define APP_RX_PDU_SIZE 27
#define APP_TX_TIME 328
#define APP_RX_TIME 328

//This API is documented in hci.h
HCI_EXT_SetMaxDataLenCmd(APP_TX_PDU_SIZE ,  APP_TX_TIME,
   APP_RX_PDU_SIZE, APP_RX_TIME);

Once a connection is formed, the controller handles negotiating a packet size with the peer device. If both devices are set up to use data length extension, a throughput increase is observed.

To re-enable controller negotiation upon a new connection, simply adjust the values to be greater using the same command above. Use valid values as shown in Table 13., otherwise the controller will reject this call.

In addition to the TI Vendor Specific command, Bluetooth SIG HCI commands can also be used, such as the following.

1
2
3
4
5
6
#define APP_SUGGESTED_PDU_SIZE 251
#define APP_SUGGESTED_TX_TIME 2120

//This API is documented in hci.h
HCI_LE_WriteSuggestedDefaultDataLenCmd(APP_SUGGESTED_PDU_SIZE ,
APP_SUGGESTED_TX_TIME)

HCI_LE_WriteSuggestedDefaultDataLenCmd() only alters the PDU size and time for the Transmit side.

Set Packet Length in a Connection

Packet length can also be changed dynamically in a connection using the below API snippet. The application can determine when this must occur based on any logic, such as sensor data or button presses.

uint16_t cxnHandle; //Request max supported size
uint16_t requestedPDUSize = 251;
uint16_t requestedTxTime = 2120;

GAPRole_GetParameter(GAPROLE_CONNHANDLE, &cxnHandle); //This API is documented in hci.h

if (SUCCESS != HCI_LE_SetDataLenCmd(cxnHandle, requestedPDUSize, requestedTxTime))
   DISPLAY_WRITE_STRING("Data length update failed", LCD_PAGE0);