Document toolboxDocument toolbox

Commissioning Modular Gateway EtherCAT with TwinCAT

EtherCAT is the Industrial Ethernet technology characterized by excellent performance, low costs, flexible topology and simple handling. The configuration of an EtherCAT network is carried out with a special configuration tool, e.g. Beckhoff TwinCAT

In this example, we run TwinCAT on a Windows-PC, which will handle as a Master and exchange data with KUNBUS Gateway module for EtherCAT. The system has a KUNBUS EtherCAT Gateway (PR100073) connected over piBridgeLeft interface of RevPi Connect.

 

 Requirements

 

  Test setup

 

  Configuration and Running TwinCAT

  • Download the ESI file from the Gateway KUNBUS website and place it in a folder with the following path: C:\TwinCAT\3.1\Config\Io\EtherCAT

  • Start TwinCAT XAE Shell

    • Open a new project with File/new/project and give a project name

  • TwinCAT has two modes: configuration mode and run mode. All the configuration must be done in the configuration mode

  • From here you can do either

    • Right click on device“ → “Scan”

      Scans for masters and devices. If EtherCAT-Slave is connected, it is automatically detected.

      TwinCat asks to change from “config”-mode to “free run”-mode - cyclic communication is active

  • Or do it step-by-step

    • Look at your project tree and click on I/O | right click on Device | on add new element | select EtherCAT Master | click on OK. Your project tree will look as following:

  • Right click on Device 1 (Gerät 1 for German version) | add new element | select KUNBUS Gateway EtherCAT | Box 1 (KUNBUS Gateway EtherCAT) will appear on your Device tree.

  • Currently the version 1.2 is produced, and therefore you should choose this version

 

 

  • Click on SYSTEM | right click on Tasks| select TwinCAT Task with Image| give task name and validate with OK

  • In this example, we are exchanging data. For “Free run”-mode, these steps can be skipped

 

  • click on Task 5: Here you can define the priority and the cycle time you want for your system to refresh Date

 

  • Right click on Inputs | give the variable name

 

  • Click on Box 1 (KUNBUS Gateway EtherCAT) | click on TxPDO | Right click on Data 001 | click on change Link (DE: Verknüpfung ändern) click on your created variable (for this example: VAR 80).

 

  • Build your Project (1 and 2) and activate the configuration (3) and you must suppose to be in the run mode now (4)

 

  • If “Scan” and “Free Run”-mode were selected, you can go on with this step

    • Now we write a value on an output of the Gateway and check it with the piTest command on the next image

    • A PiCtory configuration must be done

  • We write a value on an Output using the first register of RxPDO (Data 001)

  • Check the sent value with piTest

    • Connect to your RevPi Connect via SSH

piTest -r input_1