[BLE] Stack pending event BTM_ENABLED_EVT 0x2

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

Very often when trying to connect to a device, I get after several second a BTM_ENABLED_EVT with the status code 0x2 (timeout) and then a connection UP. What is really happening and how to prevent this ? It really slows down the connection time.

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

This doesn't appear to be a timeout, but rather a BTM_BUSY error which can be thrown as a result of numerous different flags throughout the stack.

The BTM_ENABLED_EVT should only be thrown on initialization of the stack--after that this should not be called. If it is called multiple times you may be triggering the watchdog somewhere.

Jacob

Yes you are right, it is WICED_PENDING error code. I only initialise the stack once at the beginning of my program and get a BTM_ENABLED_EVT with status WICED_SUCCESS (0x00). It is only after some time after several connection/disconnection that I get this event when I try to connect to a device. I launch wiced_bt_gatt_le_connect and around 6-7 seconds later I receive a BTM_ENABLED_EVT event with error code WICED_PENDING (0x2) and around one second later I receive a connection UP event.

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

If you're getting multiple BTM_ENABLED_EVT, it's very likely that you're rebooting in that 6-7 second gap. I can't say why this would be happening without taking a look at the code.

Jacob

0 Likes

I got same 0x02 in BTM_ENABLED_EVT for restful_smart_server & bt_smartbridge demo in stock SDK-3.7.0.

Maybe jakewtorres​ could also take a look at their source code.

Platform : BCM94343W (SPIL N08 module)

0 Likes

Would it be a stack overflow problem ? Something wrong in the BLE code ?

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

I'm unable to replicate this so far. Still looking into it.

marmottus​ What value does your wiced_bt_gatt_le_connect function return? What hardware and what SDK are you using?

xavier@candyhouse​ Do you see the 0x02 status on the very first BTM_ENABLED_EVT or is it a later event like is happening to marmottus​?

Jacob

dkumar

0 Likes

Once I saw it on first BTM_ENABLED_EVT.
But now I can't reproduce it either...

0 Likes

Doesn't happen to me for now with 3.7.0