[BLE] Unknown GATT event 0x5

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

cross mob
user_2112781
Level 4
Level 4
10 likes received 10 likes given 5 likes given

After using the BLE stack for a while, I get a GATT event callback with the code 0x5. This is not documented.

When looking at the header wiced_bt_gatt.h, I see a structure related to the GATT_CONGESTION_EVT, this event is not in the enumeration wiced_bt_gatt_evt_t ​but I guess this is the 0x5 event ?

0 Likes
5 Replies
JacobT_81
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

This event means that you're running low in tx buffers. BLE transmissions wait for connection events which occur every 7.5ms to 4000ms. Standard BLE can only send 20 bytes per connection event. If you transmit data in between connection events, it goes into a buffer until the next connection event can push it out. If you try to push too much in between connection events, you'll overflow this buffer.

Jacob

Thank you for the answer.  What would be the limit for the TX queue?

0 Likes

There are a couple variables associated with the tx queue size. Your MTU size, defined buffer count, size, etc. I'll have to get back to you once I find an exact number.

For now, the best solution is timing your data pushes to synchronize with connection events i.e. start a timer on the same interval as (or a multiple of) the connection events and push data once per loop into the queue. That should avoid this error.

Jacob

This sounds more like a workaround, I guess that could work but my question is: how could I change the TX buffer size to be sure never to exceed it ? I always send BLE commands one after another, e.g. I will only send a Request after a Response has been received, so it should not be congested. Of course I am connected to multiple devices (8) but the TX queue cannot be so small. Waiting for your findings 🙂

I'm also receiving wiced_bt_gatt_evt_t event == 0x5 from GATT callback. (SDK 4.0.1)
Is there any update?

0 Likes