IEEE 1588v2 PTP deamon

The PTP daemon (PTPd) implements the Precision Time protocol (PTP) as defined by the IEEE 1588 standard. PTP was developed to distribute very precise time information among network components. It becomes very popular in TDM over Ethernet networks, where timing information should be distributed from Master (Grandmaster) clock to Slaves (cliens of PTP). The IEEE1588v2 standard (2008) includes mappings to User Datagram Protocol (UDP)/Internet Protocol (IP), DeviceNet, and a layer-2 Ethernet implementation. The standard permits synchronization accuracies better than 1 ns.

You can use Linux PC with PTPd running in Master, Slave, Transparent clock mode as described in IEEE1588-2008. The steps below show as install and run PTPd:

1. Download the latest PTPd version from the project page: http://sourceforge.net/projects/ptpd/files/

2. Extract the source code from archive:

    # tar -xzvf ptpd-2.2.0.tar.gz


3. Compile the executable binnary file for PTPd:

    # cd ptpd-2.2.0/src/
    # make

4. To run PTPd:

    # ./ptpd2

ptpd2:
   -gGW          Protocol mode (slave/master with ntp/master without ntp)
   -b <dev>      Interface to use

   -cC  -DVfS    Console / verbose console;     Dump stats / Interval / Output file / no Syslog
   -uU           Unicast/Hybrid mode


   -hHB           Summary / Complete help file / run-time debug level

ERROR: Please select program mode


You should select the required mode to run the PTPd on your Linux PC:

  • Master only: PTPd listens eth1 interface (-b option) and writes debug info in the  /var/log/ptpd.log file:

    #./ptpd2 -b eth1 -c -G -D -f /var/log/ptpd.log


  •  Slave only: PTPd listens eth1 interface (-b option) in unicast mode (-u) and writes debug info in the  /var/log/ptpd.log file, it is assumed that the IP of Master is 10.1.0.11:

    #./ptpd2 -b eth1 -c -u 10.1.0.11 -g -D -f /var/log/ptpd.log


P.S. Looks line the latest PTPd (2.2.0) version has some bugs related to Unicast Request Mode. For some modes (without NTP) it is required to kill/stop NTP processe if it is already running on the Linux PC.

11 comments:

  1. hi,
    I got following error when i enter the master only command.

    root@NEWI5:/home/rajiv/Ilesh/ptpd-2.2.0/src# ./ptpd2 -b eth1 -c -G -D -f /var/log/ptpd.log
    Error: Multiple ptpd2 instances detected (-L to ignore lock file /var/run/kernel_clock)

    ReplyDelete
    Replies
    1. Looks like another ptpd2 process already runnung on your PC.
      To check this:

      # ps -axf | grep ptpd2

      Delete
    2. HELLO I have the same PROBLEM
      PLZ HELP :)

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Hi,

    Thanks brm,
    its nice i got it.

    Now i received message in log file as follow :

    state: 2013-06-10 13:06:38:899386, slv, 3085a9eaa18a:01, owd: 0.000000000, ofm:
    state: 2013-06-10 13:06:40:899373, slv, 3085a9eaa18a:01, owd: 0.000000000, ofm:

    can you tell me how to elaborate or analyze it.

    ReplyDelete
  4. Can you tell me it give hardware time stamping value or software time stamping ?

    ReplyDelete
    Replies
    1. I'm not sure. I think it has software time stamping. Study the help/user manuals for ptpd2.

      Delete
  5. Hi,
    Could you tell me if PTPd implements the profile Telecom (G.8265.1)?
    Thanks.

    ReplyDelete
  6. Getting below error on master
    linux-vgz3:~/ptpd-2.2.0/ptpd-2.2.0/src # ./ptpd2 -b eth0 -G -D -f ptpd.log
    Warning: 0 ntpd daemon(s) detected in parallel, but we were expecting 1. Continuing anyway.
    linux-vgz3:~/ptpd-2.2.0/ptpd-2.2.0/src #

    ReplyDelete
  7. INTERNATIONAL CONCEPT OF WORK FROM HOME
    Work from home theory is fast gaining popularity because of the freedom and flexibility that comes with it. Since one is not bound by fixed working hours, they can schedule their work at the time when they feel most productive and convenient to them. Women & Men benefit a lot from this concept of work since they can balance their home and work perfectly. People mostly find that in this situation, their productivity is higher and stress levels lower. Those who like isolation and a tranquil work environment also tend to prefer this way of working. Today, with the kind of communication networks available, millions of people worldwide are considering this option.

    Women & Men who want to be independent but cannot afford to leave their responsibilities at home aside will benefit a lot from this concept of work. It makes it easier to maintain a healthy balance between home and work. The family doesn't get neglected and you can get your work done too. You can thus effectively juggle home responsibilities with your career. Working from home is definitely a viable option but it also needs a lot of hard work and discipline. You have to make a time schedule for yourself and stick to it. There will be a time frame of course for any job you take up and you have to fulfill that project within that time frame.

    There are many things that can be done working from home. A few of them is listed below that will give you a general idea about the benefits of this concept.

    Baby-sitting
    This is the most common and highly preferred job that Women & Men like doing. Since in today's competitive world both the parents have to work they need a secure place to leave behind their children who will take care of them and parents can also relax without being worried all the time. In this job you don't require any degree or qualifications. You only have to know how to take care of children. Parents are happy to pay handsome salary and you can also earn a lot without putting too much of an effort.

    Nursery
    For those who have a garden or an open space at your disposal and are also interested in gardening can go for this method of earning money. If given proper time and efforts nursery business can flourish very well and you will earn handsomely. But just as all jobs establishing it will be a bit difficult but the end results are outstanding.

    Freelance
    Freelance can be in different wings. Either you can be a freelance reporter or a freelance photographer. You can also do designing or be in the advertising field doing project on your own. Being independent and working independently will depend on your field of work and the availability of its worth in the market. If you like doing jewellery designing you can do that at home totally independently. You can also work on freelancing as a marketing executive working from home. Wanna know more, email us on workfromhome.otr214423@gmail.com and we will send you information on how you can actually work as a marketing freelancer.


    Internet related work
    This is a very vast field and here sky is the limit. All you need is a computer and Internet facility. Whatever field you are into work at home is perfect match in the software field. You can match your time according to your convenience and complete whatever projects you get. To learn more about how to work from home, contact us today on workfromhome.otr214423@gmail.comand our team will get you started on some excellent work from home projects.


    Diet food
    Since now a days Women & Men are more conscious of the food that they eat hence they prefer to have homemade low cal food and if you can start supplying low cal food to various offices then it will be a very good source of income and not too much of efforts. You can hire a few ladies who will help you out and this can be a good business.

    Thus think over this concept and go ahead.

    ReplyDelete
  8. I am working on a project to virtually implement PTP on 3 VMs running CentOS 7. I am using ptpd2 ver 2.3 rc3 for the purpose and am stuck now with following rsults and configurations :-

    I made 2 VMs on VMWorkstation and isstalled CentOS 7 on both.

    Then i installed PTPd2.3 on both and run following commands :-

    ptpd2 -C -M -i eno16777736 -u 192.168.249.145 -S -L (On master - .145 being my slave machine)
    ptpd2 -C -s -i eno16777736 -u 192.168.249.142 -S -L (On slave - .142 being my slave machine)

    Master displays following messages :-
    [root@localhost src]# ptpd2 -C -M -i eno16777736 -u 192.168.249.145 -S -L
    2015-04-22 04:57:52.169901 ptpd2[13636].startup (info) () Configuration OK
    2015-04-22 04:57:52.172203 ptpd2[13636].startup (info) () Successfully acquired lock on /var/run/ptpd2.lock
    2015-04-22 04:57:52.172310 ptpd2[13636].startup (notice) (___) PTPDv2 started successfully on eno16777736 using "masteronly" preset (PID 13636)
    2015-04-22 04:57:52.208329 ptpd2[13636].eno16777736 (notice) (lstn_init) Now in state: PTP_LISTENING
    2015-04-22 04:57:53.585482 ptpd2[13636].eno16777736 (notice) (mst) Now in state: PTP_MASTER, Best master: 000c29fffe4575a2(unknown)/01 (self)

    Slave is able to detect my .145 machine as master clock and displays following :-
    [root@localhost Desktop]# ptpd2 -C -s -i eno16777736 -u 192.168.249.142 -S -h -L -a
    Warning: It is recommended to set the delay request interval (ptpengine:log_delayreq_interval) in unicast mode
    2015-04-22 05:36:11.169388 ptpd2[5779].startup (info) () Configuration OK
    2015-04-22 05:36:11.172710 ptpd2[5779].startup (notice) () PTPDv2 started successfully on eno16777736 using "slaveonly" preset (PID 5779)
    2015-04-22 05:36:11.188558 ptpd2[5779].eno16777736 (info) (init) Observed_drift loaded from kernel: -18411
    2015-04-22 05:36:11.188598 ptpd2[5779].eno16777736 (notice) (lstn_init) Now in state: PTP_LISTENING
    2015-04-22 05:36:11.748632 ptpd2[5779].eno16777736 (info) (lstn_init) New best master selected: 000c29fffe4575a2(unknown)/01
    2015-04-22 05:36:11.748815 ptpd2[5779].eno16777736 (notice) (slv) Now in state: PTP_SLAVE, Best master: 000c29fffe4575a2(unknown)/01
    2015-04-22 05:36:12.747693 ptpd2[5779].eno16777736 (notice) (slv) Received first Sync from Master
    2015-04-22 05:36:12.747811 ptpd2[5779].eno16777736 (notice) (slv) Servo: Going to slew the clock with the maximum frequency adjustment

    This is the entry on ptpd.log file of slave machine:-
    2015-04-22 04:12:34.542680 ptpd2[1938].startup (info) () Info: Now running as a daemon
    2015-04-22 04:12:34.561277 ptpd2[1938].startup (info) () Successfully acquired lock on /var/run/ptpd2.lock
    2015-04-22 04:12:34.561307 ptpd2[1938].startup (notice) (___) PTPDv2 started successfully on eno16777736 using "slaveonly" preset (PID 1938)
    2015-04-22 04:12:34.565580 ptpd2[1938].eno16777736 (info) (init) Observed_drift loaded from kernel: -18411
    2015-04-22 04:12:34.649248 ptpd2[1938].eno16777736 (notice) (lstn_init) Now in state: PTP_LISTENING
    2015-04-22 04:13:34.567002 ptpd2[1938].eno16777736 (warning) (lstn_init) Still in LISTENING after 5 restarts - will do a full network reset
    2015-04-22 04:13:34.659894 ptpd2[1938].eno16777736 (notice) (lstn_reset) Now in state: PTP_LISTENING
    2015-04-22 04:14:34.715744 ptpd2[1938].eno16777736 (warning) (lstn_reset) Still in LISTENING after 5 restarts - will do a full network reset
    2015-04-22 04:14:34.795028 ptpd2[1938].eno16777736 (notice) (lstn_reset) Now in state: PTP_LISTENING
    2015-04-22 04:15:34.909602 ptpd2[1938].eno16777736 (warning) (lstn_reset) Still in LISTENING after 5 restarts - will do a full network reset
    2015-04-22 04:15:34.979416 ptpd2[1938].eno16777736 (notice) (lstn_reset) Now in state: PTP_LISTENING

    Is it the right way? What should I be looking at?
    How to determine whether slave machine is synching to master?

    Please help me…am not able to find clarity anywhere.

    Regards
    Ravish

    ReplyDelete