AnsweredAssumed Answered

How to get consecutive data from plural boards connected 1PC.

Question asked by Nobunari on Feb 1, 2016
Latest reply on Feb 4, 2016 by Nobunari

Hello there.


I am now planning to get consecutive data from plural boards(more than three) using ZedBoard + FMCOMMS1(or 4).


When I used one board(=ZedBoard + FMCOMMS1(or 4)), I was able to get successive data from this.


The C code on Linux PC is


   while (1){                  

             nbytes_rx0 = iio_buffer_refill(rxbuf0);                         


             p_inc = iio_buffer_step(rxbuf0);

             p_end = iio_buffer_end(rxbuf0);                       

             p_start = iio_buffer_first(rxbuf0,rx0_i);


             for (p_dat = p_start; p_dat < p_end; p_dat += p_inc) {

                            i = ((int16_t*)p_dat)[0]; // Real (I)

                            q = ((int16_t*)p_dat)[1]; // Imag (Q)





On the other hand, trying to get data from two boards using LAN like this,


              assert((ctx0 = iio_create_network_context("")) && "No context");

              assert((ctx1 = iio_create_network_context("")) && "No context");       


              rx0 = iio_context_find_device(ctx0, "cf-ad9643-core-lpc");          

              rx1 = iio_context_find_device(ctx1, "cf-ad9643-core-lpc");


              rxbuf0 = iio_device_create_buffer(rx0, BUFNUM, false);           

              rxbuf1 = iio_device_create_buffer(rx1, BUFNUM, false);


              nbytes_rx0 = iio_buffer_refill(rxbuf0);             

              nbytes_rx1 = iio_buffer_refill(rxbuf1);             


I can't get correct data from rxbuf1.


For example, Both rxbuf0 and rxbuf1 gets 1,2,3,4 at the first time(buffer size = 4),

but second time, rxbuf0 gets 5,6,7,8 and rxbuf1 gets 9,10,11,12.


It depends on the time until the function iio_buffer_refill(rxbuf0) returns the number

whether rxbuf1 gets correct data or not.


If the time is too long, the successive data have already missed before asking iio_buffer_refill(rxbuf1).


So the code like this also didn't work properly.


              while(nbytes_rx0 < 0 && nbytes_rx1 < 0){          

                            nbytes_rx0 = iio_buffer_refill(rxbuf0);                         

                            nbytes_rx1 = iio_buffer_refill(rxbuf1);                     



                          if(nbytes_rx0 > 0){



What I want to do is similar to what is described in this link,


but each device is not synchronized and on a different board.


Is there any way to get correct data from plural boards connected to LAN?