Strange errors with Das16 driver with PC104-DAS16JR/16 and Geode CPU

Hello all,

 I am hoping somebody can point me in the right direction with some very
strange problems I'm having using the das16.o driver with a Measurement
Computing PC104-DAS16JR/16 DAQ card, and an Advantech PCM-3350 (GX1 NS
Geode, 300MHz) cpu card.

 I'm using version 0.7.65 of comedi, with the "timer mode" option turned on
for fixing a bug with the Geode DMA.

 The symptoms of the problem are:

1) When acquiring just one channel of data (using the demo program "cmd"),
there are gaps in the data.  For example, acquiring a 100Hz sine wave  at
64kHz, about once every 20 seconds or so (but not at exact intervals) the
sine wave will "jump" to a new position in the cycle, and stay there.  My
CPU is only being used <10% for the cmd process, so I don't think I'm
running out of resources.  All other channels are jumpered.

2) When acquiring multiple channels (scanning say 8 channels at 8kHz per
channel, or 64kHz aggregate), everything will start fine for the first 20
seconds or so, and then the channels will "switch".  In other words, if
channel zero has a sine wave, channel two has 4.5volts DC, and all other
channels are jumpered, the data for channel zero will be a sine wave for
about 20 seconds, then it will switch to being 0v (jumpered) for 10-20
seconds, and then maybe (at random) switch back to being a sine wave, and so
on.  Same for all the other channels, always starting out correct, then
switching to other channels.


 It looks like the driver or the hardware is losing buffers, and causing the
data stream to become out of alignment.

 Does anyone have any ideas as to what could cause this?  Things I have
tried include:

1) I tried both single ended mode and differential mode, with no improvement
2) I tried using the newest das16.o driver from the CVS repository, which
seemed to make things worse...
3) I wired the terminals and checked the grounding - I've wired as the
manual specifies for both single ended and differential and confirmed all
connections with a multimeter
4) I've checked my code for reading data, and written two independent
versions (one in MATLAB and one in PVWave), both agree that there are gaps
in the data written to disk
5) I used both the original cmd.c program (only modified to change the
command parameters so they are compatible with my card), and a re-written
version which uses binary data output to file.  Both have the same problem.
6) I tried turning off the timer mode, and configuring with an interrupt,
but "cmd" quits almost right away after starting with an error about a
spurrious interrupt or the like (I forget the exact error message).  I
didn't play with this long, because I didn't expect this to work.


Below is some information about my setup and such:




I am using a kernel I compiled fresh from the source at kernel.org.  It is
version 2.4.18 (I used the same version that RedHat 7.2 ships with, because
the rest of the system was installed from a RedHat 7.2 CD).

/proc/version:
Linux version 2.4.18 (root_at_gamma) (gcc version 2.96 20000731 (Red Hat Linux
7.0) ) #4 Fri Sep 20 15:28:16 EDT 2002


*****

dmsg:

comedi: version 0.7.65 - David Schleef <ds_at_schleef.org>
comedi0: das16: 0x0300-0x0310
 id bits are 0x00
 ( no irq ) ( dma = 1)

*****

setup command:

/usr/sbin/comedi_config /dev/comedi0 pc104-das16jr/16 0x300,,1,10,,,,,1

Note that I do, in fact, have the jumpers on the board set to use the 10MHz
clock, port address 0x300, and DMA channel 1

*****

output of command dumps in cmd:

command before testing:
start:      now      0
scan_begin: follow   0
convert:    timer    15625
scan_end:   count    8
stop:       count    691200000
first test returned 4 (argument conflict)
start:      now      0
scan_begin: follow   0
convert:    timer    15600
scan_end:   count    8
stop:       count    691200000
second test returned 0 (success)

*****

/proc/dma:
 1: das16
 4: cascade

*****

/proc/ioports: (just the line with das16 in it):
0300-030f : das16

*****

/proc/comedi:

format string: "%2d: %-20s %-20s %4d",i,driver_name,board_name,n_subdevices
 0: das16                pc104-das16jr/16        5
das16:
[... long list of board names removed ...]


*****

the meat of the changes I made in cmd to use a binary output file:

        /* start the command */
        ret=comedi_command(dev,cmd);
        if(ret<0){
                comedi_perror("comedi_command");
                exit(1);
        }

        while(1){
                ret=read(comedi_fileno(dev),buf,BUFSZ);
                if(ret<0){
                        /* some error occurred */
                        perror("read");
                        break;
                }else if(ret==0){
                        /* reached stop condition */
                        break;
                }else{
                        static int col = 0;
                        total+=ret;
                        if(verbose)fprintf(stderr,"read %d %d\n",ret,total);
                        ret_written = fwrite( buf, 1, ret, fid );
                        if (ret_written != ret) printf("ERROR:
%d,%d\n",ret,ret_written);
                }
        }

*****

output of the "info" demo program:

overall info:
  version code: 0x000741
  driver name: das16
  board name: pc104-das16jr/16
  number of subdevices: 5
subdevice 0:
  type: 1 (analog input)
  number of channels: 16
  max data value: 65535
  ranges:
    all chans: [-10,10] [-5,5] [-2.5,2.5] [-1.25,1.25] [0,10] [0,5] [0,2.5]
[0,1
.25]
  command:
    start: now
    scan_begin: follow
    convert: timer|ext
    scan_end: count
    stop: none|count
  command fast 1chan:
    start: now 0
    scan_begin: follow 0
    convert: timer 10000
    scan_end: count 1
    stop: count 2
[*** stuff about subdevices 1-4 removed ***]


 Any help will be greatly appreciated.  Thanks!

-Peter

--
Peter J. Jensen
Engineer

Cognitive Bionics, Inc.
202 E. Washington St., Suite 707
Ann Arbor, Michigan 48104 USA

+1 734.717.5224  mobile
+1 734.213.1900  office
+1 734.629.0336  fax
jensen_at_cogbio.com

Received on 2002-09-29Z20:32:41