cancel
Showing results for 
Search instead for 
Did you mean: 

interrupt of the timer

cchechio
Associate II
Posted on June 30, 2014 at 02:32

Can I have a link or an code example to count the rising edges that have an input signal in a prefixed time?

I need the number of rising edges in a second.

The frequency of the signal on a gpio input is in a range from 10 Hz to 70Hz.

how count the number of rising edges until the timer is 0?

I use stm32f4 discovery.

4 REPLIES 4
Posted on June 30, 2014 at 05:15

You could use one TIM in external counter mode, and use a second to define the integration period, this could trigger a DMA sample of the counter of the first, and subsequent measurements would allow you to compute the increments over the period. There may also be other gating options.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
cchechio
Associate II
Posted on June 30, 2014 at 10:46

Can I ask you an example?

cchechio
Associate II
Posted on June 30, 2014 at 10:47

where can I study this part?

Posted on June 30, 2014 at 16:52

There are several manuals for it, Data Sheet/Manual and Reference Manual. The timer section is a bit heavy going, but if you have familiarity with other micro-processor and timer designs it should give some perspective.

http://www.cs.indiana.edu/~geobrown/book.pdf

I don't really want to have to write everyone's code. I've posted some external counter examples. You could review the count every 1000 iterations of a 1ms SysTick interrupt? The kind of frequency you're talking about would seem easy to measure using PWM Input mode. Integration is perhaps more effective with faster clocks.

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/STM32F4%20Timer%20External%20Pulse%20counting&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F&currentview...

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..