From f972e1bcb7d11d3cb317c4be5ae05376143d3db8 Mon Sep 17 00:00:00 2001 From: Alan Carvalho de Assis Date: Thu, 15 Feb 2024 12:54:21 -0300 Subject: [PATCH] arch/stm32h7: 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/stm32h7/stm32_pwm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/src/stm32h7/stm32_pwm.c b/arch/arm/src/stm32h7/stm32_pwm.c index e6da7c99f2de4..d6f682ecccb71 100644 --- a/arch/arm/src/stm32h7/stm32_pwm.c +++ b/arch/arm/src/stm32h7/stm32_pwm.c @@ -4227,6 +4227,14 @@ static int pwm_stop(struct pwm_lowerhalf_s *dev) regval &= ~resetbit; putreg32(regval, regaddr); + + /* 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); pwminfo("regaddr: %08" PRIx32 " resetbit: %08" PRIx32 "\n",