Skip to main content
SRedd.5
Senior III
April 16, 2023
Solved

SVPWM implementation different from documentation

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.

This topic has been closed for replies.
JKong.3
JKong.3Best answer
Associate III
August 14, 2023

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

2 replies

SRedd.5
SRedd.5Author
Senior III
April 18, 2023

Any help on this?

JKong.3
JKong.3Best answer
Associate III
August 14, 2023

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