AnsweredAssumed Answered

stm32cube Timer TIM2 Base IT : Callback immediatly

Question asked by meneghel.marco on Mar 5, 2015
Latest reply on Mar 9, 2015 by meneghel.marco
I generated a project with stm32cube and I set timer TIM2 with follow conf, when I call HAL_TIM_Base_Start_IT the callback is called immediatly and not after a cycle ( as I expect).

P.S. After firts callback it's works fine (cycling with configured period)

MCU is STM32F207

void MX_TIM2_Init(void)

  TIM_ClockConfigTypeDef sClockSourceConfig;
  TIM_MasterConfigTypeDef sMasterConfig;

  htim2.Instance = TIM2;
  htim2.Init.Prescaler = 60000;
  htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
  htim2.Init.Period = 10;
  htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;

  sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
  HAL_TIM_ConfigClockSource(&htim2, &sClockSourceConfig);

  sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
  sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
  HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig);