Translating Code From Teensy 3.2 to NodeMCU board im retouching some projects ,

Translating Code From Teensy 3.2 to NodeMCU board

im retouching some projects , adapting from on board to the other to be able to use the Wifi capabilities on the esp .

after being successful on some , there are other that gave me the following error when the code reaches a certain point :

Soft WDT reset

ctx: cont
sp: 3fff2ca0 end: 3fff2f50 offset: 01b0

stack>>>
3fff2e50: 402e0000 00000000 00000003 0001ffff
3fff2e60: 0000001f 000001e0 aaaaaaaa 00000063
3fff2e70: 0000001f 000001e0 3fff076c 4020aa78
3fff2e80: 3fff13d1 000001e0 00000085 00000000
3fff2e90: 151f0000 0000031d 00000000 40209138
3fff2ea0: 9999999a 3fff18a0 3fff076c 4020cac0
3fff2eb0: 3f1d151f 00000000 402e0000 3fff0f78
3fff2ec0: 4020aa14 3fff0fc0 000001e0 00000000
3fff2ed0: 00000000 00000008 3fff1e68 3fff1f24
3fff2ee0: 3fffdad0 3fff0a1c 3fff0a18 3fff1f24
3fff2ef0: 3fffdad0 3fff0a1c 3fff18a0 4020920b
3fff2f00: 3fffdad0 3fff0a1c 3fff0a18 402094b8
3fff2f10: 3fffdad0 00000075 3fff1e68 4020a47b
3fff2f20: feefeffe 3fff0798 3fff0764 4020a62e
3fff2f30: 3fffdad0 00000000 3fff1f1d 4021567c
3fff2f40: feefeffe feefeffe 3fff1f30 40100718
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v3de0c112
~ld
ÿ


i will continue to debug , trying to find the conflict that is generating this (non random) reset , but just won’t to check as this probably happened to others first .

will appreciate any hint ,
thank you .

Probably memory related. I wish there was a way to debug these properly. Also sometimes you may just have a dodgy Node. Ive come across afew

WDT is the watchdog timer - how much time are you spending in setup? And what code are you having this problem with? (Post to http://gist.github.com, please)

Thank you both for the comments ,
Daniel, it goes beyond setup , it reaches the main loop and in fact executes the first three led effects, as soon as the next one begins , it resets with that message, and always at the same point .

Will post the code tomorrow .

So the watchdog timer fires when the system spends too long doing something and doesn’t get to reset the watchdog timer - you might have something that is spinning for too long or disabling interrupts for too long.

@Daniel_Garcia is it possible to disable the wdt? ,I saw some recommendations on this direction but the instruction mentioned is not implemented. In the arduino code version.( is there but does nothing),
I know it may hide the real problem but is a quick way to confirm if this is the case …

Daniel, in the code I call a function on the loop to execute all the effects , so it goes for long time out of the loop , could that be the problem . .? ,

Probably - the watchdog timer has nothing to do with wifi - it’s a way for the system to detect if it has locked up. If you aren’t going to exit loop for a long time you should find out how to reset the watchdog timer.

So thats what it is!!! Many times i have had my esp8266 crash with a similar message when i had a tight loop with no delay. Soon as i put in a delay(1) it works…looks like disabling WTD sounds like a plan!

You can call ESP.wdtDisable(); to disable the watchdog timer, have not tested it yet…but it compiles

I believe the ESP has a hardware timer so it can’t be fully disabled but calling yield() or delay(1) will reset the timer so add a small delay in your loop as Leon suggested to help.

@Brian_Lewis Yep correct, i tested this last night. yield() seems a tad less blocking for real time stuff

thank you,
i think i have all the pieces now , will first transform my functions call in a better “non-blocking” way, so the code will return to the main loop more frequent , in case that is not enough, will add Yield() on specific code locations , will do tomorrow …