USRP Codegen error : Nontunable property 'ChannelMapping' may only be assigned once.

6 vues (au cours des 30 derniers jours)
Hi all,
I am trying to use code generation to accelerate my usrp fucntion. However, when I set ChannelMaping to '[1 2]' to receive data from both antennas on B210, the error 'Nontunable property 'ChannelMapping' may only be assigned once' popped up. How can I solve this?
  2 commentaires
Matan Silver
Matan Silver le 14 Sep 2023
Hi Xianglong,
To best answer your question, it would be helpful to have some example code or reproduction steps. Could you show a minimal example of how you are using Support Package for USRP to get this error? For example, are you generating code from MATLAB, or are you generating code for a model using the USRP Simulink blocks?
In the mean time, there is some information I can give you based on the context of your question which may be helpful.
For the SDRuTransmitter and SDRuReceiver System Objects, ChannelMapping is a Nontunable property. Nontunable properties have restrictions on when they can be modified. See this doc page for more info on that:
Does that help narrow down if you are modifying ChannelMapping in a place that is disallowed?
Please let me know if you can reply with reproduction steps--I might be able to get you a more helpful answer.
Matan
XIANGLONG WANG
XIANGLONG WANG le 15 Sep 2023
Hi Matan,
Thanks for your reply. My code is to receive signal from both channels and compare them in spectrum.
In my main function, I use codgen by:
if compileIt
codegen('runSignalSpectrum', '-args', {coder.Constant(prmUSRP)});
end
if useCodegen
clear runSignalSpectrum_mex
runSignalSpectrum_mex(prmUSRP);
else
runSignalSpectrum(prmUSRP);
end
And in runSignalSpectrum:
function runSignalSpectrum(prmUSRP)
persistent rxRadio hSpectrum
if isempty(rxRadio)
rxRadio = comm.SDRuReceiver(...
'Platform', 'B210', ...
'SerialNum', prmUSRP.Address, ...
'MasterClockRate', prmUSRP.MasterClockRate, ...
'CenterFrequency', prmUSRP.USRPCenterFrequency, ...
'Gain', prmUSRP.USRPGain, ...
'DecimationFactor', prmUSRP.USRPDecimationFactor, ...
'SamplesPerFrame', prmUSRP.USRPFrameLength, ...
'ChannelMapping', [1 2], ...
'OutputDataType', 'double');
hSpectrum = spectrumAnalyzer(...);
end
% Some Processing Code
release(hSpectrum);
release(rxRadio);
end
If I remove the 'Channel Maping' property, the code generation will success.

Connectez-vous pour commenter.

Réponse acceptée

Karunya Choppara
Karunya Choppara le 19 Sep 2023
Here the property 'ChannelMapping' of system object comm.SDRuReceiver is a non tunable property, and cannot be changed in between the simulation.
The error is seen as the ChannelMapping is assumed as 1, while setting the other parameters. The error happens as it tries to tune the ChannelMapping to [1 2] later.
Set the Channel Mapping to [1 2] after specifying the radio address, as below
rxRadio = comm.SDRuReceiver(...
'Platform', 'B210', ...
'SerialNum', prmUSRP.Address, ...
'ChannelMapping', [1 2], ...
'MasterClockRate', prmUSRP.MasterClockRate, ...
'CenterFrequency', prmUSRP.USRPCenterFrequency, ...
'Gain', prmUSRP.USRPGain, ...
'DecimationFactor', prmUSRP.USRPDecimationFactor, ...
'SamplesPerFrame', prmUSRP.USRPFrameLength, ...
'OutputDataType', 'double');

Plus de réponses (0)

Catégories

En savoir plus sur Communications Toolbox dans Help Center et File Exchange

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by