ESP32 Timer Alarm Not Firing
DodaTech
Updated 2026-06-26
1 min read
In this tutorial, you'll learn about ESP32 Timer Alarm Not Firing. We cover key concepts, practical examples, and best practices.
The Problem
ESP32 hardware timer alarm does not trigger the ISR or callback.
Quick Fix
Wrong
timer_init(TIMER_GROUP_0, TIMER_0, &config);
timer_start(TIMER_GROUP_0, TIMER_0); // No alarm set
Timer counts but no alarm event fires.
Right
timer_config_t config = {
.alarm_en = TIMER_ALARM_EN,
.counter_en = TIMER_PAUSE,
.intr_type = TIMER_INTR_LEVEL,
.counter_dir = TIMER_COUNT_UP,
.auto_reload = TIMER_AUTORELOAD_EN,
.divider = 8000
};
timer_init(TIMER_GROUP_0, TIMER_0, &config);
timer_set_alarm_value(TIMER_GROUP_0, TIMER_0, 10000);
timer_enable_intr(TIMER_GROUP_0, TIMER_0);
timer_isr_register(TIMER_GROUP_0, TIMER_0, onTimer, NULL, 0, NULL);
timer_start(TIMER_GROUP_0, TIMER_0);
Timer fires every 10000 ticks (1 second at 8000 divider).
Prevention
Enable alarm with .alarm_en = TIMER_ALARM_EN. Register ISR before starting timer. Calculate correct divider for desired period (80 MHz / divider). Set auto_reload for repeating timers. Check return values of timer functions.
DodaTech engineers apply these same patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro for production IoT reliability.
FAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro