Closed EpicLPer closed 4 years ago
I don't know if this can help. I wrote it as a comment top myself last year. Seems the link could cover it
// Note if you use an Wemos D1 as MCU, ICACHE_RAM_ATTR is required // https://community.blynk.cc/t/error-isr-not-in-iram/37426/20 //ICACHE_RAM_ATTR
I put the ICACHE_RAM_ATTR after variables and before procedures.
I don't know if this can help. I wrote it as a comment top myself last year. Seems the link could cover it
// Note if you use an Wemos D1 as MCU, ICACHE_RAM_ATTR is required // https://community.blynk.cc/t/error-isr-not-in-iram/37426/20 //ICACHE_RAM_ATTR
I put the ICACHE_RAM_ATTR after variables and before procedures.
I'm kinda lost... not sure where to put this or how.
https://stackoverflow.com/a/58131720 explains it pretty well, see the next answer for an example.
@EpicLPer ICACHE_RAM_ATTR is an ESP8266 attribute that will place a function into RAM (as opposed to the usual program storage, which is flash). On ESP8266, all interrupt service routines must be placed in RAM. Try placing the attribute before the ISR, like this:
void ICACHE_RAM_ATTR setFlag(void) {
// check if the interrupt is enabled
if(!enableInterrupt) {
return;
}
// we got a packet, set the flag
receivedFlag = true;
}
If I do this then I get the following compile error:
In function 'void setup()':
SX127x_Receive_Interrupt_Example:54:23: error: 'setFlag' was not declared in this scope
radio.setDio0Action(setFlag);
^
exit status 1
'setFlag' was not declared in this scope
Okay, fixed it :) Had to put it before void for it to work!
ICACHE_RAM_ATTR void setFlag(void) {
// check if the interrupt is enabled
if(!enableInterrupt) {
return;
}
// we sent a packet, set the flag
transmittedFlag = true;
}
Couldn't remember which way it was, I'm glad it's working now.
I'm new to LoRa (and in general playing around with breakout boards or Arduino programming :) ) and I just tried out the Receive and Transmit Interrupt Examples included with the project.
The non-interrupt ones worked fine and I was able to successfully transmit data which got me hyped up for LoRa already!
But trying the Interrupt examples results in the ESP8266 (Wemos D1 Mini clone) to constantly crash with the following crashdump and error:
With my limited understanding of Arduino stuff so far it seems to get hung up on
radio.setDio0Action(setFlag);
.Any way to fix this? Did I maybe do something wrong or is something not right in the Library?
Thanks already :)