Resolve hardware timer functions not in IRAM, crashes when called from ISR #4684
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi folks,
As seen in crankyoldgit/IRremoteESP8266#1350 and taligentx/dscKeybusInterface#80, the Arduino/esp32 hardware timer functions are currently not in IRAM and cause crashes when called from an ISR:
I've run across this issue when using ESPAsyncWebServer and Blynk with my library (dscKeybusInterface). The library uses a GPIO pin change interrupt to catch a clock signal, and that ISR triggers a timer interrupt to read data from a different GPIO after 250us. This works fine with Arduino/AVR and esp8266, but calling
timerStart()
andtimerStop()
on Arduino/esp32 results in the above crash, and is resolved by placing these functions in IRAM.For reference, Arduino/esp8266 places its hardware timer functions in IRAM: https://github.com/esp8266/Arduino/blob/master/cores/esp8266/core_esp8266_timer.cpp
The current workaround in the IRremoteESP8266 library bypasses the Arduino esp32 core functions and redefines
hw_timer_t
andhw_timer_reg_t
so its ISR can configure the timers directly: crankyoldgit/IRremoteESP8266#1351It'd be great to be able to avoid these kinds of workarounds - thanks!