Error ISR not in IRAM!

Excellent, Many Many Thanks, I try to use 2.4.2 as you said before and everithing works fine, the error was gone and solved…
You save me a lot of time, thank you!

1 Like

Would it be possible for you to give an example of how to include a proper interruption with the new ESP Board Library. I know downgrading works, but this can’t be a permanent solution. If you have an idea on how to implement a simple interrupt, it would be greatly appreciated.

You’d better use timers with Blynk,
We all have issues with interrupts and blynk.

There are two ways to handle the ISR not in IRAM issue. These examples assume that your interrupt handling function is called MyInterruptHandler

You can simply add a pre-declaration of the ISR handler routine with ICACHE_RAM_ATTR before the interrupt handler name, like this:

void ICACHE_RAM_ATTR MyInterruptHandler();

This pre-declaration of the ISR handler should be near the top of your code, before void setup - where you initialise your interrupt like this:

attachInterrupt(digitalPinToInterrupt(5),MyInterruptHandler,FALLING);

your interrupt handler would then look like this:

 void MyInterruptHandler()
{
  // do your interrupt handling stuff in here....
}

Alternatively, you can skip the pre-declaration and do it in the ISR handler like this:

 void ICACHE_RAM_ATTR MyInterruptHandler()
{
  // do your interrupt handling stuff in here....
}

When you take this approach, your ISR handler MUST appear before your void loop in the sketch, otherwise you’ll get a “not declared in this scope” error when you compile the code (at least when using the Arduino IDE).

Pete.

3 Likes

genius. you save my day

2 Likes

Hi Pete, you seem very knowledgable. I am having issues with Blynk and ESP Board Library on anything above 2.4.2, is there a way to make this work with the newer libraries. I have read through your post here and it makes sense, it compiles and uploads, but when I run it, I get the ISR not in IRAM! Abort called and then constant reboots. Any idea?

The simplest way is if you post your code.
Ensure that you post it with triple backticks at the beginning and end though.
Triple backticks look like this:
```
Copy and past them if necessary.

Pete.

Problem with ISR not IRAM in a WEMOS or ARDUION is that memory for that handle ISR interrupt must be reserved in a section DECLARATION for values in this way for example
void ICACHE_RAM_ATTR ServiceLimitSwitchUpperShield_12_D6();
// There are solved for ATTACHINTERRUPT - you must declare this before function SETUP (very important )
In a section SETUP you can define
attachInterrupt(digitalPinToInterrupt(12), ServiceLimitSwitchUpperShield_12_D6 , FALLING );

The method ServiceLimitSwitchUpperShield_12_D6 define for example
[[ichache_IRAM_ATTR]]
void ServiceLimitSwitchUpperShield_12_D6()

Take attention what memory is need for your souce code . This value give compilator.With abouve 32 KB may also occur problem . Choice MMU from Tools
as 32 KB cache + 32 KB IRAM (balanced ). You can try other option
de sp9auv

ICACHE_RAM_ATTR is deprecated in the latest ESP8266 core versions and will lead to a compilation warning at present, and probably a compilation failure in later releases. You should use IRAM_ATTR instead.

Pete.

1 Like