This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BLE Long write

My Setup: Nordic is the Server, Android is the client.

I have read many, many forum posts about doing long reads/writes. Virtually everyone says you cannot do long writes. Instead you have to do a sequence of 20 byte writes.
devzone.nordicsemi.com/.../

I've also looked into Android API, and found that they do long read under the hood but do not support long write. I can only send 20 byte at a time. This is just what the forum posts have said.

HOWEVER, what I don't understand is how Noric Master Control Panel successfully executes long write. I can load up a 50 byte message and pass it over the Android App version of MCP. Is there something utilized in the MCP that I have missed, or cannot get access to in Android?

I cannot believe there is no way to write large streams of data from a phone to a BLE chip. It must be that I've missed something.

Thanks for your help!

Parents
  • Hi Darren,

    There is a feature in BLE that goes by names like "long write", "queued writes" and "prepared writes". This feature lets you write multiple 20-byte chunks of data simultaneously, even across multiple characteristics. It works by sending multiple "Prepare Write Requests" (which have their full data echoed back in the "Prepare Write Response") followed by a final "Execute Write Request" that includes a flag saying "Write now" or "Cancel". I guess this is what the MCP is doing.

    You should have the same functionality in Android by using beginReliableWrite() followed by a number of writeCharacteristic() calls and finalized with executeReliableWrite().

  • Write commands and notifications do not require any response, and can be sent pretty fast. The S110 SoftDevice supports up to 6 packets per connection interval, but might be limited by the central if the central has less. This gives a maximum throughput of 6 packets * 20 bytes every connection interval. The minimum connection interval is 7.5ms, but this is not supported in all centrals either. iOS can be negotiated down to 11-something ms with some tricks, and Android should support 7.5ms (but have fewer packets per interval). The theoretical maximum is 128kpbs (16kB/s). See some examples here: devzone.nordicsemi.com/.../

Reply
  • Write commands and notifications do not require any response, and can be sent pretty fast. The S110 SoftDevice supports up to 6 packets per connection interval, but might be limited by the central if the central has less. This gives a maximum throughput of 6 packets * 20 bytes every connection interval. The minimum connection interval is 7.5ms, but this is not supported in all centrals either. iOS can be negotiated down to 11-something ms with some tricks, and Android should support 7.5ms (but have fewer packets per interval). The theoretical maximum is 128kpbs (16kB/s). See some examples here: devzone.nordicsemi.com/.../

Children
No Data
Related