- From: H. Miton <hm_at_iris10.lemfi.u-psud.fr>
- Date: Mon, 03 Feb 2003 21:47:31 +0100
We have installed Comedi-0.7.65 and Comedilib-0.7.19 in a PC P4 running
with MANDRAKE 9.0 using a Kernel 2.4.19 We have also installed a DT3001
board for which we have read in "drivers.txt" :
Driver: dt3000.o
Description: Data Translation DT3000 series
Author: ds
Devices: [Data Translation] DT3001 (dt3000), DT3001-PGL, DT3002, DT3003,
DT3003-PGL, DT3004, DT3005, DT3004-200
Status: works
There is code to support AI commands, but it may not work.
AO commands are not supported.
We tried to test the AI subdevice of the board.
Some instructions of comedi like "comedi_data_read" have runned
correctly with
this board.
Then we have tested the instruction "comedi_command". For this we have
written
the following piece of code :
#include <linux/kernel.h>
#include <comedilib.h>
#include <comedi.h>
#include <stdio.h>
/*******************************************************/
comedi_cmd cmd;
comedi_t *cf;
int chan = 0;
int channel;
int range = 1;
int aref = AREF_DIFF;
int i;
int subdevice;
int main(int argc, char *argv[])
{
int size;
int it;
int go;
unsigned int var;
unsigned int x[4];
char buf[1000];
//
for(i=0;i<1000;i++)
{
buf[i]=65;
}
cf = comedi_open("/dev/comedi0");
comedi_perror("device ");
subdevice=comedi_find_subdevice_by_type(cf,COMEDI_SUBD_AI,0);
printf("index of subdev AI %d\n",subdevice);
channel = 0;
for(i=0;i<4;i++)
{
x[i]=CR_PACK(channel+i,range,aref);
}
//
memset(&cmd,0,sizeof(cmd));
cmd.subdev = 0;
cmd.flags = 0;
cmd.start_src = TRIG_NOW;
cmd.start_arg = 0;
cmd.scan_begin_src = TRIG_TIMER;
cmd.scan_begin_arg = 100*1000000;
cmd.convert_src = TRIG_TIMER;
cmd.convert_arg = 1*1000000;
cmd.scan_end_src = TRIG_COUNT;
cmd.scan_end_arg = 2;
cmd.stop_src = TRIG_COUNT;
cmd.stop_arg = 100;
cmd.chanlist = x;
cmd.chanlist_len = 2;
//
x[0]=CR_PACK(channel,range,aref);
x[1]=CR_PACK(channel+1,range,aref);
//
it=comedi_command_test(cf , &cmd);
printf("execution of comedi_command_test %d\n",it);
it=comedi_command_test(cf , &cmd);
printf("execution of comedi_command_test %d\n",it);
it=comedi_command(cf , &cmd);
printf("execution of comedi_command %d\n",it);
comedi_perror("comedi_command ");
//
sleep(1);
go=1;
while(go)
{
//
var = comedi_fileno(cf);
printf("comedi_fileno : %d\n",var);
it=read(var,buf,sizeof(buf));
printf("execution of read %d\n",it);
if(it<0)
{
perror(" read ");
for(i=0;i<10;i++)
{
printf("%d\n",buf[i]);
}
}
go=0;
if(it==0)
{
go=0;
}
else
{
perror(" read ");
for(i=0;i<10;i++)
{
printf("%d\n",buf[i]);
}
}
}
return 0;
}
We have compiled it using the following instruction
cc test2.c -o test2 -lcomedi
and we have run it. The output is all cases like this :
device : Success
index of subdev AI 0
execution of comedi_command_test 0
execution of comedi_command_test 0
execution of comedi_command 0
comedi_command : Success
comedi_fileno : 3
execution of read -1
read : Input/output error
65
65
65
65
65
65
65
65
65
65
read : Input/output error
65
65
65
65
65
65
65
65
65
65
Systematically the instruction read generate an input-output error.
apparently nothing has been written in the file comdi_fileno.
To your sense is the problem due to the board or to the code ?
I would like to be sure concerning this point before changing the board.
Very sincerely yours,
H. MITON Research Scientist LEMFI buidg 511 91405 Orsay Cedex France
~
Received on 2003-02-03Z20:47:31