Menu

Issues running ptpd2 in QNX 6.6

Help
2017-02-13
2017-02-13
  • Jefferson Coelho

    Hi,

    I've compiled ptpd2 2.3.2 in my QNX 6.6 x86 environment with runtime debug, experimental, pcap, statistics, ptpd timers enabled, and unicast max of 128 (-DRUNTIME_DEBUG -DPTPD_EXPERIMENTAL -DPTPD_PCAP -DPTPD_STATISTICS -DPTPD_PTIMERS -DPTPD_UNICAST_MAX=128).

    Command line for the master is:
    ./ptpd2 -D -m --ptpengine:log_announce_interval=-4 --delay-interval=-8 --ptpengine:use_libpcap=y --ptpengine:interface=wm0 --global:verbose_foreground=1 --global:lock_file=/home/ptpd2.lock

    Command line for slave is:
    ./ptpd2 -D --ptpengine:use_libpcap=y --ptpengine:interface=wm0 --global:verbose_foreground=1 --global:lock_file=/home/ptpd2.lock

    With this setup, I see the master send the first sync message to the slave, and the slave adjusting its clock. Many other sync messages follow, but
    (1) the adjustment required in the following sync messages is exactly the same as in the first sync message
    (2) the slave applies the adjustment, which causes its clock to diverge from the master clock - not converge to it.

    The net effect is that the slave makes a first adjustment, then its clock fails to keep up with the master clock. Successive slave starts progressively get a better first adjustment as the drift is loaded - but the clocks are never in sync.

    Any suggestions as to how to proceed from here?

    Thank you for any insight you may offer.

     
  • Wojciech Owczarek

    Hi Jefferson,

    I would suspect that this may be purely because of timestamping inaccuracies. If you are running on x86 with experimental options enabled, the best timestamp quality on QNX you will get using regular sockets without libpcap. With experimental options, PTPd will use precise timestamp interpolation using the TSC counter and attaching itself to the timer interrupt. Try without libpcap.

    QNX support is slightly experimental i.e. I build and test in VMs, but I do not currently have QNX running on physical hardware anywhere. However the code currently in git was tested on physical x86, without libpcap, and I was seeing sub-10 us - one thing to note though, I was using a dedicated hardware grandmaster, not another PTPd.

    Thanks,
    Wojciech

     
  • Wojciech Owczarek

    I would also suggest using higher sync rates, and experimenting with filters - you should enable sync and delay statistical filters (say, median, and pick a number of samples that provides best results), and also enable sync + delay outlier filters.

    Thanks,
    Wojciech

     
  • Jefferson Coelho

    Wojciech,

    Thank you very much for taking the time to answer. Following your suggestion, I disabled pcap:
    ./configure --enable-experimental-options --enable-runtime-debug --disable-pcap --host=qnx6

    Master command line:
    ./ptpd2 -D -m --ptpengine:log_announce_interval=-4 --delay-interval=-8 --ptpengine:interface=wm0 --global:verbose_foreground=1 --global:lock_file=/home/ptpd2.lock

    Slave command line:
    ./ptpd2 -D --ptpengine:interface=wm0 --global:verbose_foreground=1 --global:lock_file=/home/ptpd2.lock

    Logs are attached. I cut the logs short because after about one minute no new type of message showed up; both master and slave keep on reporting Announce messages received, followed bu updateAlarms().

    In the logs you will see the master going from PTP_INITIALIZING to PTP_LISTENING to PTP_MASTER; the slave goes rom PTP_INITIALIZING to PTP_LISTENING to PTP_SLAVE. I will keep on experimenting with filters.

    Thank you,
    - Jefferson

     
  • Jefferson Coelho

    Quick update: I ran ptpd2 as a master in a Ubuntu host, and ran the same ptpd2 code as a slave in a QNX host. As far as I can tell, clock synchronization works in this case - see attached logs.

    Comparing the QNX and Ubuntu builds and logs, one of the differences is that SO_TIMESTAMPING is enabled for Ubuntu. Not sure if this is significant; looking at the qnx patch release notes, it seems that this was intentional.

    Not sure about which next step to take; any help will be greatly appreciated.
    Thanks,
    - Jefferson

     

Log in to post a comment.