Ethercat HAL driver

More
6 years 5 months ago #166565 by CORBETT
Replied by CORBETT on topic Ethercat HAL driver
I kept working over and over on TwinCAT 2.11 to get the ethernet card working and never could, but I downloaded TwinCAT 3.1 and it loaded the intel based ethernet card on the first try. I had already checked Beckhoff's website to make sure the ethernet card was compatible, but it just would never work in TC2.

So now I can see the EL5151 terminal in TwinCAT 3 config mode, but I am not quite sure what to do. I had read so much about TC2 that I am lost in TC3. I am just glad to finally see the thing show up in TwinCAT so I can try to get it working.

@ chimeno Albert, I will have to go back and review all that you stated in the past since I can finally see the terminal in TC3
More
6 years 5 months ago #166640 by theshade
Replied by theshade on topic Ethercat HAL driver
Thank you, that was it..!!!!!

Except that (maybe because it's a pi... doing it as the "pi" user (without sudo) seemed to work better..
running
hg config --debug helped me figuring this out...
More
6 years 5 months ago - 6 years 5 months ago #166754 by theshade
Replied by theshade on topic Ethercat HAL driver
Still trying to compile on a raspberry,
I think I compiled everything but it seems the tool doesn't match the kernel module... and I don't know how to debug, configure or change what I did to make them match:
pi@raspberrypi:~/etherlabmaster/etherlabmaster-code/tool $ ./ethercat master
Failed to get master information: Inappropriate ioctl for device

found this related link from Florian but it's pretty old...
lists.etherlab.org/pipermail/etherlab-users/2009/000437.html

pi@raspberrypi:~/etherlabmaster/etherlabmaster-code/tool $ ./ethercat version
IgH EtherCAT master 1.5.2 0c011dc6dbc4+

the service is loaded:
pi@raspberrypi:~/etherlabmaster/etherlabmaster-code/tool $ systemctl status ethercat.service
* ethercat.service - EtherCAT Master Kernel Modules
Loaded: loaded (/etc/systemd/system/ethercat.service; enabled; vendor preset: enabled)
Active: active (exited) since Tue 2020-05-05 10:47:20 CEST; 1h 13min ago
Main PID: 2751 (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 4915)
Memory: 0B
CGroup: /system.slice/ethercat.service
May 05 10:47:20 raspberrypi systemd[1]: Starting EtherCAT Master Kernel Modules...
May 05 10:47:20 raspberrypi systemd[1]: Started EtherCAT Master Kernel Modules.

module are here:
pi@raspberrypi:~/etherlabmaster/etherlabmaster-code/tool $ modinfo ec_master
filename: /lib/modules/4.19.58-rt22-v7l+/updates/dkms/ec_master.ko
version: 1.5.2 unknown
license: GPL
description: EtherCAT master driver module
author: Florian Pose <fp@igh-essen.com>
srcversion: 39580AF71CC604526D48086
depends:
name: ec_master
vermagic: 4.19.58-v7l SMP preempt mod_unload modversions ARMv7 p2v8
parm: main_devices:MAC addresses of main devices (array of charp)
parm: backup_devices:MAC addresses of backup devices (array of charp)
parm: debug_level:Debug level (uint)

pi@raspberrypi:~/etherlabmaster/etherlabmaster-code/script $ modinfo ec_generic
filename: /lib/modules/4.19.58-rt22-v7l+/updates/dkms/ec_generic.ko
version: 1.5.2 unknown
license: GPL
description: EtherCAT master generic Ethernet device module
author: Florian Pose <fp@igh-essen.com>
srcversion: 1AE486D6201500C92B67C63
depends: ec_master
name: ec_generic
vermagic: 4.19.58-v7l SMP preempt mod_unload modversions ARMv7 p2v8



so I redid a (not sure why) :
sudo apt-get install etherlabmaster
( I also checked the log when I use ec-debianize to build it and get the same errors)
Which resulted in this:
Warning: Spoiler!

Warning: Spoiler!




I did put:
MASTER0_DEVICE="eth0" in ethercat.conf
and
echo "ENABLE_CYCLES = NO" > configure/CONFIG_OPTIONS.local
and run
./configure --enable-generic --disable-8139too

recompiled and then did that ( forum.linuxcnc.org/27-driver-boards/3559...uxcnc-how-to-install ):
Open etc/default/ethercat as root : $ sudo thunar
Find your mac adres : $ ip link show (output = link/ether ....)
Type in MASTER0_DEVICE="lo:ve:me:te:nd:er" (your mac adres my dear)
Type in DEVICE_MODULES="generic"
$ sudo update-ethercat-config (reboot, or restart your pc)

I think I missed some configuration steps or maybe having both ec-debianized dpkg installed after the igh etherlabmaster.... but I don't know where... still trying things... but mostly getting lost...

Thank you in advance and sorry if I am slow and don't yet grab the essence of it... maybe I should start again from scratch (
Last edit: 6 years 5 months ago by theshade.
More
6 years 5 months ago #166822 by theshade
Replied by theshade on topic Ethercat HAL driver
well tonigh I restarted from a fresh raspbian image and logged everything I did:

# Starting from fresh 2020-02-13-raspbian-buster-full.img install
# configure language, keyboard, wifi, enable VNC

#install subversion (svn)
sudo apt-get install subversion
# just because I forgot (it's the first thing to do)
sudo apt-get update
sudo apt-get upgrade

svn checkout github.com/sgawad/rpi4-4.19.58-rt/trunk/prebuilt
cd prebuilt/
chmod +x deploy.sh
./deploy.sh

# the pi will reboot by itself... at the end of deploy.sh
uname -a
Linux raspberrypi 4.19.58-rt22-v7l+ #1 SMP PREEMPT RT Fri Nov 1 14:58:37 KST 2019 armv7l GNU/Linux

git clone github.com/sittner/ec-debianize
cd ec-debianize/

# install mercurial with mq extensions (thx chimeno)
sudo apt-get install mercurial
hg config --edit
#PRESS 1
#ADD under
#[extensions]
mq =
save file /home/pi/.hgrc
./get_source.sh
cd etherlabmaster
dpkg-checkbuilddeps
sudo apt-get install debhelper
sudo apt-get install dkms
sudo apt-get install quilt

# end of output looks like
# dpkg-genbuildinfo
# dpkg-genchanges >../etherlabmaster_1.5.2+20190904hg33b922p8ea394-1_armhf.changes
#dpkg-genchanges: info: including full source code in upload
# dpkg-source --after-build .
#dpkg-source: info: unapplying 40_safe_rt_mutex_enable.patch
#dpkg-source: info: unapplying 30_relax_al_state_change_timeout.diff
#dpkg-source: info: unapplying 20_fix_read_pdo_count.diff
#dpkg-source: info: unapplying 10_fix_distclean.diff
#dpkg-buildpackage: info: full upload (original source is included)
# signfile etherlabmaster_1.5.2+20190904hg33b922p8ea394-1.dsc
#gpg: keybox '/home/pi/.gnupg/pubring.kbx' created
#gpg: skipped "Sascha Ittner <sascha.ittner@modusoft.de>": No secret key
#gpg: dpkg-sign.K_Eus86w/etherlabmaster_1.5.2+20190904hg33b922p8ea394-1.dsc: clear-sign failed: #No secret key
#dpkg-buildpackage: error: failed to sign .dsc file
# but apparently it's all normal !!!

#running
sudo dpkg -i etherlabmaster_1.5.2+20190904hg33b922p8ea394-1_armhf.deb

#gives errors looking at the log... so had to fix acrroding to this


#The kernel headers are cross compiled and there's a bug in deb-pkg that packs the build host #executables rather than the target executables. Thankfully, the sources are also included with #the headers so you just have to recompile the header scripts.

#There are 4 steps needed to do this:
#1) Change to the Linux header directory:
cd /usr/src/linux-headers-`uname -r`
#1) Install the necessary dependencies:
sudo apt-get install -y build-essential bc bison flex libssl-dev
#2) Apply the byteshift patch to the headers:
wget raw.githubusercontent.com/armbian/build/...bian-byteshift.patch -O - | sudo patch -p1
#3) Compile the scripts:
sudo make scripts
#Now DKMS should work like normal. This is useful for adding Realtek wireless devices and other #drivers.

sudo dpkg -i etherlabmaster_1.5.2+20190904hg33b922p8ea394-1_armhf.deb
(Reading database ... 230473 files and directories currently installed.)
Preparing to unpack etherlabmaster_1.5.2+20190904hg33b922p8ea394-1_armhf.deb ...


Deleting module version: 1.5.2+20190904hg33b922p8ea394
completely from the DKMS tree.
Done.
Unpacking etherlabmaster (1.5.2+20190904hg33b922p8ea394-1) over (1.5.2+20190904hg33b922p8ea394-1) ...
Setting up etherlabmaster (1.5.2+20190904hg33b922p8ea394-1) ...
Loading new etherlabmaster-1.5.2+20190904hg33b922p8ea394 DKMS files...
Building for 4.19.58-rt22-v7l+
Building initial module for 4.19.58-rt22-v7l+
Error! Bad return status for module build on kernel: 4.19.58-rt22-v7l+ (armv7l)
Consult /var/lib/dkms/etherlabmaster/1.5.2+20190904hg33b922p8ea394/build/make.log for more information.
dpkg: error processing package etherlabmaster (--install):
installed etherlabmaster package post-installation script subprocess returned error exit status 10
Processing triggers for libc-bin (2.28-10+rpi1) ...
Errors were encountered while processing:
etherlabmaster

the log content is now as follow and the first error is gone... others are still there tough...

Warning: Spoiler!

More
6 years 5 months ago #166888 by chimeno
Replied by chimeno on topic Ethercat HAL driver
Hi @theshade
I have no experience in Raspbian, can you try this if it helps you?
Code:
./get_source.sh dpkg-buildpackage -uc -us
Greeting
Chimeno
More
6 years 5 months ago #166894 by theshade
Replied by theshade on topic Ethercat HAL driver
Hi @chimeno, Thank you so much for your help.

making the package works with
./get_source.sh
dpkg-buildpackage -uc -us
and it doesn't complain about the missing signature ..

but again it's when I install the package:
sudo dpkg -i etherlabmaster_1.5.2+20190904hg33b922p8ea394-1_armhf.deb

that I get the some compile errors about "free_dma" and "free_irq" : (same as last night)
Warning: Spoiler!


Thanks anyway..
Time to create page: 0.186 seconds
Powered by Kunena Forum