Adlink LPCIe-7250 support

198 views
Skip to first unread message

Emma Peace

unread,
Jun 10, 2015, 12:34:27 AM6/10/15
to comed...@googlegroups.com
Hi,

I'm working on a project and I need to be able to use the Adlink LPCIe-7250, I've got a copy of the head of Comedi and don't see a driver in there for it. I'm willing to have a crack at creating one, I assume that copying the driver for the 7230 would be a good place to start. It looks like the 7250 is just the PCIe version of the 7230.

I've not done any driver development before so any advice anyone can give before I dive on in would be much appreciated.

Kind Regards

Emma Peace

Éric Piel

unread,
Jun 10, 2015, 10:24:23 AM6/10/15
to comed...@googlegroups.com
Hi Emma,

I'm not too much into driver development (for comedi), but I've notived the comedi driver in the linux kernel is fairly different from the one in the comedi git tree. In the Linux tree, it looks more generic (it's called adl_pci7x3x.c), so maybe it's easier to see what needs to be done to add support for another device.
With some luck, if that's indeed so close from the 7230, you might get it working just by adding the device info into the pci_device_id and adl_pci7x3x_boards.

So maybe get the latest linux git tree (or latest release version if it's too unstable), and have a look at drivers/staging/comedi/drivers/adl_pci7x3x.c .

Good luck,
Éric

Ian Abbott

unread,
Jun 10, 2015, 12:55:46 PM6/10/15
to comed...@googlegroups.com
I've added a driver to the Comedi git repository called "adl_pci7250"
based on the register map in the manual as it looked fairly trivial. I
haven't tested it though.

The driver is for the PCI-7250, but ought to work for the LPCI-7250 and
LPCIe-7250 too as far as I can tell. The driver does not attempt to
distinguish between these card types.

Since the PCI-7250 allows up to three PCI-1751 extension cards to be
fitted, each providing 8 additional relay outputs and 8 additional
isolated inputs, the driver supports 32 relay outputs and 32 digital
inputs. Any missing extension cards shouldn't do any harm, but the
extra channels associated with them won't do anything. This is
particularly relevant to the LPCI-7250 and LPCIe-7250 which do not
support the extension cards, but the driver assumes they are fitted anyway!

--
-=( Ian Abbott @ MEV Ltd. E-mail: <abb...@mev.co.uk> )=-
-=( Web: http://www.mev.co.uk/ )=-

Emma Peace

unread,
Jun 11, 2015, 12:24:56 AM6/11/15
to comed...@googlegroups.com
Wow, that was unexpected and really fast, thanks so much!

I'm scheduled to start the work with the 7250 next week so I'll let you know how it's working as soon as I've got it going.

Thanks again!

Kind Regards,

Emma Peace



--
You received this message because you are subscribed to a topic in the Google Groups "Comedi: Linux Control and Measurement Device Interface" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/comedi_list/RaQGeavOr0U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to comedi_list...@googlegroups.com.
To post to this group, send email to comed...@googlegroups.com.
Visit this group at http://groups.google.com/group/comedi_list.
For more options, visit https://groups.google.com/d/optout.

Emma Peace

unread,
Jun 14, 2015, 11:46:34 PM6/14/15
to comed...@googlegroups.com
I've got the latest version from git, built and installed and the 7250 driver won't load.

Running "sudo modprobe adl_pci7250" results in the following message

[ 6043.556179] adl_pci7250: disagrees about version of symbol range_unipolar5
[ 6043.556185] adl_pci7250: Unknown symbol range_unipolar5 (err -22)
[ 6043.556203] adl_pci7250: disagrees about version of symbol comedi_pci_auto_unconfig
[ 6043.556205] adl_pci7250: Unknown symbol comedi_pci_auto_unconfig (err -22)
[ 6043.556218] adl_pci7250: disagrees about version of symbol comedi_driver_unregister
[ 6043.556220] adl_pci7250: Unknown symbol comedi_driver_unregister (err -22)
[ 6043.556234] adl_pci7250: disagrees about version of symbol comedi_pci_auto_config
[ 6043.556236] adl_pci7250: Unknown symbol comedi_pci_auto_config (err -22)
[ 6043.556250] adl_pci7250: disagrees about version of symbol comedi_driver_register
[ 6043.556253] adl_pci7250: Unknown symbol comedi_driver_register (err -22)

And if I try to use the --force flag I get

modprobe: ERROR: could not insert 'adl_pci7250': Exec format error

The test module and main comedi modules all load fine. Is there something obvious (to everyone else) I'm doing wrong?

Kind Regards

Emma

Kind Regards,

Emma Peace

To unsubscribe from this group and all its topics, send an email to comedi_list+unsubscribe@googlegroups.com.

Éric Piel

unread,
Jun 15, 2015, 3:13:49 AM6/15/15
to comed...@googlegroups.com
It sounds like a mismatch between your kernel version and the kernel for
which the module was compiled. Maybe your computer got a kernel update
since last configure? In that case, you can do:
make clean
./configure
make

Éric

Emma Peace

unread,
Jun 15, 2015, 5:40:18 AM6/15/15
to comed...@googlegroups.com
I've just been doing further testing, the 7250 and a few of the other adlink drivers load on a workstation which is running ubuntu 15.04, but not on workstations running 14.10 (which unfortunately is what we are deploying on). I've made sure I'm compiling for the right kernel.

The specific kernel I'm on on 14.10 is 3.16.0-39-generic.

Kind Regards,

Emma Peace, CEO
www.presentationcartography.com
phone +64 (0)21 079 0871

--
You received this message because you are subscribed to a topic in the Google Groups "Comedi: Linux Control and Measurement Device Interface" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/comedi_list/RaQGeavOr0U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to comedi_list...@googlegroups.com.

Ian Abbott

unread,
Jun 15, 2015, 5:45:39 AM6/15/15
to comed...@googlegroups.com
It could be trying to load a mixture of the "staging" comedi modules
from your distro's kernel package and the "comedi.org" comedi modules
built by yourself. The binary interfaces between the two sources of
modules are not compatible with each other.

You can check where modules are loaded from with the 'modinfo' command:

/sbin/modinfo comedi | head -n 1

/sbin/modinfo adl_pci7250 | head -n 1

Those print the first line of the modinfo output, indicating the full
filename of the module. If the filename includes the sub-path
"kernel/drivers/staging/comedi", the module will be coming from the
distro's kernel package (or from any other kernel built with comedi
included). Otherwise the module will be loaded from the your self-built
and installed comedi installation. The key thing is you don't want any
of the comedi modules to be loaded from "staging" for your tests.

I think the self-build comedi modules used to be installed in
"/lib/modules/${KERNEL_VER}/kernel/comedi/" by default, but I just tried
it on my Debian system and they got installed to
"/lib/modules/${KERNEL_VER}/comedi/". However, if you install the
modules with the DKMS system, I think they get installed to
"/lib/modules/${KERNEL_VER}/updates/comedi/".

If necessary, you can change the search order for modules by creating a
file in the /etc/depmod.d/ directory with the .conf extension (e.g.
"/etc/depmod.d/mysearch.conf") and adding the following line:

search comedi updates built-in

Then running "depmod -a" as root (or "sudo depmod -a").


I'm planning to submit a driver module to the Linux kernel so you won't
have to use the self-built driver from comedi.org. However, it would be
nice to see if the one from comedi.org works properly first. In any
case, it would be several months before the submitted driver trickled
through to the mainline Linux sources and it wouldn't get back-ported to
older kernels.

Emma Peace

unread,
Jun 15, 2015, 6:02:35 AM6/15/15
to comed...@googlegroups.com
Yes, thank you that fixed the driver loading! It was indeed trying to mix the different module versions.

I'll test the hardware tomorrow morning and let you know how it goes.

Thanks for all the assistance!

Kind Regards,

Emma Peace

--
You received this message because you are subscribed to a topic in the Google Groups "Comedi: Linux Control and Measurement Device Interface" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/comedi_list/RaQGeavOr0U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to comedi_list...@googlegroups.com.

Ian Abbott

unread,
Jun 15, 2015, 7:05:28 AM6/15/15
to comed...@googlegroups.com
On 15/06/15 10:45, Ian Abbott wrote:
> I think the self-build comedi modules used to be installed in
> "/lib/modules/${KERNEL_VER}/kernel/comedi/" by default, but I just tried
> it on my Debian system and they got installed to
> "/lib/modules/${KERNEL_VER}/comedi/". However, if you install the
> modules with the DKMS system, I think they get installed to
> "/lib/modules/${KERNEL_VER}/updates/comedi/".

Actually, I just DKMS again on my Debian system and the modules get
installed to "/lib/modules/${KERNEL_VER}/updates/dkms/".

Speaking of DKMS, I forgot to add adl_pci7250 to the dkms.conf file, but
I've fixed that now in the git repository.

DKMS automates the process of rebuilding comedi when a new kernel is
installed.

If you have a snapshot of the latest comedi sources, you can do
something like:

sudo dkms install /path/to/comedi

and it will copy the sources to /usr/src/comedi-${someversioncode} and
build it for the current kernel, and if dkms is set-up right, build it
whenever a new kernel is installed. The ${someversioncode} part is
extracted from the "PACKAGE_VERSION" line in comedi's "dkms.conf" file,
so you might want to edit that first, especially if you want to install
an updated version of the comedi sources alongside the previous ones.

Ian Abbott

unread,
Jun 15, 2015, 7:31:33 AM6/15/15
to comed...@googlegroups.com
On 15/06/15 12:05, Ian Abbott wrote:
> On 15/06/15 10:45, Ian Abbott wrote:
>> I think the self-build comedi modules used to be installed in
>> "/lib/modules/${KERNEL_VER}/kernel/comedi/" by default, but I just tried
>> it on my Debian system and they got installed to
>> "/lib/modules/${KERNEL_VER}/comedi/". However, if you install the
>> modules with the DKMS system, I think they get installed to
>> "/lib/modules/${KERNEL_VER}/updates/comedi/".
>
> Actually, I just DKMS again on my Debian system and the modules get
> installed to "/lib/modules/${KERNEL_VER}/updates/dkms/".
>
> Speaking of DKMS, I forgot to add adl_pci7250 to the dkms.conf file, but
> I've fixed that now in the git repository.
>
> DKMS automates the process of rebuilding comedi when a new kernel is
> installed.
>
> If you have a snapshot of the latest comedi sources, you can do
> something like:

I should also point out that those sources need a configure script, so
you need to have run ./autogen.sh on the sources first if they have come
straight from a git snapshot!

Emma Peace

unread,
Jun 16, 2015, 10:58:55 PM6/16/15
to comed...@googlegroups.com
I can now confirm that the adl_pci7250 driver works perfectly. I've integrated it into our software and tested input and output fairly heavily without any problems.

Much thanks for all the assistance!

Kind Regards,

Emma Peace

--
You received this message because you are subscribed to a topic in the Google Groups "Comedi: Linux Control and Measurement Device Interface" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/comedi_list/RaQGeavOr0U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to comedi_list...@googlegroups.com.

Ian Abbott

unread,
Jun 17, 2015, 3:39:20 AM6/17/15
to comed...@googlegroups.com
On 17/06/15 03:58, Emma Peace wrote:
> I can now confirm that the adl_pci7250 driver works perfectly. I've
> integrated it into our software and tested input and output fairly
> heavily without any problems.
>
> Much thanks for all the assistance!
>
> Kind Regards,
>
> Emma Peace

Thanks for testing!

Aleš Gaber

unread,
Feb 3, 2016, 8:41:56 AM2/3/16
to Comedi: Linux Control and Measurement Device Interface
hi,
im also working on a project and have adlink PCI 7230 card.
waiting from adlink for 2 weeks but still nothing...
my kernl: linux 3.19.0-25-generic
Distro: Ubuntu
Release: 14.04

i checked the driver on comedi... but if i see things right... only for older kernels....
Anyone can help me?


On Wednesday, June 10, 2015 at 6:34:27 AM UTC+2, Emma Peace wrote:

Ian Abbott

unread,
Feb 3, 2016, 10:26:32 AM2/3/16
to comed...@googlegroups.com
On 03/02/16 13:41, Aleš Gaber wrote:
> hi,
> im also working on a project and have adlink PCI 7230 card.
> waiting from adlink for 2 weeks but still nothing...
> my kernl: linux 3.19.0-25-generic
> Distro: Ubuntu
> Release: 14.04
>
> i checked the driver on comedi... but if i see things right... only for
> older kernels....
> Anyone can help me?

Your PCI 7230 card should be supported by the "adl_pci7x3x" module in
Ubuntu's 3.19.0 kernel. These modules should be loaded automatically by
the operating system when it detects your card:

adl_pci7x3x
comedi

Does that happen?
Reply all
Reply to author
Forward
0 new messages