To view this discussion on the web visit https://groups.google.com/d/msgid/machinekit/0a9d01d73085%24e9fe9c00%24bdfbd400%24%40autoartisans.com.
Thanks Justin,
Yes that's the direction I've been going. For now I've left the charge pump output at 500 Hz while I set up the PWM which is done in hardware. I can have two at different frequencies so that will work for both charge pump and PWM for the spindle.
The odd thing at the moment is that the spindle PWM on my LinuxCNC system just stopped working. Don't remember if I accidentally edited something or what.
But on the BBB front I'm at the point where everything except the actual output appears to be working with one teensy problem.
The AXIS display doesn't show the SPINDLE ON/OFF and +/- buttons to set speed. Nor for that matter the coolant flood and mist check boxes. It does on my LinuxCNC setup. Which is why I was checking there and now suddenly no spindle movement even though I have buttons.
If anyone knows why the spindle control buttons have gone missing please let me know.
Thanks
John
To view this discussion on the web visit https://groups.google.com/d/msgid/machinekit/CA%2BQ02MO%2B2s2tDjv%3Dg86xj8DDtwtJf3jc_rMV0fPmq%3DYjs_tfVQ%40mail.gmail.com.
Making progress.
Scope shows PWM and DIR on correct pin. Buttons work. + button however increases speed reported value above 3000 RPM when examined with HAL meter even though PWM reached 100% at 3000 RPM. (50 RPS)
Still missing something.
#(JCD) Add PWM Spindle control
# ################
# Spindle
# ################
# This output is on DB25-14
setp hpg.pwmgen.00.pwm_period 100000
setp hpg.pwmgen.00.out.00.pin 813
setp hpg.pwmgen.00.out.00.enable 1
setp hpg.pwmgen.00.out.00.scale 50.0
setp hpg.pwmgen.00.out.00.value 0
net spindle-enable <= motion.spindle-on
net spindle-vel-cmd-rps <= motion.spindle-speed-out-rps
net spindle-vel-cmd-rpm <= motion.spindle-speed-out
net spindle-vel-cmd-rpm-abs <= motion.spindle-speed-out-abs
net spindle-cw <= motion.spindle-forward
net spindle-ccw <= motion.spindle-reverse
net spindle-brake <= motion.spindle-brake
net spindle-revs => motion.spindle-revs
net spindle-enable => hpg.pwmgen.00.out.00.enable
net spindle-vel-cmd-rps => hpg.pwmgen.00.out.00.value
# This output is on DB25-16 and is Spindle Direction.
net spindle-ccw => bb_gpio.p8.out-19
# This output is on DB25-17
net charge-pump => bb_gpio.p9.out-14
> -----Original Message-----
> From: machi...@googlegroups.com [mailto:machi...@googlegroups.com] On Behalf Of John Dammeyer
> Sent: April-13-21 7:46 PM
> To: 'Charles Steinkuehler'; machi...@googlegroups.com
> Subject: RE: [Machinekit] BBB and charge pump
Things are not going well so I've attached the HAL file.
I've spent several days on this trying all sorts of different things and finally just reducing the HAL file to as simple as possible.
I don't know if the photos would make it through so here are links to them. Didn't have a USB stick handy to save them so I just photographed the entire scope.
This one shows 50% PWM to the spindle as the yellow trace.
http://www.autoartisans.com/beagle/PWM50_ChgPmp-1.jpg
This one should be the same as the one above but isn't 50%.
http://www.autoartisans.com/beagle/PWM50_ChgPmp-2.jpg
In fact the PWM appears to oscillate at about 2 hz with the falling edge synchronized to either edge of the blue trace which is the charge pump output.
I've simplified the HAL file as much as possible. It appears the PWM to the spindle is not being done in hardware and something is preventing it from staying at the requested 50%.
It doesn't matter if it's set from AXIS or if I do this.
setp hpg.pwmgen.00.out.00.value 25.0
I'm also not sure about this part:
# load low-level drivers
# Hex values of pins. $6B,$71,$77,$7E,$D6 $6D,$6E,$72,$76,$F1
loadrt hal_bb_gpio output_pins=107,113,119,126,214 input_pins=109,110,114,118,241
loadrt [PRUCONF](DRIVER) prucode=$(HAL_RTMOD_DIR)/[PRUCONF](PRUBIN) [PRUCONF](CONFIG) halname=hpg
Depending on which machinekit and BBB web page I read the values for the output_pins have different numbers with the latest supposedly 813 for P8 Pin 13.
Setting up the spindle pin I do use 813 which appears to work. However, again according to one of the web pages if I want the PRU to control this I'd use 1813 rather than 813 or 0813. However, no output appears when I use 1813.
So I'm still missing something with a hardware generated (or PRU generated PWM that has a period of 1mS.)
No matter what I do the PWM oscilates between 0 and 50% synchronized to the edges of the charge_pump.
Any suggestions on what to do next?
Thanks
John
To view this discussion on the web visit https://groups.google.com/d/msgid/machinekit/0b4601d730dd%24ee043dc0%24ca0cb940%24%40autoartisans.com.