Hardware timers on ESP32

If you are asking a question, please follow this template:

  1. My goal is: To use a hardware timer on the ESP32
  2. My actions are: I pull the blank C sample project, changed the code to use a HW timer instead. Code is here: https://pastebin.com/tJ9qkKf5
  3. The result I see is: I get a core dump on boot, with another exception occurring during the core dump. Logs are here: https://pastebin.com/JdDJhmAh
  4. My expectation & question is: Am I creating a hardware timer correctly here?

Hardware timer callbacks are running in the ISR context and need to be compiled with the IRAM attribute set in front of the declaration. And in the callback, you may only call routines which are running in the ISR context as well. These aren’t much, so your LOG… macro will cause a core dump. but the GPIO access should work.

That did the trick - thanks

Hi…is it possible to consider an external watchdog device in your design? That would deliver a more robust implementation than an internal watchdog. The TPS3823-33 device from TI works well for ESP32 designs - it has both a voltage monitor and watchdog timer.

pcb manufacturing