Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tmr.softwd() Not working in loop #2962

Closed
chathurangawijetunge opened this issue Nov 14, 2019 · 3 comments
Closed

tmr.softwd() Not working in loop #2962

chathurangawijetunge opened this issue Nov 14, 2019 · 3 comments

Comments

@chathurangawijetunge
Copy link

odeMCU 3.0.0.0 built on nodemcu-build.com provided by frightanic.com
branch: master
commit: 310faf7
release: 3.0-master_20190907
release DTS: 201909070945
SSL: false
build type: integer
LFS: 0x20000
modules: file,gpio,mqtt,net,node,pwm,rtctime,sntp,tmr,wifi
build 2019-10-25 06:20 powered by Lua 5.1.4 on SDK 3.0.1-dev(fce080e)


tmr.softwd(5)
while true do print("runing") tmr.delay(1000000) end

this will not reset the device.... is it a bug..?
is there a way to reset when stuck in continuous loop (stuck)

@TerryE
Copy link
Collaborator

TerryE commented Nov 14, 2019

tmr.delay() issues a system_soft_wdt_feed() every 1 sec to prevent a timout during a deliberate delay. Don't ask me why. The logic was laid down in the mists of time and we deprecate the use of the delay anyway as this can crash the network stack. Use a proper CB timer.

If you don't feed the timer then the processor will reset. Try:

for i=1,1000000000 do j = 0 end

This will trigger the H/W watchdog timer after ~3s, as you aren't feeding the SW watchdog.

@nwf Nathaniel, IIRC you did some work on the S/W timer. Any comment

@nwf
Copy link
Member

nwf commented Nov 14, 2019

I'm afraid you've got the wrong committer. The only thing I did with timers was #2603.

@TerryE
Copy link
Collaborator

TerryE commented Nov 25, 2019

Anyway, I don't think that this is a bug, per se; it is more an issue of "that's how it was designed to work". I'll leave it for other committers to comment first, but my inclination is to close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants