-->
Page 1 of 1

Random Watchdog reset

PostPosted: Thu Jan 19, 2017 9:31 am
by CRF
I have many ESPs running without problems.
But now I have one, with random watchdog reset. This is the only one using an interrupt routine, and just to get in more trouble I use "long" delays in that routine.

It is a light dimmer function, and it kinda needs to wait for up to 10ms until it triggers the triac and than exits.

Do you think this is the cause of WDT running out?

Can I disable the WDT? What do you suggest?

Re: Random Watchdog reset

PostPosted: Fri Jan 20, 2017 8:46 am
by CRF
Adding ESP.wdtDisable(); and ESP.wdtFeed(); did NOT help.

But when changing interrupt function to if(1) return; there is no RESET. So it really looks like the time spent in that function is the cause.

But how to solve this???

Re: Random Watchdog reset

PostPosted: Sat Jan 21, 2017 9:38 am
by martinayotte
You should never do something that take long time in interrupt routine.
Interrupt should be execute as quickly as possible, and should not call anything that could itself produce interrupts, such as Serial.print().
If you have a long process to be execute when interrupt is triggered, the interrupt routine should simply set a flag to true and return, then your main loop will check that flag and process the lengthy execution.

Re: Random Watchdog reset

PostPosted: Mon Jan 23, 2017 8:47 am
by CRF
Well, I solved this. In case anyone finds this usefull.
I used this microtimer http://onetechpulse.com/esp8266-microse ... lay-timer/
Now I can controll the fireing delay after zero crossing down to 10 microseconds, without any blocking code.
I have not had a reset since.