Discussion:
[etherlab-dev] compile and use ethercat driver under linux 3.10.33
dries geentjens
2014-04-08 20:14:30 UTC
Permalink
Dear Developers,During my tries to get the ethercat driver working, I got stuck on two computers.The first computer is a raspberry pi. Here, I run a ported kernel especially for raspberry pi.My problem: I can perfectly do a "./ethercat restart". The ethercat driver stops and comes back up.This I perfectly see with "lsmod".Still, when I try to do "ethercat slaves" for example, the raspberry pi immediatly gives me the following line: "IOCTL() version magic difference. EtherCAT0:28 ethercat:13".The compiling happens on the same target. I don't understand why I have this problems.The second computer gives "Module ec_master not found. Failed".What is saw was the fact that I don't have the "ec_master.ko" in the /lib/modules/<kernel>/ethercat.This ethercat directory is just empty. What can be the problem for this problem?Can somebody please get me a hand with this. I really have no clues anymore.Kind regards,Dries Geentjens
Gavin Lambert
2014-04-08 23:01:49 UTC
Permalink
Post by dries geentjens
Still, when I try to do "ethercat slaves" for example, the raspberry pi
immediatly gives me the following line: "IOCTL() version magic difference.
EtherCAT0:28 ethercat:13".
This means that your installed kernel modules do not match your userland
versions.
Post by dries geentjens
The second computer gives "Module ec_master not found. Failed".
What is saw was the fact that I don't have the "ec_master.ko" in the
/lib/modules/<kernel>/ethercat. This ethercat directory is just empty.
What can be the problem for this problem?
This suggests that you have not installed the kernel modules.

Both of these problems most likely stem from the same source: you are not
building the system properly. Read the INSTALL file.
r***@diamond.ac.uk
2014-04-09 08:36:17 UTC
Permalink
Hello,

No solution from me, but more questions:
What kernel did you port?
Which kernel are you running?
What kernel is running on the raspberry pi? You mention a "target" where the compiling happens. Is there a host computer?
Which interface do you intend to use: generic? Hardware-specific? (Which adapter)

I also suggest that you try this other mailing list where there seems to be more traffic.
etherlab-***@etherlab.org<mailto:etherlab-***@etherlab.org>

Regards,

Ronaldo


From: dries geentjens [mailto:***@hotmail.com]
Sent: 08 April 2014 21:15
To: etherlab-***@etherlab.org
Subject: [etherlab-dev] compile and use ethercat driver under linux 3.10.33

Dear Developers,

During my tries to get the ethercat driver working, I got stuck on two computers.

The first computer is a raspberry pi. Here, I run a ported kernel especially for raspberry pi.
My problem: I can perfectly do a "./ethercat restart". The ethercat driver stops and comes back up.
This I perfectly see with "lsmod".
Still, when I try to do "ethercat slaves" for example, the raspberry pi immediatly gives me the following line: "IOCTL() version magic difference. EtherCAT0:28 ethercat:13".
The compiling happens on the same target. I don't understand why I have this problems.

The second computer gives "Module ec_master not found. Failed".
What is saw was the fact that I don't have the "ec_master.ko" in the /lib/modules/<kernel>/ethercat.
This ethercat directory is just empty. What can be the problem for this problem?

Can somebody please get me a hand with this. I really have no clues anymore.

Kind regards,
Dries Geentjens



--

This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.

Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd.

Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.

Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
Jeroen Van den Keybus
2014-04-09 12:33:11 UTC
Permalink
Post by dries geentjens
During my tries to get the ethercat driver working, I got stuck on two
computers.
You really need to give more specific information. For starters, which
EtherCAT master version ?

The first is therefore an ARM SoC. What type is the second ?
Post by dries geentjens
The first computer is a raspberry pi. Here, I run a ported kernel
especially for raspberry pi.
My problem: I can perfectly do a "./ethercat restart". The ethercat driver
stops and comes back up.
This I perfectly see with "lsmod".
'restart' is not a valid ethercat command. Nothing of what 'ethercat' does,
influences the kernel drivers and, therefore, cannot be observed by lsmod.

Still, when I try to do "ethercat slaves" for example, the raspberry pi
Post by dries geentjens
immediatly gives me the following line: "IOCTL() version magic difference.
EtherCAT0:28 ethercat:13".
The compiling happens on the same target. I don't understand why I have
this problems.
The second computer gives "Module ec_master not found. Failed".
What is saw was the fact that I don't have the "ec_master.ko" in the
/lib/modules/<kernel>/ethercat.
This ethercat directory is just empty. What can be the problem for this
problem?
Assuming you are building this on a PC, I can suggest the following:

0. First build and test this on a PC platform, so that you know how the
master should behave.
1. Make sure you get the source in a local building directory, not
requiring root access. Avoids contamination of your Linux installation.
2. Do not build kernel-specific Ethernet drivers yet. Instead, use
ec_generic for initial testing and acquaintance. The main reason is that
you do not need a specific kernel version in this case. Any recent kernel
will do.
3. Do not install yet (don't do 'sudo make install' or 'sudo make
modules_install'). Instead, use 'sudo insmod' to try and load the kernel
modules directly without affecting your Linux installation.

For *building*, after unpacking the source, you basically need 4 steps (you
need to be in the toplevel source dir for this, note the $ prompt: none of
this requires root privs):

$ ./bootstrap linux
$ ./configure --disable-8139too [note: must terminate with:
'config.status: executing libtool commands']
$ make
$ make modules

(by default, ec_generic is enabled (good) but the 8139 is by default
enabled as well (bad) and will fail if your kernel doesn't match any of the
supported versions. By disabling it, any kernel version will do.)

Follow the INSTALL guidelines closely and specifically, check during module
building ('make modules') which kernel build directory was used. For that,
check the 2nd line of the 'make modules' result. It should read like:

make[1]: Entering directory `/home/[username]/work/linux-[version]'

Check that this is indeed the Linux version you intend to use.


To *run the master*, you first need to determine the MAC address of the eth
interface that's going to be managed by the master.

$ /sbin/ifconfig -a

Make note of the relevant MAC address.

Now load the master (still in toplevel source dir !)

$ sudo insmod master/ec_master.ko main_devices=[mac address]

Do yourself a favor and enable ordinary user access to the just-created
device (otherwise you have to always 'sudo ethercat'):

$ sudo chmod 666 /dev/EtherCAT0

Then, and only then, load the Ethernet driver (the correct attachment is
done through the MAC address you specified earlier):

$ sudo insmod devices/ec_generic.ko

Chances are that your network interface isn't up yet. To make certain, do:

$ sudo ifconfig eth[X] up

Now test operation of the system with any and all of:

$ dmesg
$ tool/ethercat master
$ tool/ethercat slave -v


Only after this, I would endeavour building on an embedded platform.
Post by dries geentjens
Can somebody please get me a hand with this. I really have no clues
anymore.
Go and build it. Properly. And step by step.

Good luck,



J.

Loading...