dbraun1981 / hal-cia402

linuxcnc hal interface for CiA402 Drives
GNU General Public License v2.0
29 stars 15 forks source link

Omron G5 bus errors when combined with hal-cia402 #1

Closed Bouni closed 1 year ago

Bouni commented 3 years ago

Hi,

First of all, thank you so much for this component!

I have started seting up linuxcnc + ethercat after watching the video of MetalMusings: https://www.youtube.com/watch?v=NQ-HnrusGJo He describes using your HAL component to get EtherCat servos working that support the cia402 profile and are not yet officially in the linuxcnc-ethercat implementation.

I run linuxcnc + ethercat on a RPi 4 as the EtherCat master, my bus consists of these components:

If I connect just the G5 servo it works absolutely fine with this config, if I do the same with just the Sanyo Denki RS2 (with your cia402 component) it works also without problems with this config.

But If I merge the two configs so that I have both, the G5 and the RS2 servo connected, the G5 starts to randomly click its internal relay, showing a b2 error (bus communication error) but not all the time, and if I move it, it stps rotating every time the relay clicks. The config is here.

Is your component incompatible with the integrated G5 implementation or am I doing something wrong here?

dbraun1981 commented 3 years ago

Hello Bouni,

your issue can't be related by this component. This component works on an layer above the ethercat driver an has no influence to the ethercat part. If i look at your ethercat config, it all looks good to me. But keep in mind that the Pis onboard NICs are not the best choice for ethercat/realtime use... You can try to sync the master to the first slave with using "refclocksynccycles = -1" in the ethercat_conf.xml. But I think this is an hardware hf dispersion/ grounding problem: the enabled sanyo drive influences the G5 drive. Check the behaviour whitout enabling the sanyo drive.

You can get help with reading the dmesg printout, there must be ethercat messages at the times the G5 get his com errors. Set the ethercat debug level to 1. "ethercat debug 1" .

Bouni commented 3 years ago

Hi,

But keep in mind that the Pis onboard NICs are not the best choice for ethercat/realtime use...

I just used it because I saw it in the video and had a pi laying around. Long term I will go for a Fujitsu Board/Kontron Board which I've laying around. They have Intel NICs onboard which should work I guess.

You can try to sync the master to the first slave with using "refclocksynccycles = -1" in the ethercat_conf.xml.

This gives me this error: image

But I think this is an hardware hf dispersion/ grounding problem: the enabled sanyo drive influences the G5 drive. Check the behaviour whitout enabling the sanyo drive.

I did that by commenting out ethercat.hal:29 and ethercat.hal:35

And with this I'm able to run the G5! It clicked one or two times but continues to work. I Have the servos sitting onmy desk, so no proper grounding except for PE wires etc. maybe that's an issue!?

With ethercat debug 1 I get this in the logs after starting linuxcnc up:

... A ton of Sync after XXX ms messages ...
[  174.105786] EtherCAT DEBUG 0-4: Sync after 2460 ms:      10060 ns
[  174.106801] EtherCAT DEBUG 0-4: 9974 ns difference after 2460 ms.
[  174.106811] EtherCAT DEBUG 0-4:    ref_time=679569402308085000
[  174.106817] EtherCAT DEBUG 0-4:    app_time=679569405403149254
[  174.106824] EtherCAT DEBUG 0-4:  start_time=679569405503149254
[  174.106829] EtherCAT DEBUG 0-4:       cycle=1000000
[  174.106835] EtherCAT DEBUG 0-4:  shift_time=0
[  174.106842] EtherCAT DEBUG 0-4:   remainder=64254
[  174.106848] EtherCAT DEBUG 0-4:        start=679569405504085000
[  174.106855] EtherCAT DEBUG 0-4: Setting DC cyclic operation start time to 679569405504085000.
[  174.108784] EtherCAT DEBUG 0-4: Setting DC AssignActivate to 0x0300.
[  174.112793] EtherCAT DEBUG 0-4: Now in SAFEOP.
[  174.112795] EtherCAT 0: Domain 0: Working counter changed to 8/9
[  174.112802] .
[  174.236808] EtherCAT DEBUG 0-4: Now in OP. Finished configuration.
[  174.252550] EtherCAT 0: Slave states on main device: OP.
[  175.122908] EtherCAT 0: Domain 0: Working counter changed to 9/9
... a couple of Domain 0: Working counter changed to messages from here on ...

When I enable the drives, nothing changes despite ongoing "Working counter changed messages":

[ 1211.995358] EtherCAT 0: Domain 0: 3 working counter changes - now 9/9
[ 1211.995367] .
[ 1213.005371] EtherCAT 0: Domain 0: 4 working counter changes - now 9/9
[ 1213.005379] .
[ 1214.015393] EtherCAT 0: Domain 0: 10 working counter changes - now 9/9
[ 1214.015401] .
[ 1215.025413] EtherCAT 0: Domain 0: 8 working counter changes - now 9/9
[ 1215.025421] .
[ 1216.035436] EtherCAT 0: Domain 0: 2 working counter changes - now 9/9
[ 1216.035444] .
[ 1217.045460] EtherCAT 0: Domain 0: 4 working counter changes - now 9/9
[ 1217.045467] .
[ 1218.055482] EtherCAT 0: Domain 0: 2 working counter changes - now 9/9
[ 1218.055492] .
[ 1219.065510] EtherCAT 0: Domain 0: 4 working counter changes - now 9/9
[ 1219.065518] .
[ 1220.075525] EtherCAT 0: Domain 0: 6 working counter changes - now 9/9
[ 1220.075537] .
[ 1221.085559] EtherCAT 0: Domain 0: 10 working counter changes - now 9/9
[ 1221.085567] .
[ 1222.095566] EtherCAT 0: Domain 0: 16 working counter changes - now 9/9
dbraun1981 commented 3 years ago

Hi,

which LCNC Version is this? Run in place or installed ? You need to apply the add_task_pll_support patch. the dmesg log is with "refclocksynccycles = -1"? Without the patch, lcec is not able to sync the task pll to the first slave..

Try to get "mechanical Space" between Computer / Coupler and the drives. There have been a few of the same errors in the forum a while ago....

Bouni commented 3 years ago

Hi,

I run LCNC 2.8.2, installed as per the instructions I found on the LCNC forum and wrote them up in my gist

I guess that thi simage was built without applying the add_task_pll_support patch.

the dmesg log is with "refclocksynccycles = -1"? Without the patch, lcec is not able to sync the task pll to the first slave..

No, with refClockSyncCycles="1", otherwise I'm not able to start LCNC. What slave is LCNC syncing to if I set -1!?

Try to get "mechanical Space" between Computer / Coupler and the drives. There have been a few of the same errors in the forum a while ago....

I'll give it a try, but to do that I'll need to rebuild my setup first, that will take while....

Do you think I should go streight for a "real" PC and dump the RPi4 in order to get this to work properly?

dbraun1981 commented 3 years ago

What slave is LCNC syncing to if I set -1!?

It syncs to the first slave.

Do you think I should go streight for a "real" PC and dump the RPi4 in order to get this to work properly?

I would give it a try. I am not familar with the hardware design of the PI4 yet, but on the PI3 ethercat behaviour was terrible, so SIttner(lcec) designed an extern network card with stable clock and controlling by SPI.

Bouni commented 3 years ago

I think the Pi4 has native Gbit Ethernet where the Pi3 had Ethernet via USB interface. So that should be musch better, but I don't know if better means good enough 😉

I will go for the normal PC and see if it makes a huge difference.