From b535740fff58a51e4370bf654df5e62e29785d5d Mon Sep 17 00:00:00 2001 From: Alan Carvalho de Assis Date: Thu, 15 Feb 2024 12:50:25 -0300 Subject: [PATCH] arch/stm32f7: Clear all PWM channel when during STOP I noticed when executing pwm STOP command in multichannel mode, the channel still outputting. This commit fixes this issue. Signed-off-by: Alan C. Assis --- arch/arm/src/stm32f7/stm32_pwm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/src/stm32f7/stm32_pwm.c b/arch/arm/src/stm32f7/stm32_pwm.c index fb88fcc9aed09..d1d3d76bc2708 100644 --- a/arch/arm/src/stm32f7/stm32_pwm.c +++ b/arch/arm/src/stm32f7/stm32_pwm.c @@ -4007,6 +4007,13 @@ static int pwm_stop(struct pwm_lowerhalf_s *dev) outputs = pwm_outputs_from_channels(priv); ret = pwm_outputs_enable(dev, outputs, false); + /* Clear all channels */ + + pwm_putreg(priv, STM32_GTIM_CCR1_OFFSET, 0); + pwm_putreg(priv, STM32_GTIM_CCR2_OFFSET, 0); + pwm_putreg(priv, STM32_GTIM_CCR3_OFFSET, 0); + pwm_putreg(priv, STM32_GTIM_CCR4_OFFSET, 0); + leave_critical_section(flags); pwm_dumpregs(dev, "After stop");