2015-03-23 09:56 AM
Hello,
I using a STM32F103 processor and Keil uvision MDK. I have this timer configuration in my project:
TIM_TimeBaseInitTypeDef timerInitStructure;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
timerInitStructure.TIM_Prescaler = 40000;
timerInitStructure.TIM_CounterMode = TIM_CounterMode_Up;
timerInitStructure.TIM_Period = 500;
timerInitStructure.TIM_ClockDivision = TIM_CKD_DIV1;
timerInitStructure.TIM_RepetitionCounter = 0;
TIM_TimeBaseInit(TIM2, &timerInitStructure);
TIM_Cmd(TIM2, ENABLE);
During building a project I obtain this 3 errors:
Error: L6218E: Undefined symbol TIM_GetCounter (referred from main.o).
Error: L6218E: Undefined symbol TIM_Cmd (referred from periph_init.o).
Error: L6218E: Undefined symbol TIM_TimeBaseInit (referred from periph_init.o).
In project I have included all important files like''stm32f10x_tim.h'',''stm32f10x_rcc.h'',''misc.h'',''stm32f10x_gpio.h''.
Please, can someone explain me what is reason for this errors?
2015-03-23 10:05 AM
I do not have added stm32f10x_tim.c in project. Sorry, my error.
Edit:However, timer still does not work. Counter register has always value of zero.2015-03-23 11:55 AM
aha, a back to front bulletin board, so let me try again:
Hallo, I do not know your development system, but from working with gcc in general I would say that during the link phase of the project the linker could not find the library file or the object file that has these symbols defined. The ''xxx.h'' files only say to the compiler that such a library or object file exist, the compiler then leaves an unresolved symbol indicator in the main.o file, which the linker is supposed to resolve. You did not say wether you are working under linux or windows. Under Linux I could give some hint where to start looking. Under windows it is hard for me. cheers, j.2015-03-23 01:59 PM
Keil under Windows, so not GCC and not LINUX.
Code doesn't appear objectionable, perhaps you can post a more complete example to provide context. Where are you reading TIMx->CNT? Can you output a timer channel to a pin?2015-03-24 12:48 AM
Ahoj Ivan,
> However, timer still does not work. Counter register has always value of zero. And what is the content of other registers of that timer? JW