HRTIM variable PWM glitch on STM32F334R8
Hi,
I'm generating a variable duty PWM on HRTIM1, Timer A, unit 1. It is configured to 500 kHz, with a 217 ps resolution.
I want to update the duty value every 50 kHz. It works, but on some steps, the duty glitches to high state (it seems that the compare value doesnt work on these cycles, since my compare value doesnt change on this tests).
The PWM configuration is:



I do the duty update with
// Write the value to compare in the register.
pCompareCfg.CompareValue = pwm_duty;
// Apply the compare configuration to the dessire timer unit in this case HRTIM-A1
HAL_GpioSet(HAL_GPIO_OUT_Led2, HAL_GPIO_HIGH);
HAL_HRTIM_WaveformCompareConfig(&hhrtim1, HRTIM_TIMERINDEX_TIMER_A, HRTIM_COMPAREUNIT_1, &pCompareCfg);
HAL_GpioSet(HAL_GPIO_OUT_Led2, HAL_GPIO_LOW);
In the figure, red trace is the GPIO and yellow is the PWM output.
I've also tried with:
__HAL_HRTIM_SETCOMPARE(&hhrtim1, HRTIM_TIMERINDEX_TIMER_A, HRTIM_COMPAREUNIT_1, pCompareCfg.CompareValue);
HAL_HRTIM_SoftwareUpdate(&hhrtim1, HRTIM_TIMERINDEX_TIMER_A);
Anyone has experienced this issue or know why happens?
Thanks!
