Error ISR not in IRAM!

When I uncomment:
// attachInterrupt(digitalPinToInterrupt(2), emailOnButtonPress, CHANGE);

I get the error:
ISR not in IRAM!

WeMos D1

How can I resolve this ?
Thanks

Well, with what very little details you have provided, one must conclude that it is nothing Blynk specific… so start here - ISR not in IRAM - Google Search

I found this line in Blynk’s email example… I am using the one for ESP8266…

But it is not commented out, so what source code are you working from? What hardware are you using?
What Blynk Library version? ESP Arduino Core version? You know… details, details… :stuck_out_tongue_winking_eye:

I tried to include all the code but as I am new was rejected
WeMo D1

Trying again:

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
/* Set this to a bigger number, to enable sending longer messages */
//#define BLYNK_MAX_SENDBYTES 128

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "ad89f389xxxxxxxxxx10bcbe4";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "HTxxxxxxxxxxundo";
char pass[] = "goxxxxxxx456";

void emailOnButtonPress()
{
  // *** WARNING: You are limited to send ONLY ONE E-MAIL PER 15 SECONDS! ***

  // Let's send an e-mail when you press the button
  // connected to digital pin 2 on your Arduino

  int isButtonPressed = !digitalRead(2); // Invert state, since button is "Active LOW"

  if (isButtonPressed) // You can write any condition to trigger e-mail sending
  {
    Serial.println("Button is pressed."); // This can be seen in the Serial Monitor
    Blynk.email("your_", "Subject: Button Logger", "You just pushed the button...");

    // Or, if you want to use the email specified in the App (like for App Export):
    //Blynk.email("Subject: Button Logger", "You just pushed the button...");
  }
}

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
Blynk.begin(auth, ssid, pass, "blynk-cloud.", 80);
 // Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

  // Send e-mail when your hardware gets connected to Blynk Server
  // Just put the recepient's "e-mail address", "Subject" and the "message body"
  Blynk.email("estivarizgonzalo@gmail.com", "Prueba", "My Blynk project is online.");

  // Setting the button
  pinMode(2, INPUT_PULLUP);
  // Attach pin 2 interrupt to our handler
// attachInterrupt(digitalPinToInterrupt(2), emailOnButtonPress, CHANGE);
}

void loop()
{
  Blynk.run();
}

You need to edit your post (using the pencil icon at the bottom of the post) and add triple backticks at the start and end of your code, so that it displays correctly.
Triple backticks lol like this:
```

I assume that you mean Wemos D1, but which flavour (D1R1, D1R2, Mini, Pro?).

And, which version of the ESP core are you using?

Pete.

1 Like

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