Sending multiple notification with ble

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

cross mob
lizhc_1333676
Level 1
Level 1

I continuous send 256Bytes to the phone in the notification mode.A packet is 20bytes and last packet is 16bytes.But the test failed,Only we can get three packets on the phone.The code stopped in this line: 

   

    while(CyBle_GattGetBusyStatus() == CYBLE_STACK_STATE_BUSY); 

   

On the other hand,What is the maximum number of packets that CYBLE could process per connection event in  notification mode?

   

thanks.

0 Likes
1 Solution
Anonymous
Not applicable

Hi,

   

You need to take care of two things (in case you are not):

   

1) Check if the stack memory is free to queue the notification data you send from application

   

Before sending notifications, check if (CyBle_GattGetBusyStatus() == CYBLE_STACK_STATE_FREE). If yes, then send the notification, else wait for the memory to be cleared.​

   

 

   

2) You should call CyBle_ProcesEvents() atleast once, after calling the GattsNotification API. Calling multiple GattsNotification API before calling CyBle_ProcessEvents does not process the notification and only queues it, which overflows the internal memory.

   

 

   

Additionally, you can set a higher MTU for the notification characteristic and let client request to update the MTU size.

View solution in original post

0 Likes
3 Replies
Anonymous
Not applicable

Hi,

   

If you add some delay betweene each packets, are you able to send the notifcaitons properly? Can you reduce the connection interval and see if it is working?

   

Also, the max. MTU Size is 512 Bytes,

   

Regards,

   

-Madhu Sudhan

0 Likes
Anonymous
Not applicable

Hi,

   

You need to take care of two things (in case you are not):

   

1) Check if the stack memory is free to queue the notification data you send from application

   

Before sending notifications, check if (CyBle_GattGetBusyStatus() == CYBLE_STACK_STATE_FREE). If yes, then send the notification, else wait for the memory to be cleared.​

   

 

   

2) You should call CyBle_ProcesEvents() atleast once, after calling the GattsNotification API. Calling multiple GattsNotification API before calling CyBle_ProcessEvents does not process the notification and only queues it, which overflows the internal memory.

   

 

   

Additionally, you can set a higher MTU for the notification characteristic and let client request to update the MTU size.

0 Likes
Anonymous
Not applicable

If you are doing an Android app make sure you have the connection priority set to low latency if you don't already. You can set it back to balanced or low power after the transfer is done.

0 Likes