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, let me write an answer, not a comment. Reliable write is not the same as long write. On Android it is enough to call writeCharacteristic(...) with data longer than 20 bytes to make it work. It should work on nRF Master Control Panel. Android will take care of it automatically. The firmware must be prepared to received long write. I'm not sure but perhaps WRITE_RESPONSE is required for the char. I'm not an expert in the firmware side but it works with some apps and does not with others, so the difference must be there, I guess. The BLE_EVT_USER_MEM_REQUEST and BLE_EVT_USER_MEM_RELEASE is what you need to handle in the firmware. Here you'll find an example: github.com/.../ble_app_hrs---LongWrite

Reply
  • Hi, let me write an answer, not a comment. Reliable write is not the same as long write. On Android it is enough to call writeCharacteristic(...) with data longer than 20 bytes to make it work. It should work on nRF Master Control Panel. Android will take care of it automatically. The firmware must be prepared to received long write. I'm not sure but perhaps WRITE_RESPONSE is required for the char. I'm not an expert in the firmware side but it works with some apps and does not with others, so the difference must be there, I guess. The BLE_EVT_USER_MEM_REQUEST and BLE_EVT_USER_MEM_RELEASE is what you need to handle in the firmware. Here you'll find an example: github.com/.../ble_app_hrs---LongWrite

Children
Related