RE: [Machinekit] BBB and charge pump

2021-04-18 Thread John Dammeyer
Thank you.
That worked.  The strange thing is that I actually had a comment in the file 
about interference but got my 8-- numbers mixed around and at one point did 
have the PWM pin removed from that list.  Then I put it back.  

I've now also added the ramp with slow spindle acceleration (although the 2HP 
Bergerda AC Servo is virtually instant on -- scary fast).

One other  question.  If the 8xx and 9xx numbers work for the loadrt 
hal_bb_gpio statement is it possible to also use them for the stepper motor pin 
selection here:

setp hpg.stepgen.00.steppin 0x4C
setp hpg.stepgen.00.dirpin  0x4D

Changing those to the 8-- and 9-- series would make the hal file more readable.

And ...  tada
Here's the evidence with how little is required to run a full 4 axis CNC 
machine to a PMDX-126 Break out Board.
Module to convert HDMI to VGA for the monitor.  Xylotex BBB_25/26 (now 
discontinued) and modified so outputs are always enabled so Charge Pump comes 
through and System Enable DB25-1 is active high.
http://www.autoartisans.com/beagle/BBB_SimplePP.jpg

And on the screen the MachineKit Axis interface.  If the code sets S3000 you 
can see Z motion is held off until the spindle is up to speed.  Really cool.  
Works now just like the PC with MESA 7i92H
http://www.autoartisans.com/beagle/BBB_Works.jpg

Here's the updated HAL file.
http://www.autoartisans.com/beagle/XylotexG3616.hal

and for reference the INI file.
http://www.autoartisans.com/beagle/XylotexG3616.ini

For anyone browsing through the files they will see that I'm also prepping to 
run the spindle with step/dir.  The wiring is already in place with a module 
that takes step/dir signals configured either as PWM/DIR or STEP/DIR.  The PWM 
goes into a small far east module to make 0-10V to a shielded cable to the 
servo drive.  The STEP/DIR signals are also converted to differential and go 
via the general DB25 cable with ENABLE and FAULT signals to the servo drive.  
All it takes is once parameter change on the servo to use step/dir.

With the BBB I can just use a different .HAL file.  With the MESA 7i92H the 
FPGA doesn't support PWM and STEP/DIR on the same pins so it requires 
reprogramming it which is why I've only done this with MACH3, LinuxCNC Parallel 
port and soon the Beagle. 

Again thanks
John


> -Original Message-
> From: machinekit@googlegroups.com [mailto:machinekit@googlegroups.com] On 
> Behalf Of Charles Steinkuehler
> Sent: April-18-21 7:08 AM
> To: machinekit@googlegroups.com
> Subject: Re: [Machinekit] BBB and charge pump
> 
> It looks like you have the PRU and the hal_bb_gpio both driving P8 pin
> 13, so they're stepping on each other.  Don't have the hal_bb_gpio
> driver talk to P8 pin 13 and things should work much better.  Also,
> unless you're using a _really_ old version of hal_bb_gpio, it will
> probably make more sense to use the newer 8xx/9xx pin numbering scheme
> like you are for the PRU pins.
> 
> Warning: lines below will probably wrap...the loadrt command needs to be
> all one line.
> 
> So turn this:
> loadrt hal_bb_gpio output_pins=107,113,119,126,214
> input_pins=109,110,114,118,241
> 
> ...into this:
> loadrt hal_bb_gpio output_pins=807,819,826,914
> input_pins=809,810,814,818,941
> 
> On 4/17/2021 6:14 PM, John Dammeyer wrote:
> > 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 

Re: [Machinekit] BBB and charge pump

2021-04-18 Thread Charles Steinkuehler
It looks like you have the PRU and the hal_bb_gpio both driving P8 pin 
13, so they're stepping on each other.  Don't have the hal_bb_gpio 
driver talk to P8 pin 13 and things should work much better.  Also, 
unless you're using a _really_ old version of hal_bb_gpio, it will 
probably make more sense to use the newer 8xx/9xx pin numbering scheme 
like you are for the PRU pins.


Warning: lines below will probably wrap...the loadrt command needs to be 
all one line.


So turn this:
loadrt hal_bb_gpio output_pins=107,113,119,126,214 
input_pins=109,110,114,118,241


...into this:
loadrt hal_bb_gpio output_pins=807,819,826,914 
input_pins=809,810,814,818,941


On 4/17/2021 6:14 PM, John Dammeyer wrote:

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
  
From: machinekit@googlegroups.com [mailto:machinekit@googlegroups.com] On Behalf Of John Dammeyer

Sent: April-13-21 8:26 PM
To: 'Charles Steinkuehler'; machinekit@googlegroups.com
Subject: RE: [Machinekit] BBB and charge pump
  
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   10

setp hpg.pwmgen.00.out.00.pin   813
setp hpg.pwmgen.00.out.00.enable1
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: machinekit@googlegroups.com [mailto:machinekit@googlegroups.com] On 
Behalf Of John Dammeyer
Sent: April-13-21 7:46 PM
To: 'Charles Steinkuehler'; machinekit@googlegroups.com
Subject: RE: [Machinekit] BBB and charge pump

That's what I'm trying to get going now.  Actually first the PWM for spindle 
speed and then I'll create the second PWM for charge
pump.

Having a lot of trouble with the PWM for the spindle.  I've added what I think 
are the correct motion.spindle- ... but all I can get on
the AXIS screen are the +/- and STOP button along with the BRAKE checkbox.  And 
the +/- buttons do flip the DB25-16 port pin so
that's all working.

But the set speed button is missing and I can't seem to link to the PWM