cancel
Showing results for 
Search instead for 
Did you mean: 

Dealing with Timers

elaroussi
Associate II
Posted on February 21, 2014 at 14:16

The original post was too long to process during our migration. Please click on the attachment to read the original post.
12 REPLIES 12
Posted on April 26, 2014 at 14:43

Yes, your project seems to be missing the critical startup_stm32f10x.s (or equivalent) file, describing the STM32F1 interrupt vector table. Please review some of the template projects in the firmware libraries, and use those as a guide to setting up your own.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mn
Associate III
Posted on April 28, 2014 at 07:23

yes. i did not add ''startup_stm32f10x_hd.s'' correctly to my project.

Thanks a lot.

mn
Associate III
Posted on June 09, 2014 at 09:05

hi

i have new problem with IAR interrupt.

i config TIM2 interrupt and after execute:

TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE);

jtag jump to  ''startup_stm32f10x_hd.s''

and stop in line:

          B TIM2_IRQHandler

//---- my config and functions:

void TIM2_IRQHandler(void)// call 62.5us Timer INT Lable

{

  if (TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET) // Qualify the source

  {

    TIM_ClearITPendingBit(TIM2, TIM_IT_Update); // Clear the source

  }

    if(BufferCounter<(BfrSize-SprtBfrSize))

    {

        if(BufferCounter==0)

            Buffer_Flag=0x01;

        DAC_SetDualChannelData(DAC_Align_8b_R,Buffer[BufferCounter],Buffer[BufferCounter]);

        BufferCounter++;

    }

    else

    {

        if(BufferCounter==(BfrSize-SprtBfrSize))

            Buffer_Flag=0x02;

        DAC_SetDualChannelData(DAC_Align_8b_R,PBuffer[BufferCounter-(BfrSize-SprtBfrSize)],PBuffer[BufferCounter-(BfrSize-SprtBfrSize)]);

        BufferCounter++;

        if(BufferCounter>=BfrSize)

            BufferCounter=0;

    }

}

//----------------------------------

    RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);// TIMER2 CLOCK ENABLE

    RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM2,DISABLE);  

    NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn;      // Define the INT source

    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 7;// Define the INT Priority

    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;    

    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;// Enable and Run the Timer

    NVIC_Init(&NVIC_InitStructure);

//-------------------

void TIM_Configuration(void)// Timer Config for 10us

{

    TIM_TimeBaseInitTypeDef  TIM_TimeBaseStructure;

    TIM_TimeBaseStructure.TIM_Period = 4500;//4500  => 62.5us // Timer count to TIM_Period and will be Reset

    TIM_TimeBaseStructure.TIM_Prescaler = 720;

    TIM_TimeBaseStructure.TIM_ClockDivision =0;

    TIM_TimeBaseStructure.TIM_RepetitionCounter=0;    

    TIM_TimeBaseStructure.TIM_CounterMode =       TIM_CounterMode_Up;//TIM_CounterMode_Up;

    TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure);

    TIM_ClearITPendingBit(TIM2, TIM_IT_Update); // Clear the source

    TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE);

    TIM_Cmd(TIM2, ENABLE);    

}