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.

CC2640R2F: MSG_BUFFER_NOT_AVAIL status

Part Number: CC2640R2F
Other Parts Discussed in Thread: CC2640

Hi,

I have to send more packet of 200 bytes, if I see the btsnoop_hci log when I send the third packet I send 30 bytes and the call:

GATTServApp_ProcessCharCfg

return MSG_BUFFER_NOT_AVAIL.
How can I do resolve it running the GATTServApp_ProcessCharCfg only when I have the buffer available?
Thanks.

Best regards.

  • Hi Giuseppe,

    I would suggest implementing a retry mechanism so that if a packet is not sent out due to the buffer space you can retry. You can also look into using Indications to ensure your packets are received (the stack should retry indications until the packets are acknowledged by the recipient).

    Have you also adjusted MAX_NUM_PDU and MAX_PDU_SIZE to ensure a higher throughput? You can also look at using Data Length Extensions as well.

    Hopefully this helps!

  • Hi,

    I don't understand the MSG_BUFFER_NOT_AVAIL. 

    I have an App on the smartphone that it sends a data request at the CC2640, so the CC2640 reads the first 200 bytes from the uart and it sends the 200 bytes packet at the app, after the app sends a second request, the CC2640 read the second 200 bytes from the uart an it sends the packet to the app and so on. The number of the packets can be one, two, thirty, forty, one hundred,..... 

    When the CC2640 sends the packet at the app, the buffer space is not freed?

    why is it no longer available on the fourth delivery?

    Thanks.

    Best regards.

  • Hi,

    if I increase the size of the heap, the number of packets I send increases. With Heap size = 6000 I send 8 packets.

    If I check the heap with ICall_getHeapMgr GetMetrics I have:


    pBlkMax pBlkCnt   pBlkFree   pMemAlo    pMemMax   pMemUB  totalFreeSize  largestFreeSize

    72               65              6            4152            4324         4408           1724                 1456
    80               70             10           4340            4796         4856           1536                  1080
    84               75             14           4528            4984         5120           1348                   892
    89               80             18           4716            5172         5308           1160                   704
    94               85             22           4904            5360         5496            972                    516
    99               90             26           5092            5548         5684           784                     328

    Every time a packet is sent, pMemMax increases, but this value must be < heap size, so I think when this value is > heap size I don't send any other packets.


    How can I free the allocated memory block?

    Thanks.

    Best regards.

  • The stack should free the memory block when it's done processing the write. To view the stack's HEAP usage, can you define HEAP_MGR_METRICS and see if the memory is freed?

    More info here: https://dev.ti.com/tirex/content/simplelink_cc2640r2_sdk_4_30_00_08/docs/blestack/ble_user_guide/html/ble-stack-3.x-guide/debugging-index.html?highlight=heap#debugging-common-heap-issues 

    You may just be queuing data faster than the device can send it to the central.

  • Hi,

    I solved, I use the call_malloc to allocate space at any iteration but in some execute condition the code doesn't call call_free to deallocate space.

    Thanks.

    Best regards.