Beckhoff / CCAT

Beckhoff CCAT FPGA Kernel mode driver to run EtherCAT Master on CX devices
Other
36 stars 16 forks source link

ccat and etherlab on CX5130 #7

Closed Gunob17 closed 4 years ago

Gunob17 commented 4 years ago

Hi. Im trying to install CCAT and etherlab on a CX5130 im using ubuntu server 18.04.4 lts with fully preempt linux-4.19.106-rt45 kernel installed for realtime operation.
i run the installation of ccat $make and sudo make install I can see that the ccat modules have been installed (see bellow)

$lsmod | grep ccat
ccat_update            16384  0
ccat_systemtime        16384  0
ccat_sram              16384  0
ccat_gpio              16384  0
ccat_netdev            16384  0
ccat                   16384  2 ccat_sram,ccat_update

After this im trying to install etherlab master in the using the guide from the documentation $hg clone http://etherlabmaster.hg.sourceforge.net/hgweb/etherlabmaster/etherlabmaster ethercat-hg $cd ethercat-hg $hg update stable-1.5 $patch -p1 < ../CCAT/etherlab-patches/0001-convert-ccat-to-mfd.patch $patch -p1 < ../CCAT/etherlab-patches/0002-zalloc.patch $./bootstrap $./configure --disable-8139too --enable-ccat_netdev --enable-kernel --enable-cycles --enable-hrtimer --prefix /opt/etherlab

$make $make modules $make install $make modules_install

$mkdir /etc/sysconfig $cd /opt/etherlab $cp etc/sysconfig/ethercat /etc/sysconfig/ $ln -s etc/init.d/ethercat /etc/init.d/

Then i change the MASTER0_DEVICE variable to the mac address of the port i want to use and DEVICE_MODULES variable to "ccat" in /etc/sysconfig/ethercat

And finally i try to start it with /etc/init.d/ethercat start but i just get the error

Starting EtherCAT master 1.5.2 modinfo: ERROR: Module ec_ccat not found.
 done

And the modules do not show up when i run $lsmod | grep ccat

I uninstalled it to try another way with https://github.com/icshwi/etherlabmaster

$echo "ETHERCAT_MASTER0=enp3s0" > ethercatmaster.local
$make init
$echo "WITH_DEV_GENERIC = NO"  > configure/CONFIG_OPTIONS.local
$echo "WITH_DEV_CCAT = YES" >> configure/CONFIG_OPTIONS.local
$make ccat_patch
$make build
$make install
$make dkms_add
$make dkms_build
$make dkms_install
$make setup

Everything installs fine with and i end up with the modules installed

$lsmod | grep ccat
ec_ccat_netdev         20480  0
ec_master             258048  1 ec_ccat_netdev
ccat_update            16384  0
ccat_systemtime        16384  0
ccat_sram              16384  0
ccat_gpio              16384  0
ccat                   16384  2 ccat_sram,ccat_update

I can't seem to get the ethercat to work after this and dmesg gives me this

[ 21.195204] ccat: loading out-of-tree module taints kernel.

[ 1547.697135] PKCS#7 signature not signed with a trusted key
[ 1547.729268] EtherCAT: Master driver 1.5.2 unknown
[ 1547.740860] EtherCAT: 1 master waiting for devices.
[ 1547.876607] PKCS#7 signature not signed with a trusted key

Am i missing something? or am i doing something wrong?

Regards Gustav

pbruenn commented 4 years ago

Did you blacklisted or unloaded the driver "ec_bhf" from mainline Linux? See https://github.com/Beckhoff/CCAT/issues/3#issuecomment-266788708 for details.

Gunob17 commented 4 years ago

okay that fixed the not trusted key issue

[  953.200321] ccat: loading out-of-tree module taints kernel.
[ 2485.537826] EtherCAT: Master driver 1.5.2 fff0749b52f5+
[ 2485.539210] EtherCAT: 2 masters waiting for devices.

but i still get the

$sudo /etc/init.d/ethercat start
Starting EtherCAT master 1.5.2 modinfo: ERROR: Module ec_ccat not found.
 done

and the modules still isn't loaded when i use the primary etherlab source

lsmod | grep ccat
ccat_update            16384  0
ccat_systemtime        16384  0
ccat_sram              16384  0
ccat_gpio              16384  0
ccat_netdev            16384  0
ccat                   16384  2 ccat_sram,ccat_update
HWilke commented 4 years ago

Do you have at least one EL Terminal connected to the device? Because there is an internal EBus/KBus switch which first detects the correct bus system.

pbruenn commented 4 years ago

That looks strange. In your first report ec_ccat_netdev was loaded as expected but this time he complains about ec_ccat. That driver was renamed to ec_ccat_netdev, since we converted the CCAT driver into a MFD (Multi Function Device). Maybe you mixed up both versions?

Gunob17 commented 4 years ago

yeah that was it i had them mixed up, in the DEVICE_MODULES variable where i had "ccat" it had to be "ccat_netdev" thanks alot. but now i have a problem i have run into a couple of other times, i just thought that the https://github.com/icshwi/etherlabmaster had a problem, but it might be something else, when i try to run the ethercat master command i get the below

Master0
  Phase: Waiting for device(s)...
  Active: no
  Slaves: 0
  Ethernet devices:
    Main: 00:01:05:32:43:b8 (waiting...)
      Link: DOWN
      Tx frames:   0
      Tx bytes:    0
      Rx frames:   0
      Rx bytes:    0
      Tx errors:   0
      Tx frame rate [1/s]:      0      0      0
      Tx rate [KByte/s]:      0.0    0.0    0.0
      Rx frame rate [1/s]:      0      0      0
      Rx rate [KByte/s]:      0.0    0.0    0.0
    Common:
      Tx frames:   0
      Tx bytes:    0
      Rx frames:   0
      Rx bytes:    0
      Lost frames: 0
      Tx frame rate [1/s]:      0      0      0
      Tx rate [KByte/s]:      0.0    0.0    0.0
      Rx frame rate [1/s]:      0      0      0
      Rx rate [KByte/s]:      0.0    0.0    0.0
      Loss rate [1/s]:          0      0      0
      Frame loss [%]:         0.0    0.0    0.0
  Distributed clocks:
    Reference clock:   None
    DC reference time: 0
    Application time:  0
                       2000-01-01 00:00:00.000000000
Master1
  Phase: Waiting for device(s)...
  Active: no
  Slaves: 0
  Ethernet devices:
    Main: 00:01:05:33:d0:40 (waiting...)
      Link: DOWN
      Tx frames:   0
      Tx bytes:    0
      Rx frames:   0
      Rx bytes:    0
      Tx errors:   0
      Tx frame rate [1/s]:      0      0      0
      Tx rate [KByte/s]:      0.0    0.0    0.0
      Rx frame rate [1/s]:      0      0      0
      Rx rate [KByte/s]:      0.0    0.0    0.0
    Common:
      Tx frames:   0
      Tx bytes:    0
      Rx frames:   0
      Rx bytes:    0
      Lost frames: 0
      Tx frame rate [1/s]:      0      0      0
      Tx rate [KByte/s]:      0.0    0.0    0.0
      Rx frame rate [1/s]:      0      0      0
      Rx rate [KByte/s]:      0.0    0.0    0.0
      Loss rate [1/s]:          0      0      0
      Frame loss [%]:         0.0    0.0    0.0
  Distributed clocks:
    Reference clock:   None
    DC reference time: 0
    Application time:  0
                       2000-01-01 00:00:00.000000000

when i then try to scan for slave devices i can't find either the io busses i have on the plc or the infinion ethercat slave i have connected to the ethernet port i have linked with etherlab.

pbruenn commented 4 years ago

Now, we reached unknown territory. I am not an EtherLab expert. My knowledge of EtherLab is limited to this ccat driver and a simple example program which I compiled some years ago. To be honest I didn't touch EtherLab for quite some time. But the EtherLab community has some pretty smart and helpful people on their mailing list: http://lists.etherlab.org/mailman/listinfo/etherlab-users

Gunob17 commented 4 years ago

Okay thanks. If I find a solution I will add it here for any one else with the same problem.

Gunob17 commented 4 years ago

Update: Had to downgrade ubuntu to 14.04 and the rt linux kernel to 4.9.219-rt142 and now it works