Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

$ 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 EtherCAT linuxRT Configuration

We are currently using Etherlab's EtherCAT Master module, which can be found under the package area<To be finished tomorrow.>

 

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)

...

  The kernel-modules.cmd file needs to be updated to include the following:

  1. Location of EtherCAT kernel drivers
  2. Install kernel drivers
  3. Network configuration
  4. EtherCAT system configuration & set-up
  5. 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 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 following stanza provides the network configuration, installs kernel drivers, and performs some EtherCAT system configuration & set-up

# =========================================

# 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

# Recommend using the following logic to configure based on the port’s MAC Address

EthCat_MAC_ADDR=00:0B:AB:39:3F:CB

eth_cat=$(ifconfig -a | grep "HWaddr ${EthCat_MAC_ADDR}" | awk '{print $1}')

ifconfig ${eth_cat} netmask 255.255.255.0



# insert MAC address for eth1 after main_devices

# the ethercat slaves/devices are connected at eth1 (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 up


ln -s $ETHERCAT_DRIVER/tool/ethercat /sbin/ethercat


sleep 5

chmod o+rw /dev/EtherCAT*


# ===========================================================

Next, need to add the following lines to start the scanner process up automatically.

# ===================================================================

 

# Now we start the ethercat scanner process under the linux screen program:

 

# This will allow us to attach/detach to our Ethercat scanner process

 

# ==============================================

 

# ==============================================

cd $EPICS_IOCS/cpu-b084-hp03

su laci -c $EPICS_IOCS/vioc-b084-tmp1/scannerStartup.sh

# =================================================

 


Verification checks on linuxRT machines:

  •  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

...

  • 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

EtherCAT Template for Creating Epics Application 

When starting a new EtherCAT application, it is highly recommended to start a new epics application and vioc using the slac_ethercat template.

Configuring EtherCAT Epics Application

...