Hi,
My application is hanging inside the sl_Stop() function call.
The application is currently configured to restart the WiFi link once in 5 seconds or so, just to test the sl_Stop() issue.
The semaphore lock is being used to wait for two other tasks to complete their network activity.
Please see code below which shows the sequence of re-initialization of the WiFi link:
***********************************************************************************************
if ((ret = osi_LockObjLock(&pLockAp , OSI_WAIT_FOREVER)) <0)
{
UART_PRINT("IPSM Error locking Object...\n\r");
}
MAP_UtilsDelay(10000000/2.5);
MAP_UtilsDelay(10000000/2.5);
lRetVal = Network_IF_DeInitDriver();
if(lRetVal < 0)
{
UART_PRINT("Failed to stop SimpleLink Device...\n\r");
if ((ret = osi_LockObjUnlock(&pLockAp)) <0)
{
UART_PRINT("IPSM Error Unlocking Object...\n\r");
}
continue;
}
Network_IF_ResetMCUStateMachine(); // Reset The state of the machine
// Start the driver
lRetVal = Network_IF_InitDriver(ROLE_STA);
if(lRetVal < 0)
{
UART_PRINT("Failed to start SimpleLink Device...\n\r");
// MAP_UtilsDelay(10000000/2.5); // 2 seconds delay --TODO Raj
// MAP_UtilsDelay(10000000/2.5); // 2 seconds delay --TODO Raj
if ((ret = osi_LockObjUnlock(&pLockAp)) <0)
{
UART_PRINT("IPSM Error Unlocking Object...\n\r");
}
continue;
}
lRetVal = Network_IF_ConnectAP(g_cWlanSSID,g_SecParams);
if(lRetVal < 0)
{
UART_PRINT("Connection to an AP failed...\n\r");
// MAP_UtilsDelay(10000000/2.5); // 2 seconds delay --TODO Raj
// MAP_UtilsDelay(10000000/2.5); // 2 seconds delay --TODO Raj
if ((ret = osi_LockObjUnlock(&pLockAp)) <0)
{
UART_PRINT("IPSM Error Unlocking Object...\n\r");
}
continue;
}
// Get the IP address acquired by device
lRetVal = Network_IF_IpConfigGet(&ulIP,&ulSubMask,&ulDefGateway,&ulDns);
if(lRetVal < 0)
{
UART_PRINT("Getting IP Address failed...\n\r");
// MAP_UtilsDelay(10000000/2.5); // 2 seconds delay --TODO Raj
// MAP_UtilsDelay(10000000/2.5); // 2 seconds delay --TODO Raj
if ((ret = osi_LockObjUnlock(&pLockAp)) <0)
{
UART_PRINT("IPSM Error Unlocking Object...\n\r");
}
continue;
}
UART_PRINT("Device IP Address is %d.%d.%d.%d \n\r\n\r",
SL_IPV4_BYTE(ulIP, 3),SL_IPV4_BYTE(ulIP, 2),
SL_IPV4_BYTE(ulIP, 1),SL_IPV4_BYTE(ulIP, 0));
if(SL_IPV4_BYTE(ulIP, 3) == 0) // If IP address is "0.<something>.<something>.<something>", it is not valid.
{
UART_PRINT("Did not obtain IP Address...\n\r");
//Signal to any waiting task that net connection is down
net_connect = FALSE;
// MAP_UtilsDelay(10000000/2.5); // 2 seconds delay --TODO Raj
// MAP_UtilsDelay(10000000/2.5); // 2 seconds delay --TODO Raj
if ((ret = osi_LockObjUnlock(&pLockAp)) <0)
{
UART_PRINT("OTA Error Unlocking Object...\n\r");
}
continue;
}
// Get the serverhost IP address using the DNS lookup
lRetVal = Network_IF_GetHostIP((char*)IPSM_SERVER, &ulDestinationIP);
if(lRetVal < 0)
{
// MAP_UtilsDelay(10000000/2.5); // 2 seconds delay --TODO Raj
// MAP_UtilsDelay(10000000/2.5); // 2 seconds delay --TODO Raj
UART_PRINT("DNS lookup failed...\n\r",lRetVal);
if ((ret = osi_LockObjUnlock(&pLockAp)) <0)
{
UART_PRINT("OTA Error Unlocking Object...\n\r");
}
continue;
}
// ulDestinationIP = 0;//TODO Raj
UART_PRINT("IP address passed to create connection is %ul",ulDestinationIP);
lRetVal = Network_IF_GetHostIP((char*)"redmine-server.dyndns.org", &OtaIP);
if(lRetVal < 0)
{
UART_PRINT("DNS lookup failed...\n\r",lRetVal);
// MAP_UtilsDelay(10000000/2.5); // 2 seconds delay --TODO Raj
// MAP_UtilsDelay(10000000/2.5); // 2 seconds delay --TODO Raj
if ((ret = osi_LockObjUnlock(&pLockAp)) <0)
{
UART_PRINT("OTA Error Unlocking Object...\n\r");
}
continue;
}
//Signal to any waiting task that net connection is up
net_connect = TRUE;
if ((ret = osi_LockObjUnlock(&pLockAp)) <0)
{
UART_PRINT("OTA Error Unlocking Object...\n\r");
}
osi_Sleep(100);
**********************************************************************************
There is a sl_Stop() call that happens inside the Network_IF_DeInitDriver() function. I have a print before the App enters the sl_Stop() function and a print after the sl_Stop function. The print before the sl_Stop() function appears on the screen but not the print after the sl_Stop() function call. This happens randomly when the App runs for about half an hour or so.
Can someone please help resolve this issue?
thanks and regards,
Rajkumar