[time-nuts] precision timing pulse
kb8tq at n1k.org
Thu Nov 17 20:18:58 EST 2016
If you head of into ARM land (or even FPGA’s) there is a bit of a gotcha. If you
want to run a 10 MHz input and a PPS output, you need a counter with at least
24 bits. The peripherals on ARM chips are all over the place. Some have very
fancy timers, but only go to 16 bits. Some have 32 bit timers that aren’t very fancy.
Some timers will clock at the input clock frequency. Others have weird pre-scale
rules on them. Since the pre-scaler is a “can’t get at it” device in terms of restarting,
it puts some limits on what you can do. With FPGA’s it’s rare to get a 1 pps divider
and all of the other stuff you want to do in less than about 64 flip flops. That’s not
a crazy thing on modern parts. It can be an issue on older parts.
> On Nov 17, 2016, at 5:45 PM, Chris Albertson <albertson.chris at gmail.com> wrote:
> For counting and timing the ARM has hardware counbter/timmer that is made
> with logic gates so you don't need software or to disable interrupts.
> Most modern uP has loads and loads of peripheral hardware built-in. With
> the ARM there is a lot more of these peripheral devices than there are pins
> on the chip so the hard part is learning how to configure the chip (each is
> So rather then doing like the PicDiv does, counting cycles in software you
> would load up a bunch of config registers to set up a hardware divide by N
> The little AVR chip on the Arduino also has built-in counter but that ARV
> chip is pretty low-end so the counter has not the best specs and there are
> not so many independent counters
> With these counters we could build a scintillation counter that is as good
> as you can build using logic gates and not have to resort to assembly
> language. We can program counters to do things like latch their contents
> so that if the interrupt handler takes some time to read a value it is OK
> because we have a hardware latch.
> It takes time to learn to use this, but there are library functions to call
> that provide a standard API across several different processors.
> From a software developer's point of view one of the biggest reasons for
> using a modern uP is debugging. Many times we can step through code, line
> by line as it executes inside the chip. Unfortunately the Arduino
> environment does not take advantage of this but most professional level
> IDEs do. If time is money source level debugging in C is worth a mint.
> Again, you really can get accurate counting, that function in moved to
> specialized hardware now that is built into the uP chip.
> On Wed, Nov 16, 2016 at 7:17 PM, Hal Murray <hmurray at megapathdsl.net> wrote:
>> tvb at LeapSecond.com said:
>>> Arduino probably uses compiled code, external libraries, and interrupts
>>> that also is a no-no for precise time.
>> There are two parts to the Arduino ecosystem. One is low cost hardware.
>> other is a software package that is easy for non-wizards to use.
>> I'd be very surprised if somebody hasn't figured out how to call
>> coded in assembly language. If so, you can use their hardware and their
>> software environment and write your code like it was running on a bare
>> machine as long as you add a wrapper to call it from their environment and
>> start your code with a disable interrupts.
>> These are my opinions. I hate spam.
>> time-nuts mailing list -- time-nuts at febo.com
>> To unsubscribe, go to https://www.febo.com/cgi-bin/
>> and follow the instructions there.
> 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