Ethercat HAL driver

More
11 Nov 2017 09:40 - 11 Nov 2017 09:43 #101649 by sirop
Replied by sirop on topic Ethercat HAL driver
Means rpath incomplete.

Try
$(CC) -shared -o $@ $(lcec-objs) -Wl,-rpath,$(LIBDIR),-rpath,/opt/etherlab/lib/ -L$(LIBDIR) -L/opt/etherlab/lib/ -llinuxcnchal -lethercat -lrt
Last edit: 11 Nov 2017 09:43 by sirop. Reason: typo
The following user(s) said Thank You: chimeno

Please Log in or Create an account to join the conversation.

More
11 Nov 2017 10:11 #101650 by chimeno
Replied by chimeno on topic Ethercat HAL driver
hi Sirop,
if this works, now I have a new error "open / dev / EtherCAT0: Permission denied"

lack of permission? I give permission so?

echo KERNEL == \ "EtherCAT [0-9] * \", MODE = \ "0664 \"> /etc/udev/rules.d/99-EtherCAT.rules

after this it does not work either.

how can I solve that?

Thank you
Attachments:

Please Log in or Create an account to join the conversation.

More
11 Nov 2017 11:42 #101652 by sirop
The following user(s) said Thank You: chimeno

Please Log in or Create an account to join the conversation.

More
14 Nov 2017 19:08 - 14 Nov 2017 19:11 #101797 by chimeno
Replied by chimeno on topic Ethercat HAL driver

File Attachment:

File Name: 99-EtherCAT.rules.c
File Size:0 KB
Hello sirop

I have been comparing and searching but I can not give linuxcnc permissions to EtherCAT0, this is what I have done.

sudo -i
echo KERNEL == "EtherCAT [0-9] *", MODE = "0664", GROUP = "ethercat"

directory /etc/udev/rules.d/ ...ok

What am I doing?
Attachments:
Last edit: 14 Nov 2017 19:11 by chimeno.

Please Log in or Create an account to join the conversation.

More
14 Nov 2017 20:06 - 14 Nov 2017 20:06 #101799 by sirop
Replied by sirop on topic Ethercat HAL driver
So what is the contents of 99-ethercat.rules now?
Last edit: 14 Nov 2017 20:06 by sirop. Reason: typo
The following user(s) said Thank You: chimeno

Please Log in or Create an account to join the conversation.

More
15 Nov 2017 04:50 #101815 by chimeno
Replied by chimeno on topic Ethercat HAL driver
Hi Sirop,
The content of the 99-ethercat.rules file is :

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

thanks

Please Log in or Create an account to join the conversation.

More
15 Nov 2017 09:57 #101827 by sirop
Replied by sirop on topic Ethercat HAL driver

Hi Sirop,
The content of the 99-ethercat.rules file is :

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

thanks


That should work if you installed github.com/sittner/ec-debianize.

Otherwise:
KERNEL ==" EtherCAT [0 -9]*" , MODE ="0664" , GROUP ="users"
The following user(s) said Thank You: chimeno

Please Log in or Create an account to join the conversation.

More
17 Nov 2017 12:29 #101926 by chimeno
Replied by chimeno on topic Ethercat HAL driver
hi Sirop,
thank you very much, now if it works well, I will start to try. I tried to install github.com/sittner/ec-debianize but I lacked dependencies, so get it installed manually.

Please Log in or Create an account to join the conversation.

More
21 Nov 2017 11:33 #102129 by narogon
Replied by narogon on topic Ethercat HAL driver
I am suffering some problems with random desynchronization. A few times a day it loses the synchonization and I don't know where the problem could be.

Here is the dmesg log of the start of the program:
Nov 21 10:40:09 computer kernel: [ 4188.814196] I-pipe: head domain RTAI registered.
Nov 21 10:40:09 computer kernel: [ 4188.814199] RTAI[hal]: compiled with gcc version 4.7.2 (Debian 4.7.2-5) .
Nov 21 10:40:09 computer kernel: [ 4188.814241] RTAI[hal]: mounted (IPIPE-NOTHREADS, IMMEDIATE (INTERNAL IRQs DISPATCHED), ISOL_CPUS_MASK: 0).
Nov 21 10:40:09 computer kernel: [ 4188.814242] SYSINFO: CPUs 4, LINUX APIC IRQ 2312, TIM_FREQ 6235080, CLK_FREQ 3691742000, CPU_FREQ 3691742000
Nov 21 10:40:09 computer kernel: [ 4188.814244] RTAI_APIC_TIMER_IPI: RTAI DEFINED 2314, VECTOR 2314; LINUX_APIC_TIMER_IPI: RTAI DEFINED 2312, VECTOR 2312
Nov 21 10:40:09 computer kernel: [ 4188.814245] TIMER NAME: lapic; VARIOUSLY FOUND APIC FREQs: 6235080, 6235080, 6229000
Nov 21 10:40:09 computer kernel: [ 4188.828603] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
Nov 21 10:40:09 computer kernel: [ 4188.828623] , <uses LINUX SYSCALLs>, kstacks pool size = 524288 bytes.
Nov 21 10:40:09 computer kernel: [ 4188.828626] RTAI[sched]: hard timer type/freq = APIC/6235080(Hz); default timing: oneshot; linear timed lists.
Nov 21 10:40:09 computer kernel: [ 4188.828628] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 3691742000 hz.
Nov 21 10:40:09 computer kernel: [ 4188.828629] RTAI[sched]: timer setup = 999 ns, resched latency = 2944 ns.
Nov 21 10:40:09 computer kernel: [ 4188.836122] RTAI[math]: loaded.
Nov 21 10:40:09 computer kernel: [ 4188.865007] EtherCAT: Requesting master 0...
Nov 21 10:40:09 computer kernel: [ 4188.865011] EtherCAT: Successfully requested master 0.
Nov 21 10:40:09 computer kernel: [ 4188.871652] EtherCAT 0: Domain0: Logical address 0x00000000, 500 byte, expected working counter 75.
Nov 21 10:40:09 computer kernel: [ 4188.871654] EtherCAT 0:   Datagram domain0-0-main: Logical offset 0x00000000, 500 byte, type LRW.
Nov 21 10:40:09 computer kernel: [ 4188.871663] EtherCAT 0: Master thread exited.
Nov 21 10:40:09 computer kernel: [ 4188.871666] EtherCAT 0: Starting EtherCAT-OP thread.
Nov 21 10:40:14 computer kernel: [ 4194.303501] EtherCAT WARNING 0-0: Slave did not sync after 5000 ms.
Nov 21 10:40:14 computer kernel: [ 4194.309495] EtherCAT 0: Domain 0: Working counter changed to 2/75.
Nov 21 10:40:15 computer kernel: [ 4195.308811] EtherCAT 0: Domain 0: Working counter changed to 3/75.
Nov 21 10:40:18 computer kernel: [ 4197.538050] EtherCAT 0: Domain 0: Working counter changed to 5/75.
Nov 21 10:40:19 computer kernel: [ 4198.537365] EtherCAT 0: Domain 0: Working counter changed to 6/75.
Nov 21 10:40:20 computer kernel: [ 4200.145656] EtherCAT 0: Domain 0: Working counter changed to 8/75.
Nov 21 10:40:21 computer kernel: [ 4201.147966] EtherCAT 0: Domain 0: 16 working counter changes - now 32/75.
Nov 21 10:40:22 computer kernel: [ 4202.151274] EtherCAT 0: Domain 0: 18 working counter changes - now 59/75.
Nov 21 10:40:23 computer kernel: [ 4202.602525] EtherCAT 0: Slave states on main device: OP.
Nov 21 10:40:23 computer kernel: [ 4203.153601] EtherCAT 0: Domain 0: 11 working counter changes - now 75/75.


And suddenly about one hour later:
Nov 21 11:40:01 computer kernel: [ 7775.906288] EtherCAT 0: Domain 0: Working counter changed to 27/75.
Nov 21 11:40:01 computer kernel: [ 7775.912275] EtherCAT 0: 9 slave(s) responding on main device.
Nov 21 11:40:01 computer kernel: [ 7775.915249] EtherCAT 0: Scanning bus.
Nov 21 11:40:03 computer kernel: [ 7777.519550] EtherCAT 0: Domain 0: Working counter changed to 0/75.
Nov 21 11:40:03 computer kernel: [ 7777.717212] EtherCAT WARNING 0: 1 datagram TIMED OUT!
Nov 21 11:40:03 computer kernel: [ 7778.164464] EtherCAT WARNING: Datagram f285d5cc (domain0-0-main) was SKIPPED 1 time.
Nov 21 11:40:04 computer kernel: [ 7778.519864] EtherCAT 0: Domain 0: Working counter changed to 43/75.
Nov 21 11:40:04 computer kernel: [ 7778.793398] EtherCAT 0: Bus scanning completed in 2884 ms.
Nov 21 11:40:04 computer kernel: [ 7778.793401] EtherCAT 0: Using slave 0 as DC reference clock.
Nov 21 11:40:04 computer kernel: [ 7778.793403] EtherCAT ERROR 0: Failed to calculate bus topology.
Nov 21 11:40:04 computer kernel: [ 7778.815377] EtherCAT 0: 25 slave(s) responding on main device.
Nov 21 11:40:04 computer kernel: [ 7778.815378] EtherCAT 0: Slave states on main device: SAFEOP, OP + ERROR.
Nov 21 11:40:04 computer kernel: [ 7778.818354] EtherCAT 0: Scanning bus.
Nov 21 11:40:07 computer kernel: [ 7781.687518] EtherCAT WARNING 0-9: Slave has state error bit set (SAFEOP + ERROR)!
Nov 21 11:40:07 computer kernel: [ 7782.009975] EtherCAT WARNING 0-10: Slave has state error bit set (SAFEOP + ERROR)!
Nov 21 11:40:08 computer kernel: [ 7782.330434] EtherCAT WARNING 0-11: Slave has state error bit set (SAFEOP + ERROR)!
Nov 21 11:40:08 computer kernel: [ 7782.637916] EtherCAT WARNING 0-12: Slave has state error bit set (SAFEOP + ERROR)!
Nov 21 11:40:08 computer kernel: [ 7782.958375] EtherCAT WARNING 0-13: Slave has state error bit set (SAFEOP + ERROR)!
Nov 21 11:40:09 computer kernel: [ 7783.278835] EtherCAT WARNING 0-14: Slave has state error bit set (SAFEOP + ERROR)!
Nov 21 11:40:09 computer kernel: [ 7783.587316] EtherCAT WARNING 0-15: Slave has state error bit set (SAFEOP + ERROR)!
Nov 21 11:40:09 computer kernel: [ 7783.906776] EtherCAT WARNING 0-16: Slave has state error bit set (SAFEOP + ERROR)!
Nov 21 11:40:09 computer kernel: [ 7784.217253] EtherCAT WARNING 0-17: Slave has state error bit set (SAFEOP + ERROR)!
Nov 21 11:40:10 computer kernel: [ 7784.525732] EtherCAT WARNING 0-18: Slave has state error bit set (SAFEOP + ERROR)!
Nov 21 11:40:10 computer kernel: [ 7784.838206] EtherCAT WARNING 0-19: Slave has state error bit set (SAFEOP + ERROR)!
Nov 21 11:40:10 computer kernel: [ 7785.147683] EtherCAT WARNING 0-20: Slave has state error bit set (SAFEOP + ERROR)!
Nov 21 11:40:11 computer kernel: [ 7785.468144] EtherCAT WARNING 0-21: Slave has state error bit set (SAFEOP + ERROR)!
Nov 21 11:40:11 computer kernel: [ 7785.776623] EtherCAT WARNING 0-22: Slave has state error bit set (SAFEOP + ERROR)!
Nov 21 11:40:11 computer kernel: [ 7786.087100] EtherCAT WARNING 0-23: Slave has state error bit set (SAFEOP + ERROR)!
Nov 21 11:40:12 computer kernel: [ 7786.407559] EtherCAT WARNING 0-24: Slave has state error bit set (SAFEOP + ERROR)!
Nov 21 11:40:12 computer kernel: [ 7786.714043] EtherCAT 0: Bus scanning completed in 7908 ms.
Nov 21 11:40:12 computer kernel: [ 7786.714046] EtherCAT 0: Using slave 0 as DC reference clock.
Nov 21 11:40:12 computer kernel: [ 7786.808882] EtherCAT ERROR 0-9: AL status message 0x001B: "Sync manager watchdog".
Nov 21 11:40:12 computer kernel: [ 7786.811877] EtherCAT 0-9: Acknowledged state SAFEOP.
Nov 21 11:40:12 computer kernel: [ 7786.811883] EtherCAT 0: Domain 0: Working counter changed to 45/75.
Nov 21 11:40:13 computer kernel: [ 7787.815191] EtherCAT 0: Domain 0: Working counter changed to 42/75.
Nov 21 11:40:17 computer kernel: [ 7791.909283] EtherCAT WARNING 0-9: Slave did not sync after 5000 ms.
Nov 21 11:40:17 computer kernel: [ 7791.914281] EtherCAT 0: Domain 0: Working counter changed to 44/75.
Nov 21 11:40:17 computer kernel: [ 7791.919265] EtherCAT ERROR 0-10: AL status message 0x001B: "Sync manager watchdog".
Nov 21 11:40:17 computer kernel: [ 7791.922260] EtherCAT 0-10: Acknowledged state SAFEOP.
Nov 21 11:40:17 computer kernel: [ 7792.034071] EtherCAT ERROR 0-11: AL status message 0x001B: "Sync manager watchdog".
Nov 21 11:40:17 computer kernel: [ 7792.036067] EtherCAT 0-11: Acknowledged state SAFEOP.
Nov 21 11:40:18 computer kernel: [ 7792.916591] EtherCAT 0: Domain 0: 7 working counter changes - now 46/75.
Nov 21 11:40:21 computer kernel: [ 7795.391418] EtherCAT 0: Domain 0: Working counter changed to 48/75.
Nov 21 11:40:21 computer kernel: [ 7795.397407] EtherCAT ERROR 0-12: AL status message 0x001B: "Sync manager watchdog".
Nov 21 11:40:21 computer kernel: [ 7795.401410] EtherCAT 0-12: Acknowledged state SAFEOP.
Nov 21 11:40:21 computer kernel: [ 7795.618032] EtherCAT ERROR 0-13: AL status message 0x001B: "Sync manager watchdog".
Nov 21 11:40:21 computer kernel: [ 7795.622024] EtherCAT 0-13: Acknowledged state SAFEOP.
Nov 21 11:40:22 computer kernel: [ 7796.391729] EtherCAT 0: Domain 0: 7 working counter changes - now 50/75.
Nov 21 11:40:26 computer kernel: [ 7800.809280] EtherCAT WARNING 0-13: Slave did not sync after 5000 ms.
Nov 21 11:40:26 computer kernel: [ 7800.816267] EtherCAT 0: Domain 0: Working counter changed to 52/75.
Nov 21 11:40:26 computer kernel: [ 7800.826249] EtherCAT ERROR 0-14: AL status message 0x001B: "Sync manager watchdog".
Nov 21 11:40:26 computer kernel: [ 7800.830243] EtherCAT 0-14: Acknowledged state SAFEOP.
Nov 21 11:40:26 computer kernel: [ 7800.965014] EtherCAT ERROR 0-15: AL status message 0x001B: "Sync manager watchdog".
Nov 21 11:40:26 computer kernel: [ 7800.968011] EtherCAT 0-15: Acknowledged state SAFEOP.
Nov 21 11:40:27 computer kernel: [ 7801.818581] EtherCAT 0: Domain 0: 7 working counter changes - now 54/75.
Nov 21 11:40:31 computer kernel: [ 7806.061420] EtherCAT WARNING 0-15: Slave did not sync after 5000 ms.
Nov 21 11:40:31 computer kernel: [ 7806.066417] EtherCAT 0: Domain 0: Working counter changed to 56/75.
Nov 21 11:40:31 computer kernel: [ 7806.073399] EtherCAT ERROR 0-16: AL status message 0x001B: "Sync manager watchdog".
Nov 21 11:40:31 computer kernel: [ 7806.075395] EtherCAT 0-16: Acknowledged state SAFEOP.
Nov 21 11:40:31 computer kernel: [ 7806.185210] EtherCAT ERROR 0-17: AL status message 0x001B: "Sync manager watchdog".
Nov 21 11:40:31 computer kernel: [ 7806.187206] EtherCAT 0-17: Acknowledged state SAFEOP.
Nov 21 11:40:32 computer kernel: [ 7807.066731] EtherCAT 0: Domain 0: 7 working counter changes - now 58/75.
Nov 21 11:40:37 computer kernel: [ 7811.282616] EtherCAT WARNING 0-17: Slave did not sync after 5000 ms.
Nov 21 11:40:37 computer kernel: [ 7811.287613] EtherCAT 0: Domain 0: Working counter changed to 60/75.
Nov 21 11:40:37 computer kernel: [ 7811.294595] EtherCAT ERROR 0-18: AL status message 0x001B: "Sync manager watchdog".
Nov 21 11:40:37 computer kernel: [ 7811.296591] EtherCAT 0-18: Acknowledged state SAFEOP.
Nov 21 11:40:37 computer kernel: [ 7811.410399] EtherCAT ERROR 0-19: AL status message 0x001B: "Sync manager watchdog".
Nov 21 11:40:37 computer kernel: [ 7811.412395] EtherCAT 0-19: Acknowledged state SAFEOP.
Nov 21 11:40:38 computer kernel: [ 7812.287928] EtherCAT 0: Domain 0: 7 working counter changes - now 62/75.
Nov 21 11:40:38 computer kernel: [ 7813.079587] EtherCAT ERROR 0-20: AL status message 0x001B: "Sync manager watchdog".
Nov 21 11:40:38 computer kernel: [ 7813.082583] EtherCAT 0-20: Acknowledged state SAFEOP.
Nov 21 11:40:38 computer kernel: [ 7813.195389] EtherCAT ERROR 0-21: AL status message 0x001B: "Sync manager watchdog".
Nov 21 11:40:38 computer kernel: [ 7813.197385] EtherCAT 0-21: Acknowledged state SAFEOP.
Nov 21 11:40:39 computer kernel: [ 7813.290238] EtherCAT 0: Domain 0: 8 working counter changes - now 66/75.
Nov 21 11:40:39 computer kernel: [ 7813.307201] EtherCAT ERROR 0-22: AL status message 0x001B: "Sync manager watchdog".
Nov 21 11:40:39 computer kernel: [ 7813.309197] EtherCAT 0-22: Acknowledged state SAFEOP.
Nov 21 11:40:39 computer kernel: [ 7813.419012] EtherCAT ERROR 0-23: AL status message 0x001B: "Sync manager watchdog".
Nov 21 11:40:39 computer kernel: [ 7813.421008] EtherCAT 0-23: Acknowledged state SAFEOP.
Nov 21 11:40:39 computer kernel: [ 7813.534818] EtherCAT ERROR 0-24: AL status message 0x001B: "Sync manager watchdog".
Nov 21 11:40:39 computer kernel: [ 7813.537815] EtherCAT 0-24: Acknowledged state SAFEOP.
Nov 21 11:40:39 computer kernel: [ 7813.649641] EtherCAT 0: Slave states on main device: OP.
Nov 21 11:40:40 computer kernel: [ 7814.292561] EtherCAT 0: Domain 0: 14 working counter changes - now 75/75.

It gets reconnect automatically but it doesn't work for me because I would need to make homing again.

Some parameters:

appTimePeriod="1000000"
refClockSyncCycles="100"
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>

Any idea why is this happening ?

Please Log in or Create an account to join the conversation.

More
21 Nov 2017 13:26 - 21 Nov 2017 13:27 #102130 by sirop
Replied by sirop on topic Ethercat HAL driver


appTimePeriod="1000000"
refClockSyncCycles="100"
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>

Any idea why is this happening ?


You could "play" with sync0Shift if you know what you are doing,
but to my mind an even worse sourse of jitter is concealed in github.com/sittner/linuxcnc-ethercat/blo...c_main.c#L1119-L1132
  master->app_time += master->app_time_period;
  ecrt_master_application_time(master->master, master->app_time);

  // sync ref clock to master
  if (master->sync_ref_cycles > 0) {
    if (master->sync_ref_cnt == 0) {
      master->sync_ref_cnt = master->sync_ref_cycles;
      ecrt_master_sync_reference_clock(master->master);
    }
    master->sync_ref_cnt--;
  }

  // sync slaves to ref clock
  ecrt_master_sync_slave_clocks(master->master);

As you see
master->app_time += master->app_time_period;
each time the Ethercat HAl thread is called. So if your HAL thread has latency/jitter, then this latency/jitter is inherited to EtherCAT process.

To say more: this snippet above shows how to sync slaves' clocks to the master clock. It would be better to do the opposite: to sync the master clock to a DC of a slave as the slave has a hardware ( more precise) clock. There must be a solution for this somewhere on the etherlab list.
Last edit: 21 Nov 2017 13:27 by sirop. Reason: typo
The following user(s) said Thank You: Nico2017

Please Log in or Create an account to join the conversation.

Time to create page: 0.261 seconds
Powered by Kunena Forum