Possibly the most complex task you face if you want to use kacq is to install the prerequisites. It could involve compiling and installing a linux kernel, along with a few other packages. The instructions below aim at making these steps as simple as possible. This process went smoothly the last few times we have tried it.
First, you need a computer. The more channels and the higher the sampling rate you want to use, the faster the computer needs to be. kacq was written to take advantage of multi-core processors (see Code section of manual). A processor with 4 cores should give you optimal results. You would also benefit from a computer with a decent graphic card to display the oscilloscope. Make sure there are Linux drivers available for you graphic card. We have been developping kacq with a Dell OptiPlex 780-Desktop equipped with an Intel Core i7 processor. With this machine, the acquisition and recording of 64 channels at 20 kHz takes less than 5% of the processor time (as measured with the top
command). The oscilloscope is the processor intensive part of kacq. The processor usage of the oscilloscope depends on the settings and the type of signal being displayed.
kacq uses the comedi drivers to interact with the acquisition cards. You can have a look at the comedi website to know which acquisition cards are supported. If you want to record from only one board, you can probably pick any card that is supported and that fits your requirements. Because we want to record from 64 channels, we need to work with two cards simultaneously. We opted for 2 NI PCI-6259 cards. These cards support RTSI (Real Time System Integration) bus. This is used to synchronize the two cards. You need a bus cable to connect the RTSI of the two cards. The cable can be ordered from National Instruments. Note that the method to synchronize two cards varies depending on which cards you are using. So if you want to use kacq with more than one card without changing the code, better stick to the PCI-6259.
Once you have the computer equipped with the card(s), you need to install a recent Gnu/Linux operating system. This usually involves burning a DVD and rebooting your system from the DVD. We are using the 64-bit version of Fedora 17.
Because the linux kernel coming with Fedora is heavily modified, we need to compile and install a vanilla kernel on the computer to be able to use the comedi drivers. The configuration of the kernel is key to good acquisition performance. When kacq acquires data from many channels at high sampling rates, large amounts of data accumulate quickly in the driver buffers and kacq must empty this buffer regularly to avoid buffer overflow, which results in loss of data. Long delays between reading the driver buffer can be caused by other processes running on the computer. To avoid this situation, steps can be taken to ensure that kacq regularly empty the data from the driver buffer. There are several solutions available. One is to enable the option “Preemptible Kernel “ in the kernel option. This should reduce significantly the low latency responses of the computer. Another solution is to install the real-time patch to the vanilla kernel (see https://rt.wiki.kernel.org/index.php/Main_Page and https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO). This creates a kernel with very low latencies. We are developping kacq with the preemtive option found in the kernel version 3.4.4. Here are the steps to install that kernel.
cd ; wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.4.4.tar.bz2
tar -jxvf linux-3.4.4.tar.bz2
cd linux-3.4.4 ; cp /boot/config-3.4.3-1.fc17.x86_64 .config
make oldconfig
Answer yes (y) or m to most questions if you are not sure. This command will update the .config file so that it is compatible with the new kernel. You might have to install ncurses-devel to run make oldconfig.
make menuconfig
make
or make -j 8
if you can run many processes in parallel.
make modules_install
make install
List the different choice
grep ^menuentry /boot/grub2/grub.cfg | cut -d "'" -f2
Set the desired default
grub2-set-default "menuentry title"
Apply the change
grub2-mkconfig -o /boot/grub2/grub.cfg
shutdown -r now
uname -a
ln -s ~/linux-3.4.4 /usr/src/linux
git clone git://comedi.org/git/comedi/comedi.git
git clone git://comedi.org/git/comedi/comedilib.git
cd comedi; ./autogen.sh; ./configure; make
As root cd comedi;make install; depmod -a
/dev/comedi0
should be created.
yum install comedilib-devel
During our latest installation, this step was done automatically when rebooting.
If it is not the case, this is what you have to do with a two NI PCI-6259 card setup.
comedi_config /dev/comedi0 ni_pcimio
comedi_config /dev/comedi1 ni_pcimio
You might want to have permission to write and read on the files /dev/comedi0 and /dev/comedi1. This will allow you to run kacq as a normal user. To make that process automated on Fedora 17:
touch /etc/rc.d/rc.local; chmod ugo+x /etc/rc.d/rc.local
Add #!/bin/sh at the top of /etc/rc.d/rc.local
echo "chown user_name /dev/comedi0; chgrp group_name /dev/comedi0 >> /etc/rc.d/rc.local"
To be able to compile kacq, you also need the gtk+2 development kit.
yum install gtk2-devel
cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/kacq co kacq
cd kacq/kacq;./autogen.sh;./configure; make; su -; make install
If everything worked, you should have kacq installed on the computer.