Skip to main content
GIkar
Associate III
August 23, 2019
Question

undefined reference to `TIM_ITConfig'

  • August 23, 2019
  • 5 replies
  • 1862 views

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

This topic has been closed for replies.

5 replies

Tesla DeLorean
Guru
August 23, 2019

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 VenmoUp vote any posts that you find helpful, it shows what's working..
GIkar
GIkarAuthor
Associate III
August 23, 2019

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

Tesla DeLorean
Guru
August 23, 2019

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 VenmoUp vote any posts that you find helpful, it shows what's working..
GIkar
GIkarAuthor
Associate III
August 23, 2019

is "#define HAL_TIM_MODULE_ENABLED" enabled

GIkar
GIkarAuthor
Associate III
August 23, 2019

#include <stm32f4xx_it.h>

#include <stm32f4xx_hal_conf.h>

Bob S
Super User
August 23, 2019

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
GIkarAuthor
Associate III
September 6, 2019

Thanks. "__HAL_TIM_ENABLE_IT()" finally worked

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