EVM Measurements for 802.15.4 (ZigBee) System
comm.EVM System object™ to measure the error vector magnitude (EVM) of a simulated IEEE® 802.15.4 [ 1 ] transmitter. IEEE 802.15.4 specifies protocols used for ZigBee® wireless personal area networks.
Specified EVM Requirement
The EVM measurement quantifies the modulation accuracy of a transmitter by measuring the difference between an error-free modulated reference waveform and an impaired waveform. Section 126.96.36.199 of IEEE® 802.15.4, specifies: "... An IEEE 802.15.4 transmitter shall have EVM values of less than 35% when measured for 1000 chips. The error-vector measurement shall be made on baseband I and Q chips after recovery through a reference receiver system. The reference receiver shall perform carrier lock, symbol timing recovery, and amplitude adjustment while making the measurements. ...". Here, the receiver processing does not require carrier lock, symbol timing recovery, and amplitude adjustment because the only impairment applied in the simulation is additive white Gaussian noise (AWGN).
Define system parameters for an 802.15.4 system for the 868 MHz band, direct sequence spread spectrum (DSSS) with binary phase-shift keying (BPSK) for chip modulation, and differential encoding for data symbol encoding.
The BPSK bit-to-chip mapping spreads each input bit with a 14 chip sequence. Input bits with value
0 are represented by the
chipValues parameter and input bits with value
1 are represented by
(1-chipValues). Use an oversampling rate of four for the transmitted signal and a filter span of eight symbols. To simulate transmitter and test hardware imperfections, use an SNR of 60 dB.
dataRate = 20e3; % Bit rate in Hz M = 2; % Modulation order (BPSK) chipValues = ... % Chip values for 0-valued input bits [1;1;1;1;0;1;0;1;1;0;0;1;0;0;0]; numSymbols = 1000; % Number of symbols required to measure EVM numFrames = 100; % Number of frames nSamps = 4; % Oversample rate filtSpan = 8; % Filter span in symbols SNR = 60; % Simulated signal-to-noise ratio in dB
Calculate the spreading gain, chip rate, final sampling rate, and the number of bits required to obtain one EVM measurement value. Include one extra bit in the simulation of the transmitted symbols to account for filter delays.
gain = length(chipValues); % Spreading gain (chips per symbol) chipRate = gain*dataRate; % Chip rate sampleRate = nSamps*chipRate; % Final sampling rate numBits = ... % Bits for one EVM measurement ceil((numSymbols)/gain)+1;
Obtain BPSK modulated symbols by using a simple mapping of 0 to +1 and 1 to -1. To allow use of matrix math and to write efficient MATLAB® code, map the chip values so that modulatation can be applied before bit-to-chip conversion. To apply the pule shape filtering specified for ZigBee, define a pair of square-root-raised-cosine filters with a rolloff factor of 1.
chipValues = 1 - 2*chipValues; % Map chip values rctFilt = comm.RaisedCosineTransmitFilter( ... RolloffFactor=1, ... OutputSamplesPerSymbol=nSamps, ... FilterSpanInSymbols=filtSpan); rcrFilt = comm.RaisedCosineReceiveFilter( ... RolloffFactor=1, ... InputSamplesPerSymbol=nSamps, ... FilterSpanInSymbols=filtSpan, ... DecimationFactor=nSamps);
As defined in section 6.7.3 of IEEE® 802.15.4, the EVM calculation method normalizes the average error of the measured I and Q samples by the power of a symbol. Since the power of both constellation symbols is the same for a BPSK system, configure the EVM measurment object to use peak constellation power normalization. For more information on EVM calculation methods and normalization options, see the
comm.EVM System object reference page.
evm = comm.EVM(Normalization='Peak constellation power');
Generate random data bits, differentially encode these bits by using a
comm.DifferentialEncoder System object, and apply BPSK modulation. Spread the modulated symbols by using a matrix multiplication with the mapped chip values. Pass the spread symbols through a pulse shaping filter.
The EVM object assumes that the received and reference symbols are synchronized and sampled at the same rate. The received signal must be downsampled and synchronized with the reference signal.
To ensure sufficeint averaging, simulate 100 frames with 1000 symbols in each frame. Save the maximum measured EVM check that satifies the requirment of EVM 35% noted in the Specified EVM Requirement section.
Since the transmit and receive filters are identical and the delay from each equals half the filter span, the total delay equals the span of one filter.
refSigDelay = rctFilt.FilterSpanInSymbols; diffenc = comm.DifferentialEncoder; simNumSymbols = numBits*gain; % Number of symbols in a frame peakRMSEVM = -inf; % Initialize peak RMS EVM value
Use a for loop to process transmission frames. On the transmit side, generate random data, apply differential encoding, apply BPSK modulation, spread the chip, apply pulse shaping and add noise to the transmitted signal. On the receive side, downsample and filter the signal, account for the signal delay, measure the EVM, update the peak EVM to save the maximum value measured. After processing all frames of data, display the maximum EVM value.
for p=1:numFrames % Transmit side b = randi([0 M-1],numBits,1); d = diffenc(b); x = 1-2*d; % Modulate c = reshape(chipValues*x',simNumSymbols,1); % Spread data cUp = rctFilt(c); r = awgn(cUp,SNR,"measured"); % Receive side rd = rcrFilt(r); % Downsample and filter rmsEVM = evm( ... complex(rd(refSigDelay+(1:numSymbols))), ... complex(c(1:numSymbols))); % Update peak RMS EVM calculation if (peakRMSEVM < rmsEVM) peakRMSEVM = rmsEVM; end end % Display results fprintf(' Worst case RMS EVM (%%): %1.2f\n',peakRMSEVM)
Worst case RMS EVM (%): 0.19
Additional impairments, such as I/Q imbalance can be added to the transmitted signal by using the
iqimbal2coef function. For more examples and information, see the Error Vector Magnitude (EVM) and Visualize RF Impairments topics.
1. IEEE Standard 802.15.4, Wireless Medium Access Control (MAC) and Physical Layer (PHY) Specifications for Low-Rate Wireless Personal Area Networks, 2003.