Shop OBEX P1 Docs P2 Docs Learn Events
NTP Protocol and the SX or Prop — Parallax Forums

NTP Protocol and the SX or Prop

Brian CarpenterBrian Carpenter Posts: 728
edited 2007-12-24 17:55 in General Discussion
I was thinking Harrison or any of the other guys playing with the TCP/IP stack for the Prop might be able to answer this question for me the best. But feel free to jump in if you can help.· I would like to make·an NTP (Network Time Protocol) server with a micro and a RTC circuit for proof of concept for an idea i have.· I have found a few things on the internet.· I found a site that says that NTP uses UDP port 123.· Does anyone have any experience with this? Would it make the most sense to use a product like the Digi Connect ME to do this or would it be mor practicle to use a propeller and an rj45 mag socket like is being used in the prop forums?· Any help would be greatly appreciated.


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


It's Only A Stupid Question If You Have Not Googled It First!!

Comments

  • Harrison.Harrison. Posts: 484
    edited 2007-12-24 17:55
    If you are working on a proof of concept than you may want to implement SNTP (Simple Network Time Protocol) instead. SNTP is similar to NTP, but it does not guarantee the same level of accuracy due to the stateless nature of SNTP. If you need high accuracy (millisecond to nanosecond range) than you will need to use NTP, which is much harder to implement due to the stateful nature of the protocol and the math involved. I believe Windows still uses SNTP (hence why you see 1-2 second deviations between computers).

    I would recommend reading: tools.ietf.org/html/rfc4330. It contains the latest implementation details for SNTP.

    You can use whatever you are comfortable with on the hardware side. I think embedded device servers (like the XPort and Digi Connect ME) are overkill since their UDP implementations don't quite fit the simple SNTP protocol. I would recommend something more device side (such as a Propeller + ENC28J60). That way, you can write maybe a 150 lines of code to handle UDP/SNTP. You can take a look at my HTTP server demo code which contains a UDP echo server, perfect for using as a base for SNTP. You could even use the web server side to configure the RTC clock, and the UDP echo code to respond to client SNTP requests.

    I may actually try this sometime just because it is one of the simplest protocols still in use today. It'll be interesting to see how well it stacks up against big SNTP servers run by the NIST and other organizations.

    Harrison
Sign In or Register to comment.