Fast pulse for stepper with EL2202

More
29 Aug 2023 17:08 - 29 Aug 2023 18:02 #279299 by JoBoCNC
Hello, 
I would like to replace my parallel port system with Ethercat. My existing system uses closed loop stepper drivers with parallel port.
My idea was to use a fast Beckhoff module for the stepper pulses. So I bought the EL2202 module.

To test the setup, I added the Ethercat commands for Y-axis to my previous configuration files. 
At low speed everything works fine. But at higher speed the stepper loses steps. 
The other axes with the parallel port work fine at these speeds.
So I think that the EL2202 is not generating the pulses fast enough.
In my opinion, with my config it is at least possible to generate the same speed as the parallel port axis.

Any suggestion what i can try? Think it is a configuration issue. So here my config files.
Thank you very much!

Here my .hal 
# Generated by stepconf 1.1 at Sat Sep  3 11:45:09 2022
# Änderungen an dieser Datei werden beim nächsten
# Aufruf von stepconf überschrieben.

#loadrt trivkins

loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec

loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS 

loadrt hal_parport cfg="0 out"
setp parport.0.reset-time 50 #5000
loadrt stepgen step_type=0,0,0,0
loadrt pwmgen output_type=1 #1




addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread #servo
addf pwmgen.update servo-thread



addf lcec.read-all base-thread #servo
#addf lcec.write-all servo-thread

addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf pwmgen.make-pulses base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread
addf lcec.write-all base-thread    #testservo


net spindle-cmd-rpm => pwmgen.0.value
net spindle-on <= spindle.0.on => pwmgen.0.enable
net spindle-pwm <= pwmgen.0.pwm
setp pwmgen.0.pwm-freq 8000.0
setp pwmgen.0.scale 24000
setp pwmgen.0.offset 0
setp pwmgen.0.dither-pwm true
net spindle-cmd-rpm     <= spindle.0.speed-out
net spindle-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-cmd-rps     <= spindle.0.speed-out-rps
net spindle-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-at-speed    => spindle.0.at-speed
net dout-00 <= motion.digital-out-00

setp parport.0.pin-01-out-invert 1
net spindle-pwm     => parport.0.pin-01-out
setp parport.0.pin-02-out-invert 1
net zstep           => parport.0.pin-02-out
setp parport.0.pin-02-out-reset 1
setp parport.0.pin-03-out-invert 1
net zdir            => parport.0.pin-03-out

#setp parport.0.pin-04-out-invert 1
#net ystep           => parport.0.pin-04-out
net ystep           => lcec.0.1.dout-1  #changed to ethercat
#setp parport.0.pin-04-out-reset 1
#setp lcec.0.1.dout-1-reset 1

setp parport.0.pin-05-out-invert 1
net ydir            => parport.0.pin-05-out
setp parport.0.pin-06-out-invert 1
net xstep           => parport.0.pin-06-out
setp parport.0.pin-06-out-reset 1
net xdir            => parport.0.pin-07-out
setp parport.0.pin-08-out-invert 1
net x2step           => parport.0.pin-08-out
setp parport.0.pin-08-out-reset 1
net x2dir            => parport.0.pin-09-out

net xenable         => parport.0.pin-14-out
net dout-00         => parport.0.pin-16-out
net spindle-on      => parport.0.pin-17-out
net home-z          <= parport.0.pin-10-in-not
net home-y          <= parport.0.pin-11-in-not
net home-x          <= parport.0.pin-13-in-not
net home-x2          <= parport.0.pin-12-in-not
net estop-ext       <= parport.0.pin-15-in-not




setp stepgen.0.position-scale [JOINT_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 44000
setp stepgen.0.dirsetup 44000
setp stepgen.0.maxaccel [JOINT_0]STEPGEN_MAXACCEL
net xpos-cmd joint.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => joint.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable joint.0.amp-enable-out => stepgen.0.enable
net home-x => joint.0.home-sw-in

setp stepgen.1.position-scale [JOINT_1]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 27000
setp stepgen.1.dirsetup 27000
setp stepgen.1.maxaccel [JOINT_1]STEPGEN_MAXACCEL
net x2pos-cmd joint.1.motor-pos-cmd => stepgen.1.position-cmd
net x2pos-fb stepgen.1.position-fb => joint.1.motor-pos-fb
net x2step <= stepgen.1.step
net x2dir <= stepgen.1.dir
net x2enable joint.1.amp-enable-out => stepgen.1.enable
net home-x2 => joint.1.home-sw-in

setp stepgen.2.position-scale [JOINT_2]SCALE
setp stepgen.2.steplen 1 #1
setp stepgen.2.stepspace 0 #0
setp stepgen.2.dirhold 35000 #27000
setp stepgen.2.dirsetup 35000
setp stepgen.2.maxaccel [JOINT_2]STEPGEN_MAXACCEL
net ypos-cmd joint.2.motor-pos-cmd => stepgen.2.position-cmd
net ypos-fb stepgen.2.position-fb => joint.2.motor-pos-fb
net ystep <= stepgen.2.step
net ydir <= stepgen.2.dir
net yenable joint.2.amp-enable-out => stepgen.2.enable
net home-y => joint.2.home-sw-in

setp stepgen.3.position-scale [JOINT_3]SCALE
setp stepgen.3.steplen 1
setp stepgen.3.stepspace 0
setp stepgen.3.dirhold 27000
setp stepgen.3.dirsetup 27000
setp stepgen.3.maxaccel [JOINT_3]STEPGEN_MAXACCEL
net zpos-cmd joint.3.motor-pos-cmd => stepgen.3.position-cmd
net zpos-fb stepgen.3.position-fb => joint.3.motor-pos-fb
net zstep <= stepgen.3.step
net zdir <= stepgen.3.dir
net zenable joint.3.amp-enable-out => stepgen.3.enable
net home-z => joint.3.home-sw-in

#setp stepgen.3.position-scale [AXIS_Z]SCALE
#setp stepgen.3.steplen 1
#setp stepgen.3.stepspace 0
#setp stepgen.3.dirhold 27000
#setp stepgen.3.dirsetup 27000
#setp stepgen.3.maxaccel [AXIS_3]STEPGEN_MAXACCEL
#net apos-cmd joint.3.motor-pos-cmd => stepgen.3.position-cmd
#net apos-fb stepgen.3.position-fb => joint.3.motor-pos-fb
#net astep <= stepgen.3.step
#net adir <= stepgen.3.dir
#net aenable joint.3.amp-enable-out => stepgen.3.enable
#net home-a => joint.3.home-sw-in

net estop-out <= iocontrol.0.user-enable-out
net estop-ext => iocontrol.0.emc-enable-in

loadusr -W hal_manualtoolchange
net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared

.ini:
# This config file was created 2022-09-09 17:56:09.071663 by the update_ini script
# The original config files may be found in the /home/jobo/linuxcnc/configs/Meine-Maschine/Meine-Maschine.old directory

# Generated by stepconf 1.1 at Sat Sep  3 11:45:09 2022
# Änderungen an dieser Datei werden beim nächsten
# Aufruf von stepconf überschrieben.

[EMC]
# The version string for this INI file.
VERSION = 1.1

MACHINE = Meine-Maschine
DEBUG = 0

[DISPLAY]
DISPLAY = axis
EDITOR = gedit
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
ARCDIVISION = 64
GRIDS = 10mm 20mm 50mm 100mm 1in 2in 5in 10in
MAX_FEED_OVERRIDE = 1.2
MIN_SPINDLE_OVERRIDE = 0.5
MAX_SPINDLE_OVERRIDE = 1.2
DEFAULT_LINEAR_VELOCITY = 30.00
MIN_LINEAR_VELOCITY = 0
MAX_LINEAR_VELOCITY = 750.00
DEFAULT_ANGULAR_VELOCITY = 10
MIN_ANGULAR_VELOCITY = 0
MAX_ANGULAR_VELOCITY = 50.00
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 2
PROGRAM_PREFIX = /home/jobo/linuxcnc/nc_files
INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm
PYVCP = custompanel.xml
#GEOMETRY = xyz

[KINS]
JOINTS = 4
KINEMATICS = trivkins coordinates=XXYZ

[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python

[RS274NGC]

PARAMETER_FILE = linuxcnc.var

[EMCMOT]

EMCMOT = motmod
COMM_TIMEOUT = 1.0
BASE_PERIOD = 30000
SERVO_PERIOD = 1050000 
#120000

[TASK]
TASK = milltask
CYCLE_TIME = 0.001

[HAL]
HALFILE = Meine-Maschine.hal
HALFILE = custom.hal
POSTGUI_HALFILE = custom_postgui.hal

[HALUI]
#No Content


[TRAJ]
COORDINATES = X X Y Z
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 10
MAX_LINEAR_VELOCITY = 750.00
#NO_FORCE_HOMING = 0

[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl


[AXIS_X]
MIN_LIMIT = -0.001
MAX_LIMIT = 572.0
MAX_VELOCITY = 750
MAX_ACCELERATION = 750.0

[JOINT_0]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -0.001
MAX_LIMIT = 572.0
MAX_VELOCITY = 750
MAX_ACCELERATION = 750.0
STEPGEN_MAXACCEL = 937.5
SCALE = 320.0
FERROR = 1
MIN_FERROR = .25
#HOME_OFFSET = 0.000000
#HOME_SEARCH_VEL = -10.000000
#HOME_LATCH_VEL = -0.2
#HOME_SEQUENCE = 1

HOME_OFFSET = -0.800000
HOME_SEARCH_VEL = -12.000000
HOME_LATCH_VEL = -0.2
HOME_SEQUENCE = -1
HOME_FINAL_VEL = 5
HOME_USE_INDEX = NO

[JOINT_1]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -0.001
MAX_LIMIT = 572.0
MAX_VELOCITY = 750
MAX_ACCELERATION = 750.0
STEPGEN_MAXACCEL = 937.5
SCALE = 320.0
FERROR = 1
MIN_FERROR = .25
#HOME_OFFSET = 0.000000
#HOME_SEARCH_VEL = -10.000000
#HOME_LATCH_VEL = -0.2
#HOME_SEQUENCE = 1

HOME_OFFSET = -0.600000
HOME_SEARCH_VEL = -12.000000
HOME_LATCH_VEL = -0.2
HOME_SEQUENCE = -1
HOME_FINAL_VEL = 5
HOME_USE_INDEX = NO

[AXIS_Y]
MIN_LIMIT = 0.0
MAX_LIMIT = 480.001
MAX_VELOCITY = 75
MAX_ACCELERATION = 750.0 

[JOINT_2]

TYPE = LINEAR
HOME = 480.0
MAX_VELOCITY = 75
MAX_ACCELERATION = 750.0 
STEPGEN_MAXACCEL = 937.5
SCALE = 320.0
FERROR = 1
MIN_FERROR = .25
MIN_LIMIT = -0.001
MAX_LIMIT = 480.001
HOME_OFFSET = 480.000000
HOME_SEARCH_VEL = 12.000000
HOME_LATCH_VEL = 0.2
HOME_SEQUENCE = 2

[AXIS_Z]
MIN_LIMIT = -250.00
MAX_LIMIT = 0.001
MAX_VELOCITY = 50
MAX_ACCELERATION = 750.0

[JOINT_3]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 50
MAX_ACCELERATION = 750.0
STEPGEN_MAXACCEL = 937.5
SCALE = 320.0
FERROR = 1
MIN_FERROR = .25
MIN_LIMIT = -250.00
MAX_LIMIT = 0.001
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = 12.000000
HOME_LATCH_VEL = 0.2
HOME_SEQUENCE = 0


And my Ethercat config file:
<masters>
<master idx="0" appTimePeriod="30000" refClockSyncCycles="5">
<slave idx="0" type="EK1100"/>
<slave idx="1" type="EL2202"/>
<slave idx="2" type="EL1819"/>

</master>
</masters>
Last edit: 29 Aug 2023 18:02 by JoBoCNC.

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

More
29 Aug 2023 19:55 #279311 by jjdege
HI
I don't know, but have you tried putting in .hal

setp lcec.0.1.dout-1 1
net ystep => lcec.0.1.dout-1 #changed to ethercat

HI

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

More
29 Aug 2023 20:26 #279313 by PCW
Are there any timing specifications on the EL2022?

I would expect a parallel port to have significantly lower overhead than EtherCAT

 

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

More
30 Aug 2023 09:26 #279360 by JoBoCNC
Thanks for the replies.

setp lcec.0.1.dout-1 1 changed nothing.

What do you mean with timing specifications?
The datasheet says Switching times under 1us.

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

More
30 Aug 2023 16:56 #279397 by mwc
The EL2202 is a fast switching output module, but only fast in how quickly it switches it's outputs from receiving the signal to switch the outputs.

It can switch an output in less than 1uS, but how often it can switch that output is limited by the EtherCAT transmission time frames. Even if your EtherCAT master can run with 100uS frame times (I can't remember the cycle time LCNC uses, but I'm pretty sure it's slower!), that's a 10'000Hz cycle. However it can only command an output change once per cycle, so to issue a single pulse takes a minimum of 2 cycles, so your absolute maximum step pulse frequency is going to be 5'000Hz at 100uS cycle time.

I seem to think that LCNC runs a 1ms Cycle time, which would mean the maximum step frequency is only going to be 500Hz.

However I don't think the LCNC EtherCAT implementation is even capable of converting/transmitting step pulse outputs to what is in effect a standard output.

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

More
30 Aug 2023 20:48 #279416 by JoBoCNC
That makes sense. Thanks. Means my setup can't work. :(

Just for understanding: when using ethercat drivers they get one command per cycle like "do 10 steps"? So the driver has an extra processing?

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

More
30 Aug 2023 22:44 #279422 by mwc
In a basic way, yes.

I can't remember the correct name for the protocol implemented in LCNC, but every cycle LCNC sends the desired position to all the drives. The drives then do all the required calculations to get the motor to that required position within the given time.

I'll hopefully be dusting of my test setup again this weekend to see if the latest EitherLab Master version has fixed the issues I was having with the cheaper EitherCAT closed loop drives I have.

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

Time to create page: 0.083 seconds
Powered by Kunena Forum