[time-nuts] Re: Adding PTP or NTP to my GPSDO

Andrew Rodland andrew at cleverdomain.org
Mon Jul 12 03:25:48 UTC 2021


On Sunday, May 30, 2021 3:09:16 PM EDT Pluess, Tobias wrote:
> Besides that, I also thought about adding a NTP. That would not require a
> MAC with PTP capability. Any thoughts on that? has anyone ever written
> their own NTP server on a microcontroller?

I have, twice — once for the Arduino Uno (ATmega328) with W5100 Ethernet (not 
great; the W5100's own processor adds quite a lot of jitter, but it was still 
good to better than 100us), and once for an Arduino Due clone (ATSAM3X8E) 
using the internal Ethernet MAC. Both of them are up on GitHub: 
https://github.com/arodland?tab=repositories&q=ntp

Probably most of it is not much use to you, but the NTP protocol 
implementation at lines 27 - 216 of
https://github.com/arodland/Due-GPS-NTP-Server/blob/master/ethernet.cpp
might be educational.

One trick to keep in mind when doing NTP on a micro is: you don't need to 
bother with an ARP implementation, just swap the src and dst MAC addresses 
along with the src and dst IP addresses when you send your reply.

Cheers,

Andrew KC2G





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