Change global variables from ISR

If a global variable is changed from within a ISR a Guru Meditation Error: Core 1 panic'ed (Cache disabled but cached memory region accessed) can be triggered causing the application to fail and force the ESP32 to reboot. The proper programming is to declare the variable as static volatile and to mark the ISR code with the compiler flag IRAM_ATTR

Example code:



Leave a Reply

Your email address will not be published. Required fields are marked *

Free Link Directory