I am new in topics on timer with registers in programming. My problem is that I need to get the phase difference between two signals. In the electronic I have two Schmitt triggers that make rissing edge when the reference signal and output signals goes through 0 and my intention is to measure the time between the singals but the phase is around 100-200 nano seconds. So I need to program the Arduino Due with registers to use the TIMER_CLOCK1 which is 84MHz / 2 = 42MHz, around 23 nano seconds period to get the higher speed and accurracy.
Searching in the datasheet I found various tables in page 857-863 and the registers in page 881. The page don't allow two images, sorry. Datasheet
I think (not secure) I need to use two input capture pins (one for each singal) to start and finish the count but I dont know how to do because I don't understand how the registers work, peripheral A and B... and I'm getting confused.
Here you have an image to help you understand the situation:
Subtracting the time of the second timer to the first time and divide by 2 I get the phase in time.
If someone could tell me how to set them up and explain it to me so I can understand it, please.
Thanks so much.
(Sorry for my english is not my matern language)