STM32F103 ordinary timer interrupt problem, there is the boot after initialization, an open permit interrupt, timer interrupt function immediately into a

problem:

After boot initialization exist in TIM3_Int_Init () inside opened to allow interrupt function TIM_ITConfig (), immediately enter the timer interrupt function once. Only enter once.
Finally timer initialization function has been closed:
TIM_Cmd (TIM3, DISABLE); // temporarily closed TIMx peripherals. This function will initialize mentioned front useless.

 

 

Solution:

 

Summary: It should be TIM_TimeBaseInit (TIM5, & TIM_TimeBaseStructure); generates an update event, as long as the 
TIM_ClearFlag (TIM5, TIM_FLAG_Update); 
 TIM_ITConfig (TIM5, TIM_IT_Update, ENABLE); on TIM_TimeBaseInit (TIM5, & TIM_TimeBaseStructure); later, it will not appear opened to allow interrupt function TIM_ITConfig (), the timer interrupt function immediately enter a situation. 
IM_Cmd (TIM5, ENABLE); release after release before does not matter, he just let the counter to just put behind the words might need to clear the counter. 

Hope: to solve a permit to open an interrupt function TIM_ITConfig (), immediately enter the timer interrupt function once; there is help.

Guess you like

Origin blog.csdn.net/qq_23327993/article/details/89022170