[ntp:questions] Re: about the kernel discipline on embedded product

Ulrich Windl Ulrich.Windl at RZ.Uni-Regensburg.DE
Fri May 19 08:46:03 UTC 2006


"Tim" <Tanguy.ropitault at gmail.com> writes:

> Hi,
> in the ntp faq, it's written:
> "Does my Operating System have the Kernel Discipline?
> To make sure, try using the ntp_gettime() system call."
> 
> Fist, I made this test on a machine... and I have the system call
> ntp_gettime(). So I think I have the kernel discipline. It's confirmed
> in the /var/log/ntp.log file with the line:
> kernel time sync enabled.
> I also tried the command ntptime which gives:
> ntp_gettime() returns code 0 (OK)
>   time c7f9adc5.296ee000  Wed, Apr 26 2006 10:28:53.161, (.161848),
>   maximum error 274450 us, estimated error 10661 us
> ntp_adjtime() returns code 0 (OK)
>   modes 0x0 (),
>   offset 1755.000 us, frequency -3.955 ppm, interval 4 s,
>   maximum error 274450 us, estimated error 10661 us,
>   status 0x1 (PLL),
>   time constant 4, precision 1.000 us, tolerance 512 ppm,
>   pps frequency 0.000 ppm, stability 512.000 ppm, jitter 200.000 us,
>   intervals 0, jitter exceeded 0, stability exceeded 0, errors 0.
> 
> So everything seems to be OK. I dont use a PPS source so PPS values are
> normal. And I use the kernel discipline with a PLL. Am I right?

Yes, so far.

> 
> 
> Now, I want to check that the kernel discipline on my embedded product.
> It's based on a Power PC CPU... I do exactly the same test.
> ntp_gettime() system call works fine. But when i check my ntp.log,
> there is always the line:
> ntp sync disabled... and I don't know why. Also if I do ntptime, here
> is the output:
> 
> ntp_gettime() returns code 5 (ERROR)

"ERROR" mean what it says.


>   time c7f9aeee.336f6000  Wed, Apr 26 2006  8:33:50.200, (.200918),
>     maximum error 227078 us, estimated error 3816 us
>     ntp_adjtime() returns code 5 (ERROR)
>       modes 0x0 (),
>         offset 2899.000 us, frequency 162.167 ppm, interval 4 s,
>           maximum error 227078 us, estimated error 3816 us,
>             status 0x1 (PLL),
>               time constant 0, precision 1.000 us, tolerance 512 ppm,
>                 pps frequency 0.000 ppm, stability 512.000 ppm, jitter
> 200.000 us,
>                   intervals 0, jitter exceeded 0, stability exceeded 0,
> errors 0.
> So why Have I return code 5 ERROR? and if the kernel discipline
> enabled? I think that yes because the status is PLL but i'm not sure...

I can only guess that the implementation of ntp_gettime() is wrong.

The patch in my PPSkit for Linux may be a bit paranoid, but maybe compare your
code with this one:

+       if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0
+           /* clock not synchronized (hardware or software error) */
+#ifdef CONFIG_NTP_PPS
            || ((time_status & (STA_PPSFREQ|STA_PPSTIME)) != 0
                && (time_status & STA_PPSSIGNAL) == 0)
-           /* p. 24, (b) */
+           /* PPS signal lost when either PPS time or PPS frequency
+            * synchronization requested
+            */
            || ((time_status & (STA_PPSTIME|STA_PPSJITTER))
                == (STA_PPSTIME|STA_PPSJITTER))
-           /* p. 24, (c) */
+           /* PPS jitter exceeded when PPS time synchronization requested */
            || ((time_status & STA_PPSFREQ) != 0
-               && (time_status & (STA_PPSWANDER|STA_PPSERROR)) != 0))
-           /* p. 24, (d) */
+               && (time_status & (STA_PPSWANDER|STA_PPSERROR)) != 0)
+           /* PPS wander exceeded or calibration error when PPS frequency
+            * synchronization requested
+            */
+#endif
+          )

Regards,
Ulrich




More information about the questions mailing list