1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>2. Configuration</title><link rel="stylesheet" type="text/css" href="comedilib.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="index.html" title="Comedi"><link rel="up" href="index.html" title="Comedi"><link rel="prev" href="index.html" title="Comedi"><link rel="next" href="gettinginformation.html" title="2.2. Getting information about a card"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.
Configuration
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="gettinginformation.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="install"></a>2.
Configuration
</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="install.html#cardconfiguration">2.1.
Configuration
</a></span></dt><dt><span class="section"><a href="gettinginformation.html">2.2.
Getting information about a card
</a></span></dt></dl></div><p>
This section assumes that you have successfully compiled and installed
the <a class="ulink" href="http://www.comedi.org" target="_top"><acronym class="acronym">Comedi</acronym></a> software, that your hardware device is in your computer,
and that you know the relevant details about it, i.e., what kind of
card it is, any jumper settings related to input ranges, the
I/O base address and IRQ for old non-plug-n-play boards, etc.
</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="cardconfiguration"></a>2.1.
Configuration
</h3></div></div></div><p>
The good news is: on most systems PCI and USB based boards are
configured automatically. The kernel will
detect your data acquisition devices, will load the appropriate
kernel drivers and will create the
<code class="filename">/dev/comedi</code> entries.
</p><pre class="screen">
bp1@bp1-x61:~/sandbox/comedilib$ ls -l /dev/comedi0*
crw-rw---- 1 root iocard 98, 0 2012-04-26 23:41 /dev/comedi0
crw-rw---- 1 root iocard 98, 48 2012-04-26 23:41 /dev/comedi0_subd0
crw-rw---- 1 root iocard 98, 49 2012-04-26 23:41 /dev/comedi0_subd1
</pre><p>
Usually these devices belong to the group <code class="systemitem">iocard</code> as shown here. The only
action you need to take is to become member of this group and
then the <a class="ulink" href="http://www.comedi.org" target="_top"><acronym class="acronym">Comedi</acronym></a> device is ready to be used.
</p><p>
There are a few PCI drivers that for one reason or another
do not support auto-configuration, either because there is
more than one variant of a board sharing the same PCI device
ID (e.g. Advantech PCI-1710 and PCI-1710HG), or because
some configuration options are needed (e.g. Amplicon PCI224
and PCI234) or for some other reason. It is also possible
to disable auto-configuration when loading the
<code class="systemitem">comedi</code> kernel module. In these
cases devices need to be configured manually as for ISA
cards. Conversely, most <a class="ulink" href="http://www.comedi.org" target="_top"><acronym class="acronym">Comedi</acronym></a> drivers supplied with the
kernel sources that support auto-configuration may no longer
support manual configuration.
</p><p>
By default, the <code class="systemitem">comedi</code> kernel module
does not reserve any devices for manual configuration so
manual configuration will fail. To allow devices to be
configured manually, set the
<em class="parameter"><code>comedi_num_legacy_minors</code></em> module
parameter to the number of devices to reserve for manual
configuration when loading the <code class="systemitem">comedi</code>
kernel module. If using <span class="command"><strong>modprobe</strong></span>, this
can be set automatically by editing
<code class="filename">/etc/modprobe.conf</code> or
<code class="filename">/etc/modprobe.d/comedi.conf</code> (depending
on the system) to include the line:
</p><pre class="screen">
options comedi comedi_num_legacy_minors=4
</pre><p>
The number <code class="literal">4</code> in the above line may be
adjusted to increase or decrease the number of devices to be
reserved for manual configuration.
</p><p>
Old ISA based cards need to be manually configured which is
explained here. You only need to read on here
if you have one of these old cards.
On embedded systems it might also be necessary to load the
driver and then to configure the boards manually.
In general manual configuration is done by running
the <span class="command"><strong>comedi_config</strong></span> command
(as <code class="systemitem">root</code>).
Here is an example of how to use the command (perhaps you should read
its <span class="command"><strong>man</strong></span> page now):
</p><pre class="screen">
comedi_config /dev/comedi0 labpc-1200 0x260,3
</pre><p>
This command says that the <span class="quote">“<span class="quote">file</span>”</span>
<code class="filename">/dev/comedi0</code> can be used to access the <a class="ulink" href="http://www.comedi.org" target="_top"><acronym class="acronym">Comedi</acronym></a>
device that uses the <em class="parameter"><code>labpc-1200</code></em> board, and that
you give it two run-time parameters (<code class="literal">0x260</code> and
<code class="literal">3</code>). More parameters are possible, and their
meaning is driver dependant.
</p><p>
This tutorial goes through the process of configuring <a class="ulink" href="http://www.comedi.org" target="_top"><acronym class="acronym">Comedi</acronym></a>
for two devices, a
National Instruments AT-MIO-16E-10, and a
Data Translation DT2821-F-8DI.
</p><p>
The NI board is plug-and-play. The current <code class="systemitem">ni_atmio</code> driver
has kernel-level ISAPNP support, which is used by default
if you do not specify a base address. So you could simply
run <span class="command"><strong>comedi_config</strong></span> as
</p><pre class="screen">
comedi_config /dev/comedi0 ni_atmio
</pre><p>
For the preceding <span class="command"><strong>comedi_config</strong></span> command to succeed, the
<code class="systemitem">ni_atmio</code> kernel module must
be loaded first. For plug-n-play boards on
modern kernels, the appropriate comedi kernel modules should get loaded
automatically when your computer is booted.
The <span class="command"><strong>modprobe</strong></span> command can
be used to manually load/unload kernel modules, and <span class="command"><strong>lsmod</strong></span>
will list all the currently loaded modules.
</p><p>
For the Data Translation board, you need to know
how the board's jumpers are configured in order to specify the correct
<span class="command"><strong>comedi_config</strong></span> parameters. These parameters for the board are given in the
<a class="link" href="lowleveldrivers.html" title="5.6. Kernel drivers">kernel drivers</a> section about the <code class="systemitem">dt282x</code>
driver.
The card discussed here is a DT2821-f-8di. The
entry for the <code class="systemitem">dt282x</code> driver tells you that the
<span class="command"><strong>comedi_config</strong></span> parameters give the driver the I/O base,
IRQ, DMA 1, DMA 2, and
in addition the states of the
differential/single-ended and unipolar/bipolar jumpers:
</p><div class="itemizedlist"><p class="title"><b>dt282x configuration options:</b></p><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>[0] - I/O port base address</p></li><li class="listitem"><p>[1] - IRQ</p></li><li class="listitem"><p>[2] - DMA 1</p></li><li class="listitem"><p>[3] - DMA 2</p></li><li class="listitem"><p>[4] - AI jumpered for 0=single ended, 1=differential</p></li><li class="listitem"><p>[5] - AI jumpered for 0=straight binary, 1=2's complement</p></li><li class="listitem"><p>[6] - AO 0 jumpered for 0=straight binary, 1=2's complement</p></li><li class="listitem"><p>[7] - AO 1 jumpered for 0=straight binary, 1=2's complement</p></li><li class="listitem"><p>[8] - AI jumpered for 0=[-10,10]V, 1=[0,10], 2=[-5,5], 3=[0,5]</p></li><li class="listitem"><p>[9] - AO 0 jumpered for 0=[-10,10]V, 1=[0,10], 2=[-5,5], 3=[0,5],
4=[-2.5,2.5]</p></li><li class="listitem"><p>[10]- A0 1 jumpered for 0=[-10,10]V, 1=[0,10], 2=[-5,5], 3=[0,5],
4=[-2.5,2.5]</p></li></ul></div><p>
</p><p>
So, the appropriate options list might be:
</p><pre class="screen">
0x200,4,0,0,1,1,1,1,0,2,2
</pre><p>
and the full configuration command is:
</p><pre class="screen">
comedi_config /dev/comedi1 dt2821-f-8di 0x200,4,0,0,1,1,1,1,0,2,2
</pre><p>
Setting the DMA channels to 0 disables the use of DMA.
</p><p>
So now you have your boards configured correctly.
Since data acquisition boards are not typically well-engineered,
<a class="ulink" href="http://www.comedi.org" target="_top"><acronym class="acronym">Comedi</acronym></a> sometimes can't figure out if an old non-plug-n-play
board is actually in the computer and at the base address you specified.
If it can't, it assumes you are right. Both of these boards
are well-made, so <a class="ulink" href="http://www.comedi.org" target="_top"><acronym class="acronym">Comedi</acronym></a> will give an error message if it
can't find them. The <a class="ulink" href="http://www.comedi.org" target="_top"><acronym class="acronym">Comedi</acronym></a> kernel module, since it is a part
of the kernel, prints messages to the kernel logs, which you
can access through the command <span class="command"><strong>dmesg</strong></span> or the file
<code class="filename">/var/log/messages</code>.
Here is a configuration failure (from <span class="command"><strong>dmesg</strong></span>):
</p><pre class="screen">
comedi0: ni_atmio: 0x0200 can't find board
</pre><p>
When it does work, you get:
</p><pre class="screen">
comedi0: ni_atmio: 0x0260 at-mio-16e-10 ( irq = 3 )
</pre><p>
Note that it also correctly identified the board.
</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="gettinginformation.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Comedi </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.2.
Getting information about a card
</td></tr></table></div></body></html>
|