AM243x INDUSTRIAL COMMUNICATIONS SDK  09.02.00
EtherCAT SubDevice Beckhoff SSC Demo

Introduction

This example is a EtherCAT SubDevice application based on EtherCAT SubDevice Stack Code (SSC) version 5.13 from Beckhoff.

The example does the below

  • Initializes the EtherCAT SubDevice stack
  • Initializes the FWHAL, which kicks off the ESC
  • SubDevice is taken to INIT state. It can be move to OP (operational) state by connecting it to a EtherCAT MainDevice, and process data communication is possible after that.
  • Allows user to control 8 LEDs for AM243X-EVM and 4 LEDs for AM243X-LP using an EtherCAT MainDevice
  • Allows Online Application Upgrade, if loaded using SBL OSPI
Note

In the E1/E2 revision of am243x-lp board, there are following issues which impact enhanced link detection and RX_ER monitor by ICSSG. Therefore EtherCAT cable redundancy can not be supported in E1/E2 revision.

  • "PRG1_PRU0_GPO8" is not connected to "PRG1_CPSW_ETH1_LED_LINK" from Ethernet PHY
  • "PRG1_PRU1_GPO8" is not connected to "PRG1_CPSW_ETH2_LED_LINK" from Ethernet PHY
  • "PRG1_PRU0_GPO5" is not connected to "PRG1_CPSW_ETH1_LED_1000/RX_ER" from Ethernet PHY
  • "PRG1_PRU1_GPO5" is not connected to "PRG1_CPSW_ETH2_LED_1000/RX_ER" from Ethernet PHY

In E3 revision, following connections are available. SDK example enables cable redundancy and will work on E3 revision only. For running it on E1/E2 revision, few changes are required. For more details, see Supported Combinations.

Supported Combinations

Parameter Value
CPU + OS r5fss0-0 freertos
ICSSG ICSSG1
Toolchain ti-arm-clang
Boards am243x-evm, am243x-lp (E3 Revision)
Example folder examples/industrial_comms/ethercat_slave_beckhoff_ssc_demo
Parameter Value
CPU + OS r5fss1-0 freertos
ICSSG ICSSG0
Toolchain ti-arm-clang
Board am243x-evm, am243x-lp (E3 Revision)
Example folder examples/industrial_comms/ethercat_slave_beckhoff_ssc_demo

As mentioned above, SDK example will work on E3 revision of am243x-lp only. For running it on E1/E2 revision, following changes are needed.

  • Disable enhanced link detection
    • In tiesc_socParamsInit() function present in "${SDK_INSTALL_PATH}/examples/industrial_comms/ethercat_slave_beckhoff_ssc_demo/am243x-lp/tiescsoc.c", set bspInitParams->enhancedlink_enable to TIESC_MDIO_RX_LINK_DISABLE.
  • Disable the pinmux configuration for pins not available in E1/E2 revision
    • In "EtherCAT" module in SysConfig, uncheck following pins from PRU_ICSSG1_MII_G_RT.
      • MII0_RXER(PR1_MII0_RXER)
      • MII0_RXLINK(PR1_MII0_RXLINK)
      • MII1_RXER(PR1_MII1_RXER)
      • MII1_RXLINK(PR1_MII1_RXLINK)

PRU ICSSG0 Instance

This example, configured to run on r5fss_1_0_freertos uses PRU_ICSSG0 instance in PRU_ICSSG peripheral. On EVMs supported by TI (AM64X-EVM, AM243X-EVM), it is not possible to use PRU_ICSSG0, as the PRG0_RGMII1 and PRG0_RGMII0 pins are not connected to Ethernet PHYs. This example would require a dedicated custom board to use the PRU_ICSSG0 instance of ICSSG peripheral. This example, with the custom board, is compatible for PRU_ICSSG0 and it provides full support out of the box.

See ICSSG0 Usage Guide for more details

Performance Benchmarking

TwinCAT MainDevice was used as the EtherCAT MainDevice for these tests.

Cycle Time

Lowest cycle time tested is 31.25 us(microseconds) with Distributed Clock(DC) Synchronization mode.

Interrupt Processing Time

Following is the interrupt processing time for PDI and Sync ISRs with 50 us cycle time. The RxPDO size is 5 bytes and TxPDO size is 7 bytes in this example.

Scenario PDI ISR Processing Time (microseconds) SYNC0 ISR Processing Time (microseconds) SYNC1 ISR Processing Time (microseconds)
DC mode with SYNC0 enabled 2.7 3.2 0
DC mode with SYNC0 and SYNC1 enabled 2.7 0.8 2.6

Steps to Run the Example

  • To build this example, it is necessary to get the EtherCAT SubDevice Stack Code (SSC). Download EtherCAT stack version 5.13 from ETG website and extract it to a local folder. Please refer to "Application Note ET9300 (EtherCAT SubDevice Stack Code)" for more details on SSC.
  • Generate the patched EtherCAT SubDevice stack code source files using any one of the below mentioned methods:
    • Using the patch file
      • Copy the EtherCAT SubDevice Stack files to {SDK_INSTALL_PATH}/source/industrial_comms/ethercat_slave/beckhoff_stack/stack_sources/ folder.
      • Download Windows Patch Utility from gnuwin32 sourceforge. (Note that this is not a TI tool. See licensing information page for more details)
      • Download Dos2Unix/Unix2Dos-Text file format converters from gnuwin32 sourceforge. (Note that this is not a TI tool. See licensing information page for more details)
      • Patch file utility(Patch.exe) and unix2dos.exe utility can be found in their bin folders.
      • Launch DOS Command prompt
      • CD to the folder ${SDK_INSTALL_PATH}/source/industrial_comms/ethercat_slave/beckhoff_stack/patch which contains TI_ECAT.patch.
      • Execute unix2dos.exe as given below:
        $(Dos2Unix/Unix2Dos-DIR)/bin/unix2dos.exe TI_ECAT.patch
      • CD to patch file utility bin folder.
      • Execute patch.exe as given below:
        patch.exe -i ${SDK_INSTALL_PATH}/source/industrial_comms/ethercat_slave/beckhoff_stack/patch/TI_ECAT.patch -d ${SDK_INSTALL_PATH}/source/industrial_comms/ethercat_slave/beckhoff_stack/stack_sources/
    • Using Beckhoff SSC Tool

      • Install SSC tool version 1.5.3.0. This configuration tool facilitates working with the EtherCAT SubDevice Stack Code (SSC), as it allows reducing the size of the EtherCAT SubDevice stack code by removing unused code parts depending on the desired configuration. Objects should be defined in a .xlsx file. Please refer to EtherCAT SubDevice Design - Quick Guide for details.
      • Click on "Import" button and select TI_ESC_[SDK_VERSION].xml present in SoC specific folder inside ${SDK_INSTALL_PATH}/source/industrial_comms/ethercat_slave/beckhoff_stack/patch folder.
      • Make sure "Custom" is selected in the dialog box and "TI [SOC] Sample \<Texas Instruments Incorporated\>" is selected from the list.
      • Set DC_SUPPORTED to 1 if not set.
      • Save the project.
      • Click "Project->Create new SubDevice Files". This will generate the EtherCAT Source files specific to the the selected TI device.
      • Copy all the generated files except tiescappl.c, tiescappl.h and tiescapplObjects.h to ${SDK_INSTALL_PATH}/source/industrial_comms/ethercat_slave/beckhoff_stack/stack_sources/.
      Note
      • For the SDK example, tiescappl.c and tiescappl.h files are used from "${SDK_INSTALL_PATH}/examples/industrial_comms/ethercat_slave_beckhoff_ssc_demo/" folder, and not from the SSC Tool generated files.
      • If you want to modify the object dictionary, you can update the "${SDK_INSTALL_PATH}/source/industrial_comms/ethercat_slave/beckhoff_stack/patch/am64x_am243x_am263x/tiescappl.xlsx" file and then the SSC tool will generate the application code accordingly.
  • Change macro defintions in {SDK_INSTALL_PATH}/source/industrial_comms/ethercat_slave/beckhoff_stack/stack_sources/ecat_def.h, if required for your application. Please ensure that TIESC_HW is set to 1, and TIESC_APPLICATION is set to 1.
Note
Fast link detection using RX_LINK pins (MLINK mode) is required to support complete EtherCAT functionality, and certain conformance tests will fail if fast link detection is not used. Link Polling is not suggested, use it only for debugging if required.
Attention
If you need to reload and run the example again, EVM power-cycle is MUST.

Sample Output

Shown below is a sample output when the application is run:

EtherCAT Device
EtherCAT Sample application
Revision/Type : x0690 Build : x0514
Firmware Version : 6.5.20
SYNC0 task started
SYNC1 task started

See Also

EtherCAT SubDevice FWHAL