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.

CC2564MODA: A2DP + BLE : Memory buffer size full when streaming audio + sending BLE packet

Part Number: CC2564MODA
Other Parts Discussed in Thread: CC2564, TM4C123GH6PM

Hello Ti support team,

We facing some issue using CC2564 in dual-mode bluetooth with Bluetopia stack.  Our application need to regulary send BLE packet without any data or time loss. These packet are send in a 1ms thread where we call the function GATT_Handle_Value_Notification() function. All is working well so far and we correctly get all the data in our android application. The streaming audio is working fine as well when we don't send BLE packet.

The problem occurs when we trying to stream audio through A2DP profile and send BLE packet at the same time. After a moment, we can hear some short audio cut-off and GATT_Handle_Value_Notification() return the error message BTPS_ERROR_INSUFFICIENT_BUFFER_SPACE. After that, we are not able to send any more BLE packets (even if the status callbacck etGATT_Connection_Device_Buffer_Empty is called)

By using the function BTPS_QueryMemoryUsage. I observed the following result : 

Memory usage when nothing run (NO BLE and NO A2DP) : Used = 5032 / Free = 10332 / MaxFree = 10332

Memory usage when only BLE : Used = 5032 / Free = 9152/ MaxFree = 9060

Memory usage when  A2DP :  Used = 13004 / Free = 2360/ MaxFree = 2236

Memory usage when  A2DP + BLE:  Used = 13152/ Free = 2212 / MaxFree = 2200

We can't allocate more memory because our SRAM allocation is already full...

My question are :

  • Is this "normal" that the memory used when running nothing is to 5032 ? Can we optimize something to reduce this value ? 
  • If not, is this possible to reduce the A2DP memory usage by modify some parameter (from SBC codec or by reduce audio quality) ? 

MCU ref : TM4C123GH6PM

It will be so great if you can get me some information about this issue.

Thanks in advance ! 

  • Hi , We have assigned your query to BT expert. We will get back to you shortly.

    Thanks,
    Saurabh
  • Mickael,

    How important is that 1ms interval for the BLE packets? 1ms seems pretty low, which could lead to the buffer getting backed up until it runs out of space. If possible, I recommend experimenting with a higher amount of time as your application allows.
  • Hi DFZ,

    Actually I'm processing data in this 1ms Task but I only call GATT_Handle_Value_Notification() when I have enough data (approximatively all 16ms).
    By the way I tried to reduce the bitpool of the SBC codec (set at 35) and so reduce the bitrate of the streaming audio.

    This allowed me to reduce the SBC_BUFFER_SIZE and increase the MEMORY_BUFFER_SIZE used for KERNEL. It seems to works pretty well with this configuration but the problem still occurs after several minutes of A2DP + BLE.

    Now I suppose I need to find a good compromise between quality audio streaming and BLE data rate.
    So my question are still the same :
    Is this "normal" that the memory used when running nothing is to 5032 ? Can we optimize something to reduce this value ?
    If not, is this possible to reduce the A2DP memory usage by modify some parameter (from SBC codec or by reduce audio quality) ?

    Thanks in advance !
  • Mickael Ben soussan said:
    Is this "normal" that the memory used when running nothing is to 5032 ? Can we optimize something to reduce this value ?

    Yes, since the scheduler for the BT stack is running at this time. This varies by MCU.

    Mickael Ben soussan said:
    If not, is this possible to reduce the A2DP memory usage by modify some parameter (from SBC codec or by reduce audio quality) ?

    The audio quality parameters are determined on the A2DP source side, so it is not possible to change these from the sink. Normally if memory is a concern A3DP can be used, but that does not work in this case since you are also using the BLE. Unfortunately, I can not think of another way to reduce memory consumption.

  • Thanks for this quick answer DFZ !

    Fine I will try to play with some parmaters and will back to you if I find something that fit with my problem.

    Thanks a lot, I will back to you as short as I possible =)
  • Hi TI team,

    I've got some news about my current issue. Reducing my bitpool to 35 made works pretty well my application on some android support (Smartphone/Tablet) .

    The problem is that on some android support (I'm testing on tablet Huawei btv-w09 ), I got a lot of BLE data packet loss when I start streaming audio. On the other side, I test with a tablet Galaxy tab s2 and all is working properly and without any loss or disconection.

    These two tablet are pretty recent, use bluetooth 4.1 and accept an connection interval of 15ms. I don't understand where the difference can come from. 

    Did you already heard about a similar problem ? 

    Did you have any track to follow in order to fix this issue ? 

    I already try a lot of fix (A LOT !) but I'm really desperate right now.

    Thanks in advance. 

    Mickael Ben soussan