I thought within 1% or so was good enough and was happy with
        that. Within 50ns is really good, is it complicated to implement
        on micro controller?

For machine control 1% is probably good enough. But I also have some
other uses with high speed (100MS/s) adc's in mind. These systems will
get a VCXO to adjust the frequency. This project is part of finding out
what kind of trouble I can expect to run into.

That being said, on the XMC4400 it's extremely simple to get proper
synchronisation. There is hardware to timestamp the incoming and outgoing
packets. There also is a clock which allows very fine grained frequency
adjustment. All built for PTP. If you have, for example, an Intel e1000e
ethernet card, this card also has the ability to timestamp the packets.

Once the PTP clocks are properly synchronised you just have to know when to
do what. The PTP clock on the XMC4400 can be used to generate an event
at that time.

This is the first microcontroller I've looked at with ethernet, but I
suspect many processors have these facilities.

Currently the sync packets consist of two timestamps. One is "now" on the
PC, and the other is the time of the next expiration of the posix timer.
An event is scheduled for this next expiration time. These events are used
to synchronise the PWM timer.

FWIW, you can have a look at the archive of the drive. In the udp_sync.cpp
file the sync packets are received. This is also where the synchronised
events are scheduled. These events are handled in ethernet.cpp which just
calls pwm.set_timestamp() for every event. The PWM synchronisation is a
bit more involved, because I also use dithering to adjust the frequency.

Because hardware timestamping is not used on the e1000e, "now" is
inaccurate, and a source of error. The other problem is that you have
to know the actual time of the posix timer expiration. I still have to
find out if I set an interval of 222222ns on a posix timer, it really is
222222ns and not some value rounded to the nearest possible interval.

regards,

Mark.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to