Hello,
I've inherited a project to create an iOS app that can communicate via BLE to UART RS232 to devices in the field using a proprietary protocol and at 115200 baud and the speeds that I am achieving using BLE is too slow for our liking and I'm trying to get to the bottom of it.
The project for the BLE device is the base ble_app_uart_pca10040_s132 example project configured for 15ms connection intervals and MTU of 247 bytes and PHY is 2M.
I'm transmitting roughly 140,000 bytes from the field devices to the app and it is about 4 times as slow over BLE than it is using TCP. The protocol uses acknowledgements and has a max length of 256 bytes.
Protocol Example
- App sends message starting data transfer
- Device receives message and sends between 16-256 bytes of data
- App receives message and sends acknowledgement
- Device receives message and sends between 16-256 bytes of data
- App receives message and sends acknowledgement
- Repeat until end of text message is sent by device
When calculating the amount of bytes received by the app over the time it takes, it comes out to about 12.5 kilobits/second. When running over TCP with the same app code I am getting about 45 kilobits/second. One thing that I have noticed is the time it takes to send a message from the app and receive a message from the device is about 50-60 milliseconds over BLE, while over TCP its about 12-15 milliseconds.
I would love any insight or input into this approach. I'm not very experienced in BLE and trying to figure out if it is a side effect of our protocol and BLE or if there is some type of limiting factor with BLE and iOS.
Thanks!