summaryrefslogtreecommitdiff
path: root/bsp
diff options
context:
space:
mode:
authorz14git <[email protected]>2019-10-27 17:16:06 +0800
committerz14git <[email protected]>2019-10-27 17:16:06 +0800
commitd3f8b9b9c14b0c4b79bc67efb8d4ff65f9552f50 (patch)
tree0bc1d1df3e6b380e0cd655f05fff7f7075b5b58f /bsp
parentff861d1acc8c2d83054c60aae814070b56778674 (diff)
修复pwm初始化时,相应的时钟没有使能的问题
Diffstat (limited to 'bsp')
-rw-r--r--bsp/stm32/libraries/HAL_Drivers/drv_pwm.c14
1 files 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)