Closed Phil1988 closed 7 years ago
Oh, come on. This has been described so many times in the forum. Do study ESP8266 watchdog (do some search for "soft WDT reset") and apply at least one yield() in right place. BTW this has nothing to do with Arduino ESP8266 Core and is off-topic here :-(
Hello @Pablo2048 and thanks to you quick response. I found a lot of ideas that caused this problem (like power issue or use wdt_disable(); and wdt_enable();)
So can I just simply use the yield() -function every while loop to make it work? Will this cause a performance issue (i dont know how long the yield() needs)? Would it also work to disable the watchdog timer as long as the loop runs and start it afterwards?
I am completely new to ESP8266 so what would be the best (in view of performance) solution and what is the watchdog doing? (so what will not work if I stop the watchdog during the while loop?)
Thanks in advance and sorry that I cant find the solution/workaround in the forum.
Ok, where You did the search for this and how exactly does Your question look like that forum/google search engine did not find any related info? ( https://github.com/esp8266/Arduino/issues/2866 , https://forum.arduino.cc/index.php?topic=442570.0 , https://stackoverflow.com/questions/44100043/nodemcu-wdt-reset ) At least You have to readthedoc http://arduino-esp8266.readthedocs.io/en/latest/reference.html?highlight=yield#timing-and-delays ...
@Phil1988 your functions can't take too much time to execute without going back, because the wifi stack must be serviced. If you don't service it, you get mem corruption and blowups. There is a hardware wdt and a software wdt in place to assure you don't do this. This is not the right place to ask for help, this is an issue tracker for the core. Closing as off-topic, see #3655 .
Thanks to all. Just added a delay(0);
in my while loop. This stopped the endless software reset party 😄 Pretty strange...
Your delay(0) tip has rescued an old man, thanks! My tombstone would have the inscription "WDT broke his heart", except that I'm planning to be cremated.
Thank for posting your solution. Despite the snarky responses, there isn't a simple to find quick fix like your delay(0); suggestion. Cheers!
Hi, delay(0) consume time too !! a better solution is... some like this...
if ((millis() - tiempo) > 1000) { delay(0); tiempo = millis(); }
then... you execute delay(0) only 1 time per second !!
delay(0) takes more time that the entire while !!
Description
I lost 4 hours now on this problem by searching the given debug messages and solder/desolder, rewrite the code etc but it might have something to do with a while loop and the watchdog...
I am using a WeMos to control a DRV8825 and a stepper driver that is sitting on a rail. The next step for me is to do a calibration drive, where the distance of the rail is beeing measured. Because the the calibration should not beeing aborted by anything I want to use a while loop.
The problem is, that the while loop causes the WeMos to soft-reset. See my very simplified example sketch to get an idea of the problem.
I have had the messages: rst cause:2, boot mode:(3,6) rst cause:2, boot mode:(1,6) rst cause:4, boot mode:(1,6)
It's no power issue (measured with a good multimeter and a oscilloscope).
Hardware
Hardware: WeMos D1 mini Core Version: (I dont know)
Settings in IDE
Module: WeMos D1 R2 & mini Flash Size: 4M (3M SPIFFS) CPU Frequency: 80Mhz Upload Speed: 921600 Upload Using: SERIAL
Sketch
Debug Messages