...
This current code stanza defines the location for the EtherCAT kernel drivers.
# =============================================================== # Define kernel module driver location # =============================================================== PACKAGE_TOP=/afs/slac/g/lcls/package KERNEL_DRIVER_HOME=$PACKAGE_TOP/linuxKernel_Modules ETHERCAT_DRIVER=$KERNEL_DRIVER_HOME/ethercat/buildroot-2015.02-x86_64 |
---|
...
The first step specific to an EtherCAT application, is creating a chain.xml file for the scanner process. The scanner process will open up a unix socket for communication with the IOC. If using the slac_ethercat template, you should already have a directory named /etc under <top>. Otherwise, you will been to create a directory called /etc. This directory will consist of a Makefile, chain.xml, and a scanner.xml. The scanner.xml will be automatically generated upon building the application.
...
TOP=..
include $(TOP)/configure/CONFIG
install: /usr/bin/python $(ECASYN)/etc/scripts/expandChain.py chain.xml > scanner.xml
clean: rm -f scanner.xml rm -f EK1101-EtherCAT.template distclean: clean realclean: clean uninstall: |
---|
...
However, the chain.xml needs to be manually created based off the devices in your EtherCAT chain. You should first verify that your device is supported in the EtherCAT Module (check that your device as
This directory will cons
To setup the scanner, chain.xml file is to be created.
...
is an example of a chain with just one motion control device (ref: $APP/users/namrata/EtherCATest/etc):
<chain> <device type_name="E1250-EC-UC" revision="0x00010007" position="0" name="LINMOTOR0" /> </chain> |
---|
Here is another example with two slave devices for an EtherCAT coupler and an analog output device for reading temperature from RTD's (ref: $APP/users/ababbitt/LCLS-II/TEMPERATURE/etc):
<chain> <device type_name="EK1101" revision="0x00120000" position="0" name="C <device type_name="EL3202" revision="0x00100000" position="1" name="A </chain> |
---|
To obtain the revision number for the device use the slaves ethercat 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.
NOTE: If you are using a brand new module, it may not currently exist in the EtherCAT module. You can check whether you device is supported by looking in the following areas in the EtherCAT module area.
XML
Templates
For the long-term, any new devices should be integrated into the EtherCAT module. Please contact the EtherCAT module owners:
- Who wants to be the EtherCAT module owner?
![(big grin)](/s/mtcf10/8804/1naq7q0/_/images/icons/emoticons/biggrin.svg)
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.
...
Verification checks on development machines (lcls-dev3):
- Check that your python version is correct:
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 |
---|
Debugging Tips