Can I increase NRF_SDH_BLE_GATT_MAX_MTU_SIZE over 247?

Hi,

I'm using SDK 17.1.0 on nRF52833 DK.

Now I want to transmit  some data from mobile app to DK board by using examples\ble_peripheral\ble_app_uart.

NOTE: ble_nus_data_send(ble_nus_t * p_nus, uint8_t * p_data, uint16_t * p_length, uint16_t conn_handle)

When my DK board is connected, RTT viewer print "Data len is set to 0xF4(244)", and the NRF_SDH_BLE_GATT_MAX_MTU_SIZE is 247. Is that mean there are 3 bytes has been used on UART service when using ble_nus_data_send()? And the max size of *pdata is limitted to 244?

Can I recieve or send 1024 byte data to mobile app by setting NRF_SDH_BLE_GATT_MAX_MTU_SIZE?

Parents
  • Hi 

    244 bytes is the maximum amount of attribute data that can be sent in a single over the air packet over BLE. The actual data length in this case is 251 bytes, since the ATT protocol adds a 3 byte header and the link layer adds another 4 byte header on top of the attribute data. 

    The reason the NRF_SDH_BLE_GATT_MAX_MTU_SIZE is set to 247 is to make room for the 3 byte ATT header while still allowing you to send the maximum 244 bytes of attribute data. 

    According to the Bluetooth specification an attribute can not be larger than 512 bytes (not including the 3 byte header), so if you need to send more data than this you need to split it into multiple packets yourself. 

    The most efficient way to transmit data over BLE is to split it into 244 byte chunks, since this will utilize the maximum capacity of the BLE packets and minimize the overhead. 

    Best regards
    Torbjørn

Reply Children
Related