Reading data streams of the 2 RX channels simultaneusly?

Hello!
I am working with a Lime SDR USB, and the LMS API.
I need to measure the phase difference of two signals connected to the 2 RX channels.

In the documentation of the API there are functions to read the data streams of each channel (one by one). But I haven’t seen any function that allows to read both data streams simultaneously.

Is there any function that allow to read the information of both RX channels simultaneously?
Any other API or any other library has a function that read both RX streams at the same time?

Thanks in advance
Mauro

1 Like

When using 2 channels, both of them are received simultaneously and samples are put into each channel’s FIFO buffers. So reading data streams one by one you will get samples that are at the same time frame.

1 Like

Thanks for the answer @ricardas!

I was looking into one of the examples (dualRXTX.cpp). In this example they start the RX stream one by one:

Blockquote
//Start streaming
for (int i = 0; i < chCount; ++i)
{
LMS_StartStream(&rx_streams[i]);
LMS_StartStream(&tx_streams[i]);
}

I am starting the RX stream in the same way. (I guess that LMS_StartStream() just initiates the transfer of data from the Lime board to the FIFO buffers in the PC, is it correct?). If the RX streams are started in this way, are they aligned?

I am reading a small amount (1k up to 64k samples) of each stream each time. I suppose that in this way the sample alignment between both channels is kept. Is it correct?

Yes, you are correct. LMS_SetupStream determines which channels are going to be used, and actually the first call to LMS_StartStream starts them all, subsequent calls to other LMS_StartStream is just for reference count tracking.
Rx streams started this way are timestamp aligned, not sure about phase alignment 2RX Phase measuremen issue -180 degree phase jump, I haven’t tried it myself.
As long as you read equal amount of samples from both channels they will stay aligned (as long as you’re processing samples faster than they are produced).