Attributes from a GATT database located on a GATT Server (usually a BLE peripheral device) have a maximum allowed value size of 512 bytes.
While is it recommended to design small attribute value sizes (usually a few bytes), situations arrive where longer attributes are necessary. For example, characteristics whose values contain long strings will certainly need a lot of bytes compared to numbers: Device Name, Manufacturer Name etc.
A problem with such attributes is the limited payload size of BLE packets. For example, for an ATT packet, after stripping down all headers and metadata, we are left with 23 bytes of actual ATT data that an over-the-air packet can contain. If the ATT layer requires sending more than 23 bytes in a certain transaction, the L2CAP layer, which lies immediately under ATT, cuts the data in 23-byte slices and sends multiple packets over the air, because of the radio limitations imposed by the standard.
Because of that, the default size of an ATT packet is 23 (this is abbreviated as ATT_MTU), and all BLE devices must be capable of working with at least this default size. It is possible for some devices to support an ATT_MTU value greater than 23, but in that case two things need to be considered:
When designing a BLE app, one must keep in mind that a lot of BLE devices do not support the MTU exchange feature (usually due to resource constraints), so it is quite possible it will work with the default value.
See Bluetooth Core 4.1 specification, vol. 3, section 3.4.2 for more information.
Continue reading: Part 2