Basic WDT?
Posted:
Sun Jul 03, 2016 3:59 am
by John L
I am playing with V3 ESP Basic and have not been able to find any reference to WDT (Watchdog Timer) within Basic language itself?
WDT would be useful in embedded application in case of something locking up, to restart the ESP with autorun default.bas program.
Not sure if WDT feed could be set in a Timer routine that can be polled on regular bases?
WDT is available in the Arduino environment.
Regards
John
Re: Basic WDT?
Posted:
Mon Jul 04, 2016 4:55 pm
by forlotto
It is my understanding that the timer on the esp is not hardware based not 100% sure here but is what my memory recalls making so it would be a SWDT vs a HWDT anotherwards:
HW watchdog resets the system automatically, if the shutdown is not (periodically) prevented by software; SW watchdog OTOH can do something only, when given CPU time. Thus it must periodically check if the system needs to be reset and respond to that by programming HW.
The end result is that a SW watchdog can fail to respond to total system crash.
Typical programming models of those are:
HW watchdog: [HW circuit] <-- [low priority timer interrupt postponing reset]
--
vs.
--
SW watchdog: [Low priority SW process feeding SW Watchdog]
+ [High priority SW process requiring "food"]
So basically you could possibly use another piece of hardware in conjunction to produce the same effect but as it stands without more hardware it would likely not be possible so you might as well just add the hardware and make it yourself ;) Would be radically simplistic to do I would think one could even use 2 esp8266 chips to achieve the effect with a relay. cutting the 5v power and restoring it to the non WDT only issue I would see is they would both have to be watch dog timers for each other just talking back and forth every 10 minutes or so if there is no response bingo trigger the restart buy shutting the relay off then on!!!
Very cool idea and while it is not possible via code it is possible via added hardware.
I hope this helps and hope to see your watch dog timer! ;)