<This page is currently under active progress. Please contact Alisha Babbitt (ababbitt@slac.stanford.edu) for more information or questions.>
This page covers how to setup a new EtherCAT device and integrate into the EPICS Control System. The following topics are included:
- EtherCAT Resources & Reference Material
- linuxRT PC Set-up
- EtherCAT linuxRT Configuration
- EtherCAT Template for Creating Epics Application
- Configuring EtherCAT Epics Application
- T
- Debugging Tips
EtherCAT Resources & Reference Material
The following resources and reference material provide an introduction to the EtherCAT technology:
linuxRT PC Set-up
In the SLAC environment, we are currently running EtherCAT on industrial PC's running linux with a pre-emptive real-time patch (linuxRT). Before configuring for EtherCAT, the very first step is to set-up a new linuxRT host.
Verification Checks of linuxRT Machines:
- Please see $IOC/cpu-<bld>-<name>/README on instructions on how to power cycle machines remotely through the use of ipmi commands
- Once you set-up your linuxRT machine and boot up, log in as laci to your linuxRT system. ( ssh laci@cpu-<bld>-<name>)
- Test if your machine is running real-time linux using uname -a
$ uname -a Linux cpu-b34-mc23 3.18.11-rt7 #5 SMP PREEMPT RT Wed Mar 16 19:03:38 PDT 2016 x86_64 GNU/Linux $ /lib/libc.so.6 GNU C Library (Buildroot) stable release version 2.20, by Roland McGrath et al. Copyright (C) 2014 Free Software Foundation, Inc. |
---|
EtherCAT linuxRT Configuration:
In the SLAC environment, we are currently running EtherCAT on industrial PC's running linux with a pre-emptive real-time patch (linuxRT). Before configuring for EtherCAT, the very first step is to set-up a new linuxRT host.
We are currently using Etherlab's EtherCAT Master module.
3. As the OS is set up, the linux Kernel Driver is required. For this, include the kernel module, include the port where the device is connected into the kernel-modules.cmd file. ( ref : $IOC/cpu-b34-mc23)
4. Test if your machine has the Etherlab EtherCAT driver module loaded.
$ ethercat version IgH EtherCAT master 1.5.2 2eff7c993a63 $ lsmod | grep ec ec_generic 3453 1 ec_master 240382 3 ec_generic |
---|
5. If the slaves are connected with the setup, the ethercat command line tool can help visualize it.
$ ethercat slaves 0 0:0 OP + E1250-EC-UC V1.7b1 |
---|
The EtherCAT application has two parts.
- The scanner process which scans the bus.
- The IOC application
The scanner process open up unix socket for communication with IOC.
To setup the scanner, chain.xml file is to be created.
- Obtain the device.xml file from the vendor and add it in the /etc/xml folder.
- Create a chain.xml file defining the devices on the network. (ref: $APP/users/namrata/EtherCATest/etc)
<chain> <device type_name="E1250-EC-UC" revision="0x00010007" position="0" name="LINMOTOR0" /> </chain> |
---|
To obtain the revision number for the device use the slaves etherlab command line tool.
$ ethercat slaves -v -p0 === Master 0, Slave 0 === Device: Main State: OP Flag: + Identity: Vendor Id: 0x4c4e5449 Product code: 0x009606e3 Revision number: 0x00010007 Serial number: 0x1bd200e7 |
---|
- Generate the scanner.xml file using the script - expandChain.py present under /etc/scripts
scripts/expandChain.py chain.xml > scanner.xml |
---|
- Generate the database template file using the script - makeTemplate.py present under /etc/scripts. The maketemplate.py file has shortennames function: Use it to shortenn names of the PVs.
scripts/maketemplate.py -b xml -d E1250-EC-UC -r 0x00010007 -o E1250-EC-UC.template |
---|
- Add the scanner.xml file in a bin folder along with the scanner binary in $IOC/vioc-b34-mc23 folder.
Add the script to start the scanner as a linux screen process. (ref: $IOC/cpu-b34-mc23)
Start the scanner at 100Hz frequency.
Python version: Python 2.7.9
export the correct version to the path
$ python --version Python 2.7.4 $ export PATH=/afs/slac/g/lcls/package/python/python2.7.9/linux-x86_64/bin/:$PATH $ python --version Python 2.7.9 |
---|