Problem getting GS2 drive to work

More
16 Jan 2016 20:42 - 16 Jan 2016 22:59 #68537 by Davenc
I'm finishing up a grizzly G0602 conversion and am having trouble getting the GS2 to turn. I've verified the following steps multiple times.

1) My encoders are working because I can cut air threads on the lathe. I tested cutting air threads before I switched the GS2 over to serial port control. I'm using an index pulse with both phase A and B and have verified they are outputting correctly with a Oscope i.e. and 90 degree difference between phase A & B.
2) I've tested the GS2 drive numerous times manually so I know at least that part of it works.
3) I've verified I have the 9 pin serial port in enabled in bios and I can see it when I issue | grep tty command
4) I've gone through the GS2 drive settings multiple times and they are what they are supposed to be from the documentation on linuxcnc including adding the motor parms into the drive.
5) I've verified the cable connecting the drive to the serial port, I've even ohm'ed the cable point to point and its good. Only three wires, kind of hard to mess up 3 wires and I used an automation direct document showing the wiring from an RJ11 connector to a DB9 connector.
6) I've added the hal commands from this link to my custom hal file. www.linuxcnc.org/docs/2.4/html/examples_gs2_example.html

Here's the relevant entries in the hal files. Note that I combined the relevant entries into one file, this isn't how it's configured in linuxcnc the entries are in their proper place.

# Include your customized HAL commands here
# This file will not be overwritten when you run stepconf again

# load the user space component for the Automation Direct GS2 VFD's
loadusr -Wn spindle-vfd gs2_vfd -n spindle-vfd

# connect the spindle direction pin to the GS2
net gs2-fwd spindle-vfd.spindle-fwd <= motion.spindle-forward

# connect the spindle on pin to the GS2
net gs2-run spindle-vfd.spindle-on <= motion.spindle-on

# connect the GS2 at speed to the motion at speed
net gs2-at-speed motion.spindle-at-speed <= spindle-vfd.at-speed

# connect the spindle RPM to the GS2
net gs2-RPM spindle-vfd.speed-command <= motion.spindle-speed-out

loadrt trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt hal_parport cfg="0 out"
setp parport.0.reset-time 1000
loadrt stepgen step_type=0,0
loadrt encoder num_chan=1
loadrt abs count=1
loadrt scale count=1
loadrt lowpass count=1

addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf encoder.update-counters base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread

addf stepgen.capture-position servo-thread
addf encoder.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
addf abs.0 servo-thread
addf scale.0 servo-thread
addf lowpass.0 servo-thread

setp encoder.0.position-scale 80.000000
#setp encoder.0.counter-mode false
setp encoder.0.x4-mode true
net spindle-position encoder.0.position => motion.spindle-revs
net spindle-velocity-feedback-rps encoder.0.velocity => motion.spindle-speed-in
net spindle-index-enable encoder.0.index-enable <=> motion.spindle-index-enable
net spindle-phase-a encoder.0.phase-A
net spindle-phase-b encoder.0.phase-B
net spindle-index encoder.0.phase-Z

net xstep => parport.0.pin-02-out
setp parport.0.pin-02-out-reset 1
net xdir => parport.0.pin-03-out
net zstep => parport.0.pin-06-out
setp parport.0.pin-06-out-reset 1
net zdir => parport.0.pin-07-out
net spindle-index <= parport.0.pin-11-in
net spindle-phase-a <= parport.0.pin-12-in
net spindle-phase-b <= parport.0.pin-13-in

Not sure what my next step is but I'd like to know whether or not I have any errors in the hal stuff. BTW I used Andy's custom lathe gui to test out the air threads and it worked but the program stops at the beginning of the gcode file because the spindle isn't turning. I did try to manually startup the spindle using M3 S commands. Also I'm using the latest linuxcnc version 2.7.3.

How to check to see if my serial port is connecting to the GS2 which apparently it's not or the spindle would be turning.

Thanks for the help,
Dave
Last edit: 16 Jan 2016 22:59 by Davenc.

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

More
17 Jan 2016 11:55 #68582 by BigJohnT
This is my spindle using the GS2

# Spindle Drive
loadusr -Wn spindle-vfd gs2_vfd -s 2 -p none -n spindle-vfd -v
# connect the spindle direction pin to the GS2
net gs2-fwd spindle-vfd.spindle-fwd <= motion.spindle-forward
# connect the spindle on pin to the GS2
net gs2-run spindle-vfd.spindle-on <= motion.spindle-on
# connect the GS2 at speed to the motion at speed
net gs2-at-speed motion.spindle-at-speed <= spindle-vfd.at-speed
# connect the spindle RPM to the GS2
net gs2-RPM spindle-vfd.speed-command <= motion.spindle-speed-out
#vfd panel fan
net gs2-run => hm2_5i25.0.7i77.0.0.output-03

# Spindle Encoder
setp hm2_5i25.0.encoder.03.scale 10000
net spindle-position hm2_5i25.0.encoder.03.position => motion.spindle-revs
net spindle-velocity hm2_5i25.0.encoder.03.velocity => motion.spindle-speed-in
net spindle-index-enable hm2_5i25.0.encoder.03.index-enable <=> motion.spindle-index-enable

There are some settings in the drive you must do before it can be controlled by the gs2 component. I'll look when I get out to the shop.

JT

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

More
17 Jan 2016 12:49 #68583 by Davenc
John,
Thanks for making me look at this again I just found the obvious.

I had this = loadusr -Wn spindle-vfd gs2_vfd -n spindle-vfd

When I should have had this = loadusr -Wn spindle-vfd gs2_vfd -r 9600 -p none -s 2 -n spindle-vfd

Not quite sure how that happened when I thought I copied and pasted the whole list. The drive is now turning the motor.

Thanks,
Dave

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

Time to create page: 0.164 seconds
Powered by Kunena Forum