-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
attachinterrupt crash on latest git but works on 2.4.1 (latest stable) #4870
Comments
Different issues. In your case, the swapstate() ISR function is missing the ICACHE_RAM_ATTR decorator. |
Hi @devyte, Thanks and really appreciate the quick response. This is the updated sketch: const byte interruptPin = 5; //pin D1 on NodeMcu
volatile bool state = 0;
bool state_old = 0;
void ICACHE_RAM_ATTR SwapState() {
state = !state;
}
void setup() {
Serial.begin(115200);
Serial.print(F("Core version: "));
Serial.println(ESP.getCoreVersion());
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), SwapState, CHANGE);
}
void loop()
{
if (state != state_old)
{
state_old = state;
static int counter; ;
Serial.print("Interrupt counter: ");
Serial.println(++counter);
}
} Also now I got longer lines of stack dump, please see below, hope this is helpful:
Thank you in advance. |
Why is this issue being closed? |
This issue, as reported, is a user error, and not the same, see my previous comment. The crash with the decorator is reported in #4866 which is not closed. |
Don't remove the decorator. If it works without it, it's pure luck. |
Roger that, will definitely use the Cheers, |
Basic Infos
Platform
Settings in IDE
Problem Description
attachinterrupt
in the sketch below crashes on latest git but works on 2.4.1 (latest stable).Crash happened as soon soon as interrupt was triggered (in this case, when interrupt pin goes from
HIGH
toLOW
, i.e. interrupt pin is connected to GND pin).MCVE Sketch
Debug Messages
Please advise what debug mode I should turn on..?
Stack DUMP
The text was updated successfully, but these errors were encountered: