First Time Help

More
28 Jun 2011 22:42 - 30 Jun 2011 18:44 #10937 by andypugh
Replied by andypugh on topic Re:First Time Help
Here is a totally untried attempt at a driver.
(It is a bit tricky to test without the actual hardware)

Save the attached file somewhere, then use comp to install it:

comp --install /path/to/where/the/file/is/pcl720.comp

Then, in the HAL file load it rather like hal_parport in the sample configs.

loadrt pcl720 ioaddr=0x300
(If you had a second card at 400 hex then it would be loadrt pcl720 ioaddr=0x300,0x400)

Then add it to the base thread with
addf pcl720.0.write base-thread
addf pcl720.0.read base-thread

That will create 32 input pins with names like pcl720.0.pin-00-in and 32 output pins with names like pcl720.0.pin-31-out
You then connect those as required, eg

net x-dir stepgen.0.dir => pcl720.0.pin-00-out
net x-step stepgen.0.step => pcl720.0.pin-02-out
and so on.

I would be astonished if it worked without a few more iterations.
Attachments:
Last edit: 30 Jun 2011 18:44 by andypugh. Reason: deleted buggy file version

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

More
29 Jun 2011 12:46 #10948 by btvpimill
Replied by btvpimill on topic Re:First Time Help
Hi Andy, great stuff there. here are my first questions:

What is the protocal for the parallel port? for instance how does I/O card know when an address is sent vs data, also how does it know when to "read" or "write"

Next, how often does the transaction occur?

I understand most all of your file with 1 exception:

pin in bit pin-##-out[32] "output pins";
pin out bit pin-##-in[32] "input pins";


I get the array part, but why pin IN bit pin-##-OUT? and vice-versa on the next line.
Is it IN from HAL then OUT to the card?

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

More
29 Jun 2011 12:59 #10949 by andypugh
Replied by andypugh on topic Re:First Time Help
btvpimill wrote:

What is the protocal for the parallel port? for instance how does I/O card know when an address is sent vs data, also how does it know when to "read" or "write"

This driver does not use the parallel port, it uses the ISA bus.
However, the principle is much the same. If you send the data to (typically) 0x378 then the data bytes appear at the parallel port. In this case sending them to 0x300 will send them to the ISA bus, and to the pcl720 card. The low-level hardware stuff is done by a magic that we don't need to understand.

Next, how often does the transaction occur?

Every time the pcl720.N.read and pcl720.N.write function is called by the realtime system. That depends on the thread it is attached to. Typically that is every 1mS for the servo thread, and every 20uS for a base-thread on a low-latency machine.

I get the array part, but why pin IN bit pin-##-OUT? and vice-versa on the next line.
Is it IN from HAL then OUT to the card?

Yes, exactly that (or IN to the card and OUT of the connector). I got it wrong first time round writing the driver :-)

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

More
29 Jun 2011 13:14 #10952 by btvpimill
Replied by btvpimill on topic Re:First Time Help
Doh!! I forgot he has an ISA card. That makes it so much nicer IMHO. I miss that bus.

Ok, so if doing this with a Parallel port, I assume we would use the port as a real port and maybe there are read/write bits on the port. Back to google to help to dig up OLD memories of how the parallel port communicates.

I'll be back when I brush up on it a bit :)

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

More
29 Jun 2011 14:05 #10959 by Todd Zuercher
Replied by Todd Zuercher on topic Re:First Time Help
When I ran comp this is what was spit out.

make -C /usr/src/linux-headers-2.6.32-122-rtai SUBDIRS=`pwd` CC=gcc V=0 -o /Module.symvers modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-122-rtai'
CC [M] /tmp/tmpUprtGT/pcl720.o
Building modules, stage 2.
MODPOST 1 modules
WARNING: "hal_init" [/tmp/tmpUprtGT/pcl720.ko] undefined!
WARNING: "hal_exit" [/tmp/tmpUprtGT/pcl720.ko] undefined!
WARNING: "hal_export_funct" [/tmp/tmpUprtGT/pcl720.ko] undefined!
WARNING: "hal_malloc" [/tmp/tmpUprtGT/pcl720.ko] undefined!
WARNING: "hal_pin_bit_newf" [/tmp/tmpUprtGT/pcl720.ko] undefined!
WARNING: "rtapi_snprintf" [/tmp/tmpUprtGT/pcl720.ko] undefined!
WARNING: "hal_ready" [/tmp/tmpUprtGT/pcl720.ko] undefined!
WARNING: "rtapi_print" [/tmp/tmpUprtGT/pcl720.ko] undefined!
CC /tmp/tmpUprtGT/pcl720.mod.o
LD [M] /tmp/tmpUprtGT/pcl720.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-122-rtai'
cp pcl720.ko /usr/realtime-2.6.32-122-rtai/modules/emc2/
cp: cannot create regular file `/usr/realtime-2.6.32-122-rtai/modules/emc2/pcl720.ko': Permission denied
make: *** [install] Error 1

Did I do something wrong?

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

More
29 Jun 2011 14:41 #10961 by andypugh
Replied by andypugh on topic Re:First Time Help
Todd Zuercher wrote:

When I ran comp this is what was spit out.
WARNING: "hal_init" [/tmp/tmpUprtGT/pcl720.ko] undefined!
WARNING: "hal_exit" [/tmp/tmpUprtGT/pcl720.ko] undefined!
WARNING: "hal_export_funct


Ah, yes.
The problem is that it can't compile the module without some header files which define some of the functions it uses.
(Which I have, of course, so didn't notice the problem)

I will need to have a look on my reference installation tonight to see if the files exist in a standard installation. The other alternative is to download the full EMC2 source code, but that seems like a lot of trouble.

cp pcl720.ko /usr/realtime-2.6.32-122-rtai/modules/emc2/
cp: cannot create regular file `/usr/realtime-2.6.32-122-rtai/modules/emc2/pcl720.ko': Permission denied
make: *** [install] Error 1

You probably need to use
sudo comp --install pcl720.comp
so that you temporarily have read/write rights to the kernel modules directory.
(it will ask for a password)

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

More
29 Jun 2011 15:44 #10964 by BigJohnT
Replied by BigJohnT on topic Re:First Time Help
Usually you can just ignore the warnings and as Andy pointed out you need to use sudo.

John

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

More
29 Jun 2011 18:09 #10966 by Todd Zuercher
Replied by Todd Zuercher on topic Re:First Time Help
Ok, I reran comp with sudo, ignoring all the warnings.

Then using the basic stepper configuration as a model I tried to set something up, but I am not getting any movement.:(

Something needs a little more tweaking, but I am to much of a noob to have a clue.

I am not even sure what information to give to ask for help.

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

More
29 Jun 2011 18:39 #10969 by andypugh
Replied by andypugh on topic Re:First Time Help
You can't really ignore the function XXXX undefined warnings.

Bear with me, I will look into it.

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

More
29 Jun 2011 18:49 #10971 by BigJohnT
Replied by BigJohnT on topic Re:First Time Help
Did you add your comp to your hal file?

www.linuxcnc.org/docview/html/hal_basic_hal.html

John

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

Time to create page: 0.092 seconds
Powered by Kunena Forum