Is there a way to do dead time compenstaion using a STM32g4 running a PMSM motor? When changing the PWM period to compensate the period will phase shift. Is there a way to set the low side and high side for a capture compere register in center align
My compensation today:
if(I->a >= deadband_thresholde)
{
compare_u += dead_time_comp;
}
else if(I->a <= -deadband_thresholde)
{
compare_u -= dead_time_comp;
}
if(I->b >= deadband_thresholde)
{
compare_v += dead_time_comp;
}
else if(I->b <= -deadband_thresholde)
{
compare_v -= dead_time_comp;
}
if(I->c >= deadband_thresholde)
{
compare_w += dead_time_comp;
}
else if(I->c <= -deadband_thresholde)
{
compare_w -= dead_time_comp;
}
__HAL_TIM_SET_COMPARE(htim, TIM_CHANNEL_U, compare_u);
__HAL_TIM_SET_COMPARE(htim, TIM_CHANNEL_V, compare_v);
__HAL_TIM_SET_COMPARE(htim, TIM_CHANNEL_W, compare_w);