修复pwm初始化时,相应的时钟没有使能的问题
This commit is contained in:
parent
ff861d1acc
commit
d3f8b9b9c1
|
@ -323,13 +323,6 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device)
|
||||||
tim->Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
tim->Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||||
#endif
|
#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)
|
if (HAL_TIM_Base_Init(tim) != HAL_OK)
|
||||||
{
|
{
|
||||||
LOG_E("%s time base init failed", device->name);
|
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;
|
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.MasterOutputTrigger = TIM_TRGO_RESET;
|
||||||
master_config.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
master_config.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
||||||
if (HAL_TIMEx_MasterConfigSynchronization(tim, &master_config) != HAL_OK)
|
if (HAL_TIMEx_MasterConfigSynchronization(tim, &master_config) != HAL_OK)
|
||||||
|
|
Loading…
Reference in New Issue