How to make two processes that use the same USRP device?

I have an USRP device (X300) that can transmit and receive signals. I want my X300 device to transmit a sine wave and simultaneously receive the signal on the second daughterboard of the USRP in a while loop. It is rather inefficient to do this in sequence and it would be much better to create two processes, one for the sine wave and for measurement, since these two steps do not necessarily need to be performed one after another.
The following code shows the working, but inefficient solution
for i = 0:100
sinewave = step(hSineSource); % generate sine wave
step(radioTX, sinewave); % transmit to USRP(R) radio
[rxSig, len, overrun ] = radioRX();
spectrumAnalyzer(rxSig); %display received spectrum
end
Here is what i would like to do if this was the C programming language
pid = fork()
if (pid == 0)
for i = 0:100
sinewave = step(hSineSource); % generate sine wave
step(radioTX, sinewave); % transmit to USRP(R) radio
end
else
for i =0:100
[rxSig, len, overrun ] = radioRX();
spectrumAnalyzer(rxSig); %display received spectrum
end
end
When trying to do something similar with seperate MATLAB instances open or using MATLABs workers, we encounter the problem that MATLAB prohibits the concurrent use of the same IP in different processes. How can this problem be circumvented?

Respuestas (1)

Sreeja
Sreeja el 29 de Abr. de 2026 a las 9:56
Starting with MATLAB R2026a, the comm.SDRuReceiver and comm.SDRuTransmitter objects support thread-based pooling.
This means you can now use parfeval and backgroundPool to perform simultaneous transmit and receive operations with USRP radios, using the Communications Toolbox Support Package for USRP Radio.
Additionally, the new transmitRepeat utility enables continuous background transmission.
For more information and usage examples, please refer to https://in.mathworks.com/help/comm/usrpradio/ug/comm.sdrutransmitter.transmitrepeat.html
You may also find this example helpful:
https://in.mathworks.com/help/wlan/ug/image-transmission-reception-using-802-11-waveform-sdr.html

Categorías

Más información sobre Communications Toolbox en Centro de ayuda y File Exchange.

Productos

Versión

R2021a

Preguntada:

el 14 de Jun. de 2021

Respondida:

el 29 de Abr. de 2026 a las 9:56

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by