Error ISR not in IRAM!

Thanks Pete
WEMOS D1 MINI
Where I found the ESP core version ?

Can this help:
https://arduino.esp8266.com/stable/package_esp8266com_index.json

Gonzalo

Even a first time post shouldn’t have blocked the addition of pasted code… and we didn’t see any system flags indicating such a block. :face_with_raised_eyebrow:

Anyhow, I have properly formatted your 2nd posts pasted code as required in the welcome topic and the initial post directions you needed to remove when posting your first text.

I also blocked out your AUTH code… you may still wish to refresh it in the App and in your code… prevents someone else from messing with your project.

Blynk%20-%20FTFC

This should be viewable in your IDE Board Manager…

image

Actually now up to 2.5.2

Thank you Gunner
I found:
esp8266 by ESP8266 Community Versión 2.5.2 installed

Your code compiles fine for me, using v2.5.1 of the core and with the correct board type (Lolin wemos D1 R2 and Mini) selected.

Pete.

Yes it compiles OK, but when I tried to Upload the error appears and reboots continuosly:

[57] Connecting to HT_B5D4F4_segundo
[561] Connected to WiFi
[561] IP: 192.168.1.112
[561] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on ESP8266

[635] Connecting to blynk-cloud.com:80
[1023] Ready (ping: 156ms).
[1091] Connecting to HT_B5D4F4_segundo
[1091] Connected to WiFi
[1091] IP: 192.168.1.112
[1091] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on ESP8266

[1246] Connecting to blynk-cloud.com:80
[1565] Ready (ping: 157ms).
ISR not in IRAM!

Abort called

>>>stack>>>

ctx: cont
sp: 3ffffda0 end: 3fffffc0 offset: 01b0
3fffff50:  3ffffb50 0000003e 00000400 00000050  
3fffff60:  3ffe87a1 000004de 3ffee8f8 3ffe84f8  
3fffff70:  3ffe84e6 3ffe84dc 3ffee8f8 401004c6  
3fffff80:  3ffe84e6 3ffe84dc 3ffee8f8 402020b5  
3fffff90:  feefeffe feefeffe feefeffe 3ffeea98  
3fffffa0:  3fffdad0 00000000 3ffeea68 40203d08  
3fffffb0:  feefeffe feefeffe 3ffe8548 401007b1  
<<<stack<<<

Seems like it was something introduced in ESP core 2.5.1 according to this:
https://www.esp8266.com/viewtopic.php?p=82454

Have you tried downgrading, preferably to 2.4.2 as everything since seems to be rather buggy.

Pete.

1 Like

Thank you Pete !
With version 2.4.2 works fine with no error

2 Likes

I don’t want to re-open a solved issue, but I discovered you just need to add ICACHE_RAM_ATTR in front of your ISR function to solve this issue. It tells the compiler to keep the ISR function in memory and is required for ESP core 2.5.1 and later.

Example ICACHE_RAM_ATTR void ISRfunction() {}.

Worked for me with ESP core 2.5.2 installed.

3 Likes

Hello my friend. I have the same problem but i dont know where to change the ICACHE_RAM_ATTR void ISRfunction() {} instruction you say. Im using a ESP01 ESP8266 with WifiManager and Blynk. Everything was working fine; i did an upgrade and i think im now on ESP core 2.5.2.
Blynk keeps reconnecting with that ISR not in IRAM! error and i dont know where to fix it. Thanks

I think they mean to add the ICACHE_RAM_ATTR variable before the function you call from your ISR.

Hi Rodrigo_Torres. I’m assuming you have an interrupt being called somewhere in your code which is why you’re getting the error. When attaching the interrupt, you call a function to happen when the interrupt is triggered. That function is referred to as the ISR. The example below is a typical attachInterrupt operation.

Let’s say your ISR was “myInterruptFuction()”

attachInterrupt(digitalPinToInterrupt(pin), ISR, mode)

When you define the function later in your code you would simple put ICACHE_RAM_ATTR in front of it.

ICACHE_RAM_ATTR void myInterruptFunction() {
  some code here
}

That’s what worked for me anyway.

3 Likes

Amorphus Thanks a lot my friend. Those kind of help is perfect; im kinda new on this and you save me a lot of work. Now i downgrade the ESP core version but i’ll try that tip you say to make it work on latest one.
Thanks again for your time; i hope i can fix it.

Glad I could save you some time. I’m curious to know if it works for you. Let me know how it goes. Downgrading the library just seemed like a poor solution to me.

There are a lot of other issues with the ESP core after 2.4.2 though, so downgrading may be needed to resolve those as well.

Pete.

1 Like

I generally agree Pete but I feel those issues should be taken on a case by case basis before downgrading. I would also not consider this particular error an “issue” as it’s just a change to how to do interrupts and it’s covered in section 2.1 of the core documentation. As I understand it, not doing it this way should never have been allowed and we will all need to be doing interrupts this way moving forward.

3 Likes

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