Skip to main content
Associate II
March 29, 2024
Question

PWM in Interrupt

  • March 29, 2024
  • 1 reply
  • 840 views

how to use PWM timer1 in Interrupt mode

This topic has been closed for replies.

1 reply

ST Technical Moderator
April 2, 2024

Hello @venkateswarlu and welcome to the Community :)

You can start from STM32CubeMX to configure the peripherals and generate the code.

So, you need to configure the timer, the Clocks, the PWM channel, and the interrupt.

ImenD_0-1712043867278.png

 

You can start the PWM output in interrupt mode using HAL_TIM_PWM_Start_IT(&htim1, TIM_CHANNEL_1);
Then, implement the Interrupt Handler using HAL_TIM_IRQHandler(&htim1);

Make sure to enable GPIOx and TIMx clock in RCC and set correctly the interrupt priority.

Please refer to these resources for more info on the STM32 Timers:

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks