Stepgen Quadrature Hal and ini file setup

More
5 years 8 months ago #198178 by Michael
Looking at running servo motors in quadrature position mode. Just wanted to confirm the changes I need to make in the Hal and ini files. Also need to confirm the timing settings and math are correct. This is assuming that the Hostmot2 and Stepgen components are both similar in their literature for pins and paramters. There was a bit more info about this on the stepgen page which is why I prefaced that.

hal file:
setp hm2_7i92.7i78.stepgen.00.steplen [JOINT_0]STEPLEN
setp hm2_7i92.7i78.stepgen.00.dirdelay [JOINT_0]DIREDELAY #This part comes from the Stepgen component and not Hostmot2
setp hm2_7i92.7i78.stepgen.00.step_type=2
setp hm2_7i92.7i78.stepgen.00.control-type 1

I don't understand the " the stepgen outputs one complete Gray cycle (00 â 01 â 11 â 10 â 00)" portion of this and its significance to the setup

ini file will need the timing entered for pulses but I don't think that it need stepspace, dirhold, dirsetup but this is where I am confused/wrong.

Max motor speed is 3000 rpm which makes it 50rps
Max pulse cycles read to be 500kHz which gives me 10000 us per revolution for pulses.
minimum pulse width is .8 us so it looks like to get max motor speed I would need 12500 pulses per revolution to achieve that. Do I need to calculate in time for the Dirdelay?

The drive gearing can produce anywhere from 2000 to 65536 pulses per revolution.
Resolution wise this provides me with .000015" per pulse X/Y and .000009" in Z (geared 40 to 24 and 8mm and 5mm screws respectively). Is this math correct?

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

More
5 years 8 months ago #198193 by PCW
For quadrature mode, you need to reduce the scale factor by 1/4
(so if you had a step/dir scale of 50000, the scale with quadrature
would need to be 12500)

Also the stepgen hardware still obeys the step length and setup /hold times
so these should all be set so short that they do no interfere with the quadrature
generation (say 50 ns for all settings)

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

More
5 years 8 months ago #198248 by Michael
So then steplen, stepspace, dirsetup, dirhold all need to be set at 50 ns? Should I not worry about the timing information that the manufacturer supplied in the previous picture?

If I set Linuxcnc step scale at 1/4 for example 12500. Should the drive still be looking for full scale then of 50000?

Also where does the frequency limit of 500kHz come into play with quadrature steps?

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

More
5 years 8 months ago #198326 by andypugh

Michael wrote: So then steplen, stepspace, dirsetup, dirhold all need to be set at 50 ns? Should I not worry about the timing information that the manufacturer supplied in the previous picture?


Those terms have no meaning with quadrature input.

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

More
5 years 8 months ago - 5 years 8 months ago #198329 by PCW
Right, for quadrature, the important thing is to set stepgen maxvel so you cannot violate
the quadrature timing (the limitation would be the 1.0 usec T2 and T3 or time between counts)
This timing allows up to a 1 MHz step rate (with 250 KHz A and B quadrature signals)

The maximum step rate is not related to latency (and about 12.5 MHz on Mesa Ethernet cards)

If I set Linuxcnc step scale at 1/4 for example 12500. Should the drive still be looking for full scale then of 50000?

If the drive is set for 50000 steps (or quadrature edges) per turn then the stepgen scale should be 12500
if the stepgen is in quadrature mode.
Last edit: 5 years 8 months ago by PCW.

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

More
5 years 8 months ago #198901 by Michael
Got this all working today. I have not checked the accuracy of the whole setup but the math should be correct and the axis are moving the approximate correct distance (according to my harbor freight tape measure...) The only thing I noted is that the T2 and T3 distance between steps is < or = to 1us so I do think that the limiting factor is the drives 500kHz frequency limit.

I set the drives to be expecting 10000 steps/rev which makes full scale 52916.60449 steps/in after gearing and screws. At full speed of 8.33 ips the drive would be expecting 440kHz. This is using MAX_VELOCITY for the calculation. Pncconf set STEPGEN_MAXVEL at 16.67 when i activated backlash compensation. The notes indicate:
# The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION
# If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger.

Does STEPGEN_MAXVEL also need to be 100% higher with backlash? That was the one part I didn't get how those max settings interact with the motion and pulse frequency.

I set the scale in Linuxcnc to 1/4 of the calculated or 13229.1662 steps/inch. All of this gives .0000188" per step resolution. The drives can be geared lower but I am unsure if this will push past the max frequency since I made the calculation with the MAX_VELOCITY and not STEPGEN_MAXVEL.

I was also surprised that the step gen control type was velocity and not position. If I were to bring the encoders into the loop to close the position would I comment out:
#net x-pos-fb <= hm2_7i92.0.stepgen.00.position-fb
#net x-pos-fb => joint.0.motor-pos-fb
and use instead:
net x-pos-fb <= hm2_7i92.0.encoder.00.position
net x-vel-fb <= hm2_7i92.0.encoder.00.velocity
net x-pos-fb => joint.0.motor-pos-fb

Or does linux use both forms of position feedback in closed loop?

Thanks for the help and answering all the questions. Attached Hal and ini for those interested.

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

Time to create page: 0.144 seconds
Powered by Kunena Forum