Hi,
We are using AWS FreeRTOS and we have a custom hardware (CC3220SF). When the device wants to switch off the Wi-Fi and before that we are trying to disconnect from AP the application gets hanged in Network_IF_DisconnectFromAP() function. After going through the code of Network_IF_DisconnectFromAP() function there is while loop which checks if the device is disconnected or not for every 1 second as shown below. I feel if the NWP disconnects and connects back within 1 second it is not coming out of the while loop.
long Network_IF_DisconnectFromAP(void)
{
long lRetVal = 0;
if (IS_CONNECTED(g_ulStatus))
{
lRetVal = sl_WlanDisconnect();
if (0 == lRetVal)
{
while (IS_CONNECTED(g_ulStatus))
{
usleep(1000);
}
return lRetVal;
}
else
{
return lRetVal;
}
}
else
{
return lRetVal;
}
}
Device |
Amazon FreeRTOS -> 202002 |
FreeRTOS kernel V10.3.0 |
FreeRTOS OTA V1.1.1 |
NA |
FreeRTOS MQTT V2.1.1 |
SL Host Driver Version 2.0.1.27 |
sp_3.14.0.0_2.0.0.0_2.2.0.7.bin |
sp_3.14.0.0_2.0.0.0_2.2.0.7.bin |
v2_10_00_04 |
Please suggest a solution for this, also check the logs pasted below. The application gets hanged after Post connectionAsyncEvent below.
411072.689 - 16 1491 [Tmr Svc] [INFO ][DEMO][1491] [Debug] Post connectionAsyncEvent
411078.689 - 17 1502 [Tmr Svc] [INFO ][DEMO][1501] Device disconnected from the AP on application's request
411078.689 -
411078.689 -
411307.689 - 18 1774 [Tmr Svc] [INFO ][DEMO][1774] Device disconnected from the AP on an ERROR..!!
411307.689 -
411307.689 -
411594.689 - 19 2061 [Tmr Svc] [INFO ][DEMO][2061] [WLAN EVENT] STA Connected to the AP: BSIoT , BSSID: 18:64:72:5c:b2:4d
411594.689 -
411594.689 -
411609.689 - 20 2075 [Tmr Svc] [INFO ][DEMO][2075] [NETAPP EVENT] IP Acquired: IP=172.26.253.153 , Gateway=172.26.0.1
411609.689 -
411609.689 -
411619.689 - 21 2076 [Tmr Svc] [INFO ][DEMO][2076] [Debug] Post connectionAsyncEvent