ESP32 Timer Auto-Reload Not Working
DodaTech
Updated 2026-06-26
1 min read
In this tutorial, you'll learn about ESP32 Timer Auto. We cover key concepts, practical examples, and best practices.
The Problem
ESP32 timer fires once but does not reload and fire repeatedly.
Quick Fix
Wrong
timer_config_t config = {
.auto_reload = TIMER_AUTORELOAD_DIS, // Wrong!
Timer fires once then stops. No further alarms.
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_set_counter_value(TIMER_GROUP_0, TIMER_0, 0);
timer_enable_intr(TIMER_GROUP_0, TIMER_0);
timer_start(TIMER_GROUP_0, TIMER_0);
Timer fires every 1 second continuously until stopped.
Prevention
Set auto_reload = TIMER_AUTORELOAD_EN. Reset counter value with timer_set_counter_value(). Alarm value sets the reload target. Use auto_reload for PWM-like timing. Disable for one-shot timers.
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