Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By AYAduino
#21671 Dans,
for what it's worth I spent the better part of three solid days troubleshooting random failures/resets in a pretty straightforward application (3 input lines, monitored via interrupts, a few sensors and 3 outputs driving transistor switches). I wasted a lot of time looking at the code in the libraries trying to figure out what was happening there to cause the wdt resets (usually failed in a fairly repeatable pattern). What I learned, in a nutshell, is your code has to be *TIGHT* and the ESP is insanely sensitive to any kind of fluctuations either in terms of supply voltage/current or via GPIO pins. I eliminated 100% of function calls from within other functions (even jumps out to fairly quick routines) unless it was the last statement in that routine; instead I set flags that would each be checked (in the main loop) which in turn would call the required function. This, plus the addition of capacitors, extra resistors (really trial and error in a few cases) and wires as short as possible seem to have resolved my issues. I'm sure more will crop up (I'm largely flying by the seat of my pants with this stuff) but I'm having to be a lot more 'careful' with this than I've ever had to be with the Arduino.

I should note that my version of 'tight' code would likely turn the stomach of a developer - so I've likely just gone from gawd-awful to moderately-less-disturbing. My point really was that gawd-awful would run flawlessly on the Arduino but it doesn't cut it on the ESP. Finally, the real trouble seems to come into play with WiFi communications; clean entries and exits with those routines and no interruptions.
Brad
Last edited by AYAduino on Thu Jun 25, 2015 3:08 pm, edited 1 time in total.
User avatar
By cal
#21676 Moin Dans,

I learned few minutes ago that espduino delays are ok because they are translated into the underlying event model.

viewtopic.php?p=21670#p21670

Sorry for adding confusion.

Cal

P.S. I am trying to learn more about the watchdog timer to find a generic debug scenario for it.

viewtopic.php?f=13&t=3756
User avatar
By danbicks
#21824 Cal,

Thanks buddy, I am very close to a rock solid solution :)

In fact I am now having issue's trying to get the WDT to reset. I am pretty certain I have found the main reason, and yep delays are ok.

Thanks AYAduino, these are sensitive little devices, as long as good DC de coupling and a well regulated voltage reg is in place they should be pretty reliable. I have no issues with electrical characteristics but thanks for your input.

Dans