This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM4378: TimeSync example

Genius 13655 points
Part Number: AM4378

Hello Champs,

How to run the below example on idkAM4379 board?

ti\AM437x\pdk_am437x_1_0_14\packages\MyExampleProjects\timeSync_BasicExample_idkAM437x_wSocLib_armExampleproject

Is there some doc demo the steps list? Does it need to enable the RTC module to run the example?

Thanks.
Rgds
Shine

  • Hi Shine,

    Refer to below user guides:

    Regards,
    Pavel

  • Hi Pavel,

    Thanks for providing the doc. But it only described the function of TimeSync example, there is no detailed steps for how to run this example. 

    Customer did the following steps:

    1. using ethernet cable to connect IDK board  PRUETH0 to PC

    2. Configure PC IP address to the same subnet 

    3. Run ptpd on PC

    But the "offset" and "delay" are not correct. 

    Thanks.

    Rgds
    Shine

  • Shin,

    The TI-RTOS timeSync example is tested with ptpd from Processor SDK Linux instead of PC. From the PTP status ('S'), we expect the the clock drift to settle to low values such as < 100 ns indicating the PTP sync.

    http://software-dl.ti.com/processor-sdk-linux-rt/esd/AM437X/latest/index_FDS.html

    Regards,

    Garrett

     

  • Thank you!

    I a following those steps above.And my  PC is ubuntu 18.0. I run ptpd in my Ubuntu and connect it to my board.

    but it didn\t work..

    so i have a problem.

    i have a pc with Ubuntu and a board idkAM437x

    i want to synchronize time between pc and my board.

    so is there some information i can get to solve this problem?

    Best regards!

    Thank you!

  • Hi,

    I will try to replicate your setup to see if the issue can replicated...

    Regards,

    Garrett

  • Hi,

    Can you please check if your NIC has hardware clock support or not?

    :~$ethtool -T eth1
    Time stamping parameters for eth1:
    Capabilities:
    software-transmit (SOF_TIMESTAMPING_TX_SOFTWARE)
    software-receive (SOF_TIMESTAMPING_RX_SOFTWARE)
    software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
    PTP Hardware Clock: none

    Without PTP hardware clock support, you might observe the large clock drift.

    Regards,
    Garrett

  • Thanks!That's the reason....

    Thanks very much!!

    Regards

  • Hi,

    Thank you very much !

    I want to ask  another question,that is

     if my host has ptp support, how can I get the  time on my board?Which variable is the time?Because I want to get the time .

    Regards,

    Mike

  • Hi,

       I bought a new  NIC that support ptp.

       :~ethtool -T enp0s4

    ----------------------------------------------------------

    Time stamping parameters for enp0s4:
    Capabilities:
    hardware-transmit (SOF_TIMESTAMPING_TX_HARDWARE)
    software-transmit (SOF_TIMESTAMPING_TX_SOFTWARE)
    hardware-receive (SOF_TIMESTAMPING_RX_HARDWARE)
    software-receive (SOF_TIMESTAMPING_RX_SOFTWARE)
    software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
    hardware-raw-clock (SOF_TIMESTAMPING_RAW_HARDWARE)
    PTP Hardware Clock: 0
    Hardware Transmit Timestamp Modes:
    off (HWTSTAMP_TX_OFF)
    on (HWTSTAMP_TX_ON)
    ------------------------------------------------------------------------------

    that shows OK.

    so I follow those steps:

    1.rebuild the TimeSync example project.

    2.copy the app to SD card and  using ethernet cable to connect IDK board  PRUETH0 to PC

    3. Configure PC IP address to the same subnet (My board IP is 192.168.1.4,and My ubuntu IP is 192.168.1.5)

    4. Run ptpd on PC---------->

       4.1 sudo git clone git://git.code.sf.net/p/linuxptp/code linuxptp

       4.2 cd linuxptp

       4.3 sudo make

                4.4 sudo make install

                4.5 sudo ptp4l -i enp04   -m -S  or sudo ptpd -M -i enp0s4 -C

    But the "offset" and "delay" are not correct....still that number...

    Regards,

  • Hi,

    Can you try to run ptp4l/Ubuntu as master with the following command and configuration file ptp_cfg2.txt? The IDK board is set up as slave by default:

    ~/ptp41_test$ sudo ptp4l -2 -P -f ptp_cfg2.txt -m -H -i eth0

    ptp_cfg2.txt looks like below:

    [global]
    tx_timestamp_timeout 10
    logMinPdelayReqInterval -3
    logSyncInterval -3
    twoStepFlag 1
    summary_interval 0
    [eth0]
    egressLatency 146
    ingressLatency 246
    

    The result captured on my setup: 

    Peer Delay on P1 :                      338 ns

    Peer Delay on P2 :                      0 ns

     

    --------DUT configured as Slave---------

    *********PTP/1588 Params********

    Clock Drift :                           5 ns

    Curr offset :                           -3 ns

    Min offset :                            -154 ns

    Max offset :                            60 ns

    Num Sync Missed :                       6

    UTC Offset (Seconds field) :            1568750807 seconds

    Master connected on Port :              1

    *******************************

    Regards,
    Garrett

  • Hello,

    >>how can I get the  time on my board?Which variable is the time?

    Please refer to the function TimeSync_getCurrentTime():

    /**
    * @brief Returns the current time on device
    *
    * Returns the current time in
    * 1. Seconds : Seconds as on master
    * 2. Nanoseconds : Current nanoseconds as on master
    * The format is identical to the one followed in PTP frames for origin timestamp
    * The time is returned in timeSyncParamsHandle->clockTime
    *
    * @param[in] timeSyncParamsHandle Pointer to PTP Handle
    * @param[out] nanoseconds Pointer to nanoseconds field which is updated by API
    * @param[out] seconds Pointer to seconds field which is updated by API
    *
    * @retval None
    *
    */
    void TimeSync_getCurrentTime(TimeSync_ParamsHandle_t timeSyncParamsHandle,
    uint32_t *nanoseconds, uint64_t *seconds);

    Regards,

    Garrett

  • Thank you.It works well!!!

    Thanks very much!

    Regards

  • Hi,

    Glad to be of help.

    Please help mark the thread as 'resolved'.

    Regards,
    Garrett