Main Content

LTE Transmitter Using Software Defined Radio

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.

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

Transmitter Design

Follow these steps to understand how the LTE transmitter functions.

  1. Generate a baseband LTE signal.

  2. Prepare the baseband signal for transmission using the SDR hardware.

  3. Send the baseband data to the SDR hardware for upsampling and transmission at the desired center frequency.

Generate Baseband LTE Signal

The lteRMCDLTool 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.OCNGPDSCHEnable = "On";            % Adds noise to unallocated PDSCH resource elements

Create the baseband waveform (eNodeBOutput), a fully populated resource grid (txGrid), and the full configuration of the RMC using the lteRMCDLTool 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.

helperPlotTransmitResourceGrid(rmc,txGrid);
axes = gca;
axes.Children(1).EdgeColor = "none";
title("Transmitted Resource Grid");

Figure contains an axes object. The axes object with title Transmitted Resource Grid contains 10 objects of type patch, surface. These objects represent unused, Cell RS, PSS, SSS, PBCH, PCFICH, PHICH, PDCCH, PDSCH.

Display the power spectral density.

spectrumScope = dsp.SpectrumAnalyzer( ...
    SampleRate=txsim.SamplingRate, ...
    SpectrumType="Power density", ...
    SpectralAverages=10, ...
    Title="Baseband LTE Signal Spectrum", ...
    YLimits=[-90 -50], ...
    YLabel="Power spectral density");
spectrumScope(eNodeBOutput);
release(spectrumScope);

Figure Spectrum Analyzer contains an axes object and other objects of type uiflowcontainer, uimenu, uitoolbar. The axes object with title Baseband LTE Signal Spectrum contains an object of type line. This object represents Channel 1.

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 M- by -N array, where M is the number of samples per LTE frame and N is the number of frames generated.

if txsim.TransmitOnSDR
    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
    end
    
    % Scale the signal for better power output and convert to int16, which
    % is the native format for the SDR hardware. Since you are transmitting
    % the same signal in a loop, you can do the cast once to save
    % processing time.
    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 and create dummy second
    % channel data.
    fprintf("Splitting transmission into %i frames\n",numFrames)
    txFrame = reshape(eNodeBOutput(1:samplesPerFrame*numFrames),samplesPerFrame,numFrames);
end

Transmission Using SDR Hardware

The example uses a try 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 currentTime<txsim.RunTime
            for n = 1:numFrames
                bufferUnderflow = sdrTransmitter(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 LTE Receiver Using Software Defined Radio 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.

SDR Troubleshooting