cancel
Showing results for 
Search instead for 
Did you mean: 

undefined reference to `TIM_ITConfig'

GIkar
Associate III

Hello,

i want to set a flag to a timer with:

 TIM_ITConfig(TIM1, TIM_IT_UPDATE, ENABLE);

but get the error:

undefined reference to `TIM_ITConfig'

what i have to include?

Thanks

8 REPLIES 8

Make sure that the stm32xyx_hal_conf.h file for your project defines the TIM module for inclusion. And that the TIM library source files are in the project so the linker can get closure.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
GIkar
Associate III

0690X00000AABiBQAX.jpgI checked it the "stm32xyx_hal_conf.h" is included in the main. but the same problem What's missing?

GIkar
Associate III

#include <stm32f4xx_it.h>

#include <stm32f4xx_hal_conf.h>

You only need to include stm32f4xx.h at the top level, and you need to set a define in stm32f4xx_hal_conf.h, like #define HAL_TIM_MODULE_ENABLED

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

is "#define HAL_TIM_MODULE_ENABLED" enabled

Is the error coming from the compiler or the linker?

Make sure you have stm32f4xx_hal_tim.c brought into the project.

Perhaps looks at some of the working project templates for your IDE

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Bob S
Principal

TIM_ITConfig() is not a HAL function, is it an SPL function (the older, some would say better, Standard Peripheral Library). For example, in the STM32F4xx SPL it is defined in stm32f4xx_tim_.h. Are you perhaps trying to take code from a sample program that uses SPL and merge it into other code that uses HAL? The corresponding HAL function is a macro named __HAL_TIM_ENABLE_IT() to enable the interrupt, or __HAL_TIM_DISABLE_IT() to disable it.

EDIT: I just realized you are the same person whose post I responded to here:

https://community.st.com/s/question/0D50X0000BEYTq0SQH/capture-control-auto-reload-register-interrupt-flag

See my response there about enabling the timer capture interrupts.

GIkar
Associate III

Thanks. "__HAL_TIM_ENABLE_IT()" finally worked

Yes. It was my but i guess i asked the wrong question.