WDT fires if setup() takes more than 1 sec
Should WDT be disabled during setup()? It's quite common situation when setup() executes quite long time.
Yes, I also have this problem. I would like to disable WDT during setup() because setup waits for WiFi connection that is used to deliver settings for further operation. ets_wdt_disable() is reported as undefined external...
Can you call yield() or delay() in your setup function periodically in the same way it is done in the sample sketches for the ESP8266WiFi library? Both will indirectly reset the watchdog. On Apr 2, 2015 10:36 AM, "tomaja" [email protected] wrote:
Yes, I also have this problem. I would like to disable WDT during setup() because setup waits for WiFi connection that is used to deliver settings for further operation.
Reply to this email directly or view it on GitHub https://github.com/esp8266/Arduino/issues/34#issuecomment-88795278.
Oh, yes - delay works! Sorry for that, I didn't get that from README :( Спасибо, Иван!
@Sermus Maybe adding methods to enable/disable WDT would be sufficient for most cases?
Not sure this is a way out because i got it in a 3rd party library which i tried to use as is. Its initialization tooks long time. In that sense if we want to have one-to-one Arduino library portability we must let them initialize as long as they need. Otherwise i'd have to modify a lib inserting watchdog feeds (if it's possible at all)
I meant something like this:
void setup() {
wdt_disable();
/// some initialization
ThirdPartyLibrary.begin();
/// more stuff
wdt_enable();
}
Would that work?
What exactly is this library doing, by the way? I have added workarounds for some of the common usage patterns like while (!wifiClient.available()){} which detect such blocking loops and call yield() internally.
it's ILI9341 lib and it fills the screen black in quite a longy way. What is the issue with nesting setup() call in these wdt_disable()/wdt_enable(), except not working WDT itself?
delay() doesn't seem enough. I probably have more than 1s in between two delay calls. Yes, your proposition looks good (adding wdt_enable and wdt_disable). Can you add those two functions?
Thanks!
It would also be usefull to have a function to set the wtd reset time! Thanks!
@igrr Do you think this feature will be added?
void setup() {
wdt_disable();
/// some initialization
ThirdPartyLibrary.begin();
/// more stuff
wdt_enable();
}
@tomaja Added WDT APIs: ESP.wdtEnable(), ESP.wdtDisable(), ESP.wdtFeed().
You can either grab the latest version from git, or download the full .zip when it is ready from https://ci.appveyor.com/project/igrr/Arduino/build/artifacts
Great! Thanks, @igrr !
I just built Mac version from source and I checked that I can use ESP.wdtDisable() - script compiles just fine.
My Prolific USB to Serial stopped working after OSX update this morning so I'm unable to flash the new image to ESP8266 until I resolve that. I'll let you know how it works.
@tomaja I have also installed the Yosemite update today and had to reinstall the FTDI driver to make serial uploads work. I suppose the driver got replaced by Apple's version during the upgrade.
Edit: ignore this, you're using Prolific not FTDI...
Sorry to trigger a notification, but I would like to understand what is the purpose of the watchdog? I can't find any informations. Thanks!
A Watchdog timer is a safeguard against infinite loops or crashed processors.
You periodically reset the watchdog timer. If you don’t it forces a reset of the processor.
Crashed processors are usually stuck in a giberish loop of some kind that is unlikely to have a watchdog reset command in it.
Given that embedded processors are often stuck in the middle of electrically noisy environments, or placed inaccessibly this is a very important feature.
Processors can crash for reasons other than poor code. Single event upsets triggered by background and cosmic radiation are examples. As well as glitches from electrical noise and RFI and EMI.
The AVR ATmega has one built in but most folk don't actually enable or use it.
On 15/05/15 08:36, Marvin Roger wrote:
Sorry to trigger a notification, but I would like to understand what is the purpose of the watchdog? I can't find any informations. Thanks!
— Reply to this email directly or view it on GitHub https://github.com/esp8266/Arduino/issues/34#issuecomment-102299731.
[email protected] www.kirbyand.co.uk
Thanks, I thought it was something specific to the ESP8266. So I suppose the watchdog resets at the end of a loop() iteration and on a yield/delay call? I think the concept should be documented in the README, because as you said it is not enabled by default on official Arduino boards, so newcomers might be lost as I was.
Agreed
The ESP8266 is a bit of an odd ball case.
Consider that the other Arduino/Ethernet/Wifi offerings use an ATmega as the arduino and a second embedded processor of some type or other to do the networking bit.
In the ESP's case we are expecting one processor to do it all. there is a lot going off in the background that we are unaware of. The pre-written envrionments typical of arduino style coding don’t help with seeing what is going off behind the scenes. But does get folk into it quicker by hiding the complexity. Something of a trade off.
Not only do we need to de-schedule to kick or reset the watchdog timer, but we also need to do the same to let the background networking stuff do it's thing.
This knowledge is obvious to the guys at the cutting edge doing the coding but is part of a whole bunch of context that other folk coming to it new do not have.
Part of the challenge of turning out open source is the wide range of skill levels that will be encountered.
Some clear statements and maybe an example snippet might be useful to help with this. Or at least a statement of what the time period for the WDT defaults to, so folk can deal with it by issuing a specific call to it at intervals.
Whilst it will be possible to modify the WDT period and even to disable it all together, my best advice is don't do it. Learn to program with WDT and de-scheduling if you are planning on working with the ESP.
On 15/05/15 13:18, Marvin Roger wrote:
Thanks, I thought it was something specific to the ESP8266. So I suppose the watchdog resets at the end of a loop() iteration and on a yield/delay call? I think the concept should be documented in the README, because as you said it is not enabled by default on official Arduino boards, so newcomers might be lost as I was.
— Reply to this email directly or view it on GitHub https://github.com/esp8266/Arduino/issues/34#issuecomment-102384594.
[email protected] www.kirbyand.co.uk
We've got something along these lines in the third paragraph here: https://github.com/esp8266/Arduino#timing-and-delays
@AndyKirby if you can help to expand/improve this readme section I would really appreciate this.
Yup will do.
What is the default timeout for WDT ??
On 15/05/15 13:56, Ivan Grokhotkov wrote:
We've got something along these lines in the third paragraph here: https://github.com/esp8266/Arduino#timing-and-delays
@AndyKirby https://github.com/AndyKirby if you can help to expand/improve this readme section I would really appreciate this.
— Reply to this email directly or view it on GitHub https://github.com/esp8266/Arduino/issues/34#issuecomment-102391250.
[email protected] www.kirbyand.co.uk
Around 1 second. Unfortunately there is no info at this point how to change that value.