comedi installation

Hi Alex,
I am using red hat 7.3.
Below you can find my notes on the steps I followed (based on the
documentation (readme, emails, etc) included in the distribution that
explains what to do for red hat installation).

This is for comedi 0.7.66 / comedilib 0.7.20.
It is the same for comedi 0.7.68 with some exceptions (****) I mentioned in
the text.



Configuring and Compiling the Kernel (2.4.18-3, Red Hat)
____________________________________________________________________________
__
1)
as root:

2)
create symbolic links:

linux -> linux-2.4.18-3
linux-2.4 -> linux-2.4.18-3

3)
clean .o files and dependencies lying around
cd /usr/src/linux
make mrproper

4)
copy the desired configuration file from
/usr/src/linux/configs to
/usr/src/linux

cd /usr/src/linux
cp /usr/src/linux/configs/kernel-2.4.18-i686.config ./.config

5)
configure kernel
make oldconfig or
make menuconfig if you want to change the configuration

6)
set up all the dependencies correctly
make dep

-it updates /usr/src/linux/include/linux/version.h:
    #define UTS_RELEASE "2.4.18-3custom"
    #define LINUX_VERSION_CODE 132114
    #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

7)
create a compressed kernel image
make bzImage

- it creates /usr/src/linux/arch/i386/boot/bzImage

8)
install the new kernel
make install

- it copies bzImage to /boot/vmlinuz-2.4.18-3custom,
- creates vmlinuz -> vmlinuz-2.4.18-3custom
- creates new Kernel Symbol Table:
   System.map-2.4.18-3custom, (and System.map -> System.map-2.4.18-3custom_)
- updates /boot/grub.conf
   title Red Hat Linux (2.4.18-3custom)
         root (hd0,0)
         kernel /boot/vmlinuz-2.4.18-3custom ro root=/dev/hda1 vga=794
video=vesa

9)
build modules
make modules

10)
install modules
make modules_install

- creates /lib/modules/2.4.18-3custom

11)
reboot,
and start with the new kernel






Configuring and Compiling Comedi
____________________________________________________________________________
__



A. comedi 0.7.66 (the kernel space - modules)
B. comedilib 0.7.20


___A______configure and compile comedi 0.7.66______
1)
copy comedi-0.7.66.tgz to /usr/loca/
unzip: tar xzvf comedi-0.7.66.tgz

2)
modify /usr/local/comedi-0.7.66/include/linux/fs.h:

/*
 * linux/fs.h compatibility header
 */

#ifndef __COMPAT_LINUX_FS_H_
#define __COMPAT_LINUX_FS_H_

#include <linux/version.h>

/* #if LINUX_VERSION_CODE < 0x020200  */
/* no fasync */
/* #define KILL_FASYNC(a,b,c) */
/* #else  */
/* #if LINUX_VERSION_CODE < 0x020400  */
/* #define KILL_FASYNC(a,b,c)   kill_fasync((a),(c))  */
/* #else  */

#define KILL_FASYNC(a,b,c)      kill_fasync(&(a),(b),(c))

/* #endif */
/* #endif */



#include_next <linux/fs.h>

#endif


3)
- Check  /usr/src/linux/include/linux/version.h
#define UTS_RELEASE "2.4.18-3custom"
#define LINUX_VERSION_CODE 132114
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

- Ensure that the value for UTS_RELEASE matches the current kernel (type
uname -r from the console)
$uname -r
2.4.18-3custom

4)for comedi-0.7.66
Configure comedilib
cd /usr/local/comedi-0.7.66
make config

- Enter location of Linux source tree [/lib/modules/2.4.18-3custom/build]:
- Press enter to accept the location of the linnux source tree (this is
actually /usr/src/linux-2.4.18-3)
- Select features:
 * Verbose Debugging (CONFIG_COMEDI_DEBUG) [Y/n/?] Y
 * Kernel Comedilib (CONFIG_COMEDI_KLIB) [M/n/?] M
 * Data Translation boards (CONFIG_COMEDI_DT) [Y/n/?] Y
 * Enter N for all of the remaining feature exept for the following:
 * National Instruments boards (CONFIG_COMEDI_NI) [Y/n/?] Y

 * Computer Boards PCI-DAS series (CONFIG_COMEDI_CB_PCIDAS) [M/n/?] M

 * Computer Boards PCI-DAS64xx and PCI-DAS60xx series
(CONFIG_COMEDI_CB_PCIDAS64) [M/n/?] M
 * Computer Boards PCI-DDA series (CONFIG_COMEDI_CB_PCIDDA) [M/n/?] M
 * Computer Boards PCIM-DDA06-16 driver (CONFIG_COMEDI_CB_PCIMDDA) [M/n/?] M
 * Computer Boards PCIM-DAS driver (CONFIG_COMEDI_CB_PCIMDAS) [M/n/?] M
 * Computer Boards PC-CARD-DAS16/16 driver (CONFIG_COMEDI_CB_DAS16_CS)
[M/n/?] M
 * Generic 8255 support (CONFIG_COMEDI_8255) [M/n/?] M
 * Comedi test driver (CONFIG_COMEDI_TEST) [M/n/?] M
 * Skeleton driver (CONFIG_COMEDI_SKEL) [M/n/?] M

*****
4)for comedi-0.7.68
cd /usr/local/comedi-0.7.68
./configure
*****


5)
Makefiles for Comedi are now configured.
Run 'make' to compile

make

 - it creates under /usr/local/comedi-0.7.66/comedi/drivers:
   cb_pcidas.o, 8255.o, etc...



6)
as root:
and then 'make install' to install.  It will create:
/lib/modules/2.4.18-3custom/comedi

make install

*****
for comedi-0.7.68:
- I got some errors but related with some doc/manuals compilation (?)...
- All the modules (*.o) were installed in /lib/modules/2.4.18-3custom/comedi
and later at 8), modprobe complains it does not find some modules under
/lib/modules/2.4.18-3custom/comedi/comedi   and
/lib/modules/2.4.18-3custom/comedi/comedi/drivers.
so I created these 2 new directories and copied all the modules there.
(in comedi-0.7.66 these directories were created by make install)
*****


7)
if comedi has never been installed on your system, run 'make dev' to create
the device nodes (files) '/dev/comedi*'.  You need to create device files
to access the hardware from the user space.

make dev

 mknod -m 666 /dev/comedi0 c 98 0
 mknod -m 666 /dev/comedi1 c 98 1
 mknod -m 666 /dev/comedi2 c 98 2
 mknod -m 666 /dev/comedi3 c 98 3


8)
Install the driver module ("cb_pcidas" for our board) into the kernel:

/sbin/modprobe cb_pcidas

 -to verify run /sbin/lsmod
 Module                  Size  Used by    Not tainted
 cb_pcidas              15140   0  (unused)
 8255                    3616   0  [cb_pcidas]
 comedi_fc               1840   0  [cb_pcidas]
 comedi                 23084   0  [cb_pcidas 8255 comedi_fc]


9)

___B______configure and compile comedilib 0.7.20______

B1)
copy comedilib-0.7.20.tar.gz to /usr/loca/
unzip: tar xzvf comedilib-0.7.20.tar.gz

B2)
Configure comedilib
./configure

B3)
make

 - creates /usr/local/comedilib-0.7.20/lib/.libs/libcomedi.so, libcomedi.a

B4)
as root:

make install

 - installs libcomedi.so, libcomedi.a in /usr/local/lib

__________________________________________________________


10)
- comedi_config  is  used  to configure comedi drivers.
- each measurement device is associated with a particular comedi
       device file /dev/comediN, where N is 0,1,2,3, etc.
- comedi_config  allows  you  to associate a particular driver (and device)
  with a comedi device file (and also configure driver parameters for the
particular device)

as root:
cd /usr/local/comedilib-0.7.20/comedi_config/
./comedi_config /dev/comedi0 cb_pcidas


- /sbin/modprobe -c shaws all the configured module
  $/sbin/modprobe -c | grep comedi =>
  alias char-major-98 comedi




11)
to autoload comedi modules at start up modify /etc/modules.conf (this does
not apply to PCMCIA cards).
Add the following lines:

 alias char-major-98 comedi
 alias char-major-98-0 cb_pcidas
 post-install cb_pcidas
/usr/local/comedilib-0.7.20/comedi_config/comedi_config /dev/comedi0
cb_pcidas

__________________________________________________________


12)
verify:
$cat /proc/comedi
comedi version 0.7.66
format string: "%2d: %-20s %-20s %4d",i,driver_name,board_name,n_subdevices
 0: cb_pcidas            pci-das1602/16          7
cb_pcidas:
 cb_pcidas
8255:
 8255


13)
run some demo programs from /usr/local/comedilib-0.7.20/demo

demo-1)
If hardware and software are correctly installed, the program prints a list
of subdevices it recognises.

cd /usr/local/comedilib-0.7.20/demo
./info
overall info:
  version code: 0x000742
  driver name: cb_pcidas
  board name: pci-das1602/16
  number of subdevices: 7
subdevice 0:
  type: 1 (analog input)
  number of channels: 16
  max data value: 65535
  ranges:
    all chans: [-10,10] [-5,5] [-2.5,2.5] [-1.25,1.25] [0,10] [0,5] [0,2.5]
[0,1.25]
  command:
    start: now|ext
    scan_begin: follow|timer|ext
    convert: now|timer|ext
    scan_end: count
    stop: none|count
  command fast 1chan:
    start: now 0
    scan_begin: follow 0
    convert: timer 5000
    scan_end: count 1
    stop: count 2
subdevice 1:
  type: 2 (analog output)
  number of channels: 2
  max data value: 65535
  ranges:
    all chans: [-5,5] [-10,10] [0,5] [0,10]
  command:
    start: int
    scan_begin: timer|ext
    convert: now
    scan_end: count
    stop: none|count
  command fast 1chan:
    start: int 0
    scan_begin: timer 10000
    convert: now 0
    scan_end: count 1
    stop: count 2
subdevice 2:
  type: 5 (digital I/O)
  number of channels: 24
  max data value: 1
  ranges:
    all chans: [0,5]
  command:
    not supported
subdevice 3:
  type: 8 (memory)
  number of channels: 128
  max data value: 255
  ranges:
    all chans: [0,1]
  command:
    not supported
subdevice 4:
  type: 9 (calibration)
  number of channels: 8
  max data value: 255
  ranges:
    all chans: [0,1]
  command:
    not supported
subdevice 5:
  type: 9 (calibration)
  number of channels: 2
  max data value: 255
  ranges:
    all chans: [0,1]
  command:
    not supported
subdevice 6:
  type: 9 (calibration)
  number of channels: 1
  max data value: 255
  ranges:
    all chans: [0,1]
  command:
    not supported



demo-2)
Continue with ./inp -s <subdevice> -c <channel> to read individual samples

cd /usr/local/comedilib-0.7.20/demo
./inp -s 2 -c 0 -v   to read DI0
__________________________________________________________________________
















-----Original Message-----
From: Alex Fielding [mailto:afielding_at_adelphia.net]
Sent: April 1, 2004 4:18 AM
To: George Pava
Subject: Re: AO consecutive writing - problem


Mr. Pava,
I see from your recent post to the comedi mailing list that you upgraded to
comedi 0.7.68.  Might you please let me know what Linux distribution /
version are you using?

I am having troubles installing 0.7.68 onto an older Linux version and I am
thinking about installing a newer distribution.

Regards,
Alex

----- Original Message -----
From: "George Pava" <pava_at_cs.ubc.ca>
To: "Ashish Golkar" <ashish_at_casde.iitb.ac.in>
Cc: "Frank Mori Hess" <fmhess_at_users.sourceforge.net>; <comedi_at_comedi.org>
Sent: Thursday, March 25, 2004 5:54 PM
Subject: RE: AO consecutive writing - problem


> Thanks for your suggestion, this is what I did:
>
> 1)upgrade to comedi(0.7.68 / 0.7.21) as Frank recommended.
> The Analog Output problem is still there, basically you can use only one
AO;
> if you write to AO0 3V, you will get 3V at the output, but than if you
write
> 7V
> to AO1, the value of AO0 is changing to 0 or other negative values (AO1
will
> have the correct value of 7V).
>
> 2)I modified cb_pcidas.c as Ashish indicates below.  This solved the
> crosstalk for the AI but not the AO.
>
> I would appreciate any other tips you may have.
> If I have to start digging into this, is there any overall description of
> how modules/drivers are build/interact/ etc ?
>
> Thanks,
> George
>
>
>
>
> -----Original Message-----
> From: Ashish Golkar [mailto:ashish_at_casde.iitb.ac.in]
> Sent: March 19, 2004 6:56 AM
> To: pava_at_cs.ubc.ca
> Subject: Measurement Computing setup
>
>
> Hi...just read your email on the DAS card from Measurement Computing...we
> faced a similar problem with our DAS 1002...if we used the driver code as
> is we got a lot of crosstalk between adjacent channels...we tried changing
> the multiplexer settling time in the driver code...the function where we
> changed the settling time is listed below...hope it helps.
>
> static int cb_pcidas_ai_rinsn(comedi_device *dev, comedi_subdevice *s,
> comedi_insn *insn, lsampl_t *data)
> {
> int n,i;
> unsigned int bits;
> static const int timeout = 10000;
>
> // enable calibration input if appropriate
> if( insn->chanspec & CR_ALT_SOURCE )
> outw( cal_enable_bits( dev ),
> devpriv->control_status + CALIBRATION_REG);
> else
> outw( 0, devpriv->control_status + CALIBRATION_REG);
> // set mux limits and gain
> bits = BEGIN_SCAN(CR_CHAN(insn->chanspec)) |
> END_SCAN(CR_CHAN(insn->chanspec)) |
> GAIN_BITS(CR_RANGE(insn->chanspec));
> // set unipolar/bipolar
> if(CR_RANGE(insn->chanspec) & IS_UNIPOLAR)
> bits |= UNIP;
> // set singleended/differential
> if(CR_AREF(insn->chanspec) != AREF_DIFF)
> bits |= SE;
> outw(bits, devpriv->control_status + ADCMUX_CONT);
>
> /**************************************************
>  wait for mux to settle
> **************************************************/
> comedi_udelay(6);  /* <---addition to eliminate crosstalk */
>
> /* clear fifo */
> outw(0, devpriv->adc_fifo + ADCFIFOCLR);
> /* convert n samples */
> for (n = 0; n < insn->n; n++)
> {
> /* trigger conversion */
> outw(0, devpriv->adc_fifo + ADCDATA);
> /* wait for conversion to end */
> /* return -ETIMEDOUT if there is a timeout */
> for(i = 0; i < timeout; i++)
> {
> if (inw(devpriv->control_status + ADCMUX_CONT) &
> EOC)
> break;
> }
> if(i == timeout)
> return -ETIMEDOUT;
> /* read data */
> data[n] = inw(devpriv->adc_fifo + ADCDATA);
> }
>
> /* return the number of samples read/written */
> return n;
> }
>
> -Ashish
> -------------------------------
> PHOTON+ELECTRON+TRUST=BIG MESS
> -------------------------------
>
>
> _______________________________________________
> comedi mailing list
> comedi_at_comedi.org
> https://cvs.comedi.org/cgi-bin/mailman/listinfo/comedi
>

Received on 2004-04-01Z21:58:55