2024-12-18 12:24 PM
Hi,
I have configured two PWM channels with complimentary channels on TIM1. I am mainly using the STM32CubeMX for configuration. The MX_TIM1_Init() function has been generated successfully which does use the HAL driver for configuring the PWM channels.
However, when I called HAL_TIM_PWM_Start() function to start PWM generation on each of the channel, only the base channels were generated successfully but non of the complimentary ones have been generated.
So I had to use the stm32h5xx_ll_tim.h driver that managed to generate all PWM channels successfully.
Here is the working PWM start generation code:
/* Enable outputs OC1, OC1N, OC2, OC2N, OC3 and OC3N */
LL_TIM_CC_EnableChannel(htim1.Instance, LL_TIM_CHANNEL_CH1 |
LL_TIM_CHANNEL_CH1N |
LL_TIM_CHANNEL_CH2 |
LL_TIM_CHANNEL_CH2N);
/* Enable counter */
LL_TIM_EnableCounter(htim1.Instance);
/* Force update generation */
LL_TIM_GenerateEvent_UPDATE(htim1.Instance);
What is wrong with the tim PWM HAL driver for stm32h5 series?
Regards,
Hani
2024-12-18 01:59 PM
For PWM on complementary output, use HAL_TIMEx_PWMN_Start().
JW