kicer
kicer
This guy hasn't written anything yet

注册于 2 months ago

回答
1
文章
0
关注者
0

是设置的独立通道。

排查发现是SDK中__PWM_CountType_Config函数的问题。
CR寄存器中CNTTYPEx移位错误,导致CNTEN被覆盖,patch如下:

diff --git a/platform/drivers/wm_pwm.c b/platform/drivers/wm_pwm.c
index 7674828d3c020f718b0f71b67eb3ce29fd3f8e92..a88d3e77b1241dccd118d9ce3d64d6ab5f157c72 100644
--- a/platform/drivers/wm_pwm.c
+++ b/platform/drivers/wm_pwm.c
@@ -70,7 +70,7 @@ HAL_StatusTypeDef __PWM_CountType_Config(PWM_HandleTypeDef *hpwm, uint32_t Chann
     }
     else
     {
-        MODIFY_REG(hpwm->Instance->CR, (0x0FF << (PWM_CR_CNTTYPE0_Pos + Channel * 2)), 
+        MODIFY_REG(hpwm->Instance->CR, (0x03 << (PWM_CR_CNTTYPE0_Pos + Channel * 2)), 
                     (CounterMode << (PWM_CR_CNTTYPE0_Pos + Channel * 2)));
     }

发布
问题