[LinuxPPS] Synchronizing a ZDA message with NTP using linuxPPS

Divi.Oillo at ifremer.fr Divi.Oillo at ifremer.fr
Sat Mar 20 15:38:52 CET 2010


Hello, I post this message because I need a little help.

I want to synchronise the time of my master clock "SOFY EXP 320" with  
that of my computer using NTP and linuxPPS using a serial port. My  
master clock issues a $ZQZDA frame and a PPS signal.

My configuration:
linux ubuntu "karmic koala" 10.09
kernel linux 2.6.31

I get the source code of linux 2.3.31
Then, I applied LinuxPPS patch ntp-pps-2.6.31-rc1.diff

make menuconfig
I modified this elements:

Device Drivers ---> Caracter devices ---> Serial drivers --->
	{M} 8250/16550 and compatible serial support
	<M> 8250/16550 PCMCIA device support
	(48) Maximum number of 8250/16550 serial ports
	(4) Number of 8250/16550 serial ports to register at runtime
	[*] Extended 8250/16550 serial driver options
	[*]   Support more than 4 legacy serial ports
	[*]   Support for sharing serial interrupts
	[ ]   Autodetect IRQ on standard ports (unsafe)
	[*]   Support RSA serial ports
     	     *** Non-8250 serial port support ***
	<M> MAX3100 support
	<M> Digi International NEO PCI Support

Device Drivers ---> PPS support --->
	<M> PPS support
	[*]   Use low level IRQ timestamps
	[*]   PPS debugging messages
	      *** PPS clients support ***
	<M>   Kernel timer client (Testing client, use for debug)
	<M>   PPS line discipline
	[*]   Parallel printer support

Device Drivers ---> Caracter devices --->
	<M> Parallel printer support

Then, I recompile the kernel and reboot.

I installed util-linux-ng V2.17 and I applied this patch:
  --- a/sys-utils/ldattach.c	2009-07-04 01:20:03.000000000 +0200
  +++ b/sys-utils/ldattach.c	2010-02-19 17:40:00.054134773 +0100

  @@ -242,6 +242,10 @@
   	ts.c_cflag |= (PARENB|PARODD);
   	break;
       }
  +
  +    if (ldisc == N_PPS)
  +        ts.c_iflag |= (IGNBRK|ICRNL);
  +
       ts.c_cflag |= CREAD;	/* just to be on the safe side */
       if (tcsetattr(tty_fd, TCSAFLUSH, &ts) < 0)
   	err(EXIT_FAILURE, _("cannot set terminal attributes for %s"), dev);

$ cd /usr/include
$ mv linux linux.old
$ mv asm asm.old
$ mv asm-generic asm-generic.old
$ ln -s /lib/modules/$(uname -r)/build/include/linux linux
$ ln -s /lib/modules/$(uname -r)/build/arch/x86/include/asm asm
$ ln -s /lib/modules/$(uname -r)/build/include/asm-generic asm-generic
# cp /lib/modules/2.6.31.9-pps/build/Documentation/pps/timepps.h .

$ sudo modprobe 8250
$ ldattach 18 /dev/ttyS0

$ ls -l /dev/pps*
crw-rw---- 1 root root 251, 0 2010-03-20 06:51 /dev/pps0

$ tree /sys/class/pps/pps0
/sys/class/pps/pps0
|-- assert
|-- clear
|-- dev
|-- echo
|-- mode
|-- name
|-- path
|-- power
|   `-- wakeup
|-- subsystem -> ../../../../class/pps
`-- uevent

2 directories, 9 files

$ sudo ./ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1269069406.008529871, sequence: 3151 - clear   
1269069406.508538933, sequence: 3152
source 0 - assert 1269069407.008474012, sequence: 3152 - clear   
1269069406.508538933, sequence: 3152
source 0 - assert 1269069407.008474012, sequence: 3152 - clear   
1269069407.508536805, sequence: 3153

Then, I create the folowing links:
$ sudo ln -sf /dev/ttyS0 /dev/gps0
$ sudo ln -sf /dev/pps0 /dev/gpspps0

Then, I installed ntp-4.2.4p8 and I applied the nmea.patch  
(http://ftp.enneenne.com/pub/misc/linuxpps/refclocks/nmea/). The  
problem is that my signal is a ZDA, and this version of NTP don't work  
with ZDA.
So, I tried to install ntp-4.2.6, a version of ntp that works with  
ZDA, but there is no patch nmea.c for this version of NTP.

I modified the file /etc/ntp.conf and I added this two lines :
	server 127.127.20.0 prefer minpoll 4
	fudge 127.127.20.0 flag3 1 flag2 0 time1 0.0

How can I do? Which version of ntp should I install?


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.





More information about the LinuxPPS mailing list