{TWINCAT_INSTALL_DIR}\TwinCAT\3.1\Config\Io\EtherCAT
folder.${SDK_INSTALL_PATH}/source/industrial_comms/ethercat_slave/beckhoff_stack/esi/TI_ESC.xml
Create a new TwinCAT XAE Project (XML format) by going to "File -> New -> Project -> TwinCAT Project"
Go to "TwinCAT -> Show Realtime Ethernet Compatible Devices" and install TwinCAT RT Ethernet intermediate driver. For best performance, it is recommended to use a compatible NIC card listed in Supported network controllers . For the first time only you need to do this for the PC's Ethernet port, which is used as the EtherCAT port. Go to "TwinCAT -> Show Realtime Ethernet Compatible Devices" and check if the ethernet adapter is listed below "Installed and ready to use devices" before attempting to scan the slave.
In Solution Explorer, go to "TwinCAT project -> I/O -> Devices". Right click on Devices and select Scan. Press OK in the next dialog to start scanning for EtherCAT devices.
Once an EtherCAT compatible device has been detected on this Ethernet port, the following dialog shows up. Note that there is a tick mark next to the adapter to which the EVM is connected. Press OK and confirm to start "Scan for boxes".
TI Box n(TIESC) will be detected automatically. The TI device will be listed "Box n (TIESC-*)". Press Yes to activate Free Run. This will put TI ESC into OP mode. TIESC number is based on the platform and application. Please check the ESI file for more details.
The EtherCAT device state can be displayed by selecting a "Device" (Double click on "Device") and then selecting the "Online" tab. The device should be in the OP state with no Lost Frames or Tx/Rx Errors.
The user can control 8 digital out LEDs using TwinCAT. LED[0] to LED[7] in "Box n (TIESC-*) -> DO Outputs -> LED". Each LED can be turned on and off by selecting "Online write 1" and "Online write 0" respectively.
Choose DC Synchronization for all devices in the chain. Click on Box n (TIESC-*). Open the DC tab, and choose DC-Synchron option in Operation Mode. Do this for all slaves in the chain.
In Solution Explorer, go to TwinCAT project, select "SYSTEM -> Real-Time". In the Settings tab, choose the desired Base Time. With compatible NIC cards, a base time of as low as 50 us can be chosen.
Right-click on "SYSTEM -> Tasks". Click "Add New Item" on the pop-up menu. Select "TwinCAT Image with Task" in the next dialog box. Type a name for the task, and choose OK.
Choose "Auto start" for the task. Choose 2 cycle ticks’ frequency for the task.
Add an output variable to the task. Right-click on "[Task name] -> Outputs", and choose "Add New Item". You may choose default options for the variable.
Link the variable to an output for the last slave in the chain. Right-click on [Variable name], and choose "Change Link...".
Choose an output from the last slave. You may need to choose "All Types" in "Show Variable Types".
Cable redundancy is a feature which ensures that all slaves are accessible even if there is a single link break in the network between two ports of master. We need to ports of master for testing this feature.
It can be tested as follows:
The topology can be verified by selecting a "Device" (Double click on "Device") and then selecting the "EtherCAT" tab and click on "Topology". It is also possible to use Beckhoff CU2508 (Real-time Ethernet port multiplier) if you do not have two ports available on master. You can connect CU2508 to PC running TwinCAT, and use two ports of CU2508 to connect to two EtherCAT slave devices.
In our case, we have used CU2508 , therefore you see three devices (one CU2508 and two slave devices) between master ports in the image below.
Ensure that both devices are in OP state. It can be displayed by selecting the "Device" (Double click on "Device") and then selecting the "Online" tab.
Break the link between OUT/Port1 of first device and IN/Port0 of second device. Both devices should still be in OP state.
enhancedlink_enable
of bsp_params should be set to TIESC_MDIO_RX_LINK_ENABLE while initializing the EtherCAT Slave FWHAL. This configuration is done in tiesc_socParamsInit()
in tiescsoc.c file.EtherCAT Slave Beckhoff SSC Example is expected to be used with ${SDK_INSTALL_PATH}/source/industrial_comms/ethercat_slave/beckhoff_stack/esi/TI_ESC.xml
file. If the application is modified to work with a different ESI XML file, user will need to update the corresponding ESI header file (tiesc_eeprom.h) and rebuild the application project.
${SDK_INSTALL_PATH}/tools/bin2c
folder. Example usage is shown below. tiesc_eeprom.h
file with new header file.