This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Write to variable length characteristic

Hello,

I have some code running that transfers binary data from an iPhone to a nRF51822 device (used for firmware upgrade).

I have used a variable length characteristic with a maximum length of 20 bytes. I then write "as often as possible" from an iOS application using CBCharacteristicWriteWithoutResponse to avoid having to wait for data before sending the next packet.

This is working ok on iPhone 4S, but on newer models the connection interval seems to be longer which means I need a long delay between each packet causing the transfer speed to drop significately.

I'm now trying to send bigger packets. I started by reconfiguring my characteristic to allow bigger writes (knowing that these would still be divided into the MTU size) and allowing write (with response).


    char_md.char_props.write_wo_resp = 1;
    char_md.char_props.write = 1;

    attr_md.vloc = BLE_GATTS_VLOC_USER;
    attr_md.vlen = 1;

    attr_char_value.init_len     = 1;
    attr_char_value.init_offs    = 0;
    attr_char_value.max_len      = 512;
    attr_char_value.p_value      = m_stream_buffer;

The problem is that iOS gets an error message when I try to write more than 20 bytes of data (using a CBCharacteristicWriteWithResponse).

Has anyone else tried this?

Parents
  • Current S110 does not support bigger MTU sizes, and to make writes of more than 20 bytes work, you'll therefore have to implement GATT Write Long as a GATT Server, for instance following this MSC. However, beware that this will not give you higher throughput in any way.

    You should note that (at least) iPhone 5S has an issue causing it to transfer at most 1 packet per interval, and this is most likely the cause of your slowdown, as you can see from this question. This issue should be fixed in a future version of iOS, but I can't really promise anything. Unfortunately, I'm not aware of any workaround for this problem.

Reply
  • Current S110 does not support bigger MTU sizes, and to make writes of more than 20 bytes work, you'll therefore have to implement GATT Write Long as a GATT Server, for instance following this MSC. However, beware that this will not give you higher throughput in any way.

    You should note that (at least) iPhone 5S has an issue causing it to transfer at most 1 packet per interval, and this is most likely the cause of your slowdown, as you can see from this question. This issue should be fixed in a future version of iOS, but I can't really promise anything. Unfortunately, I'm not aware of any workaround for this problem.

Children
No Data
Related