[etherlab-dev] A rookie try to build ethercat host master on ubuntu10.04

Thomas Bitsky Jr tbj at automateddesign.com
Wed Jun 11 20:46:02 CEST 2014


Here are notes I wrote for my junior programmer to help him install on our machines. Maybe they’ll help for you.

# sudo adduser <username> src
MAKE SURE YOU HAVE BOOTED UNDER THE TARGET KERNEL
# wget http://etherlab.org/download/ethercat/ethercat-1.5.2.tar.bz2
# tar xjf ethercat-1.5.2.tar.bz2

Move the source working directory to /usr/local/src
# sudo mv ethercat-1.5.2 /usr/local/src/
 Move to that location
# cd /usr/local/src/
Make a link to the source directory called Ethercat

# sudo ln -s ethercat-1.5.2 ethercat

Move into the source directory
# cd ethercat
# ./configure --enable-e1000e --enable-generic –disable-8139too
# make
# make modules
# sudo make install
# sudo make modules_install


When we've completed installing all the modules we want to use, we need to do a final depmod



# sudo depmod





Now, we do some configuration work. We start by finding the MAC address we want to use.



# sudo ifconfig



Pick out the HWAddr (Hardware Address, also known as the MAC Address) of the adapter you'd like to use (example: eth0) and record it. You'll need to type it in later.



Now let's copy in the configuration to the location that the EtherCAT Master will be expecting it.



# sudo mkdir /etc/sysconfig/

# sudo cp /opt/etherlab/etc/sysconfig/ethercat /etc/sysconfig/





Edit the configuration file using the nano text editor.



# sudo nano /etc/sysconfig/ethercat

You need to setup this file as prescribed in the EtherCAT manual. You definitely need to change the values for MASTER0_DEVICE, which need the MAC address of the Ethernet card you've selected, and then the driver you'd like to use for that device.
For a development system, "generic" is fine. For a production system, the hope is that you've selected a target machine with a supported network device. We typically used cards supported by the e1000e driver, but check the hardware specs if you’re unsure.

Example:

MASTER0_DEVICE="00:0C:29:09:E0:D7"

DEVICE_MODULES="e1000e"



(For a Development or VM-based system: DEVICE_MODULES="generic" )

 The next step is to install the EtherCAT driver as a service.


cd /opt/etherlab



Copy the initialization script (If this doesn't work, make sure that there isn't a /etc/init.d/ethercat already. If so, remove it), change its ownership properties.





# sudo cp ./etc/init.d/ethercat /etc/init.d/

# sudo chmod a+x /etc/init.d/ethercat




OPTIONAL:: This will automatically start the ethercat master on startup. Generally, we DON’T WANT TO DO THIS.

# sudo update-rc.d ethercat defaults

Make ethercat tool available:



# sudo ln -s /opt/etherlab/bin/ethercat /usr/local/bin/ethercat


  So “normal" users shall have reading access, a udev rule must be created, which simply means creating the file:
/etc/udev/rules.d/99-EtherCAT.rules



Using the text editor nano:

$ sudo nano /etc/udev/rules.d/99-EtherCAT.rules


Enter the following contents:

KERNEL=="EtherCAT[0-9]*", MODE="0664", GROUP="users"

Test that the master is working.



# sudo /etc/init.d/ethercat start



Setting up for User Program Development



The EtherLAB EtherCAT master is now running on the system. The next task is to setup the system so that other programs can use the master. You need to add /opt/etherlab/lib to your /etc/ld.so.conf so that the user programs calling it can link to the shared object.





# cd /etc/

# sudo nano ld.so.conf



THIS LINE WILL ALREADY EXIST ==> include /etc/ld.so.conf.d/*.conf


Underneath it, add:

/opt/etherlab/lib

So, when you're done, the file will look like the following:

include /etc/ld.so.conf.d/*.conf
/opt/etherlab/lib

Exit, save, then we need to update the system from the configuration file.

# sudo ldconfig

You can see if it got installed by running:

# ldconfig -v | grep libether*


Good luck!

From: taotao <taotao at cptek.com.cn<mailto:taotao at cptek.com.cn>>
Date: Tuesday, June 10, 2014 at 10:36 PM
To: "etherlab-dev at etherlab.org<mailto:etherlab-dev at etherlab.org>" <etherlab-dev at etherlab.org<mailto:etherlab-dev at etherlab.org>>
Subject: [etherlab-dev] A rookie try to build ethercat host master on ubuntu10.04


Dear Sir,


  Please forgive my poor english.  I ' m a C++ developer,  My boss want to let my build ethercat on Linux. also my company is your vendor. so i download 1.5.2 source code. and i has been successfully compled on Ubuntu 10.04.

I don't know what to do next.  so can you just send some create ethercat host master docmenet  to me?

  and I try to start ethercat master, but it's report error:

  "Starting EtherCAT Master 1.5.2 FATAL: Error Inserting ec_master (/lib/modules/2.6.32-38-generic/ethercat/master/ec_master.ko): Invalid argument“

  Is it ubuntu 10.04 kernel of linnux 2.6.32-38-generic problem?

  I was check file(lib/modules/2.6.32-38-generic/ethercat/master/ec_master.ko) is exist.

Best wish




2014-06-11
________________________________

★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

企业的价值在于员工的幸福和客户的感动!



陶 涛    Tao Tao

自动化系统开发部

System Development Department

江苏中兴西田数控科技有限公司

JIANGSU CPTEK SERVO TECHNOLOGY CO.;LTD

TEL:0519-80950895        FAX:0519-80950893

邮编:213300    邮箱:taotao at cptek.com.cn<mailto:taotao at cptek.com.cn>

地址:江苏省溧阳市中关村科技园上上路28号



★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

***************************************************************************************************************************************

收发邮件者请注意:

本邮件含保密信息,若误收本邮件,请务必通知发送人并直接删去,不得使用、传播或复制本邮件。

进出邮件均受到本公司合规监控。邮件可能发生被截留、被修改、丢失、被破坏或包含计算机病毒等不安全情况。



注意:

このメールには秘密情報が含まれていますので、もし間違いメールでしたら、必ず差出人に連絡をお願いします、そしてこのメールは削除お願いします。お手数をおかけしますがよろしくお願いいたします。なお、勝手にメールを変更したり、転送したり、コピーするのはお止めください。メールは当社にて監視されています。

なお添付資料を開くのはウイルス感染の恐れがありますのでお止めください。

***************************************************************************************************************************************


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-dev/attachments/20140611/64764f75/attachment-0001.html>


More information about the etherlab-dev mailing list