ESP32 Timer Counter Value Not Incrementing
DodaTech
Updated 2026-06-26
1 min read
In this tutorial, you'll learn about ESP32 Timer Counter Value Not Incrementing. We cover key concepts, practical examples, and best practices.
The Problem
ESP32 timer counter remains at 0 or does not increment at expected rate.
Quick Fix
Wrong
uint64_t val;
timer_get_counter_value(TIMER_GROUP_0, TIMER_0, &val);
// Timer not started
Counter value: 0 (timer never started)
Right
timer_config_t config = { /* ... */ };
timer_init(TIMER_GROUP_0, TIMER_0, &config);
timer_set_counter_value(TIMER_GROUP_0, TIMER_0, 0);
timer_start(TIMER_GROUP_0, TIMER_0);
uint64_t val;
timer_get_counter_value(TIMER_GROUP_0, TIMER_0, &val);
float seconds = val / 10000.0 / 8000.0; // Adjust for divider
Serial.printf("Counter: %llu (%.2f seconds)\n", val, seconds);
Counter: 100000 (1.25 seconds since start)
Prevention
Call timer_start() after init. Set initial counter value with timer_set_counter_value(). Use timer_get_counter_value() for 64-bit read. Calculate elapsed time: counter_value / (80 MHz / divider).
DodaTech engineers apply these same patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro for production IoT reliability.
FAQ
← Previous
ESP32 Timer Calibration Off Due to RC Oscillator
Next →
ESP32 Timer Group Conflict with Other Peripheral
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro