summaryrefslogtreecommitdiff
path: root/bsp
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2019-08-19 16:47:19 +0800
committerGitHub <[email protected]>2019-08-19 16:47:19 +0800
commitccf80cc2f339f94cbb1af5f45eaadfe92c4451d5 (patch)
tree5532b215638c5f2b9b66283bd0e6fb83d8d1b057 /bsp
parent38209e26525f4976c50a325238753c5bed23e659 (diff)
parent2e90a7e5b2a984a5fdba24564e930a74a97bb01b (diff)
Merge pull request #2953 from wuhanstudio/pwm-clock-enable
[stm32][driver] pwm enable clock
Diffstat (limited to 'bsp')
-rw-r--r--bsp/stm32/libraries/HAL_Drivers/drv_pwm.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c b/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c
index 292d5015f2..247c8f88fe 100644
--- a/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c
+++ b/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c
@@ -322,24 +322,25 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device)
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4)
tim->Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
#endif
- if (HAL_TIM_Base_Init(tim) != HAL_OK)
+
+ if (HAL_TIM_PWM_Init(tim) != HAL_OK)
{
- LOG_E("%s time base init failed", device->name);
+ LOG_E("%s pwm init failed", device->name);
result = -RT_ERROR;
goto __exit;
}
- clock_config.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
- if (HAL_TIM_ConfigClockSource(tim, &clock_config) != HAL_OK)
+ if (HAL_TIM_Base_Init(tim) != HAL_OK)
{
- LOG_E("%s clock init failed", device->name);
+ LOG_E("%s time base init failed", device->name);
result = -RT_ERROR;
goto __exit;
}
- if (HAL_TIM_PWM_Init(tim) != HAL_OK)
+ clock_config.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
+ if (HAL_TIM_ConfigClockSource(tim, &clock_config) != HAL_OK)
{
- LOG_E("%s pwm init failed", device->name);
+ LOG_E("%s clock init failed", device->name);
result = -RT_ERROR;
goto __exit;
}