NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
Configuring TwinCAT For AM335x
Contents
- 1 Introduction
- 2 Configuring TwinCAT For AM335x
- 3 Controlling Digital LED's On AM335x (running Full application) Using TwinCAT
- 4 Controlling Digital LED's On AM335x (running Demo application) Using TwinCat
- 5 Monitoring Digital Inputs on AM335x Using TwinCAT
- 6 Online Application upgrade from TwinCAT
- 7 Generating EEPROM binary file
- 8 Disclaimer
Introduction[edit]
This article describes how TwinCAT software running on a PC can be used to control AM335x based EtherCAT slave controller, and monitor inputs from it. TwinCAT is a software system from BeckHoff which turns almost any compatible PC into a real-time controller with a multi-PLC system. TwinCAT can be used to control the digital ouputs and monitor the digital inputs on AM335x over EtherCAT. There are eight digital LED's on AM335x IDK/ICE which represents eight digital outputs; there are eight pairs of jumper pins respresenting eight digital inputs.
Configuring TwinCAT For AM335x[edit]
1. Install TwinCAT (One month evaluation is available for free download from Beckhoff website www.beckhoff.de/tcatweb/twincat_download_e.aspx - select PLC mode of installation and check IO drivers box. TwinCAT works best on 32 bit Windows XP/Vista machines.
2. Copy sdk\protcols\ethercat\ecat_appl\esi\TI_ESC.xml and sdk\examples\ethercat\esi\TiEtherCATLib.xml to <Drive>:\TwinCAT\Io\EtherCAT folder
3. Start TwinCAT system manager
4. Goto Options > Show Real Time Ethernet Compatible Devices and Install TwinCAT RT Ethernet intermediate driver. For best performance - it is recommended to use compatible NIC card listed here, infosys.beckhoff.com/index.php. If the network interface is listed as incompatible device, you can still proceed by installing the driver, enabling it and use TwinCAT.
5. Goto I/O - Configuration > I/O Devices - right click and select Append device and then select EtherCAT > EtherCAT. Device1 (EtherCAT) will be added to I/O devices
6. Connect CAT5 Ethernet cable from TwinCAT PC to ECAT IN/Port0(J8 of IDK, J2 of ICE) . If you have multiple ICE/IDKs in chain, please connect from ECAT OUT/Port1 (J9 of IDK, J3 of ICE) to Port0 of next ICE/IDK.
7. Now right click Device1(EtherCAT)> select Scan Boxes.
8. Or to scan a device right click on 'I/O Devices' and Select 'Scan Devices'. A dialog box will appear for 'Scan for boxes'. Select Yes.
9. TI Boxn(ti-esc) (full application) or Box n(TIESC-00m) (demo application) will be detected automatically.
10. Now select Device1 (EtherCAT) and goto Actions > Select Set/Reset TwinCAT to Config Mode or use shortcut SHIFT-F4
11. A dialog will pop asking Load I/O Devices, select Yes
12. Next dialog asks confirmation to Activate Free Run - select Yes. This will put the Slave into OP mode
Controlling Digital LED's On AM335x (running Full application) Using TwinCAT
[edit]
1. Now user can control digital out leds using TwinCAT. Select TI Boxn(ti-esc)>DO Outputs > LED1-8 to control the output LEDs .
2. To turn an LED on/off right click on the LED, select 'Online Write' and enter the value 1/0.
Controlling Digital LED's On AM335x (running Demo application) Using TwinCat[edit]
1. Now user can control digital out leds using TwinCAT. Select Boxn(TI-ESC)>RxPDO >32Bit Output to control the output LEDs .
2. To turn an LED on/off right click on the 32Bit Output, select 'Online Write' and enter the value 1/2/4 etc to turn on the first second or third LED. A value of 0xFF would turn all LEDs on and 0x0 would turn all of them off.
Monitoring Digital Inputs on AM335x Using TwinCAT
[edit]
1. There are jumper pins marked J9 (ICE) and J15 (IDK) on the AM335x board next to the digital output LEDs. The last 8 of them (adjacent to resistors) can be used to supply Digital Inputs.
2. If you are running the Demo application, go to Box (TIESC-001) > TXPDO > 32Bit Input. If you are running the Full application, go to TI Box (ti-esc) > DI Inputs > Switch n. Open the Online Tab.
3. In the Demo version, placing jumpers across the Digital Input pins sets bits in the LSB of the Value. Placing a jumper across the first pair of pins will set the least significant bit (bit 0), placing a jumper across the second pair of pins will set bit 1, and so on. In the full version, placing a jumper across the first pair of pins will set Switch 1, placing a jumper across the second pair of pins will set Switch 2, and so on. The value can be read by choosing the appropriate switch, and opening the online tab.4. The following reading will be obtained with jumper placed across the sixth pair of pins.
Online Application upgrade from TwinCAT
[edit]
TI PRU-ICSS EtherCAT Slave running on supported platforms can be upgraded online using FoE.
To use this feature from TwinCAT, EtherCAT Slave Information (ESI) file needs to be updated to have the FoE feature enabled.
Steps to modify the ESI file are as follows:
- Go to ${TWINCAT_INSTALL_FOLDER}\3.1\Config\Io\EtherCAT
- Open ESI file (TI_ESC.xml or TiEtherCATLib.xml) with an editor and search for ‘CoE’.
- Add a new tag <FoE /> after to CoE tag as given below.
<Mailbox DataLinkLayer="true">
<CoE SdoInfo="true" SegmentedSdo="true" CompleteAccess="true" />
<FoE />
- Save the file.
- Restart TwinCAT
Note: In order to have the option to upgrade TI EtherCAT slave application via FoE you need to run full-fledged EtherCAT slave.
The following section describes the procedure to upgrade TI EtherCAT slave application during runtime.
- Configure TwinCAT as mentioned in previous sections.
- Click on TI Box, Select "Online" tab.
- Click "Bootstrap" (Label 1 on picture) button. ( This will take the Slave to BOOT state).
- Once the state has changed to 'BOOT', Click 'Downoad' button ( Label 2 on picture).
- Rename your EtherCAT application binary (.bin) as ECATFW__, and use this file as your new EtherCAT application firmware.
- Locate the new firmware to be dowloaded click 'Open'.
- Click OK on the new dialog shown.
- This will downlload the new firmware. The progress bar will show the status of download.
- Once the download has finished, change the state back to "Init" by clicking 'Init' button. This will cause a reload of the application.
Generating EEPROM binary file
[edit]
The following steps explain how to convert the ESC configuration file into an EEPROM binary file. This binary file can later be used for generating equivalent header file to be used to build the EtherCAT Application.
1. Configure TwinCAT as mentioned in previous sections.
2. Click on the TI Box. Select EtherCAT. Click on the tab 'Advanced Settings'.
3. Select ESC Access->E2PROM->Hex Editor. Select 'Write to File' and save the binary as a '.bin' file.
NOTE: Please make sure that upload button is not clicked any time before during this step - this will load the EEPROM data from TI ESC to TwinCAT memory.
Disclaimer[edit]
TwinCAT is a software product developed and supported by BeckHoff. For further product details and for support information on TwinCAT please visit http://www.beckhoff.com/english.asp?twincat/default.htm