[time-nuts] NTP to discipline Raspberry Pi

mike cook mc235960 at gmail.com
Sat Jul 27 03:10:54 EDT 2013


Le 27 juil. 2013 à 03:18, Julien Ridoux a écrit :

<snip>

> 
> Hi Mike,
> 
> Thanks for the interest in the data. You are quite right for everything regarding data structure, but let me explain what we meant by that comment.
> 
> Timespec{} is a 64 bit data structure and support nanoseconds. Yes.
> 
> However, it doesn't mean that the digits below the micro-second are actually representative of anything real.
> 
> For the nanosecond digits to be something else than noise you need to make sure that:
> - the hardware counter on top of which the system clock is build has a frequency of at least 1GHz
> - the kernel does not increase the granularity of the counter readings (see the implementation of 'TSC-low' timecounter on FreeBSD for an example: http://svnweb.freebsd.org/base/stable/9/sys/x86/x86/tsc.c?view=markup) 
> 
> In the case of the raspberry pi, the relevant source code can be found around line 155 in the following kernel source file:
> https://github.com/raspberrypi/linux/blob/rpi-3.6.y/arch/arm/mach-bcm2708/bcm2708.c
> 
> As you can see, from the comments in the code, the STC counter runs at 1MHz. Any digit representing a quantity below one microsecond would have to be interpolated in some way (please don't ask me on how this is done, I am sure someone will know how the bit stuffing is done better than me).
> 
> In any case, I don't see how we can trust anything below the microsecond resolution on the Raspberry Pi when it comes to assessing the stability of the actual hardware -- again I am coming from an angle where we bypass all system clock inner mechanics driven by ntpd or equivalent.
> 
> 

  Oh spit.....

 To illustrate, Hal suggested that I string some calls to clock_gettime(). Here's the result

mike at raspberrypi ~/src $ ./test_clock_gettime_on_RPI
 return from 10 succesive calls to clock_gettime(CLOCK_MONOTONIC) 
766112 s 68807594 ns
766112 s 68811593 ns elapsed 3999 ns 
766112 s 68812593 ns elapsed 1000 ns 
766112 s 68812593 ns elapsed 0 ns 
766112 s 68813593 ns elapsed 1000 ns 
766112 s 68814593 ns elapsed 1000 ns 
766112 s 68815593 ns elapsed 1000 ns 
766112 s 68816593 ns elapsed 1000 ns 
766112 s 68816593 ns elapsed 0 ns 
766112 s 68817593 ns elapsed 1000 ns 

  Looks like I need a new platform. 

Thanks for your input Julien


> 
> 
> 
> _______________________________________________
> time-nuts mailing list -- time-nuts at febo.com
> To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
> and follow the instructions there.




More information about the time-nuts mailing list