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

Largest allowed setting for variable length characteristic?

I'm using the nRF51822 with the S110 soft device. When specifying the maximum size of a variable length characteristic notify property (the max_len field of the ble_gatts_attr_t structure), what is the maximum value that can be used? Looking at other questions on the Nordic Developer Zone it seems as if this field should be set to no higher than 20 bytes, but it would be more efficient for me to deal with larger packet sizes. Can the constant BLE_GATTS_VAR_ATTR_LEN_MAX (which is 512) be used as the maximum size for this field?

What are the implications of using packets larger than 20 bytes, if it is possible?

Thanks.

Parents
  • You can have an attribute that is up to BLE_GATTS_VAR_ATTR_LEN_MAX bytes long (this is a spec limitation), but you can send only 20 bytes in each Notification. The size of a notification is given by spec to be ATT_MTU-3 (see Vol 3, part F, section 3.4.7.1), and with the S110, ATT_MTU is 23 bytes and not changeable.

    Whether it makes sense to have an attribute that is more than 20 bytes is hence really an application decision. Beware that a notification doesn't have an offset, so any notification is expected to send only the 20 first bytes of the attribute.

Reply
  • You can have an attribute that is up to BLE_GATTS_VAR_ATTR_LEN_MAX bytes long (this is a spec limitation), but you can send only 20 bytes in each Notification. The size of a notification is given by spec to be ATT_MTU-3 (see Vol 3, part F, section 3.4.7.1), and with the S110, ATT_MTU is 23 bytes and not changeable.

    Whether it makes sense to have an attribute that is more than 20 bytes is hence really an application decision. Beware that a notification doesn't have an offset, so any notification is expected to send only the 20 first bytes of the attribute.

Children
No Data
Related