cancel
Showing results for 
Search instead for 
Did you mean: 

stm32g474 hrtim

xcm
Associate

tima 的pwm输出正确,但是timb的pwm一个周期出现无法reset的情况

1000063108.jpg

2 REPLIES 2
Imen.D
ST Employee

Hello @xcm 

Please try to write in English to make sure you can get an answer, because most of the people on this community can speak English but not Chinois.
If possible, to provide more details on your issue and share your code, TIM configuration, software version used.

Did you check the known HRTIM limitations in the STM32G471xx/473xx/474xx/483xx/484xx device errata - Errata sheet?

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
xcm
Associate

ok,

void HAL_HRTIM_RepetitionEventCallback(HRTIM_HandleTypeDef *hhrtim, uint32_t TimerIdx)//20kHz中断
{
if (TimerIdx == HRTIM_TIMERINDEX_TIMER_A)
{
HAL_HRTIM_WaveformOutputStart(&hhrtim1,HRTIM_OUTPUT_TA1 | HRTIM_OUTPUT_TA2 | HRTIM_OUTPUT_TB1 | HRTIM_OUTPUT_TB2 | HRTIM_OUTPUT_TC1 | HRTIM_OUTPUT_TC2);
//HAL_HRTIM_WaveformOutputStart(&hhrtim1,HRTIM_OUTPUT_TB1 | HRTIM_OUTPUT_TB2);

hhrtim1.Instance->sTimerxRegs[0].CMP1xR = SPWM_400[i];
hhrtim1.Instance->sTimerxRegs[0].CMP3xR =SPWM_400[399-i];

hhrtim1.Instance->sTimerxRegs[1].CMP1xR = SPWM_400[i];
hhrtim1.Instance->sTimerxRegs[1].CMP3xR = SPWM_400[399-i];

}
}

The two PWM is not the same as the picture shows.how to solve it.every period has a wrong pwm(50Hz).