Stepgen Quadrature Hal and ini file setup

More
09 Feb 2021 18:51 #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?
Attachments:

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

More
09 Feb 2021 20:01 #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
10 Feb 2021 06:07 #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
10 Feb 2021 21:31 #198326 by andypugh

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
10 Feb 2021 21:51 - 11 Feb 2021 02:05 #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: 11 Feb 2021 02:05 by PCW.

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

More
15 Feb 2021 05:31 #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.
Attachments:

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

More
15 Feb 2021 15:24 #198939 by PCW
You have lots of margin in step frequency:
Currently at 8.33 IPS*13229.1662 you will have a
~ 110.200 KHZ square wave on both A and B.
This gives you your ~440 KHz step rate, since the
drive steps on all edges of A and B.

And yes, you can use encoder feedback simply by swappiing
hm2_7i92.0.encoder.NN.position
with
hm2_7i92.0.stepgen.NN.position-fb
and connecting
hm2_7i92.0.encoder.00.velocity
to pid.nn.feedback-deriv

Note that the PID tuning will be quite different

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

More
15 Feb 2021 15:26 - 15 Feb 2021 15:29 #198940 by PCW
You have lots of margin in step frequency:
Currently at 8.33 IPS*13229.1662 you will have a
~ 110.200 KHZ square wave on both A and B.
This gives you your ~440 KHz step rate, since the
drive steps on all edges of A and B.

STEPGEN_MAXVEL is unchanged when backlash is used

And yes, you can use encoder feedback simply by swappiing
hm2_7i92.0.encoder.NN.position
with
hm2_7i92.0.stepgen.NN.position-fb
and connecting
hm2_7i92.0.encoder.00.velocity
to pid.nn.feedback-deriv

Note that the PID tuning will be quite different

Ack hit quote instead of edit sorry for the double post
Last edit: 15 Feb 2021 15:29 by PCW.

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

More
14 Sep 2022 14:56 #251902 by P1-Engineering
What would be the advantage of using Quadrature input over step+dir?.

I'm currently trying to decide what would be the best option. I have a set of delta A2L drives with mesa 716E+7I85 boards. Everything is wired up and now starting to put together the configuration.
In the future I want to make it a full-closed loop system by fitting the mill with scales. For now I will probably feedback the servo encoder output. Also want to use the home to index function if this is possible.

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

More
14 Sep 2022 15:42 - 14 Sep 2022 17:37 #251905 by PCW
Quadrature has the advantage of not needing step time settings
(they can all be set to say 50) and having possibly higher step rates.
(4x higher than step/dir at the same minimum pulse width)

That is, if a drive had a 1 usec minimum high and 1 usec minimum low
step pulse specification, that would limit the step rate to 500 KHz
with step and dir but quadrature could reach a 2 MHz step rate with
the same timings.
Last edit: 14 Sep 2022 17:37 by PCW.
The following user(s) said Thank You: P1-Engineering

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

Time to create page: 0.146 seconds
Powered by Kunena Forum