User Tools

Site Tools


ds:comedi

This is an old revision of the document!


Comedi - The Linux Control and Measurement Device Interface

Comedi provides a common Linux interface to certain DAQ hardware,
typical PCI digital and analog I/O cards and is actively developed since 1998.

It consists of

  • Linux drivers
  • Comedilib
  • Kcomedilib

Drivers

Comedi and available drivers are integrated into the Linux kernel.
For some reasons Comedi is still located in the staging tree.

To enable Comedi and build the comedi module, setup the
kernel configuration as follows:

Device Drivers [*]
    Staging drivers [*]
        Data acquisition support <M>
      

This ensures the built of the comedi module only.
To actually make use of the supported hardware,
the comedi driver(s) need to be set to build.

Taking the ADDI-DATA I/O PCI card 1648 for example,
activate the Comedi PCI drivers section and set the appropriate driver.

            Comedi PCI drivers [*]
                ADDI-DATA APCI_16xx support <M>

This will built the driver module addi_apci_16xx,
which depends on the comedi module.

When loaded, lsmod shows something like:

comedi                 46649  1 addi_apci_16xx

Every device gets a separate comedi[0-9]+ node in the device tree.
Assuming only one card in this example

crw-rw---- 1 root root 98, 0 Aug  4  2015 /dev/comedi0

To access the device, use the library Comedilib for user-space applications
or Kcomedilib for real-time kernel modules making use of Comedi hardware.

Comedilib

Comedilib needs to be installed

> comedi_board_info
overall info:
  version code: 0x00074c
  driver name: addi_apci_16xx
  board name: apci1696
  number of subdevices: 3
subdevice 0:
  type: 5 (digital I/O)
  flags: 0x00030000
  number of channels: 32
  max data value: 1
  ranges:
    all chans: [0,5]
  command:
    not supported
subdevice 1:
  type: 5 (digital I/O)
  flags: 0x00030000
  number of channels: 32
  max data value: 1
  ranges:
    all chans: [0,5]
  command:
    not supported
subdevice 2:
  type: 5 (digital I/O)
  flags: 0x00030000
  number of channels: 32
  max data value: 1
  ranges:
    all chans: [0,5]
  command:
    not supported 
  

Kcomedilib

Kcomedilib provides the Comedilib interface to the kernel space.
This is useful when writing real-time kernel modules that need
access to Comedi devices.

Resources

ds/comedi.1438778671.txt.gz · Last modified: 2015/08/05 14:44 by tmilosic