Skip to main content
j3lda
Associate II
February 13, 2015
Question

How to corretly stop timer

  • February 13, 2015
  • 2 replies
  • 753 views
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.
    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    February 13, 2015
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    j3lda
    j3ldaAuthor
    Associate II
    February 14, 2015
    Posted on February 14, 2015 at 11:26

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