How is it possible to send more than 1 packet per connection interval on iOS to a Bluetooth LE (BLE) device?
I am connecting from iOS [iPhone 6 with iOS 10.3] to Microchip BM70 BLE. I have read articles like https://punchthrough.com/blog/posts/maximizing-ble-throughput-on-ios-and-android as well threads like https://lists.apple.com/archives/bluetooth-dev/2015/Apr/msg00026.html and have implemented code such that it:
If I just write full blast, iOS stops sending data after about 20 packets. If I sleep 150ms after every 4 packets, it sends correctly. If I sleep 35ms after each packet, then it sends correctly, too. If I send 18 packets and then send 19th packet as Write WithResponse + call back handler, then it sends the packets correctly, too.
However, when I look at the logic analyzer, the data is being sent correctly but only 1 packet is being sent per connection interval [30ms]:
logic analyzer snippet of BLE packets
Is there some other setup I need to do in my CBPeripheral or CBCentralManager to be able to send more than 1 packet per connection interval?
Thanks!
If you are facing issues on disconnecting central and peripheral, I would recommend to use write with response, and send the second set of data on successful callback received from Peripheral after writing data. This is better rather than waiting for 150 ms after 4 packets, if you are focusing on increasing the throughput.
Also, iOS will adjust MTU size with the peripheral to send maximum possible packets in one connection. [This is from the experiment that i did using iPhone (Central application) and Linux/Android (Peripheral Application)]. On connecting with Xiomi Mi A1, the MTU got adjusted to 185 as per the request from iPhone application to peripheral. However you cannot programatically give custom value to MTU size, as API s for editing MTU is private and hidden from public APIs.
With iPhone 8 as central and Android with BLE 4.2 as Peripheral, the throughput that we could achieve is 2.5 KiloBytes per sec.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With