AnsweredAssumed Answered

Unreliable DDS application

Question asked by bistromat on Jun 1, 2015
Latest reply on Jun 4, 2015 by rgetz

Starting a new thread to reflect the fact that the earlier thread wasn't the cause of my underlying problem.


As earlier, I'm using custom AD9364 hardware somewhat closely based on the FMCOMMS4 design. The FPGA design is essentially FMCOMMS4 with some different peripherals. I have a radio application interfacing with the 9364 via IIO, in C++. Tuning and radio setup are handled by scripts using the sysfs interface. Here's the initialization:


struct iio_context *ctx;

struct iio_device *dds;

struct iio_buffer *txbuf;

ctx = iio_create_local_context();

if(!ctx) {

     perror("Could not create IIO context");

     return -1;


dds = iio_context_find_device(ctx, "cf-ad9361-dds-core-lpc");

if(!dds) {
     perror("Could not find device");

     return -1;


num_channels = iio_device_get_channels_count(dds);

for(i=0;i<num_channels;i++) iio_channel_enable(iio_device_get_channel(dds, i));

txbuf = iio_device_create_buffer(dds, NSYMS*NUM_IDLE_FRAMES, 0);

        if(!txbuf) {

             perror("Could not allocate buffer");

             return -1;

        } far, so good, right? Anything in the above initialization that looks strange?


Buffers are filled and submitted using iio_buffer_push(). The strange behavior I'm seeing is a nondeterministic (so far as I can tell) failure to output RF data; buffers are bring filled and submitted to libiio just fine with no complaint, but the output of the DDS is all zeroes. I can't tell where the data is hanging up. Seems like about 20% of the time the application fails. The rest of the time it works fine. I can stop and start my program multiple times to observe the failure/success: either it works just fine, or it outputs nothing at all.


Any hints on where I could look, any hooks into the drivers I could probe, or any reliable test code you use yourselves with libiio would be very appreciated.