AnsweredAssumed Answered

Receiving continuous samples for > 0.5s on FMCOMMS5

Question asked by mredfield on Jan 25, 2017
Latest reply on Feb 9, 2017 by larsc

We're using an FMCOMMS5 on the ZC702 carrier board. We'd like to receive four channels of data at a sample rate of 60Msps and store it to disk. We only need to receive about 0.5s of data, and we can buffer that much in RAM.

 

Our current design is to create an iio_buffer of maximum size (max size described here: https://ez.analog.com/thread/49873), then call iio_buffer_refill() on it multiple times until we have as much data as we need. After each time iio_buffer_refill returns, we memcpy the contents of the buffer to RAM and then refill it again.

 

This seems to work, but it looks like we're not getting continuous samples. To test sample continuity, we set up to receive a tone. If we find discontinuities in the phase of the received tone, we know we've dropped some samples. What we find is that there are no phase discontinuities in the first buffer length of data, but after that we do get phase discontinuities. It also looks like we get phase discontinuities within a single buffer returned from iio_buffer_refill after the first one.

 

What is the recommended way of receiving long contiguous blocks of data?

 

For reference, here is pseudo-code for our current algorithm:

 

rxbuf = iio_device_create_buffer(dev_phy, MAX_IIO_BUF_SIZE, false);
int desired_samples = 30000000;
int bytes_per_sample = 4*4; // channels * 4 bytes for each I/Q
int bytes_saved = 0;
uint8_t * rx_store = (uint8_t *) malloc(desired_samples * bytes_per_sample);
int rx_idx = 0;
while (bytes_saved < desired_samples * bytes_per_sample) {
bytes_fetched = iio_buffer_refill(rxbuf);
buf_start = iio_buffer_start(rxbuf);
memcpy(rx_store + rx_idx, buf_start, byte_fetched);
rx_idx += bytes_fetched;
bytes_saved += bytes_fetched;
}

fwrite(rx_store, 1, bytes_saved, logfile);

Outcomes