[time-nuts] precision timing pulse
kb8tq at n1k.org
Thu Nov 17 07:45:35 EST 2016
> On Nov 16, 2016, at 11:52 PM, jimlux <jimlux at earthlink.net> wrote:
> On 11/16/16 7:17 PM, Hal Murray wrote:
>> tvb at LeapSecond.com said:
>>> Arduino probably uses compiled code, external libraries, and interrupts so
>>> that also is a no-no for precise time.
>> There are two parts to the Arduino ecosystem. One is low cost hardware. The
>> 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 subroutines
>> coded in assembly language.
> Lots of this around
It’s around, but unless you *only* use assembly, there is no way to be sure of what is happening
on a cycle by cycle basis. Once you put that restriction on things, the whole “cute IDE” part of it
becomes more of a problem than part of the solution. Since the dividers are always in divide mode
(there are no spare cycles) you don’t have some part of the process that does not matter ….
That is only part of the problem. The other part is working out just how the i/o pins get done.
One thing about even the M series Arm’s … you still get the bus arbitration and cycle
interleaving stuff. It makes them faster by a noticeable amount. The ones with bus
cache (M4’s etc) get even more “interesting” when you try to work out exactly which cycle
the pin toggles on. They have to do something there (even on simple parts) since flash runs
at one speed, I/O at another speed, CPU at yet another clock speed, and RAM tied to either
CPU or (yikes!!) I/O. The same Teensy board line also has < $30 boards in it with all the
cache and bus stuff (180 MHz CPU and 26 MHz flash …).
> 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.
> ANd many "supported by Arduino environment" hardware platforms have hardware that can do the timing.. the teensy alluded to before has hardware timers that are trivially accessible from the Arduino dev environment, because Paul at PJRC (or other folks, too) has built APIs/libraries to get access to the capabilities of the chip.
> So you can use the "timer0" library, which is software on a vanilla Arduino, and hardware on the Freescale processor used on the teensy.
> 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