-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Usage of any type of interrupt leads to an exception #2477
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
Comments
Some fresh exception: wdt reset |
I think you have interrupts() and noInterrupts() backwards |
me-no-dev, could you please explain? I have both interrupts() and nointerrupts():
I enable interrupts at the beginning of the critical code and after it.... |
you need to disable interrupt before going into critical code, then enable them again after you are done |
me-no-dev, I can be wrong but the code above exactly you wrote. The critical code is: The mentioned string execution can take long time because it connects with an internet server. So I need to catch my impulses during this process. |
I've spet another two days in order to catch this hardware watchdog issue. The only thing I'm sure that the problem is not in my code. The only thing I need to do - enter the following code into my sketch:
An I receive a hardware watchdog reset after few minutes and up to 1 hour and 10 minutes. :) I don't know what to do else :) |
It seems that I'm very close to the solution. My opinion that the problem is not in attachInterrupt but in interrupts()/noInterrupts(). So... I had hardware watchdogs resets when I tried to use the pair of interrupts/noInterrupts or just interrupts alone. That cased problems because one of my libs works with interrupts and it doesn't enable interrupts. Also even once usage of interrupts() in setup() leads to random wdt reset. Now I'm testing my skets with my WeMos board without any interrupts()/noInterrupts() and it works twice more than before: two hours instead of 40 minutes or 1 hour 10 minutes. Later I'll introduce larger test and push information here. |
Hello EveryOne once more! I'm still struggle with WDT resets which appear mostly randomly and without clear understanding from my side when and why it happen. I send 2 weeks and two WeMos D1 R2 modules without any result. Do date I'm pretty sure that the problem is not in the interrupts. There is a slightly chance that the sketch I use is not the best written. So I'll redisign it completely and see will I get rid of the WDT Reset or not. |
Hello EveryOne! It seems that after two days of refactoring of my Sketch for WeMos D1 R2 it is clear what was the problem of usage of PWM for internal LED (or external).
The frequence of fading is default. The board is also connected to WiFi. I got random Hardware WatchDogs. This could happen just after restart or in time around 40 minutes. I think this can be connected with this issue #836 |
what me-no-dev means |
@kvv213 your interrupt() - noInterrupt() calls look reversed. In any case, you most likely shouldn't be messing with that, unless you have time-critical code (e.g.: like the serial communication with a DHT sensor). You certainly shouldn't nest those calls, and also network communications should not be wrapped. |
Maybe a litle late! This is what I found.
It failed with an exception after a few seconds! After removing the delay(1) in loop, it works. |
@palsbo two things: your ISR needs the ICACHE_RAM_ATTR keyword, and it should not have an empty body. Declare a global volatile bool, set it in the ISR, check and clear it in the loop. |
@devyte, is this still true? It seems like a really broad assertion, and the info I found googling around seems stale. However, from what I understand of the root problem, from the explanation at #2680 (comment), |
Yes. All ISRs need to be in RAM, and all functions called from the ISR must be in RAM as well. |
Hello EveryOne!
I spent more than a week in otder to try to eliminate a hang of my WeMos D1 R2 board with ESP8266 onboard.
If the board is connected to PC then it just hang down. When it is standalone I can see something the following:
Reset reason: Hardware Watchdog
Reset info: Fatal exception:4 flag:1 (WDT) epc1:0x40000f68 epc2:0x00000000 epc3:0x40000f68 excvaddr:0x00000000 depc:0x00000000
The 4-th expection means:
Level1InterruptCause
Level-1 interrupt as indicated by set level-1 bits in the INTERRUPT register
I use interrupt in order to cacth impulses on a pin when one of the routines is publishing information to a remote server via WiFi. The rest of time I use Bounce2.
This is how I attach interrupt
This is the callback function
Loop routine:
And the publisher:
It is not easy to catch the exception but it appeares :(
The text was updated successfully, but these errors were encountered: