Stepper motor not running (Linux CNC + EtherCat + RPi 4)

More
28 Jan 2022 12:50 #233368 by db1981
did you insert the basic neccessary stuff from core_hal to the ethercat.hal ?

seems that motion is missing....

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

More
28 Jan 2022 13:28 - 28 Jan 2022 13:43 #233372 by Dj Junior
this is my hal file. I m going step by step to avoiding error

loadrt [KINS]KINEMATICS
#autoconverted trivkins
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec
loadrt cia402 count=3
loadrt pid names=x-pid,y-pid,z-pid

I added the following code to section [EMCMOT]

COMM_TIMEOUT = 10.0
COMM_WAIT = 0.100
# Timeout for comm to emcmot, in seconds
COMM_TIMEOUT = 1.0

and the error disappeared

now there is another error

waiting for s.joints<0>, s.kinematics_type<0>
 

File Attachment:

File Name: output_2022-01-28.txt
File Size:2 KB
Attachments:
Last edit: 28 Jan 2022 13:43 by Dj Junior.

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

More
28 Jan 2022 14:18 #233375 by db1981
is this in the hal?

addf motion-command-handler servo-thread

addf motion-controller servo-thread

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

More
28 Jan 2022 14:42 - 28 Jan 2022 15:41 #233379 by Dj Junior
Yes! here is the hal file

loadrt [KINS]KINEMATICS
#autoconverted trivkins
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec
loadrt cia402 count=2

addf lcec.read-all servo-thread
addf cia402.0.read-all servo-thread
addf cia402.1.read-all servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf cia402.0.write-all servo-thread
addf cia402.1.write-all servo-thread
addf lcec.write-all servo-thread

#*******************
# AXIS X
#*******************

# --- joint signals for motion

net x-pos-cmd <= joint.0.motor-pos-cmd
net x-vel-cmd <= joint.0.vel-cmd
net x-pos-fb <= joint.0.motor-pos-fb
net x-enable <= joint.0.amp-enable-out

# --- connect stepper driver to joint

net x-pos-cmd => cia402.0.pos-cmd
net x-pos-fb => cia402.0.pos-fb
net x-enable => cia402.0.enable

# --- ect60 settings

setp cia402.0.csp-mode 1
setp cia402.0.pos-scale 4000

# --- from stepper(ethercat) to cia402

net x-statusword lcec.0.4.cia-statusword => cia402.0.statusword
net x-opmode-display lcec.0.4.opmode-display => cia402.0.opmode-display
net x-drv-act-pos lcec.0.4.actual-position => cia402.0.drv-actual-position
net x-drv-act-velo lcec.0.4.actual-velocity => cia402.0.drv-actual-velocity

# --- from cia402 to stepper(ethercat)

net x-controlword cia402.0.controlword => lcec.0.4.cia-controlword
net x-modes-of-operation cia402.0.opmode => lcec.0.4.opmode
net x-drv-target-pos cia402.0.drv-target-position => lcec.0.4.target-position
net x-drv-target-velo cia402.0.drv-target-velocity => lcec.0.4.target-velocity

#*******************
# AXIS Z
#*******************

# --- joint signals for motion

net z-pos-cmd <= joint.1.motor-pos-cmd
net z-vel-cmd <= joint.1.vel-cmd
net z-pos-fb <= joint.1.motor-pos-fb
net z-enable <= joint.1.amp-enable-out

# --- connect stepper driver to the joint

net z-pos-cmd => cia402.1.pos-cmd
net z-pos-fb => cia402.1.pos-fb
net z-enable => cia402.1.enable

# --- ect60 settings

setp cia402.1.csp-mode 1
setp cia402.1.pos-scale 10000

# --- from servo(ethercat) to cia402

net z-statusword lcec.0.5.cia-statusword => cia402.1.statusword
net z-opmode-display lcec.0.5.opmode-display => cia402.1.opmode-display
net z-drv-act-pos lcec.0.5.actual-position => cia402.1.drv-actual-position
net z-drv-act-velo lcec.0.5.actual-velocity => cia402.1.drv-actual-velocity

# --- from cia402 to servo(ethercat)

net z-controlword cia402.1.controlword => lcec.0.5.cia-controlword
net z-modes-of-operation cia402.1.opmode => lcec.0.5.opmode
net z-drv-target-pos cia402.1.drv-target-position => lcec.0.5.target-position
net z-drv-target-velo cia402.1.drv-target-velocity => lcec.0.5.target-velocity

#*********************
# E-STOP
#*********************

setp iocontrol.0.emc-enable-in 1

I think my problem is the drivers. They are in the PREOP state

pi@linuxcnc:~/linuxcnc/configs/sim.axis $ ethercat slaves
0  0:0  OP     +  EK1100 EtherCAT-Koppler (2A E-Bus)
1  0:1  OP     +  EL1018 8Ch. Dig. Input 24V, 10�s
2  0:2  OP     +  EL1104 4K. Dig. Eingang 24V, 3ms, Sensorversorgung
3  0:3  OP     +  EL2008 8K. Dig. Ausgang 24V, 0.5A
4  0:4  PREOP  +  TQ870(COE)
5  0:5  PREOP  +  TQ870(COE)
6  0:6  PREOP  +  TQ870(COE)

I configured it with vendor id and manufacturer
 

File Attachment:

File Name: ethercat-c...28-2.xml
File Size:5 KB
Attachments:
Last edit: 28 Jan 2022 15:41 by Dj Junior.

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

More
28 Jan 2022 16:14 #233383 by db1981
am i right that linuxcnc is now starting up?

you will have to find out whats wrong with the pdo mapping. Set ethercat debug level to 1 and carefully read dmesg. It will help to reduce the config to an minimal setup. (only PC and one drive for example) , so reading dmesg is a lot easier....

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

More
28 Jan 2022 16:32 - 28 Jan 2022 16:33 #233386 by Dj Junior
Yes! linuxcnc is started.
 
It gives me join error and according to the linuxcnc manual it may be due
1. too little ferror or min_ferror
2. the RT pulsing can't keep up with the speed needed
2.a. BASE_PERIOD set incorrectly or (requested step rate is not possible at this BASE_PERIOD)
2.b. max velocity too high
2.c. max acceleration too high

Anyway I look at it later now I connect a driver as you said and try to see if I can configure it
Attachments:
Last edit: 28 Jan 2022 16:33 by Dj Junior.

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

More
28 Jan 2022 18:14 #233394 by Hakan
You can have a look at how I did it for the lathe.
I made the config from scratch, you can see the complete hal file.
forum.linuxcnc.org/ethercat/42048-notes-...aspberry-pi-4#206936

The three files you see there is everything. You can test the lathe copy them and only them to an empty directory.
You have to change indices to reflect you ethercat setup. And then start linuxcnc lathe.ini
It will run on only two axis but may give you a way to come further.
 

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

More
28 Jan 2022 19:13 #233399 by db1981
this errors are not important at the moment.

first the basics !

You have to get the communication working, all slaves must have ethercat op state.
all linuxcnc stuff is not related to the pure ethercat config.

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

More
28 Jan 2022 20:22 #233405 by rodw
I have a basic working complete config here that may help.
github.com/rodw-au/linuxcnc-cia402

But this is for my hardware not yours so the xml file will need some edits. but it will show how to configure the SDO's (thanks to Hakan there!)

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

More
29 Jan 2022 13:32 - 29 Jan 2022 13:38 #233432 by Dj Junior
Hi everyone
I only connected one driver as recommended but the motor does not run. It seems that the configuration is correct, I also downloaded the xml file of the ECT60 driver on the tuttorial cia402 to compare it with mine and the settings are almost all the same.
The driver status is in OP.
dmesg gives no error.
I connected the driver on Windows with TWINCAT and the motor is running
but connected on RPI and starting linuxcnc the motor does not work.
I do not understand why
 

 

 

File Attachment:

File Name: custom.hal
File Size:2 KB
 

File Attachment:

File Name: custom.ini
File Size:5 KB
 

File Attachment:

File Name: custom-conf.xml
File Size:2 KB
Attachments:
Last edit: 29 Jan 2022 13:38 by Dj Junior.

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

Time to create page: 0.472 seconds
Powered by Kunena Forum