lte transmitter using software defined radio -凯发k8网页登录
this example shows how to generate a reference measurement channel (rmc) downlink (dl) lte waveform suitable for over-the-air transmission. this example also shows how to use a software-defined radio (sdr) to transmit the generated waveform using single or multiple antennas.
introduction
this example generates eight frames of a baseband rmc dl waveform. using sdr hardware such as the xilinx® zynq®-based radio, this baseband waveform can be modulated for rf transmission. the sdr transmits the waveform by looping transmission of the eight frames for a specified time period.
this example supports these sdrs.
adalm-pluto from the communications toolbox support package for analog devices® adalm-pluto radio
usrp™ e310/e312 from the communications toolbox support package for usrp™ embedded series radio
ad936x/fmcomms5 from the communications toolbox support package for xilinx® zynq®-based radio
usrp™ n300/n310/n320/n321/b200/b210/x300/x310 from the communications toolbox support package for usrp™ radio
example setup
before running the example, ensure that you have installed the appropriate support package for the sdr that you intend to use and that you have configured the hardware.
the transmitonsdr
field of the txsim
structure determines whether the example transmits the generated waveform using an sdr.
txsim.transmitonsdr = false;
if you select the transmitonsdr
field of the txsim
structure, configure the variables required for sdr transmission.
if txsim.transmitonsdr txsim.sdrdevicename = "ad936x"; % sdr that is used for waveform transmission txsim.runtime = 20; % time period to loop waveform in seconds txsim.radiocenterfrequency = 2450000000; % center frequency in hz txsim.radioidentifier = '192.168.3.2'; % value used to identify radio, for example, ip address, usb port, or serial number end
configure the other fields in the txsim
structure for lte downlink waveform generation.
txsim.rc = "r.4"; % base rmc configuration, 1.4 mhz bandwidth txsim.ncellid = 17; % physical layer cell identity txsim.nframe = 700; % initial frame number txsim.totframes = 8; % number of frames to generate txsim.numantennas = 1; % number of transmit antennas
transmitter design
follow these steps to understand how the lte transmitter functions.
generate a baseband lte signal.
prepare the baseband signal for transmission using the sdr hardware.
send the baseband data to the sdr hardware for upsampling and transmission at the desired center frequency.
generate baseband lte signal
the function provides the default configuration parameters defined in 3gpp ts 36.101 annex a.3, which are required to generate an rmc.
customize the parameters within the configuration structure rmc
.
rmc = ltermcdl(txsim.rc); rmc.ncellid = txsim.ncellid; rmc.nframe = txsim.nframe; rmc.totsubframes = txsim.totframes*10; % 10 subframes per frame rmc.cellrefp = txsim.numantennas; % configure number of cell-specific reference signal antenna ports rmc.ocngpdschenable = "on"; % adds noise to unallocated pdsch resource elements
if using two or more antennas, enable transmit diversity.
if rmc.cellrefp >= 2 rmc.pdsch.txscheme = "txdiversity"; rmc.ocngpdsch.txscheme = "txdiversity"; else rmc.pdsch.txscheme = "port0"; rmc.ocngpdsch.txscheme = "port0"; end rmc.pdsch.nlayers = txsim.numantennas;
create the baseband waveform (enodeboutput
), a fully populated resource grid (txgrid
), and the full configuration of the rmc using the function.
trdata = [1;0;0;1]; % transport data
[enodeboutput,txgrid,rmc] = ltermcdltool(rmc,trdata);
txsim.samplingrate = rmc.samplingrate;
display the resource grid populated with the highlighted channels and the power spectral density of the lte baseband signal. you can see a 1.4 mhz signal bandwidth at baseband in the spectrum plot.
if using multiple transmit antennas, set displayantennaforgrid
to the antenna port you would like to display.
displayantennaforgrid = 1; ax = axes; hplotdlresourcegrid(rmc,txgrid(:,:,displayantennaforgrid),ax,displayantennaforgrid); ax.children(1).edgecolor = "none"; title("transmitted resource grid");
display the power spectral density.
spectrumscope = spectrumanalyzer( ... samplerate=txsim.samplingrate, ... spectrumtype="power-density", ... title="baseband lte signal spectrum", ... ylabel="power spectral density"); spectrumscope(enodeboutput); release(spectrumscope);
prepare for transmission
the transmitter plays the lte signal in a loop. the example splits the baseband signal into lte frames of data, and the sdr transmitter object (sdrtransmitter
) transmits a full lte frame. the example reshapes the baseband lte signal into an - by - array, where is the number of samples per lte frame and is the number of frames generated.
if txsim.transmitonsdr % scale the signal for better power output and convert to int16, which % is the native format for the sdr hardware. powerscalefactor = 0.7; enodeboutput = enodeboutput.*(1./max(abs(enodeboutput))*powerscalefactor); enodeboutput = int16(enodeboutput*2^15); % lte frames are 10 ms long samplesperframe = 10e-3*txsim.samplingrate; numframes = length(enodeboutput)/samplesperframe; % ensure you are using an integer number of frames if mod(numframes,1) warning("non integer number of frames. trimming transmission ..."); numframes = floor(numframes); end % reshape the baseband lte data into frames for simpler transmission fprintf("splitting transmission into %i frames\n",numframes) txframe = reshape(enodeboutput,samplesperframe,numframes,txsim.numantennas); if matches(txsim.sdrdevicename, ["ad936x", "fmcomms5", "pluto", "e3xx"]) sdrtransmitter = sdrtx( ... txsim.sdrdevicename, ... centerfrequency=txsim.radiocenterfrequency, ... basebandsamplerate=txsim.samplingrate); if matches(txsim.sdrdevicename, ["ad936x", "fmcomms5", "e3xx"]) sdrtransmitter.showadvancedproperties = true; sdrtransmitter.bypassuserlogic = true; sdrtransmitter.ipaddress = txsim.radioidentifier; else sdrtransmitter.radioid = txsim.radioidentifier; end else % for the usrp sdrs sdrtransmitter = comm.sdrutransmitter(... platform=txsim.sdrdevicename,... centerfrequency=txsim.radiocenterfrequency); [sdrtransmitter.masterclockrate, sdrtransmitter.interpolationfactor] = ... hgetusrprateinformation(txsim.sdrdevicename,txsim.samplingrate); if matches(txsim.sdrdevicename, ["b200", "b210"]) % change the serial number as needed for usrp b200/b210 sdrtransmitter.serialnum = txsim.radioidentifier; else sdrtransmitter.ipaddress = txsim.radioidentifier; end sdrtransmitter.enableburstmode = true; sdrtransmitter.numframesinburst = numframes; end sdrtransmitter.channelmapping = 1:txsim.numantennas; end
transmission using sdr hardware
the example uses a block to transfer the baseband data to the sdr hardware. using the try,
catch
block means that if an error occurs during the transmission, the hardware releases the resources used by the sdr system object™. the sdrtransmitter
system object transmits a full frame of lte data.
if txsim.transmitonsdr fprintf("starting transmission at fs = %g mhz\n",txsim.samplingrate/1e6) currenttime = 0; try while currenttimefor n = 1:numframes bufferunderflow = sdrtransmitter(squeeze(txframe(:,n,:))); if bufferunderflow warning("dropped samples.") end end currenttime = currenttime numframes*10e-3; % one frame is 10 ms end catch me release(sdrtransmitter); rethrow(me) end fprintf("transmission finished\n") release(sdrtransmitter); end
further exploration
you can use the companion example to decode the broadcast channel of the waveform generated by this example. try changing the cell identity and initial system frame number and observe the detected cell identity and frame number at the receiver.
if using a supported multi-channel sdr, try increasing the number of antennas
sdr troubleshooting
adalm-pluto radio (communications toolbox support package for analog devices adalm-pluto radio)
usrp embedded series radio (communications toolbox support package for usrp embedded series radio)
xilinx zynq-based radio (communications toolbox support package for xilinx zynq-based radio)
usrp radio (communications toolbox support package for usrp radio)