Re: DAQCard-1200 status

Frank Mori Hess wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>On Thursday 14 November 2002 01:33 pm, Fredik Lingvall wrote:
>  
>
>>4) Add these lines to /etc/modules.conf :
>>
>>    alias char-major-98 comedi
>>    alias char-major-98-0 ni_labpc
>>    post-install ni_labpc /usr/sbin/comedi_config /dev/comedi0 daqcard-1200
>>    
>>
>
>You don't want these lines in /etc/modules.conf for a pcmcia card.  The 
>module should be loaded through the /etc/pcmcia/ files.  Automatic calling of 
>comedi_config should be done by the /etc/pcmcia/comedi script (you might need 
>to edit it to call comedi_config with the arguments you want ).
>  
>
OK.

>Would you get the current cvs?  I put in a couple udelay()s in the analog 
>input and output insn that should fix the timeouts on analog input at least.  
>Maybe it will help output too, I can't really think of anything else to try.  
>If you want to try fixing it yourself, the relevant function for analog out 
>is ao_winsn() in comedi/drivers/ni_labpc.c.
>
I added the udelay:s but that didn't change anyting. I put some printk calls
in the diver (in labpc_ao_winsn(...) function in ni_labpc.c) to see if the
arguments were ok. I could not find anything that was wrong.

The write_byte(..) function which write data to the hardware seems to get
the correct arguments (see below)

 lsb = data[0] & 0xff;
 msb = (data[0] >> 8 ) & 0xff;
  printk("DAC : lsb = %d , msb = %d\n",lsb,msb);
  thisboard->write_byte(msb, dev->iobase + DAC_MSB_REG(channel));
  thisboard->write_byte(lsb, dev->iobase + DAC_LSB_REG(channel));

If i set lsb =msb =0 and and range to 1 (=[0,10v]) the measured output
is still not zero and changes between different calls to 
 comedi_data_write(...).

It would be nice if it was possible to read the registers on the 
hardware that controls
analog output to see what changes beween differents runs. Is this possible?
(Is there a PDF-hardware manual available somewhere?)


For the analog input I noticed that the driver first clears the FIFO

 thisboard->write_byte(0x1, dev->iobase + ADC_CLEAR_REG);

then it reads two bytes from the FIFO (why?)

  thisboard->read_byte(dev->iobase + ADC_FIFO_REG);
  thisboard->read_byte(dev->iobase + ADC_FIFO_REG);

and then the AD-conversion is started with:

     /* trigger conversion */
      thisboard->write_byte(0x1, dev->iobase + ADC_CONVERT_REG);
 
A status register is then polled to see if the conversion is finished:
   for(i = 0; i < timeout; i++)
    {
      if(thisboard->read_byte(dev->iobase + STATUS1_REG) & DATA_AVAIL_BIT)
        break;
    }

and after that the data is read:

    if(i == timeout)
    {
      comedi_error(dev, "timeout");
      return -ETIME;
    }

    lsb = thisboard->read_byte(dev->iobase + ADC_FIFO_REG);
    udelay(1);
    msb = thisboard->read_byte(dev->iobase + ADC_FIFO_REG);
      data[n] = (msb << 8) | lsb;
 

What I get here is timeout errors, that is i=timeout. The timeout
is set to 1000. Why is the timeout 1000? Is it derived from something
like bus clock etc. I noticed that the same timeout is used in the
ni_mio driver. I tried to increase the timeout but that did not
change anything. I suspect that  sometimes the conversion is
never started resulting in strange readings. Need help here...

Fredrik




 

Received on 2002-11-19Z17:36:55