# [time-nuts] Homebrew frequency counter, need help

Li Ang lllaaa at gmail.com
Sat Nov 29 08:49:09 EST 2014

```Hi
Thanks for the great article.
I did a little test just now. To measure the refclk of itself. And this
is the result(I kept 10 digits of the fraction part):

### Frequency Counter startup ###
gate=1s #=8985  freq=10.0000000002
gate=1s #=9038  freq=10.0000000001
gate=1s #=9039  freq=10.0000000002
gate=1s #=9038  freq=10.0000000000
gate=1s #=9034  freq=10.0000000002
gate=1s #=9038  freq=10.0000000002
gate=1s #=9037  freq=10.0000000002
gate=1s #=9038  freq=10.0000000001
gate=1s #=9037  freq=10.0000000001
gate=1s #=9038  freq=10.0000000001
gate=1s #=9039  freq=10.0000000000
gate=1s #=9034  freq=10.0000000002
gate=1s #=9038  freq=10.0000000001
gate=1s #=9038  freq=10.0000000001
gate=1s #=9038  freq=10.0000000001
gate=1s #=9038  freq=10.0000000002
gate=1s #=9038  freq=10.0000000002
gate=1s #=9038  freq=10.0000000001
gate=1s #=9038  freq=10.0000000002
gate=1s #=9038  freq=10.0000000002
gate=1s #=9038  freq=10.0000000000
gate=1s #=9034  freq=10.0000000000
gate=1s #=9029  freq=10.0000000000
gate=1s #=9034  freq= 9.9999999999
gate=1s #=9034  freq=10.0000000001
gate=1s #=9030  freq=10.0000000002
gate=1s #=9037  freq=10.0000000002
gate=1s #=9038  freq=10.0000000001
gate=1s #=9038  freq=10.0000000000
gate=1s #=9034  freq=10.0000000002
gate=1s #=9038  freq=10.0000000003
gate=1s #=9038  freq=10.0000000001
gate=1s #=9038  freq=10.0000000003
gate=1s #=9037  freq=10.0000000001
gate=1s #=9038  freq=10.0000000002
gate=1s #=9038  freq=10.0000000002
gate=1s #=9038  freq=10.0000000000
gate=1s #=9030  freq=10.0000000003
gate=1s #=9038  freq=10.0000000000
gate=1s #=9034  freq=10.0000000001
gate=1s #=9038  freq=10.0000000001
gate=1s #=9039  freq=10.0000000001
gate=1s #=9038  freq=10.0000000001
gate=1s #=9037  freq=10.0000000000
gate=1s #=9030  freq=10.0000000001
gate=1s #=9038  freq=10.0000000001
gate=1s #=9037  freq= 9.9999999999
gate=1s #=9035  freq=10.0000000000
gate=1s #=9039  freq=10.0000000002
gate=1s #=9037  freq= 9.9999999999
gate=1s #=9034  freq=10.0000000002
gate=1s #=9038  freq=10.0000000001
gate=1s #=9038  freq=10.0000000001
gate=1s #=9038  freq=10.0000000001
gate=1s #=9038  freq=10.0000000002
gate=1s #=9038  freq=10.0000000000
gate=1s #=9034  freq=10.0000000000
gate=1s #=9030  freq=10.0000000001
gate=1s #=9038  freq=10.0000000001
gate=1s #=9038  freq=10.0000000000
gate=1s #=9030  freq=10.0000000001
gate=1s #=9030  freq=10.0000000000
gate=1s #=9034  freq=10.0000000001
gate=1s #=9038  freq= 9.9999999999
gate=1s #=9034  freq=10.0000000002
gate=1s #=9038  freq=10.0000000001
gate=1s #=9030  freq= 9.9999999999
gate=1s #=9034  freq=10.0000000000
gate=1s #=9030  freq=10.0000000001
gate=1s #=9038  freq=10.0000000000
gate=1s #=9031  freq=10.0000000001
gate=1s #=9038  freq=10.0000000000
gate=1s #=9039  freq=10.0000000000
gate=1s #=9034  freq=10.0000000001
gate=1s #=9038  freq=10.0000000000
gate=1s #=9039  freq=10.0000000001
gate=1s #=9038  freq=10.0000000001
gate=1s #=9038  freq=10.0000000001
gate=1s #=9038  freq=10.0000000000
gate=1s #=9034  freq=10.0000000000
gate=1s #=9039  freq=10.0000000001
gate=1s #=9037  freq=10.0000000001
gate=1s #=9038  freq=10.0000000003
gate=1s #=9038  freq=10.0000000001
gate=1s #=9038  freq=10.0000000001
gate=1s #=9038  freq=10.0000000001
gate=1s #=9038  freq=10.0000000001
gate=1s #=9038  freq=10.0000000001
gate=1s #=9030  freq=10.0000000002
gate=1s #=9038  freq=10.0000000001
gate=1s #=9037  freq=10.0000000001
gate=1s #=9030  freq=10.0000000001
gate=1s #=9037  freq= 9.9999999999
gate=1s #=9034  freq=10.0000000000
gate=1s #=9030  freq=10.0000000000
gate=1s #=9034  freq=10.0000000002
gate=1s #=9038  freq=10.0000000001
gate=1s #=9038  freq=10.0000000000
gate=1s #=9030  freq=10.0000000002
gate=1s #=9038  freq=10.0000000001
gate=1s #=9038  freq= 9.9999999999
gate=1s #=9034  freq=10.0000000001
gate=1s #=9038  freq=10.0000000002
gate=1s #=9037  freq= 9.9999999999
gate=1s #=9034  freq=10.0000000002
gate=1s #=9038  freq=10.0000000001
gate=1s #=9038  freq= 9.9999999999
gate=1s #=9034  freq=10.0000000000
gate=1s #=9030  freq=10.0000000001

2014-11-29 5:57 GMT+08:00 Kasper Pedersen <time-nuts at kasperkp.dk>:

> On 11/27/2014 03:08 PM, lllaaa wrote:
> > Hi guys,
> >     I've just get my homebrew counter working. And the resolution seems
> 10x
> > better than my RACAL DANA 1992.
> >     This counter is heavily inspired by the idea from Kasper Pedersen.
> > http://n1.taur.dk/permanent/frequencymeasurement.pdf
> >     STM32F051RB & EMP240T100C5 do the control and counting job. TDC-GP22
> as
> > the interpolator. Linear regression is done by CPU.
> >     There are no fancy analog front for both signal path and refclk path.
> > I'm using two SN75ALS176 and the schmitt input of CPLD to do the job.
> >     I've noticed that the 10s gate does not get more meaningful
> > digits(looks worse than 1s gate). So here are the questions:
> >     1) I'm wondering if I could say this is an 11 digits/s counter?
> >     2) How can I improve that? Is it limited by the 485 transceiver? I
> can
> > switch to a faster MCU, that gets more measures per second, but I think
> > that only gets no more than 2 stable bits.
> >
>
> A few things to try, and learned:
>
> Try measuring the reference against itself, triggering on the same edge
> you clock the cpld on. If your VCC is wandering, your threshold will
> wander, and you get wandering phase out of the schmitt trigger in the CPLD.
> When I built my counter, I had much fun with my 'front end' (AC04s)
> having variable heating, and thus variable delay, depending on slew rate.
> I ended up giving each input channel its own low noise regulator to keep
> crosstalk from going through VCC. I think I calculated that, for a 10MHz
> 10dBm signal, 6mV threshold error is 100ps.
>
> I assume you can pick which edge to trigger on. Measure the reference
> against itself, and read out interpolator (phase) data on either edge.
> When I did my counter, I had ground current flowing through the coax
> between the counter reference input, and the house standard. I had been
> silly and chosen a low cutoff frequency for the dc-block capacitor in
> the reference input, which meant that the resulting voltage over the
> coax shield resistance got through the dc-block, and caused phase
> modulation. On the rising edge, the noise was low. On the falling edge,
> it was nasty and wandering, since when you add LF to 10MHz, and then
> slice it, the pulsewidth varies.
>
> almost-10MHz, and plot actual timestamp vs predicted timestamp. It will
> show you if you have 10MHz crosstalk, or, if as I did, you added the
> interpolator value instead of subtracting it. In my case the counter
> appeared to work most of the time, while giving wrong readings all of
> the time.
>
>
> And congratulations on getting it working.
>
>
> /Kasper Pedersen
>
>
> (When getting 10MHz out of FEI5680As, mine had ferrite blocks around the
> dsub connectors, and while I could get a cleaner signal by shorting GND
> to shield on the connector, it was better again when I bypassed the
> connector entirely and ran coax.)
>
>
> _______________________________________________
> time-nuts mailing list -- time-nuts at febo.com
> To unsubscribe, go to
> https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
> and follow the instructions there.
>
```