AnsweredAssumed Answered

STM32F103 200 KHz timer interrupt period

Question asked by Gregorsanec.Toni on Jul 14, 2015
Latest reply on Jul 14, 2015 by Clive One
Dear Sirs,

I have used some general timer sample from library od STM32F103 MCU,but I am having
difficulties to setup time base for 200 Khz interrupt. Not matter what I do, I can't get higher
interrupt period like 0.5ms (2Khz).

/* Compute the prescaler value */
  PrescalerValue = (uint16_t) (SystemCoreClock / 24000000) - 1;


  /* Time base configuration */
  TIM_TimeBaseStructure.TIM_Period = 65535;
  TIM_TimeBaseStructure.TIM_Prescaler = PrescalerValue;
  TIM_TimeBaseStructure.TIM_ClockDivision = 0;
  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;


  TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure);


  /* Output Compare Toggle Mode configuration: Channel1 */
  TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_Toggle;
  TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
  TIM_OCInitStructure.TIM_Pulse = 60; // assume 12Mhz counter clock
  TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low;
  TIM_OC1Init(TIM3, &TIM_OCInitStructure);

Please advice how to accomplish that

Outcomes