AnsweredAssumed Answered

Timer ISR implementation issue using STM32W108

Question asked by desai.parth on Mar 21, 2014
Latest reply on Apr 23, 2014 by desai.parth
Hello;

I am tryin to implement the Timer function using the General purpose timers TIM1 and TIM2 of the STM32W108 ARM Cortex M3 controller.

Following is the initialization code for the timer 2.


void timer_init()
{
  TIM2_PSC = 0x00;
  TIM2_ARR = 0x0fff; // auto reload
  TIM2_OR = 0x00;
  TIM2_CNT = 0x00;
  INT_TIM2CFG = 0x01;   //interrupt enable TIM1_IER
  TIM2_CR1 |= 0x85;
}

For trying out the implementation following ISR for the timer has been used.

 void halTimer2Isr(void)
{
  TIM2_CR1 |= 0x0;
  INT_TIM2FLAG |= 0x50;
  interrupt = 1;
}

However, while running the code the control does not transfer to the ISR.
While monitoring the register contents, it was observed that the bits 0-4 of the TIM2_ISR are immediately set to 1, once I enable the timer. The same is observed even if all the configuration registers are set to 0x00 and only the timer enable bit is set.
The operation was also checked in single steeping mode but the result remained the same.

Can anyone please guide as to where the error could be. This the first time I am trying to implement the timer function using this processor.

Thank you.

Regrads;
Parth Desai.

Outcomes