How to measure time between signal going high, and propeller detecting it ?
Bean
Posts: 8,129
I need to measure the time between when an input signal goes high, and the time that the Propeller detects it.
This could possible be from 0 to 12.5nSec. I want to measure it to 1pSec resolution (I know I don't ask for much). But 10pSec would be okay.
The only thing I can think of is to use a counter in the feedback mode. So that when the propeller detects the signal another pin will change one propeller clock later.
This will give a pulse between 12.5nSec and 25.0nSec.
Then I could use this pulse to charge a cap through a low resistor value (220 Ohms), then measure how long it takes the cap to discharge through a high resistor value (220K).
This kind of works, but the values are log not linear, in other words short pulses are stretched more than long pulses since the cap charging/discharging is a log function.
Also the measurements are rather jittery too.
So I was just wondering if anyone had any slick ways to measure this ?
I'm open to pretty much any ideas...
Bean
This could possible be from 0 to 12.5nSec. I want to measure it to 1pSec resolution (I know I don't ask for much). But 10pSec would be okay.
The only thing I can think of is to use a counter in the feedback mode. So that when the propeller detects the signal another pin will change one propeller clock later.
This will give a pulse between 12.5nSec and 25.0nSec.
Then I could use this pulse to charge a cap through a low resistor value (220 Ohms), then measure how long it takes the cap to discharge through a high resistor value (220K).
This kind of works, but the values are log not linear, in other words short pulses are stretched more than long pulses since the cap charging/discharging is a log function.
Also the measurements are rather jittery too.
So I was just wondering if anyone had any slick ways to measure this ?
I'm open to pretty much any ideas...
Bean
Comments
At that time scale, you need to define what you mean by "detect." In your scenario, which uses an output, there's an added uncertainty due to signal propagation within the Prop itself, as well as rise time on the output line. At that point, I doubt that a direct measurment would be very meaningful.
OTOH, I suppose you could use a large sample of random inputs to create a histogram and characterize the internal delays that way. One of the smaller readings could then become a bias factor which you subtract from subsequent readings.
-Phil
Not asking for much :P I assume you don't have access to a 1GHz oscilloscope? Because it should be able to get close to 10pS timing resolution. I'd say you'd need a fast/stable XOR gate to generate the pulse. Stability wise this is getting into Micrel AnyGate territory but I'd try over-volting a fast 1.8v CMOS logic gate before messing with CML logic.
To get around the log function of a RC charge/discharge you could replace it with an op-amp integrator. I don't think single nano-second response is needed on the integrator, but it wouldn't hurt. (200-400MHz bandwidth is likely enough) I'd also use an "ideal diode" circuit to define the idle voltage of the capacitor/integrator. The added precision will let you measure short pulses better. Ideally you'd then use an analog switch to switch between a charge and discharge resistor on the integrator. But all the ones I've seen are marginal speed wise. I.e. something like a ts3a4741 (might be able to abuse a single gate inverter to fill in for a switch) In the end, it may be simpler to throw a lot of bias voltage at the charge and discharge resistors so that the charge level of the timing capacitor has less effect.
Anyway, you're only going to approach that level of timing precision with relative measurements. Even bending cables is likely to make 1pS delay changes and I'll guarantee that this circuit will be a good thermometer. A stable temperature will be required to get the precision you want.
Lawson
Thanks for the ideas.
I'll have to try the "AnyGate" devices.
Bean
What exactly are you trying to do?
The Propeller can't possibly be stable enough to do this?
Duane J
http://forums.parallax.com/showthread.php/135563-Measure-the-speed-of-electricity...?highlight=Measure+speed+electricity
Is this single short, or repetitive ?
You can solve the linearity, by using scaled current sources, in the simplest form PNP and NPN devices, as current mirrors.
I see Intersil have HFA3096BZ, which is UHF array : PNP and NPN at ft 5.5GHz and 8GHz.
I'd try a couple of fast. tinylogic (schmitt) as the Timing element, & Fast XOR gate, like a 74AUP1T57/58/97/98 - as you want no other GND/VCC noise sources.
I've also seen RF Diodes (schottky) used for current steering, (HSMS-2865?) so that might give some cost trade off on UHF transistors.
You need lowest possible stray C, and these RF parts all need 'ESD paranoid' handling.
You might want a 3-state design : Charge, discharge and a hold until next charge.
A resistor in series with the integrate cap, will ensure the high drive charge phase, gets over the Schmitt threshold.
Might need a couple of test PCBs made, to determine your noise floor LSBs.
You can also buy delay lines, OnSemi & Micrel have 1024 tap models, with 10ps taps
It is a TI part, a TPL7200, but I suspect it is vaporware... ?
1FEATURES
• Supply Voltage: 2.0V to 3.7V TSSOP - PW PACKAGE
(TOP VIEW) • Time Sensing
– LSB 52ps (typ)
– Accuracy 200ps (max)
• SPI Host Interface for Configuration and
Register Access
• Measurement Range:
– Mode 1: 10ns to 167μs
– Mode 2: Power Save Mode
250ns to 8.2ms With CLOCK = 8MHz
• Low Quiescent Current
– TDC running: 1.2 mA (typ)
– TDC off, Clock Counter on: 200 μA (typ)
The figures given suggest it has a 15 bit counter, and maybe a /100 prescaler option.
Something like this could be given a CAL pulse, to check its actual delay quanta.
IIRC Chip said that there is about 3-3.5ns delay depending on which pin and which cog. I don't think you can expect the accuracy you are requiring. There will no doubt be variation in chips from different parts of the wafer as well. BTW This is just a quick reply without totally reading/understanding what you require.
In 1pS a signal will travel about 3mm.
Here is what I am using so far:
Here is the values I get: The value are pretty stable but do move around about +/- 4.
Bean
the software logic analyzer in propforth may do what you want. it can trigger off any pin or pins, rising edge falling edge, hi or lo
time period and scale are user controled.
ranges are 1 to 40 clcok cycles (one cycle needs 4 cogs, 40 cycles uses 1 cog) using cog memory; 41 cycle and greater uses hub memory
The instructions are in PROPFORTH.HTM included in te download. I have a silly kids oriented walkthrough on the wiki pages
http://code.google.com/p/propforth/wiki/LogicAnalyzerLAC
If you application is too big to fit LAC , you can try having a secnd prop chip running LAC and physically piggy backing on your application prop. Sal does this, but I haven't.
I've been experimenting and it looks like measuring a single pulse width to within 10pSec may be doable without getting too complicated.
Bean
No, about 150um to 200um - given realistic dielectrics.
This is an interesting problem - expanding time, by charge difference, so I ran up a linear version in Spice.
Expanding time, by charge difference :
This works by charge of a Cap with a high (known) current, in a short but unknown time, and then discharges with a known much lower current, and times how long that needs.
If the currents have a 1000:1 ratio, you get 1000:1 time expansion. and a 12.5ns LSB can 'magnify' to represent a 12.5ps LSB.
The waveforms show charge(zoomed), and discharge phases.
R2 ensures the schmitt hyst is overcome. Q1 & Q2 are in the same package/matched, lowest Ccb/rf devices, used in Common Base.
Q2+U3 are there simply to track Q1, and give a precise, linear discharge current.
Q1.re is gated via the Schmitt Comparator, so the discharge ceases on 'time up', and holds the value, for the next Charge (user injected)
This auto zeros on the threshold point. The C value is not part of the equation, but it will be chosen to give the largest practical dV.
D1 reduces the swing on Vee, and C2 compensates for Cd and Cbe, to give a clean start to current.
A M-LVDS Comparator might also work, but is more expensive.
Q1 enables during the charge time, but the current ratios are very large, and if Q1 enable is inside the minimum time, it is a fixed and small error.
Charge UP, for now is a pulsed current source, but it would typically be a fast low C PNP device drive by the time window.
A known pulse width could be used to calibrate out skews in tplh, tphl
I'm lucky because in my application the pulse will always be between 12.5nSec and 25nSec. So I have a much simpler idea.
I will just use a series resistor and let the PC handle the log to linear math. I also plan to use a propeller generated pulse to calibrate.
Bean
This is really interesting. This sounds similar to what laserdeveloper did with his laser rangefinder last year. The phrase "expanding time" drew a lots of calls of "BS". It came out to be accurate to a couple centimetres up to a half mile.
But he said there was a problem with noise, so he had to take multiple readings and average them. I think he did ten per second. Displaying the reading on the second every second was the slowest part, as I recall.
So how fancy does the circuit have to be to make this work with a single pulse? Is this in the realm of something a hobbyist n00b can do? What if I enlist the aid of the local hackerspace, who can design their own circuits and etch custom surface mount boards?
Should this be a separate thread?
Of course, you are pushing down into the noise floor, and jitters and skews all work against you.
If you can average, you certainly should do that.
Also on any sort of echo system, the echo itself is going to be low level, and very noisy.
The simplest possible expand-by-charge-balance is two resistors(maybe 1000:1), and a cap, and some form of analog gate (Diode/analog SW/Open Drain/open collector).
That is non linear, but as Bean is doing, that can be 'fixed-later' - it does gain points for simplicity.
The issues are the same as for classic Dual Slope voltmeters, and if you wanted true single shot, you need to add an Auto-zero state, so you know the Cap is starting from exactly the end-of-charge threshold (ie zero point).
In the circuit above, the circuit tristates when it hits the threshold, but you cannot wait too long floating without adding errors.
In a Prop, you could add the Auto zero state in SW, and use the pin threshold as the comparator, for all modes.
It would help to choose the 'quietest pin', and maybe even GND the lead frame either side, and shut down as much as possible during the measure cycle.
Injection devices ? - perhaps '3357 Analog Switch (this uses 2 select pins to do Edge and On/Off in one package), or
I am favouring a 74AUP2G38 - 2 IP pins and open drain (2.3ns, 0.9pF), and the Dual Gate nature opens the door to doing current control via Vdd.
You would use one half always on, and DC regulate Vcc to give a reference current, and expect the other half to track that,
or you could just use a load resistor, applying KISS.
Another benefit of the 2Gate, is you can use one to inject a CAL signal, so do not need to add multiplexers to the critical signal path.
The 74AUP2G38 includes schmitt IPs & wide Vcc tolerance, so you could use this to create fine delays for testing.
Plenty of scope for tests, using a cheap and simple part.
Bean: please keep the forum up to date on your progress. I've made several boards that measure the buildup time of a Q-switched laser and I'd love to have 100pS to 1nS resolution. I'd also look at correcting the output of the sub-clock measurement circuit on the Prop. It shouldn't be too hard to generate a 50-100 entry look up table and interpolate the true delay from that.
Lawson
Yes, but you would need two, one for XOR (or almost any 2 pin logic operation) and one using /OE as an Open Drain buffer.
A benefit of such a gate, is you can try various combinations quite easily.
However, an important detail of using a Twin Gate (2Gxx Open Drain, is you can use one channel as the reference in a current mirror, and should get same-die tracking performance.
Spice says an LM317 style regulator as a current injector, works quite well on a Pair of N-FETS Current Mirror.
1G56/1G59/1G95/1G96
only minus, is the package is leadless MicroPak, so not practical for low volume use.