Hi Frederic,

Long story and then some questions.

I mentioned 10uS period because that's what I read is the PRU interrupt rate
and why the machine kit can't do more than 50kHz stepping pulses.    Don't
know if that's true either now because that information might also be old.

Using a hardware QEPof course means the logic takes care of the quadrature
count and all you have to do is read the register which counts up and down
for you.  Years ago, I designed a 3 axis board using the LS7166 if I recall
the number correctly.  There is now even an LS7266 dual quadrature 24 bit
counter that I'm holding in my hand.  With a Byte Level interface to the
registers and lots of features even an 8 bit Microprocessor can deal with hi
res encoders.

In my case they were used for Oil Rig Heave compensation.  Some drilling
platforms float because the ocean floor is too far down.  No way to
physically anchor them to the ground.  The ocean isn't really still but
rises and falls with a swell, not to mention tide of course.  A drill string
with a bit is a long long pipe that weighs a lot.  The full weight of the
string is not put on the drill bit to avoid damaging it.  There's always
some tension on the string holding it up to provide the pressure.  Much like
you might ease off on drilling into metal on your lathe.

Anyway, the point of the encoders was to measure the depth of the platform
the ocean bottom by means of an encoder around a wheel that had a few turns
of cable connected to the platform and the bottom.  As the platform moved up
and down the encoder would turn producing pulses counted by the LS7166 chip.


A second encoder was connected to the winch cable that controlled the height
of the top of the drill string.  That's the part you see going up and down
as they add or remove drill pipe to the drill string.  In order to maintain
a constant pressure on the drill string the two encoder values were used to
track rig heave in the ocean swell and pull up or release more winch cable
from the drill string cable to keep a constant pressure on the drill string.

Hope that didn't sound too long or convoluted.  Simple and used to be done
with analogue before.  

Point is, if you have a hardware QEP device you can measure the encoder with
a much slower processor than the encoder pulse rate.  The value you pull
from that becomes the error term relative to say the stepping pulses of a
motor axis after appropriate scaling.   So if you want 1:1 and you have a
1000 ppr encoder on the spindle and a 2000 step/rev motor then you have to
multiply the encoder value by 2 or divide the stepper counter by 2.  If you
want an infinite repeating ratio like 2/3 (and there are lots for threads
depending on lead screw pitch and desired thread)  you multiply and divide
the encoder/leadscrew values by the appropriate scale factors (like choosing
gears) and then use the result as an error term to speed up or slow down the
lead screw.  

With high resolution encoders the PID loop ends up with less chucky changes
in motor speed. With 1PPR on the spindle by the time you know the spindle
speed (counting clocks between spindle pulses) the spindle may have already
changed speed.  So for the next full turn the Z axis is turning at the wrong
speed relative to the spindle.  That correction is then done on the next
spindle pulse but once again, now the spindle is turning faster and again
the leadscrew motor is wrong.   That's why the lease expensive and most
reliable addition to any lathe with 1PPR encoder is a good rock solid
spindle speed control.  AC Mains, Belts and pulleys.  It's the small DC
speed controls on things like Far East variable speed lathes that cause the
most grief.

Anyway, back to the Beagle and the QEP.   A 1000 line encoder on the spindle
and 1000 line encoder on the lead screw motor results in 4000 PPR for each.
To turn a 1:1 thread they both have to be turning the same rate.  Say you
are doing high speed threading of leadscrew pitch (8TPI) at 2400 RPM.
That's 40 RPS or 25mS per turn.  If the Beagle PRU cycle time is 10uS then
it's there to read the QEP counter 2500 times per revolution.  (25mS/10uS =
0.144 degrees of spindle rotation) .

That value from the QEP is ultimately used with a PID routine to create the
error term to adjust the step rate out of the Z axis Carriage.  It's also
used to determine if it's time to decelerate to the end of the screw thread
location.  Or if not decelerate then to cause the X axis to pull the tool
out at the rate that causes a thread depth reduction and then decelerate to
a stop.

BTW, there will also be a lag between a new Z axis speed and the old one but
now instead of 360 degrees between "adjustments" it's 0.144 degrees.    Much
better than once per 360 degrees.

So Frederic (or anyone else), 

from Jeff Pollard's post referring to the Xylotex  cape:

"On the BBB_DB25/26, the  IDC26 header has BBB Pin P9-42 and P9-27.
  P9-42 equates to eQEP0Ain
  P9-27 equates to eQEP0Bin

  Pin 9-41 equates to eQEP0index.  This is on the DB25 connector and has a
RC filter on it (used on the board as an A axis home/limit switch).  If you
want to use that input, you will need to remove the capacitor."

What needs to be put into the Xylotex  .ini and .hal file to make the Beagle
PRU use a 1PPR sensor for the latest revision of MachineKit on the Beagle?

What needs to be put into the Xylotex  .ini and .hal file to make the Beagle
PRU use eQEP0 for the latest revision of MachineKit on the Beagle?

Selecting either the current Xylotex or Xylotex.ShuttleXpress ini file in
the Machinekit Configuration Selector dialog box results in:
"axis-ngc - AXIS with Machinekit 0.1 on Xylotex" as the machine kit window
title.

None of the other selections appear to select a hardware interface for a
lathe.  It's all mills or 3D printers.  

What else is required to create "a Lathe" on the Beagle Machinekit 0.1?

Thanks
John


> -----Original Message-----
> From: Frederic RIBLE [mailto:fri...@teaser.fr]
> Sent: October-15-17 2:33 AM
> To: emc-users@lists.sourceforge.net
> Subject: Re: [Emc-users] MachineKit on the BeagleBone Black
> 
> As far as I know, PRU micro-code is using sampling for counting.
> I have validate up to 100 kHz, with a PRU period of 2.5uS.
> So you have 4 samples per pulse period, which is enough, but not fully
> satisfying if you need to master the jitter.
> See
> http://blog.f1oat.org/2016/04/10/adding-velocity-estimation-in-
> hal_pru_generic-encoder/
> The fix I have done on MK code is for frequency measurement.
> I am using PRU based encoder for MPG, so without strong constraints.
> 
> 6000 rpm is exactly the upper limit I have with my ECMO-120P lathe.
> With my 1024 ppr spindle encoder, the pulse rate is above 100 kHz.
> Possible with PRU, but close to the limit in regards to the overall
> performance.
> I do not know if PRU micro-code can sustain 2.5uS period when increasing
> the number of encoders/pwms it is processing.
> This is why I am using BBB eQEP instead of PRU for spindle.
> I do not have specs in mind, but I guess eQEP is capable of more than 1
> MHz, as soon as the lowpass filter of the input is well designed.
> 
> Frederic
> http://cnc.f1oat.org
> 
> On 2017-10-15 06:24, John Dammeyer wrote:
> > Hi Jon,
> > With respect to high speed encoder interface using the PRU on the Beagle
I
> > may have misunderstood the comment from Charles from the second link
> below.
> > I'm thinking a 6000 RPM spindle with a 1000 line encoder detecting in
> > quadrature.  That's tracking 24KHz which has a period of 41.667uS so I
guess
> > the PRU can probably count that as long as it isn't doing to many other
> > things in that same 10uS interrupt.
> >
> > Here's what I've found so far to a posting I did back in 2015.
> >
> https://groups.google.com/forum/#!searchin/machinekit/Beaglebone$20machi
> neki
> > t$20lathe$20spindle%7Csort:relevance/machinekit/6klZrJH_2ZA/kDVr-
> 6LgFgAJ
> >
> > 1. A reply from Jeff Pollard on which pins on the Xylotex 26 pin header
to
> > use for the QEP along with instructions to not use the "A HOME/LIMIT"
switch
> > on the DB-25 for homing and instead remove a filter capacitor so the
index
> > pulse can be read.  How to configure the Xylotex .ini file is not
explained.
> >
> > Past that the other link from 15JUN15:
> >
> https://groups.google.com/forum/#!searchin/machinekit/Beaglebone$20machi
> neki
> >
> t$20lathe$20spindle%7Csort:relevance/machinekit/OvkMCwhhpjY/O0y1sl8y8
> OcJ
> >
> > 1. A comment from Charles which is what has led me to think the QEP for
> > spindle isn't possible on the Beagle yet.  But that was more than 2
years
> > ago.
> >
> > "You can implement slow user-interface style encoder inputs on the ARM
> > in the servo thread (1 mS period) using the software encoder input and
> > GPIO pins.
> >
> > The PRU encoders will run at the PRU period (10 uS by default) and
> > must use direct PRU input pins.
> >
> > The hardware encoders obviously need to use the specific pins for the
> > channel(s) used.
> >
> > If you need more higher performance encoders, it's possible to
> > dedicate one of the PRUs to do just encoder inputs, but that software
> > has yet to be written (pull requests greatly appreciated!).  :)
> >
> > Charles Steinkuehler"
> >
> >
> >
> >
> >> -----Original Message-----
> >> From: Jon Elson [mailto:el...@pico-systems.com]
> >> Sent: October-14-17 7:55 PM
> >> To: Enhanced Machine Controller (EMC)
> >> Subject: Re: [Emc-users] MachineKit on the BeagleBone Black
> >>
> >> On 10/14/2017 03:14 PM, John Dammeyer wrote:
> >>> I'll see if I can find that link.  From what I remember it's specific
> > PRU
> >>> code for the Beagle that needs to be written for the Lathe part and
that
> > was
> >>> never done.
> >>>
> >>>
> >> But, there is NO specific PRU code for a lathe.  What you
> >> need are steps (assuming a step/dir motor interface),
> >> some digital I/O to control the spindle, and at least one
> >> encoder counter with direction.  The generic PRU code
> >> built by Charles Steinkuehler can provide this, if the hal
> >> command line asks it to do so.
> >>
> >> Once you have a spindle encoder, you can do lathe threading
> >> operation.
> >>
> >> Now, one other item might be an analog output to control
> >> spindle speed.  You can always integrate a PWM output, which
> >> the PRU can provide, to get this.
> >>
> >> Jon
> >>
> >>
> >
----------------------------------------------------------------------------
> > --
> >> Check out the vibrant tech community on one of the world's most
> >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> >> _______________________________________________
> >> Emc-users mailing list
> >> Emc-users@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/emc-users
> >
> >
----------------------------------------------------------------------------
--
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > _______________________________________________
> > Emc-users mailing list
> > Emc-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/emc-users
> 
> 
>
----------------------------------------------------------------------------
--
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to