Mesa 7i92 .bit file

More
14 Jan 2016 23:14 #68412 by andypugh
Replied by andypugh on topic Mesa 7i92 .bit file

hostmot2.so
hm2_eth.so
hm2_7i92.so
I'm missing the third file. Is there somewhere that I can get this file, or do I need to create it from a file on the 7i92.zip download?


I am pretty sure that there isn't a hm2_7i92. The 7i92 isn't mentioned in the hm2_eth manual page (an omission) but it makes an appearance in the actual code ( github.com/LinuxCNC/linuxcnc/blob/993436...tmot2/hm2_eth.c#L675 )

However, you shouldn't have to be a programmer to use LinuxCNC.
One thing to check first is that the ethernet cards only work with the rt-preempt version of the kernel and the "uspace" version of linuxcnc.
linuxcnc.org/docs/2.7/html/getting-start...th_preempt_rt_kernel

Rather than start with a full config, and all the complications that brings, I would first try to find the card with a minimal config. (And despite what I just said, this is command-line stuff)
halrun
loadrt hostmot2
loadrt hm2_eth board_ip="192.168.1.121"
show pin

If you get a list of HAL pins, then the board has been found, and the driver is loaded.

If not, then try the loadrt hm2_eth with a different ip or mac.
Once you have comms you can then unloadrt_hm2_eth and try loadrt-ing it again with different config strings to get the functions you want.

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

More
15 Jan 2016 00:15 #68420 by 10K
Replied by 10K on topic Mesa 7i92 .bit file
Great suggestion!

The system is talking to the 7i92 board when I run halcmd in the terminal as you suggested. I was also able to refine the command for my configuration as:
loadrt hm2_eth board_ip=192.168.1.121 config="num_stepgens=4 num_encoders=1 num_pwmgens=0"

But something odd is going on. When I type
sudo /usr/bin/mesaflash --device 7i92 --addr 192.168.1.121 --readhmid
:
I get the expected pinout:

IO Connections for P1
Pin# I/O Pri. func Sec. func Chan Pin func Pin Dir

1 17 IOPort None
2 19 IOPort StepGen 5 Step/Table1 (Out)
3 21 IOPort StepGen 5 Dir/Table2 (Out)
4 23 IOPort StepGen 6 Step/Table1 (Out)
5 25 IOPort StepGen 6 Dir/Table2 (Out)
6 26 IOPort StepGen 7 Step/Table1 (Out)
7 27 IOPort StepGen 7 Dir/Table2 (Out)
8 28 IOPort StepGen 8 Step/Table1 (Out)
9 29 IOPort StepGen 8 Dir/Table2 (Out)
10 30 IOPort QCount 1 Quad-A (In)
11 31 IOPort QCount 1 Quad-B (In)
12 32 IOPort QCount 1 Quad-IDX (In)
13 33 IOPort None
14 18 IOPort PWM 1 PWM (Out)
15 20 IOPort None
16 22 IOPort StepGen 9 Step/Table1 (Out)
17 24 IOPort None

(Note: I reordered this slightly to put the pins in order for easier comparison)

But when I connect to the board through halcmd, I get this:

halcmd: loadrt hm2_eth board_ip=192.168.1.121 config="num_stepgens=4 num_encoders=1 num_pwmgens=0"
hm2_eth: loading Mesa AnyIO HostMot2 ethernet driver version 0.2
hm2_eth: 192.168.1.121: Hardware address: 00:60:1b:11:00:72
hm2_eth: discovered 7I92
hm2/hm2_7i92.0: 34 I/O Pins used:
hm2/hm2_7i92.0: IO Pin 000 (P2-01): IOPort
hm2/hm2_7i92.0: IO Pin 001 (P2-14): IOPort
hm2/hm2_7i92.0: IO Pin 002 (P2-02): StepGen #0, pin Step (Output)
hm2/hm2_7i92.0: IO Pin 003 (P2-15): IOPort
hm2/hm2_7i92.0: IO Pin 004 (P2-03): StepGen #0, pin Direction (Output)
hm2/hm2_7i92.0: IO Pin 005 (P2-16): IOPort
hm2/hm2_7i92.0: IO Pin 006 (P2-04): StepGen #1, pin Step (Output)
hm2/hm2_7i92.0: IO Pin 007 (P2-17): IOPort
hm2/hm2_7i92.0: IO Pin 008 (P2-05): StepGen #1, pin Direction (Output)
hm2/hm2_7i92.0: IO Pin 009 (P2-06): StepGen #2, pin Step (Output)
hm2/hm2_7i92.0: IO Pin 010 (P2-07): StepGen #2, pin Direction (Output)
hm2/hm2_7i92.0: IO Pin 011 (P2-08): StepGen #3, pin Step (Output)
hm2/hm2_7i92.0: IO Pin 012 (P2-09): StepGen #3, pin Direction (Output)
hm2/hm2_7i92.0: IO Pin 013 (P2-10): Encoder #0, pin A (Input)
hm2/hm2_7i92.0: IO Pin 014 (P2-11): Encoder #0, pin B (Input)
hm2/hm2_7i92.0: IO Pin 015 (P2-12): Encoder #0, pin Index (Input)
hm2/hm2_7i92.0: IO Pin 016 (P2-13): IOPort
hm2/hm2_7i92.0: IO Pin 017 (P1-01): IOPort
hm2/hm2_7i92.0: IO Pin 018 (P1-14): IOPort
hm2/hm2_7i92.0: IO Pin 019 (P1-02): IOPort
hm2/hm2_7i92.0: IO Pin 020 (P1-15): IOPort
hm2/hm2_7i92.0: IO Pin 021 (P1-03): IOPort
hm2/hm2_7i92.0: IO Pin 022 (P1-16): IOPort
hm2/hm2_7i92.0: IO Pin 023 (P1-04): IOPort
hm2/hm2_7i92.0: IO Pin 024 (P1-17): IOPort
hm2/hm2_7i92.0: IO Pin 025 (P1-05): IOPort
hm2/hm2_7i92.0: IO Pin 026 (P1-06): IOPort
hm2/hm2_7i92.0: IO Pin 027 (P1-07): IOPort
hm2/hm2_7i92.0: IO Pin 028 (P1-08): IOPort
hm2/hm2_7i92.0: IO Pin 029 (P1-09): IOPort
hm2/hm2_7i92.0: IO Pin 030 (P1-10): IOPort
hm2/hm2_7i92.0: IO Pin 031 (P1-11): IOPort
hm2/hm2_7i92.0: IO Pin 032 (P1-12): IOPort
hm2/hm2_7i92.0: IO Pin 033 (P1-13): IOPort
hm2/hm2_7i92.0: registered


Some of the IO ports have been inserted into the range of step generators, and the Index ports were moved from pins 10-12 to pins 13-15. Can you think of any reason these would differ? And how can I fix it to match?

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

More
15 Jan 2016 00:20 - 15 Jan 2016 00:20 #68421 by andypugh
Replied by andypugh on topic Mesa 7i92 .bit file
I think it is right.

The IO port numbers do not match the DB25 pin numbers.

So
hm2/hm2_7i92.0: IO Pin 003 (P2-15): IOPort
is GPIO number 003 but is on pin 15 of the P2 (DB25) connector.
(P1 is the box header)
Last edit: 15 Jan 2016 00:20 by andypugh.
The following user(s) said Thank You: 10K

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

More
15 Jan 2016 00:26 #68422 by 10K
Replied by 10K on topic Mesa 7i92 .bit file
Ah hah! It's obvious now that you pointed it out! So I'm in good shape so far.

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

More
15 Jan 2016 02:09 #68430 by 10K
Replied by 10K on topic Mesa 7i92 .bit file
I'm back to working on the .ini and .hal files. I had asked before about a hm2_7i92.so file. There is not one. So how do I configure the .ini file? I'd think that it looked something like this:
loadrt trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt hostmot2
loadrt hm2_eth board_ip="192.168.1.121" config="firmware=7i92_G540x2D.bit num_stepgens=4 num_encoders=1 num_pwmgens=0"
loadrt stepgen step_type=0,0
loadrt encoder num_chan=1

addf hm2_7i92.0.read base-thread
addf stepgen.make-pulses base-thread
addf encoder.update-counters base-thread
addf hm2_7i92.0.write base-thread
addf hm2_7i92.0.reset base-thread
...
If there's not a hm2_7i92, how do I add a real time component function?

Note: It's entirely possible that I am completely confused about how all this works.

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

More
15 Jan 2016 10:07 - 15 Jan 2016 10:14 #68436 by cncbasher
Replied by cncbasher on topic Mesa 7i92 .bit file
you do not need any other files hm2_eth has all you need .
as the bit file is flashed to the card it's not required to be part of the config line

all you need is:
loadrt hm2_eth board_ip="192.168.1.121"

unless you are changing the configuration of the prebuilt stepgens the rest of the line is not needed
ethernet does not work over RTAI , you need to use rt-preempt , it is a uspace component ,

if your using the linuxcnc livecd , this is all setup for you
Last edit: 15 Jan 2016 10:14 by cncbasher.
The following user(s) said Thank You: 10K

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

More
15 Jan 2016 10:21 - 15 Jan 2016 10:21 #68437 by andypugh
Replied by andypugh on topic Mesa 7i92 .bit file

I'm back to working on the .ini and .hal files.


The HAL file is the important one, the INI is just a place to put information that the HAL file needs.
Some components (such as motion) look in the INI file for config data. But typically the HAL file accesses INI file entries with [SECTION]ITEM syntax.
You are perfectly at liberty to add your own items to existing sections and new sections to the INI if you wish.

Personally I prefer not to get the hm2 parameters from the INI so my HAL files tend to contain
loadrt hm2_pci config="firmware=....."
type lines.

I had asked before about a hm2_7i92.so file. There is not one. So how do I configure the .ini file?

Assuming you mean the HAL file, I don't know, but I do know how to find out.
halrun
loadrt hostmot2
loadrt hm2_eth ...
show funct

Will show you the HAL thread-functions that exist to add to the realtime thread(s)
You will either see hm2_eth.0.read or hm2_7i92.0.read etc. It depends on whether hmw_eth creates HAL names in its own name or the identified card name. (I don't have the hardware or OS to check)
Last edit: 15 Jan 2016 10:21 by andypugh.
The following user(s) said Thank You: 10K

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

More
15 Jan 2016 15:24 #68456 by 10K
Replied by 10K on topic Mesa 7i92 .bit file
Thanks andypugh, that's very helpful! So I ran the show funct command, and here's what I got:
halcmd: show funct
Exported Functions:
Owner   CodeAddr  Arg       FP   Users  Name
 00009  7f0dba7d975f  00ddc9a0  YES      0   hm2_7i92.0.read
 00009  7f0dba7d9702  00ddc9a0  YES      0   hm2_7i92.0.read-request
 00009  7f0dba7d9632  00ddc9a0  YES      0   hm2_7i92.0.write

So the HAL name is hm2_7i92!

I found that editing the code automatically generated by Stepconf Wizard was problematic. So I generated some code using Pncconf Wizard using one of the included boards. I changed the name of the board in the .hal file to 7i92, and tweaked the loadrt hm2_eth line, and linuxcnc ran! I'm sure that I'll need some edits, but this gives me a good place to start.

PS, you are correct. The configuration code I quoted in my earlier post was from the .hal file, not the .ini file.

cncbasher, I could not load the livecd version of linuxcnc on my computer. I'm limited on what I can get to run because the computer has UEFI and a eMMC drive. I can only install 64 bit versions of linux, and they must be recent versions. Older versions (such as Debian Wheezy) don't see the eMMC drive, and can't be installed. I'm currently running Linux Mint 2 (LMDE2) and RT PREEMPT 4.4.

Thanks for the hint on loading the hm2_eth driver. I removed the firmware= part of the config, but I am, as you mentioned, changing the config of the prebuilt stepgens, encoders, and pwmgens, so I do need the config=.... (See earlier posts in this thread)

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

More
15 Jan 2016 15:37 #68458 by andypugh
Replied by andypugh on topic Mesa 7i92 .bit file

I found that editing the code automatically generated by Stepconf Wizard was problematic. So I generated some code using Pncconf Wizard using one of the included boards. I changed the name of the board in the .hal file to 7i92, and tweaked the loadrt hm2_eth line, and linuxcnc ran! I'm sure that I'll need some edits, but this gives me a good place to start.


Excellent. Now you have a working config I suggest you make a backup, and from now on make your changes by editing HAL and INI rather than letting PNCConf over-write your edits.

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

More
15 Jan 2016 16:23 #68466 by PCW
Replied by PCW on topic Mesa 7i92 .bit file
You should add this to the pncconf created HAL file to get the best possible
stepgen performance:

# latch all stepgen position counts 50 usec before nominal read time:
setp hm2_7i92.0.0.dpll.01.timer-us -50
setp hm2_7i92.0.0.stepgen.timer-number 1
The following user(s) said Thank You: 10K

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

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