[ntp:questions] Using a uC based embedded device as SNTP server
hart at ntp.org
Thu Feb 16 14:52:58 UTC 2012
2012/2/16 Thorsten Mühlfelder <thenktor at gmail.com>:
> I've already posted these questions 8 months ago without answers, but
> now the problem came to my mind again. Sorry for double post.
> I'm using a Atmel uC embedded device as SNTP server. The code is
> working so far, but I wonder what the correct settings are for:
> * stratum
> * precision
> * root dispersion
> * reference identifier
> * reference timestamp
> The embedded device has a battery buffered hardware RTC, that is
> capable of 1 second resolution. The used oscillator though has a
> frequency tolerance of 20 ppm.
> On startup the device tries to get the time from a pre-configured NTP
> server once.
> In my understanding my server is a stratum 1 with reference identifier
> LOCL. Also I chose reference timestamp as last time correction by
> SNTP. Is this correct?
> I also wonder about the precision an root dispersion settings, as the
> RTC only has a resolution of 1 second.
> Thanks for any help, I'd like to set it up the right way.
Your understanding is mistaken. The only case where it appropriate
for a server not implementing the full NTP protocol to act as an NTP
server is when it has a disciplined external reference to UTC, such as
a local clock disciplined by other means to UTC time. The device you
describe is retrieving time via NTP and must run the full protocol,
which determines how to set the variables you mention, and does not
allow for a single query at startup. For example, the stratum will be
one higher than the upstream (or downstratum, if you prefer) NTP
server. The root dispersion will be the sum of the source NTP
server's root dispersion and a factor accounting for the effects of
your link to that server. The precision would be 0, as it is a power
of 2 seconds and 2**0 is one second. Precision -1 would indicate a
clock which ticks at least twice per second but less than 4 times per
second, etc. The reference timestamp would be the same as your
Please refer to RFC 5905 for all the details of NTP and SNTP.
More information about the questions