4 years, 10 months ago.

Max Size Allowed for a GATT Characteristic in MBED CORDIO API?

I am writing a BLE based bootloader DFU service and one of the questions I had since we are streaming the firmware upgrade OTA, I am wondering what is the maximum size I can set for the GATT Characteristic which receives the firmware data? I saw some other MBED forum questions that it is driven by the MTU size, however if the default in CORDIO API is set to 23, how can I increase this?

Also I plan on streaming this bootloader firmware using an IOS/Android device app, do these devices have their own pre-defined MTU Size, that I would need to adhere to?

Thanks, Ajay.

Question relating to:

The nRF52840 Development Kit is a single-board development kit for Bluetooth low energy, ANT, 802.15.4, and 2.4 GHz proprietary applications using the nRF52840 SoC.

1 Answer

4 years, 10 months ago.

Hi Ajay,

Mbed OS provides MTU configuration in json file, please refer here, https://github.com/ARMmbed/mbed-os/blob/15b5b5da23b970d397e7d94bfcda7e38fa3870c8/features/FEATURE_BLE/targets/TARGET_CORDIO/mbed_lib.json#L50

You can overwrite this config in mbed_app.json by

include the mbed library with this snippet

{
    "target_overrides": {
        "NRF52840_DK": {
            "cordio.desired-att-mtu": 256,
            ...
        },
    }
    ...
}

Regards,

Desmond

Accepted Answer

Hi Desmond,

Thanks so much for your response. I was wondering is there an upper limit for this setting? In the event we set the desired MTU, is it possible IPhone/Android not honor this request?

Thanks, Ajay

posted by Ajay Kashyap 02 Jul 2019

Hi Ajay,

The desired MTU is between 23 and 517, you can check the "help" field in mbed_lib.json.

If the MTU size is set, there will be a negotiation procedure happening after connection established, and the final MTU size depends on master's decision, which means the decision is up to iPhone/Andriod in your case.

Regards,

Desmond

posted by Desmond Chen 02 Jul 2019

Hi Desmond,

Thanks for confirming and helping me better understand the negotiation process. I was wondering back to my original question, what should be the size of the Characteristic that I write the firmware to, if IOS/Android would decide the MTU length. Apparently according the Bluetooth spec, the Maximum size of a Write Characteristic can be 512 bytes. I am a little confused about when transferring say blocks of 512 bytes of data from say IPhone/IOS how will the MTU affect the transfer size.

Thanks, Ajay

posted by Ajay Kashyap 03 Jul 2019