Dear All,
I have a problem. I am going to test some different devices by LimeSDR-mini though C++ API.
Now, I need to know the time delay or the time stamp(from send the signal from TX and the time we get the signal from RX) and compare with them.
So, How to get the time delay by C++ API, I didn’t find any wait to report the time. Also, I have set the TDD mode for test.
lms_stream_t tx_stream;
tx_stream.channel = 0;
tx_stream.fifoSize = 1024 * 1024;
tx_stream.throughputVsLatency = 0.5;
tx_stream.dataFmt = lms_stream_t::LMS_FMT_F32;
tx_stream.isTx = true;
if (LMS_SetupStream(device, &tx_stream) != 0)
error();
lms_stream_meta_t meta_tx;
meta_tx.waitForTimestamp = false;
// wait for the specified HW timestamp before broadcasting data over
meta_tx.flushPartialPacket = true;
// send samples to HW even if packet is not completely filled (end TX burst).
meta_tx.timestamp = 0;
lms_stream_t rx_stream;
rx_stream.channel = 0;
rx_stream.fifoSize = 1024 * 1024;
rx_stream.throughputVsLatency = 0.5;
rx_stream.dataFmt = lms_stream_t::LMS_FMT_F32;
rx_stream.isTx = false;
if (LMS_SetupStream(device, &rx_stream) != 0)
error();
lms_stream_meta_t meta_rx;
//default false, do not use it
meta_rx.waitForTimestamp = false;
meta_rx.flushPartialPacket = false;
meta_rx.timestamp = 0;
And
auto t1 = chrono::high_resolution_clock::now();
auto t2 = t1;
while (chrono::high_resolution_clock::now() - t1 < chrono::seconds(10)) //run for 10 seconds
{
samplesRead = LMS_RecvStream(&rx_stream, rx_buffer, buffer_size, &meta_rx, 1000);
meta_tx.timestamp = meta_rx.timestamp + 1024 * 512 * 50;
samplesWrite = LMS_SendStream(&tx_stream, tx_buffer, samplesRead, &meta_tx, 1000);
if (chrono::high_resolution_clock::now() - t2 > chrono::seconds(1))
{
t2 = chrono::high_resolution_clock::now();
lms_stream_status_t status;
LMS_GetStreamStatus(&rx_stream, &status); //Obtain RX stream stats
cout << "RX rate: " << status.linkRate / 1e6 << " MB/s\n"; //link data rate (both channels))
LMS_GetStreamStatus(&tx_stream, &status); //Obtain TX stream stats
cout << "TX rate: " << status.linkRate / 1e6 << " MB/s\n"; //link data rate (both channels))
}
}
Please tell me any way to deal with problem.
Thank you so much.