Spindle encoder on pico USC

More
11 Mar 2013 07:55 #31196 by johntrevick
I want to try hooking up spindle speed feedback so I built a crude encoder out of photo interrupters and connected it to encoder 03 on my Pico Systems USC but I may have run into a problem.

The photo interrupters I chose have a built in comparator and provide a logic level output but the index channel is showing True except when it passes over the index hole. I don't think it matters for the A/B channels but for index won't this be a problem? Continuously resetting the count or something? I would probably need to invert this at the hardware level, right?


-John

Please Log in or Create an account to join the conversation.

More
11 Mar 2013 09:40 #31199 by jmelson
Replied by jmelson on topic Spindle encoder on pico USC

I want to try hooking up spindle speed feedback so I built a crude encoder out of photo interrupters and connected it to encoder 03 on my Pico Systems USC but I may have run into a problem.

The photo interrupters I chose have a built in comparator and provide a logic level output but the index channel is showing True except when it passes over the index hole. I don't think it matters for the A/B channels but for index won't this be a problem? Continuously resetting the count or something? I would probably need to invert this at the hardware level, right?


-John

No, the index detector is edge-triggered, so it only responds to the rising edge of
the index pulse, not the continuous level. So, it should work fine.

Jon

Please Log in or Create an account to join the conversation.

More
11 Mar 2013 10:01 #31200 by johntrevick
Ah, good news then. I'll give it another go tomorrow.

The example files on your site www.pico-systems.com/codes/univstepthread/univstep_motion.hal shows:

newsig spindle-index-en bit
linkps motion.spindle-index-enable => spindle-index-en
linksp spindle-index-en => ppmc.0.encoder.03.index-enable

ppmc.0.encoder.03.index-enable doesn't seem to exist anymore.

Please Log in or Create an account to join the conversation.

More
12 Mar 2013 08:56 #31269 by johntrevick
Having a weird problem - can't seem to find this pin (for example, in halmeter):
ppmc.0.encoder.03.index-enable
only has:
ppmc.0.encoder.03.index

Position seems to be working (counting up/down when I rotate the spindle) but it doesn't reset because index isn't hooked up. When I try to use the command everyone else seems to be using (without the "-enable") I get an error.

from univstep_motion.hal:
net spindle-position ppmc.0.encoder.03.position => motion.spindle-revs
net spindle-velocity ppmc.0.encoder.03.velocity => motion.spindle-speed-in
net spindle-index-enable ppmc.0.encoder.03.index <=> motion.spindle-index-enable

I get:
[...]
LINUXCNC - 2.5.1
[...]
Debug file information:
Can not find -sec MOT -var MOT -num 1
Can not find -sec IO -var IO -num 1
Can not find -sec LINUXCNC -var NML_FILE -num 1
Can not find -sec EMC -var NML_FILE -num 1
univstep_motion.hal:67: Signal 'spindle-index-enable' can not add I/O pin 'motion.spindle-index-enable', it already has OUT pin 'ppmc.0.encoder.03.index'

Please Log in or Create an account to join the conversation.

More
12 Mar 2013 11:34 #31271 by jmelson
Replied by jmelson on topic Spindle encoder on pico USC

Ah, good news then. I'll give it another go tomorrow.

The example files on your site www.pico-systems.com/codes/univstepthread/univstep_motion.hal shows:

newsig spindle-index-en bit
linkps motion.spindle-index-enable => spindle-index-en
linksp spindle-index-en => ppmc.0.encoder.03.index-enable

ppmc.0.encoder.03.index-enable doesn't seem to exist anymore.


ppmc.0.encoder.03.index-enable is a very special HAL pin, it is one
of the very few that is bi-directional. The way it works is that some motion module
that wants to zero the counter on the next index pulse sets this pin, the
driver sets the function in the hardware, and the hardware sets a flag
when the zero-on-index has been performed. Then, the driver clears the
bi-directional signal, and the motion module knows that the indexing
operation has been accomplished.

ppmc.0.encoder.03.index is NOT a bidirectional signal, but output only,
and can't be linked to a bidir signal, I think. So, that is why it croaks on that,
and wouldn't work, anyway.

Now, one WAY this can happen is if your board is REALLY old! it has
to have rev 1 firmware to not export this pin in the driver. You can
run the diagnostics with the bus option, and it will ID each board
by type and firmware rev. OK, checking my records, your board is from 2003!
So, that explains it.
With boards that old, the firmware rev is a date scribed into the EPROM
chip at U4, and will probably be really hard to read.
I should be able to make you a new EPROM for this board that can make
it handle the index. That will be from 2007.

Jon

Please Log in or Create an account to join the conversation.

More
12 Mar 2013 16:50 #31278 by johntrevick
I bought a firmware upgrade from you last summer when I got some relays but I haven't installed it yet. So I guess it's time!

I'll install that tonight (hopefully) and report back.

Please Log in or Create an account to join the conversation.

More
13 Mar 2013 09:43 #31308 by johntrevick
Ok, I've run into an even more weird problem.

I installed the new firmware and "univstepdiags bus" went from revision 1 to revision 3. The new eprom I got (end of June) is labelled 5/26/07.

The ppmc.0.encoder.03.index-enable pin now shows up but so does ppmc.0.encoder.03.index which I don't see listed in www.linuxcnc.org/docs/html/drivers/pico_ppmc.html

I added in net spindle-index-enable ppmc.0.encoder.03.index-enable <=> motion.spindle-index-enable to univstep_motion.hal and it starts up without error. When I rotate the spindle I see ppmc.0.encoder.03.position moving fine.

However, now my index channel isn't working. With a solid 5v or 0V it always shows false but if I unplug the connection from the board it seems to float and intermittently goes true (btw, this doesn't reset the position to 0). I also tried connecting it directly to 5V or Gnd. After spending a while tearing through my wiring I was pretty sure I'd blown my board and decide to write up my results here but then went back to try one last thing - downgrading back to rev 1 and of course, index and the photo interrupter are working fine. Obviously index-enable no longer exists.

So I don't think I've destroyed my board thankfully but it's the one showing me who the boss is.

Please Log in or Create an account to join the conversation.

More
13 Mar 2013 12:00 #31310 by jmelson
Replied by jmelson on topic Spindle encoder on pico USC

Ok, I've run into an even more weird problem.

I installed the new firmware and "univstepdiags bus" went from revision 1 to revision 3. The new eprom I got (end of June) is labelled 5/26/07.

The ppmc.0.encoder.03.index-enable pin now shows up but so does ppmc.0.encoder.03.index which I don't see listed in www.linuxcnc.org/docs/html/drivers/pico_ppmc.html

This is all good, this signal "index" is not used except for testing, it should show the
state if the index, reporting a 1 only on one servo cycle, then going back to zero.
If you try it with halmeter, you will miss the change, but if you display it on Halscope,
it will sample every servo cycle, so you will see the short blips.

I added in net spindle-index-enable ppmc.0.encoder.03.index-enable <=> motion.spindle-index-enable to univstep_motion.hal and it starts up without error. When I rotate the spindle I see ppmc.0.encoder.03.position moving fine.

However, now my index channel isn't working. With a solid 5v or 0V it always shows false but if I unplug the connection from the board it seems to float and intermittently goes true (btw, this doesn't reset the position to 0). I also tried connecting it directly to 5V or Gnd. After spending a while tearing through my wiring I was pretty sure I'd blown my board and decide to write up my results here but then went back to try one last thing - downgrading back to rev 1 and of course, index and the photo interrupter are working fine. Obviously index-enable no longer exists.

Again, halmeter will miss the change. Also, the index-enable signal is only turned on when searching
for an index pulse, as when homing to index or beginning a spindle-sync operation such as
G33. Otherwise the spindle count will just count up and down with the rotation. The easiest way to
test is to try a G33 operation and watch the spindle count with halscope. When it syncs, the count will
abruptly jump to zero, and the index-enable signal will also reset to zero. You can sync halscope to
the index-enable going to zero.

Jon

Please Log in or Create an account to join the conversation.

More
14 Mar 2013 06:54 #31367 by johntrevick
Success! The G33 command appears to be working although I've disassembled a bunch of stuff for testing so I'm rotating the spindle manually. Eventually I'll give it a shot on a real part.

thanks for your time and patience.

-John

Please Log in or Create an account to join the conversation.

More
14 Mar 2013 08:18 #31371 by jmelson
Replied by jmelson on topic Spindle encoder on pico USC

Success! The G33 command appears to be working although I've disassembled a bunch of stuff for testing so I'm rotating the spindle manually. Eventually I'll give it a shot on a real part.

It is probably safer that way!
What you described yesterday seemed to indicate everything was OK,
so I thought it was going to work. The encoder index operation requires a
LOT of steps, so you can't diagnose it without doing all of the steps
to activate the encoder-index signal and then watching the spindle
position count reset in Halscope.

The diagnostic program also has a function the test this called indexres,
you run it like this:

./univstepdiags 378 indexres 3
if you want to test the 4th axis on a USC on the parallel port at 0x378.
When you rotate the encoder by hand, you will see the count reset
when it passes the index location. I often use this to find out
how many counts an encoder produces per rev.

Jon

Please Log in or Create an account to join the conversation.

Moderators: PCWjmelson
Time to create page: 0.143 seconds
Powered by Kunena Forum