9
votes

Our company develops a hardware unit that has Bluetooth BLE and we have a service app in a Nexus 7 (2013) that we want to send firmware files to the unit with. The files can be as large as 500kb.

The BT chip is a Texas Instruments CC2540.

I have gone through tons of we pages, and scanned Stack overflow for information how to speed up the transfer of data from the Android device to the CC2540, but haven´t found any really good example.

On Nordic semiconductors homepage I found an example of how they calculate the maximum throughput for a Android unit: (https://devzone.nordicsemi.com/index.php/how-do-i-calculate-throughput-for-a-ble-link)

Nexus 4 with nRF51822: 4 * 20 B * 1/0.0075 s = 10.6 kB/s = 84 kbps

It says that an Android unit can send 4 packets of 20 bytes per connection interval, and that Android can handle connection intervals of 7.5ms.

In our app we are currently sending data with writeCharateristics and wait for onWriteCharateristics callback before we send the next chunk of data. However, that sending rate is painfully slow as the callback takes about 2 seconds to be called(!!). That makes a data transfer rate of 10 bytes/s which is far away from the 10.6kb/s in the example calculation above.

We have tried transferring 50kb of data between two iOS devices (with a modified version of the KeyFob demo for iOS) and got a transfer rate of 3.4kb/s. But that was using the CBPeripheralManager UpdateValue which I understand is a way of sending a notification from peripheral to central.

What I have read there is no way right now to have an Android device working as peripheral. Does this mean it's impossible for a CC2540 to send notifications to the Nexus 7? And is the only way to maximize the throughput to send the data through notifications?

Is it the stack in the TI device that makes it all slow, or is there any way to change any parameters to make the data transfer faster between the Nexus and the CC-unit?

We had an idea of implementing a GATT server in the Nexus 7 device and make the CC2540 subscribe for notifications from it. Is that possible? That means the Nexus first have to scan for the CC2540 and connect to it when it finds the service. When the connection is established, the CC2540 starts to subscribe for notifications from the Nexus 7. After that sending notifications from the Nexus to the CC2540 with a higher transfer rate.

Hopefully someone else has been trying to do the same thing as we are trying to do!

1
I know this was not your main question, but Android can act as a peripheral since Android 5.0. There are many apps in the Play Store you can use to make your Android device advertise BLE packets, such as Nordic nRF Connect, which use the BluetoothLeAdvertiser class in API level 21Mark Ch
Wow I just noticed how old this question is. How did I end up here...Mark Ch

1 Answers

0
votes

Some months ago I worked to a project using the CC2540, unfortunately the project was about another application field.

Anyway I remember that you can set your connection parameters like the Connection_Interval or the Slave_Latency in order to improve your throughput, even if the power consumption will be greater than before. Probably you have already tried to do that but I think this is the only way to obtain a good result.