VNR wrote:Finally i found the bug:
The Axis prints "waiting for s.axes" because hal_ppmc driver crashes at line 1147.
src/hal/drivers/hal_ppmc.c -> funcion static void read_encoders(slot_data_t *slot)
1146 } else {
1147 *(slot->encoder
.vel) = vel; // encoder without timestamp
1148 }
The tracking history:
1) Axis prints "waiting for s.axes" because src/emc/ini/iniaxis.cc fails in function loadAxis at emcAxisSetBacklash
2) src/emc/task/taskintf.cc fails at function emcAxisSetBacklash because function usrmotWriteWriteEmcmotCommand fails.
3) src/emc/motion/usrmotintf.cc fails at function usrmotWriteEmcmotCommand because function usrmotReadEmcmotStatus always return s.commandNumEcho = 0 (must be equal to commandNum sent)
4) Fixed this Axis loads.
5) But now i get an RTAPI fault.
6) So i read rtfaults.txt ( git.linuxcnc.org/gitweb?p=linuxcnc.git;a...rtfaults.txt;hb=HEAD ) and found that the problem was hal_ppmc.c at line 1147.
7) I commented that line and recompile.
8) I got back with the change in 4) and recompile again.
9) Now i can run the univstep example config (with Axis and hal_ppmc driver). I can get out of estop, home all and MDI G0 X100 Y100 Z100.WOW, I can't believe this is the first person to hit this bug! Now, this code has been only in the
development version of LinuxCNC for a long time, waiting for the long-fabled 2.5 version to come
out. This was done in November 2010!
OHHHHH! NOW I understand! This error REQUIRES the board to be very old (Pre ver 2),
from before late 2006.
What is going on is that the function export_encoders() should always export the velocity pin,
no matter what rev the board is. But, only if the board is greater than ver 2 does the current code
do that. For some reason, this was bundled with the encoder timestamp and index-enable
features. Older USC boards don't have properly working encoder index logic.
But, all encoders should be able to produce a scaled velocity from the position delta, so it
should always export the velocity HAL pin.
I am driving to the CNC Workshop on Wednesday, and will be coming back on Sunday.
I'm a little afraid to hack into this and make things worse.
But, if VNR doesn't need the
scaled velocity, commenting out that line is fine. If he does want that, then the fix is to
move lines 2141-2145 up before line 2132. Since no USC board has timestamping of
the encoder counter, it will just scale the encoder delta value.
I'm not sure I can cobble together a board of that old revision, that used a 5 V FPGA
instead of the newer 3.3/1.8 V FPGA, so I can't just put old firmware in a new board
for testing.
Well, thanks to VNR for finding a bug I should have tracked down!
Jon