====================================== HOWTO setup an NREC development system ======================================

Contents ======== 1. Hardware requirements 2. Linux kernel 3. RTAI Modules 4. Comedi 5. Qwt 6. Development tools and libraries 7. NREC 8. Known issues

1. Hardware requirements ======================= - Modern x86 PC - Dual head graphics adapter - For Data Acquisition and Digital I/O development: A Comedi (see www.comedi.org) compatible DAQ card, e.g. a Measurement Computing PCI-DAS6025. - For the Trigger/Clipping the following connections must be established:

2. Linux Kernel =============== - Recent stable 2.6 kernel. Either from kernel.org or from your distribution, e.g. Debian packaged kernel. - Make sure the following configuration options are selected. (Current Debian Sarge kernel-images have all these options set, so there is probably no need to build a custom kernel.):

2.1 Linux Kernel with RTAI realtime extensions ============================================== - Install latest stable kernel sources

- Install RTAI extensions

- Unpack kernel-sources and rtai-sources

- Change into the build dir

- Copy config file of your running kernel into the build dir (for a reasonable default config)

- Get package fpr kernel-compilation:

- Apply rtai patch suitable for your kernel version:

- Configure and build kernel

- Leave kernel source dir

- Install the built kernel

- check grub boot manager entry:

- If you get lots of IRQ-related messages after rebooting, insert the parameters noirqdebug and pci=noacpi to the kernel-command of your boot-manager (lilo or grub).

3. RTAI Modules ===============

- Get rtai from https://www.rtai.org/RTAI/ - or check out stable branch (vulcano) via cvs to /usr/local/src/rtai/vulcano:

- Install like written in /usr/local/src/rtai/vulcano/README.INSTALL:

- In the menu "General" set the rtai-path (/usr/lib/realtime)

- Make it:

- If you would like to test rtai, do:

- It is useful to link the rtai modules to /lib/modules/$(uname -a)/

4. Comedi ========= - The official comedi-source package in the Debian repository which

- You will need some Debian administration and development tools.

- Get original debian comedi package source:

- Get current comedi release:

- Unpack:

- Merge with debian source:

- Now, we have to generate a list of files which are to be included in the package:

- and add a changelog entry at the top of debian/changelog:



- NOTE1: Currently (Feb 2007) Comedi PCMCIA drivers are broken with kernels >= 2.6.17.

- NOTE2: If you are using debian/rules from an old debian package (i.e. 0.7.70 or earlier)

- Now we can finally build the Debian package:

- If everything went well you now have a debian package in the parent directory.

- NOTE3: This .deb package is system independent. I.e. having created it once

- Install your created Debian package:

- Build and install the comedi-modules for your running kernel using module-assistant (m-a):

- Make comedilib package:

- Download comedilib-x.x.x.tar.gz from http://www.comedi.org/download

- Unpack:

- Make package:

- Install package:

- Load modules and associate comedi-driver of your card to comedi-device:

- Configure comedi with the comedi-driver of your card

- Test comedi installation:

- Modules can be specified in /etc/modules,

- comedi_config can be called in a startup-script for automation

5. Qwt ========== - Make sure you have qt3 installed:

- Download the latest Qwt 5.0 from

- Unpack the archive:

- Build the library:

- To use the library you have to

6. Development tools and libraries ================================== - Install subversion client

- Install kdevelop (optional)

- Install the HDF5 library (required) and tools (optional)

- Install the movie libraries

- Install the gnu scientific library

7. NREC =======

- Checkout module "nrec" from the subversion server

- Generate Makefile from qmake project file

- Import NREC project into KDevelop (optional)

- Compile NREC. Either in KDevelop "Build" -> "Build Project" or on the command line type

8. Known issues ===============

8.1 Frame length is 100ms too large: Symptoms: When NREC is started from X running on a second graphics adapter the first time, syslog says "Disbling IRQ X" and from now until reboot all frames are 100ms too long. Cause: For some reason, a flood of unhandled interrupts from the Matrox graphics card occurs and this IRQ is disabled by kernel interrupt debugging routines. Solution: Append the bootparam 'noirqdebug' to the kernel command line. (lilo.conf: Insert an append = "irqdebug" in the section of your kernel image; run lilo. See 'man 7 bootparam' and 'man 5 lilo.conf')

8.2 RealTime graphics thread runs away: Symptoms: Matrox graphics and MC DAQ card share the same IRQ (see 'lspci -v'). When a trial is started, the RT graphics thread takes all CPU time and {renders the system unusable | is killed by the watchdog}. Cause: matroxfb and Comedi cb_pcidas64 drivers interfere the IRQ management of each other. (Bad implementation in Comedi driver?) matroxfb can't enable the VSYNC interrupt so the ioctl( WAITFORVSYNC ) fails. Hence, DirectFB does a busy wait for the IRQ so the thread never sleeps. Solution: Put the DAQ card into another PCI slot that doesn't share interrupts with the AGP slot. Consult the motherboard manual or try it out. A good guess is a slot physically far away from the AGP slot.

8.3 dfb hangs at startup/initialization (dfbinfo hangs already) dfb init has problems, if the module has been loaded before X. Solution: Load matroxfb after X has been started. Reload dfb modules: # rmmod matroxfb_base matroxfb_DAC1064 matroxfb_accel cfbcopyarea cfbimgblt cfbfillrect matroxfb_Ti3026 matroxfb_g450 g450_pll matroxfb_misc mga # modprobe matroxfb_base # modprobe mga

==============

APPENDIX

==============

A.1 RTAI device nodes creation script =====================================


8<


#!/bin/bash mkdir /dev/rtf for n in seq 0 9 do

done for n in seq 0 9 do

done


8<


A.2 Patch to disable PCMCIA drivers: =====================================


--- comedi-debian/comedi-0.7.70/debian/rules 2007-02-25 18:12:38.000000000 +0100 +++ comedi-build/debian/rules 2007-02-25 18:56:10.000000000 +0100 @@ -34,7 +34,7 @@

- CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --with-rtaidir=/usr/lib/realtime + CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --with-rtaidir=/usr/lib/realtime --disable-pcmcia


A.3 Startscript for automatically configuring comedi device: =============================================================

#! /bin/sh # # comedi-device Associate Comedi driver with device file # # Friedemann Bunjes <friedemann.bunjes@uni-tuebingen.de> #

case "$1" in

# comedi_config /dev/comedi0 ni_pcimio

esac

exit 0