cancel
Showing results for 
Search instead for 
Did you mean: 

How do I generate a Timer Interrupt at the completion of a series of pulses?

BMcKe.2
Associate II

Using an Advanced Timer (Timer 1 in STM32H743ZI) in PWM One-Shot mode, and using the Repetition Counter, I generate a string of 5 pulses. For each pulse, I generate a Capture/Compare Interrupt and have a CallBack routine (using "HAL_TIM_PulseFinishedCallBack(...)". This works fine.

I have also enabled the Update Interrupt for Timer 1 and expected it to service that routine at the completion of the 5 pulses as well but it does not. The code for the Interrupt is generated in the stm32h7xx_it.c file "(void TIM1_UP_IRQHandler(void))" but execution does not appear to reach it. Both Timer 1 Capture/Compare and Update Interrupts are enabled in the NVIC. I am using "void HAL_TIM_Period_ElapsedCallback(...)" as the call back routine for the Update Interrupt.

How do I get the Update Interrupt to work?

12 REPLIES 12

You can use the HAL_TIM_Base_Start_IT to start the timer including the PeriodElapsed interrupt, and then use HAL_TIM_PWM_Start to start generate PWM. If you need the compare interrupts too, then use HAL_TIM_PWM_Start_IT.

Kartikey_yendhe
Associate

what is  PWM One-Shot mode  and PWM ONE-Pulse mode?? Are both are same or different?

 

I don't remember seeing "One-shot" anywhere else but in the opening post here, so it may be misspelling of One-pulse mode.

KW