× Forum Header

PWM not quite working

More
25 Feb 2010 09:23 #2056 by gordoflash
Hi, I have installed the EMC2 with the Ubuntu live CD and have successfully got my mill to move all 3 axis.

I use a Digispeed from Homann Designs to control a VFD.

Using the Step Config Wizard and reading the Integrator Manual V2.3, I have the following functions working on my mill.

Move all 3 axis.
Find Home and limit switches.
ChargePump.
Estop.
PWM for the spindle.

My problem with the PWM is that when I type into MDI "S1000 M3" The spindle works ok, if I type "S1000 M4" I get the correct signal to reverse the VFD but there is no PWM signal to the Digispeed.

The Integrator Manual says to do this--

loadrt pwmgen output_type=0
addf pwmgen.update servo-thread
addf pwmgen.make-pulses base-thread
net spindle-speed-cmd motion.spindle-speed-out => pwmgen.0.value
net spindle-on motion.spindle-on => pwmgen.0.enable
net spindle-pwm pwmgen.0.pwm => parport.0.pin-09-out
setp pwmgen.0.scale 1800 # Change to your spindle’s top speed in RPM

But the Step Config Wizard produces this--
*** highlights areas I'm not sure about that differ from above.

loadrt pwmgen output_type=0
addf pwmgen.update servo-thread
addf pwmgen.make-pulses base-thread
net spindle-cmd <= motion.spindle-speed-out => pwmgen.0.value ***
net spindle-enable <= motion.spindle-on => pwmgen.0.enable ***
net spindle-pwm <= pwmgen.0.pwm ***
setp pwmgen.0.pwm-freq 50.0
setp pwmgen.0.scale 7000.0
setp pwmgen.0.offset 0.0
setp pwmgen.0.dither-pwm true
net spindle-fwd motion.spindle-forward => parport.1.pin-14-out
net spindle-rev motion.spindle-reverse => parport.1.pin-16-out
setp parport.1.pin-01-out-invert 1
net spindle-pwm => parport.1.pin-01-out

This system is working on a demo version of Mach3. I hope to get my mill working correctly on EMC2 as from what I've seen it's smoother motion and cleaner screen layout appeals

I can attach the hal files if more info is needed.

My next challenge is to get my pendant functioning.

Thanks

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

More
04 Feb 2011 16:12 - 04 Feb 2011 16:55 #6988 by leintz
Replied by leintz on topic Re:PWM not quite working
I have the same problem...did you foud any solution ?
Last edit: 04 Feb 2011 16:55 by leintz.

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

More
04 Feb 2011 22:02 #6998 by andypugh
Replied by andypugh on topic Re:PWM not quite working
Can you (both?) paste the full HAL config to www.pastebin.com or www.pastebin.ca (depending on which is working at the moment).

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

More
03 Oct 2011 12:08 #13625 by leintz
Replied by leintz on topic Re:PWM not quite working
so...I did it...anyway...here is my HAL (attached)

File Attachment:

File Name: my_mill-45...86d3.hal
File Size:5 KB
Attachments:

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

More
04 Oct 2011 01:24 #13636 by andypugh
Replied by andypugh on topic Re:PWM not quite working
Is it working now, or do you still have problems?

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

More
04 Oct 2011 06:02 - 04 Oct 2011 11:04 #13638 by leintz
Replied by leintz on topic Re:PWM not quite working
no, it does not work...

in CW mode PWM works nicely but CCW mode PWM output has very narrow pulses...if I try to increase spindle speed...pulses become (pulse length is almost minimum) shorter and disapear at all...pwm works like an oposite direction...
Last edit: 04 Oct 2011 11:04 by leintz.

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

More
04 Oct 2011 20:30 #13655 by andypugh
Replied by andypugh on topic Re:PWM not quite working
Ae you using m4 for backwards, or a negative S-number?

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

More
04 Oct 2011 21:10 #13657 by andypugh
Replied by andypugh on topic Re:PWM not quite working
OK, the answer is in the pwmgen manpage. Though it does seem a bit peculiar.

pwmgen type 0 (the default) is zero for negative inputs. However, anticlockwise spindle speeds are indicated by a negative number.

The solution is to use pwmgen type 1. If you edit the HAL file to say
loadrt pwmgen output_type=1
Then it will work.

This is something that needs fixing in stepconf.

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

More
05 Oct 2011 10:33 #13676 by leintz
Replied by leintz on topic Re:PWM not quite working
thank you very much...it works

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

More
02 Nov 2011 21:27 #14530 by jpka
Replied by jpka on topic Re:PWM not quite working
Hi!
I just fall into very similar problem, if not exactly same problem.
I need to basic PWM control of spindle speed.
One difference from standard setup is i use 'Spindle PWM' in Stepconf Wizard, but *not* use 'Spindle ON' signal, i write below why.
But after Wizard finishes, PWM output (i set it at pin 2) not work: This pin only now act as On-Off switch.
When i use 'S0 M3' pin becomes zero, 'S1 M3' or 'S1000 M3' gives continuous '1'.
I carefully read example in docs:
loadrt pwmgen output_type=0 
addf pwmgen.update servo-thread
addf pwmgen.make-pulses base-thread
net spindle-speed-cmd motion.spindle-speed-out => pwmgen.0.value
net spindle-on motion.spindle-on => pwmgen.0.enable
net spindle-pwm pwmgen.0.pwm => parport.0.pin-09-out
# Set the spindle's top speed in RPM 
setp pwmgen.0.scale 1800
but it is far different from that i see in auto-generated .hal file (please see attachment).
And because of difference, i can't properly insert this code in my .hal file, and can't test it, and can't test solution about 'loadrt pwmgen output_type=1'.
Q1: Is there an error in Stepconf Wizard, and should i ask about fixing it? Or it may already fixed in latest code tree?
Q2: Is there a (simple) way to fix .hal file by hands to get PWM out work?
Q3 (complex): There is common standard method and timing of PWM control exists for wide class of Electronic Speed Control (ESC) taken from radio-controlled toys world, and these ESCs used by some CNC DIYers for spindle motors. It all uses pulses like 1 ms = full reverse speed, 1.5 ms = stop, 2 ms = full forward speed. Period is 20 ms. (so duty cycle max. 10%). These ESCs don't have separate On-Off asynchronous input. Can it be used in EMC, and how i can modify .hal file for it? And maybe in far, far future i can hope that this particularly spindle control timings can be integrated in Stepconf Wizard?
Thanks! :-)

File Attachment:

File Name: my_mill.txt
File Size:4 KB
Attachments:

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

Time to create page: 0.689 seconds
Powered by Kunena Forum