Hi,

On my side, I am using eQEP2 hardware encoder along with index.
It is able to manage high pulse rate. Mandatory because I have a 4096 ppr encoder at 6000 rpm: 400 kHz. Not yet tested with a real threading, but validation I have done so far by using a signal generator shows that the index is well managed. What is tricky with eQEP is that you have very limited choice for the pins your are using.
For my Emco 120P retrofit, my encoder is connected as below:

P8.12   SPINDLE_A
P8.11   SPINDLE_B
P8.16   SPINDLE_Z


And the relevant HAL sections:

loadrt hal_bb_gpio output_pins=807,808,809,810,813,814,815,817,818,819,826,923,928 input_pins=911,912,913,915,917,918 loadrt [PRUCONF](DRIVER) prucode=$(HAL_RTMOD_DIR)/[PRUCONF](PRUBIN) [PRUCONF](CONFIG) halname=hpg
loadrt hal_arm335xQEP encoders=eQEP0,eQEP2

# Spindle encoder

addf eqep.update servo-thread

setp eQEP2.position-scale 4096
setp eQEP2.min-speed-estimate 0.2
setp eQEP2.capture-prescaler 5 # can measure down to 50 Hz pulses / 20 rpm
setp eQEP2.counter-mode 0        # Quadrature mode
setp eQEP2.invert-B 1

net spindle-position eQEP2.position => motion.spindle-revs
net spindle-velocity eQEP2.velocity => motion.spindle-speed-in
net spindle-index-enable eQEP2.index-enable <=> motion.spindle-index-enable

Frederic.
http://cnc.f1oat.org

On 27/03/2017 21:02, Charles Steinkuehler wrote:
On 3/27/2017 12:26 PM, Russell Gower wrote:
Hi, Is any body else using the Pru encoder - I’ve been using it for
spindle feed back on my Lathe for some time now, but I’ve just come
to do some thread cutting and the index-enable isn’t being cleared
on and index pulse.

I’ve double checked the hardware and the pulse is being sent to the
BBB, i’ve just had a look at hal_pru_generic/encoder.c and the code
doesn’t seem to do anything with that signal, I don’t yet fully
understand how this interacts with the pru hardware so I don’t know
how to go about fixing it - any pointers welcome.
I don't think I ever wrote the code to handle indexed encoders (in
part because I don't have any on-hand to test with).  I think the
hardware encoders support index but they're pretty restricted on which
pins you can use.

If you're up to coding a bit and testing, there are working examples
of index handling in the hostmot2 driver and the software encoder
driver (the hal_pru_generic code is sort-of a mashup of the two).

The way it's intended to work:

* The PRU sees an index pulse
** The PRU latches the current position (Encoder.Z_capture)
** The PRU increments the index count (Encoder.Z_count)
* The ARM driver reads the index count and if it's changed, handles
updating things if index-enable is set

It looks like it's just the ARM side that needs some fixup (probably
some conditional behavior based on the index-enable pin), the only
code doing anything with index is here:

https://github.com/machinekit/machinekit/blob/master/src/hal/drivers/hal_pru_generic/encoder.c#L204-L207


--
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 [email protected].
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to