This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/CC2640R2F: Data Length Extension

Part Number: CC2640R2F
Other Parts Discussed in Thread: BLE-STACK

Tool/software: Code Composer Studio

Hi,

attached the BLE register that I get by sniffing the communication when I make a smartphone-CC2640R2F connection.

Do lines 433 and 434 indicate that devices negotiate the MTU length and set it to 251 bytes?

Thanks.

Best regards.

Giuseppe

sniffer_ble.pdf

  • Hi Guiseppe,

    Yes this line is for the MTU exchange. Please see the BLE-Stack User's Guide:

     

  • Hi,

    thanks for the answer but I don't get anything on ATT_MTU_UPDATED_EVENT.

    don't I should get a message with the length value?

    Best regards. 

    Giuseppe

  • Hi,

    should I use:

    HCI_LE_SetDataLenCmd


    HCI_LE_ReadSuggestedDefaultDataLenCmd

    HCI_LE_WriteSuggestedDefaultDataLenCmd

    HCI_LE_ReadMaxDataLenCmd

    ?

    Best regards.

  • Hi, 

    from software developer's guide chapter 5.6.5.2 I see that I must call:

    HCI_LE_WriteSuggestedDefaultDataLenCmd

    and the DLE is ok.

    but should I have an event that tell me the value of set length?

    Best regards.

    Giuseppe

  • Hi,

    if I display the value:

    pMsg->msg.exchangeMTURsp.serverRxMTU

    that I obtain in the event ATT_MTU_UPDATED_EVENT, I see 251.

    But If I call the HCI_LE_SetDataLenCmd(connHandle, requestedPDUSize, requestedTxTime)

    with:

     requestedPDUSize=251

    requestedTxTime=2120

    in the event HCI_LE_SET_DATA_LENGTH

    if I display:

    command_complete->pReturnParam[3],

    command_complete->pReturnParam[2],

    command_complete->pReturnParam[1],

    command_complete->pReturnParam[0]

    I obtain the values: 0 0 0 17

    why?

    What is the  length value?

    Best regards.

  • Hi Giueppe,

    1) Please review the difference between MTU and PDU. I think this is why you are so confused by the HCI commands:

    2) To use DLE please follow the instructions in the BLE-Stack User's Guide: (Please note DLE is enabled by default in BLE-Stack examples)

  • Hi,

    Thanks for the answer.

    I have some questions:

    1) I understand that the MTU is the total dimension of the data that I can receive, for example, If I have a characteristic in write, the max length is 251 byte, while the PDU is the max number of byte in a packet.

    So if I use the DLE I can receive all in one packet. Is it correct?

    2) The maximum PDU value depends on the BLE standard, for BLE 4.0 it is 27, for BLE 4.2 it is 255, but the maximum MTU value doesn‘t depend of the BLE standard, I can have a device with BLE 4.0 and max MTU of 255 byte, is it correct?

    3)If I use the HCI_LE_WriteSuggestedDefaultDataLenCmd(DLE_MAX_PDU_SIZE , DLE_MAX_TX_TIME) ,

    with DLE_MAX_PDU_SIZE=251 and DLE_MAX_TX_TIME=2120 the controller automatically negotiates the parameters and sets the values to the lowest ones. Is it correct?

    Suppose I have one characteristic in write (length 251 byte) and one in indicate, when write is done I send the indicate.

    4)Suppose that I negotiate the connection with a device that supports the DLE, in this case I receive one packet and I send tha indicate, while if the device support the max 27 byte of PDU I receive 10 packets, the controller reassembles everything and I send the indicate after the tenth packet. Is it correct?

    5)Suppose that I negotiate the connection with a device that support a max MTU of 150 byte, I know that the max MTU set is 150 from the event ATT_MTU_UPDATED_EVENT, and when I receive 150 byte in more packets I send the indicate. Is it correct?

    Thanks.

    Best regards.

    Giuseppe

  • Hi Giuseppe,

    1) If you have a characteristic which is 251 bytes long and you use DLE you can send the whole value in one packet, e.g. a notification packet.

    2) The MTU will depend on the peer MTU and in case of ATT packets, the ATT_MTU.

    3) Yes if the PDU size and Tx time do not match the smallest value will be used. Please note that different PHYs have different transmission time per byte. 

    4) I don't understand the question. The indication command will be sent from the application/profile to the BLE-Stack when the write callback is called, so not before the full write command has been received and the write response has been sent. It will be sent over the air as a separate packet.

    5) I don't understand this question either. 

    Please don't worry about L2CAP and MTUs and fragmentation and defragmentation in the application. If you are working with ATT/GATT packets (indications, write commands etc) it's all handled by the BLE-Stack.

  • Hi,

    thanks for answer, with regards to 4) and 5), my doubt is:

    the max length of characteristic is 251 Bytes, suppose that the smartphone support MTU length of 251 bytes and the DLE, so I receive the 251 byte in one packete.

    Suppose that for particular purpose I need to receive 500 bytes from the smartphone, what happens is:

    1) I receive the first 251 byte, the write callback is called.

    2) I receive 500-251 = 249 byte, the write callback is called.

    3) I send the notification.

    Is it correct?

    Best regards.

    Giuseppe

  • Hi Giuseppe,

    Yes, your understanding is correct of the callback behavior is correct, and you can send the notification when you receive all your data.

    For reference, the Custom Profile SimpleLink Academy module also has an example of a GATT service write callback that has similar behavior as mentioned. 

    Regards,
    Michael

  • Ok,

    thanks at all for the clarification.

    Best regards.

    Giuseppe

  • Hi,

    ok, thanks at all for the clarification.

    Best regards.

    Giuseppe