This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2541 GATT_WriteLongCharValue causes memory allocation error?!

Other Parts Discussed in Thread: CC2541

Hello,


I'm currently working on a project with the TI CC2541 keyfob which is my central device. I have the problem that the GATT_WriteLongCharValue causes a memory allocation error (0x13).

I have to send 211 bytes of data to a peripheral. The "gattPrepareWriteReq_t" states that memory has to be allocated for "pReq->pValue" but that doesn't work and I don't know why.


Here is my configuration:

gattPrepareWriteReq_t pPrepWriteReq;

pPrepWriteReq.handle = server_data_handle;

pPrepWriteReq.len = len;

pPrepWriteReq.offset = 0;

pPrepWriteReq.pValue = osal_mem_alloc(len);

osal_memcpy(pPrepWriteReq.pValue, hlpData, len);


status = GATT_WriteLongCharValue( connHandle, &pPrepWriteReq, keyfobapp_TaskID);

Thanks in advance for your help!!


Best regards,

Hannes

  • Hi,

    If you are encountering bleMemAllocError (0x13), try increasing your heap length (INT_HEAP_LEN). In addition to the memory that your app supplies to GATT_WriteLongCharValue, this fxn will itself allocate memory. If this alloc fails, you will get the aforementioned error code.

    Best wishes
  • Hi,

    I have found a solution. I've changed my compiler optimization level to high which helps against the memory problem. I've also changed the INT_HEAP_LEN.

    The second problem was that I was not able to send more than 80 Bytes of data with one GATT_WriteLongCharValue call. I think thats the problem of the FIFO buffer which is limited to max 90 Bytes, right?

    Found here another discussion:
    e2e.ti.com/.../475553

    Best regards,
    Hannes