2016-06-21 01:52 AM
Hello.
I have configured the timer 6 to interrupt every 3s, but immediately after initialize the timer the interrupt occurs.Why?1 - HAL_TIM_Base_Init (&htim6);2 - HAL_TIM_Base_Start_IT(&htim6);3 - ''immediately'' (almost) it goes to interrupt handler...How can I resolve this problem?Thank you.2016-06-21 02:57 AM
> Why?
Because > 1 - HAL_TIM_Base_Init (&htim6); forces update through setting TIMx_EGR.UG (the reason is to force the prescaler setting into the real prescaler counter). > How can I resolve this problem? Clear TIMx_SR.UIF before enabling the timer. JW2016-06-21 03:32 AM
Hello.
I had already done it ... but the result is the same.The interruption is immediate ...2016-06-21 03:45 AM
Clear the flag *before* HAL_TIM_Base_Start_IT().
JW2016-06-21 04:00 AM
Oh... sorry xD.
I think that the flag had changed in Start_IT, so I tried modify the flag after...In resume, the flag is changed in Timer Init...My mistake.It works!Thank you very much!