[time-nuts] Of rubidium life and piggy-bank anemia....

Bruce Griffiths bruce.griffiths at xtra.co.nz
Sat Dec 1 09:21:47 UTC 2007


Poul-Henning Kamp wrote:
> In message <20071201063952.93D07BE2F at ip-64-139-1-69.sjc.megapath.net>, Hal Murr
> ay writes:
>
>   
>> Would digital inputs be good enough?  Suppose you feed several 10 MHz signals 
>> into a FPGA and program it so each input signal drives a counter.  Ignoring 
>> implementation details like synchronization, is that good enough to be 
>> interesting?  I'm assuming you have a PC that grabs all the counters every N 
>> ticks/seconds/hours/whatever.
>>     
>
> I did this 10 years ago and there are good and bad ways to do it.
> (http://phk.freebsd.dk/pubs/timecounter.pdf)
>
> "ignoring implementation details like synchronization" is like
> shipping & handling: it will get you both ways.
>
> What you want to do is this:
>
> A master counter 26-32 bits, running off your chosen frequency source.
> (mine ran 26 bit at 100 MHz in an XC6200)
>
> For each signal, a latch that latches the master counter and can be
> read out, somehow.
>
> One pseudo-signal, that you trigger from the computer, so that you
> can synchronize the computer clock with the master latch:
>
> 	t1 = getnanotime();
> 	tickle latch;
> 	t2 = getnanotime();
> 	read latch;
> 	t3 = getnanotime();
> 	do math of your choice.
>
> If a source is low frequency (power-grid, 1PPS etc), just put three
> latches in sequence on the signal, clocked by the master frequency,
> that takes care of meta-stability.
>
> If a source is high frequency, put an async prescaler/divider in
> front of the anti-meta-stability latches.
>
> If you are doing this on a PCI board, things are a lot simpler if
> your "chosen frequency source" is the PCI clock.  But that means
> that you will have to build a more elaborate mathematical model,
> since you have a unstable transfer frequency.
>
> Input noise resulted in about +/- 2LSB noise in my case, with
> very rube goldberg-esque input circuits, spend some time on
> that.
>
> Metastability will always get you +/- 1LSB noise, but it may
> not be distributed evenly over that interval, so averaging is
> not a perfect solution.  (Most of the assymetry is polarity
> based, so you could feed the same signal to two latches on
> opposite polarities and see if you can eliminate it that way).
>
> By all means: go for it, its a very fun project.
>
> And if you do it as a PCI card, please share the source :-)
>
> Poul-Henning
>
>   
You don't actually require a latch for each input as long as flag bits
(one per input channel) are used to denote which transitions occurred at
the latched count.
The flag bits should be latched along with the count.

Using a PCI card is perhaps a recipe for planned obsolescence.
If the input transition rates are relatively low (eg with PPS inputs)
then an onboard microprocessor with a serial port has more than
sufficient bandwidth to keep up.
Alternatively just embed the microprocessor and its memory in the gate
array as this simplifies the PCB layout considerably.
Just ensure the counter length is great enough to ensure that it cant
rollover more than once between successive input transitions.

Bruce




More information about the Time-nuts_lists.febo.com mailing list