Mesa 5i25/7i77 - First Steps

More
26 Feb 2016 23:41 #70690 by andypugh

Sparky961 wrote: I know that the MPG could be connected in a multitude of configurations but is there any "standard" for which I/O pins to use?

It might be easiest to connect to a spare encoder counter, if you have one to spare. Alternatively, if you look on page 21 of the manual you can see that in Mode 3 pins 16/17 and 18/19 become MPG A/B channels. This could be helpful, as the GPIO pins are better able to handle the 12V MPG pulses.
You set the mode to 3 with "sserial_port_0=30000000" assuming that the 7i77 is on port 0.0. I can't guarantee that is the case, it might be evident from the pin names.

Do you think that's a good next step or would it be time to get into the servo amp connections?

Yes, that seems reasonable. Clamp the motors down well, they may jump. And be aware that PID tuning a bare motor can be very difficult, so don't expect much until the motors are on the machine.

As you seem to be enjoying HAL you could try creating a very simple single-axis config with no GUI. I am guessing most of the pin names here, I don't have a 7i77 to hand. You can put this in a text file then use the halcmd "source filename" command to load it. But the tab-completion of the live prompt is handy too.

You will need pid, the man=page is here
linuxcnc.org/docs/2.7/html/man/man9/pid.9.html
I needed that to remember the name of the pid pins and the function that needs addf-ing to the realtime thread.

And, in fact, all the man pages are at the bottom of here:
linuxcnc.org/docs/2.7/html/
loadrt hostmot2
loadrt hm2_pci config="sserial_port_0=300xxx"
loadrt pid count =1
loadrt threads
addf hm2_5i25.0.read thread1
addf pid.0.do-pid-calcs thread1
addf hm2_5i25.0.write thread1 

net command hm2_5i25.0.7i77.0.0.mpg1 pid.0.command #this is where the guesswork starts
net feedback hm2_5i25.0.encoder.00.position pid.0.feedback
net pid-output pid.0.output hm2_5i25.0.7i77.0.0.analogout-00 

setp pid.0.Pgain 1.5
setp pid.0.enable 1

start

That's the bare bones of a single axis controller. You will see that the pid component has many more parameters than just Pgain, and tweaking them is an academic subject in itself. (I have a colleague with a PhD in PID controllers...)
I have almost certainly left out some important "enable" pins. "show pin *enable*" will show you them.

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

More
27 Feb 2016 00:36 #70692 by Sparky961
For the sake of anyone who got here searching Google for something like "Tosoku HC1 21 MPG", I previously made a comment about trying it out with 5V input which I have since proved doesn't work.

There's a component inside on the circuit board that sure looks like a fixed linear voltage regulator. Probing the pins matches what I'd expect to see from it if it were a voltage regulator, which is what I have decided to believe. For a standard +12V regulator, the maximum input voltage is 30V (generally). So I hooked it up to my variable test power supply and started at the rated 12V. I first worked down, monitoring the output of the (has to be a) regulator. the 5V started dropping off when the input reached about 7V.

The encoder outputs dropped proportionally to the regulator's, so you might get away with it if you know what you're doing and interpret the outputs appropriately. Next, the dicey part, I slowly worked upward of 12V by about 2V at a time feeling for any heat on the board and smelling for burning - a certain sign that you should go talk a walk.

Fortunately I had neither of those really-bad things happen and the output voltage stayed rock solid at 5V all the way up to 24V, the maximum of the test supply. At no point did the regulator or any other components get noticeably warmer. Definitely no smoke was emitted.

So, to summarize the MPG should be completely happy with any input voltage between 7 and 24VDC, possibly even up to 30 according to one data sheet. This is great because the built-in indicator LED is supposed to get 24V as well.

I now need to read up on the 7i77's inputs and what they'll do with this 0/5V digital signal.

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

More
27 Feb 2016 00:43 #70694 by andypugh

Sparky961 wrote: I now need to read up on the 7i77's inputs and what they'll do with this 0/5V digital signal.


I think that the GPIO pins 16-19 in MPG mode should be good to 32V, so that's a good reason to configure that way.

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

More
27 Feb 2016 00:44 - 27 Feb 2016 00:49 #70695 by Sparky961

Sparky961 wrote: I now need to read up on the 7i77's inputs and what they'll do with this 0/5V digital signal.


Well I'll be ..... How often do things just work out right? Page 27 of the 7i77 manual, regarding "Software Process Operation Modes":

"Encoder input threshold is fixed at 2.5V for compatibility with 5V encoder outputs"

Could it be any simpler? :)
Last edit: 27 Feb 2016 00:49 by Sparky961.

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

More
27 Feb 2016 00:47 #70696 by andypugh
Sounds good, and also safe to 32V if the MPG requires you to go higher to make it work.

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

More
27 Feb 2016 01:27 #70697 by Sparky961
Is there a reference for what all of the pin names do?

Some are obvious, others aren't. For example, I'm looking at the following trying to figure out what the difference would be:
     5  s32   OUT             0  hm2_5i25.0.7i77.0.0.enc0.count
     5  float OUT             0  hm2_5i25.0.7i77.0.0.enc0.position
     5  s32   OUT             0  hm2_5i25.0.7i77.0.0.enc0.rawcounts

I'm sure that the meaning/function will become clear for many of them, but having a reference is always good to start. As I'm typing all of this, I'm thinking perhaps the above are all just scaled differently?

I'm glad you gave me the caveat as to pin names, etc. I don't need to be spoon fed though, so it's good you're making me work for it rather than just giving me stuff I can copy, paste, and never learn from.

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

More
27 Feb 2016 01:51 #70700 by andypugh

Sparky961 wrote: Is there a reference for what all of the pin names do?


That's an interesting question. I am not sure that there is. There used to be (the manpages link earlier) but a lot of the pin names on smart-serial connected devices (which includes part of the 7i77 pins) are actually defined by the smart-serial device itself, so you need to look at each card manual to see what it can do, then correlate that to the pin names the firmware chooses.

Some are obvious, others aren't. For example, I'm looking at the following trying to figure out what the difference would be:

     5  s32   OUT             0  hm2_5i25.0.7i77.0.0.enc0.count
     5  float OUT             0  hm2_5i25.0.7i77.0.0.enc0.position
     5  s32   OUT             0  hm2_5i25.0.7i77.0.0.enc0.rawcounts

I'm sure that the meaning/function will become clear for many of them, but having a reference is always good to start. As I'm typing all of this, I'm thinking perhaps the above are all just scaled differently?


Yes. The counts are the actual encoder edges. The position is counts / scale (a HAL parameter. Use "show param" to see them at the halcmd prompt. Parameters can be set, but can not be part of a net in HAL. This was an old design decision, and probably wouldn't be done that way now. There is a slow process that is moving parameters to pins. PID gains used to be parameters, but actually changing gains depending on error/setpoint etc can be very useful.

The manpages list both. You will see that PID now only has parameters as the read-only debug data.

The rawcounts pin is a version of counts that is not reset by index-enable. It can be handy to have that if you are using the encoder to commutate an AC servo motor.

I'm glad you gave me the caveat as to pin names, etc. I don't need to be spoon fed though, so it's good you're making me work for it rather than just giving me stuff I can copy, paste, and never learn from.

It's not deliberate, I have never owned a 7i77, so I am having to guess pin names. I did write the driver so it is an educated guess, but often wrong.

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

More
27 Feb 2016 02:53 #70703 by Sparky961
Just a little status update...

Taking the provided simple example and tweaking it a bit, I ended up with the following:
loadrt hostmot2
loadrt hm2_pci config="sserial_port_0=300000"
loadrt pid num_chan=1
loadrt threads

addf hm2_5i25.0.read thread1
addf pid.0.do-pid-calcs thread1
addf hm2_5i25.0.write thread1 

net command hm2_5i25.0.7i77.0.0.enc0.position pid.0.command
net feedback hm2_5i25.0.encoder.00.position pid.0.feedback
net pid-output pid.0.output hm2_5i25.0.7i77.0.1.analogout0

setp pid.0.Pgain 1.5
setp pid.0.enable 1

setp hm2_5i25.0.7i77.0.1.analogena 1

start

I have my MPG/Pendant connected to the 7i77's inputs 16 and 17. The result of loading the above as a HAL file and setting up a watch on hm2_5i25.0.7i77.0.1.analogout0 and hm2_5i25.0.7i77.0.0.enc0.count is that the count increments from 0 to 25 with one rotation of the MPG wheel. The analog output changes proportionally by 1.5 times the MPG count.

I'm thinking that the MPG count should give me a count of 100 per rev though. How would I go about setting this to 4x quadrature instead of the default 1x? Or is this the expected behaviour? There's a reference in the 7i77 manual o the REGMAP file in HostMot2 source distribution that might be a clue, but I couldn't find anything definitive.

The other change that's a bit less obvious is that I added a piece of plywood to my workbench to begin organizing and holding things down temporarily. This should help with the growing rat's nest of wires. The last thing I want is for something to come undone and short out the works. I'm still considering how is best to contain the final system so that its maintainable, expandable, and safe from the harsh shop environment.

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

More
27 Feb 2016 10:20 #70706 by andypugh

Sparky961 wrote: I'm thinking that the MPG count should give me a count of 100 per rev though. How would I go about setting this to 4x quadrature instead of the default 1x? Or is this the expected behaviour? There's a reference in the 7i77 manual o the REGMAP file in HostMot2 source distribution that might be a clue, but I couldn't find anything definitive.


You could set the scale parameter to 4, but I don't think that has the desired effect.

I can't remember how to change a sserial remote to x4 mode. It won't be anything to do with the regmap, as that affects registers on the FPGA in the 5i25. The encoder counting is happening in a separate processor that simply sends serial data to that fpga.

The setsserial util/command is probably what is needed. But to be useful that would require the setting to be "sticky" through a restart.

PCW might be able to advise. I have a 7i73 sserial remote with mpg counters in my machine, I can have a look tonight.

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

More
27 Feb 2016 10:42 #70707 by andypugh
I needed to go into the workshop for something else, and looking at the parameters, there is an "nvencmode" parameter for each encoder.

One of mine is set to 4, probably for the encoder I a using. So, it should be a relatively simply matter to set the nvencmode to the required value with setsserial at the command line, and as it is non-volatile it should be a one-time setup.

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

Moderators: PCWjmelson
Time to create page: 0.100 seconds
Powered by Kunena Forum