Pimping the mini-lathe
On the one hand it looks reasonably simple, but seeing as I am a really sloppy coder (I again locked up Linuxcnc in endless loops yesterday by looping to infinity....twice) I would be concerned about bricking my 7i96 dicking around with this.
I do not know if 7i96 has dual firmwares as most of the Mesa boards do, so here we go :
PCW, helppppp !
the fallback area of the EEPROM:
mesaflash --device 7i96 --addr xx.xx.xx.xx --write test.bit --fallback
and then load the FPGA from the fallback area of the EEPROM:
mesaflash --device 7i96 --addr xx.xx.xx.xx --reload --fallback
If this fails, you can just power cycle the card and reload the user configuration
As far as MPGs go, running a software encoder on the isolated inputs is one way
but will only work with 5V MPG signals if you have the input common at ground
If you are running LinuxCNC 2.9 you can also get hardware MPG encoders on the isolated
inputs using the inm firmware (the inm firmware also has hardware debouncing on the isolated inputs)
I don't think I will bother adding linear encoders to this machine (that might be polishing a turd), but for a future build (a better lathe), would probably add them to the expansion pinhead. Can you also run differential signals to the pinhead, or only single ended?
I have been really happy with the Mesa hardware since I got the 5i25+7i77 PnP kit for the Maho, but once you see how flexibly these are, if you put a little effort into learning the full capabilties, it is really impressive hardware you company has produced Peter. Thanks for the ongoing support.
Looking at the configs changes Peter (Talla83) did...
... is there a manual or list of rules of what you can place where, and what doesnt work? He demonstrated on a 7i92, but the 7i96 has more hardware function dedicated pins.
but the on board I/O like stepgen pins and isolated inputs have a fixed direction so can only
be used in their designed directions and may have other limitations like maximum speed.
For example the 7I96 stepgen outputs are driven by 5V buffer chips to get a full
5V signal that can drive 24 mA. This buffer only works as an output. Similarly
the isolated input pins can only function as inputs, and are speed limited by
the Optocouplers used for isolation to about 5KHz maximum input frequency.
RotarySMP wrote: Given that my lathe only uses a fraction of the 7i96's capacity (2 Stepgen, 1 ENC and 1 Pwmgen) at present, would it be possible to add a further encoder through mesaflash to read a jog wheel? I looked through the bit files, and see there is one that looks like it converts to six ENC (7i96_6enc_d.bit). What would I need to do to make a 1pwmgen+ 1 addition ENC bitfile?
Actually given that jogwheels are only 100 PPR, and the normal input pins are read at 1kHz, I can't hand jog at 10 RPS anyway, so there is probably no disadvantage of puttnig the jog wheel onto general I/O except that they need a few pins.
Bonus question, would it be possible to reconfigure both the two unused Stepgens to ENC? With two stepgens, 1 pwmgen, and 3 Enc (the existing one plus two more), I could add linear encoders to the two axis, and run the jog wheel off I/O. That would be awsome for a lathe.
This is what I have used on a mill using a 7i96 for jogging 3 axis
# change number of encoders here loadrt encoder num_chan=5 addf encoder.capture-position servo-thread addf encoder.update-counters servo-thread # MPG stuff here #### load ilowpass for mpg smoothing ### loadrt ilowpass names=ilowpass.mpgX,ilowpass.mpgY,ilowpass.mpgZ addf ilowpass.mpgX servo-thread addf ilowpass.mpgY servo-thread addf ilowpass.mpgZ servo-thread setp ilowpass.mpgX.scale 50 setp ilowpass.mpgX.gain 0.01 setp ilowpass.mpgY.scale 50 setp ilowpass.mpgY.gain 0.01 setp ilowpass.mpgZ.scale 50 setp ilowpass.mpgZ.gain .01 # for velocity mode (when you stop spinning the dial the axis stops) # must be set for each axis setp joint.0.jog-vel-mode 1 setp axis.x.jog-vel-mode 1 setp joint.1.jog-vel-mode 1 setp axis.y.jog-vel-mode 1 setp joint.2.jog-vel-mode 1 setp axis.z.jog-vel-mode 1 # "times 4 mode" one count per full quadrature cycle, instead of the usual one count per edge. # mpg jog wheels often have a full quadrature cycle per "click". 0 for off and 1 for on. setp encoder.0.x4-mode 0 setp encoder.1.x4-mode 0 setp encoder.2.x4-mode 0 #set axis to the required increment ( 0.01) net jog-inc-x joint.0.jog-scale axis.x.jog-scale sets jog-inc-x 0.0002 net jog-inc-y joint.1.jog-scale axis.y.jog-scale sets jog-inc-y 0.0002 net jog-inc-z joint.2.jog-scale axis.z.jog-scale sets jog-inc-z 0.0002 #set inputs to 7i96 #encoder X net mpg-xa encoder.0.phase-A <= hm2_7i96.0.gpio.000.in net mpg-xb encoder.0.phase-B <= hm2_7i96.0.gpio.001.in #encoder Y net mpg-ya encoder.1.phase-A <= hm2_7i96.0.gpio.002.in net mpg-yb encoder.1.phase-B <= hm2_7i96.0.gpio.003.in #encoder Z net mpg-za encoder.2.phase-A <= hm2_7i96.0.gpio.004.in net mpg-zb encoder.2.phase-B <= hm2_7i96.0.gpio.005.in # send mpg-encoder counts to required axis # x encoder net enc-counts-x encoder.0.counts net enc-counts-x ilowpass.mpgX.in net enc_out-x ilowpass.mpgX.out net enc_out-x axis.x.jog-counts net enc_out-x joint.0.jog-counts setp axis.x.jog-enable true setp joint.0.jog-enable true # Y encoder net enc-counts-y encoder.1.counts net enc-counts-y ilowpass.mpgY.in net enc_out-y ilowpass.mpgY.out net enc_out-y axis.y.jog-counts net enc_out-y joint.1.jog-counts setp axis.y.jog-enable true setp joint.1.jog-enable true # Z encoder net enc-counts-z encoder.2.counts net enc-counts-z ilowpass.mpgZ.in net enc_out-z ilowpass.mpgZ.out net enc_out-z axis.z.jog-counts net enc_out-z joint.2.jog-counts setp axis.z.jog-enable true setp joint.2.jog-enable true
If you want the hal file as well just shout
indicates e exists as EXP but does not explain the usage
I think it will be EXP(n) or EXP[n]
as for pi, I think you would need to define it as a variable.
net spindle-enable <= spindle.0.on
net spindle-enable => hm2_7i96.0.ssr.00.out-00
net spindle-cw <= spindle.0.forward
net spindle-cw => hm2_7i96.0.ssr.00.out-01
net spindle-ccw <= spindle.0.reverse
net spindle-cww => hm2_7i96.0.ssr.00.out-02
When I push Gmoccapy spindle fwd button, both out-00 and out-01 go true. Spindle starts correctly.
When I push the rev rotation button, spindle enable out-00 goes high, but out-02 stay false. I can't see the error.
I am a bit lost with the spindle closed loop connection. I have the following generated by PNCConf
setp pid.s.Pgain [SPINDLE_0]P
setp pid.s.Igain [SPINDLE_0]I
setp pid.s.Dgain [SPINDLE_0]D
setp pid.s.bias [SPINDLE_0]BIAS
setp pid.s.FF0 [SPINDLE_0]FF0
setp pid.s.FF1 [SPINDLE_0]FF1
setp pid.s.FF2 [SPINDLE_0]FF2
setp pid.s.deadband [SPINDLE_0]DEADBAND
net ratio_select.out pid.s.maxoutput
setp pid.s.error-previous-target true
net spindle-index-enable <=> pid.s.index-enable
net spindle-enable => pid.s.enable
net spindle-vel-cmd-rpm-abs => pid.s.command
net spindle-vel-fb-rpm-abs => pid.s.feedback
net spindle-pid-out pid.s.output => scale.gear.in
net gear-ratio ratio_select.out-f => scale.gear.gain
setp ratio_select.in00 0.000405
setp ratio_select.in01 0.000175
net gear-select-a => ratio_select.sel0
net spindle-output <= scale.gear.out
# ---Encoder feedback signals/setup---
setp [HMOT](CARD0).encoder.00.counter-mode 0
setp [HMOT](CARD0).encoder.00.filter 1
setp [HMOT](CARD0).encoder.00.index-invert 0
setp [HMOT](CARD0).encoder.00.index-mask 0
setp [HMOT](CARD0).encoder.00.index-mask-invert 0
setp [HMOT](CARD0).encoder.00.scale [SPINDLE_0]ENCODER_SCALE
net spindle-revs <= [HMOT](CARD0).encoder.00.position
net spindle-vel-fb-rps <= [HMOT](CARD0).encoder.00.velocity
net spindle-index-enable <=> [HMOT](CARD0).encoder.00.index-enable
# ---setup spindle control signals---
net spindle-vel-cmd-rps <= spindle.0.speed-out-rps
net spindle-vel-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-vel-cmd-rpm <= spindle.0.speed-out
net spindle-vel-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-vel-cmd-rpm-abs => hm2_7i96.0.pwmgen.00.value
but it does respond to a change in command S word.
Thanks for assistance.