Cy_BLE_GATTS_SendNotification() = CY_BLE_ERROR_MEMORY_ALLOCATION_FAILED

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Panometric
Level 5
Level 5
100 sign-ins 100 replies posted 10 solutions authored

My app sends about 10 notifications per second. Sometimes it gets CY_BLE_ERROR_MEMORY_ALLOCATION_FAILED from Cy_BLE_GATTS_SendNotification().


Should the memory allocated to the BLESS stack be increased and if so how is it done? I am using the COMPONENTS+=BLESS_HOST BLESS_CONTROLLER on the M4 configuration. 

Alternatively, what is the best course of action when this error is encountered?

 

0 Likes
1 Solution
Panometric
Level 5
Level 5
100 sign-ins 100 replies posted 10 solutions authored

@Yugandhar I was already doing it via a variable set from the stack callback CY_BLE_EVT_STACK_BUSY_STATUS event like the throughput example. 
But doing it directly like you said seems to work better. Must be a race condition there. 

View solution in original post

0 Likes
2 Replies
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello,

Before sending a Notification from the Server could you please check whether the stack is busy or not. Send the notification when the stack is free as shown in below.

if(Cy_BLE_GATT_GetBusyStatus(appConnHandle.attId) == CY_BLE_STACK_STATE_FREE)
{
/* Send notification data to the GATT Client*/

Cy_BLE_GATTS_SendNotification();
}

Thanks,
P Yugandhar.

0 Likes
Panometric
Level 5
Level 5
100 sign-ins 100 replies posted 10 solutions authored

@Yugandhar I was already doing it via a variable set from the stack callback CY_BLE_EVT_STACK_BUSY_STATUS event like the throughput example. 
But doing it directly like you said seems to work better. Must be a race condition there. 

0 Likes