Skip to main content
hospodar
Associate III
March 23, 2015
Question

Timer configuration

  • March 23, 2015
  • 4 replies
  • 1162 views
Posted on March 23, 2015 at 17:56

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?
    This topic has been closed for replies.

    4 replies

    hospodar
    hospodarAuthor
    Associate III
    March 23, 2015
    Posted on March 23, 2015 at 18:05

    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.

    431023
    Visitor II
    March 23, 2015
    Posted on March 23, 2015 at 19:55

    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.

    Tesla DeLorean
    Guru
    March 23, 2015
    Posted on March 23, 2015 at 21:59

    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?

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    waclawek.jan
    Super User
    March 24, 2015
    Posted on March 24, 2015 at 08:48

    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