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

7 次查看(过去 30 天)
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 个评论
Matan Silver
Matan Silver 2023-9-14
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 2023-9-15
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.

请先登录,再进行评论。

采纳的回答

Karunya Choppara
Karunya Choppara 2023-9-19
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');

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 RF Blockset Models for Transceivers 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by