Page 1 of 1

ESP32 freezes out of nowhere. Destination Host Unreachable

Posted: Thu Jul 18, 2019 8:44 am
by GeorgeFlorian1
OS: Linux Mint 19.1
Board: ESP32-EVB
IDE: PlatformIO IDE
platform = https://github.com/platformio/platform-espressif32.git

Hello !

I am using ESPAsyncWebServer to serve some web-pages and to control the 2 relays that are on the board.
The ESP is configured with a static IP:

Code: Select all

if(!WiFi.config(local_IP_STA, gateway_STA, subnet_STA, local_IP_STA, primaryDNS)) {
         logOutput((String)"Couldn't configure STATIC IP ! Starting DHCP IP !");
       }
       delay(50);
       WiFi.begin(x[0].c_str(),x[1].c_str());
The issue I am having is that the ESP freezes randomly with no DEBUG message. I have set the DEBUG level at Verbose: build_flags = -DCORE_DEBUG_LEVEL=5.

I am also using the following methods in order to prevent the ESP from freezing, but they don't help at all. With or without them I can't make the project reliable.

Code: Select all

  enableCore1WDT();
  esp_wifi_set_ps (WIFI_PS_NONE);
I get the following browser error:

Code: Select all

This site can’t be reached
ERR_ADDRESS_UNREACHABLE
And pinging the ESP ends with Destination Host Unreachable.

The issue I am experiencing makes the ESP a very unreliable board. I don't know if it's the ESP at fault or the Server's Library.

The `void loop()` is pretty straight forward:

Code: Select all

void loop(){
  if (shouldReboot) {
    logOutput("Restarting in 5 seconds...");
    delay(5000);
    server.reset();
    ESP.restart();
  }
  currentTimeRelayOne = millis();
  currentTimeRelayTwo = millis();

  if(startTimeRelayOne != 0 && !needManualCloseRelayOne) {
    if ((currentTimeRelayOne - startTimeRelayOne) > (Delay1.toInt()*1000)) {
      digitalWrite(RELAY1,LOW);
      status1 = "OFF";
      logOutput((String)relay1 + " closed");
      startTimeRelayOne = 0;
    }
  }

  if(startTimeRelayTwo != 0 && !needManualCloseRelayTwo) {
    if ((currentTimeRelayTwo - startTimeRelayTwo) > (Delay2.toInt()*1000)) {
      digitalWrite(RELAY2,LOW);
      status2 = "OFF";
      logOutput((String)relay2 + " closed");
      startTimeRelayTwo = 0;
    }
  }
  delay(2);
}

Re: ESP32 freezes out of nowhere. Destination Host Unreachable

Posted: Mon Dec 30, 2019 7:57 am
by NivruttiMahajan
Hey GeorgeFlorian1,
I am also facing the same issue, have u solved it?