Page 1 of 1

Wifi sample SimpleWifiServer hangs

Posted: Thu Jul 13, 2017 9:07 am
by boylesg
The example sketch hangs at the indicated line of code.

Code: Select all

void setup()
{
    Serial.begin(115200);
    pinMode(5, OUTPUT);      // set the LED pin mode

    delay(10);

    // We start by connecting to a WiFi network

    Serial.println();
    Serial.println();
    Serial.print("Connecting to ");
    Serial.println(ssid);

    [b]WiFi.begin(ssid, password);[/b]
I tracked it down to the following line of code in WifiGeneric.cpp:

Code: Select all

static bool _esp_wifi_started = false;

static bool espWiFiStart(){
    if(_esp_wifi_started){
        return true;
    }
    if(!wifiLowLevelInit()){
        return false;
    }
    [b]esp_err_t err = esp_wifi_start();[/b]

    if (err != ESP_OK) {
        log_e("esp_wifi_start %d", err);
        wifiLowLevelDeinit();
        return false;
    }
    _esp_wifi_started = true;
    return true;
}
Has anyone else had this problem and found a fix?