From d3f8b9b9c14b0c4b79bc67efb8d4ff65f9552f50 Mon Sep 17 00:00:00 2001 From: z14git Date: Sun, 27 Oct 2019 17:16:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dpwm=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E6=97=B6=EF=BC=8C=E7=9B=B8=E5=BA=94=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E9=92=9F=E6=B2=A1=E6=9C=89=E4=BD=BF=E8=83=BD=E7=9A=84=E9=97=AE?= =?UTF-8?q?=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 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c b/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c index ef89018eca..2c2af0dcc0 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c @@ -323,13 +323,6 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device) tim->Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; #endif - if (HAL_TIM_PWM_Init(tim) != HAL_OK) - { - LOG_E("%s pwm init failed", device->name); - result = -RT_ERROR; - goto __exit; - } - if (HAL_TIM_Base_Init(tim) != HAL_OK) { LOG_E("%s time base init failed", device->name); @@ -345,6 +338,13 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device) goto __exit; } + if (HAL_TIM_PWM_Init(tim) != HAL_OK) + { + LOG_E("%s pwm init failed", device->name); + result = -RT_ERROR; + goto __exit; + } + master_config.MasterOutputTrigger = TIM_TRGO_RESET; master_config.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; if (HAL_TIMEx_MasterConfigSynchronization(tim, &master_config) != HAL_OK)