cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 TIM Frequency and Delay Measurement

roland23
Associate II
Posted on November 06, 2015 at 08:35

I have the following Problem:

I have two input signals. The frequency of the signals is equal, but there is a delay between this signals.

I have to measure the delay between the rising edge of the first input and the rising edge of the second input. I have also to measure the frequency of one Signal.

I'm using the STM32F429.

Example:

0690X000006032PQAQ.jpg

Is it possible to solve this problem with a hardware timer?
2 REPLIES 2
Posted on November 07, 2015 at 22:03

This is almost the same as measuring pulse width of PWM - see the PWM input sub-chapter of TIM chapter. The only difference is that you don't set capture2's source to channel 1, but each channel captures its own ''native'' input.

JW

vincenthamp9
Associate III
Posted on November 08, 2015 at 11:52

This is one of the most basic examples of input captures possible. Configure a timer of your choice with a certain base time with a precision in range (so at least something as high as the highest possible delay time).

Choose two input channels (most timers have ~4) and configure them for input capture. Activate the interrupt of the channel which triggers the delayed signal and then compare the CCR registers of both channels for the actual delay.