Tool/software:
I use the following code to shut down the NWP. In my case, SL_STOP_TIMEOUT=15000, but sl_Stop() takes the entire time regardless of what I give it. Also, sl_Stop() returns 0 whether it times out or not.
Without at least a 3ms delay between sl_WlanDisconnect() and sl_Stop(), sl_Stop() will consume the entire timeout time that it is given.
static void StopWifiTask( void )
{
debug_console_Log(WIFI, LOG_INFO, "StopWifiTask()");
StopRetryTimeout();
StopWifiTimeout();
aws_iot_DisonnectFromAwsIot();
sl_WlanDisconnect();
Task_sleep(6); // This delay is required so that sl_stop() call won't hang & time out. Not sure why. 2ms is too short, 3ms seems to do the trick
sl_Stop(SL_STOP_TIMEOUT);
}