4.7.8.1.8.1. Enet NETCONF Example

4.7.8.1.8.1.1. Makefile

For an example of the app makefile, please refer to <enet>/examples/enet_tsn/enet_tsn_netconf_example/makefile. There are some important notes to consider:

  • To include TSN components, add the following macros:

    INCLUDE_INTERNAL_INTERFACES += tsn_gptp tsn_combase tsn_unibase tsn_uniconf tsn_netconf
    COMP_LIST_COMMON += tsn_combase tsn_unibase tsn_gptp tsn_uniconf tsn_netconf pugixml
    
  • Ensure that the tsninit.c and netconf_init.c file is included in the app’s source:

    SRCS_COMMON += ncapp_main.c tsninit.c netconf_init.c gptp_init.c debug_log.c
    
  • NETCONF_ENABLED should be defined to spawn NETCONF server task during TSN Start:

    CFLAGS_LOCAL_COMMON += -DNETCONF_ENABLED
    
  • By default, example application will initialized FATFS Driver to be able to access SD Card for saving persistent configs and Yang Schema data for <get-schema> RPC operation. However, if SD Card is not available, define DISABLE_FAT_FS to disable all operation related to File System:

    CFLAGS_LOCAL_COMMON += -DDISABLE_FAT_FS
    
  • Currently TI Jacinto does not have TLS library, thus the following should be define to prevent application to look for valid certificate paths:

    CFLAGS_LOCAL_COMMON += -DNCONF_ENABLE_TCP_PLAINTEXT=0x01
    
  • If the log task is used, define the TSN_USE_LOG_BUFFER macro:

    CFLAGS_LOCAL_COMMON += -DTSN_USE_LOG_BUFFER=1
    
  • Include the jacinto_buildconf.h at the beginning to ensure the correct inclusion of combase headers:

    CFLAGS_LOCAL_COMMON += -include $(PDK_TSN_COMP_PATH)/tsn-stack/tsn_buildconf/jacinto_buildconf.h
    

4.7.8.1.8.1.2. Build Enet TSN NETCONF example

  • Navigate to the <pdk>/packages/ti/build directory:

    $ cd <pdk>/packages/ti/build
    
  • Build the TSN modules (tsn_unibase, tsn_combase, tsn_gptp, tsn_uniconf, tsn_netconf):

    $ make tsn_unibase tsn_combase tsn_gptp tsn_uniconf tsn_netconf
    
  • To clean the build and remove generated files:

    $ make tsn_unibase_clean tsn_combase_clean tsn_gptp_clean tsn_uniconf_clean tsn_netconf_clean
    
  • You can specify the build mode as either release or debug. By default, the release mode is built. To build in debug mode, use the BUILD_PROFILE=debug option:

    $ make tsn_unibase tsn_combase tsn_gptp tsn_uniconf tsn_netconf BUILD_PROFILE=debug
    
  • If you want to build with C++ compiling rules, use the CPLUSPLUS_BUILD=yes option:

    $ make tsn_unibase tsn_combase tsn_gptp tsn_uniconf tsn_netconf CPLUSPLUS_BUILD=yes
    
  • To build the TSN example app in the PDK, use the following command:

    $ make enet_tsn_netconf_example_freertos CORE=mcu2_0
    

    The example app binary file can be found at the following location:

    <pdk>/packages/ti/binary/enet_tsn_netconf_example_freertos/bin/j721e_evm/enet_tsn_netconf_example_freertos_mcu2_0_release.xer5f
    

    This command will build the TSN example app (enet_tsn_netconf_example_freertos) using the FreeRTOS operating system and targeting the mcu2_0 core. Adjust the command according to your specific requirements, such as selecting a different operating system or core if needed.

4.7.8.1.8.1.3. Running Enet TSN NETCONF example

4.7.8.1.8.1.3.1. MMC / SD Card Preparation

In this example, FAT file system support was enabled to show how to use UNICONF’s persistent database dbname and runtime start-up configration configfiles. for details regarding this configs please see Uniconf configuration. Because of the above, the startup config file and schema files needs to be installed in the DUT’s MMC (SDCARD) filesystem.

To do this, insert SD card onto your PC SD card slot and format the SD card with just one FAT32 partition. After formatting, copy the following directories and all their contents to the newly created partition.

  • <enet>/examples/enet_tsn/conffiles

  • <tsn-stack>/tsn_uniconf/yangs/schemas

The content of the partition will be something like the following:

$ tree -L 2 /media/user/USB\ STICK/
/media/user/USB STICK/
├── conffiles
│   └── interface.conf
├── schemas
│   ├── ...
│   └── xmlsafe
└── uniconfdb
    └── #Add This Directory, this will be the location of UNICONF DB.

Safely remove the SDCard from PC SD card slot, and insert it to DUT’s SD Card Slot.

The above file structure should correspnd to the following path specified in the example.

In common.h:

#define INTERFACE_CONFFILE_PATH "0:/conffiles/interface.conf"
#define UNICONF_DBFILE_PATH     "0:/uniconfdb/example.bin"

In netconf_init.c:

#define NETCONF_YANG_SCHEMA_DIR "0:/schemas/xmlsafe"

4.7.8.1.8.1.3.2. Lauching appplication binaries in DUT

  • Launch a CCS debug session, load and run enet_tsn_netconf_example_freertos_mcu2_0_release.xer5f binary file to the MAIN_Cortex_R5_0_0.

  • Logs will be printed in Main UART port 0. Below is an example of the log when gPTP works in slave mode:

    ==================================
       NETCONF+TSN GPTP Example App
    ==================================
    EnetBoard_setupPorts: 4 of 4 ports configurations found
    Configuring SerDes lane 1 for QSGMII
    EnetApp_appInitTask: EnetBoard_setupPorts() done
    EnetApp_appInitTask: EnetApp_initMMCSD() done
    Starting lwIP, local interface IP is dhcp-enabled
    LwipifEnetAppCb_getHandle: EnetApp_init() done
    EnetMcm: CPSW_9G on MAIN NAVSS
    Mdio_open: MDIO manual mode enabled
    PHY 0 is alive
    PHY 3 is alive
    PHY 12 is alive
    PHY 15 is alive
    PHY 16 is alive
    PHY 17 is alive
    PHY 18 is alive
    PHY 19 is alive
    PHY 23 is alive
    EnetPhy_bindDriver: PHY 16: OUI:0001c1 Model:27 Ver:00 <-> 'vsc8514' : OK
    EnetPhy_bindDriver: PHY 17: OUI:0001c1 Model:27 Ver:00 <-> 'vsc8514' : OK
    EnetPhy_bindDriver: PHY 18: OUI:0001c1 Model:27 Ver:00 <-> 'vsc8514' : OK
    EnetPhy_bindDriver: PHY 19: OUI:0001c1 Model:27 Ver:00 <-> 'vsc8514' : OK
    Host MAC address: 70:ff:76:1d:f7:8d
    [LWIPIF_LWIP] Enet LLD netif initialized successfully
    status_callback==UP, local interface IP is 0.0.0.0
    EnetApp_appInitTask: EnetApp_initLwIP() done
    DB File Initialized: True
    EnetApp_uniconfTask: dbname: 0:/uniconfdb/example.bin
    Logger_task: started
    unibase-1.1.4-jacinto
    INF:cbase:tilld0: has mac: 70:FF:76:1D:F7:8D
    INF:cbase:tilld1: has mac: 00:00:00:00:00:00
    INF:cbase:tilld2: has mac: 00:00:00:00:00:00
    INF:cbase:tilld3: has mac: 00:00:00:00:00:00
    INF:nconf:simpledb_open:imported 19340 bytes from the saved data
    INF:nconf:uc_hwal_open:
    INF:cbase:cb_rawsock_open:combase-1.1.3-jacinto
    INF:cbase:cb_rawsock_open:dmaTxChId=-1 numRxChannels=0 dmaRxChId=-1 nTxPkts=0 nRxPkts=0 pktSize=0
    INF:cbase:cb_lld_task_create:alloc stack size=16384
    INF:nconf:000005-057372:uniconf_main:uniconf started
    
    Start: uniconf_task
    INF:cbase:cbl_query_response:tilld0 link DOWN !!!!
    INF:cbase:cbl_query_response:tilld1 link DOWN !!!!
    INF:cbase:tilld1: alloc mac: 70:FF:76:1D:F7:8E
    INF:cbase:cbl_query_response:tilld2 link DOWN !!!!
    INF:cbase:tilld2: alloc mac: 70:FF:76:1D:F7:8F
    INF:cbase:cbl_query_response:tilld3 link DOWN !!!!
    INF:cbase:tilld3: alloc mac: 70:FF:76:1D:F7:90
    
    EnetApp_gptpYangConfig:domain=0
    EnetApp_gptpYangConfig:domain=1
    INF:nconf:get_exmodid_in_db:get xl4gptp:exmodid from db, id=0
    
    EnetApp_gptpNonYangConfig:XL4_EXTMOD_XL4GPTP_SINGLE_CLOCK_MODE=1
    EnetApp_gptpNonYangConfig:XL4_EXTMOD_XL4GPTP_USE_HW_PHASE_ADJUSTMENT=1
    EnetApp_gptpNonYangConfig:XL4_EXTMOD_XL4GPTP_CLOCK_COMPUTE_INTERVAL_MSEC=100
    EnetApp_gptpNonYangConfig:XL4_EXTMOD_XL4GPTP_FREQ_OFFSET_IIR_ALPHA_START_VALUE=1
    EnetApp_gptpNonYangConfig:XL4_EXTMOD_XL4GPTP_FREQ_OFFSET_IIR_ALPHA_STABLE_VALUE=4
    EnetApp_gptpNonYangConfig:XL4_EXTMOD_XL4GPTP_PHASE_OFFSET_IIR_ALPHA_START_VALUE=1
    EnetApp_gptpNonYangConfig:XL4_EXTMOD_XL4GPTP_PHASE_OFFSET_IIR_ALPHA_STABLE_VALUE=4
    EnetApp_gptpNonYangConfig:XL4_EXTMOD_XL4GPTP_MAX_DOMAIN_NUMBER=2
    EnetApp_gptpNonYangConfig:XL4_EXTMOD_XL4GPTP_CMLDS_MODE=1
    EnetApp_gptpNonYangConfig:XL4_EXTMOD_XL4GPTP_SECOND_DOMAIN_THIS_CLOCK=1
    [NCONF] TASK Started: 0:/uniconfdb/example.bin
    INF:nconf:tsn_netconf-1.0.0-8f3d14b
    Start: netconf_task
    CpswMacPort_checkSgmiiStatus: MAC 2: SGMII link parter config port: link up: 1-Gbps Full-Duplex
    Cpsw_handleLinkUp: Port 2: Link up: 1-Gbps Full-Duplex
    MAC Port 2: link up
    link_callback==UP
    INF:nconf:nconf_msghdlr_main_loop:Started
    
    Start: gptp2d_task
    EnetApp_initTsn:gptp start done!
    CPU Load: 56%
    INF:gptp:gptpman_run:max_domains=2, max_ports=4
    INF:cbase:cb_rawsock_open:combase-1.1.3-jacinto
    INF:cbase:cb_rawsock_open:dmaTxChId=-1 numRxChannels=0 dmaRxChId=-1 nTxPkts=0 nRxPkts=0 pktSize=0
    INF:cbase:cbl_query_response:tilld0: link UP, speed=1000, duplex=1 !!!!
    INF:gptp:dev:tilld0 open success
    INF:gptp:dev:tilld1 open success
    INF:gptp:dev:tilld2 open success
    INF:gptp:dev:tilld3 open success
    INF:gptp:gptpnet_init:Open lldtsync OK!
    INF:gptp:IEEE1588-2019 performance monitoring disabled.
    INF:gptp:IEEE1588-2019 performance monitoring disabled.
    INF:gptp:gptpclock_mode_slave_main:domainIndex=0 already in SLAVE_MAIN
    INF:gptp:onenet_activate:tilld0 status=1, duplex=1, speed=1000Mbps
    INF:gptp:000007-379204:domainIndex=0, GM changed old=00:00:00:00:00:00:00:00, new=70:FF:76:FF:FE:1D:F7:8D
    INF:gptp:gptpclock_set_gmsync:gptpInstanceIndex=0, domainIndex=0, gmstate=2
    INF:gptp:set_phase_offsetGM:domainIndex=0, New adjustment(New GM?)
    INF:gptp:000007-384489:domainIndex=1, GM changed old=00:00:00:00:00:00:00:00, new=70:FF:76:00:01:1D:F7:8D
    INF:gptp:000007-384705:adjust_GM_btw_domains:domainIndex=1
    INF:gptp:gptpclock_set_gmsync:gptpInstanceIndex=0, domainIndex=1, gmstate=2
    INF:gptp:set_phase_offsetGM:domainIndex=1, New adjustment(New GM?)
    INF:gptp:index=1 speed=1000, duplex=full, ptpdev=tilld0
    INF:nconf:ydbi_get_item_ifk3vk0:no data
    INF:nconf:ydbi_get_item_ifk3vk0:no data
    INF:gptp:onenet_activate:tilld1 status=0, duplex=1, speed=0Mbps
    INF:nconf:ydbi_get_item_ifk3vk0:no data
    INF:nconf:ydbi_get_item_ifk3vk0:no data
    INF:gptp:onenet_activate:tilld2 status=0, duplex=1, speed=0Mbps
    INF:nconf:ydbi_get_item_ifk3vk0:no data
    INF:nconf:ydbi_get_item_ifk3vk0:no data
    INF:gptp:onenet_activate:tilld3 status=0, duplex=1, speed=0Mbps
    INF:ubase:GPTP_MEDIUM_ALLOC: fragsize=16 fragused/fragnum=1978/2259 (87%)
    INF:ubase:GPTP_SMALL_ALLOC: fragsize=4 fragused/fragnum=56/126 (44%)
    INF:ubase:SM_DATA_INST: fragsize=8 fragused/fragnum=7222/7222 (100%)
    INF:gptp:gptpman_run:GPTPNET_INTERVAL_TIMEOUT_NSEC=125000000
    
    domain=0, offset=0nsec, hw-adjrate=0ppb
            gmsync=true, last_setts64=0nsec
    domain=1, offset=-22856nsec, sw-adjrate=0.000000e+00
            gmsync=true, last_setts64=4563533687nsec
    
    status_callback==UP, local interface IP is 192.168.0.110
    Enet lwIP App: Added Network IP address I/F ti0: 192.168.0.110
    CPU Load: 4%
    domain=0, offset=0nsec, hw-adjrate=0ppb
            gmsync=true, last_setts64=0nsec
    domain=1, offset=-22856nsec, sw-adjrate=0.000000e+00
            gmsync=true, last_setts64=4563533687nsec
    
    INF:gptp:md_pdelay_resp_sm_recv_req:port=1, set receivedNonCMLDSPdelayReq=1
    
    WRN:gptp:000022-126875:waiting_for_pdelay_interval_timer_proc:portIndex=1, sourcePortIdentity=80:EE:73:FF:FE:DC:CF:DA, thisClock=70:FF:76:FF:FE:1D:F7:8D, neighborPropDelay=3140
    INF:gptp:waiting_for_pdelay_interval_timer_proc:portIndex=1, not asCapable
    
    INF:gptp:waiting_for_pdelay_interval_timer_proc:set asCapableAcrossDomains, portIndex=1
    INF:gptp:set asCapable for domainIndex=0, portIndex=1
    INF:gptp:000023-127512:gptpgcfg_set_asCapable:domainInde=0, portIndex=1, ascapable=1
    INF:gptp:set asCapable for domainIndex=1, portIndex=1
    INF:gptp:000023-128280:gptpgcfg_set_asCapable:domainInde=1, portIndex=1, ascapable=1
    
    INF:gptp:000023-251133:gm_stable:gm_unstable_proc:domainIndex=0
    INF:gptp:gptpclock_set_gmsync:gptpInstanceIndex=0, domainIndex=0, gmstate=1
    INF:gptp:000023-251368:active domain switched from 0 to 1
    INF:gptp:000023-251493:gm_stable:gm_unstable_proc:domainIndex=0
    INF:gptp:000023-252502:gm_stable:gm_unstable_proc:domainIndex=1
    INF:gptp:gptpclock_set_gmsync:gptpInstanceIndex=0, domainIndex=1, gmstate=1
    INF:gptp:000023-252805:gm_stable:gm_unstable_proc:domainIndex=1
    INF:gptp:000023-376119:setSyncTwoStep_txSync:domainIndex=1, portIndex=1, sync gap=23375msec
    INF:gptp:000023-376921:setFollowUp_txFollowUp:domainIndex=1, portIndex=1, fup gap=23375msec
    INF:gptp:000023-492470:domainIndex=0, GM changed old=70:FF:76:FF:FE:1D:F7:8D, new=80:EE:73:FF:FE:DC:CF:DA
    INF:gptp:gptpclock_set_gmsync:gptpInstanceIndex=0, domainIndex=0, gmstate=0
    INF:gptp:000023-492922:gm_stable:gm_unstable_proc:domainIndex=0
    INF:gptp:gptpclock_set_gmsync:gptpInstanceIndex=0, domainIndex=0, gmstate=1
    
    INF:gptp:set_phase_offsetGM:domainIndex=0, New adjustment(New GM?)
    INF:gptp:set_phase_offsetGM:domainIndex=0, offset adjustment, diff=-1897751374
    INF:gptp:set_phase_offsetGM:domainIndex=0, stable
    INF:gptp:clock_master_sync_receive:computeGmRateRatio:domainIndex=0 unstable rate=-4206ppb (timeleap_past)
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -2265ppb, GMdiff=7767nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -2831ppb, GMdiff=7463nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -2564ppb, GMdiff=7269nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -3444ppb, GMdiff=6942nsec
    INF:gptp:000024-376321:gm_stable:gm_stable_proc:domainIndex=1
    INF:gptp:gptpclock_set_gmsync:gptpInstanceIndex=0, domainIndex=1, gmstate=2
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -3415ppb, GMdiff=6735nsec
    INF:gptp:000024-500581:gm_stable:gm_stable_proc:domainIndex=0
    INF:gptp:gptpclock_set_gmsync:gptpInstanceIndex=0, domainIndex=0, gmstate=2
    INF:gptp:000024-500935:active domain switched from 1 to 0
    
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -3743ppb, GMdiff=6491nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -3777ppb, GMdiff=6100nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -3670ppb, GMdiff=5928nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -3301ppb, GMdiff=5793nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -4045ppb, GMdiff=5527nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -4304ppb, GMdiff=5328nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -4862ppb, GMdiff=5099nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -3966ppb, GMdiff=5053nsec
    
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -4651ppb, GMdiff=4816nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -4602ppb, GMdiff=4676nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -4487ppb, GMdiff=4548nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -4826ppb, GMdiff=4369nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -3972ppb, GMdiff=4340nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -5220ppb, GMdiff=4057nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -4708ppb, GMdiff=3996nsec
    
    CPU Load: 5%
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -5291ppb, GMdiff=3804nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -4176ppb, GMdiff=3824nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -5413ppb, GMdiff=3558nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -4368ppb, GMdiff=3577nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -4405ppb, GMdiff=3464nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -4363ppb, GMdiff=3364nsec
    
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -4725ppb, GMdiff=3218nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -5240ppb, GMdiff=3058nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -5323ppb, GMdiff=2866nsec
    IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to -5068ppb, GMdiff=2810nsec
    ...
    

4.7.8.1.8.1.4. Linux PTP Tool

To evaluate and verify DUT’s gPTP, we can use linuxptp which can be installed as follows:

$ sudo apt-get install linuxptp
$ ptp4l -v

To use ptp4l for gPTP we need the gPTP.cfg which we can download as follows:

$ wget https://raw.githubusercontent.com/richardcochran/linuxptp/master/configs/gPTP.cfg -O ~/ptp_config.cfg

For this example change the value of priority1 in the downloaded file to 249 just enough that it can be either gPTP master or slave depending on DUTs priority1 value.

Also, for some network cards, there is a bug with internal propagation delay, in those cases you might need to increase the neighborPropDelayThresh.

Below is an example of linux ptp4l config we can use for this example:

#
# 802.1AS example configuration containing those attributes which
# differ from the defaults.  See the file, default.cfg, for the
# complete list of available options.
#
[global]
gmCapable               1
priority1               249
priority2               249
logAnnounceInterval     0
logSyncInterval         -3
syncReceiptTimeout      3
neighborPropDelayThresh 10000
min_neighbor_prop_delay -20000000
assume_two_step         1
path_trace_enabled      1
follow_up_info          1
transportSpecific       0x1
ptp_dst_mac             01:80:C2:00:00:0E
network_transport       L2
delay_mechanism         P2P

To run ptp4l in PC execute the following command in console:

$ sudo ptp4l -i enp1s0 -m -l 6 -q -f ./ptp_config.cfg
Where:

enp1s0 - PC’s network interface connected to DUT’s network

When ptp4l, runs as master the following logs should appear:

ptp4l[2882574.023]: selected /dev/ptp0 as PTP clock
ptp4l[2882574.072]: port 1 (enp1s0): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[2882574.072]: port 0 (/var/run/ptp4l): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[2882574.072]: port 0 (/var/run/ptp4lro): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[2882577.100]: port 1 (enp1s0): LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
ptp4l[2882577.100]: selected local clock 80ee73.fffe.dccfda as best master
ptp4l[2882577.100]: port 1 (enp1s0): assuming the grand master role

When ptp4l, runs as slave, logs should similar to the following should appear:

ptp4l[2883297.220]: selected /dev/ptp0 as PTP clock
ptp4l[2883297.285]: port 1 (enp1s0): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[2883297.285]: port 0 (/var/run/ptp4l): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[2883297.285]: port 0 (/var/run/ptp4lro): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[2883300.338]: port 1 (enp1s0): new foreign master 70ff76.fffe.1df78d-1
ptp4l[2883300.544]: port 1 (enp1s0): LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
ptp4l[2883300.544]: selected local clock 80ee73.fffe.dccfda as best master
ptp4l[2883300.544]: port 1 (enp1s0): assuming the grand master role
ptp4l[2883302.214]: selected best master clock 70ff76.fffe.1df78d
ptp4l[2883302.214]: port 1 (enp1s0): MASTER to UNCALIBRATED on RS_SLAVE
ptp4l[2883302.590]: port 1 (enp1s0): UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED
ptp4l[2883303.216]: rms 566994510559 max 1133989021227 freq +44673 +/- 2991 delay  3144 +/-   0
ptp4l[2883304.216]: rms  966 max 1508 freq +47991 +/- 1266 delay  3142 +/-   0
ptp4l[2883305.216]: rms 1558 max 1688 freq +50732 +/- 412 delay  3140 +/-   0
ptp4l[2883306.216]: rms  955 max 1256 freq +51216 +/-  95 delay  3122 +/-   0
ptp4l[2883307.218]: rms  337 max  604 freq +50971 +/- 133 delay  3140 +/-   0
...

4.7.8.1.8.1.5. Verification

4.7.8.1.8.1.5.1. LWIP TCP/IP Stack

Confirmed during start-up that LWIP stack was able to get IP address either by DHCP or Static (if configured).

DHCP enabled

By default, DHCP is enabled, and the following logs should appear:

Starting lwIP, local interface IP is dhcp-enabled
LwipifEnetAppCb_getHandle: EnetApp_init() done
EnetMcm: CPSW_9G on MAIN NAVSS
Mdio_open: MDIO manual mode enabled
...
[LWIPIF_LWIP] Enet LLD netif initialized successfully
status_callback==UP, local interface IP is 0.0.0.0
EnetApp_appInitTask: EnetApp_initLwIP() done

When DUT was able to get IP address from DHCP server, logs like the following should appear:

status_callback==UP, local interface IP is 192.168.0.110
Enet lwIP App: Added Network IP address I/F ti0: 192.168.0.110

DHCP disable (Static IP)

To use Static IP, uncomment the following lines in lwipcfg.h:

/* If these 2 are not defined, the corresponding config setting is used */
/* #define USE_DHCP    0 */
/* #define USE_AUTOIP  0 */

When the above is defined to 0, IP Address of DUT will be set statically with values from the following macro defines:

/* #define USE_PCAPIF 1 */
#define LWIP_PORT_INIT_IPADDR(addr)   IP4_ADDR((addr), 192,168,1,200)
#define LWIP_PORT_INIT_GW(addr)       IP4_ADDR((addr), 192,168,1,1)
#define LWIP_PORT_INIT_NETMASK(addr)  IP4_ADDR((addr), 255,255,255,0)

Below is an example log, when Static IP address is configured successfully:

Starting lwIP, local interface IP is 192.168.1.200
LwipifEnetAppCb_getHandle: EnetApp_init() done
EnetMcm: CPSW_9G on MAIN NAVSS
Mdio_open: MDIO manual mode enabled
...
[LWIPIF_LWIP] Enet LLD netif initialized successfully
status_callback==UP, local interface IP is 192.168.1.200
Enet lwIP App: Added Network IP address I/F ti0: 192.168.1.200
EnetApp_appInitTask: EnetApp_initLwIP() done

4.7.8.1.8.1.5.2. gPTP Stack

Single port

Connect a port to a Linux PC and run ptp4l from the PC as discussed in previous section. When DUT becomes master the following log will be shown:

domain=0, offset=0nsec, hw-adjrate=96466ppb
    gmsync=true, last_setts64=0nsec
domain=1, offset=13959018nsec, sw-adjrate=0.000000e+00
    gmsync=true, last_setts64=1706169470902928420nsec

CPU Load: 2%
domain=0, offset=0nsec, hw-adjrate=96466ppb
    gmsync=true, last_setts64=0nsec
domain=1, offset=13959018nsec, sw-adjrate=0.000000e+00
    gmsync=true, last_setts64=1706169470902928420nsec
...

On the other hand, when DUT becomes slave, the following logs will be shown instead:

IFV:gptp:domainIndex=0, clock_master_sync_receive:the master clock rate to 128261ppb, GMdiff=19712nsec
IFV:gptp:domainIndex=1, clock_master_sync_receive:the master clock rate to 70820ppb, GMdiff=9472nsec
...

Multiple ports

In this function, gPTP is operating as a switch. The availability of this feature is determined by the board configuration rather than the gPTP stack. If a board enables multiple MAC ports, the gPTP function should operate properly. To test this function, please connect two PCs to two ports of the EVM.

When the EVM board acts as the master, only the master log will be printed out, while the two PCs will print the slave log. On the other hand, if one of the PCs acts as the master, the slave log will be printed by the other PC and the EVM, while the master PC will print the master log.

To identify which machine is the master, please check the log:

INF:gptp:001809-750000:domainIndex=0, GM changed old=24:76:25:FF:FE:96:6C:41, new=70:FF:76:FF:FE:1D:9B:77

In this case, the machine with the source MAC address of 70:FF:76:FF:FE:1D:9B:77 is the master.

4.7.8.1.8.1.5.3. NETCONF

Note

See NETCONF Client Interoperability in integration guide for details regarding netconf_client and how to use it.

GPTP Status verification

While gPTP sync is ongoing as mentioned above, connect to DUT’s NETCONF server using the netconf_client and confirmed that the port status is correct and correspond to what is obeserved via gPTP logs.

Since we set ptp4l’s priority1 to 249, DUT should become master when verified through logs and NETCONF client’s Status Tab as shown below:

../../_images/ex_tsn_netconf_master_mode.png

Updating gPTP Configuration

Update DUT’s gPTP priority using the following XML data to force it to become slave on next reboot:

<?xml version='1.0' encoding='UTF-8'?>
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <ptp xmlns="urn:ieee:std:1588:yang:ieee1588-ptp">
        <instances>
            <instance>
                <instance-index>0</instance-index>
                <default-ds>
                    <priority1>255</priority1>
                    <priority2>254</priority2>
                </default-ds>
            </instance>
            <instance>
                <instance-index>1</instance-index>
                <default-ds>
                    <priority1>255</priority1>
                    <priority2>254</priority2>
                </default-ds>
            </instance>
        </instances>
    </ptp>
</data>

Edit-Config in netconf_client should be successful as shown below:

../../_images/ex_tsn_netconf_client_edit_config_window.png

Persistent DB Configuration

After successful config update, restart DUT without changing the binaries. Verify that DUT becomes slave both via console logs and in NETCONF client’s Status Tab similar to following:

../../_images/ex_tsn_netconf_slave_mode.png