AnsweredAssumed Answered

How do I create a long GATT characteristic value on the QN9080?

Question asked by Ian MacDonald on May 22, 2018
Latest reply on May 28, 2018 by Gerardo Rodríguez

The suite of example projects for the QN9080 includes a variety of use cases, but none of them covers using long attribute values. According to the BLE spec, GATT attribute values should be allowed up to 512 bytes. There is even a comment to this effect within source/common/gatt_db/macros/gatt_db_macros.h:

* Characteristic Value Attribute Value
* - max 512 bytes

However, when I attempt to modify any gPermissionFlagReadable_c characteristic to increase its size beyond 123 bytes, the debugger ends up in the HardFault_Handler as soon as my phone tries to read it the value.



PRIMARY_SERVICE_UUID128(service_temperature, uuid_service_temperature)
    CHARACTERISTIC(char_temperature, gBleSig_Temperature_d, (gGattCharPropRead_c))
        VALUE(value_temperature, gBleSig_Temperature_d, (gPermissionFlagReadable_c), MAX_CHAR_SIZE, 0x00)



static const uint8_t TMP_TEMP[512] = { ... };

bleResult_t Tms_RecordTemperatureMeasurement (uint16_t serviceHandle, int16_t temperature)
    // ...

    result = GattDb_WriteAttribute(handle, MAX_CHAR_SIZE, (uint8_t*)TMP_TEMP);

    // ...


As long as MAX_CHAR_SIZE <= 123, the communication works fine. As soon as I cross that threshold, the board halts and my phone is consequently disconnected. The gatt_server_interface.h doesn't appear to expose the paging offset from Read Blob outlined in BLE Core 4.2 section, leaving me to assume that this is all handled internally to the GattDb library.


Can anyone help me figure out what I've done wrong here?