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

What is the maximum size of data can be transferred over BLE?

Hi,

I am trying to send stream of data over BLE. I am using nRF52 development kit and in that ble_app_uart code is running. I want to send continuous data to the UART and then it should be send over BLE communication. I have checked the data rate by sending bulk of data which is 20 Bytes data in a frame. So each of the data is about 20Bytes only (20Bytes then new line then 20Bytes- this sequence continues). In this case I am not getting any issue.

While sending without newline I can send upto 220 bytes at a time. If it is more than that BLE getting disconnected from the connected device.

How to overcome this issue, if I am sending continuous data(may be around 200KB of data at instance). How to handle large amount of incoming data?

How to handle the BLE disconnecting issue in case of large incoming data?

Parents
  • There should be no limit of the amount of data, but it is indeed in throughput (amount of data per time frame). So I suspect you have some problem in flow management of your data through NUS Tx/Rx "pipes" and the limit of 220B is just artifact of e.g. running out of Tx buffers or loosing some context/overflow in your APP code. From what I see Nordic is using this in their BT 4.2/5.0 throughput demos and they transport large chunks of data (1MB) without visible problems - see here.

Reply
  • There should be no limit of the amount of data, but it is indeed in throughput (amount of data per time frame). So I suspect you have some problem in flow management of your data through NUS Tx/Rx "pipes" and the limit of 220B is just artifact of e.g. running out of Tx buffers or loosing some context/overflow in your APP code. From what I see Nordic is using this in their BT 4.2/5.0 throughput demos and they transport large chunks of data (1MB) without visible problems - see here.

Children
  • I have seen the demo. But what is the size of payload?. In case of UART_BLE communication what is the maximum data size to be transferred?

    Is there any defined solution by using buffer sequence to handle bulk data?. Since I have done several tests using ble_app_uart code but I could not send the large amount of data. In my testing I am trying to send Operating system's booting log's over the BLE. So the actual data is bigger in size. In this case only BLE gets disconnected from the BLE sniffer dongle.

  • Sorry, you are right. By looking to ble_nus_string_send function implementation in components\ble\ble_services\ble_nus\ble_nus.c file it seems that Nordic UART doesn't solve fragmentation of APP data if they exceed BLE_NUS_MAX_DATA_LEN which is set to (NRF_BLE_GATT_MAX_MTU_SIZE - 3). But because it is behaving as classic unformatted UART data stream it should work like this: you cut you large data into blocks of BLE_NUS_MAX_DATA_LEN length and feed ble_nus_string_send function with them one by one. If your APP data are not structured (e.g. you cannot distinguish where they start and where end) and you need it then you need to add some kind of header o other formatting to your APP layer but that should be easy. Do you have two nRF52840 PDK or nRF52 DK boards so you can test the throughput demo? If you run the sniffer with it you should see all the flow.

  • I want your help on splitting data into chunks of 20bytes after receiving from UART. I have tried to do this but I can't achieve that function. Can you suggest the way to do this? It will be thankful if you are sharing code with me.

  • I'm afraid I don't have time to play with NUS and do any code samples. I believe that few pointers to some large buffer (keeping track where your last 20-byte or smaller block started and where should next start) and simple state machine (if packet sent then check if pointers indicate there are more data to send and if yes then cut next chunk and send it) should solve the problem.

Related