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:
You can search and find various videos (step-by-step) about STM32 PWM in Interrupt mode.
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