[time-nuts] Frequency counter questions

Bob kb8tq kb8tq at n1k.org
Mon Apr 24 13:13:16 EDT 2017


Some of the process below is “not trivial”. One example:

You have a “gate” from the GPSDO and a “signal” from somewhere else. If you
want the STM to do the whole thing, the “gate” pin needs to get the job done in 
X +/-  1 cycles of the “signal” pin. Delay X (if it’s consistent) isn’t a problem. Having a
> +/- 1 cycle delay *is* a problem. The interrupt servicing structure in the MCU
may or may not be able to hit things +/- 10 ns or even +/- 100 ns.  Sometimes a
“lower power” MCU with simple code is better at this than a multi core gizmo running
a high level operating system. 

Lots of things to dig into.


> On Apr 24, 2017, at 12:45 PM, Chris Albertson <albertson.chris at gmail.com> wrote:
> On Sun, Apr 23, 2017 at 6:25 PM, Jerry Hancock <jerry at hanler.com> wrote:
>> So to summarize, if I limit my high resolution to 99,999,999.999hz and use
>> a gate of 1000 seconds, would that get me to .01hz?  If not, then what
>> would the possible resolution be?
> It is best to keep this kind of discussion on the list.  That way if some
> one like me sys something dumb, it will get noticed and called out.
> OK, so it seems you
> (1) are interested in measuring frequency up to 100 MHz but no higher.
> (2) want to use an STM32 ARM uP to
> (3) Are using the older (and simpler) design that simply counts cycles and
> divides by the gate time to measure frequency
> If the above assumptions are wrong.  STOP reading now and post corrections
> or additions
> OK so we are good to go....
> I assume you know about and intend to use the built in counter/timmer on
> the STM32.   You first step is to find out the maximum pule rate you can
> place on that pin.  Lets guess it is 48 MHz. But you are a conservative
> engineer an want to de-rate it to 24 MHz.
> This means to measure up to 100 MHz you will need a prescaler that can
> divide by 4.    This will transform you maximum 100 MHz to a maximum of 25
> MHz.   It will force you into using 4X longer gate time.   This is the only
> reason to pre-scale, because you can't otherwise process the signal.
> Now it is very simple.   You write software that starts the counters on the
> desired pin and then your GPS sends a signal every one second (You do NOT
> need to divide down the 10MHZ from a GPSDO because the GPS already has a
> one pulse per second output that feeds the DO.)   SO every one second you
> read the number of counts and keep doing this for as many seconds as you
> need   After the gate time which might be one second or 4,000 seconds you
> add up all the one second readings and compute the answer.
> Actually you can do better given the excess computer power you have:  You
> can output a frequency estimate after the first send and then each second
> you can output a more accurate value until finally after 4,000 seconds out
> have 0.001 Hz.   So in the first second you put up a display that is good
> for +/- 4 hZ and then four seconds later you can be a 1.0 Hz and after an
> hour 0.001 Hz
> As I wrote before.   I use the "trigger" output of my old Tektronix scope
> as input to my counter because the scopes trigger is MUCH better.   If you
> own a 'scope this will save you a LOT of work as all you would need to
> build is a voltage converter to take the trigger output to 3v3 volts for
> the STM32.  The STM already can do rescaling and counting.    Connect an
> I2C display and you are done with the hardware.  For a better and cheaper
> display, the STM32 can serve a web page and then you see the frequency on
> your phone.
> Chris Albertson
> Redondo Beach, California
> _______________________________________________
> 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 mailing list