[time-nuts] Homebrew frequency counter, need help

Magnus Danielson magnus at rubidium.dyndns.org
Sun Dec 14 16:14:18 UTC 2014


Hi Li Ang,

On 12/12/2014 04:40 PM, Li Ang wrote:
> Hi Bob,
>      The job done by linear regression is to reduce the uncertainty. This
> counter is designed to use continous timestamp method. My current design
> can measure 9000 times/second. If I only use the 1st and last one to
> calculate, it's the traditional recipocal + interploator method. This is
> what you can see on the chart named "without linear regression". The
> uncertainty of slope(the frequency ratio of ref and signal ) is contributed
> by these 2 measurements. With linear regression of all 9000 data within one
> second, the uncertainty will reduced to smaller one. (I really can't
> remember the ratio. Something like sqrt(9000)).

Bob's comment about filtering is correct. The lack of uncertainty is 
partly systematic and partly white noise. As you filter it, as with 
linear regression, you will weight samples with a parabolic value, 
called the Omega filtering, and this will act as a low-pass filter. The 
low-pass filter will alter the white-noise shape of the ADEV, as the 
bandwidth have reduced. This is strictly predictable by the processing. 
The produced ADEV curve is shaped by the measuring device and 
processing, not by the DUT, so it's not showing the "real ADEV" of the 
DUT, but it would not be doing that anyway. One such filtering mechanism 
exists in MDEV, but it has established formulas for how noise-shapes 
behave with various degrees of filtering, so therefore it is accepted as 
a standard.

Regression filtering for frequency measures have already been done in 
the Pendulum counter range, but not for phase measurements.

It's not as much as "right" or "wrong" as how you present the numbers 
and interprent them.

Cheers,
Magnus


>
> while(1) {
>          double t3;  //fraction part of refcnt, measured by tdc_gp22
>          double ref_curr;
>          uint32_t sig_curr;
>          static double ref_start;
>          static uint32_t sig_start;
>          uint32_t refcnt, sigcnt;
>          const uint32_t gate_time = 1000; // 1000ms gate time
>
>          if (i == 0) {
>                  init_regression(&rv);
>                  cpld_rst();
>                  timestamp(&refcnt, &sigcnt, &t3);
>                  ref_start = refcnt - t3;
>                  sig_start = sigcnt;
>                  i++;
>                  continue;
>          }
>
>          timestamp(&refcnt, &sigcnt, &t3);
>
>          regression_enter_data(&rv, refcnt - t3 - ref_start, sigcnt - sig_start);
>          if (msecond < gate_time) {
>              i++;
>              continue;
>          } else  {
>                  t = regression_slope(&rv) ; // with linear regression
>                  printf("\r\nFreq=%.*f", 14, t);
>                  ref_curr = refcnt - t3;
>                  sig_curr = sigcnt;
>
>                  t = CalcFreq(ref_curr - ref_start, sig_curr -
> sig_start); // without linear regression
>                  printf(" Interpolated=%.*f", 12, t);
>
>                  msecond = 0;
>                i = 0;
>          }
> }
>
> 2014-12-12 21:18 GMT+08:00 Bob Camp <kb8tq at n1k.org>:
>>
>> HI
>>
>>> On Dec 12, 2014, at 4:04 AM, Tom Van Baak <tvb at LeapSecond.com> wrote:
>>>
>>> This large posting is from Li Ang.
>>> /tvb
>>>
>>> ----- Original Message -----
>>> From: Li Ang
>>> To: Discussion of precise time and frequency measurement
>>> Sent: Thursday, December 11, 2014 7:37 AM
>>> Subject: Re: [time-nuts] Homebrew frequency counter, need help
>>>
>>>
>>> Hi Bob,
>>>    I've sent the PCB to the factory and I am waiting for the new board.
>> This time, it's a 4-layer borad and changed from CPLD to FPGA. This is the
>> first time of FPGA & 4-layer project. Hope everthing be OK.
>>
>> Very nice looking. I hope it works !!!
>>
>>>    TPS79333 as the LDO for TDC. Better PSRR and noise spec than before
>> (XC6206). Analog and digital parts have their dedicated LDO.
>>>
>>>
>>>    While I'm waiting the the new board. I did a test with PRS10 & FE5650
>> with current board. It's strange that the 20s adev of "without linear
>> regression" is better than "with linear regression”
>>
>> Be careful pre-processing ADEV data. There are a variety of statistical
>> “traps” you can fall into. An overly simple explanation is that ADEV looks
>> at noise and that most pre-processing is a filter. Filters take out noise.
>> Finding one that only takes out the “bad noise” and keeps the “good noise”
>> can be quite difficult.
>>
>> What exactly are you doing in your linear regression computation?
>>
>> Bob
>>
>>>
>> .<bottom_layer.GIF><power_plane.GIF><top_layer.GIF><adev.gif>_______________________________________________
>>> 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.
>>
>> _______________________________________________
>> 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.
>>
> _______________________________________________
> 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.
>



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