-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Closed
Description
Hardware:
Board: ESP32-WROOM-32
Core Installation version: 1.0.6
IDE name: Arduino IDE
Flash Frequency: 80Mhz
PSRAM enabled: no
Upload Speed: 256000
Computer OS: Windows 10
Description:
I wanna attach an external interrupt from inside a template class. Used like in the code below, the ESP32 crashes immediatly. Outside the template class attachInterrupt() works fine. From inside the template class I can attach that ISR via gpio_isr_handler_add() without problems.
Is there a way to use attachInterupt() inside a template class?
Sketch:
#include <Arduino.h>
#include <Preferences.h>
Preferences preferences;
template <int pin>
class myTemplateClass {
static void IRAM_ATTR externalISR() {
//do stuff
}
public:
myTemplateClass() {}
void begin() {
attachInterrupt(digitalPinToInterrupt(pin), externalISR, RISING);
}
};
myTemplateClass<14> myObj;
void setup() {
Serial.begin(500000);
myObj.begin();
}
void loop() {
preferences.begin("config");
preferences.clear();
preferences.end();
}Debug Messages:
Guru Meditation Error: Core 1 panic'ed (Cache disabled but cached memory region accessed)
PC: 0x400ea2dc: myTemplateClass14>::externalISR() at C:\Users\Adrian\Desktop\ZACwire-Library-ESP32-beta\examples\FineTuning/FineTuning.ino line 8
EXCVADDR: 0x00000000
Decoding stack results
0x400ea2dc: myTemplateClass14>::externalISR() at C:\Users\Adrian\Desktop\ZACwire-Library-ESP32-beta\examples\FineTuning/FineTuning.ino line 8
0x4008adc6: esp_rom_spiflash_read at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/spi_flash/spi_flash_rom_patch.c line 556
0x40084238: spi_flash_read at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/spi_flash/flash_ops.c line 599
0x400e6229: nvs::nvs_flash_read(unsigned int, void*, unsigned int) at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/nvs_flash/src/nvs_ops.cpp line 76
0x400e4c21: nvs::Page::readEntry(unsigned int, nvs::Item&) const at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/nvs_flash/src/nvs_page.cpp line 739
0x400e5053: nvs::Page::findItem(unsigned char, nvs::ItemType, char const*, unsigned int&, nvs::Item&, unsigned char, nvs::VerOffset) at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/nvs_flash/src/nvs_page.cpp line 783
0x400e51e0: nvs::Page::eraseItem(unsigned char, nvs::ItemType, char const*, unsigned char, nvs::VerOffset) at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/nvs_flash/src/nvs_page.cpp line 322
0x400e4531: nvs::Storage::eraseNamespace(unsigned char) at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/nvs_flash/src/nvs_storage.cpp line 568
0x400e3835: nvs_erase_all(nvs_handle) at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/nvs_flash/src/nvs_api.cpp line 369
0x400d0d61: Preferences::clear() at C:\Users\Adrian\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.6\libraries\Preferences\src\Preferences.cpp line 72
0x400d0ca9: loop() at C:\Users\Adrian\Desktop\ZACwire-Library-ESP32-beta\examples\FineTuning/FineTuning.ino line 30
0x400d1f51: loopTask(void*) at C:\Users\Adrian\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.6\cores\esp32\main.cpp line 23
0x40086169: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143
Metadata
Metadata
Assignees
Labels
No labels