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

Wi-Fi Combo

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

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
250 likes received 100 likes received 50 likes received
Employee

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

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

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
250 likes received 100 likes received 50 likes received
Employee

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
JeGu_2199941
Level 5
25 likes received 10 likes received 10 likes given
Level 5

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
user_2112781
Level 4
10 likes received 10 likes given 5 likes given
Level 4

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

0 Likes
JacobT_81
Employee
250 likes received 100 likes received 50 likes received
Employee

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
JeGu_2199941
Level 5
25 likes received 10 likes received 10 likes given
Level 5

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

0 Likes
user_2112781
Level 4
10 likes received 10 likes given 5 likes given
Level 4

Doesn't happen to me for now with 3.7.0