Is it possible to flush an IIO RX buffer? I've tried opening and destroying a buffer using libiio, but I still get stale IQ data.
Calling iio_buffer_destroy() should stop the DMA and free all buffers. This means when a new buffer is allocated the first buffer will contain fresh data.
You can refresh the buffer with iio_buffer_refill( ), if that's what you mean.
That's not what I was referring to. Due to the way that 4 buffers are continually enqueued/dequeued, if a buffer is dequeued, and then the next data is dequeued 10 minutes later, then that data is 10 minutes old. So I'm looking for a way to flush all buffers and get up to date data. Creating and destroying a buffer via Libiio doesn't seem to completely do it.
Alternatively, you could just call iio_buffer_refill( ) several times, until you know that the samples are fresh enough (by reading the timestamp channel, for instance) or that the refill call blocks (when it takes more than ~4ms).
Is there a timestamp channel when using libiio with the AD9361 fmcomms2/3, fmcmoms5 drivers? For example I see the streaming voltage channels under the cf-ad9361-lpc and cf-ad9361-A devices, but I don't see anything labeled timestamp.
I am about a month behind right now so maybe it is a recent addition.
You are right, there is no timestamp with the AD9361, sorry for the confusion.
Retrieving data ...