Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If esp8266 cannot connect to wifi at any reason, the system crashes sporadically #1

Closed
urmel79 opened this issue Dec 8, 2019 · 1 comment

Comments

@urmel79
Copy link
Owner

urmel79 commented Dec 8, 2019

  • sporadic system crashes especially when WiFi is not connected
  • OTA updates do not work and also lead to system crash and reboot
@urmel79 urmel79 changed the title If esp8266 cannot connect to wifi at any reason, the program stucks If esp8266 cannot connect to wifi at any reason, the system crashes sporadically Dec 15, 2019
@urmel79
Copy link
Owner Author

urmel79 commented Dec 15, 2019

[bug] external interrupts conflict with WiFi connection attempts or OTA updates and lead to sporadic crashes!
[fix (workaround)] disable external GPIO interrupts temporarily

void connectToWifi() {
  Serial.println("Connecting to Wi-Fi...");
  WiFi.mode(WIFI_STA);  // client mode

  // [bug] external interrupts conflict with wifi connection attempts and
  // ota updates and lead to sporadic crashes!
  // [fix (workaround)] disable external interrupts temporarily
  // reference https://www.mikrocontroller.net/topic/460256#5573848
  ETS_GPIO_INTR_DISABLE();
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);

  // enable external interrupts again
  ETS_GPIO_INTR_ENABLE();
}

reference https://www.mikrocontroller.net/topic/460256#5573848

@urmel79 urmel79 closed this as completed Dec 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant