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

Writing more than 20 bytes (at a time) to a characteristic

By trial and error, I notice that I can only write 20 bytes to a characteristic, no matter how big I make ble_gatts_attr_t.max_len. A little googling reveals that this is a common limit in BLE and there are some special extended attributes to transfer larger blocks of data. Is there an app note or application example to do this?

Parents
  • The current MTU size of the S110 is 23 bytes, and when you remove the headers defined by the Bluetooth Specification, that leaves 20 payload bytes for write commands and notifications. All data sent with the current S110 therefore have to be split into 20 byte packages when writing or notifying.

    However, there is a concept of offsets, both when reading and notifying so it is possible to have a longer characteristic, and then read or notify 20 bytes in the middle of the value, and in that way sequentially transfer the entire characteristic. Depending on the platform on the peer device, this may either be handled transparently or have to be done manually. Since this is possible, the softdevice allows you to add a characteristic longer than 20 bytes.

    The Bluetooth specification also defines an operation you can use to write long characteristics atomically (Write Long), but this is not currently supported by the S110.

    The different operations possible on a characteristic is defined in the Bluetooth Core Specification, Volume 3, Part G, sections 4.8 to 4.11. It might be interesting to take a look at.

  • Hi Ole

    Does Nordic have any plans to increase the MTU size anytime soon?

Reply Children
No Data
Related