Associate II
Jul 25, 2016 9:20 PM UTC
Question
Using STM32F103 to generate 1 millisecond interrupt
- 1 reply
- 1649 views
Posted on July 25, 2016 at 23:20
Hello, trying to generate 1 millisecond interrupt using TIM4 timer with in STM32F103 series of processor. By selectinghtim4.Init.Period = 1 able to generate Two millisecond interrupt. When we configurehtim4.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;
HAL_TIM_Base_Init(&htim4);
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. Regards, Jim #- #stm32-timer #!stm32f103