PWM stepper motor driver
micronewb
Posts: 20
I am working on running some stepper motors for a walker and I am interfacing with a microstep motor driver. The only problem I am having is I am losing my PWM signal at 28Khz. I am setup on the oscilloscope and the signal drops out higher than that frequency. I have tried writing a spin version using waitcnt and have tried the pwmx8 object. Any ideas why this is happening and how i can increase the frequency, I really need a signal up to at least 35 Khz. Thanks in advance for any help!
Comments
Do you have the external 5 MHz crystal hooked up properly? Is your clock phase-locked loop set properly?
In your CON section you should have:
Post Edited (ElectricAye) : 6/1/2010 5:42:24 PM GMT
CON
_clkmode = xtal1 + pll16x
_xinfreq = 6_250_000
Another option is phil did an object that used the vga hardware to generate pwm. If I remember correctly it could do ~80KHz with 8bits of resolution, it is also in obex.
like this
I get around 43 kHz
not much commands left to stay above 35kHz
So if you want to do 35kHz the signal has to be generated in PASM
Is your steppermotor continoius rotation and it is NOT important if you loose some steps?
Or do you need to control it and calculate with every single microstep ?
How about attaching your code to a posting as a propellertool archive to make sure that all files needed are included
and then let forum members take a look at your code and test it on theier propeller-chips?
It could be some really dumb detail but how should we know without looking into the code?
best regards
Stefan
Post Edited (StefanL38) : 6/2/2010 7:55:58 PM GMT
28KZ or 32KZ is a division. At this time the current is highest, as well the Back-EMF. Maybe surpass your motor's rated.
Turns out assembly solves all the problems. I can get my pwm signal up to 2.8 Mhz now. I lose resolution quickly after 2.0 Mhz as expected, but thanks again for the suggestions.
Gavin.
My only warning is we run through a motor driver currently so this will strictly give you a PWM signal. I don't take care of the stepper phases in this program, but if this is what your looking for have at it.