Post Go back to editing

Capturing and writing the IQ data using AD9361_iiostream.c

Hi everyone,

I am recently  trying to understand how AD9361_iiostream.c code to work and I have some questions on the file AD9361_iiostream.c. 

  • I understand that there is a limit to the buffer. Does this mean we can get maximum 1048576 samples in 1 millisecond with this created buffer?   "rxbuf = iio_device_create_buffer(rx, 1024*1024, false);"
  • I am trying to modify this code to write the IQ data from the channel to a file. For example, is it possible to capture a signal continuously with 5 MHz bandwidth and a sampling rate 50 Msps for 1 second and write it to the file without losing any sample?

Thanks,

Baris

Parents
  • Hi Lars, 

    Thanks for your reply.

    Should I modify the code as follows?

    rxbuf = iio_device_create_buffer(rx, 1024*1024, false);

    for(i=0;i<1000;i++)

    {

    nbytes_rx = iio_buffer_refill(rxbuf);

        for (iio_buffer_first(rxbuf, rx0_i); p_dat < p_end; p_dat += p_inc)

       {const int16_t i = ((int16_t*)p_dat)[0];

       const int16_t q = ((int16_t*)p_dat)[1];

       fprintf(file,"%d %d,i,q);}

    }

    With this code I get 1024*1024*1000 samples from the channel for total 1 second, do I?

Reply
  • Hi Lars, 

    Thanks for your reply.

    Should I modify the code as follows?

    rxbuf = iio_device_create_buffer(rx, 1024*1024, false);

    for(i=0;i<1000;i++)

    {

    nbytes_rx = iio_buffer_refill(rxbuf);

        for (iio_buffer_first(rxbuf, rx0_i); p_dat < p_end; p_dat += p_inc)

       {const int16_t i = ((int16_t*)p_dat)[0];

       const int16_t q = ((int16_t*)p_dat)[1];

       fprintf(file,"%d %d,i,q);}

    }

    With this code I get 1024*1024*1000 samples from the channel for total 1 second, do I?

Children
No Data