AnsweredAssumed Answered

Using STM32F103 to generate 1 millisecond interrupt

Question asked by Jim on Jul 25, 2016
Latest reply on Jul 26, 2016 by Clive One
Hello, trying to generate 1 millisecond interrupt using TIM4 timer with in STM32F103 series of processor. By selecting htim4.Init.Period = 1 able to generate Two millisecond interrupt. When we configure htim4.Init.Period = 0, not able to get any interrupt.

Here is the Init Code for TIM4:

void MX_TIM4_Init(void)
  TIM_ClockConfigTypeDef sClockSourceConfig;
  TIM_MasterConfigTypeDef sMasterConfig;
  htim4.Instance = TIM4;
  htim4.Init.Prescaler = 48000;
  htim4.Init.CounterMode = TIM_COUNTERMODE_DOWN;
    htim4.Init.Period = 0;  //9;
  htim4.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
  sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
  HAL_TIM_ConfigClockSource(&htim4, &sClockSourceConfig);
  sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
  sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
  HAL_TIMEx_MasterConfigSynchronization(&htim4, &sMasterConfig);

Attached Clock configuration mxcube application in jpeg format.

Appreciate any help on this.