- From: Luc Lefebvre <luc.lefebvre_at_mcgill.ca>
- Date: Wed, 15 Jan 2003 10:32:47 -0500 (EST)
Hi Kenneth,
As mentioned earlier...
This document describes my experience in getting comedi working with a
National Instruments DAQ Card <model 6062E> with Debian Woody and
kernel 2.4.18. It, or parts of it could be added as an addtional
example in the section 2 <Installation and Configuration> of the
Comedilib documentation <if deemed appropriate>.
Hopefully this will be of use to others. Any additional input is
welcome and if the list finds this useful, I will post any updates or
changes.
----------> START of EXAMPLE <---------------
Before getting started, one strong recommendation, join the comedi
mailing list and read the archives. The usual read the READMEs and
other docs.
--Getting the software.
-Kernel source
The kernel source can be obtained either through your distribution
<deb or rpm package> or at the usual place <kernel.org and mirrors>.
-Comedi & Comedilib
They are packaged with many distributions <including Debian> or can be
downloaded from the comedi website <http://stm.lbl.gov/comedi/>. The
version I used is comedilib-0.7.19.tgz and comedi-0.7.66.tgz.
-PCMCIA-CS
With the linux kernel, <at least with 2.4 kernels> you will need to
compile and install pcmcia card services. This is usually packaged
with your distribution. More information at
<http://pcmcia-cs.sourceforge.net/>
--Configuring the kernel.
In order to use a pcmcia DAQ card with comedi one needs to install
pcmcia card services modules <I compiled from source, pcmcia-cs
version 3.1.33>. In order for comedi to generate the proper
configuration during the make phase, the kernel _must_ be compiled
with PCMCIA/CardBus support enabled <ie. CONFIG_PCMCIA=y in your
kernel .config file, the "general setup" section in xconfig>.
--Compiling & installing Comedi & Comedilib
Comedi is the device drivers, comedlib are the libraries required to
write software which interacts with the comedi supported devices.
For the Debian distribution one extracts the comedi archive into the
/usr/src/modules directory. This allows us to use the "make-kpkg
--revision xx modules-image" which generates a package compatible with
the kernel source which is ready to install. During the process you
will be asked a series of questions which will result in the .config
file for the comedi module. My .config file is as follows:
#
# Automatically generated make config: don't edit
#
CONFIG_COMEDI=m
#
# Comedi Features
#
# CONFIG_COMEDI_RT is not set
CONFIG_COMEDI_DEBUG=y
CONFIG_COMEDI_KLIB=m
#
# Hardware device drivers
#
# CONFIG_COMEDI_DT is not set
CONFIG_COMEDI_NI=y
# CONFIG_COMEDI_NI_ATMIO is not set
CONFIG_COMEDI_NI_MIO_CS=m
# CONFIG_COMEDI_NI_DAQ_DIO24 is not set
# CONFIG_COMEDI_NI_PCIMIO is not set
# CONFIG_COMEDI_NI_PCIDIO is not set
# CONFIG_COMEDI_NI_670X is not set
# CONFIG_COMEDI_NI_ATMIO16D is not set
# CONFIG_COMEDI_NI_AT_A2150 is not set
# CONFIG_COMEDI_NI_LABPC is not set
# CONFIG_COMEDI_NI_AT_AO is not set
# CONFIG_COMEDI_DAS08 is not set
# CONFIG_COMEDI_DAS16 is not set
# CONFIG_COMEDI_DAS16M1 is not set
# CONFIG_COMEDI_DAS6402 is not set
# CONFIG_COMEDI_DAS800 is not set
# CONFIG_COMEDI_DAS1800 is not set
# CONFIG_COMEDI_CB_PCIDAS is not set
# CONFIG_COMEDI_CB_PCIDAS64 is not set
# CONFIG_COMEDI_CB_PCIDDA is not set
# CONFIG_COMEDI_CB_PCIMDDA is not set
# CONFIG_COMEDI_CB_PCIMDAS is not set
# CONFIG_COMEDI_CB_DAS16_CS is not set
CONFIG_COMEDI_8255=m
# CONFIG_COMEDI_MULTIQ3 is not set
CONFIG_COMEDI_PARPORT=m
# CONFIG_COMEDI_ADL_PCI9111 is not set
# CONFIG_COMEDI_ADL_PCI9118 is not set
# CONFIG_COMEDI_ADV_PCI1710 is not set
# CONFIG_COMEDI_PCL711 is not set
# CONFIG_COMEDI_PCL724 is not set
# CONFIG_COMEDI_PCL725 is not set
# CONFIG_COMEDI_PCL726 is not set
# CONFIG_COMEDI_PCL812 is not set
# CONFIG_COMEDI_PCL816 is not set
# CONFIG_COMEDI_PCL818 is not set
# CONFIG_COMEDI_RTD520 is not set
# CONFIG_COMEDI_RTI800 is not set
# CONFIG_COMEDI_RTI802 is not set
# CONFIG_COMEDI_II_PCI20KC is not set
# CONFIG_COMEDI_CONTEC_PCI_DIO is not set
# CONFIG_COMEDI_QUATECH_DAQP is not set
# CONFIG_COMEDI_DAQBOARD2000 is not set
# CONFIG_COMEDI_DAQBOARD2000_FPGA is not set
# CONFIG_COMEDI_FL512 is not set
# CONFIG_COMEDI_POC is not set
# CONFIG_COMEDI_PCM3730 is not set
# CONFIG_COMEDI_PCMAD is not set
# CONFIG_COMEDI_AMPLC_PCI230 is not set
# CONFIG_COMEDI_AMPLC_PC236 is not set
# CONFIG_COMEDI_AMPLC_PC263 is not set
# CONFIG_COMEDI_SSV_DNP is not set
# CONFIG_COMEDI_ICP_MULTI is not set
# CONFIG_COMEDI_KE_COUNTER is not set
# CONFIG_COMEDI_ME_DAQ is not set
CONFIG_COMEDI_TEST=m
CONFIG_COMEDI_SKEL=m
CONFIG_COMEDI_FC=m
#---END OF COMEDI .config FILE---
NOTE: Do not forget to run "make dev" from the comedi source directory
if the devices /dev/comedi? don't exist on your system. See the
INSTALL file in the source directory.
Comedilib is easily produced as a package with the "make debian"
command <there is a similar "make rpm" command for RPM based distros>.
One important detail if you want to use the python or perl wrappers
provided edit the Config file in the comedlib directory to reflect
this. After making the package simply install as per your
distributions procedure.
--Configuring the system
One additional step that I had to perform was to add the following
lines to my /etc/modutils/aliases file:
alias char-major-98 comedi
alias char-major-98-0 ni_mio_cs
These items are taken from "ls -l /dev/comedi*" where the major and
minor device numbers are listed. Comedi devices are character
devices, their major number is 98, and the first one
<ie. /dev/comedi0> has a minor number of 0.
I also created the file /etc/modutils/comedi with the contents:
# created in order to add comedi modules to modules.conf
# via update-modules
# ---
# LL 8 Jan 2003
# ---
path=/lib/modules/`uname -r`/comedi/comedi
#---end of /etc/modutils/comedi file---
I also added the following 2 lines to the /etc/modules file:
comedi
ni_mio_cs
I then ran update-modules which <in Debian distributions> updated the
/etc/modules.conf.
I then ran "depmod -a".
Now with the DAQ Card in place one can run modprobe ni_mio_cs to load
the module, or if the card is in place when one reboots the computer
one should have the card come up automatically with the modules
automatically loaded. I used cardinfo <an X-windows gui showing the
status of pcmcia card slots> to verify that the card was identified
and configured OK <I got the proper card ID, as well as an irq and
memory address allocated>.
NOTE: the Debian package libcomedi-dev includes the file
/etc/pcmcia/comedi.conf which takes care of associating the card
manfid with the card name and its driver.
I then ran a series of example programs provided with comedilib <in
the associated demo subdirectory and all seems to be working OK.
-----------------> END of documentation INSERT <--------------------
The one remaining issue is that my card does not come up "clean".
Interestingly the modules are loaded but the card is not configured
<ie. no irq or address assigned>. I get the following error message
<in /var/log/syslog>:
Jan 9 11:41:33 deb cardmgr[355]: socket 1: National Instruments DAQCard-6062E
Jan 9 11:41:33 deb kernel: cs: memory probe 0xa0000000-0xa0ffffff: excluding 0xa0000000-0xa00fffff
Jan 9 11:41:33 deb cardmgr[355]: executing: 'modprobe ni_mio_cs'
Jan 9 11:41:34 deb cardmgr[355]: get dev info on socket 1 failed: Resource temporarily unavailable
#
# ******* I then run cardctl eject from the command line
# and the module is removed automatically
#
Jan 9 11:47:57 deb cardmgr[355]: executing: 'modprobe -r ni_mio_cs'
Jan 9 11:48:05 deb cardmgr[355]: socket 1: National Instruments DAQCard-6062E
#
# ******* I then run cardctl insert from command line
# and the module is loaded again automatically, this time successfully!...
# this totally baffles me for the moment
#
Jan 9 11:48:06 deb cardmgr[355]: executing: 'modprobe ni_mio_cs'
Jan 9 11:48:06 deb kernel: comedi: version 0.7.66 - David Schleef <ds_at_schleef.org>
Jan 9 11:48:06 deb cardmgr[355]: + Warning: loading /lib/modules/2.4.18/comedi/comedi/drivers/ni_mio_cs.o will taint the kernel: no license
Jan 9 11:48:06 deb kernel: mio_cs: Card Services release does not match!
Jan 9 11:48:06 deb cardmgr[355]: executing: './comedi start ni_mio_cs'
Jan 9 11:48:06 deb kernel: cs: IO port probe 0x0100-0x04ff: excluding 0x240-0x24f 0x388-0x38f 0x3b8-0x3df 0x408-0x40f 0x480-0x48f 0x4d0-0x4d7
Jan 9 11:48:06 deb kernel: cs: IO port probe 0x0250-0x0387: clean.
Jan 9 11:48:06 deb kernel: cs: IO port probe 0x0390-0x03b7: clean.
Jan 9 11:48:06 deb kernel: cs: IO port probe 0x03e0-0x0407: clean.
Jan 9 11:48:06 deb kernel: cs: IO port probe 0x0410-0x047f: clean.
Jan 9 11:48:06 deb kernel: cs: IO port probe 0x0490-0x04cf: clean.
Jan 9 11:48:06 deb kernel: cs: IO port probe 0x04d8-0x04ff: clean.
Jan 9 11:48:06 deb kernel: cs: IO port probe 0x0800-0x08ff: clean.
Jan 9 11:48:06 deb kernel: cs: IO port probe 0x0a00-0x0aff: clean.
Jan 9 11:48:06 deb kernel: cs: IO port probe 0x0c00-0x0cff: clean.
Jan 9 11:48:06 deb kernel: comedi0: ni_mio_cs: DAQCard: io 0x0120, irq 3, DAQCard-6062E
This has got me baffled at the moment. I currently have
CONFIG_PCMCIA=y in my kernel .config as mentioned above but the other
items in the kernel PCMCIA/CardBus are currently "not set". My
workaround <I plan on doing most of my stuff with python> will be to
add a procedure that will do the cardctl thing in software if the DAQ
isn't configured <at least until I can figure out what the issue(s)
are that prevent the DAQ from configuring reliably at first go...>.
In conclusion I would like to thank David Schleef and other
contributors to the comedi project as well as the kindness and
generosity of all list members.
--URLs
Comedi: <http://stm.lbl.gov/comedi/>
pcmcia-cs: <http://pcmcia-cs.sourceforge.net/>
Luc Lefebvre
13 January 2003
On Wed, 15 Jan 2003, Kenneth Jacker wrote:
> luc> I am putting together an account of what I did in order to get
> luc> my NI DAQ Card to work with comedi. It will be under 10k in
> luc> size. Would it be appropriate for me to post this to the list?
>
>
> I'd appreciate seeing a copy if you could email it and/or
> provide a URL.
>
> Thanks for sharing your work ...
>
> -Kenneth
>
--
Luc Lefebvre o
/`-'
Open Source, a strategic choice \ www.eff.org
for mission-critical applications ___/___./ www.publicknowledge.org
http://www.gnu.org/philosophy/no-word-attachments.html
Key fingerprint = D2E5 5E35 B910 6F4E 0242 EC63 0FD9 96D0 C7F4 784E
Received on 2003-01-15Z15:32:47