drivers: pwm: mcux: ftm: fix pwm capture timer overflow count edge cases
Depending on the timing of the edges of the signal to be captured, a timer overflow interrupt flag may appear in the same ISR as a channel event (1st or 2nd edge capture complete) flag. Change the timer overflow math to compensate the timer overflow count based on whether the channel event happened before or after the overflow flag occured. For continuous PWM period captures, only the very first edge of the first period requires an interrupt to be captured. Subsequent "first edges" are the same edges as the second edge of the previous period. Depending on the timing of the captured signal, enabling the 1st edge interrupt in this case can cause the overflow count for subsequent first edges to be captured at the wrong point in time. Fixes: #52452 Signed-off-by:Henrik Brix Andersen <hebad@vestas.com> (cherry picked from commit b4912ea9)
Loading
Please sign in to comment