Micro recommendation for precise timing measurement
Hi,
I've got an application where I need to measure the relative timing between edges of a couple input signals, with a precision of 5 ns or less. For example, I want to know the time (number of clocks) between the rising edge of signal A and the rising edge of signal B. I'm doing it with an FPGA now, but it would be great if I could use a timer in a microprocessor or something similar. I haven't seen any timers that can run that fast, although I haven't done an exhaustive search. Can anyone recommend a micro that can do the job? Is there something that can even get close, say with a precision under 10 ns?
I should also mention that I'd like the parts cost to be under $10 in quantity.
Thank you and please let me know if you need some more information.
Hi Thomas.
The key here is that you have two asynchronous signals coming into the processor that have to be sampled independently, which is possible if they are both attached to GPIO pins...if configured to generate interrupts on rising edges, you could read the core cycle counter in the interrupt handler and simply subtract the first value from the second to obtain the relationship. However, the GPIO ring on the Blackfin processors is in the system clock domain, so edge detection is limited to the system clock frequency. Some processors support SCLKs up to 133 MHz, so you could get it down to ~7.5ns precision, but that would be your baseline step value as well...said another way, if the rising edges for both signals A and B in your application sampled in the same SCLK cycle, the difference you measure in core cycles between the interrupts using this scheme would NOT be the phase relationship between the two, it would simply be the ISR overhead between servicing the A interrupt and the B interrupt. If the signals won't get that close together, then this scheme will work because you'd incur the same interrupt overhead to vector, do any context saving, and read the cycle counter for both interrupts (assuming no exceptions occur AND no higher priority or nested interrupts hold off servicing of the GPIO interrupt)...but again, the measured time would be a function of which SCLK cycle caught the edge...if Signal A goes high at the beginning of SCLK period 1 and Signal B goes high near the end of SCLK period 2, then A and B will be detected 1 SCLK apart even though they are actually nearly 2 SCLKs apart...but that would be within 7.5ns at 133MHz.
The above said, any Blackfin processor could do the above, but you'd want to go with one with faster supported SCLKs to improve the precision. The BF531 is probably the cheapest option at 133MHz, but you will find less expensive alternatives like the BF592 if 100MHz (~10ns precision) is good enough.
-Joe
Please log in to reply.