Ethercat drive configuration woes

More
01 Dec 2022 21:08 #258260 by mwc
So I've put the H3 to the side for now, and have managed to get LinuxCNC installed on a Pi4 as per Hakan's and psuedo's posts.

I've created a new machine profile, and have LinuxCNC loading, and the drives going to OP state, but I have so far failed to get any movement.
The first obvious issue is when I click Machine On, it takes over 50seconds for the Jog/Home buttons to become active.
If I try jogging, I get a following error, and it takes the same 50second plus for the Jog/Home buttons to deactivate.

There are no standout issues in any of the outputs mentioned in pseudo's thread.

Terminal output from linuxcnc -v -
pi@linuxcnc:~ $ linuxcnc -v
Verbose mode on
RUN_IN_PLACE=no
LINUXCNC_DIR=
LINUXCNC_BIN_DIR=/usr/bin
LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
LINUXCNC_SCRIPT_DIR=
LINUXCNC_RTLIB_DIR=/usr/lib/linuxcnc/modules
LINUXCNC_CONFIG_DIR=
LINUXCNC_LANG_DIR=/usr/lib/tcltk/linuxcnc/msgs
INIVAR=inivar
HALCMD=halcmd
LINUXCNC_EMCSH=/usr/bin/wish8.6
LINUXCNC - 2.8.4
Machine configuration directory is '/home/pi/linuxcnc/configs/my_EtherCAT'
Machine configuration file is 'my_EtherCAT.ini'
INIFILE=/home/pi/linuxcnc/configs/my_EtherCAT/my_EtherCAT.ini
VERSION=1.1
PARAMETER_FILE=linuxcnc.var
TASK=milltask
HALUI=halui
DISPLAY=axis
COORDINATES=XYZ
KINEMATICS=trivkins coordinates=XYZ
Starting LinuxCNC...
Starting LinuxCNC server program: linuxcncsvr
Loading Real Time OS, RTAPI, and HAL_LIB modules
Starting LinuxCNC IO program: io
Starting HAL User Interface program: halui
Found file(REL): ./my_EtherCAT.hal
Note: Using POSIX realtime
Found file(REL): ./custom.hal
Starting TASK program: milltask
Starting DISPLAY program: axis
note: MAXV     max: 25.000 units/sec 1500.000 units/min
note: LJOG     max: 25.000 units/sec 1500.000 units/min
note: LJOG default: 6.000 units/sec 360.000 units/min
note: jog_order='XYZ'
note: jog_invert=set()
joint 2 following error
emc/task/taskintf.cc 942: Error on joint 2, command number 85
Running HAL shutdown script
task: 32360 cycles, min=0.000164, max=0.031864, avg=0.010082, 0 latency excursions (> 10x expected cycle time of 0.010000s)
Removing HAL_LIB, RTAPI, and Real Time OS modules
Note: Using POSIX realtime
Removing NML shared memory segments
pi@linuxcnc:~ $


ethercat slaves before starting LinuxCNC-
pi@linuxcnc:~ $ ethercat slaves
0  0:0  PREOP  +  CL3-E57H
1  0:1  PREOP  +  CL3-E57H
2  0:2  PREOP  +  CL3-E57H
pi@linuxcnc:~ $ ethercat slaves -v
=== Master 0, Slave 0 ===
Device: Main
State: PREOP
Flag: +
Identity:
  Vendor Id:       0x00000a79
  Product code:    0x00001000
  Revision number: 0x00000001
  Serial number:   0x00000000
DL information:
  FMMU bit operation: no
  Distributed clocks: yes, 64 bit
  DC system time transmission delay: 0 ns
Port  Type  Link  Loop    Signal  NextSlave  RxTime [ns]  Diff [ns]   NextDc [ns]
   0  MII   up    open    yes             -   3940305729           0           0
   1  MII   up    open    yes             1   3940308529        2800         680
   2  N/A   down  closed  no              -            -           -           -
   3  N/A   down  closed  no              -            -           -           -
Mailboxes:
  Bootstrap RX: 0x0000/0, TX: 0x0000/0
  Standard  RX: 0x1000/128, TX: 0x1100/128
  Supported protocols: CoE
General:
  Group: EtherCAT Driver
  Image name: 
  Order number: 
  Device name: CL3-E57H
  CoE details:
    Enable SDO: yes
    Enable SDO Info: no
    Enable PDO Assign: yes
    Enable PDO Configuration: yes
    Enable Upload at startup: no
    Enable SDO complete access: no
  Flags:
    Enable SafeOp: no
    Enable notLRW: no
  Current consumption: 0 mA
=== Master 0, Slave 1 ===
Device: Main
State: PREOP
Flag: +
Identity:
  Vendor Id:       0x00000a79
  Product code:    0x00001000
  Revision number: 0x00000001
  Serial number:   0x00000000
DL information:
  FMMU bit operation: no
  Distributed clocks: yes, 64 bit
  DC system time transmission delay: 680 ns
Port  Type  Link  Loop    Signal  NextSlave  RxTime [ns]  Diff [ns]   NextDc [ns]
   0  MII   up    open    yes             0   3922788069           0         680
   1  MII   up    open    yes             2   3922789508        1439         719
   2  N/A   down  closed  no              -            -           -           -
   3  N/A   down  closed  no              -            -           -           -
Mailboxes:
  Bootstrap RX: 0x0000/0, TX: 0x0000/0
  Standard  RX: 0x1000/128, TX: 0x1100/128
  Supported protocols: CoE
General:
  Group: EtherCAT Driver
  Image name: 
  Order number: 
  Device name: CL3-E57H
  CoE details:
    Enable SDO: yes
    Enable SDO Info: no
    Enable PDO Assign: yes
    Enable PDO Configuration: yes
    Enable Upload at startup: no
    Enable SDO complete access: no
  Flags:
    Enable SafeOp: no
    Enable notLRW: no
  Current consumption: 0 mA
=== Master 0, Slave 2 ===
Device: Main
State: PREOP
Flag: +
Identity:
  Vendor Id:       0x00000a79
  Product code:    0x00001000
  Revision number: 0x00000001
  Serial number:   0x00000000
DL information:
  FMMU bit operation: no
  Distributed clocks: yes, 64 bit
  DC system time transmission delay: 1399 ns
Port  Type  Link  Loop    Signal  NextSlave  RxTime [ns]  Diff [ns]   NextDc [ns]
   0  MII   up    open    yes             1   3902518293           0         719
   1  MII   down  closed  no              -            -           -           -
   2  N/A   down  closed  no              -            -           -           -
   3  N/A   down  closed  no              -            -           -           -
Mailboxes:
  Bootstrap RX: 0x0000/0, TX: 0x0000/0
  Standard  RX: 0x1000/128, TX: 0x1100/128
  Supported protocols: CoE
General:
  Group: EtherCAT Driver
  Image name: 
  Order number: 
  Device name: CL3-E57H
  CoE details:
    Enable SDO: yes
    Enable SDO Info: no
    Enable PDO Assign: yes
    Enable PDO Configuration: yes
    Enable Upload at startup: no
    Enable SDO complete access: no
  Flags:
    Enable SafeOp: no
    Enable notLRW: no
  Current consumption: 0 mA

ethercat slaves once LinuxCNC has loaded -
pi@linuxcnc:~ $ ethercat slaves
0  0:0  OP  +  CL3-E57H
1  0:1  OP  +  CL3-E57H
2  0:2  OP  +  CL3-E57H
pi@linuxcnc:~ $ ethercat slaves -v
=== Master 0, Slave 0 ===
Device: Main
State: OP
Flag: +
Identity:
  Vendor Id:       0x00000a79
  Product code:    0x00001000
  Revision number: 0x00000001
  Serial number:   0x00000000
DL information:
  FMMU bit operation: no
  Distributed clocks: yes, 64 bit
  DC system time transmission delay: 0 ns
Port  Type  Link  Loop    Signal  NextSlave  RxTime [ns]  Diff [ns]   NextDc [ns]
   0  MII   up    open    yes             -   3940305729           0           0
   1  MII   up    open    yes             1   3940308529        2800         680
   2  N/A   down  closed  no              -            -           -           -
   3  N/A   down  closed  no              -            -           -           -
Mailboxes:
  Bootstrap RX: 0x0000/0, TX: 0x0000/0
  Standard  RX: 0x1000/128, TX: 0x1100/128
  Supported protocols: CoE
General:
  Group: EtherCAT Driver
  Image name: 
  Order number: 
  Device name: CL3-E57H
  CoE details:
    Enable SDO: yes
    Enable SDO Info: no
    Enable PDO Assign: yes
    Enable PDO Configuration: yes
    Enable Upload at startup: no
    Enable SDO complete access: no
  Flags:
    Enable SafeOp: no
    Enable notLRW: no
  Current consumption: 0 mA
=== Master 0, Slave 1 ===
Device: Main
State: OP
Flag: +
Identity:
  Vendor Id:       0x00000a79
  Product code:    0x00001000
  Revision number: 0x00000001
  Serial number:   0x00000000
DL information:
  FMMU bit operation: no
  Distributed clocks: yes, 64 bit
  DC system time transmission delay: 680 ns
Port  Type  Link  Loop    Signal  NextSlave  RxTime [ns]  Diff [ns]   NextDc [ns]
   0  MII   up    open    yes             0   3922788069           0         680
   1  MII   up    open    yes             2   3922789508        1439         719
   2  N/A   down  closed  no              -            -           -           -
   3  N/A   down  closed  no              -            -           -           -
Mailboxes:
  Bootstrap RX: 0x0000/0, TX: 0x0000/0
  Standard  RX: 0x1000/128, TX: 0x1100/128
  Supported protocols: CoE
General:
  Group: EtherCAT Driver
  Image name: 
  Order number: 
  Device name: CL3-E57H
  CoE details:
    Enable SDO: yes
    Enable SDO Info: no
    Enable PDO Assign: yes
    Enable PDO Configuration: yes
    Enable Upload at startup: no
    Enable SDO complete access: no
  Flags:
    Enable SafeOp: no
    Enable notLRW: no
  Current consumption: 0 mA
=== Master 0, Slave 2 ===
Device: Main
State: OP
Flag: +
Identity:
  Vendor Id:       0x00000a79
  Product code:    0x00001000
  Revision number: 0x00000001
  Serial number:   0x00000000
DL information:
  FMMU bit operation: no
  Distributed clocks: yes, 64 bit
  DC system time transmission delay: 1399 ns
Port  Type  Link  Loop    Signal  NextSlave  RxTime [ns]  Diff [ns]   NextDc [ns]
   0  MII   up    open    yes             1   3902518293           0         719
   1  MII   down  closed  no              -            -           -           -
   2  N/A   down  closed  no              -            -           -           -
   3  N/A   down  closed  no              -            -           -           -
Mailboxes:
  Bootstrap RX: 0x0000/0, TX: 0x0000/0
  Standard  RX: 0x1000/128, TX: 0x1100/128
  Supported protocols: CoE
General:
  Group: EtherCAT Driver
  Image name: 
  Order number: 
  Device name: CL3-E57H
  CoE details:
    Enable SDO: yes
    Enable SDO Info: no
    Enable PDO Assign: yes
    Enable PDO Configuration: yes
    Enable Upload at startup: no
    Enable SDO complete access: no
  Flags:
    Enable SafeOp: no
    Enable notLRW: no
  Current consumption: 0 mA

dmesg - wH while loading LinuxCNC-
[Dec 1 20:39] EtherCAT: Requesting master 0...
[  +0.000015] EtherCAT: Successfully requested master 0.
[  +0.001595] EtherCAT 0: Domain0: Logical address 0x00000000, 168 byte, expected working counter 9.
[  +0.000009] EtherCAT 0:   Datagram domain0-0-main: Logical offset 0x00000000, 168 byte, type LRW.
[  +0.000081] EtherCAT 0: Master thread exited.
[  +0.000011] EtherCAT 0: Starting EtherCAT-OP thread.
[  +0.349635] EtherCAT 0: Domain 0: Working counter changed to 2/9
[  +0.000010] .
[  +3.897046] EtherCAT 0: Domain 0: Working counter changed to 3/9
[  +0.000009] .
[  +1.003017] EtherCAT 0: Domain 0: 4 working counter changes - now 9/9
[  +0.000008] .
[  +0.089112] EtherCAT 0: Slave states on main device: OP.
 

dmesg once LinuxCNC is closed-
[Dec 1 20:46] EtherCAT 0: Master thread exited.
[  +0.000086] EtherCAT 0: Starting EtherCAT-IDLE thread.
[  +0.000129] EtherCAT ERROR 0-2: Failed to receive AL state datagram: 
[  +0.000007] Datagram 
[  +0.000005] initialized
[  +0.000006] .
[  +0.000033] EtherCAT 0: Releasing master...
[  +0.000009] EtherCAT 0: Released.
[  +0.017978] EtherCAT 0: Slave states on main device: SAFEOP + ERROR.
[  +0.020154] EtherCAT ERROR 0-0: AL status message 0x001A: "Synchronization error".
[  +0.000120] EtherCAT 0-0: Acknowledged state SAFEOP.
[  +0.019835] EtherCAT ERROR 0-1: AL status message 0x001A: "Synchronization error".
[  +0.000133] EtherCAT 0-1: Acknowledged state SAFEOP.
[  +0.020074] EtherCAT ERROR 0-2: AL status message 0x001A: "Synchronization error".
[  +0.000142] EtherCAT 0-2: Acknowledged state SAFEOP.
[  +0.019528] EtherCAT 0: Slave states on main device: PREOP.
[  +0.459963] EtherCAT WARNING: Datagram b81dad78 (master-fsm) was SKIPPED 1 time.


 

File Attachment:

File Name: my_EtherCAT.ini
File Size:4 KB

File Attachment:

File Name: my_EtherCAT.hal
File Size:5 KB

File Attachment:

File Name: myethercat-conf.xml
File Size:4 KB
Attachments:

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

More
01 Dec 2022 21:12 #258262 by mwc
And now I've fixed the formatting, the drives are Lichuan CL53-E57H Closed loop.
I have the manual, and they're CoE/CIA402 compliant.

If i look at the halmeter for the relevant pins, the drives show as enabled.

I'm wondering if it's an operating mode issue, as the driver manual does include a flow diagram for CSP mode, but the final outcome is the drives show as operational, so I'm pretty sure CSP mode is being configured correctly.

Anybody got any ideas?

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

More
01 Dec 2022 23:55 #258274 by db1981
all files you have attached look ok.

but there is something that seems to slow down the linuxcnc thread.

what is the content of custom.hal and custom_postgui.hal

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

More
02 Dec 2022 00:18 #258276 by mwc
I've just checked, and both hals are empty except for two comment lines.

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

More
02 Dec 2022 13:08 #258313 by db1981
Can you try if the problem is ethercat related or an general problem with the pi?

start one of the sample realtime configurations with stepgen, and check if linuxcnc / gui reacts as expected .

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

More
02 Dec 2022 21:08 #258366 by mwc
As I wasn't entirely happy with the Pi setup, I've temporarily removed the Mini-ITX board from my mill, stuck a new SSD in it, done a fresh install using the stable ISO (Debian Buster with linuxcnc 2.8.4), and installed EtherCAT as per Rod's guide.

Now I've done that, I've still got the exact same slow response from LinuxCNC.

Response is fine when using the Axis Sim profile.

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

More
02 Dec 2022 21:36 #258370 by db1981
hmm,

you can do a step by step test.

first insert the lcec_conf line in your sim hal -> test
-> next at the loadrt lcec -> test
-> add the addf lcec lines -> test
-> add the hal connections

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

More
02 Dec 2022 22:11 #258376 by mwc
I've just spent some time trying a few things.

I gradually removed all the ethercat realted lines from my Hal file until there were no ethercat related lines left, but the gui was still slow.

So I created a new profile using stepconf, gradually added all the ethercat lines, and the slow response problem has not returned.

I still don't have any movement and get following errors, so I now need to work out why the drives aren't fully enabling.
It's possibly a configuration issue, but the driver software is wrong, so I can't see if they are configured correctly or not. I'm told the correct software should be available on Monday.

I might try setting the SDOs via the xml over the weekend, to see if I can get them to fully enable and move.
Is there any way to read out values from slave registers and have them displayed somewhere?

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

More
03 Dec 2022 22:46 #258458 by mwc
Can somebody clarify something for me?

I'm just checking a few things, and have been watching various variables in HAL Configuration screen.
When I enable the drives, (Pins)cia402.0.controlword goes from 4 to 6.
6 (binary 0110 - aka Bits 1 and 2 set), are the bits for power on and quick stop (quick stop is inverted, so needs to be 1 to allow operation), so that appears to be OK.

However statusword, and opmode remain at 0.
Looking further, (Pins)cia402.0.opmode-cyclic-position/velocity/homing are unset and cia402.0.opmode-no-mode is set.
Digging through the values, I see (Parameters)cia402.0.csp-mode is set.

From my understanding of the driver manual, opmode is the value sent to the slave (via idx 6060h in the XML), which for CSP mode, should be 8.

Why is the correct opmode not being set?

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

More
04 Dec 2022 00:14 #258465 by db1981
opmode is only set after the drive responds cia-state "switched on" .

Controlword = 6 is the firststate from the enable state machine, like the cia-protocol there are two stages left till enabled...

I think there is no feedback from your drives, statusword should have an value after power on, is there action on the pos-feedback if you turn the motor shaft?

Are your slaves in op state after starting linuxcnc?

please post actual config files again.
The following user(s) said Thank You: mwc

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

Time to create page: 0.093 seconds
Powered by Kunena Forum