Spindel problems in Gmoccapy
- tecno
 - 
				
									Topic Author
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 1850
 - Thank you received: 127
 
			
	
						28 Apr 2017 15:52		 -  28 Apr 2017 15:53		#92279
		by tecno
	
	
		
			
	
	
	
			 		
													
	
				Replied by tecno on topic Spindel problems in Gmoccapy			
			
					
		Last edit: 28 Apr 2017 15:53  by tecno.			
			Please Log in or Create an account to join the conversation.
- Todd Zuercher
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 4686
 - Thank you received: 1433
 
			
	
						28 Apr 2017 16:15		 -  28 Apr 2017 16:21		#92281
		by Todd Zuercher
	
	
		
			
	
	
			 		
													
	
				Replied by Todd Zuercher on topic Spindel problems in Gmoccapy			
			
				You have 3 lines that are essentially trying to do the same thing twice.
These two lines
net spindle-index => encoder.0.phase-Z => encoder.0.phase-A
net spindle-index <= parport.0.pin-10-in
and this one line are functionally equivalent, except for the signal name.
net spindle_index parport.0.pin-10-in => encoder.0.phase-A => encoder.0.phase-Z
Here I've deleted the offending line and reconnected the original parallel port pin line.			
					These two lines
net spindle-index => encoder.0.phase-Z => encoder.0.phase-A
net spindle-index <= parport.0.pin-10-in
and this one line are functionally equivalent, except for the signal name.
net spindle_index parport.0.pin-10-in => encoder.0.phase-A => encoder.0.phase-Z
Here I've deleted the offending line and reconnected the original parallel port pin line.
# Generated by stepconf 1.1 at Mon Apr 17 15:16:45 2017
# If you make changes to this file, they will be
# overwritten when you run stepconf again
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="0x378 out"
setp parport.0.reset-time 5000
loadrt stepgen step_type=0,0,0 ctrl_type=p,p,v
loadrt charge_pump
setp charge-pump.enable 1
net charge-pump <= charge-pump.out
loadrt encoder num_chan=1
loadrt scale count=1
loadrt near
net spindle-cmd-rpm => stepgen.2.velocity-cmd
setp stepgen.2.position-scale 0.9 #steps/RPM
setp stepgen.2.steplen 5000
setp stepgen.2.stepspace 5000
#setp stepgen.2.dirdelay 35000
setp stepgen.2.maxaccel 5000
addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf charge-pump base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread
addf encoder.update-counters base-thread
addf encoder.capture-position servo-thread
addf scale.0 servo-thread
addf near.0 servo-thread
addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
net spindle-index => encoder.0.phase-Z => encoder.0.phase-A
net spindle-cmd-rpm     <= motion.spindle-speed-out
net spindle-cmd-rpm-abs <= motion.spindle-speed-out-abs
net spindle-cmd-rps     <= motion.spindle-speed-out-rps
net spindle-cmd-rps-abs <= motion.spindle-speed-out-rps-abs
net spindle-at-speed    => motion.spindle-at-speed
net spindle-enable <= motion.spindle-on => stepgen.2.enable
net spindle-cw <= stepgen.2.step
net spindle-ccw <= stepgen.2.dir
#setp encoder.0.counter-mode 1
setp encoder.0.position-scale 1
setp encoder.0.counter-mode 1
setp encoder.0.x4-mode FALSE
setp scale.0.gain 60
setp near.0.scale 1.2
setp near.0.difference 10
net spindle-cmd => near.0.in1
net spindle-rpm => near.0.in2
net spindle-at-speed near.0.out => motion.spindle-at-speed
net coolant-flood <= iocontrol.0.coolant-flood
net xstep           => parport.0.pin-02-out
setp parport.0.pin-02-out-reset 1
net xdir            => parport.0.pin-03-out
#setp parport.0.pin-04-out-invert 1
net zstep           => parport.0.pin-04-out
setp parport.0.pin-04-out-reset 1
setp parport.0.pin-05-out-invert 1
net zdir            => parport.0.pin-05-out
net spindle-cw      => parport.0.pin-06-out
net spindle-ccw     => parport.0.pin-07-out
net coolant-flood   => parport.0.pin-09-out
net charge-pump     => parport.0.pin-14-out
net spindle-index   <= parport.0.pin-10-in
net home-z          <= parport.0.pin-11-in-not
net home-x          <= parport.0.pin-12-in-not
net estop-ext       <= parport.0.pin-15-in-not
net spindle-index-enable motion.spindle-index-enable <=> encoder.0.index-enable
net spindle-rps encoder.0.velocity => scale.0.in
net spindle-rpm scale.0.out
setp stepgen.0.position-scale [AXIS_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 35000
setp stepgen.0.dirsetup 35000
setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL
net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable axis.0.amp-enable-out => stepgen.0.enable
net home-x => axis.0.home-sw-in
setp stepgen.1.position-scale [AXIS_2]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 35000
setp stepgen.1.dirsetup 35000
setp stepgen.1.maxaccel [AXIS_2]STEPGEN_MAXACCEL
net zpos-cmd axis.2.motor-pos-cmd => stepgen.1.position-cmd
net zpos-fb stepgen.1.position-fb => axis.2.motor-pos-fb
net zstep <= stepgen.1.step
net zdir <= stepgen.1.dir
net zenable axis.2.amp-enable-out => stepgen.1.enable
net home-z => axis.2.home-sw-in
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
		Last edit: 28 Apr 2017 16:21  by Todd Zuercher.			
			Please Log in or Create an account to join the conversation.
- tecno
 - 
				
									Topic Author
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 1850
 - Thank you received: 127
 
			
	
						28 Apr 2017 16:27		 -  28 Apr 2017 16:42		#92282
		by tecno
	
	
		
			
	
	
			 		
													
	
				Replied by tecno on topic Spindel problems in Gmoccapy			
			
				Now no errors so  I can start. But still no rpm show on screen.
I am a bit suspicious on the pulse length that Mach needs quite long pulse.
So maybe there must be some filters schmitt-trigger to make pulse suitable for LCNC.
How to measure incoming pulse width on pin 10?
Found the halscope in gmoccapy. pulsewidth 45/46 ms at low rpm of approx 200rpm
					I am a bit suspicious on the pulse length that Mach needs quite long pulse.
So maybe there must be some filters schmitt-trigger to make pulse suitable for LCNC.
How to measure incoming pulse width on pin 10?
Found the halscope in gmoccapy. pulsewidth 45/46 ms at low rpm of approx 200rpm
		Last edit: 28 Apr 2017 16:42  by tecno.			
			Please Log in or Create an account to join the conversation.
- Todd Zuercher
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 4686
 - Thank you received: 1433
 
			
	
						28 Apr 2017 16:51		 -  28 Apr 2017 16:51		#92286
		by Todd Zuercher
	
	
		
			
	
	
			 		
													
	
				Replied by Todd Zuercher on topic Spindel problems in Gmoccapy			
			
				You can easily look at parport.0.pin-10-in with Halscope.
But there are some other issues.
Not sure why you added a scale component for the encoder, the encoder has a scale built in.
Try this:			
					But there are some other issues.
Not sure why you added a scale component for the encoder, the encoder has a scale built in.
Try this:
# Generated by stepconf 1.1 at Mon Apr 17 15:16:45 2017
# If you make changes to this file, they will be
# overwritten when you run stepconf again
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="0x378 out"
setp parport.0.reset-time 5000
loadrt stepgen step_type=0,0,0 ctrl_type=p,p,v
loadrt charge_pump
setp charge-pump.enable 1
net charge-pump <= charge-pump.out
loadrt encoder num_chan=1
loadrt scale count=1
loadrt near
net spindle-cmd-rpm => stepgen.2.velocity-cmd
setp stepgen.2.position-scale 0.9 #steps/RPM
setp stepgen.2.steplen 5000
setp stepgen.2.stepspace 5000
#setp stepgen.2.dirdelay 35000
setp stepgen.2.maxaccel 5000
addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf charge-pump base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread
addf encoder.update-counters base-thread
addf encoder.capture-position servo-thread
addf scale.0 servo-thread
addf near.0 servo-thread
addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
net spindle-index => encoder.0.phase-Z => encoder.0.phase-A
net spindle-cmd-rpm     <= motion.spindle-speed-out
net spindle-cmd-rpm-abs <= motion.spindle-speed-out-abs
net spindle-cmd-rps     <= motion.spindle-speed-out-rps
net spindle-cmd-rps-abs <= motion.spindle-speed-out-rps-abs
net spindle-at-speed    => motion.spindle-at-speed
net spindle-position encoder.0.position => motion.spindle-revs
net spindle-velocity  encoder.0.velocity => motion.spindle-speed-in
net spindle-enable <= motion.spindle-on => stepgen.2.enable
net spindle-cw <= stepgen.2.step
net spindle-ccw <= stepgen.2.dir
#setp encoder.0.counter-mode 1
setp encoder.0.position-scale 1
setp encoder.0.counter-mode 1
setp encoder.0.x4-mode FALSE
setp scale.0.gain 60
setp near.0.scale 1.2
setp near.0.difference 10
net spindle-cmd => near.0.in1
net spindle-rpm => near.0.in2
net spindle-at-speed near.0.out => motion.spindle-at-speed
net coolant-flood <= iocontrol.0.coolant-flood
net xstep           => parport.0.pin-02-out
setp parport.0.pin-02-out-reset 1
net xdir            => parport.0.pin-03-out
#setp parport.0.pin-04-out-invert 1
net zstep           => parport.0.pin-04-out
setp parport.0.pin-04-out-reset 1
setp parport.0.pin-05-out-invert 1
net zdir            => parport.0.pin-05-out
net spindle-cw      => parport.0.pin-06-out
net spindle-ccw     => parport.0.pin-07-out
net coolant-flood   => parport.0.pin-09-out
net charge-pump     => parport.0.pin-14-out
net spindle-index   <= parport.0.pin-10-in
net home-z          <= parport.0.pin-11-in-not
net home-x          <= parport.0.pin-12-in-not
net estop-ext       <= parport.0.pin-15-in-not
net spindle-index-enable motion.spindle-index-enable <=> encoder.0.index-enable
#net spindle-rps encoder.0.velocity => scale.0.in
#net spindle-rpm scale.0.out
setp stepgen.0.position-scale [AXIS_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 35000
setp stepgen.0.dirsetup 35000
setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL
net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable axis.0.amp-enable-out => stepgen.0.enable
net home-x => axis.0.home-sw-in
setp stepgen.1.position-scale [AXIS_2]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 35000
setp stepgen.1.dirsetup 35000
setp stepgen.1.maxaccel [AXIS_2]STEPGEN_MAXACCEL
net zpos-cmd axis.2.motor-pos-cmd => stepgen.1.position-cmd
net zpos-fb stepgen.1.position-fb => axis.2.motor-pos-fb
net zstep <= stepgen.1.step
net zdir <= stepgen.1.dir
net zenable axis.2.amp-enable-out => stepgen.1.enable
net home-z => axis.2.home-sw-in
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
		Last edit: 28 Apr 2017 16:51  by Todd Zuercher.			
			Please Log in or Create an account to join the conversation.
- tecno
 - 
				
									Topic Author
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 1850
 - Thank you received: 127
 
			
	
						28 Apr 2017 17:04				#92288
		by tecno
	
	
		
			
	
			
			 		
													
	
				Replied by tecno on topic Spindel problems in Gmoccapy			
			
				Scale is in Norberts code
No difference, still same 45-46ms pulse width
					No difference, still same 45-46ms pulse width
Please Log in or Create an account to join the conversation.
- Todd Zuercher
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 4686
 - Thank you received: 1433
 
			
	
						28 Apr 2017 18:30				#92296
		by Todd Zuercher
	
	
		
			
	
			
			 		
													
	
				Replied by Todd Zuercher on topic Spindel problems in Gmoccapy			
			
				Sorry, I didn't look close enough to Norbert's post.
Changing this line I think might get you there.
net spindle-velocity encoder.0.velocity => motion.spindle-speed-in
to
net spindle-rpm encoder.0.velocity => motion.spindle-speed-in
Sorry about that.
					Changing this line I think might get you there.
net spindle-velocity encoder.0.velocity => motion.spindle-speed-in
to
net spindle-rpm encoder.0.velocity => motion.spindle-speed-in
Sorry about that.
Please Log in or Create an account to join the conversation.
- tecno
 - 
				
									Topic Author
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 1850
 - Thank you received: 127
 
			
	
						28 Apr 2017 19:45				#92302
		by tecno
	
	
		
			
	
			
			 		
													
	
				Replied by tecno on topic Spindel problems in Gmoccapy			
			
				Will try this tomorrow, thanks.			
					Please Log in or Create an account to join the conversation.
- tecno
 - 
				
									Topic Author
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 1850
 - Thank you received: 127
 
			
	
						29 Apr 2017 09:34		 -  29 Apr 2017 09:35		#92324
		by tecno
	
	
		
			
				
No such line in hal!
Added that line, nothing. No numbers showing real rpm yet.
					
	
	
	
			 		
													
	
				Replied by tecno on topic Spindel problems in Gmoccapy			
			Sorry, I didn't look close enough to Norbert's post.
Changing this line I think might get you there.
net spindle-velocity encoder.0.velocity => motion.spindle-speed-in
to
net spindle-rpm encoder.0.velocity => motion.spindle-speed-in
Sorry about that.
No such line in hal!
Added that line, nothing. No numbers showing real rpm yet.
		Last edit: 29 Apr 2017 09:35  by tecno.			
			Please Log in or Create an account to join the conversation.
- newbynobi
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 1929
 - Thank you received: 393
 
			
	
						29 Apr 2017 09:47		 -  29 Apr 2017 09:48		#92327
		by newbynobi
	
	
		
			
	
	
	
			 		
													
	
				Replied by newbynobi on topic Spindel problems in Gmoccapy			
			
				I have tried to get your hal file OK.
So first I splitted it up. So in your INI you must load two hal files and one postgui hal file. Please find the modified files attached.
I did that, because this way it is easier to maintain and debug and correct.
I would recommend to split it even more so that you have one file for each part of your machine.
Please see also, that I did a little formating.
Also included the gmoccapy tool change and the tool offset connections.
Norbert
P.S. you must rename the files to fit your needs.
					So first I splitted it up. So in your INI you must load two hal files and one postgui hal file. Please find the modified files attached.
I did that, because this way it is easier to maintain and debug and correct.
I would recommend to split it even more so that you have one file for each part of your machine.
Please see also, that I did a little formating.
Also included the gmoccapy tool change and the tool offset connections.
Norbert
P.S. you must rename the files to fit your needs.
		Last edit: 29 Apr 2017 09:48  by newbynobi.			
			Please Log in or Create an account to join the conversation.
- tecno
 - 
				
									Topic Author
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 1850
 - Thank you received: 127
 
			
	
						29 Apr 2017 10:28				#92335
		by tecno
	
	
		
			
	
	
			
			 		
													
	
				Replied by tecno on topic Spindel problems in Gmoccapy			
			
					Please Log in or Create an account to join the conversation.
		Moderators: newbynobi, HansU	
		Time to create page: 0.197 seconds