필터 지우기
필터 지우기

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

조회 수: 10 (최근 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에서 Communications Toolbox에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by