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

How to support BLE_GATTS_VLOC_USER ?

I have found the bellowing code which was in s130/ble_gatts_struct_seriallization.c of nRF51_SDK_10.0.0 : ( ble_gatts_attr_md_enc)


/* serializer does not support attributes on stack */

if (p_attr_md->vloc != BLE_GATTS_VLOC_STACK)    {
   err_code = NRF_ERROR_INVALID_PARAM;
}

Is that to say the s130 softdevice only support BLE_GATTS_VLOC_STACK, not the BLE_GATTS_VLOC_USER ?

Further more how to support BLE_GATTS_VLOC_USER?

What is the meaning "Attribute Value is located in user memory. This requires the user to maintain a valid buffer through the lifetime of the attribute, since the stack will read and write directly to the memory using the pointer provided in the APIs." ??

  • BLE_GATTS_VLOC_USER is not supported, which means that the GATT values need to be stored in the softdevice's RAM space (BLE_GATTS_VLOC_STACK), but as I mentioned in initial reply, this should not be a problem with the newer softdevices as you can a increase the default RAM allocation for the stack if needed.

    However, the /* serializer does not support attributes on stack */" comment is a bit confusing. You can see from the code that BLE_GATTS_VLOC_STACK is in fact the only supported option, but since it says "on stack" I'm wondering if it possibly could be referring to the call stack, although it doesn't make much sense. I will report this as a bug internally.

Related