-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Crash when using interrupt on pins + webserver #3337
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
I solved the issues that I had by using iram with my isr. |
Does not solve my issue. I added the IRAM attribute to the interrupt handler methods within the power-measurement library I use:
and called those methods as before from my sketch:
Still crashes after a few time reloading the webpage. What I found out so far: :-( Any further ideas? |
The first few lines of the crash dump should contain the PC (program counter) at the location of the exception. Using the PC value, you can identify the exact line of code where the exception happens:
|
I tried this:
but got:
No idea what a.out file is missing?! I get the same output even if I remove all the arguments, just using the .exe ... |
Sorry, there should also be a |
Can you also post the actual line with the exception you get? Based on PC value, it is in IRAM, so it's likely that the exception is not related to interrupt code being in Flash. |
So it's giving me exactly the same data as the decoded stack message I posted in first post... No line information :-( |
Complexte crash information:
|
Could you please put |
Result with exception decoder:
xtensa-lx106-elf-addr2line on the exception address:
|
It means that |
With the latest stack/exeption, nothing was placed into IRAM. I removed the IRAM attribute as it did not work/solve my issue. So I'm a bit confused about your finding?! Should I place both in IRAM to make it work? |
I wrote "You have placed HLW8012::cf1_interrupt into IRAM" based on the source code you had posted above. I didn't know you have later removed IRAM attribute from that function. In any case, yes, you should place both into IRAM to make it work. If it still doesn't work, please have a look at "Exception (?): epc1=..." line again. If the exception number is 0, put the value of excvaddr into addr2line, this will give you the location of the function which is not yet placed into IRAM. |
Now I have both methods, the wrapper and the final handler with IRAM attribute. Looks stable so far. I observe this the next hour and report back ... Is there some documentation about that mysterious IRAM, so that I can read about what I now have setup? |
There isn't any for Arduino, however the requirement for the ISR handlers to be placed into IRAM is mentioned in the ESP8266 non-OS SDK programming guide. |
Considering that this specific issue is fixed, and that the underlying cause is user error due to lack of documentation, and that the request for documentation is covered elsewhere, I'm closing. |
Basic Infos
Hardware
Hardware: Sonoff Pow - https://www.itead.cc/sonoff-pow.html (looks ESP12 compatible)
Core Version: via Platform.IO - Espressif 8266 1.3.0
Description
I'm using the HLW8012 library from https://bitbucket.org/xoseperez/hlw8012.
The sensor does some measurements (voltage/current/power/...) and provides the result via square wave signal on two pins to the ESP.
Both pins will be read via interrupt. The frequency is somewhat below 1Hz up to a few hundred Hz.
The measurement is presented to the user via the webserver and a simple webpage.
If I load/reload/refresh the page frequently (no matter if its 5sek or 30sek), the ESP sooner or later crashs (see decoded stack).
The issue happens with almost 0Hz as well as with >1Hz on the pins.
The issue #1020 looks like the same issue. I tried to suggested solution (disable the interrupts before actually handling the interrupt and enabling it after interrupt handler is done), but this did not solve the issue.
Settings in IDE
Module: ESP12
Flash Size: 4MB
CPU Frequency: 80Mhz
Flash Mode: qio
Flash Frequency: 40Mhz
Upload Using: SERIAL
Reset Method: ck
Sketch
Sketch shortened to just show whats done ... It's not compileable or copy&paste-usable...
For reference: the methods in the HLW lib handling the interrupt (nothing spectacular ...):
Decoded Stack Messages
The text was updated successfully, but these errors were encountered: