On Wed, 21 Aug 2019, John Dammeyer wrote:

Date: Wed, 21 Aug 2019 15:18:25 -0700
From: John Dammeyer <[email protected]>
Reply-To: "Enhanced Machine Controller (EMC)"
    <[email protected]>
To: "'Enhanced Machine Controller (EMC)'" <[email protected]>
Subject: Re: [Emc-users] MESA 7i92H Saga

Thanks Peter,
I've got pulses coming out the Spindle Pins on connector P1.
While snooping with the scope and looking at the generated signals I've run 
into an issue.  I haven't looked at any other axis but the following 
information has to do with the X axis.  The attached screen shot shows the 
pulses as I let off on the jog button for the X axis.

Scope trigger is on the direction signal (blue trace) falling edge.
Notice after the 2uS step pulses (yellow trace) have stopped the direction 
signal changes 3 times.
Why?

This has to do with the stepgen control loop having much greater
resolution than a single step so tiny corrections may change the
direction (though timing is always obeyed). It may also have to do with PID setup.




I'm also seeing occasional joint 0 following errors when I change direction 
which is what prompted putting the scope on the signals.  It's open loop 
step/dir with no encoder feedback so something is not quite right.


try commenting out these lines (for all axis)

net x-vel-cmd       =>  pid.x.command-deriv
setp   pid.x.maxerror .0005


Here's the ini file parameters for this axis.  Below that the hal file 
originally created by pncconfig.  Should not
setp   hm2_7i92.0.stepgen.00.control-type     1
be control-type 0?


No, needs to be 1



#********************
# Axis X
#********************
[AXIS_0]
TYPE = LINEAR
HOME = 0.0
FERROR = 0.05
MIN_FERROR = 0.01
MAX_VELOCITY = 2.5
MAX_ACCELERATION = 15.0
# The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION
# If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger.
STEPGEN_MAXVEL = 3.125
STEPGEN_MAXACCEL = 18.75
P = 1000.0
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 0.0
# these are in nanoseconds
DIRSETUP   = 1000
DIRHOLD    = 1000
STEPLEN    = 2000
STEPSPACE  = 1000
STEP_SCALE = 15000.0
MIN_LIMIT = -0.04
MAX_LIMIT = 13.5
BACKLASH = 0.0215
#BACKLASH = 0.0236
HOME_OFFSET = -0.1
HOME_SEARCH_VEL = -0.8
HOME_LATCH_VEL = 0.01
HOME_FINAL_VEL = 0.2
HOME_IGNORE_LIMITS = YES
HOME_VOLATILE = 1
HOME_SEQUENCE = 1

#*******************
#  AXIS X
#*******************
setp   pid.x.Pgain     [AXIS_0]P
setp   pid.x.Igain     [AXIS_0]I
setp   pid.x.Dgain     [AXIS_0]D
setp   pid.x.bias      [AXIS_0]BIAS
setp   pid.x.FF0       [AXIS_0]FF0
setp   pid.x.FF1       [AXIS_0]FF1
setp   pid.x.FF2       [AXIS_0]FF2
setp   pid.x.deadband  [AXIS_0]DEADBAND
setp   pid.x.maxoutput [AXIS_0]MAX_OUTPUT
setp   pid.x.error-previous-target true
setp   pid.x.maxerror .0005

net x-index-enable  <=> pid.x.index-enable
net x-enable        =>  pid.x.enable
net x-pos-cmd       =>  pid.x.command
net x-vel-cmd       =>  pid.x.command-deriv
net x-pos-fb        =>  pid.x.feedback
net x-output        =>  pid.x.output

# Step Gen signals/setup
setp   hm2_7i92.0.stepgen.00.dirsetup        [AXIS_0]DIRSETUP
setp   hm2_7i92.0.stepgen.00.dirhold         [AXIS_0]DIRHOLD
setp   hm2_7i92.0.stepgen.00.steplen         [AXIS_0]STEPLEN
setp   hm2_7i92.0.stepgen.00.stepspace       [AXIS_0]STEPSPACE
setp   hm2_7i92.0.stepgen.00.position-scale  [AXIS_0]STEP_SCALE
setp   hm2_7i92.0.stepgen.00.step_type        0
setp   hm2_7i92.0.stepgen.00.control-type     1
setp   hm2_7i92.0.stepgen.00.maxaccel         [AXIS_0]STEPGEN_MAXACCEL
setp   hm2_7i92.0.stepgen.00.maxvel           [AXIS_0]STEPGEN_MAXVEL

# ---closedloop stepper signals---

net x-pos-cmd    <= axis.0.motor-pos-cmd
net x-vel-cmd    <= axis.0.joint-vel-cmd
net x-output     => hm2_7i92.0.stepgen.00.velocity-cmd
net x-pos-fb     <= hm2_7i92.0.stepgen.00.position-fb
net x-pos-fb     => axis.0.motor-pos-fb
net x-enable     <= axis.0.amp-enable-out
net x-enable     => hm2_7i92.0.stepgen.00.enable



I think the best way to do this is to use a working configuration and add the
stepgen spindle control manually to the hal file. Its really not that complex
to do by hand, and if the configurator doesn't not know how to make a
step/dir controlled spindle and you add more stepgens by adding more axis
you
will just have a mess...

1. You don't need any more axis
2. You will need to enable 6 stepgens (0..5) in the driver load line
3. You need to setup stepgen 5 in velocity mode and scale it appropriately
    (scale will be pulses per turn if you link the stepgen rate to the spindle
     speed in RPS or 60*steps per turn if you use the RPM spindle speed)
4. Next you need to net the spindle speed from motion to stepgen 5s
velocity
    command
5. You probable also should net stepgen 5's enable to motions spindle
enable
    (so the step rate is forced to 0 when the spindle is disabled)

Unless you have looked at a hal file these may seem pretty mysterious but
here
are some things that should help:

http://linuxcnc.org/docs/html/hal/tutorial.html

also man pages:

man motion
man hostmot2

To show actual pins/parameter/signals of a running LinuxCNC instance:

halcmd show all > all.txt

all.txt now has all pins,parameters, signals and functions of you current
running LinuxCNC system, and can be a great copy/paste donor file so you
dont
need to guess at names


Peter Wallace
Mesa Electronics


_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users


Peter Wallace
Mesa Electronics

(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(")_(") signature to help him gain world domination.



_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to