time_pulse_us precision problem #10046
-
I use different GPIOs on the same ESP32 to simulate the PWM capture experiment, but when using the time_pulse_us method, his time always deviates by 0.2ms. I don't know why, I need to manually compensate for 0.2ms.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You start timing the pulse in the interrupt service routine (ISR) for the same pulse. When the low to high transition occurs, some time will elapse before the ISR runs. Then the call to |
Beta Was this translation helpful? Give feedback.
You start timing the pulse in the interrupt service routine (ISR) for the same pulse. When the low to high transition occurs, some time will elapse before the ISR runs. Then the call to
time_pulse_us
occurs and the method starts the timer. So my guess is that the 200μs is a measure of that latency. ESP32 only supports soft interrupts and latency can be quite long. I'm actually rather impressed that you're only seeing 200μs...