This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

UART BLE Example - Data size limit

Hi,

What is the limitation in terms of the number of bytes that can be sent over the UART to be sent over BLE on the usart ble example? I tried sending 32 bytes and it worked, but sending 64 bytes does not seem to work.

I thought Bluetooth 4.1 onwards, the size of the data to be sent was in the hundreds of bytes range. Please let me know if I am mistaken.

Also if there is any way around that you suggest.

Thanks

  • Check out the ATT_MTU Throughput Example of how to send more than 32 bytes (By increasing the ATT_MTU size).

    Best regards,

    Simon

  • I have checked the USART-BLE example as given and it looks like I should be able to send much larger messages. What is the need for the new example?

    Thanks

  • Do you want to send 64 bytes in a single packet or divided over several packets? I assume the first.

    BLE 4.2 and 5.0 supports the feature Data Length Extension (DLE), which makes it possible to send up to 244 bytes in one packet (see image below).

    In order to set the data length, use the function sd_ble_gap_data_length_update(). If you look at the ble_app_uart_mtu_throughput example, you can see that this function is called in the following manner: 

    button_evt_handler()-->data_len_set()-->nrf_ble_gatt_data_length_set()-->data_length_update()-->sd_ble_gap_data_length_update()

    Remember to set the MTU size accordingly (NRF_SDH_BLE_GATT_MAX_MTU_SIZE).

    Best regards,

    Simon