2019-08-23 03:28 AM
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
2019-08-23 04:31 AM
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.
2019-08-23 05:01 AM
I checked it the "stm32xyx_hal_conf.h" is included in the main. but the same problem What's missing?
2019-08-23 05:08 AM
#include <stm32f4xx_it.h>
#include <stm32f4xx_hal_conf.h>
2019-08-23 05:09 AM
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
2019-08-23 05:17 AM
is "#define HAL_TIM_MODULE_ENABLED" enabled
2019-08-23 05:49 AM
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
2019-08-23 07:02 AM
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:
See my response there about enabling the timer capture interrupts.
2019-09-06 04:12 AM
Thanks. "__HAL_TIM_ENABLE_IT()" finally worked
Yes. It was my but i guess i asked the wrong question.