2019-03-23 11:02 AM
2019-03-23 11:11 AM
Your best course of action is to use Indirect mode on a second channel. ie CH1 Direct for one edge, CH2 Indirect (from CH1) for the other edge. This will tend to be safer as it gives you more leeway on the interrupt latency. You can also do a quick A-B measurement of time for the two edges.
The measurements will be in TIMx->CCR1 and CCR2
CH3 and CH4 can also pair in a similar fashion.
2019-03-23 11:17 AM
What is the core SYSCLK frequency and what is the max frequency of the incoming signal to measure rise and fall edge? What Clive mention (A-B) is usually the best. If you can't have 2 pins on the same signals, if there is enough time, you can also capture the timer compare value, double confirm the edge by sensing the GPIO level (it's low or high during the interrupt) then save it for later substraction.
2019-03-23 11:26 AM
thank you for your answers, I will try both solutions.
2019-03-23 11:32 AM
Bonne chance!
2019-03-23 11:38 AM
The core frequency SYSCLK I defined it at 100HZ, the frequency of the signal to be measured I will check it as soon as possible. Firstly, I want to find a starting solution.
I put you in the frame: I work with an UltraSon sensor and I want to measure the two rise and fall times of the Echo signal, so I only have one input. I think I can not work on two TIMER channels for the moment.
2019-03-23 12:32 PM
So use timer channel 1 and 2 of a timer and activate interrupt on both rise and fall edge of both channel.
Activate the interrupt on both channels.
The higher the timer frequency the more precise the delta measurement.
2019-03-23 12:38 PM
but how can I use two channels of a timer for only one input !
2019-03-23 11:40 PM
You are mentionning 2 rise and 2 fall time, meaning you probably have 2 signals to measure or 1 as output and 1 as echo feedback. If they are both pulses, they should be generated possibly from the same timer.