LTE Transmitter Using Analog Devices AD9361/AD9364
This example shows how to use the Xilinx® Zynq-Based Radio Support Package with MATLAB® and LTE Toolbox™ to generate an LTE transmission. The transmitted signal can be received by the companion LTE Receiver Using Analog Devices AD9361/AD9364 example if you have a second SDR platform.
Refer to the Getting Started documentation for details on configuring your host computer to work with the Support Package for Xilinx® Zynq-Based Radio.
LTE Toolbox can be used to generate standard-compliant baseband IQ downlink and uplink reference measurement channel (RMC) waveforms and downlink test model (E-TM) waveforms. These baseband waveforms can be modulated for RF transmission using SDR Radio hardware such as Xilinx Zynq-Based Radio.
In this example eight frames of a baseband RMC waveform are generated using the LTE Toolbox. A continuous RF LTE waveform is created by looping transmission of these eight frames with the Zynq® radio hardware for a user-specified time period.
The resultant waveform can be captured and the broadcast channel decoded using the companion example LTE Receiver Using Analog Devices™ AD9361/AD9364, if you have a second SDR platform.
This example requires LTE Toolbox to run. Before running this example ensure you have performed the following steps:
- Configure your host computer to work with the Support Package for Xilinx Zynq-Based Radio. See Getting Started for help. Some additional steps may be required if you want to run two radios from a single host computer. See Setup for Two Radios - One Host for help.
- Ensure that you have a suitable receiver. This example is designed to work in conjunction with the LTE Receiver Using Analog Devices AD9361/AD9364 example.
% Check that LTE Toolbox is installed, and that there is a valid license if isempty(ver('lte')) % Check for LST install error('zynqRadioLTETransmitter:NoLST','Please install LTE Toolbox to run this example.'); elseif ~license('test', 'LTE_Toolbox') % Check that a valid license is present error('zynqRadioLTETransmitter:NoLST','A valid license for LTE Toolbox is required to run this example.'); end
The example can be run by executing zynqRadioLTETransmitterAD9361AD9364ML.m. The sdrTransmitter is controlled using the values in the txsim structure. In particular, you may wish to increase the txsim.RunTime parameter to ensure the transmission is active long enough for the receive example to execute. In this example the cell identity, and initial frame number can be customized.
txsim.RC = 'R.4'; % Base RMC configuration, 1.4 MHz bandwidth. txsim.NCellID = 17; % Cell identity txsim.NFrame = 700; % Initial frame number txsim.TotFrames = 8; % Number of frames to generate txsim.RunTime = 20; % Time period to loop waveform in seconds txsim.DesiredCenterFrequency = 2.45e9; % Center frequency in Hz
The general structure of the LTE transmitter can be described as follows:
- Generate a baseband LTE signal using LTE Toolbox
- 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
Generating the Baseband LTE Signal
The default configuration parameters defined in TS36.101 Annex A.3 [ 1 ] required to generate an RMC are provided by lteRMCDL. The parameters within the configuration structure rmc can then be customized as required. The baseband waveform, eNodeBOutput, a fully populated resource grid, txGrid, and the full configuration of the RMC are created using lteRMCDLTool.
% Generate RMC configuration and customize parameters rmc = lteRMCDL(txsim.RC); rmc.NCellID = txsim.NCellID; rmc.NFrame = txsim.NFrame; rmc.TotSubframes = txsim.TotFrames*10; % 10 subframes per frame rmc.OCNGPDSCHEnable = 'On'; % Add noise to unallocated PDSCH resource elements % Generate RMC waveform trData = [1;0;0;1]; % Transport data [eNodeBOutput,txGrid,rmc] = lteRMCDLTool(rmc,trData); txsim.SamplingRate = rmc.SamplingRate;
The populated resource grid is displayed with channels highlighted. The power spectral density of the LTE baseband signal can be viewed using the DSP System Toolbox™ spectrum analyzer. As expected, the 1.4 MHz signal bandwidth is clearly visible at baseband.
transmitResourceGridPlot = sdrzPlotDLResourceGrid(rmc,txGrid); transmitResourceGridPlot.CurrentAxes.Children(1).EdgeColor = 'none'; title('Transmitted Resource Grid'); % 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);
Preparing for Transmission
The transmitter plays the LTE signal in a loop. The baseband signal is split into LTE frames of data, and a full LTE frame is transmitted using the SDR Transmitter object. The baseband LTE signal is reshaped into an M-by-N array, where M is the number of samples per LTE frame and N is the number of frames generated.
An SDR Transmitter system object is used with the named radio 'AD936x' to transmit baseband data to the SDR hardware.
txsim.RadioCenterFrequency = txsim.DesiredCenterFrequency; txsim.RadioChannelMapping = 1; txsim.SDRDeviceName = 'AD936x'; radio = sdrdev(txsim.SDRDeviceName); sdrTransmitter = sdrtx( ... txsim.SDRDeviceName, ... 'IPAddress', '192.168.3.2', ... 'CenterFrequency', txsim.RadioCenterFrequency, ... 'ChannelMapping', txsim.RadioChannelMapping, ... 'BasebandSampleRate', txsim.SamplingRate); % Scale the signal for better power output and cast to int16. This is the % native format for the SDR hardware. Since we are transmitting the same % signal in a loop, we 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 we are using an integer number of frames if mod(numFrames,1) warning('Not 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);
Splitting transmission into 8 frames
Transmission using SDR Hardware
The transfer of baseband data to the SDR hardware is enclosed in a try/catch block. This means that if an error occurs during the transmission, the hardware resources used by the SDR System object™ are released. The sdrTransmitter System object transmits one full frame of LTE data.
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~=0 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);
Starting transmission at Fs = 1.92 MHz Transmission finished
The companion example LTE Receiver Using Analog Devices AD9361/AD9364 can be used 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.
General tips for troubleshooting SDR hardware can be found in Xilinx Zynq-Based Radio Processing Errors and Fixes.
This example uses the following helper files:
- sdrzPlotDLResourceGrid.m: plots the transmit resource grid
- 3GPP TS 36.191. "User Equipment (UE) radio transmission and reception." 3rd Generation Partnership Project; Technical Specification Group Radio Access Network; Evolved Universal Terrestrial Radio Access (E-UTRA).