From aaf1abf25f47d18cd6e938f57e2a3f7db67894a1 Mon Sep 17 00:00:00 2001 From: wdfk-prog <1425075683@qq.com> Date: Thu, 1 Dec 2022 16:49:28 +0800 Subject: [PATCH] =?UTF-8?q?[fix][stm32]=E4=BF=AE=E5=A4=8D=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E9=AB=98=E7=94=B5=E5=B9=B3=E5=BC=82=E5=B8=B8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/stm32/libraries/HAL_Drivers/drv_pwm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c b/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c index 46b70e2a57..a5df7b97c5 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c @@ -278,9 +278,10 @@ static rt_err_t drv_pwm_set(TIM_HandleTypeDef *htim, struct rt_pwm_configuration { pulse = MIN_PULSE; } - else if (pulse > period) + /*To determine user input, output high level is required*/ + else if (pulse >= period) { - pulse = period; + pulse = period + 1; } __HAL_TIM_SET_COMPARE(htim, channel, pulse - 1);