SPRADH0 August   2024 AM625 , AM6442 , AM69 , TDA4VM

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
    1. 1.1 What is EtherCAT?
    2. 1.2 What is a PLC?
    3. 1.3 What is CODESYS?
  5. 2Evaluation Platform and Methods
    1. 2.1 Hardware
    2. 2.2 Software
    3. 2.3 Test Topology
  6. 3Performance Metrics
    1. 3.1 Cyclictest Performance Metrics
    2. 3.2 EtherCAT Performance Metrics
  7. 4Optimizations
    1. 4.1 Implemented Optimizations
    2. 4.2 Future Considerations
      1. 4.2.1 Set Maximum CPU Frequency
      2. 4.2.2 Isolate Cores
      3. 4.2.3 Set CPU Affinity
      4. 4.2.4 Isolate Cores and Set CPU Affinity
      5. 4.2.5 Ksoftirqs to FIFO
      6. 4.2.6 Increase the Real-Time Scheduling Time
      7. 4.2.7 Disable irqbalance
      8. 4.2.8 Use Separate Network Interface Card (NIC)
      9. 4.2.9 Disable Unnecessary Drivers
  8. 5Summary
  9. 6References
  10. 7Appendix A: How to Setup TI Embedded Processors as EtherCAT Controller Using the CODESYS Stack
    1. 7.1 Hardware Requirements
    2. 7.2 Software Requirements
    3. 7.3 Hardware Setup
    4. 7.4 Software Setup
      1. 7.4.1 Windows PC Setup
      2. 7.4.2 EtherCAT Controller Setup
      3. 7.4.3 CODESYS Development System Project
      4. 7.4.4 Execution
    5. 7.5 How to View Performance Measurements
      1. 7.5.1 Appendix A Resources
  11. 8Appendix B: How to Enable Unlimited Runtime on CODESYS Stack
    1. 8.1 CODESYS Licensing Background
    2. 8.2 Obtaining a CODESYS License
    3. 8.3 Activating CODESYS License
      1. 8.3.1 Background
      2. 8.3.2 Recommended Steps
    4. 8.4 Verifying CODESYS License Applied
      1. 8.4.1 Known Issues With Verifying CODESYS License Applied

How to View Performance Measurements

To view basic cycle time and jitter statistics in table format

  1. Within the "Devices" window, double click "Task Configuration"
  2. Click on the "Monitor" tab

To view frame specific statistics

  1. Within the "Devices" window, double click "EtherCAT_Master (EtherCAT Master)"
  2. Click on the "Status" tab

To graphically view CPU Load measurements in real-time

  1. Within the "Devices" window, double click "Task Configuration"
  2. Click on the "CPU Load" tab. Note that this tab only appears when the CODESYS project is logged in and started

To graphically view cycle time and jitter statistics in real-time

  1. Add “CmpIecTask” library manager
  2. Put the following in the "Var" section in your PLC_PRG
    PROGRAM PLC_PRG
       VAR
        tTask : Task_Info2;                                           (* Task Info *)
        aIecTasks : ARRAY[1..20] OF Task_Info2;                       (* All Task Info *)
        hCurrentTask : RTS_IEC_HANDLE := SysTypes.RTS_INVALID_HANDLE;
        Result : RTS_IEC_RESULT;                                      (* Result Code *)
    
        pTaskInfo : POINTER TO Task_Info2;
        hIecTask  : RTS_IEC_HANDLE;
        pResult   : POINTER TO RTS_IEC_RESULT;
    
         ...
    
       END_VAR
  3. Place the following text in the body of the PLC_PRG
    ...
    
    (* Retrieve information about the current task *)
    IF hCurrentTask = SysTypes.RTS_INVALID_HANDLE THEN
             hCurrentTask  := IecTaskGetCurrent(pResult:=ADR(Result));
             pTaskInfo     := IecTaskGetInfo3(hIecTask:=hCurrentTask, pResult:=ADR(Result));
    END_IF
    
    ...
  4. Add a Trace object to your CODESYS project

    1. Right click on “Application” on the left hand panel
    2. Select “Add Object” > “Trace”
      AM6442, AM625, AM69 CODESYS Add Trace
                  Object Figure 7-4 CODESYS Add Trace Object
    3. Under "Task for Trace Recording" select the Task containing PLC_PRG
    4. Select "pTaskInfo->cycle time" and "pTaskInfo->jitter" to trace in the Trace object
      1. Double click on the “Trace” object under “Application” in the left hand panel
      2. Right click anywhere on the Trace object graph and select “Add Variable”
      3. Next to the “Variable” entry, click on the 3 dots
      4. Select the variable corresponding to "pTaskInfo->cycle time" and "pTaskInfo->jitter"

    To start the graphical interface in Trace object

    1. Right click anywhere on the Trace object graph and select “Download Trace”

    To save the trace object content as csv or txt file

    1. Right click anywhere on the Trace object graph and select “Save Trace”