2024-03-29 10:33 AM
2024-04-02 01:04 AM - edited 2024-04-02 02:42 AM
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.
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: