Explorar o código

[bsp][stm32] Add HAL_TIM_Base_Init

Zhaoxing Li %!s(int64=4) %!d(string=hai) anos
pai
achega
bda4b68a80
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      bsp/stm32/libraries/HAL_Drivers/drv_pwm.c

+ 6 - 0
bsp/stm32/libraries/HAL_Drivers/drv_pwm.c

@@ -327,6 +327,12 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device)
     tim->Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
 #endif
 
+    if (HAL_TIM_Base_Init(tim) != HAL_OK)
+    {
+        LOG_E("%s pwm init failed", device->name);
+        result = -RT_ERROR;
+        goto __exit;
+    }
     if (HAL_TIM_PWM_Init(tim) != HAL_OK)
     {
         LOG_E("%s pwm init failed", device->name);