AnsweredAssumed Answered

stm32f303 counter doesn't count

Question asked by papay.jim on Feb 21, 2013
Latest reply on Feb 21, 2013 by Clive One
Hello all,
I have been on other forums and no-one has been able to help me so far.
I am implementing a timer in a stm32f303 microcontroller.
Below is the code that I am using to start it.

Can anyone give a suggestion on why the CNT register doesn't count?





TIM_TimeBaseInitTypeDef  TIM_TimeBaseStructure;

int main ( void )            
{
   
  //Enable SYSCFG clock
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

  //Timer clock
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE);
  
  //Time base configuration
  TIM_TimeBaseStructInit(&TIM_TimeBaseStructure);
  TIM_TimeBaseStructure.TIM_Period = 9999;
  TIM_TimeBaseStructure.TIM_Prescaler = 99;
  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
  TIM_TimeBaseInit(TIM4, &TIM_TimeBaseStructure);

  //TIM Interrupts enable
  TIM_ITConfig(TIM4, TIM_IT_Update, ENABLE);
  TIM_Cmd(TIM4, ENABLE);
 
  while(1);
 

Outcomes