Skip to main content
Lzhiy.1
Associate II
October 18, 2021
Solved

FOC SVPWM code,why are hCntPhA/B/C the TIM_CCR value?

  • October 18, 2021
  • 2 replies
  • 1813 views

Take the 1st sector as an example,Tim1 is configured in center-aligned mode,in function PWMC_SetPhaseVoltage Ta,Tb,Tc is figured out,then TIM_CCR1~3 are set to Ta,Tb,Tc.But in my opinion,TIM_CCR1~3 should be set as below.What do I get wrong?0693W00000FCnlyQAD.jpg

This topic has been closed for replies.
Best answer by rpip.1

The V-shaped triangle means TIMER count from ARR to 0, 0 to ARR. so Ta,b,c is applied. If TIMER is counting as 0 to ARR, ARR to 0, then your opinions is right.

2 replies

rpip.1
rpip.1Answer
Associate II
October 18, 2021

The V-shaped triangle means TIMER count from ARR to 0, 0 to ARR. so Ta,b,c is applied. If TIMER is counting as 0 to ARR, ARR to 0, then your opinions is right.

cedric H
Technical Moderator
October 18, 2021

Hello @Lzhiy.1​ ,

I am not sure I fully understand your concern, but please note that the Timer is configured in PWM mode 1.

PWM mode 1 - In upcounting, channel [1-3] are active as long as TIMx_CNT<TIMx_CCR[1-3]

else inactive. In downcounting, channel [1-3] are inactive as long as TIMx_CNT>TIMx_CCR[1-3] else active.

Regards

Cedric