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 -- Charles Steinkuehler [email protected] -- 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.
