I'm attempting to enable the Transmit / DDS for Transmit (Tx) DMA output buffer transfers for Tx 1 on the PicoZed SDR through a script without the aid of the IIO Oscope application (and the associated IIO server daemon [iiod]).
From my understanding, in order to enable / activate the data for Tx1, I can use the following echo commands to set the following IIO parameters for the cf-ad94361-dds-core-lpc (iio:device2) device to a one (1):
echo 1 > /sys/bus/iio/devices/iio:device2/scan_elements/out_voltage0_en
echo 1 > /sys/bus/iio/devices/iio:device2/scan_elements/out_voltage1_en
echo 1 > /sys/bus/iio/devices/iio:device2/buffer/enable
However, after I a script that contains these commands, it appears that when I write data to the DMA Tx buffer the spectrum doesn't appear to change as if the data isn't being written.
Am I missing something in order to enable the DAC output buffers for Tx1?
Any feedback would be appreciated. I look forward to your response.
Switching between the DDS and DMA is just writing to the cf-ad9361-dds-core-lpc device, channel altvoltage0, raw attribute.
DDS = 1
DMA = 0
HI. If you could, can you please elaborate on this. Ideally I am attempting to use system() calls from my embedded Linux app running from the Altera A10 dev kit for the adv9371, I want to simply be able to:
1. Set the TX1/2 DDS Mode to DAC Buffer Output
2. Load a file that contains my test waveforms
3. Virtually press the "load" button (reference to iio scope screen) to actually start the flow of data from the buffers to the TX DACs
I noted in the driver calls there are ways to set via "echo X > param", most parameters and even load a profile, but its not at all clear how to setup the TX 1/2 DDS mode to DAC Buffer Output, load the file and start the data flow from the buffer.
I have looked at some of the c code examples but having some difficultly in resolving many missing references even though including iio.h. The method I described would meet my needs if I could get the correct sequence and settings. Thank you very much.
root@analog:/sys/bus/iio/devices/iio:device3# cat nameaxi-ad9371-tx-hpc
buffer out_altvoltage5_TX2_I_F2_phasedev out_altvoltage5_TX2_I_F2_rawname out_altvoltage5_TX2_I_F2_scaleof_node out_altvoltage6_TX2_Q_F1_frequencyout_altvoltage0_TX1_I_F1_frequency out_altvoltage6_TX2_Q_F1_phaseout_altvoltage0_TX1_I_F1_phase out_altvoltage6_TX2_Q_F1_rawout_altvoltage0_TX1_I_F1_raw out_altvoltage6_TX2_Q_F1_scaleout_altvoltage0_TX1_I_F1_scale out_altvoltage7_TX2_Q_F2_frequencyout_altvoltage1_TX1_I_F2_frequency out_altvoltage7_TX2_Q_F2_phaseout_altvoltage1_TX1_I_F2_phase out_altvoltage7_TX2_Q_F2_rawout_altvoltage1_TX1_I_F2_raw out_altvoltage7_TX2_Q_F2_scaleout_altvoltage1_TX1_I_F2_scale out_altvoltage_sampling_frequencyout_altvoltage2_TX1_Q_F1_frequency out_voltage0_calibphaseout_altvoltage2_TX1_Q_F1_phase out_voltage0_calibscaleout_altvoltage2_TX1_Q_F1_raw out_voltage1_calibphaseout_altvoltage2_TX1_Q_F1_scale out_voltage1_calibscaleout_altvoltage3_TX1_Q_F2_frequency out_voltage2_calibphaseout_altvoltage3_TX1_Q_F2_phase out_voltage2_calibscaleout_altvoltage3_TX1_Q_F2_raw out_voltage3_calibphaseout_altvoltage3_TX1_Q_F2_scale out_voltage3_calibscaleout_altvoltage4_TX2_I_F1_frequency out_voltage_sampling_frequencyout_altvoltage4_TX2_I_F1_phase powerout_altvoltage4_TX2_I_F1_raw scan_elementsout_altvoltage4_TX2_I_F1_scale subsystemout_altvoltage5_TX2_I_F2_frequency uevent
There is an explicit example for AD9371 here: https://github.com/analogdevicesinc/libiio/blob/master/examples/ad9371-iiostream.c
If you want to have the data passed to the DMA simply repeat, just make the buffer cyclic: https://analogdevicesinc.github.io/libiio/group__Buffer.html#ga6caadf077c112ae55a64276aa24ef832
Here are the details on enabling/disabling the DDS: https://wiki.analog.com/resources/tools-software/linux-drivers/iio-dds/axi-dac-dds-hdl
Here is an example of configuring it for AD9361 but it applies to AD9371 as well: https://github.com/analogdevicesinc/plutosdr_scripts/blob/master/power.c
Thank you. I will try to use the explicit example for which you provided the link above. I am cross compiling on a PC for the arria10SOC 9371 development kit. I tried installing the libiio for that environment by downloading libiio-setup.exe and running that. However running Make produces:
make all cc -Wall -c -o ad9361-iiostream.o ad9361-iiostream.cad9361-iiostream.c:28:17: fatal error: iio.h: No such file or directory #include <iio.h> ^compilation terminated.make: *** [<builtin>: ad9361-iiostream.o] Error 1
Environment information (running in Cygwin )
(DS-5 built in)
GCC C++ Compiler 4 [arm-linux-gnueabihf]
GCC C Compiler 4 [arm-linux-gnueabihf]GCC Assembler 4 [arm-linux-gnueabihf]GCC C Linker 4 [arm-linux-gnueabihf]GCC C++ Linker 4 [arm-linux-gnueabihf]GCC Archiver 4 [arm-linux-gnueabihf]
Sorry, I know this is likely something straight forward but is there a method for installing the lib so that my cross compile env can reference it properly? Thank you.
The Arria10 is pretty powerful, I would recommend just compiling everything directly on the board itself.
Thank you Travis. Makes sense. I did that after compiling/installing libiio from git repo to fix the missing references to <iio.h> issue I had there too. So seems to be working as I can make the ad9371_iiostream project executable and am able to run it. I need to dig in now to customize it for my project. Thank you for your help!
So, I am still curious though, is there just no way to use the file descriptors to setup the tx DDS streaming. Is that just not possible to your knowledge?
Thank you again.
You can totally control the DDSs through the file descriptors. Its just error prone so we don't recommend it. Basically convert the related libiio calls into their related file descriptors. Enabling the DDS on AD9361 would be like:
echo 1 > /sys/bus/iio/devices/iio:device3/out_altvoltage0_TX1_I_F1_raw
AD9371 would be similar but using a different iio:device number.
Instead of writing the sysfs files directly, you can also use iio_attr tool.
Can you give a little more detail on why you don't recommend using the file descriptors to control the AD9361 DDS since it's error prone? I have been using the IIO file descriptors to enable/disable several parameters of the DDS and it seems to be working for our project.
I assume you would recommend following the examples in the links you provided for generating an software application that makes the appropriate libiio calls like the application Dean put together for his project. Is that correct?
Yes, applications are better. File descriptors can enumerate differently based on the system and devices attached. With libiio you can directly use names of devices to control them, avoiding this problem. Also, you get more valuable feedback in forms of error codes when things fail.