Pimping the mini-lathe

More
07 Aug 2020 13:29 #177617 by RotarySMP
Replied by RotarySMP on topic Pimping the mini-lathe
Do you create you own bit files for Mesa hardware? I was just rewatching Talla83's excellent (but german language) tutorial on how to create you own bit files.


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.
Mark
The following user(s) said Thank You: tommylight

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

More
07 Aug 2020 13:38 #177619 by tommylight
Replied by tommylight on topic Pimping the mini-lathe
No i do not, i did try that a while back (quite a while) and got tired of waiting to download a gazillion of megabytes of software, and while i was at waiting for it PCW had already made what i needed. He has a nasty habit of making custom firmware inside a day for whatever i might need and no matter how silly my requests are ! :) The best support on planet earth !
I do not know if 7i96 has dual firmwares as most of the Mesa boards do, so here we go :
PCW, helppppp ! :)

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

More
07 Aug 2020 14:03 #177621 by PCW
Replied by PCW on topic Pimping the mini-lathe
If you are concerned about bricking the 7I96, you can try new firmware by loading it into
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)
The following user(s) said Thank You: RotarySMP, tommylight

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

More
07 Aug 2020 14:37 #177622 by RotarySMP
Replied by RotarySMP on topic Pimping the mini-lathe
Thanks Tommy and Peter. So take it you can not reformat any of the TB1 outputs to encoder 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.
Mark
Attachments:

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

More
07 Aug 2020 15:01 - 07 Aug 2020 15:02 #177625 by PCW
Replied by PCW on topic Pimping the mini-lathe
On a 7I96 the parallel expansion connector (P1) can have any available function on any pin
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.
Last edit: 07 Aug 2020 15:02 by PCW.
The following user(s) said Thank You: RotarySMP

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

More
07 Aug 2020 16:05 #177628 by Clive S
Replied by Clive S on topic Pimping the mini-lathe

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.
Mark


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
The following user(s) said Thank You: RotarySMP

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

More
07 Aug 2020 17:21 - 07 Aug 2020 19:17 #177632 by RotarySMP
Replied by RotarySMP on topic Pimping the mini-lathe
Thanks Clive, I just ordered a jog encoder. I'll be sure to use this section of your HAL.
Last edit: 07 Aug 2020 19:17 by RotarySMP.

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

More
09 Aug 2020 11:17 #177741 by RotarySMP
Replied by RotarySMP on topic Pimping the mini-lathe
Here is episode 26.


Motion at last!

By the way, does anyone have an aswer to a question I posted a couple of days go?
Just playing around, what is the syntax to use natural constants like Pi or "e" in gcode?
#<103>=[pi/e]
Mark
The following user(s) said Thank You: tommylight, Clive S

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

More
09 Aug 2020 21:21 #177777 by rodw
Replied by rodw on topic Pimping the mini-lathe
The RS274ngc document
tsapps.nist.gov/publication/get_pdf.cfm?pub_id=823374
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.
The following user(s) said Thank You: RotarySMP

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

More
11 Aug 2020 19:30 #177930 by RotarySMP
Replied by RotarySMP on topic Pimping the mini-lathe
I have two problems with the following connections

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.

Second issue:
I am a bit lost with the spindle closed loop connection. I have the following generated by PNCConf

#*******************
# SPINDLE
#*******************

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


I added
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.
Mark

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

Moderators: piasdom
Time to create page: 0.366 seconds
Powered by Kunena Forum