You have direct control over TIM1_UP_TIM16_IRQHandler. It's part of user code. If you don't want HAL_TIM_IRQHandler, hijack it there, check your flags, do whatever, and skip out on calling HAL_TIM_IRQHandler. ·   · If you feel a post has answered your question, please click "Accept as Solution". Answer from TDK on community.st.com
🌐
DeepBlue
deepbluembedded.com › home › blog › stm32 timer interrupt hal example – timer mode lab
STM32 Timer Interrupt HAL Example - Timer Mode LAB – DeepBlueMbedded
February 17, 2025 - However, I do believe that there is a fundamental limitation for the timing resolution that can be enhanced by reducing the usage of HAL library functions and calling multiple functions in the process of handling various tasks. This STM32 Timer Calculator online tool that we’ve built will help you find the optimal prescaler (PSC) and auto-reload (ARR) register values to generate your desired timer interrupt intervals with a click of a button.
Discussions

A question about callback for a timer interrupt in STM32 - Electrical Engineering Stack Exchange
If I'm reading that HAL code correctly, the PWM callback function is getting called early in the process. You may just be exceeding the performance boundaries of the chip. Make sure you don't have some other interrupt active at the same time that's blocking your timer interrupt from excecuting. More on electronics.stackexchange.com
🌐 electronics.stackexchange.com
STM32 HAL timer interrupt isn't triggered - Stack Overflow
I'm trying to periodically send and Serial string from my STM32F746ZG device, using an interrupt. Most of the code is auto generated by stm32cubemx. I have hardware breakpoints (jlink) set at each More on stackoverflow.com
🌐 stackoverflow.com
timer - STM32 TIM callback to raise flag - Stack Overflow
I've read multiple times that it is usually good practice to minimize the amount of time to spend in a timer interrupt, and the advice of only raising a flag came up several times. I am using a tim... More on stackoverflow.com
🌐 stackoverflow.com
stm32 - Error setting up timer HAL PeriodElapsed Callback STM32F334R8T - Electrical Engineering Stack Exchange
I wanted to set a timer to fire an interrupt every microsecond and then increment a variable in the call back function which gets called at the end of the interrupt and if that variable has reached the desired value stop the counter with HAL_TIM_BASE_STOP_IT(). Normally when using the HAL library for STM32 at the end of an the interrupt, the interrupt handler calls a callback ... More on electronics.stackexchange.com
🌐 electronics.stackexchange.com
🌐
Steppeschool
steppeschool.com › blog › stm32-timer-interrupt
STM32 Timer Interrupt: Configuration and Implementation
October 13, 2025 - uint8_t timer_interrupt_check; void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) { timer_interrupt_check++; } You can write your custom code inside of the callback function to verify that the interrupt is functional.
🌐
DigiKey
digikey.com › en › maker › projects › getting-started-with-stm32-timers-and-timer-interrupts › d08e6493cefa486fb1e79c43c0b08cc6
Getting Started with STM32 - Timers and Timer Interrupts
In that definition, we check to make sure that the timer handle (htim) is indeed our Timer 16 and then toggle the LED pin. Note that this is a generic timer interrupt callback. If you set up multiple timer ...
🌐
ST Wiki
wiki.st.com › stm32mcu › wiki › Getting_started_with_TIM
Getting started with TIM - stm32mcu - ST wiki
Between /* USER CODE BEGIN 2 */ ... HAL_TIM_Base_Start_IT(&htim1); /* USER CODE END 2 */ When TIM1 interrupt is triggered, the function TIM1_UP_TIM16_IRQHandler is called....
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 63080344 › stm32-tim-callback-to-raise-flag
timer - STM32 TIM callback to raise flag - Stack Overflow
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) { /* USER CODE BEGIN Callback 0 */ /* USER CODE END Callback 0 */ if (htim->Instance == TIM6) { HAL_IncTick(); } /* USER CODE BEGIN Callback 1 */ else if (htim->Instance == TIM2) { TIM3_flag = 1; } else if (htim->Instance == TIM3) { TIM3_flag = 1; } /* USER CODE END Callback 1 */ } And then each of the 2 threads have a simple test on the flag, here's what it looks like for the secondary thread: void StartSecondaryThread(void *argument) { /* USER CODE BEGIN StartSecondaryThread */ HAL_TIM_Base_Start_IT(&htim3); /* Infinite loop */ for(;;) { if (TIM3_flag == 1) { runCALC(); //MORE USER CODE HERE TIM3_flag = 0; } } /* USER CODE END StartSecondaryThread */ }
🌐
VisualGDB
visualgdb.com › tutorials › arm › stm32 › timers › hal
Controlling STM32 Hardware Timers using HAL – VisualGDB Tutorials
March 31, 2016 - As long as you enable the interrupt by calling HAL_NVIC_EnableIRQ(), the timer will automatically trigger an interrupt handler function when the event occurs. You can look up the interrupt function name in the startup_stm32xxxx.c file:
🌐
STMicroelectronics Community
community.st.com › stmicroelectronics community › resources › knowledge base › stm32 mcus › how to use register callbacks in stm32
How to use register callbacks in STM32 | Community
August 11, 2023 - HAL_StatusTypeDef HAL_TIM_RegisterCallback(TIM_HandleTypeDef *htim, HAL_TIM_CallbackIDTypeDef CallbackID, pTIM_CallbackTypeDef pCallback) Note that we have some parameters to fill. The first one is a pointer to the peripheral handler, &huart3 and &htim2 for the UART3 and TIM2 respectively. The second parameter is a CallBack ID, which points to which the interrupt source calls the given CallBack.
🌐
Reddit
reddit.com › r/stm32f4 › timer interrupts and hal_tim_periodelapsedcallback
r/stm32f4 on Reddit: Timer interrupts and HAL_TIM_PeriodElapsedCallback
March 30, 2022 -

Greetings all.

I am having an issue with getting the timer interrupts to trigger, as in, they do not enter the if-statements from user code 4. I have debugged it and cycled through several times with breakpoints at the if-statements but they will not enter. The file in question is the main.c file. I have copied in what I think is relevant, but I might be wrong about that. The setup for the timers are set in Cube IDE Version 1.9.0. I am using a STM32F407VGTxLQFP100.

TLDR: The if-statements arent being entered

I hope this wasn't too confusing.

From int main(void)

HAL_TIM_Base_Start_IT(&htim6);
  HAL_TIM_Base_Start_IT(&htim13);
  TIM3->CCR1 = 950;
  HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_1);


static void MX_TIM6_Init(void)
{

  TIM_MasterConfigTypeDef sMasterConfig = {0};

  /* USER CODE BEGIN TIM6_Init 1 */

  /* USER CODE END TIM6_Init 1 */
  htim6.Instance = TIM6;
  htim6.Init.Prescaler = 16-1;
  htim6.Init.CounterMode = TIM_COUNTERMODE_UP;
  htim6.Init.Period = 50000-1;
  htim6.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;

TIM_MasterConfigTypeDef sMasterConfig = {0};
  TIM_OC_InitTypeDef sConfigOC = {0};

  /* USER CODE BEGIN TIM3_Init 1 */

  /* USER CODE END TIM3_Init 1 */
  htim3.Instance = TIM3;
  htim3.Init.Prescaler = 16-1;
  htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
  htim3.Init.Period = 1000-1;
  htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
  htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;

static void MX_TIM13_Init(void)
{

  /* USER CODE BEGIN TIM13_Init 0 */

  /* USER CODE END TIM13_Init 0 */

  /* USER CODE BEGIN TIM13_Init 1 */

  /* USER CODE END TIM13_Init 1 */
  htim13.Instance = TIM13;
  htim13.Init.Prescaler = 16000-1;
  htim13.Init.CounterMode = TIM_COUNTERMODE_UP;
  htim13.Init.Period = 100-1;
  htim13.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
  htim13.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;

From user code 4

/* USER CODE BEGIN 4 */


void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
	// Timer for å ta inn ADC målinger og sende dem på CAN
	if(htim->Instance==&htim6)
	{
		 HAL_GPIO_TogglePin(GPIOE, EN_sikring_1300W_Pin);


	}
	// Timer for så resette sikringen, KANSKJE man skal vurdere å bruke to timere, en for 1300W sikring reset, og en for 240W sikring reset?
	if(htim->Instance==&htim13)
	{
		if (counter > 100)
		{
			HAL_TIM_Base_Stop_IT(&htim13);
		}
		else
		{
			HAL_GPIO_TogglePin(GPIOE,EN_sikring_240W_Pin);
		}
		counter++;
	}
	if(htim->Instance==&htim3)
		{

		counter++;
			TIM3->CCR1 = counter;
		}
}

/* USER CODE END 4 */
🌐
St
dev.st.com › stm32cube-docs › stm32u5-hal2 › 2.0.0-beta.1.1 › docs › drivers › hal_drivers › tim › hal_tim_how_to_use.html
HAL TIM How to Use — HAL STM32U5XX 0.1.0 documentation
These functions allow to register following callbacks: By default, after the Init and when the state is HAL_TIM_STATE_INIT all interrupt callbacks are set to the corresponding weak functions HAL_TIM_<Callback_name>().
🌐
STMicroelectronics Community
community.st.com › t5 › stm32-mcus-products › how-to-disable-hal-tim-periodelapsedcallback-on-a-timer › td-p › 63378
How to disable HAL_TIM_PeriodElapsedCallback on a timer
June 15, 2022 - There is no possibility to tell HAL not use call a callback function, but as I said earlier you can define your own callback function. Can you maybe further describe your use case? Maybe I am not understanding correctly. ... from your question it is not clear to me what exactly you are trying to achieve. Do you want to call different function intstead of HAL_TIM_PeriodElapsedCallback function? Or do you want to only register different interrupts ie. capture or error interrupts? In stm32fxxx_it.c file you can delete the use of HAL_TIM_IRQHandler and handle the interrupt completely by yourself together with resetting flags.
🌐
STMicroelectronics Community
community.st.com › t5 › stm32cubemx-mcus › callback-function-for-hal-tim-onepulse-start-it › td-p › 131382
Solved: Callback function for HAL_TIM_OnePulse_Start_IT? - STMicroelectronics Community
August 16, 2022 - /* USER CODE BEGIN TIM6_Init 2 */ // Clear interrupt bit in SR that was set as a side effect of generating an update event in TIM_Base_SetConfig __HAL_TIM_CLEAR_IT(&htim6, TIM_IT_UPDATE); // enable timer update interrupt __HAL_TIM_ENABLE_IT(&htim6,TIM_IT_UPDATE); /* USER CODE END TIM6_Init 2 */ ... /* USER CODE BEGIN 4 */ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim){ if(htim==&htim6) // check source { transmissionReceived=1; } } /* USER CODE END 4 */ (Like you also suggested :smiling_face_with_smiling_eyes: ) ... PWM output on PA8 (TIM1_CH1) does not reach 0V — waveform distorted in STM32CubeIDE (MCUs) 2025-11-11
🌐
GitHub
github.com › Xxxxhx › STM32_HAL_Tutorial › blob › master › 4-Timer Interrupt.md
STM32_HAL_Tutorial/4-Timer Interrupt.md at master · Xxxxhx/STM32_HAL_Tutorial
Call the following function to start/stop timer in interrupt mode(for example in the main routine): HAL_StatusTypeDef HAL_TIM_Base_Start_IT(TIM_HandleTypeDef *htim) HAL_StatusTypeDef HAL_TIM_Base_Stop_IT(TIM_HandleTypeDef *htim)
Author   Xxxxhx