Problems with Digital Input/Output Configuration on MCCDAQ DAS1602/12.

81 views
Skip to first unread message

Alexandre Oliveira

unread,
Jul 28, 2010, 4:27:32 PM7/28/10
to comed...@googlegroups.com
Hello!

I can't find how to properly configure/access the digital output ports
of my board, a Measurement Computing PCI DAS1602/12. The analog ports
(in/out) are working as expected.

Board Name: pci-das1602/12
Driver Name: cb_pcidas

comedi_dio_config and comedi_dio_get_config always return -1.

Also, the board has 7 sub-devices and, strangely, none of them a
number of channels compatible with the DIO.

Nr Channels.
Subdevice 0: 16 ---- Analog Input
Subdevice 1: 2 ---- Analog Output
Subdevice 2: 0 ----
Subdevice 3: 256 -----
Subdevice 4: 8 ----- Probably DIO. Shouldn't there be only 4 channels?
(as specified in the manual)
Subdevice 5: 1 -----
Subdevice 6: 0 -----

Could you point me to some direction? I've nearly exausted my resources.

Best regards,
Alexandre

Ian Abbott

unread,
Jul 29, 2010, 5:54:14 AM7/29/10
to comed...@googlegroups.com

Well I can tell you what the subdevices are supposed to be:

0: AI, 16 SE chans, maxdata 0xFFF
1: AO, 2 chans, maxdata 0xFFF
2: DIO, 24 chans (grouped as 8, 8, 4, 4 chans), maxdata 1
3: MEMORY, 256 chans, maxdata 0xFF (serial EEPROM)
4: CALIB, 8 chans, maxdata 0xFF (8800 CALDAC)
5: CALIB, 1 chan, maxdata 0x7F (AD7376 trimpot)
6: NONE, 0 chans

There seem to be two different cards both identified as "pci-das1602/12"
by the driver. The other one has slightly different specs, but yours
seems to match the above apart from subdevice 2. I don't know why you
have 0 channels on subdevice 2 though, as that is handled by the 8255
subdevice driver (8255.ko) and is used by several other drivers.

--
-=( Ian Abbott @ MEV Ltd. E-mail: <abb...@mev.co.uk> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-

Alexandre Oliveira

unread,
Jul 29, 2010, 3:17:27 PM7/29/10
to comed...@googlegroups.com
Hello Ian. Thanks For the information.

When I installed the PCI Card in my computer, I just rebooted the
machine and the Comedi driver was already configured. I didn't run any
"comedi_config" command. So, I tested the analog outputs and analog
inputs with succeed. I only found out the error while testing the
Digital IO channels.

Could the problem be this? I didn't 'configure' the board correctly.

Reading the Documentation again, i saw:

==========================
(begin)
You should enable compilation this driver if you plan to use a board
that has an 8255 chip. For multifunction boards, the main driver will
configure the 8255 subdevice automatically.

This driver also works independently with ISA and PCI cards that
directly map the 8255 registers to I/O ports, including cards with
multiple 8255 chips. To configure the driver for such a card, the
option list should be a list of the I/O port bases for each of the
8255 chips. For example, comedi_config /dev/comedi0 8255
0x200,0x204,0x208,0x20c

Note that most PCI 8255 boards do NOT work with this driver, and
need a separate driver as a wrapper. For those that do work, the
I/O port base address can be found in the output of ’lspci -v’.
(end)
===================


Well, it's saying that most multifunction board configure it
automatically. However, this hasn't happened with my board. How do I
compile this driver for my board?

Here's what I've already done.

i installed with 'modprobe 8255' and it appeared at 'lsmod' command. I
wrote 'comedi_config -r /dev/comedi0' to remove the current driver and
'comedi_config /dev/comedi0 cb_pcidas'. Even then, the channels on the
subdevice 2 were still 0.

As the second paragraph suggests, i could create another driver on
/dev/comedi1/ for the 8255 chip only, but it seems a bit hard.

Any more advices?
Sorry about the english.

Alexandre.

2010/7/29 Ian Abbott <abb...@mev.co.uk>:

> --
> You received this message because you are subscribed to the Google Groups "Comedi: Linux Control and Measurement Device Interface" group.
> To post to this group, send email to comed...@googlegroups.com.
> To unsubscribe from this group, send email to comedi_list...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/comedi_list?hl=en.
>
>

Ian Abbott

unread,
Jul 30, 2010, 7:32:34 AM7/30/10
to comed...@googlegroups.com
On 29/07/10 20:17, Alexandre Oliveira wrote:
> Hello Ian. Thanks For the information.
>
> When I installed the PCI Card in my computer, I just rebooted the
> machine and the Comedi driver was already configured. I didn't run any
> "comedi_config" command. So, I tested the analog outputs and analog
> inputs with succeed. I only found out the error while testing the
> Digital IO channels.
>
> Could the problem be this? I didn't 'configure' the board correctly.

That shouldn't be a problem. Most of the comedi PCI card drivers
(including cb_pcidas) configure their cards automatically now.

> Reading the Documentation again, i saw:
>
> ==========================
> (begin)
> You should enable compilation this driver if you plan to use a board
> that has an 8255 chip. For multifunction boards, the main driver will
> configure the 8255 subdevice automatically.
>
> This driver also works independently with ISA and PCI cards that
> directly map the 8255 registers to I/O ports, including cards with
> multiple 8255 chips. To configure the driver for such a card, the
> option list should be a list of the I/O port bases for each of the
> 8255 chips. For example, comedi_config /dev/comedi0 8255
> 0x200,0x204,0x208,0x20c
>
> Note that most PCI 8255 boards do NOT work with this driver, and
> need a separate driver as a wrapper. For those that do work, the

> I/O port base address can be found in the output of �lspci -v�.


> (end)
> ===================
>
>
> Well, it's saying that most multifunction board configure it
> automatically. However, this hasn't happened with my board. How do I
> compile this driver for my board?

I've had a closer look at the "staging" Comedi driver sources included
in the kernel (2.4.34) and it seems that all the drivers that use the
8255 module as a subdevice driver are crippled. Even though the 8255.ko
module is built when CONFIG_COMEDI_PCI_DRIVERS is configured in the
kernel, none of the other drivers use the 8255.ko module and use "dummy"
versions of the functions to configure the 8255 subdevice.

The reason is fairly subtle. In drivers/staging/comedi/drivers/8255.h
there is the following code:

---------------------------------------------------------------------
#if defined(CONFIG_COMEDI_8255) || defined(CONFIG_COMEDI_8255_MODULE)

int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
int (*cb) (int, int, int, unsigned long),
unsigned long arg);
int subdev_8255_init_irq(struct comedi_device *dev, struct
comedi_subdevice *s,
int (*cb) (int, int, int, unsigned long),
unsigned long arg);
void subdev_8255_cleanup(struct comedi_device *dev, struct
comedi_subdevice *s);
void subdev_8255_interrupt(struct comedi_device *dev,
struct comedi_subdevice *s);

#else

static inline int subdev_8255_init(struct comedi_device *dev,
struct comedi_subdevice *s, void *x,
unsigned long y)
{
printk("8255 support not configured -- disabling subdevice\n");

s->type = COMEDI_SUBD_UNUSED;

return 0;
}

static inline void subdev_8255_cleanup(struct comedi_device *dev,
struct comedi_subdevice *s)
{
}

#endif
---------------------------------------------------------------------

In the "staging" comedi sources in the kernel, neither of the macros
CONFIG_COMEDI_8255 or CONFIG_COMEDI_8255_MODULE are defined, so any
drivers calling subdev_8255_init() to initialize a subdevice get the
dummy versions between #else and #endif above.

This code was inherited from the comedi CVS sources, but the configure
script for the comedi CVS version always defines the CONFIG_COMEDI_8255
macro so everything works there.

The good news is that this has been fixed in the 2.6.35-rc kernel. I'll
see if I can get some small patches into the earlier stable series
kernels to automatically define CONFIG_COMEDI_8255 and allow the drivers
with an 8255 subdevice to work.

> Here's what I've already done.
>
> i installed with 'modprobe 8255' and it appeared at 'lsmod' command. I
> wrote 'comedi_config -r /dev/comedi0' to remove the current driver and
> 'comedi_config /dev/comedi0 cb_pcidas'. Even then, the channels on the
> subdevice 2 were still 0.
>
> As the second paragraph suggests, i could create another driver on
> /dev/comedi1/ for the 8255 chip only, but it seems a bit hard.
>
> Any more advices?
> Sorry about the english.
>
> Alexandre.

One possible workaround is to build and install comedi from the CVS
sources, but then you'd have two sets of comedi modules installed: one
set in "/lib/modules/$(uname -r)/kernel/drivers/staging/comedi/" from
the kernel staging sources, and the other set in "/lib/modules/$(uname
-r)/comedi/" from comedi CVS sources. So whether it works depends which
set of modules the modprobe program finds first! You might have to give
it a helping hand by deleting (or moving) the "staging" set of modules
(and running "depmod -a" afterwards) to force modprobe to find the other
set of comedi modules.

The other workaround is to modify the kernel sources slightly and
rebuild it. One possible change is to force CONFIG_COMEDI_8255 or
CONFIG_COMEDI_8255_MODULE to be defined by modifying the
drivers/staging/comedi/Kconfig file in the kernel as follows:

In the section "config COMEDI_PCI_DRIVERS", add the following line
before the "---help---" section:

select COMEDI_8255

At the end of the file, add the following section:

config COMEDI_8255
tristate


If the kernel was already configured with "make menuconfig" before this
change, you would have to do a "make oldconfig" after applying this
change to update the kernel .config file.

Alexandre Oliveira

unread,
Aug 2, 2010, 8:12:53 PM8/2/10
to comed...@googlegroups.com
I have a good news!

It worked! Exaclty how you said.

First, I downloaded the kernel 2.6.34.1 and build it.
Then, I downloaded the CVS version and add the comedi module.
Strangelly, it still didn't show the subdevice for digital channels.

So then, I did exaclty what you said:

=== begin ===


The other workaround is to modify the kernel sources slightly and
rebuild it.  One possible change is to force CONFIG_COMEDI_8255 or
CONFIG_COMEDI_8255_MODULE to be defined by modifying the
drivers/staging/comedi/Kconfig file in the kernel as follows:

In the section "config COMEDI_PCI_DRIVERS", add the following line
before the "---help---" section:

       select COMEDI_8255

At the end of the file, add the following section:

config COMEDI_8255
       tristate


If the kernel was already configured with "make menuconfig" before this
change, you would have to do a "make oldconfig" after applying this
change to update the kernel .config file.

=== (end)===

Now I have a brand new kernel, 2.6.34.1 and all devices working! I would never think this would be the problem.

I get help for copiling from here too.
http://relacs.sourceforge.net/plugins/comedi/

Thanks Ian for the help. I will prepare a paper with this configuration for my University and I'm going to send the link. For future users.

Att.
Alexandre.

2010/7/30 Ian Abbott <abb...@mev.co.uk>
On 29/07/10 20:17, Alexandre Oliveira wrote:
> Hello Ian. Thanks For the information.
>
> When I installed the PCI Card in my computer, I just rebooted the
> machine and the Comedi driver was already configured. I didn't run any
> "comedi_config" command. So, I tested the analog outputs and analog
> inputs with succeed. I only found out the error while testing the
> Digital IO channels.
>
> Could the problem be this? I didn't 'configure' the board correctly.

That shouldn't be a problem.  Most of the comedi PCI card drivers
(including cb_pcidas) configure their cards automatically now.

> Reading the Documentation again, i saw:
>
> ==========================
> (begin)
> You should enable compilation this driver if you plan to use a board
> that has an 8255 chip. For multifunction boards, the main driver will
> configure the 8255 subdevice automatically.
>
> This driver also works independently with ISA and PCI cards that
> directly map the 8255 registers to I/O ports, including cards with
> multiple 8255 chips. To configure the driver for such a card, the
> option list should be a list of the I/O port bases for each of the
> 8255 chips. For example,  comedi_config /dev/comedi0 8255
> 0x200,0x204,0x208,0x20c
>
> Note that most PCI 8255 boards do NOT work with this driver, and
> need a separate driver as a wrapper. For those that do work, the
> I/O port base address can be found in the output of ’lspci -v’.
Reply all
Reply to author
Forward
0 new messages