Configuring NTPD correctly to sync with PPS on ARM

Hi,

We are facing an issue in interfacing NTPD with PPSAPI on QNX. We have used the PPS resource manager source code and logic from cs.nyu.edu/~bacon/pps/ with the required modifications for our hardware to implement the PPS interface.

We have configured NTPD to use the PPS device /dev/pps1 by specifying the below lines in the ntp configuration file:

      # This server will be used to enumerate the seconds for the pps interface.
      server 127.127.1.0 iburst prefer minpoll 4 maxpoll 4

      # The 127.127.22.X if the pps device and corresponds to /dev/ppsX.
      server 127.127.22.1
      fudge 127.127.22.1 flag3 1

However no major drift correction is observed after ntpd running. Is there any additional configuration or procedure to be employed for interfacing NTPD with PPS in QNX?

Attached is both the ntp.log and ntp.conf files used by ntpd.

Further details:
• PPS pulse coming every second on to one of the GPIOs of the board (instead of the Serial DCD pin used in most of the x86 environment)
• PPS_resmgr(resource manager) capture the ASSERT time of PPS signal and write to /dev/pps1 on read request
• With PPS pulse coming and PPS_resmgr capturing the time
This is the output if we cat the /dev/pps1 file

# cat /dev/pps1
C        319.303537060
C        320.303467530
C        321.303397151
C        322.303326500
C        323.303256545
C        324.303186454

Here “C” means clear instance of the pulse is captured (in reality this part is hard coded, the capture happens at assert time)
The time format here is . when the PPS pulse is captured.
The pidin output is

  352272   1 ./resmgr            24r RECEIVE     1
  352272   2 ./resmgr           245r INTR
  352272   3 ./resmgr           245r INTR
  352272   4 ./resmgr            10r RECEIVE     1
  352272   5 ./resmgr            10r RECEIVE     1
  352272   6 ./resmgr            10r RECEIVE     1
  389142   1 proc/boot/pidin     10r REPLY       1

• Starting ntpd

# SOCK=/alt2 ./ntpd -c ./ntp.conf -l ntp.log -ddd&                                                                         
[2] 397334
V2X# ntpq 4.2.4p7
addto_syslog: logging to file ntp.log
addto_syslog: logging to file ntp.log

addto_syslog: set_process_priority: Leave priority alone: priority_done is <2>

addto_syslog: precision = 1000.000 usec

create_sockets(123)
addto_syslog: ntp_io: estimated max descriptors: 1000, initial socket boundary: 16

addto_syslog: Listening on interface #0 wildcard, 0.0.0.0#123 Disabled

addto_syslog: Listening on interface #1 wildcard, ::#123 Disabled

update_interfaces(123)
create_interface(127.0.0.1#123)
addto_syslog: Listening on interface #2 lo0, 127.0.0.1#123 Enabled

created interface #2: fd=18, bfd=-1, name=lo0, flags=0x15, scope=0, ifindex=0, sin=127.0.0.1, mask=255.0.0.0, Enabled:
updating interface #2: fd=18, bfd=-1, name=lo0, flags=0x15, scope=0, ifindex=0, sin=127.0.0.1, mask=255.0.0.0, Enabled: new - created
create_interface(::1#123)
addto_syslog: Listening on interface #3 lo0, ::1#123 Enabled

created interface #3: fd=19, bfd=-1, name=lo0, flags=0x15, scope=0, ifindex=0, sin=::1, Enabled:
updating interface #3: fd=19, bfd=-1, name=lo0, flags=0x15, scope=0, ifindex=0, sin=::1, Enabled: new - created
create_interface(fe80::1#123)
addto_syslog: Listening on interface #4 lo0, fe80::1#123 Enabled

created interface #4: fd=20, bfd=-1, name=lo0, flags=0x15, scope=1, ifindex=0, sin=fe80::1, Enabled:
updating interface #4: fd=20, bfd=-1, name=lo0, flags=0x15, scope=1, ifindex=0, sin=fe80::1, Enabled: new - created
create_interface(192.168.1.66#123)
addto_syslog: Listening on interface #5 ncm0, 192.168.1.66#123 Enabled

created interface #5: fd=21, bfd=-1, name=ncm0, flags=0x19, scope=0, ifindex=0, sin=192.168.1.66, bcast=192.168.1.255,, mask=255.255.255.0, Enabled:
updating interface #5: fd=21, bfd=-1, name=ncm0, flags=0x19, scope=0, ifindex=0, sin=192.168.1.66, bcast=192.168.1.255,, mask=255.255.255.0, Enabled: new - created
create_interface(fe80::1034:56ff:fe78:9abc#123)
addto_syslog: Listening on interface #6 ncm0, fe80::1034:56ff:fe78:9abc#123 Enabled

created interface #6: fd=22, bfd=-1, name=ncm0, flags=0x11, scope=18, ifindex=0, sin=fe80::1034:56ff:fe78:9abc, Enabled:
updating interface #6: fd=22, bfd=-1, name=ncm0, flags=0x11, scope=18, ifindex=0, sin=fe80::1034:56ff:fe78:9abc, Enabled: new - created
create_sockets: Total interfaces = 7
addto_syslog: Listening on routing socket on fd #23 for interface updates

init_io: maxactivefd 23
local_clock: time 0 offset 0.000000 freq 0.000 state 0
getnetnum given 127.127.22.1, got 127.127.22.1 (t_UNK/0)
newpeer: cast flags: 0x1 for address: 127.127.22.1
newpeer: using fd 18 and our addr 127.0.0.1
peer_crypto_clear: at 0 next 0 assoc ID 11168
key_expire: at 0
peer_clear: at 0 next 1 assoc ID 11168 refid INIT
newpeer: 127.0.0.1->127.127.22.1 mode 3 vers 4 poll 6 10 flags 0x1021 0x1 ttl 0 key 00000000
getnetnum given 127.127.22.1, got 127.127.22.1 (t_REF/1)
authtrust: keyid 0000ffff life 1
local_clock: time 0 offset 0.000000 freq 0.000 state 1
report_event: system event 'event_restart' (0x01) status 'sync_alarm, sync_unspec, 1 event, event_unspec' (0xc010)
refclock_transmit: at 1 127.127.22.1
peer PPS(1) event 'event_peer_clock' (0x85) status 'unreach, conf, 1 event, event_peer_clock' (0x8015)
poll_update: at 1 127.127.22.1 flags 1021 poll 6 burst 0 last 1 next 65
auth_agekeys: at 1 keys 1 expired 0
timer: refresh ts 0
timer: interface update
update_interfaces(123)

• PPS capture time once ntpd running

cat /dev/pps1
C        352.301229757
C        353.301161242
C        354.301090181
C        355.301020196
C        356.300951318
C        357.300880924
C        358.300811333
C        359.300741424
C        360.300671742
C        361.300601666
C        362.300531833
C        363.300461151
C        364.300391106
C        365.300321378
C        366.300251606
C        367.300181742
C        368.300111833
C        369.300041893

Thanks & Regards,
Joseph