Re: data loss when trying to transfer large data with BLE
Re: data loss when trying to transfer large data with BLE
- Subject: Re: data loss when trying to transfer large data with BLE
- From: Etan Kissling <email@hidden>
- Date: Mon, 08 Apr 2013 15:54:29 +0000
- Thread-topic: data loss when trying to transfer large data with BLE
Rene,
With WriteWithResponse, you can send one write request per two connection events.
This is because only one WriteWithResponse can be active at a time, and because the
acknowledge packet is usually sent with the proceeding connection event, as it can not
be prepared in the few microseconds of time to send it in the same packet.
With WriteWithoutResponse, packets will get dropped, but you can send about 4 (officially 6)
of them per connection event (and have to do the acknowledgments yourself, if your use case
requires a reliable stream.
Syncing your writes is not necessary with the CBCentralManager. I did not run into
problems queueing up large amounts of data on the iOS side.
If you still want to sync WriteWithResponse calls with the connection event, you can use the
didWriteCharacteristic callback.
Etan
On 08.04.2013, at 16:42, Rene Limberger <email@hidden>
wrote:
> I have a use case that needs to exchange data packets of ~60bytes between an iOS device and a peripheral at as high of a data rate as possible. I understand that BLE is not designed to do that but i would like to evaluate what speeds we could get.
>
> To give some background, i am using a BLE112 module from Bluegiga in BGApi mode. For testing, the module is connected to a mac with a usb-to-serial adapter. The interface is 9600 baud with hardware flow control (RTS/CTS). I wrote a mac application that, using the BGAPI calls, controls the BLE stack on the module. I have also written a iOS app that scans for the peripheral, connects to it, find the services and characteristics. This all "sort of works" but when im trying to write to the attributes at a very high rate, eventually, data is lost, the module locks up and the connection is lost.
>
> Im trying to understand where the issue is, in iOS, the module, or both and what i can do about it. Specifically, i have read previous discussions on this list that talk about high data rates and understand that others have run into this. It would be interesting to hear how you solved this.
>
> One thing i have read repeatedly is that "the writes on iOS should be sync'd to the connection interval"? From my limited understanding of BLE, i gather than there is only a limited amount of data that can be exchanged per connection event. If so, how much data is that and how do i sync my writes to that on iOS? Is there a way when a connection interval occurs and how much data it transferred so i can write the next data?
>
> As mentioned above, my data packets are ~60bytes, so given the max length of an attribute of 20b, i created 3 attributes, with 20b each and another attribute which indicates he length (as my private protocol packets are variable length). When writing these 3 20b values and the 1b length, the initial 20 or so writes come thru to the peripheral just fine. but then things start to slow down and eventually all data is lost and the connection drops.
>
> As others have mentioned, the writes should be throttled, but im just not clear on what they should be throttled to?
>
> Thanks in advance,
> -r
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Bluetooth-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden