AM243x MCU+ SDK  08.00.00
EtherCAT Slave Beckhoff SSC Demo


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

The example does the below

  • Initializes the EtherCAT Slave stack
  • Initializes the FWHAL, which kicks off the ESC
  • Slave is taken to INIT state. It can be move to OP (operational) state by connecting it to a EtherCAT master, 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 master
  • Allows Online Application Upgrade, if loaded using SBL OSPI

Supported Combinations

Parameter Value
CPU + OS r5fss0-0 freertos
Toolchain ti-arm-clang
Boards am243x-evm, am243x-lp
Example folder examples/industrial_protocols/ethercat_slave_beckhoff_ssc_demo

Performance Benchmarking

TwinCAT Master was used as the EtherCAT master for these tests.

Cycle Time

Lowest cycle time tested is 50 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 Slave Stack Code (SSC). Download EtherCAT stack version 5.12 from ETG website and extract it to a local folder. Please refer to "Application Note ET9300 (EtherCAT Slave Stack Code)" for more details on SSC.
  • Generate the patched EtherCAT Slave stack code source files using any one of the below mentioned methods:
    • Using the patch file
      • Copy the EtherCAT Slave Stack files to {SDK_INSTALL_PATH}/source/industrial_protocols/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_protocols/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_protocols/ethercat_slave/beckhoff_stack/patch/TI_ECAT.patch -d ${SDK_INSTALL_PATH}/source/industrial_protocols/ethercat_slave/beckhoff_stack/stack_sources/
    • Using Beckhoff SSC Tool
      • Install SSC tool version This configuration tool facilitates working with the EtherCAT Slave Stack Code (SSC), as it allows reducing the size of the EtherCAT slave stack code by removing unused code parts depending on the desired configuration. Objects should be defined in a .xlsx file. Please refer to EtherCAT Slave 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_protocols/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 Slave Files". This will generate the EtherCAT Source files specific to the the selected TI device.
      • Copy the generated files to ${SDK_INSTALL_PATH}/source/industrial_protocols/ethercat_slave/beckhoff_stack/stack_sources/.
  • Change macro defintions in {SDK_INSTALL_PATH}/source/industrial_protocols/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.
  • When using CCS projects to build, import the CCS project for the required combination and build it using the CCS project menu (see Using SDK with CCS Projects).
  • When using makefiles to build, note the required combination and build using make command (see Using SDK with Makefiles)
  • Launch a CCS debug session and run the executable, see CCS Launch, Load and Run
  • To test the application, one can use TwinCAT or any other compatible EtherCAT master. The steps to test the slave with TwinCAT are present in EtherCAT Slave Setup with TwinCAT.

See Also

EtherCAT Slave

Sample Output

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

EtherCAT Device
EtherCAT Internal application
Revision/Type : x0590 Build : x04F2
Firmware Version : 5.4.242
SYNC0 task started
SYNC1 task started