Both sides previous revisionPrevious revision | |
resources:tools-software:linux-software:libiio:iio_readdev [23 May 2019 02:51] – Update to modern IIO tools Travis Collins | resources:tools-software:linux-software:libiio:iio_readdev [30 May 2019 02:35] (current) – Update example to use realistic rates and DDS frequency Travis Collins |
---|
dev 'ad9361-phy', debug attr 'loopback', value :'1' | dev 'ad9361-phy', debug attr 'loopback', value :'1' |
</xterm> | </xterm> |
- set the DDS to something slow, so it is easier to see, and we don't alias when looking at things in the time domain.<xterm>analog@imhotep:~$ **iio_attr -a -c cf-ad9361-dds-core-lpc altvoltage0 frequency 5000** | - set the DDS to something slow, so it is easier to see, and we don't alias when looking at things in the time domain.<xterm>analog@imhotep:~$ **iio_attr -a -c cf-ad9361-dds-core-lpc altvoltage0 frequency 50000** |
Using auto-detected IIO context at URI "usb:2.26.5" | Using auto-detected IIO context at URI "usb:2.26.5" |
dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage0' (output), id 'TX1_I_F1', attr 'frequency', value '9279985' | dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage0' (output), id 'TX1_I_F1', attr 'frequency', value '9279985' |
wrote 5 bytes to frequency | wrote 5 bytes to frequency |
dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage0' (output), id 'TX1_I_F1', attr 'frequency', value '5156' | dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage0' (output), id 'TX1_I_F1', attr 'frequency', value '50034' |
| |
analog@imhotep:~$ **iio_attr -a -c cf-ad9361-dds-core-lpc altvoltage1 frequency 5000** | analog@imhotep:~$ **iio_attr -a -c cf-ad9361-dds-core-lpc altvoltage2 frequency 50000** |
Using auto-detected IIO context at URI "usb:2.26.5" | Using auto-detected IIO context at URI "usb:2.26.5" |
dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage1' (output), id 'TX1_I_F2', attr 'frequency', value '9279985' | dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage2' (output), id 'TX1_I_F2', attr 'frequency', value '9279985' |
wrote 5 bytes to frequency | wrote 5 bytes to frequency |
dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage1' (output), id 'TX1_I_F2', attr 'frequency', value '5156' | dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage2' (output), id 'TX1_I_F2', attr 'frequency', value '50034' |
| |
</xterm> | </xterm> |
dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage0' (output), id 'TX1_I_F1', attr 'scale', value '0.400024' | dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage0' (output), id 'TX1_I_F1', attr 'scale', value '0.400024' |
| |
analog@imhotep:~$ **iio_attr -a -c cf-ad9361-dds-core-lpc altvoltage1 scale 0.4** | analog@imhotep:~$ **iio_attr -a -c cf-ad9361-dds-core-lpc altvoltage1 scale 0.0** |
Using auto-detected IIO context at URI "usb:2.26.5" | Using auto-detected IIO context at URI "usb:2.26.5" |
dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage1' (output), id 'TX1_I_F2', attr 'scale', value '0.000000' | dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage1' (output), id 'TX1_I_F2', attr 'scale', value '0.000000' |
wrote 4 bytes to scale | wrote 4 bytes to scale |
dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage1' (output), id 'TX1_I_F2', attr 'scale', value '0.400024' | dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage1' (output), id 'TX1_I_F2', attr 'scale', value '0.000000' |
| |
analog@imhotep:~$ **iio_attr -a -c cf-ad9361-dds-core-lpc altvoltage2 scale 0.4** | analog@imhotep:~$ **iio_attr -a -c cf-ad9361-dds-core-lpc altvoltage2 scale 0.4** |
dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage2' (output), id 'TX1_I_F2', attr 'scale', value '0.400024' | dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage2' (output), id 'TX1_I_F2', attr 'scale', value '0.400024' |
| |
analog@imhotep:~$ **iio_attr -a -c cf-ad9361-dds-core-lpc altvoltage3 scale 0.4** | analog@imhotep:~$ **iio_attr -a -c cf-ad9361-dds-core-lpc altvoltage3 scale 0.0** |
Using auto-detected IIO context at URI "usb:2.26.5" | Using auto-detected IIO context at URI "usb:2.26.5" |
dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage3' (output), id 'TX1_I_F2', attr 'scale', value '0.000000' | dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage3' (output), id 'TX1_I_F2', attr 'scale', value '0.000000' |
wrote 4 bytes to scale | wrote 4 bytes to scale |
dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage3' (output), id 'TX1_I_F2', attr 'scale', value '0.400024' | dev 'cf-ad9361-dds-core-lpc', channel 'altvoltage3' (output), id 'TX1_I_F2', attr 'scale', value '0.000000' |
| </xterm> |
| - Set the sample rate to something reasonable for the DDS frequency<xterm> |
| analog@imhotep:~$ **iio_attr -a -i -c ad9361-phy voltage0 sampling_frequency 3000000** |
| Using auto-detected IIO context at URI "usb:2.29.5" |
| dev 'ad9361-phy', channel 'voltage0' (input), attr 'sampling_frequency', value '3000000' |
| wrote 8 bytes to sampling_frequency |
| dev 'ad9361-phy', channel 'voltage0' (input), attr 'sampling_frequency', value '3000000' |
</xterm> | </xterm> |
- capture 1024 samples in 256 sample buffers <xterm>analog@imhotep:~$ **iio_readdev -u usb:3.80.5 -b 256 -s 1024 cf-ad9361-lpc > samples.dat** | - capture 1024 samples in 256 sample buffers <xterm>analog@imhotep:~$ **iio_readdev -u usb:3.80.5 -b 256 -s 1024 cf-ad9361-lpc > samples.dat** |
0000080 01431 00225 01401 00370 01356 00512 01296 00648 | 0000080 01431 00225 01401 00370 01356 00512 01296 00648 |
</xterm> | </xterm> |
- plot the results in gnuplot:<xterm>analog@imhotep:~$ .**gnuplot** | - plot the results in gnuplot:<xterm>analog@imhotep:~$ **gnuplot** |
gnuplot> **plot 'samples.dat' binary format='%short%short' using 1 with lines, 'samples.dat' binary format='%short%short' using 2 with lines** | gnuplot> **plot 'samples.dat' binary format='%short%short' using 1 with lines, 'samples.dat' binary format='%short%short' using 2 with lines** |
</xterm>{{:resources:tools-software:linux-software:libiio:readdev_gnuplot.png?600|}} | </xterm>{{ :resources:tools-software:linux-software:libiio:sine_wave_pluto.png?600 |}} |
- you can see from the discontinuities that the sample rate is too high, so check that.<xterm>analog@imhotep:~$ **iio_attr -a -i -c ad9361-phy voltage0 sampling_frequency** | - If you can see discontinuities then the sample rate is too high, so check that.<xterm>analog@imhotep:~$ **iio_attr -a -i -c ad9361-phy voltage0 sampling_frequency** |
dev 'ad9361-phy', channel 'voltage0' (input), attr 'sampling_frequency', value '30720000' | dev 'ad9361-phy', channel 'voltage0' (input), attr 'sampling_frequency', value '30720000' |
</xterm>You can expect that 30.72 MSPS is too fast to stream over USB with zero gaps between buffers. Increasing the buffer length is the best thing to do. | </xterm>You can expect that 30.72 MSPS is too fast to stream over USB with zero gaps between buffers. Increasing the buffer length is the best thing to do. |