Showing results for 
Search instead for 
Did you mean: 

Using gated timer with STM32CubeIDE, HAL, and STM32F103 MCU?


I want to create a simple demo for a gated timer in STM32F103. I am using STM32CubeIDE but I cannot find the right way to configure Cube and use HAL functions to make it work.

I have set up TIM1 timer to run at a 1kHz clock in slave mode (gated mode), using TI1FP1 as trigger source (that sets up PA8 as my gate input). I connected a push button to PA8 and 3.3V, configuring its GPIO for a pull down resistor. I enabled all TIM1 interrupts and generated the code. I used HAL_TIM_Base_Start_IT(&htim1); to start the timer but it does not generate any interrupt when I press the button. Which one of the YTIM1 interrupts should I use, and why it does not get any of the interrupts?