Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Obtaining maximum packet size

Hi,

My device is peripheral and server and is connected to an (android) phone. I have two related questions:

a) I understand that maximal packet size is obtained by calling sd_ble_gap_data_length_update with null p_dl_params and null p_dl_limitation. Is this correct?

b) How can I know the maximal GATT payload size? (Is it dependant on the phone?)

Thanks,

Daniel  

Parents
  • Hi,

    a) Providing NULL for p_dl_params means all parameters use BLE_GAP_DATA_LENGTH_AUTO, which means the SoftDevice chooses the highest value supported in the current configuration and connection parameters, see the sd_ble_gap_data_length_update() documentation.

    p_dl_limitation is an output parameter, which is used when sd_ble_gap_data_length_update() is used to respond to a Data Length Update request. If the values in the request can not be met, p_dl_limitation will contain the maximum values supported (which is also what is sent as the response.) If you set it to NULL there is still sent a response, but the values can not be read by the application as there is no ble_gap_data_length_limit_t structure holding them.

    b) Both link layer payload (which is the one set with GAP data length update) and GATT MTU depend on the phone yes. (I.e. both vary from device to device, which is why there are procedures for negotiating an increase from the mandatory default values.)

    Regards,
    Terje

  • Terje,

    Thanks for the clear answer.

    I have a follow-up questions:

    When calling sd_ble_gap_data_length_update with null p_dl_params and not null p_dl_limitation, the phone accepts the requested limitations (all field are zero). Yet, the maximal payload is 27 and the actual maximal data I can send is 20 bytes. 

    Are these the expected values? If so, is there a way to ask for more? (since I see from the BLE specs the the payload can be up to 251 bytes).

    Thanks again,

    Daniel

Reply
  • Terje,

    Thanks for the clear answer.

    I have a follow-up questions:

    When calling sd_ble_gap_data_length_update with null p_dl_params and not null p_dl_limitation, the phone accepts the requested limitations (all field are zero). Yet, the maximal payload is 27 and the actual maximal data I can send is 20 bytes. 

    Are these the expected values? If so, is there a way to ask for more? (since I see from the BLE specs the the payload can be up to 251 bytes).

    Thanks again,

    Daniel

Children
Related