Re: wrong analog output offset

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Friday 24 September 2004 10:56 am, Lars wrote:
> hi,
> there was an inaccrurancy in my last two postings about unwanted samples
> during streamed analog output with a PCI-6031E: - if I use
> comedi-0.7.68, then two extra samples appear on the output channel at
> the beginning of the stream - if I use a cvs-version, then only one
> extra sample appears
>
> I traced this difference in behaviour down to:
> - comedi/drivers/ni_mio_common.c
> - between the versions: 2004/06/28 and 2004/07/15
>
> the following lines show the difference, that matters:
>
> [ ### diff starts here ### ]
> diff -ruN cvs-20040628/comedi/comedi/drivers/ni_mio_common.c
> cvs-20040715/comedi/comedi/drivers/ni_mio_co mmon.c
> --- cvs-20040628/comedi/comedi/drivers/ni_mio_common.c   2004-06-28
> 03:03:01.000000000 +0200 +++
> cvs-20040715/comedi/comedi/drivers/ni_mio_common.c   2004-07-16
> 00:30:24.000000000 +0200 _at__at_ -854,7 +854,8 _at__at_
>
>         /* reset fifo */
>         win_out(0,DAC_FIFO_Clear);
> -       ni_ao_win_outl(dev, 0x6, AO_FIFO_Offset_Load_611x);
> +       if(boardtype.reg_type & ni_reg_6xxx_mask)
> +               ni_ao_win_outl(dev, 0x6, AO_FIFO_Offset_Load_611x);
>
>         /* load some data */
>         n = comedi_buf_read_n_available(s);
> _at__at_ -2066,7 +2067,8 _at__at_
>         bits = AO_Error_Interrupt_Enable;
>  #ifdef PCIDMA
>         win_out(0, DAC_FIFO_Clear);
> -       ni_ao_win_outl(dev, 0x6, AO_FIFO_Offset_Load_611x);
> +       if(boardtype.reg_type & ni_reg_6xxx_mask)
> +               ni_ao_win_outl(dev, 0x6, AO_FIFO_Offset_Load_611x);
>         ni_ao_setup_MITE_dma(dev, &s->async->cmd);
>         ret = ni_ao_wait_for_dma_load(dev);
>         if(ret < 0) return ret;
> [ ### end of diff ### ]
>
> if I remove the if-line, then two extra samples appear an the analog
> output channel before the written data,
> otherwise only one
>
> I experimented around with the offset (0x6) that ist written to the
> device, but that didn't change anything (as far as I tried).

You definitely don't want to execute the ni_ao_win_outl() line.  
ni_reg_6xxx_mask is a bit misleading, as it really only refers to the 
similarities between 611x, 671x and 673x boards.  If you call 
ni_ao_win_outl() with your board, it will try to write to some nonexistent 
registers, and wind up writing a garbage sample to the analog output fifo 
(as you have discovered already).

As for the second garbage sample, are you sure this still happens with the 
cvs?  A second call of ni_ao_win_outl() used to happen, but it was fixed 
about 2 months ago:

https://cvs.comedi.org/cgi-bin/viewcvs.cgi/comedi/comedi/drivers/ni_mio_common.c.diff?r1=1.223&r2=1.224

- -- 
Frank

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBVXPN5vihyNWuA4URAoHYAJsHjJK/7rh0MEpDdLFGlHqISZn2EgCfQqIO
+IzwCT20l5/TP4ExPJUDKX4=
=56uB
-----END PGP SIGNATURE-----

Received on 2004-09-25Z12:34:05