cancel
Showing results for 
Search instead for 
Did you mean: 

SVPWM implementation different from documentation

SRedd.5
Senior III

There is mistake in either the documentation or the source code, which one is correct please advise.

__weak uint16_t PWMC_SetPhaseVoltage(PWMC_Handle_t *pHandle, alphabeta_t Valfa_beta)

{

wUAlpha = Valfa_beta.alpha * (int32_t)pHandle->hT_Sqrt3;

 wUBeta = -(Valfa_beta.beta * ((int32_t)pHandle->PWMperiod)) * 2;

}

 

But if you compare with the documentation

0693W00000biAOdQAM_image.png

In the alpha code the PWM period (T) is missing.

In the beta code additional 2 is found.

Why there is a difference? Please help.

1 ACCEPTED SOLUTION

Accepted Solutions
JKong.3
Associate III

for someone with the same question, in mc_config.c -> PWMC_R3_2_Handle_t PWM_Handle_M1, 
there is .hT_Sqrt3 = (PWM_PERIOD_CYCLES*SQRT3FACTOR)/16384u

PWM_PERIOD_CYCLES is in tick (clock freq / pwm freq), and SQRT3FACTOR is 16384 * sqrt(3) * 2

so there's 2 also in Ualpha, so Ualpha and Ubeta is doubled in code

View solution in original post

2 REPLIES 2
SRedd.5
Senior III

Any help on this?

JKong.3
Associate III

for someone with the same question, in mc_config.c -> PWMC_R3_2_Handle_t PWM_Handle_M1, 
there is .hT_Sqrt3 = (PWM_PERIOD_CYCLES*SQRT3FACTOR)/16384u

PWM_PERIOD_CYCLES is in tick (clock freq / pwm freq), and SQRT3FACTOR is 16384 * sqrt(3) * 2

so there's 2 also in Ualpha, so Ualpha and Ubeta is doubled in code