- Posts: 29
- Thank you received: 5
Ethercat HAL driver
- theshade
- Offline
- Junior Member
-
I am making good progress but the motor still does not move.
when I start linuxcnc the motor does get power and is locked into position.. it is very hard to move it by hand...
I read position from encoder it is 0.
the motor is in CSP mode 0x8
When I download a new position to 0x607A manually the motor does not move.
Same when I try to move the motor using the linuxcnc interface.
I can see the cursor moving on the 3d screen but the motor is always at 0
When I start linuxcnc and get in OP dmesg
reads this:
So as you can see my sync is not working although I reached OP
I also read this sentence in the manual:
In this mode, the primary controller generates a position trace and sends the target
location (0x607A) to the drive during each PDO update cycle. The drive feeds back the
actual motor position and optional actual motor speed and torque.
Enable CSP
So what does happen if the PDO is not update at every cycle because the master is not synced correctly would CSP still work?
Also I was able to read the position from the actual location (0x6064) and the encoder has 4000 steps per revolution.
finally linuxcnc (2.9) wasn't happy with the hal command you gave me:
the hal wanted a command so I made a net..
from last message:
"Now we connect the signals ...
lcec.0.poscmd -> joint.0.motor-pos-cmd
lcec.0.actpos <- joint.0.motor-pos-fb"
so I modified to this:
net Ypos joint.1.motor-pos-cmd => joint.1.motor-pos-fb
net Zpos joint.2.motor-pos-cmd => joint.2.motor-pos-fb
net Xpos joint.0.motor-pos-cmd => lcec.0.0.poscmd
net Xact lcec.0.0.actpos => joint.0.motor-pos-fb
is it correct (what you meant?) or am I reversed with my arrows?
now it seems that when I start linuxcnc the motor turns on but when I try to move it
I get this
joint 0 following error
emc/task/taskintf.cc 947: Error on joint 0, command number 474
Also when I try to apply some force to the motor left or right from the stuck position, I see the encoder does work though..
So somehow it is not closing the loop on the position... do I need to set a speed for the CSP mode?
I thought updating position is enough.
The motor does work in windows with twincat so I know the cables are all correct.
Thank you again for your time and help
Cheers,
- chimeno
- Offline
- Elite Member
-
- Posts: 295
- Thank you received: 125
So as you can see my sync is not working although I reached OP
I also read this sentence in the manual:
In this mode, the primary controller generates a position trace and sends the target
location (0x607A) to the drive during each PDO update cycle. The drive feeds back the
actual motor position and optional actual motor speed and torque.
Enable CSP
So what does happen if the PDO is not update at every cycle because the master is not synced correctly would CSP still work?
In all the devices that have been tried so far, if the DC mode does not synchronize, the device appears an error and stays in the "PREOP E" state, if yours is in OP it must be synchronized in principle, you can try to lower the time.
<dcConf assignActivate="300" sync0Cycle="20000000" sync0Shift="0"/>
The arrows do not affect the programming, it is only as a comment to understand it betteris it correct (what you meant?) or am I reversed with my arrows?
This error is normal because the motor is not moving.now it seems that when I start linuxcnc the motor turns on but when I try to move it
I get this
joint 0 following error
emc/task/taskintf.cc 947: Error on joint 0, command number 474
In TWINCAT 3, does it work for you? you can compare these values with linuxcnc
You have activated in linuxcnc is Quick stop status ?? it's okay?
If you want you can also pass me the project in TWINCAT3 configured and that it operates and I look at it in case I see something different.
Regards
Chimeno
- theshade
- Offline
- Junior Member
-
- Posts: 29
- Thank you received: 5
The values in 0x6040 and 0x6041 in TWINCAT are 0x1F and 0x1237 (see screenshot) when the NC controller is started
I do not understand why though it is not just 0x0F because in CSP the 0x10 bit is is not required according to manual
Anyway I did try to add it into linuxcnc using the hal command to get the same as:
setp lcec.0.0.X-cmd-OPmodeRel1 1
pi@raspberrypi:~ $ ethercat -p0 -t uint16 upload 0x6040 0
0x001f 31
pi@raspberrypi:~ $ ethercat -p0 -t uint16 upload 0x6041 0
0x1237 4663
pi@raspberrypi:~ $
Also it seems to me that all status including /Quickstop are good according to my current understanding of things:
I have tried setting 0x6040 from 0x06 to 0x0f and also from 0x06 to 0x1f multiple times. Because I think that in PP mode it is required to be switched for each new position.. but in CSP I believe it should stay at 1... (at least that is what I observe when it works in twincat)
I also tried turning on
setp joint.0.jog-enable 1
don't know if that is relevant... but it seems a good thing to enable the jog if I want to move the X axis..
What I am not sure is that in the doc both 0x607A(poscmd) and 0x6064(actpos) are specified as "pulse units" integer32 so I suppose this should be some kind of integer..
but in the xml, following may examples, I have them defined as float (because otherwise it complains about the scaling) .. I saw there was a thread on that subject here but it is somewhat old and used haltype=special32 ???
I also tried different scaling betwen 0.001 to 1 and 1000 for actpos and poscmd... ( it does indeed change the encoder resolution when I force the motor) generating more or less error.
Again thank you for your help.. I feel there is just one little thing to find ... it is a bit frustrating to be so close and not see the motor move...
- chimeno
- Offline
- Elite Member
-
- Posts: 295
- Thank you received: 125
If it is surely a small detail that does not leave you, meanwhile you can try another configuration mode, for example speed,
You can test the SYNC unit cycle at 1000us in TWINCAT and define the SYNC0 x 1 = 1000 us ?? if it works you can try this configuration.
In the screenshot that you show me these records are zero? why?
Reguard
Chimeno
- theshade
- Offline
- Junior Member
-
- Posts: 29
- Thank you received: 5
I tried the new dcConf you suggested but it doesn't seem to work
also when I try to edit the sync unit cycle to 2000us, but the field in the window would not let me change the value.
I suppose I would need to change it in the SDO somehow and save the value in the firmware of the driver?
ALso I still have some warnings in the ethercat and still fail to sync.
but I do get to OP:
When I set 2.4mm to the target position in twincat the position of both actpos and poscm is 24000 so I suppose it is always an integer So do I need to have "FLOAT" haltype is correct for actpos and poscmd registers despite the integer32 type in the manual?
Do I maybe need to start an other thread or function in linuxcnc to enable actual displacement? or set windows or limits of operation or remove some safety somewhere?
- CORBETT
- Offline
- Elite Member
-
- Posts: 286
- Thank you received: 113
I finally got everything wired up in the machine and running fully on Ethercat only. No more software encoder or parallel port slow down, and now working on the PID tuning. I couldn't properly tune it in the past as it couldn't ever get up past about 30ipm as it would loose counts and then error the axis. At some point the original 200ppr encoders were replaced with 1000ppr BEI encoders, so software encoding is practically impossible at moderate to high speed. Low speed not a problem, but once past 25ipm it was really iffy about loosing counts. But now, even with just some rough tuning, I can get 50ipm with it being smooth, it came from the factory with 250ipm, so after I finish PID tuning I am going to adjust my INI and crank up the jog speed some. Huge difference in the EL5151 hardware counting comparred to the previous parallel port software encoding. Absolutely love the Ethercat setup.
Robert