我怎么能增加Rx速度呢?

5 posts / 0 new
Last post
dairylcs
Offline
Last seen:3 months 4 weeks ago
加入ed:2015-09-13 16:38
我怎么能增加Rx速度呢?

I want to send 100kB datas to da14580.But I find that it very slow.How can i increase speed?
Thank you very much!

Device:
MT_dialog
Offline
Last seen:1 month 15 hours ago
Staff
加入ed:2015-06-08 11:34
Hi dairylcs,

Hi dairylcs,

There is not a simple answer how to increase the speed of sending data and your question is very generic. A simple answer would be to increase the connection intervals of your device but thats very general, as the amount of data transfered in every connection interval depends on the amount of packets that a device can send in every connection interval. Also the way of transmitting data is relevant with the speed if you are using for example indications before sending the next indication the previous one has to be confirmed by the master and that imposes a extra delay in the transfer. You can have a look at the DSPS example and check the implementation.

Thanks MT_dialog

Joacimwe
Offline
Last seen:1 year 4 months ago
Guru
加入ed:2014-01-14 06:45
What kind of device are you

What kind of device are you sending data from?

dairylcs
Offline
Last seen:3 months 4 weeks ago
加入ed:2015-09-13 16:38
iphone or other anriod phone

iphone or other anriod phone

Joacimwe
Offline
Last seen:1 year 4 months ago
Guru
加入ed:2014-01-14 06:45
If you need flow control and

If you need flow control and to forward the data received to UART you can use Dialog's DSPS.

Otherwise you can get it done like this by yourself:

For Android:
You can use "Write Without Response" in order to send multiple packets in one connection event.
On the DA14580 side, set the characteristic property ATT_CHAR_PROP_WR_NO_RESP.
On the Android side, use characteristic.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE).
Then send the first 20 bytes using characteristic.writeCharacteristic. When you get the onCharacteristicWrite callback with success status, you can send the next 20 bytes. Continue like this until you're done. Note: due to a bug in Android if connection gets lost unexpectedly during transfer, be sure you close the gatt object before you reconnect otherwise you won't might not be a ble to write to it again after reconnect.
You should also decrease the connection interval from the default 50 ms to minimum using gatt.requestConnectionPriority(BluetoothGatt.CONNECTION_PRIORITY_HIGH). You can also use the connection parameter update request procedure from the DA14580's side if you want to have custom parameters.
You can also request a larger MTU with gatt.requestMtu in order to slightly increase throughput by moving fragmentation from your app to L2CAP layer, removing some header overhead.

iOS is a bit harder because Core Bluetooth discards outgoing Write Without Response commands if you send data too quick. You can however insert a Write With Response for each 10th packet or so to easily workaround this.