Hardware: WemosD1 mini v 2.1.0
I'm getting "Soft WDT reset" in simple loop.
Soft WDT reset
ctx: cont
sp: 3ffef1d0 end: 3ffef3d0 offset: 01b0
Stack (I'm not able to decode it. i don't have such option in my arduino app)
>>>stack>>>
3ffef380: 3ffe8430 feefeffe 3ffef360 3ffef390
3ffef390: 40106af0 00000338 00000000 3ffee39c
3ffef3a0: 3fffdad0 00000000 00000338 40201c55
3ffef3b0: feefeffe feefeffe 3ffee394 40202138
3ffef3c0: feefeffe feefeffe 3ffee3b0 40100114
<<<stack<<<
This is sample code, It's very simplifed version of my app only to present the bug. App crash always when counter is 824.
void setup()
{
Serial.begin(9600);
Serial.println("Start");
pinMode(D1, OUTPUT);
}
void loop()
{
for ( long nBlinkLong=0; nBlinkLong < 20 * 1000; nBlinkLong++ )
{
Serial.printf("%d,", nBlinkLong);
digitalWrite(D1, LOW);
delayMicroseconds(1000);
}
}
Module: Generic ESP8266 Module
Flash Size: 4MB
CPU Frequency: 80Mhz
Ok, it seems that it's caused by watchdog timer. I didn't know about this before.
https://github.com/esp8266/Arduino/issues/34#issuecomment-91751313
could you try changing your code to use delay instead of delayMicroseconds? using delay allows some of the background tasks to happen during the delay which may prevent the watchdog reset (not tested this) where delayMicroseconds does not.
Hi James, sorry for late reply. I tried to use delay but with same results. The second problem was that I needed delayMicroseconds because of simulating PWM. But I solved it without delay/delayMicrosends with getTickCount measurement.
glad you solved your problem, can i suggest that you post a stripped down example of your fixed code (in case someone else has a similar issue) and then close this issue?
Sure, it's something like this
unsigned long timeLastCheck = 0;
unsigned long intervalCheck = 500;
void loop() {
unsigned long timeNow = millis();
if ( timeLastCheck == 0 || timeNow-timeLastCheck > intervalCheck )
{
...
}
}
can you paste the whole code please?? I want to see where exactly the code goes and how to use it.
Thax.
Same problem with HX711 library on esp8266. delay(0); in loop fix problem :) Library use yield(); but it not work :(
@regimantas did you manage to fix your problem with the hx711? I am having the same problem with my hx711 and node mcu on arduino ide
I found this was necessary even in a particularly long running for loop, rather than just longer running while statements. Using delay(0) worked perfectly. Thanks!
I found this was necessary even in a particularly long running for loop, rather than just longer running while statements. Using delay(0) worked perfectly. Thanks!
But delay() has some issues like blocking other connected devices for specified time and non-accurate delays as code takes its own time to run.
Most helpful comment
Same problem with HX711 library on esp8266. delay(0); in loop fix problem :) Library use yield(); but it not work :(