stepgen step_type2 (quadrature driven steppers) Help

More
18 Apr 2019 00:50 #131095 by DaveRosario
Hi Guys,

I've been trying to find some examples on how to configure the stepgen in quadratrue mode (type 2). I understand the concept but I'm having problems implementing it in the hal file. Can you please share a little example to get me in the right direction?

So far I figure I have to use the following:

loadrt stepgen step_type=2,2,2 ctrl_type=p,p,p

#Pins
stepgen.00.phase-A
stepgen.00.phase-B
stepgen.00.position-cmd
stepgen.00.enable

#Parameters
stepgen.00.steplen
stepgen.00.dirdelay
stepgen.00.position-scale
stepgen.00.frequency
stepgen.00.maxvel
stepgen.00.maxaccel

#Functions
stepgen.make-pulses
stepgen.make-update-freq
stepgen.capture-position

But I don't know how I have a Mesa 7i76e card and closed loop steppers with hbs57 drivers.

I don't know when to call the Fuctions or set which parameters.

Thanks,

David

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

More
18 Apr 2019 01:11 #131096 by PCW
If you have a Mesa card, you do not need the stepgen component at all

I would suggest using pncconf to create a basic hal/ini file set for the 7I76e
and then edit the hal file to set the 7I76Es hardware stepgen output type
to quadrature, something like:

setp hm2_7i76e.0.stepgen.00.step_type 2

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

More
18 Apr 2019 04:26 #131103 by DaveRosario
Thanks for the quick reply PWC,

I tried that before, but the motor turns faster when spinning CCW than CW and when I increase the speed I get errors from the driver.

# Step Gen signals/setup

setp hm2_7i76e.0.stepgen.03.dirsetup [AXIS_2]DIRSETUP
setp hm2_7i76e.0.stepgen.03.dirhold [AXIS_2]DIRHOLD
setp hm2_7i76e.0.stepgen.03.steplen [AXIS_2]STEPLEN
setp hm2_7i76e.0.stepgen.03.stepspace [AXIS_2]STEPSPACE
setp hm2_7i76e.0.stepgen.03.position-scale [AXIS_2]STEP_SCALE
setp hm2_7i76e.0.stepgen.03.step_type 2
setp hm2_7i76e.0.stepgen.03.control-type 1
setp hm2_7i76e.0.stepgen.03.maxaccel [AXIS_2]STEPGEN_MAXACCEL
setp hm2_7i76e.0.stepgen.03.maxvel [AXIS_2]STEPGEN_MAXVEL

I also commented dirsetup, dirhold and stepspace and I get different errors from linuxcnc and the driver. I vefified the signals A/B in the oscilloscope and they look good but it seem that they are not going at the correct rate.
When I set the driver and linux to work with step and dir the stepper runs smooth.

Thanks for the help

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

More
18 Apr 2019 04:34 - 18 Apr 2019 04:36 #131104 by PCW
The scaling is different for quadrature, you need to divide your STEP_SCALE settings by 4

in addition you should set the steplength, stepspace, dirsetup, dirhold to a small number (say 100 ns)
so they have no affect on the quadrature timing
Last edit: 18 Apr 2019 04:36 by PCW.

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

More
18 Apr 2019 04:46 #131105 by DaveRosario
it works but the stepper feels like its grinding inside vs the step/dir mode. And I still get errors from the driver.

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

More
18 Apr 2019 05:05 #131106 by PCW
Just tried (7I76E, quadrature mode, all steptimes=100) and i get no errors,
what errors do you get?

Are you sure your drives really work in quadrature mode?

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

More
18 Apr 2019 05:15 #131107 by DaveRosario
This is what I have now:
#setp hm2_7i76e.0.stepgen.03.dirsetup [AXIS_2]DIRSETUP
#setp hm2_7i76e.0.stepgen.03.dirhold [AXIS_2]DIRHOLD
setp hm2_7i76e.0.stepgen.03.steplen [AXIS_2]STEPLEN
#setp hm2_7i76e.0.stepgen.03.stepspace [AXIS_2]STEPSPACE
setp hm2_7i76e.0.stepgen.03.position-scale [AXIS_2]STEP_SCALE
setp hm2_7i76e.0.stepgen.03.step_type 2
setp hm2_7i76e.0.stepgen.03.control-type 1
setp hm2_7i76e.0.stepgen.03.maxaccel [AXIS_2]STEPGEN_MAXACCEL
setp hm2_7i76e.0.stepgen.03.maxvel [AXIS_2]STEPGEN_MAXVEL

steplen is 3000 as my drivers require 2500.

I changed the "Pulse Active Edge" to "Falling" in the driver and now seems to be working.

The drivers have pulse/dir and CW/CCW modes

Thanks for the Help!!!

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

More
18 Apr 2019 05:17 #131108 by DaveRosario
Never mind, now I get joint following error from linuxcnc.

I'll keep trying tomorrow.

Thanks again!

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

More
18 Apr 2019 05:17 #131109 by PCW
CW/CCW is not quadrature so you can use step mode 0 (step/dir) or 1 (CW/CCW)
but not mode 2

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

More
18 Apr 2019 08:16 #131122 by DaveRosario
That was all the problem :/ I miss read the manual. It works perfectly in mode 1!

Sorry for all the trouble, but thank you for help. Much appreciated.


-David

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

Time to create page: 0.085 seconds
Powered by Kunena Forum