<This page is currently under reviewactive development/revision. Please contact Alisha Babbitt (ababbitt@slaccontact Jesus Vasquez <jvasquez@slac.stanford.edu) > for more information or questions.>
...
- EtherCAT Resources & Reference Material
- linuxRT PC Set-up
- Configuring the $IOC/vioc-<>-<> Directorysioc-<area>-<subsystem##> Directory where ## is a 2-digit number 01-99.
- EtherCAT linuxRT Configuration
- EtherCAT Template for Creating Epics Application
- Configuring EtherCAT Epics Application
- Debugging Tips
...
- For new users, please reference the following page: Diskless Boot of LinuxRT or Centos7 - Quick Start-up For New UsersHighly Highly recommend viewing this diagram: LinuxRT_Diagram
Verification checks on 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
We are currently using Etherlab's EtherCAT Master module, which can be found under the package area. The kernel-modules.cmd file needs to be updated to include the following:
- Location of EtherCAT kernel drivers
- Install kernel drivers
- Network configuration
- EtherCAT system configuration & set-up
- Start scanner process
Update the following lines of code in your $IOC/cpu-<>-<>/kernel-modules.cmd. The following code excerpts are from $IOC/cpu-b084-hp03/kernel-modules.cmd
Table 1
Facility | LinuxRT Account | LinuxRT Group | Comment |
---|
Development | laci | lcls | |
LCLS | laci | lcls | |
LCLS-II | | | not yet available |
FACET | flaci | facet | linuxRT is built with laci as the default account, users must add facet group, user and password |
Test-Facility | acctf | ? | linuxRT is built with laci as the default account, users must add test-facility group, user and password |
Verification checks on 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 on development for instance, log into laci on your linuxRT system (ref: Table 1). ( 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
We are currently using Etherlab's EtherCAT Master module, which can be found under the package area. The kernel-modules.cmd file needs to be updated to include the following:
- Location of EtherCAT kernel drivers
- Install kernel drivers
- Network configuration
- EtherCAT system configuration & set-up
- Start scanner process
Update the following lines of code in your $IOC/cpu-<>-<>/kernel-modules.cmd. The following code excerpts are from $IOC/cpu-b084-hp03/kernel-modules.cmd
This current code 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 |
---|
...
# ========================================= # Install EtherCat kernel drivers + Set-up # ========================================= # Need to configure another ethernet port on cpu-b084-hp03 for ethercat # MUST configure another ethernet port for ethercat # ifconfig eth1 192.168.1.10 netmask 255.255.252.0<insert_your_ethercat_ip_address> netmask <insert_your_netmask> # Recommend using the following logic to configure based on the port’s MAC Address EthCat_MAC_ADDR=00:0B:AB:39:3F:CB<insert_your_MAC_addresss_for_your_etherCAT_port> eth_cat=$(ifconfig -a | grep "HWaddr ${EthCat_MAC_ADDR}" | awk '{print $1}') ifconfig ${eth_cat} netmask 255.255.255.0<insert_your_ethercat_ip_address> netmask <insert_your_netmask>
# insert MAC address for eth1 after main_devices # the ethercat slaves/devices are connected at eth1 connected at ${eth_cat} (for this specific configuration)
insmod $ETHERCAT_DRIVER/master/ec_master.ko main_devices=${EthCat_MAC_ADDR} insmod $ETHERCAT_DRIVER/devices/ec_generic.ko
/sbin/ifconfig eth1 ${eth_cat} up
ln -s $ETHERCAT_DRIVER/tool/ethercat /sbin/ethercat
sleep 5 chmod o+rw /dev/EtherCAT* # =========================================================== |
---|
...
$ ethercat version IgH EtherCAT master 1.5.2 2eff7c993a63 $ lsmod | grep ec ec_generic 3453 1 ec_master 240382 3 ec_generic |
---|
- 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 |
---|
- Another helpful ethercat command line took is ethercat master
Configuring the $IOC/vioc-<>-<> Directory
The $IOC/vioc-<>-<> directory created for this EtherCAT application needs the follow items:
ec_master 240382 3 ec_generic |
---|
- 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 |
---|
- Another helpful ethercat command line took is ethercat master
Configuring the $IOC/sioc-<>-<> Directory
The $IOC/vioc-<>-<> directory created for this EtherCAT application needs the follow items:
- scannerStartup.sh (where should we put a "master" scannerStartup.sh for people to copy/point to)
- Proposal: put generic scannerStartup.sh under $IOC/common/ethercat. Script has been modified to pass in the vioc name from when the script is called from the kernel-modules.cmd
- so vioc specific information (for vioc-ltu0-mc01) was moved to the kernel-modules.cmd => have to think about use case where multiple subsystems share cpu (see above solution)
- OR do we keep it in kernel-modules.cmd (this should be apart of the linuxRT discussion)
- Create a bin directory (currently under discussion to rename this "bin" directory to avoid confusion)
- scannerStartup.sh (where should we put a "master" scannerStartup.sh for people to copy)
- Create a bin directoryProposal: rename "bin" to "scanner" and use symbolic links to point to scanner binary and scanner.xml in epics application
- In the bin directory, create a symbolic link "scanner" that points to your scanner binary in your epics application (<top>/bin/linuxRT_glibc-x68_64/scanner)
OH! scanner binary is NOT specific to your application. Should point to the package area.
- In the bin directory, create a symbolic link "scanner.xml" that points to your scanner.xml in your epics application (<top>/etc/scanner.xml)
...
Generate a vioc for your application. We are using the following format for linuxRT IOC's: vioc-<area>-<subsystem>
Choose your target architecture:
...
Any new devices should be integrated into the EtherCAT module. Please contact the EtherCAT module owners:owner:
- Who wants to be the EtherCAT module owner?
Jesus Vasquez: jvasquez@slac.stanford.edu
Now that the chain.xml file has been created to generate the scanner.xml file, the second part is to configure and clean-up your epics application to only include the elements that you need.
...