cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4Discover - Accurately time 8 inputs

Daniel Kelly
Associate
Posted on July 21, 2017 at 08:51

Hi,

Apologies ahead of time if my terminology isn't spot on, pretty new to this.

What I'm trying to do is accurately time LOW to HIGH events on 8 separate pins relative to each other. I've calculated that I need 32 bit timers to work at 84 Mhz, but need two timers to do so since each has 4 direct input capture channels. TIM2 and TIM5 are the only 32-bit timers on the STM32F4. 

Here are the problems I'm having:

1.   I'm having trouble synchronizing TIM2 and TIM5.

2.   It's possible each Channel on TIM2 is connected to the same pin as the Channels on TIM5. If this is true then I might not be able to use these two timers in this way.

Any weigh ins on these issues, or any advice generally is welcome!

Thanks,

Dan

#synchronize #input-capture #timer
2 REPLIES 2
S.Ma
Principal
Posted on July 21, 2017 at 11:08

My quick guess would be to take 3 timers using 1 common channel to start them them in one shot mode, and 3 output compare to run the transitions. Use chanel 1 as input trigger and connect all of them to a GPIO or else. There are surely better ways to be suggested by others...

andy b
Senior
Posted on August 09, 2017 at 14:23

Hi

This would probably be possibly done with timers but I think you you may be using the wrong mcu for this.ARM based microcontrollers have certain weakness one of them is that their GPIO's are slow.That is because they are not direcly connected to the core.They are treated as a peripheral ,like an UART , SPI ,I2C , etc .This brings the problme where it may be hard to syncronise your events one to another since pins change state in a variable timing.This means that if you are trying to read a 84MHz you will need to crank the core speed to its max (168MHz) and to crank the GPIO speed to its max.Including the APBx peripheral clocks speeds. It's hard to give more advice we would need more explanation about what you are trying to do when you say ''relative to each other'' what do you mean? Are you trying to make a ''homemade'' parallel bus ? Is it really required for you to read a 84MHz signal ?

Seems like an interesting idea would like to hear more about it.

-Andy