Skip to content

Commit

Permalink
arch/stm32h7: Clear all PWM channel when during STOP
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
acassis committed Feb 15, 2024
1 parent b535740 commit f972e1b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arch/arm/src/stm32h7/stm32_pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit f972e1b

Please sign in to comment.