zephyr/drivers/pwm
Henrik Brix Andersen b4912ea997 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>
2022-12-05 08:06:44 -06:00
..
CMakeLists.txt
Kconfig
Kconfig.b91
Kconfig.esp32
Kconfig.gd32
Kconfig.gecko
Kconfig.imx
Kconfig.it8xxx2
Kconfig.litex
Kconfig.mcux
Kconfig.mcux_ftm
Kconfig.mcux_pwt
Kconfig.mcux_sctimer
Kconfig.mcux_tpm
Kconfig.npcx
Kconfig.nrf5_sw
Kconfig.nrfx
Kconfig.rcar
Kconfig.rpi_pico
Kconfig.rv32m1_tpm
Kconfig.sam
Kconfig.sam0
Kconfig.sifive
Kconfig.stm32
Kconfig.test
Kconfig.xec
Kconfig.xlnx
pwm_b91.c
pwm_capture.c
pwm_gd32.c
pwm_gecko.c
pwm_handlers.c
pwm_imx.c
pwm_ite_it8xxx2.c
pwm_led_esp32.c
pwm_litex.c
pwm_mc_esp32.c
pwm_mchp_xec.c
pwm_mcux.c
pwm_mcux_ftm.c
pwm_mcux_pwt.c
pwm_mcux_sctimer.c
pwm_mcux_tpm.c
pwm_npcx.c
pwm_nrf5_sw.c
pwm_nrfx.c
pwm_rcar.c
pwm_rpi_pico.c
pwm_rv32m1_tpm.c
pwm_sam.c
pwm_sam0_tcc.c
pwm_shell.c
pwm_sifive.c
pwm_stm32.c
pwm_test.c
pwm_xlnx_axi_timer.c