cancel
Showing results for 
Search instead for 
Did you mean: 

How to corretly stop timer

j3lda
Associate II
Posted on February 13, 2015 at 21:41

Hello, I am measuring voltage via ADC, using timer TRGO interrupt trgiggered DMA. After measuring 1000samples I need to stop, proces meassured data and then continue in meassuring. I stop timer by:

TIM_ITConfig(TIM3, TIM_IT_Update, DISABLE);

 

and after data processing I run timer again by:

TIM_ITConfig(TIM3, TIM_IT_Update, ENABLE);

 

But in debug after TIM_ITConfig(...., DISABLE);  new samples are still coming and overwriting old samples. How is it possible when I stopped timer update?

When I use: TIM_Cmd(TIM3, DISABLE);  everything is OK, but I dont know if it is neccesary to turn off whole timer....

Thank you for answeres and ideas.
2 REPLIES 2
Posted on February 13, 2015 at 22:07

Turning off the timer update interrupt is not the same as turning off the timer, or the update.

The update, and the trigger are upstream from the AND gate for the interrupt enable logic.

The counter enable would seem to be the best way to stop the count, if that in fact is what you want to happen.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
j3lda
Associate II
Posted on February 14, 2015 at 11:26

Thank you clive. I just want to stop triggering my ADC for a while.