BBB and charge pump

84 Aufrufe
Direkt zur ersten ungelesenen Nachricht

John Dammeyer

ungelesen,
12.04.2021, 23:52:1312.04.21
an Machinekit
I'm using the Xylotex DB25 cape for the BBB. I've been trying to add the charge pump component without much luck.
In the HAL file I can do a
loadrt charge_pump
but an
addf charge_pump
fails with
function 'charge_pump' not found.

If I leave that out and run MachineKit on the Beagle I do see
charge-pump.0.enable
charge-pump.0.out
charge-pump.0.out-2
charge-pump.0.out-4
charge-pump.0.func.time
charge-pump.0.func.tmax
charge-pump.0.func.tmax-inc

But since the this HAL file only has a servo thread and no base thread is there a way to get this to work?

Ultimately I want the ChargePump output on DB25-17 working in the same way I have the PC with MESA 7i92H
# DB25-10 actvive low ESTOP signal mapped to 7i92 pin 13
# Pin# I/O Pri. func Sec. func Chan Pin func Pin Dir
# 10 13 IOPort QCount 0 Quad-A (In) estop-external-in (input)

# MESA 7i92H P2 connections mapped to estop-external-in
net estop-external-in <= hm2_7i92.0.gpio.013.in_not

# Stepper #4 is the charge pump on the MESA card and is enabled with the estop-external -in
net estop-external-in => hm2_7i92.0.stepgen.04.enable

which is output on DB25-17 from the MESA pin 7.
# 17 7 IOPort StepGen 4 Step/Table1 (Out) Charge Pump frequency (output)


John Dammeyer

ungelesen,
13.04.2021, 12:56:2413.04.21
an Machinekit
Just an update. I have a 501.9 Hz square wave now coming out DB25-17. The simple answer was that I needed to change to

addf charge_pump.0 servo-thread

The .0 was the issue.

The next issue, and I'm not sure how to get around this is the servo thread is too slow and doing something like this:
loadrt threads name1= fast-thread period1=100000

is not allowed. Probably because
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES tp=tp kins=trivkins

loads 'motmod' which does what 'threads' does.

I can try the standard parallel port generated version like:
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES

But I'll have to dig deeper to see why that may or may not work. Unless someone has a better suggestion like doing it the way the MESA does with an extra step/dir interface.

Next part is I also want 1kHz PWM. The MESA does this with hardware again. Can the BBB can do it with the PRU? If not it will have to also be done with a base thread of about 10KHz.

John
> --
> website: http://www.machinekit.io blog: http://blog.machinekit.io github: https://github.com/machinekit
> ---
> You received this message because you are subscribed to the Google Groups "Machinekit" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to machinekit+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/machinekit/0a0a01d73018%245f04d6e0%241d0e84a0%24%40autoartisans.com.

justin White

ungelesen,
13.04.2021, 20:51:4813.04.21
an John Dammeyer, Machinekit
Just a shot here cuz I don't use a BB, or MK much, or charge pumps and I haven't written a hal file in a year lol......

Anyway if I know the purpose of a watchdog timer and the issue you have is trying to generate reliable pulses from a hal software component running on a servo thread? Why not use the PRU pwm or step module to generate pulses at a frequency to an output pin through your E-Stop circuit and then feed it back to a PRU encoder pin. You can then arbitrarily use the encoder in "counter-mode=1" to measure the PWM pin as a velocity and use a software component like "near" or something to monitor that velocity, near will go false if the velocity is out of range....i.e., the pulses stopped. This way the PRU is making pulses, the PRU is counting pulses and the servo-thread is only limiting the sample rate at which it checks the velocity, you aren't making or counting pulses in the servo-thread.

Just an idea, not something I've tried

John Dammeyer

ungelesen,
13.04.2021, 21:17:2413.04.21
an justin White, Machinekit

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

 

 

Charles Steinkuehler

ungelesen,
13.04.2021, 21:49:4913.04.21
an machi...@googlegroups.com
If you just need a charge pump signal, use the PWM function on the PRU
(alternately, you could use a stepgen instance, but that's more code
overhead).
--
Charles Steinkuehler
cha...@steinkuehler.net

John Dammeyer

ungelesen,
13.04.2021, 22:46:3313.04.21
an Charles Steinkuehler, machi...@googlegroups.com
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 value. Which means I'm missing something. I'm using my MESA 7i92H as a guide although it's complicated by the extra ramping stuff I have in there.

What makes the speed button show up on the screen?
Thanks
> To view this discussion on the web visit https://groups.google.com/d/msgid/machinekit/ed9b13ab-776c-8edf-0e25-
> 6393ff289bd3%40steinkuehler.net.

John Dammeyer

ungelesen,
13.04.2021, 23:26:2713.04.21
an Charles Steinkuehler, machi...@googlegroups.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

John Dammeyer

ungelesen,
17.04.2021, 19:14:3417.04.21
an Charles Steinkuehler, machi...@googlegroups.com

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

XylotexG3616.hal

Charles Steinkuehler

ungelesen,
18.04.2021, 10:07:5718.04.21
an machi...@googlegroups.com
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
>>>>> website: <http://www.machinekit.io> http://www.machinekit.io blog: <http://blog.machinekit.io> http://blog.machinekit.io github: <https://github.com/machinekit> https://github.com/machinekit
>>>>> ---
>>>>> You received this message because you are subscribed to the Google Groups "Machinekit" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send an email to <mailto:machinekit+...@googlegroups.com> machinekit+...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> <https://groups.google.com/d/msgid/machinekit/0a0a01d73018%245f04d6e0%241d0e84a0%24%40autoartisans.com> https://groups.google.com/d/msgid/machinekit/0a0a01d73018%245f04d6e0%241d0e84a0%24%40autoartisans.com.
>>>>
>>>
>>> --
>>> Charles Steinkuehler
>>> <mailto:cha...@steinkuehler.net> cha...@steinkuehler.net
>>>
>>> --
>>> website: <http://www.machinekit.io> http://www.machinekit.io blog: <http://blog.machinekit.io> http://blog.machinekit.io github: <https://github.com/machinekit> https://github.com/machinekit
>>> ---
>>> You received this message because you are subscribed to the Google Groups "Machinekit" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an email to <mailto:machinekit+...@googlegroups.com> machinekit+...@googlegroups.com.
>>> To view this discussion on the web visit <https://groups.google.com/d/msgid/machinekit/ed9b13ab-776c-8edf-0e25-> https://groups.google.com/d/msgid/machinekit/ed9b13ab-776c-8edf-0e25-
>>> 6393ff289bd3%40steinkuehler.net.
>>
>> --
>> website: <http://www.machinekit.io> http://www.machinekit.io blog: <http://blog.machinekit.io> http://blog.machinekit.io github: <https://github.com/machinekit> https://github.com/machinekit
>> ---
>> You received this message because you are subscribed to the Google Groups "Machinekit" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to <mailto:machinekit+...@googlegroups.com> machinekit+...@googlegroups.com.
>> To view this discussion on the web visit
>> <https://groups.google.com/d/msgid/machinekit/0b3501d730d8%245b69d290%24123d77b0%24%40autoartisans.com> https://groups.google.com/d/msgid/machinekit/0b3501d730d8%245b69d290%24123d77b0%24%40autoartisans.com.

--
Charles Steinkuehler
cha...@steinkuehler.net

John Dammeyer

ungelesen,
18.04.2021, 19:08:2418.04.21
an Charles Steinkuehler, machi...@googlegroups.com
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
> --
> website: http://www.machinekit.io blog: http://blog.machinekit.io github: https://github.com/machinekit
> ---
> You received this message because you are subscribed to the Google Groups "Machinekit" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to machinekit+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/machinekit/7f99ee11-7e9c-a90e-0435-
> 1388b8ed6881%40steinkuehler.net.

Charles Steinkuehler

ungelesen,
19.04.2021, 19:49:5319.04.21
an John Dammeyer, machi...@googlegroups.com
On 4/18/2021 6:08 PM, John Dammeyer wrote:
> 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.

Yes, almost all the hal_pru_generic pins can use the new 8xx/9xx pin
numbering scheme. The only exception is the encoder input pins, which
require a PRU direct input to function properly.

--
Charles Steinkuehler
cha...@steinkuehler.net
Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten