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

More
27 Jan 2022 15:32 - 27 Jan 2022 15:33 #233280 by Dj Junior
Hi everyone
Thanks to the help of my last post linuxcnc it worked. I followed the examples to configure the engines but they don't work. The ethercat command like 
does not give any feedback
ethercat download -p4 -t int32 0x607a 0 3000

Where am I doing wrong?

 

File Attachment:

File Name: ethercat-c...1-27.xml
File Size:5 KB
 

File Attachment:

File Name: ethercat_2...1-27.hal
File Size:4 KB
 

File Attachment:

File Name: axis_2022-01-27.ini
File Size:5 KB
Attachments:
Last edit: 27 Jan 2022 15:33 by Dj Junior.

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

More
28 Jan 2022 05:53 - 28 Jan 2022 05:55 #233345 by Hakan
I see that you have a number of lines commented out in the hal files. It will for sure not run in that way but I guess it is part of troubleshooting.

You need to add cia402.2.read-all and write-all to the servo-thread in the same way as the two other cia402.0 and cia402.1.

I never ran the stepper motors using raw commands like that, I always went through linuxcnc and let cia402 do the job.

What I would do is to remove the comments in the hal file, start axis, reset e-stop, power-on machine and then try to jog. Ideally that should work.
Check with ethercat slaves that the devices has gone from PREOP to OP.
Double-check that got the vendor id and product code right in the xml file, you get the info from ethercat slaves -v
If it still doesn't work go to the cia402 component source code; there is an example directory with usage examples. Try those to see that you get the drives and morors to work. Always check the output from linuxcnc for any errors, as cryptic as they might be they are a good source for troubleshooting.
Last edit: 28 Jan 2022 05:55 by Hakan.

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

More
28 Jan 2022 09:05 #233354 by Dj Junior
Right! I had to comment the lines for the resolution of the problem. For example if I put the first line
loadrt [KINS] KINEMATICS
It gives me the following error
 
The second line instead
loadrt servo_period_nsec = [EMCMOT] SERVO_PERIOD num_joints = [KINS] JOINTS
gives the following error
 

with addf motion-command-handler   servo-thread
I get this
 
 
Attachments:

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

More
28 Jan 2022 09:18 #233356 by db1981
Hello,

note:
you can't use ethercat download or upload commands to register you have mapped in the ethercat_conf file. These commands are only sdo communication, if an register is mapped as pdo (cyclic) you only able to use the realtime part for communication. In your case for the above command, 607A is mapped to lcec.0.4.target-velocity you have to command "setp lcec.0.4.target-velocity XXXX (value), but first disconnect this pin in the halfile, at the moment it is connected to an output from the cia comp.

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

More
28 Jan 2022 09:25 - 28 Jan 2022 09:27 #233357 by db1981
your problem:

you are using one of the preconfigured sim configs. Hal files are all loaded in the order the are placed in the ini file. And the loadrt and addf insides , are all added in the order they placed in the hal file.
In your case ethercat.hal is loaded as last hal file , and all functions are placed at the end of the realtime thread. This will never work.

Get rid of the core_sim. hal and put the ethercat.hal in the first position, add the neccesary parts like motion etc. to the ethercat.hal , to get an clean function running order.

If you have done this, and got linuxcnc to start:
-First check if the communication works. "ethercat slaves" command, all slaves have to be in op mode.
-then set the enable pin from an cia component and check if the drives gets enabled. (normaly you will hear some pwm noise....)
-if this works, you can start to send pos oder velo commands.
Last edit: 28 Jan 2022 09:27 by db1981.

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

More
28 Jan 2022 09:44 #233359 by Dj Junior
Hello db1981
You are right all the configurations I have seen put ethercal.hal first. in my case i tried to do the same thing but every time i get the famous servo-thread not found error
 
Then hakan suggested that I place it in the last position and it worked as linuxcncn starts
Attachments:

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

More
28 Jan 2022 10:25 #233360 by db1981
thats because the servo-thread is created in this line : #loadrt servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS

you have to put this in the ethercat.hal

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

More
28 Jan 2022 10:33 - 28 Jan 2022 10:33 #233361 by Dj Junior
I removed the comments
loadrt [KINS]KINEMATICS
loadrt servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec
loadrt cia402 count=3

and this is the output

 

 
Attachments:
Last edit: 28 Jan 2022 10:33 by Dj Junior.

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

More
28 Jan 2022 10:38 #233362 by db1981
something missing:

loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS

take this line

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

More
28 Jan 2022 11:06 - 28 Jan 2022 11:07 #233365 by Dj Junior
Updated but get another issue

USRMOT: ERROR: command timeout
emcMotionInit: emcTrajInit failed
USRMOT: ERROR: command timeout
emcMotionInit: emcTrajInit failed
USRMOT: ERROR: command timeout
emcMotionInit: emcTrajInit failed

 

File Attachment:

File Name: output.txt
File Size:2 KB
Attachments:
Last edit: 28 Jan 2022 11:07 by Dj Junior.

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

Time to create page: 0.607 seconds
Powered by Kunena Forum