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.

RTOS/PROCESSOR-SDK-AM57X: timeSync example don't work on PRU2.1 on SDK 05.01.00.11

Part Number: PROCESSOR-SDK-AM57X
Other Parts Discussed in Thread: AM5728

Tool/software: TI-RTOS

Hello, I'm using AM572x IDK board, TI-RTOS SDK 05.01.00.11 and timeSync example.

I want to use pruss 2 port 1 (PRU2 ETH1 tag on board) as a PTP slave timeSync port in DualMac mode. But when I run your example, only PRU2.0 (PRU2 ETH0 tag on board) is working as a PTP source port.

I'm understand, that I can use only one PTP source for 2 PRU ports, but what do I need to change in example project to sync PTP only by PRU2.1 port?

P.S. I'm trying to change TIMESYNC_EXAMPLE_TEST_PORT0 define to 0 in src/example.h and it disables PRU2.0 sync, but doesn't enable PRU2.1 sync.

P.P.S. I'm using Ubuntu 16.04.5 LTS x64, TI-RTOS SDK v05.01.00.11, CCS v8.2.0

  • Hi Alex, do you get an error when using TIMESYNC_TEST_PORT_NUM=1; or what exactly is the behavior?. Also, are you trying Out-Of-Box timeSync_BasicExample_idkAM572x_wSocLib_armExampleproject project or a modified version? Are you testing it with 2 AM5728 IDK boards? or which boards are you using?

    From code inspection both ports should work OK.. Let me know about above questions to see if I can reproduce the issue.

    thank you,

    Paula

     

  • Hi Paula,

    Paula Carrillo said:
    do you get an error when using TIMESYNC_TEST_PORT_NUM=1; or what exactly is the behavior?

    I have no error messages, but when I use TIMESYNC_TEST_PORT_NUM=0, all is good (and sync starts on PRU2.0). When I set TIMESYNC_TEST_PORT_NUM=1, device is working, but time cannot start to sync (I saw that by LED indication & debug UART). Debug uart output you can find by link: https://pastebin.com/fcw9qNXF

    Paula Carrillo said:
    Also, are you trying Out-Of-Box timeSync_BasicExample_idkAM572x_wSocLib_armExampleproject project or a modified version?

    I'm using Out-Of-Box version of timeSync_BasicExample_idkAM572x_wSocLib_armExampleproject, but I change IP addresses to 192.168.3.3 and 192.168.4.3. My network card has 2 IPs of required ranges and it works correctly with other example projects. With that project I can ping only 1 interface (with IP 192.168.3.3) with TIMESYNC_TEST_PORT_NUM=0, but cannot ping no one with TIMESYNC_TEST_PORT_NUM=1.

    Paula Carrillo said:
    Are you testing it with 2 AM5728 IDK boards? or which boards are you using?

    I'm testing it with second network card on my PC. I'm using PTPd as master with that config (see it by link): gist.github.com/.../bceb73f9f4f99955312c12d74766a5fc . AM572x IDK board was as slave device.

    Paula Carrillo said:
    Let me know about above questions to see if I can reproduce the issue.

    I need to make PRU2.1 sync work.

    My working environment: Ubuntu x64 16.04.5 LTS, TI-RTOS SDK v05.01.00.11, CCS v8.1.0.00011, compiler GNU v7.2.1 (Linaro).

    With regards,

    Alex

  • Alex, my apology, I was away from my desk few days and I missed your reply. I will come back to you soon.

    thank you,
    Paula
  • Hi Alex, do you need to use both Interfaces w PTP at the same time? If so, I am not sure this use case is covered by test application. I will double check though.

    If not, then, I believe it actually works OK. If I ran timeSync_BasicExample_idkAM572x_wSocLib_armExampleproject as PTP slave and connect PRU2.Eth0 with my Linux machine (Running PTPd as P2P master) then from UART and LEDs it seems to work OK. If I unplugged the cable, I see stats increments "Num Sync Missed". But, after I connected to PRU.Eth1 things seems to work OK again.

    I am using OOB demo.

    thank you,
    Paula
  • Hi Paula

    I need to use PRU2.ETH1 only as PTP slave. Are you checking interfaces in dual mac mode? I need a dual mac mode. And, please, when you test it, connect a cable to PRU2.ETH1 port only (PTP slave must work with one connected cable only).

    Paula Carrillo said:
    I am using OOB demo.


    What is the OOB demo?

    Regards,
    Alex

  • Alex, After checking with our developers, there is actually a bug in the firmware for the second port.

     

    Please get fixed icss_ptp_macro.h from GIT.

    For rebuilding the PRU ICSS FW, in a command line:

    A) go to >cd C:\TI\pdk_am57xx_1_0_12\packages

    B) Run setup env script >pdksetupenv.bat

    C) go to >cd C:\TI\pdk_am57xx_1_0_12\packages\ti\drv\icss_emac

    D) run gmake release ... this take long as it would be build FW for all AM5 and all type or cores. You can alternatively try "gmake release LIMIT_BOARDS=idkAM572x LIMIT_SOCS=am572x LIMIT_CORES=a15_0". I haven't tried myself, but it should work.

    E) go to >cd C:\TI\pdk_am57xx_1_0_12\packages

    F) run gmake >gmake icss-emac_clean

    G) followed by >gmake icss-emac

     

    Other changes.. that might be required.

    1) I noticed Mac address for PRU2ETH1 was 00:00:00:00:00:00. For a quick fix, you can use an slightly modified version of PRU2ETH0 Mac address as your

    PRU2ETH1. In C:\TI\pdk_am57xx_1_0_12\packages\ti\transport\timeSync\example\src\soc\am57xx\timeSyncExampleSoC.c

           //memcpy((void *) macAddr, (void *) info.pindEthMacID3, BOARD_EEPROM_MACADDR_LENGTH); //PC-- printed mac ID was 00:00:00:00:00:00

             info.indEthMacID0[5] +=1;                          

             memcpy((void *) macAddr, (void *) info.indEthMacID0, BOARD_EEPROM_MACADDR_LENGTH); //Pc-- quick fix.

     

    2) Port number change in RX. It seems we missed to add this under "TIMESYNC_TEST_PORT_NUM" macro

    C:\TI\pdk_am57xx_1_0_12\packages\ti\transport\timeSync\example\src\timeSyncExample_main.c

                   //rxArg.port = 0; //PC-- original   

                   rxArg.port = 1; //PC-- quick test for PRU2ETH1 AM572x

     

    3) Clean and rebuild your "timeSync_BasicExample_idkAM572x_wSocLib_armExampleproject" application.

     

    Note1: IP address second port is 192.168.2.3 (as configured in rtsc_common/timeSyncExample_a15.cfg). However, I wasn’t able to ping the second port. We will check if there is any issue on NDK or ICSS_EMAC configuration for the second port and come back to you.

     Note2: I don't have a completely working setup with my linux PTPd. I was wondering if you can send me the configuration file you are using for PTPd  Linux, or the commands you are using for running it. At least to first confirm correctness with Port0 (PRU2ETH0).

    Let me know if this helps,

    Paula

  • Hello, Paula

    As I see in the header that you send, all should be good. We fixed that similarly yesterday for a custom board.

    Sorry, I have no time to check your fix too, but it should work. But thanks for that fix.

    For other people with that problem:

    1) You need to fix M_GPTP_ASSIGN_QOS macro in pdk_am57xx_1_0_12/packages/ti/drv/icss_emac/firmware/icss_dualemac/src/icss_ptp_macro.h file. Permanent link to TI repo with fixed macro: link

    2) You need to rebuild PRU-ICSS firmware:

    Paula Carrillo said:

    For rebuilding the PRU ICSS FW, in a command line:

    A) go to >cd C:\TI\pdk_am57xx_1_0_12\packages

    B) Run setup env script >pdksetupenv.bat

    C) go to >cd C:\TI\pdk_am57xx_1_0_12\packages\ti\drv\icss_emac

    D) run gmake release ... this take long as it would be build FW for all AM5 and all type or cores. You can alternatively try "gmake release LIMIT_BOARDS=idkAM572x LIMIT_SOCS=am572x LIMIT_CORES=a15_0". I haven't tried myself, but it should work.

    E) go to >cd C:\TI\pdk_am57xx_1_0_12\packages

    F) run gmake >gmake icss-emac_clean

    G) followed by >gmake icss-emac

    3) You need to rebuild your CCS project

    Regards,

    Alex

  • Hi Alex, thanks for your confirmation. One more thing, when you have a chance could you please share with me used configuration for PTPd as a master?. Currently, we use two boards for testing master-slave. A Linux machine would be better.

    thank you and happy holidays,
    Paula
  • Hello Paula

    As I said in that post, I'm using that github gist config.

    Copy of that config:

    ; /etc/ptpd.conf
    ; ==============================================================================
    ; This is a recommended configuration for a PTPv2 slave
    ; For a full list of options run ptpd2 -H or see the documentation and man pages
    ; ==============================================================================

    ; interface has to be specified (see with ifconfig)
    ptpengine:interface=enp6s0

    ; PTP domain
    ptpengine:domain=0
    ;ptpengine:domain=42

    ; available presets are slaveonly, masteronly and masterslave (full IEEE 1588 implementation)
    ptpengine:preset=masteronly

    ; multicast for both sync and delay requests - use hybrid for unicast delay requests
    ptpengine:ip_mode=multicast

    ; when enabled, instead of sockets, libpcap is used to receive (sniff) and send (inject) packets.
    ; on low latency hardware such as 10GE NICs this can provide results close to hardware-assisted PTP
    ptpengine:use_libpcap=y

    ; go into panic mode for 10 minutes instead of resetting the clock
    ptpengine:panic_mode=y
    ptpengine:panic_mode_duration=10

    ; uncomment this to enable outlier filters
    ;ptpengine:sync_outlier_filter_enable=y
    ;ptpengine:delay_outlier_filter_enable=y

    ; store observed drift in a file
    clock:drift_handling=file

    ; update online statistics every 5 seconds
    ;global:statistics_update_interval=30

    ; wait 5 statistics intervals for one-way delay to stabilise
    ;ptpengine:calibration_delay=5

    ; log file, event log only. if timing statistics are needed, see statistics_file
    global:log_file=/var/log/ptpd2.log
    ; log file up to 5M
    global:log_file_max_size=5000
    ; rotate logs up to 5 files
    global:log_file_max_files=5

    ; status file providing an overview of ptpd's operation and statistics
    global:log_status=y

    ; required if ip_mode is set to hybrid
    ;ptpengine:log_delayreq_interval=0

    ; uncomment this to log a timing log like in previous ptpd versions
    ; global:statistics_file=/var/log/ptpd2.stats

    ; Specify log level (only messages at this priority or higer will be logged).
    ; The minimal level is LOG_ERR. LOG_ALL enables debug output if compiled with
    ; RUNTIME_DEBUG.
    ; Options: LOG_ERR LOG_WARNING LOG_NOTICE LOG_INFO LOG_ALL
    ; global:log_level = LOG_ALL

    ; Maximum statistics log file size (in kB) - log file will be truncated
    ; if size exceeds the limit. 0 - no limit.
    global:statistics_file_max_size = 1000

    ; on multi-core systems it is recommended to bind ptpd to a single core
    global:cpuaffinity_cpucore=0

    ; use DSCP 46 for expedited forwarding over ipv4 networks
    ptpengine:ip_dscp=46

    ; always keep a new line in the end

    ; Set ptpd transport
    ;   ipv4 => IPv4/UDP
    ;   ethernet => Raw ethernet
    ptpengine:transport=ethernet
    ;ptpengine:transport=ipv4

    ; Delay detection mode used - use DELAY_DISABLED for syntonisation only
    ; (no full synchronisation).
    ; Options: E2E P2P DELAY_DISABLED
    ptpengine:delay_mechanism=P2P

    ; ========= newline required in the end ==========

    Regards
    Alex

  • Alex, thank you!
    Paula