Dual motor gantry settings

More
07 Oct 2019 15:13 #147345 by millhouse_
I only use Linux.

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

More
07 Oct 2019 15:28 - 07 Oct 2019 15:30 #147346 by millhouse_
Here is a picture of what I think is causing the problem:



Attachments:
Last edit: 07 Oct 2019 15:30 by millhouse_.

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

More
07 Oct 2019 22:24 - 07 Oct 2019 22:37 #147373 by millhouse_
After reading and reading i was possible to get closer. The 4 values are taken from the base_period variable within the .ini. A change of the base period changes steplen/stepspace/etc too.


It looks like within the .hal DoubleStep is enabled. I tried to disable it but that changed nothing. Do I need DoubleStep? And how can i fully deactivate it?


The question is: What changes do the config files need to accept the values for steplen etc.


.hal
# Generated by stepconf 1.1 at Fri Oct  4 22:01:28 2019
# Änderungen an dieser Datei werden beim nächsten
# Aufruf von stepconf überschrieben.
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="1 out"

#setp parport.0.reset-time 3500
setp parport.0.reset-time 5500


loadrt stepgen step_type=0,0,0,0
loadrt pwmgen output_type=1

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 stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
addf pwmgen.update servo-thread


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 100.0
setp pwmgen.0.scale 1166.66666667
setp pwmgen.0.offset 0.114285714286
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 spindle-cw          <= spindle.0.forward
net estop-out       => parport.0.pin-01-out
net spindle-cw      => parport.0.pin-14-out
net spindle-pwm     => parport.0.pin-16-out
#net xenable         => parport.0.pin-17-out

##############################################################################
#
# DIR/STEP Driver Pins
#
##############################################################################
net x-step          => parport.0.pin-02-out
setp parport.0.pin-02-out-reset 1
setp parport.0.pin-02-out-invert 1

net x-dir           => parport.0.pin-03-out
setp parport.0.pin-03-out-invert 1

net y-step          => parport.0.pin-04-out
setp parport.0.pin-04-out-reset 1
setp parport.0.pin-04-out-invert 1

net y-dir           => parport.0.pin-05-out
#setp parport.0.pin-05-out-invert 1

net z-step          => parport.0.pin-06-out
setp parport.0.pin-06-out-reset 1
setp parport.0.pin-06-out-invert 1
net z-dir           => parport.0.pin-07-out
setp parport.0.pin-07-out-invert 1

net y2-step         => parport.0.pin-08-out
setp parport.0.pin-08-out-reset 1
setp parport.0.pin-08-out-invert 1
net y2-dir          => parport.0.pin-09-out
setp parport.0.pin-09-out-invert 1

 
##############################################################################
#
#
#
##############################################################################
#net both-home-x    <= parport.0.pin-12-in
#net both-home-y    <= parport.0.pin-13-in
#net both-home-y2   <= parport.0.pin-11-in
#net both-home-z    <= parport.0.pin-15-in




##############################################################################
#
# X Axis
#
##############################################################################
setp stepgen.0.steplen        [JOINT_0]STEPLEN
setp stepgen.0.stepspace      [JOINT_0]STEPSPACE
setp stepgen.0.dirhold        [JOINT_0]DIRHOLD
setp stepgen.0.dirsetup       [JOINT_0]DIRSETUP

#setp stepgen.0.steplen        1
#setp stepgen.0.stepspace      0
#setp stepgen.0.dirhold        25000
#setp stepgen.0.dirsetup       25000

setp stepgen.0.maxaccel       [JOINT_0]STEPGEN_MAXACCEL
setp stepgen.0.maxvel         [JOINT_0]STEPGEN_MAX_VEL
setp stepgen.0.position-scale [JOINT_0]STEP_SCALE

net x-pos-cmd joint.0.motor-pos-cmd => stepgen.0.position-cmd
net x-pos-fb stepgen.0.position-fb  => joint.0.motor-pos-fb
net x-enable joint.0.amp-enable-out => stepgen.0.enable

net both-home-x                     => joint.0.home-sw-in
net both-home-x                     => joint.0.neg-lim-sw-in
net both-home-x                     => joint.0.pos-lim-sw-in

net x-step                          <= stepgen.0.step
net x-dir                           <= stepgen.0.dir



##############################################################################
#
# Y Axis left
#
##############################################################################
setp stepgen.1.steplen        [JOINT_1]STEPLEN
setp stepgen.1.stepspace      [JOINT_1]STEPSPACE
setp stepgen.1.dirhold        [JOINT_1]DIRHOLD
setp stepgen.1.dirsetup       [JOINT_1]DIRSETUP

#setp stepgen.1.steplen        1
#setp stepgen.1.stepspace      0
#setp stepgen.1.dirhold        25000
#setp stepgen.1.dirsetup       25000

setp stepgen.1.maxaccel       [JOINT_1]STEPGEN_MAXACCEL
setp stepgen.1.maxvel         [JOINT_1]STEPGEN_MAX_VEL
setp stepgen.1.position-scale [JOINT_1]STEP_SCALE

net y-pos-cmd joint.1.motor-pos-cmd => stepgen.1.position-cmd
net y-pos-fb stepgen.1.position-fb  => joint.1.motor-pos-fb
net y-enable joint.1.amp-enable-out => stepgen.1.enable

net both-home-y                     => joint.1.home-sw-in
net both-home-y                     => joint.1.neg-lim-sw-in
net both-home-y                     => joint.1.pos-lim-sw-in

net y-step                          <= stepgen.1.step
net y-dir                           <= stepgen.1.dir



##############################################################################
#
# Y Axis right
#
##############################################################################
setp stepgen.2.steplen        [JOINT_2]STEPLEN
setp stepgen.2.stepspace      [JOINT_2]STEPSPACE
setp stepgen.2.dirhold        [JOINT_2]DIRHOLD
setp stepgen.2.dirsetup       [JOINT_2]DIRSETUP

#setp stepgen.2.steplen        1
#setp stepgen.2.stepspace      0
#setp stepgen.2.dirhold        25000
#setp stepgen.2.dirsetup       25000

setp stepgen.2.maxaccel       [JOINT_2]STEPGEN_MAXACCEL
setp stepgen.2.maxvel         [JOINT_2]STEPGEN_MAX_VEL
setp stepgen.2.position-scale [JOINT_2]STEP_SCALE

net y2-pos-cmd joint.2.motor-pos-cmd => stepgen.2.position-cmd
net y2-pos-fb stepgen.2.position-fb  => joint.2.motor-pos-fb
net y2-enable joint.2.amp-enable-out => stepgen.2.enable

net both-home-y2                     => joint.2.home-sw-in
net both-home-y2                     => joint.2.neg-lim-sw-in
net both-home-y2                     => joint.2.pos-lim-sw-in

net y2-step                          <= stepgen.2.step
net y2-dir                           <= stepgen.2.dir



##############################################################################
#
# Z Axis
#
##############################################################################
setp stepgen.3.steplen        [JOINT_3]STEPLEN
setp stepgen.3.stepspace      [JOINT_3]STEPSPACE
setp stepgen.3.dirhold        [JOINT_3]DIRHOLD
setp stepgen.3.dirsetup       [JOINT_3]DIRSETUP

#setp stepgen.3.steplen        1
#setp stepgen.3.stepspace      0
#setp stepgen.3.dirhold        25000
#setp stepgen.3.dirsetup       25000

setp stepgen.3.maxaccel       [JOINT_3]STEPGEN_MAXACCEL
setp stepgen.3.maxvel         [JOINT_3]STEPGEN_MAX_VEL
setp stepgen.3.position-scale [JOINT_3]STEP_SCALE

net z-pos-cmd joint.3.motor-pos-cmd => stepgen.3.position-cmd
net z-pos-fb stepgen.3.position-fb  => joint.3.motor-pos-fb
net z-enable joint.3.amp-enable-out => stepgen.3.enable

net both-home-z                     => joint.3.home-sw-in
net both-home-z                     => joint.3.neg-lim-sw-in
net both-home-z                     => joint.3.pos-lim-sw-in

net z-step                          <= stepgen.3.step
net z-dir                           <= stepgen.3.dir



##############################################################################
#
#
#
##############################################################################
net estop-out <= iocontrol.0.user-enable-out
net estop-out => 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
# Generated by stepconf 1.1 at Fri Oct  4 22:01:28 2019
# Änderungen an dieser Datei werden beim nächsten
# Aufruf von stepconf überschrieben.

[EMC]
MACHINE = Dendroapi
DEBUG   = 0
VERSION = 1.1

[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 = 5.00
MIN_LINEAR_VELOCITY = 0
MAX_LINEAR_VELOCITY = 50.00
DEFAULT_ANGULAR_VELOCITY = 36.00
MIN_ANGULAR_VELOCITY = 0
MAX_ANGULAR_VELOCITY = 360.00
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/mantra/linuxcnc/nc_files
INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm

[KINS]
JOINTS     = 4
KINEMATICS = trivkins coordinates=XYYZ kinstype=BOTH

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

[TASK]
TASK       = milltask
CYCLE_TIME = 0.010

[RS274NGC]
PARAMETER_FILE = linuxcnc.var

[EMCMOT]
EMCMOT       = motmod
COMM_TIMEOUT = 1.0
BASE_PERIOD  = 100000
SERVO_PERIOD = 1000000

[HAL]
HALFILE         = Dendroapi.hal
HALFILE         = custom.hal
POSTGUI_HALFILE = postgui_call_list.hal

[TRAJ]
AXES                    = 3
JOINTS                  = 4
COORDINATES             = X Y Z
HOME                    = 0 0 0 0
LINEAR_UNITS            = mm
ANGULAR_UNITS           = degree
#DEFAULT_VELOCITY       = 
DEFAULT_LINEAR_VELOCITY = 36.00
MAX_LINEAR_VELOCITY     = 50.00
NO_FORCE_HOMING         = 1

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





##############################################################################
#
# X Axis joint
#
##############################################################################

[JOINT_0]
TYPE             = LINEAR
HOME             = 0.0
MIN_LIMIT        = -0.001
MAX_LIMIT        = 400.0
FERROR           = 1
MIN_FERROR       = .25
HOME_OFFSET      = 0.0
HOME_SEARCH_VEL  = 0
HOME_LATCH_VEL   = 0
HOME_USE_INDEX   = NO
HOME_SEQUENCE    = 0
HOME_FINAL_VEL   = 5
DIRSETUP         = 10000
DIRHOLD          = 10000
STEPLEN          = 6000
STEPSPACE        = 6000
STEP_SCALE       = 160
MAX_VELOCITY     = 5
MAX_ACCELERATION = 150
# 20 % higher
STEPGEN_MAX_VEL  = 6
STEPGEN_MAXACCEL = 180



[AXIS_X]
MAX_VELOCITY     = 5
MAX_ACCELERATION = 150
MIN_LIMIT        = -0.001
MAX_LIMIT        = 400.0




##############################################################################
#
# Y Axis 2 joints
#
##############################################################################

[JOINT_1]
TYPE             = LINEAR
HOME             = 0.0
MIN_LIMIT        = -0.001
MAX_LIMIT        = 400.0
FERROR           = 1
MIN_FERROR       = .25
HOME_OFFSET      = 0.0
HOME_SEARCH_VEL  = 0
HOME_LATCH_VEL   = 0
HOME_USE_INDEX   = NO
HOME_SEQUENCE    = -1
HOME_FINAL_VEL   = 5
DIRSETUP         = 10000
DIRHOLD          = 10000
STEPLEN          = 6000
STEPSPACE        = 6000
STEP_SCALE       = 160
MAX_VELOCITY     = 5
MAX_ACCELERATION = 150
# 20 % higher
STEPGEN_MAX_VEL  = 6
STEPGEN_MAXACCEL = 180



[JOINT_2]
TYPE             = LINEAR
HOME             = 0.0
MIN_LIMIT        = -0.001
MAX_LIMIT        = 400.0
FERROR           = 1
MIN_FERROR       = .25
HOME_OFFSET      = 0.0
HOME_SEARCH_VEL  = 0
HOME_LATCH_VEL   = 0
HOME_USE_INDEX   = NO
HOME_SEQUENCE    = -1
HOME_FINAL_VEL   = 5
DIRSETUP         = 10000
DIRHOLD          = 10000
STEPLEN          = 6000
STEPSPACE        = 6000
STEP_SCALE       = 160
MAX_VELOCITY     = 5
MAX_ACCELERATION = 150
# 20 % higher
STEPGEN_MAX_VEL  = 6
STEPGEN_MAXACCEL = 180



[AXIS_Y]
MAX_VELOCITY     = 5
MAX_ACCELERATION = 150
MIN_LIMIT        = -0.001
MAX_LIMIT        = 400.0



##############################################################################
#
# Z Axis joint
#
##############################################################################

[JOINT_3]
TYPE             = LINEAR
HOME             = 0.0
MIN_LIMIT        = -100
MAX_LIMIT        = 100
FERROR           = 1
MIN_FERROR       = .25
HOME_OFFSET      = 0.0
HOME_SEARCH_VEL  = 0
HOME_LATCH_VEL   = 0
HOME_USE_INDEX   = NO
HOME_SEQUENCE    = 2
HOME_FINAL_VEL   = 5
DIRSETUP         = 10000
DIRHOLD          = 10000
STEPLEN          = 6000
STEPSPACE        = 6000
STEP_SCALE       = 160
MAX_VELOCITY     = 5
MAX_ACCELERATION = 150
# 20 % higher
STEPGEN_MAX_VEL  = 6
STEPGEN_MAXACCEL = 180


[AXIS_Z]
MAX_VELOCITY     = 5
MAX_ACCELERATION = 150
MIN_LIMIT        = -100
MAX_LIMIT        = 100
Last edit: 07 Oct 2019 22:37 by millhouse_.

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

More
07 Oct 2019 23:11 - 07 Oct 2019 23:12 #147382 by millhouse_
If I use DoubleStep. Would this be the way to to do it?
Attachments:
Last edit: 07 Oct 2019 23:12 by millhouse_.

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

More
08 Oct 2019 13:05 - 08 Oct 2019 13:06 #147460 by Todd Zuercher
Since you have a 100000ns base-thread period I would strongly recommend keeping the double step option. It will allow your step motors to be able to take 1 step per base-thread cycle. Otherwise it will require two, (one to turn on the step signal, and then turn it off the next one.) That said there also will be no real advantage to having your step timing set as short as 5500ns as long as your base-thread is so long. You could set it much longer without seeing any performance hit, just don't go too long while using the double step feature, because the CPU is tied up while it counts down the reset time.

All that said, I'm not sure step timings have anything to do with your problems.
Could you restate exactly what your current problems are again?
Last edit: 08 Oct 2019 13:06 by Todd Zuercher.

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

More
08 Oct 2019 13:58 #147462 by millhouse_
Thanks for the reply.

I've created two configurations. One with DoubleStep and one without. The one without is working now. The DoubleStep one results in shuttering motors.

I don't know how to configure DoubleStep, but since the other works I haven't tried very hard. :whistle: If it really makes a difference I'll give it another try tomorrow.

The Base_Period was set by StepConf and it should be possible to lower the value.


Without DoubleStep (this one works, but still needs some adjustments for acceleration and velocity):

.ini
# Generated by stepconf 1.1 at Fri Oct  4 22:01:28 2019
# Änderungen an dieser Datei werden beim nächsten
# Aufruf von stepconf überschrieben.

[EMC]
MACHINE = Dendroapi
DEBUG   = 0
VERSION = 1.1

[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 = 5.00
MIN_LINEAR_VELOCITY = 0
MAX_LINEAR_VELOCITY = 50.00
DEFAULT_ANGULAR_VELOCITY = 36.00
MIN_ANGULAR_VELOCITY = 0
MAX_ANGULAR_VELOCITY = 360.00
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/mantra/linuxcnc/nc_files
INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm

[KINS]
JOINTS     = 4
KINEMATICS = trivkins coordinates=XYYZ kinstype=BOTH

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

[TASK]
TASK       = milltask
CYCLE_TIME = 0.010

[RS274NGC]
PARAMETER_FILE = linuxcnc.var

[EMCMOT]
EMCMOT       = motmod
COMM_TIMEOUT = 1.0
BASE_PERIOD  = 100000
SERVO_PERIOD = 1000000

[HAL]
HALFILE         = Dendroapi.hal
HALFILE         = custom.hal
POSTGUI_HALFILE = postgui_call_list.hal

[TRAJ]
AXES                    = 3
JOINTS                  = 4
COORDINATES             = X Y Z
HOME                    = 0 0 0 0
LINEAR_UNITS            = mm
ANGULAR_UNITS           = degree
#DEFAULT_VELOCITY       = 
DEFAULT_LINEAR_VELOCITY = 36.00
MAX_LINEAR_VELOCITY     = 50.00
NO_FORCE_HOMING         = 1

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





##############################################################################
#
# X Axis joint
#
##############################################################################

[JOINT_0]
TYPE             = LINEAR
HOME             = 0.0
MIN_LIMIT        = -0.001
MAX_LIMIT        = 400.0
FERROR           = 1
MIN_FERROR       = .25
HOME_OFFSET      = 0.0
HOME_SEARCH_VEL  = 0
HOME_LATCH_VEL   = 0
HOME_USE_INDEX   = NO
HOME_SEQUENCE    = 0
HOME_FINAL_VEL   = 5
DIRSETUP         = 10000
DIRHOLD          = 10000
STEPLEN          = 6000
STEPSPACE        = 6000
STEP_SCALE       = 160
MAX_VELOCITY     = 20
MAX_ACCELERATION = 100
# 20 % higher
STEPGEN_MAX_VEL  = 24
STEPGEN_MAXACCEL = 120




[AXIS_X]
MAX_VELOCITY     = 20
MAX_ACCELERATION = 100
MIN_LIMIT        = -0.001
MAX_LIMIT        = 400.0




##############################################################################
#
# Y Axis 2 joints
#
##############################################################################

[JOINT_1]
TYPE             = LINEAR
HOME             = 0.0
MIN_LIMIT        = -0.001
MAX_LIMIT        = 400.0
FERROR           = 1
MIN_FERROR       = .25
HOME_OFFSET      = 0.0
HOME_SEARCH_VEL  = 0
HOME_LATCH_VEL   = 0
HOME_USE_INDEX   = NO
HOME_SEQUENCE    = -1
HOME_FINAL_VEL   = 5
DIRSETUP         = 10000
DIRHOLD          = 10000
STEPLEN          = 6000
STEPSPACE        = 6000
STEP_SCALE       = 160
MAX_VELOCITY     = 20
MAX_ACCELERATION = 100
# 20 % higher
STEPGEN_MAX_VEL  = 24
STEPGEN_MAXACCEL = 120




[JOINT_2]
TYPE             = LINEAR
HOME             = 0.0
MIN_LIMIT        = -0.001
MAX_LIMIT        = 400.0
FERROR           = 1
MIN_FERROR       = .25
HOME_OFFSET      = 0.0
HOME_SEARCH_VEL  = 0
HOME_LATCH_VEL   = 0
HOME_USE_INDEX   = NO
HOME_SEQUENCE    = -1
HOME_FINAL_VEL   = 5
DIRSETUP         = 10000
DIRHOLD          = 10000
STEPLEN          = 6000
STEPSPACE        = 6000
STEP_SCALE       = 160
MAX_VELOCITY     = 20
MAX_ACCELERATION = 100
# 20 % higher
STEPGEN_MAX_VEL  = 24
STEPGEN_MAXACCEL = 120




[AXIS_Y]
MAX_VELOCITY     = 20
MAX_ACCELERATION = 100
MIN_LIMIT        = -0.001
MAX_LIMIT        = 400.0



##############################################################################
#
# Z Axis joint
#
##############################################################################

[JOINT_3]
TYPE             = LINEAR
HOME             = 0.0
MIN_LIMIT        = -100
MAX_LIMIT        = 100
FERROR           = 1
MIN_FERROR       = .25
HOME_OFFSET      = 0.0
HOME_SEARCH_VEL  = 0
HOME_LATCH_VEL   = 0
HOME_USE_INDEX   = NO
HOME_SEQUENCE    = 2
HOME_FINAL_VEL   = 5
DIRSETUP         = 10000
DIRHOLD          = 10000
STEPLEN          = 5050
STEPSPACE        = 5050
STEP_SCALE       = 160
MAX_VELOCITY     = 20
MAX_ACCELERATION = 100
# 20 % higher
STEPGEN_MAX_VEL  = 24
STEPGEN_MAXACCEL = 120


[AXIS_Z]
MAX_VELOCITY     = 20
MAX_ACCELERATION = 100
MIN_LIMIT        = -100
MAX_LIMIT        = 100


.hal
# Generated by stepconf 1.1 at Fri Oct  4 22:01:28 2019
# Änderungen an dieser Datei werden beim nächsten
# Aufruf von stepconf überschrieben.
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="1 out"

#setp parport.0.reset-time 3500
#setp parport.0.reset-time 5500


loadrt stepgen step_type=0,0,0,0
loadrt pwmgen output_type=1

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 stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
addf pwmgen.update servo-thread


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 100.0
setp pwmgen.0.scale 1166.66666667
setp pwmgen.0.offset 0.114285714286
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 spindle-cw          <= spindle.0.forward
net estop-out       => parport.0.pin-01-out
net spindle-cw      => parport.0.pin-14-out
net spindle-pwm     => parport.0.pin-16-out
#net xenable         => parport.0.pin-17-out

##############################################################################
#
# DIR/STEP Driver Pins
#
##############################################################################
net x-step          => parport.0.pin-02-out
#setp parport.0.pin-02-out-reset 1
setp parport.0.pin-02-out-invert 1

net x-dir           => parport.0.pin-03-out
setp parport.0.pin-03-out-invert 1

net y-step          => parport.0.pin-04-out
#setp parport.0.pin-04-out-reset 1
setp parport.0.pin-04-out-invert 1

net y-dir           => parport.0.pin-05-out
#setp parport.0.pin-05-out-invert 1

net z-step          => parport.0.pin-06-out
#setp parport.0.pin-06-out-reset 1
setp parport.0.pin-06-out-invert 1
net z-dir           => parport.0.pin-07-out
setp parport.0.pin-07-out-invert 1

net y2-step         => parport.0.pin-08-out
#setp parport.0.pin-08-out-reset 1
setp parport.0.pin-08-out-invert 1
net y2-dir          => parport.0.pin-09-out
setp parport.0.pin-09-out-invert 1

 
##############################################################################
#
#
#
##############################################################################
#net both-home-x    <= parport.0.pin-12-in
#net both-home-y    <= parport.0.pin-13-in
#net both-home-y2   <= parport.0.pin-11-in
#net both-home-z    <= parport.0.pin-15-in




##############################################################################
#
# X Axis
#
##############################################################################
setp stepgen.0.steplen        [JOINT_0]STEPLEN
setp stepgen.0.stepspace      [JOINT_0]STEPSPACE
setp stepgen.0.dirhold        [JOINT_0]DIRHOLD
setp stepgen.0.dirsetup       [JOINT_0]DIRSETUP

#setp stepgen.0.steplen        1
#setp stepgen.0.stepspace      0
#setp stepgen.0.dirhold        25000
#setp stepgen.0.dirsetup       25000

setp stepgen.0.maxaccel       [JOINT_0]STEPGEN_MAXACCEL
setp stepgen.0.maxvel         [JOINT_0]STEPGEN_MAX_VEL
setp stepgen.0.position-scale [JOINT_0]STEP_SCALE

net x-pos-cmd joint.0.motor-pos-cmd => stepgen.0.position-cmd
net x-pos-fb stepgen.0.position-fb  => joint.0.motor-pos-fb
net x-enable joint.0.amp-enable-out => stepgen.0.enable

net both-home-x                     => joint.0.home-sw-in
net both-home-x                     => joint.0.neg-lim-sw-in
net both-home-x                     => joint.0.pos-lim-sw-in

net x-step                          <= stepgen.0.step
net x-dir                           <= stepgen.0.dir



##############################################################################
#
# Y Axis left
#
##############################################################################
setp stepgen.1.steplen        [JOINT_1]STEPLEN
setp stepgen.1.stepspace      [JOINT_1]STEPSPACE
setp stepgen.1.dirhold        [JOINT_1]DIRHOLD
setp stepgen.1.dirsetup       [JOINT_1]DIRSETUP

#setp stepgen.1.steplen        1
#setp stepgen.1.stepspace      0
#setp stepgen.1.dirhold        25000
#setp stepgen.1.dirsetup       25000

setp stepgen.1.maxaccel       [JOINT_1]STEPGEN_MAXACCEL
setp stepgen.1.maxvel         [JOINT_1]STEPGEN_MAX_VEL
setp stepgen.1.position-scale [JOINT_1]STEP_SCALE

net y-pos-cmd joint.1.motor-pos-cmd => stepgen.1.position-cmd
net y-pos-fb stepgen.1.position-fb  => joint.1.motor-pos-fb
net y-enable joint.1.amp-enable-out => stepgen.1.enable

net both-home-y                     => joint.1.home-sw-in
net both-home-y                     => joint.1.neg-lim-sw-in
net both-home-y                     => joint.1.pos-lim-sw-in

net y-step                          <= stepgen.1.step
net y-dir                           <= stepgen.1.dir



##############################################################################
#
# Y Axis right
#
##############################################################################
setp stepgen.2.steplen        [JOINT_2]STEPLEN
setp stepgen.2.stepspace      [JOINT_2]STEPSPACE
setp stepgen.2.dirhold        [JOINT_2]DIRHOLD
setp stepgen.2.dirsetup       [JOINT_2]DIRSETUP

#setp stepgen.2.steplen        1
#setp stepgen.2.stepspace      0
#setp stepgen.2.dirhold        25000
#setp stepgen.2.dirsetup       25000

setp stepgen.2.maxaccel       [JOINT_2]STEPGEN_MAXACCEL
setp stepgen.2.maxvel         [JOINT_2]STEPGEN_MAX_VEL
setp stepgen.2.position-scale [JOINT_2]STEP_SCALE

net y2-pos-cmd joint.2.motor-pos-cmd => stepgen.2.position-cmd
net y2-pos-fb stepgen.2.position-fb  => joint.2.motor-pos-fb
net y2-enable joint.2.amp-enable-out => stepgen.2.enable

net both-home-y2                     => joint.2.home-sw-in
net both-home-y2                     => joint.2.neg-lim-sw-in
net both-home-y2                     => joint.2.pos-lim-sw-in

net y2-step                          <= stepgen.2.step
net y2-dir                           <= stepgen.2.dir



##############################################################################
#
# Z Axis
#
##############################################################################
setp stepgen.3.steplen        [JOINT_3]STEPLEN
setp stepgen.3.stepspace      [JOINT_3]STEPSPACE
setp stepgen.3.dirhold        [JOINT_3]DIRHOLD
setp stepgen.3.dirsetup       [JOINT_3]DIRSETUP

#setp stepgen.3.steplen        1
#setp stepgen.3.stepspace      0
#setp stepgen.3.dirhold        25000
#setp stepgen.3.dirsetup       25000

setp stepgen.3.maxaccel       [JOINT_3]STEPGEN_MAXACCEL
setp stepgen.3.maxvel         [JOINT_3]STEPGEN_MAX_VEL
setp stepgen.3.position-scale [JOINT_3]STEP_SCALE

net z-pos-cmd joint.3.motor-pos-cmd => stepgen.3.position-cmd
net z-pos-fb stepgen.3.position-fb  => joint.3.motor-pos-fb
net z-enable joint.3.amp-enable-out => stepgen.3.enable

net both-home-z                     => joint.3.home-sw-in
net both-home-z                     => joint.3.neg-lim-sw-in
net both-home-z                     => joint.3.pos-lim-sw-in

net z-step                          <= stepgen.3.step
net z-dir                           <= stepgen.3.dir



##############################################################################
#
#
#
##############################################################################
net estop-out <= iocontrol.0.user-enable-out
net estop-out => 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

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

More
08 Oct 2019 14:12 - 08 Oct 2019 14:13 #147463 by Todd Zuercher
With the double step active try setting the reset time to 10000, or even 20000. and test it and see if it works as good as without.

When you are not using the double step option, it is the equivalent of having your minimum step times equal to the base thread (if the times are less than 1 base-thread period), so in your case =100000ns. If your computer could run a 50000 or 30000ns base-tread without real time delays, then it would probably work much better at software stepping.

Are you getting any "unexpected realtime delay" alarms when starting or running Linuxcnc?
Last edit: 08 Oct 2019 14:13 by Todd Zuercher.

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

More
08 Oct 2019 17:19 #147472 by millhouse_
I'll try that tomorrow.

No errors so far. In DualStep Mode the stepper behaved like in "normal" mode with to less steplen.

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

Time to create page: 0.117 seconds
Powered by Kunena Forum