Update Orocos Configuration
@@ -1,18 +1,88 @@
|
||||
Orocos needs to be configured to your hardware, this involves:
|
||||
|
||||
1. Loading the correct kernel modules
|
||||
1. Loading the correct kernel modules for hardware drivers
|
||||
2. Identifying the device number that Comedi is assigning to each card
|
||||
3. Set the correct device number in the Orocos start.ops file
|
||||
|
||||
## Kernel Modules
|
||||
## Kernel Driver Modules
|
||||
|
||||
The correct module names for your hardware can be found on the [Comedi website](https://www.comedi.org/hardware.html). Searching for just the number part of the card name is a quick way to find it.
|
||||
|
||||
Comedi can automatically load the correct modules for most hardware - the exception is the Agilent interferometer card, for which Joerg wrote a custom driver module. If you need to support an Agilent N1231 (A or B version), then your system will require manual loading of a set of kernel modules.
|
||||
|
||||
(Further detail needed)
|
||||
Manual loading of Comedi drivers as kernel modules is done in two steps: (these are already in the setup guide, so you might have already done them.)
|
||||
1. Turning off automatic loading:
|
||||
```
|
||||
sudo cp ~/work/stxm/SystemInstall/comedi.conf /etc/modprobe.d
|
||||
```
|
||||
The comedi.conf file just contains the line `options comedi comedi_autoconfig=0`.
|
||||
|
||||
The module names for your hardware can be found on the [Comedi website](https://www.comedi.org/hardware.html). Searching for just the number part of the card name is a quick way to find it.
|
||||
2. Provide the set of modules to be loaded by the kernel:
|
||||
First, copy and link the service script:
|
||||
```
|
||||
sudo cp ~/work/stxm/SystemInstall/ComediLoadModules /etc/init.d
|
||||
cd /etc/rc5.d
|
||||
sudo ln -s ../init.d/ComediLoadModules S98ComediLoadModules
|
||||
```
|
||||
|
||||
## Identify Device Numbers
|
||||
Next, edit the `loadComedi` section of `/etc/init.d/ComediLoadModules` file to load the correct driver modules with `modprobe` commands and assign the modules to comedi devices. The PolLux version look like:
|
||||
```
|
||||
. /lib/lsb/init-functions
|
||||
. /etc/default/rcS
|
||||
|
||||
loadComedi()
|
||||
{
|
||||
|
||||
sync
|
||||
modprobe comedi
|
||||
#2> /dev/null
|
||||
modprobe kcomedilib
|
||||
#2> /dev/null
|
||||
insmod $RTAI_MODULES_DIR/rtai_comedi.ko
|
||||
#2> /dev/null
|
||||
|
||||
modprobe ni_660x
|
||||
#2> /dev/null
|
||||
|
||||
modprobe ni_pcimio
|
||||
|
||||
modprobe agilent_n1231
|
||||
|
||||
sync
|
||||
|
||||
/usr/local/sbin/comedi_config /dev/comedi4 ni_660x
|
||||
/usr/local/sbin/comedi_config /dev/comedi1 ni_pcimio
|
||||
/usr/local/sbin/comedi_config /dev/comedi2 ni_pcimio
|
||||
/usr/local/sbin/comedi_config /dev/comedi3 n1231a
|
||||
/usr/local/sbin/comedi_config /dev/comedi0 ni_660x
|
||||
|
||||
chmod go+rw /dev/comedi*
|
||||
|
||||
sync
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
The Comedi device numbers ("/dev/comedi#") assigned in the loadComedi section of the script are the numbers that are referred to in the following section, so they will hopefully match when you check them. Note that the command only assigns a Comedi device number to a kernel module and not a specific card, so it is not exactly specific if you have cards sharing the same module. In such cases you can follow the rule that Comedi will first find and assign the card with the higher PCI address.
|
||||
|
||||
In the example of PolLux, `lspci` shows:
|
||||
```
|
||||
03:00.0 Bridge: Agilent Technologies Device 0a00 (rev 01)
|
||||
03:01.0 Unassigned class [ff00]: National Instruments PCI-6602 (rev 01)
|
||||
03:02.0 Unassigned class [ff00]: National Instruments PCI-6733
|
||||
03:03.0 Unassigned class [ff00]: National Instruments PCI-6289
|
||||
03:04.0 Unassigned class [ff00]: National Instruments PCI-6602 (rev 01)
|
||||
```
|
||||
|
||||
and therefore the command `/usr/local/sbin/comedi_config /dev/comedi4 ni_660x` will start by looking at the NI-6602 card in address "03:04.0" and assign it to `/dev/comedi4`.
|
||||
|
||||
The next command `/usr/local/sbin/comedi_config /dev/comedi1 ni_pcimio` will start by looking at the NI-6602 card in address "03:04.0" and ignore it because it uses a different module (as well as already being assigned), then look at the NI-6289 card in address "03:03.0", see that the module is appropriate and assign it to `/dev/comedi1`.
|
||||
|
||||
The next command `/usr/local/sbin/comedi_config /dev/comedi2 ni_pcimio` will look past address "03:04.0" (wrong module) and "03:03.0" (already assigned), and then assign `/dev/comedi2` to the NI-6733 card in PCI address "03:02.0".
|
||||
|
||||
The next two commands assign `/dev/comedi3` to the Agilent N1231A card in PCI address "03:00.0", and then assign `/dev/comedi0` to the NI-6602 card in PCI address "03:01.0"
|
||||
|
||||
## Identify/Verify Device Numbers
|
||||
|
||||
The device numbers assigned to each card can be found in the kernel message log, which is printed with `dmesg` (might need `sudo dmesg`). There can be a lot of messages to sort through, so you can narrow it down with `dmesg | grep comedi`. This should produce output that includes lines like (example from PolLux):
|
||||
|
||||
@@ -36,7 +106,7 @@ This corresponds to a PolLux configuration with:
|
||||
- NI-6602 (ni_660x) assigned device number 0
|
||||
- NI-6289 (ni_pcimio) assigned device number 1
|
||||
- NI-6733 (ni_pcimio) assigned device number 2
|
||||
- Agilent N1231 (n1231) assigned device number 3
|
||||
- Agilent N1231 (n1231a) assigned device number 3
|
||||
- NI-6602 (ni_660x; used for reading the output of the Attocube interferometer) assigned device number 4
|
||||
|
||||
If you have multiple cards using the same driver, then it can be a bit complicated to figure out which is which. As a rule, Comedi will tend to assign a smaller device number to the card with the higher PCI address.
|
||||
|
||||
Reference in New Issue
Block a user