LoRaNow icon indicating copy to clipboard operation
LoRaNow copied to clipboard

ESP8266 crash "ISR not in IRAM"

Open who-has-seen-the-wind opened this issue 4 years ago • 1 comments

With Arduino 1.8.10, ESP8266 library v2.62, ESP12 module, serial monitor reports "ISR not in IRAM"

See https://github.com/esp8266/Arduino/issues/6127 in particular, https://github.com/esp8266/Arduino/issues/6127#issuecomment-501493870 and the two comments that follow that, where they specifically cite LoRa.cpp, including: "Is that code doing an spi transaction from an ISR??? There are strict timing requirements on the exec time of an ISR in the ESP. Blocking operations are a big no no, and in general ISRs shouldn't take more than a few us. At a glance, I don't think that code will work, at least not with wifi running. I would advise an ESP user to set a flag in the ISR and execute from the loop, or use the scheduled function api (runs a cb as though it were in the loop)."

Additionally, I see that a LoRa.cpp file is contained inside the LoRaNow src directory. Perhaps this is some prior version of SandeepMistry's code. Perhaps this library be included rather than copied? If it was included, the current version has a macro to define ISR_PREFIX as ICACHE_RAM_ATTR but doesn't really address the fundamental points in the comments cited above.

This is related to https://github.com/ricaun/LoRaNow/issues/6

who-has-seen-the-wind avatar Dec 08 '19 18:12 who-has-seen-the-wind

Hello, When I design this library I didn't know the USER from ESP is so restrict and crashes really easy if you put too much code on the interrupt. I already changed the LoRa.ccp with the ISR_PREFIX as ICACHE_RAM_ATTR and remove all the spi code to the main loop. The last test the esp don't crash when using the LoRa and Wifi. I was changing the https://github.com/ricaun/LoRaNow/tree/update Now I need some help to test the new code. Thanks for your contribution.

ricaun avatar Dec 10 '19 14:12 ricaun