GPIO ISR improperly called - "SOLVED" (worked around)
Posted: Fri Jan 15, 2021 7:51 pm
***********************************************************************************************************************************
In january, 23rd 2021, title was changed from "Random timer miscount" to "GPIO ISR improperly called"
Check post dated Jan 22, 2021 8:51 pm
***********************************************************************************************************************************
ESP-WROOM-32
"ESP32 DEVKITV1" board
Hi!
I´m about to develop an application that is time-critical and demand a reasonable precision on timer count.
It´s a simple code that should register how many timer counts occur between two positive edges on square wave signal. I´m using a pretty stable 1KHz square wave generator.
Considering a divider with value 40, it´s expected something around 2000 counts, but I´ve detected a random timer count variation around half of the correct average value.
timer_config_t config0 = {
.alarm_en = false,
.counter_en = false,
.intr_type = TIMER_INTR_LEVEL,
.counter_dir = TIMER_COUNT_UP,
.auto_reload = false,
.divider = 40
};
Interrupt routine for a certain GPIO on positive transition works perfectly. It never miss a rising edge, never is called when it should not be. When the GPIO interrupt occurs, timer is paused, its value is read and spared and finally timer is started.
Can somebody give me some clue?
In january, 23rd 2021, title was changed from "Random timer miscount" to "GPIO ISR improperly called"
Check post dated Jan 22, 2021 8:51 pm
***********************************************************************************************************************************
ESP-WROOM-32
"ESP32 DEVKITV1" board
Hi!
I´m about to develop an application that is time-critical and demand a reasonable precision on timer count.
It´s a simple code that should register how many timer counts occur between two positive edges on square wave signal. I´m using a pretty stable 1KHz square wave generator.
Considering a divider with value 40, it´s expected something around 2000 counts, but I´ve detected a random timer count variation around half of the correct average value.
timer_config_t config0 = {
.alarm_en = false,
.counter_en = false,
.intr_type = TIMER_INTR_LEVEL,
.counter_dir = TIMER_COUNT_UP,
.auto_reload = false,
.divider = 40
};
Interrupt routine for a certain GPIO on positive transition works perfectly. It never miss a rising edge, never is called when it should not be. When the GPIO interrupt occurs, timer is paused, its value is read and spared and finally timer is started.
Can somebody give me some clue?