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.
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.
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
What kind of device are you sending data from?
iphone or other anriod phone
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.