analysis, simulation and implementation of a simo ofdm...

25
Analysis, Simulation and Implementation of a SIMO OFDM Communications System Marco Tirado Daniel Friman Linda Klevard Johan Bengtsson Lin Ji May 30, 2006

Upload: others

Post on 13-Mar-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Analysis, Simulation and

Implementation of a SIMO OFDM

Communications System

Marco Tirado

Daniel Friman Linda Klevard

Johan Bengtsson Lin Ji

May 30, 2006

Page 2: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

Acknowledgements

We want thank our project assistant Sha Jao and also Per Zetterberg.

2

Page 3: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

Contents

1 Introduction 4

1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.2 Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.3 Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2 Short Description 5

2.1 OFDM System . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.1.1 DFT and IDFT . . . . . . . . . . . . . . . . . . . . . . . . 52.1.2 Cyclic Prefix . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.2 Channel Estimation . . . . . . . . . . . . . . . . . . . . . . . . . 62.2.1 Equal-Gain Combining . . . . . . . . . . . . . . . . . . . . 6

2.3 Channel Coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3 Simulation 8

3.1 Channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83.2 Receiver and Transmitter Overview . . . . . . . . . . . . . . . . . 83.3 Construction of a Frame . . . . . . . . . . . . . . . . . . . . . . . 93.4 Modulation and Demodulation . . . . . . . . . . . . . . . . . . . 103.5 Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.5.1 Modulating on a carrier . . . . . . . . . . . . . . . . . . . 123.6 Sinusoidal Pre-signal . . . . . . . . . . . . . . . . . . . . . . . . . 123.7 Superframe Detection . . . . . . . . . . . . . . . . . . . . . . . . 12

3.7.1 The Training Frame . . . . . . . . . . . . . . . . . . . . . 123.7.2 Removal of the Coarsely Estimated Carrier Frequency . . 123.7.3 Detection of the Training Frame . . . . . . . . . . . . . . 13

3.8 Training Frame Processing . . . . . . . . . . . . . . . . . . . . . . 143.8.1 Fine timing . . . . . . . . . . . . . . . . . . . . . . . . . . 143.8.2 Estimation and Removal of the Fine Frequency Offset . . 143.8.3 Channel estimation . . . . . . . . . . . . . . . . . . . . . . 15

3.9 Frame Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . 153.9.1 Estimation and Removal of the Fine Frequency Offset . . 153.9.2 Channel compensation and ECG . . . . . . . . . . . . . . 16

4 Implementation 17

4.1 GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174.1.1 Channel coding . . . . . . . . . . . . . . . . . . . . . . . . 184.1.2 Interleaving . . . . . . . . . . . . . . . . . . . . . . . . . . 184.1.3 Subfunctions . . . . . . . . . . . . . . . . . . . . . . . . . 18

4.2 DSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184.2.1 DSP Board Description . . . . . . . . . . . . . . . . . . . 184.2.2 Basic Program Functionality . . . . . . . . . . . . . . . . 194.2.3 State Machine . . . . . . . . . . . . . . . . . . . . . . . . 19

5 Results 22

5.1 Simulation and algorithms . . . . . . . . . . . . . . . . . . . . . . 225.2 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

3

Page 4: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

1 Introduction

1.1 Background

There are many techniques on how to improve the efficiency of a digital com-munication system over a frequency selective radio channel. This project willfocus on OFDM (Orthogonal Frequency Division Multiplexing) over a 1x2 SIMO(Single-Output-Multiple Input) system. OFDM improves the connection by di-viding the bandwidth into several orthogonal carrier frequencies. Provided willbe near flat fading for each of the subchannels and thus a decrease in the ISI(inter-symbol interference) between neighboring bits. The OFDM technique isused in, for example, Wireless LAN and DAB (Digital Audio Broadcasting).

Employment of multiple antennas enables parallel transmission of separate datasignals over the same frequency band. The outcome is an increased bitrate. Forthe case of 1x2 SIMO, two receiver antennas are used and they provide recep-tion of two (preferably independent) replicas of the transmitted signal. Receiverdiversity is a powerful tool for avoiding fading and interference.

1.2 Specification

The goal is to achieve a net bitrate of 100 kbps through the use of OFDMover a 1x2 SIMO channel, while restraining the bandwidth to 12 kHz. Inter-ference cancellation shall also be implemented to reduce the effects of nearbytransmitters.

1.3 Resources

Hardware

• Stationary PC and 2 laptops

• 2 DSP-cards, Texas Instruments DSK6713

• WIreless DEvelopment LAB (WIDELAB) Equipment Base

Software

• MatLab 7.1

• Microsoft Visual C++ 6.0

• Texas Instruments Code Composer Studio 2

4

Page 5: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

2 Short Description

2.1 OFDM System

The OFDM transmission technique can be regarded as FDM (frequency-divisionmultiplexing). The idea is to combat ISI by spreading lots of signals on differentfrequencies during a long period of time. As of the FFT algorithm and thedevelopment of integrated circuits this has more and more become an interestingtechnique. See figure 1 for a simple illustration of the subcarriers.

Frequency

Tx P

ow

er

Figure 1: A simple illustration of the subcarrier

2.1.1 DFT and IDFT

Two key points of an OFDM system are the Inverse Discrete Fourier Transformat the transmitter side and the Discrete Fourier Transform at the receiver side.By these the robustness of the sent data over a fading multipath channel ispreserved.The N-point DFT and IDFT are defined as

DFT {x[n]} = X [i] ,1√N

N−1∑

n=0

x[n]e−j2πn WN , 0 ≤ i ≤ N − 1

IDFT {X [i]} = x[n] ,1√N

N−1∑

n=0

X [i]ej2πn WN , 0 ≤ i ≤ N − 1

where N is the number of subchannels and W is the bandwidth in the OFDMsystem. One can think of the above expression as complex data symbols mappedto complex OFDM symbols, which make up the data symbols being sent ondifferent subchannels. In this way the available spectrum is divided into severalsubchannels which are narrowband and therefore experience almost flat fadingduring transmission.

2.1.2 Cyclic Prefix

A cyclic prefix is a prepended replica of the last symbols of the transmitted datasequence, the tail. The first chips in a given data sequence are corrupted by ISI

5

Page 6: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

from earlier chips in the previous sequence. Therefore the CP is necessary. Seefigure 2. A requirement for the CP is that the impulse response of the channelmust be shorter than the length of the cyclic prefix, L, as can be seen in figure3.

Tail

CP Data

b[0] b[2N+L+1]

Figure 2: Frame with cyclic prefix, in a buffer

L N

ISI

Cyclic Prefix

Data Block d[0]...d[N-1]

ISI

Cyclic Prefix

Figure 3: ISI between data blocks in channel output

The cyclic prefix serves not only to eliminate ISI between the data sequences,but also to suppress ICI, since it makes the transmitted signal periodic andtherefore maintains orthogonality of the subcarriers.

2.2 Channel Estimation

By appending a cyclic prefix to the channel input, the linear convolution associ-ated with the channel impulse response becomes a circular convolution. Givenx[n] being the input to a time-discrete channel with impulse response h[n]. Thechannel output y[n], 0 ≤ n ≤ N − 1 is then

y[n] = x[n] ∗ h[n] =

L−1∑

k=0

h[k]x[n − k] =

µ−1∑

k=0

h[k]x[n − k]N = x[n] ⊗ h[n]

Taking the DFT of the channel output in the absence of noise, then yields

Y [i] = DFT {y[n] = x[n] ⊗ h[n]} = X [i]H [i], 0 ≤ i ≤ N − 1

⇐⇒ H(i) = Y [i]/X [i]

2.2.1 Equal-Gain Combining

EGC (Equal-Gain Combining) is used to combine the signals from the two diver-sity antennas. That technique is of great practical interests, since it provides an

6

Page 7: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

intermediate solution as far as the performance and the implementation com-plexity is concerned. In EGC each data sequence is weighted irrespective ofSNR, i.e.

y =y1

2+

y2

2

y1,2 being the input from receiver antennas 1 and 2 respectively.

2.3 Channel Coding

A simple convolutional code with a scheme like this:

Figure 4: Convolutional encoder, one input bit gives two output bits

This code has a coding rate K=1/2 and a redundancy 100 percent,that is, forevery input bit gives the encoder two output bits. The hard decoding is baseon the Viterbi algorithm. The Viterbi decoder is using Maximum Likelihooddecoding base on the input trellis.

Figure 5: Trellis to perform the Viterbi decoding algorithm

It searches through the whole coded bits and at last the decoder performs atrace back to get the best (most likely) path and regenerates the data bits.

7

Page 8: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

PC DSP Tx/Rx Hardware

TCMCoding

Modulation Cyclic PrefixIFFTSource D/A WIDELAB

TCMDecoding

Demodulation MRC EqualizationSink A/DCyclic Prefix WIDELAB

Transmitter

Receiver

FFT

Figure 6: Transmitter and receiver.

3 Simulation

3.1 Channel

The channel implemented in the simulation is Rayleigh fading, which is a widelyused model in simulations of wireless communication systems.

3.2 Receiver and Transmitter Overview

The workings of the transmitter and receiver is roughly sketched in figure 6.As evident is, the receiver is considerably much more complicated than thetransmitter. Lots is to be detected, estimated and compensated for, and it isappropriate to define a mathematical notation for the treatment that follows.See table 1.

Table 1: Symbols and definitions used throughout this text

General

x[k] ∈ Z2, 0 ≤ k < X Data to transmit, in bitss[k] ∈ C, 0 ≤ k < S = X

dData to transmit, modulated in symbols

t[k] ∈ C, 0 ≤ k < N − 1 Training data to transmit, modulated in sym-bols

T [n] ∈ C, 0 ≤ n < N − 1 DFT of ~td ∈ Neven Bits per symbolN Number of symbols in datablock to transmitL Length of cyclic prefix, in symbolsQ Upsampling rate (before pulse shaping)p[k] ∈ R, −P ≤ k ≤ P Pulse function

P [k] ∈ C, 0 ≤ k < 2P − 1 DFT of ~pZ Length of upsampled and pulse shaped frame

in samplesY Length of upsampled and pulse shaped CP in

samplesContinued on next page

8

Page 9: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

Table 1 – continued from previous page

z[k] ∈ C, 0 ≤ k < S = Xd

Data received, modulated in symbolsy[k] ∈ Z2, 0 ≤ k < X Data received, in bits

Definitions specific to and exclusively used at the receiver

b1[k] ∈ R, 0 ≤ k < B − 1 Input buffer 1b2[k] ∈ R, 0 ≤ k < B − 1 Input buffer 2d1[k] ∈ R, 0 ≤ k < N − 1 Processed data block in time-domain from an-

tenna 1d2[k] ∈ R, 0 ≤ k < N − 1 Processed data block in time-domain from an-

tenna 2

D1[n] ∈ C, 0 ≤ n < N − 1 DFT of ~d1

D2[n] ∈ C, 0 ≤ n < N − 1 DFT of ~d2

H1[n] ∈ C, 0 ≤ k < H DFT of channel impulse response at antenna1

H2[n] ∈ C, 0 ≤ k < H DFT of channel impulse response at antenna2

fc Estimated carrier frequency

fcc Coarsely estimated carrier frequency, mea-sured in the processing of the pre-sinoisidal

θ1,2 Frequency shift over a symbolα1,2 ∈ N Pointer to the ”peak” of first symbol directly

after the CP in ~b1,2

τ1,2 Estimated fine timing

Definitions relating to coding and interleaving

I Number of datablocks to interleave (=Numberof superframes)

R Coding rate

Constraints not mentioned above

X mod d =0

The number of symbols representing the datashould be integer. In practice data is zeropadded to fulfill this.

N + L ≤ B < 2N + L The buffer should be big enough to contain acomplete frame, but may not at any instantcontain two frames.

3.3 Construction of a Frame

The generation of a frame from some data is a serial procedure, and is thus wellexplained in a step-by-step fashion:

1. First, data bits ~x are modulated generating symbols ~s. Each of these sym-bols correspond to a frequency, and can be regarded as Fourier coefficients.As of that they relate to the subchannels in a natural way.

9

Page 10: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

2. The N symbols are passed through a IDFT, yielding the time plane sym-bols to be transmitted.

3. The last L symbols of the N long sequence are appended to the beginning.These are called the cyclic prefix.

4. The N +L symbols are upsampled by Q, and convolved by ~p. The lengthof the frame after upsampling and pulse shaping is denoted by Z = (N +L) · Q − (Q − 1) + 2P .

5. Before entering WIDELAB, the real part of the signal modulated on a10kHz carrier is taken out.

At this point the signal is further raised in frequency, amplified and transmittedto the transmitter antenna. As mentioned earlier, this step is not part of thesimulation. See figure 2 for an illustration of a full frame, before being modu-lated on a carrier.

Regarding the pulse, any pulse shape ”good enough” for the job is sufficient.Attributes worth considering are bandwidth and energy. We chose to use a rootraised cosine see figure 7, however a rectangle, see figure 8 or a hat functionwould also work.

20 40 60 80 100

0

0.1

0.2

0.3

0.4

0.5Time domain

−50 0 50

0.5

1

1.5

2

2.5

3

Frequency domain

Figure 7: Root Raised Cosine Pulse Shape, with 10 samples per symbols androll-off factor 0.22

3.4 Modulation and Demodulation

Signals are modulated using QAM-4n, n being a non-negative integer. Eachsymbol contains 2d Gray coded bits. In figure 9 to the left a signal constellationfor Gray coded QAM-4 or QPSK is illustrated. An iterative procedure buildingupon QAM-4 can be used for higher orders of QAM. In the same figure to theright the signal constellation for QAM-16 is presented. The four bits to bemodulated into a QAM-16 symbol can be divided into two pairs, a higher-orderpair choosing quadrant, and a lower-order choosing a signal out of the four in

10

Page 11: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

20 40 60 80 1000

0.5

1

1.5Time domain

−50 0 500

2

4

6

8

10Frequency domain

Figure 8: Rectangle Pulse Shape, Q=10

that particular quadrant. Each group of four can be regarded as being QAM-4modulated. For the bits to be Gray coded it is necessary to rotate and sometimesflip before shifting. It is obvious from the figure that flipping is necessary forquadrants ”10” and ”01”. In the case of QAM-16, rotation should always beperformed so that the lower-order bit pair representing a ”11” is closest to origin.The procedure can analogously be repeated attaining as high an order of QAMsought for. Demodulation is done similarly, in an iterative fashion.

Figure 9: Signal constellations, QAM-4 to the left and QAM-16 to the right

3.5 Receiver

The receiver consists of a filter bank matched to the incoming data sequence.

11

Page 12: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

3.5.1 Modulating on a carrier

The channel is real, since the time domain itself is real. To transmit com-plex data we modulate the signal on a carrier letting amplitude correspond tomagnitude and likewise carrier phase to complex phase.

3.6 Sinusoidal Pre-signal

To be able to estimate the frequency offset caused by the hardware, a sinusoidalsignal is transmitted before the first superframe. At the receivers side the re-ceived signal is fourier transformed and from that, together with a threshold, thefrequency offset can be measured. This detected/estimated carrier frequency,

fcc is used throughout the whole data transmission, which means that this pro-cedure is only done once before the start of the first superframe.

The sinusoidal pre-signal is also used to estimate the energy of the signal. Thisis used in the decision whether a superframe is detected or not.

3.7 Superframe Detection

One superframe consists of 20 frames. The first frame in every superframe isthe training frame. Within the processing of the training frame the start of thesuperframe itself is derived, as well as an estimate of the channel.

3.7.1 The Training Frame

At the receivers side the channel at both antennas need to be estimated.

A naive choice of training sequence would be the all-ones or likewise the all-zeros sequence. The problem is that the corresponding OFDM symbol wouldconsist of a lone peak among zeros, rendering frame detection by correlatingan almost impossible task. Instead, a wisely chosen ”random” sequence will beused, spreading out the energy in the time plane.

The CP of the first frame in the superframe, i.e. the training frame, has thesame length as a whole data sequence, which means that the complete trainingsequence is transmitted twice.

3.7.2 Removal of the Coarsely Estimated Carrier Frequency

Input from the two antennas is sampled at the same rate as in the transmitter.Samples are put in two buffers, one for each antenna, and are analysed whenthey have reached a size B, which in this case has the length 3NQ. Removal ofthe coarsely estimated carrier frequency offset is done by multiplying the bufferelementwise with a vector containing a complex carrier, followed by filtering outthe high-frequency components.

d[k] = d[k]e−j2πfck, for 0 ≤ k ≤ 4NQ − 1

12

Page 13: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

3.7.3 Detection of the Training Frame

Frame detection on the two separated buffers is performed by finding the cor-relation between the tail of the data and the cyclic prefix. B must thus be longenough to contain an entire frame, but may at the same time not be long enoughto contain two frames and thus two pairs of correlated strips.

The first problem encountered is to determine whether there is a training framein the buffer or not. This can be solved by dividing the buffer into two partsU = {b∗1,2(k) : 0 ≤ k < B − NQ} and V = {b1,2(k) : NQ ≤ k < B}. Seefigure 10. Multiplying these two elementwise will yield a vector W , with a stripNQ samples long that has higher average energy than the rest of the vector, seefigure 11. This is due to the correlation between the CP and the tail of the data.The offset of the frame in the buffer can be estimated by the offset of this veryarea, which can be found be correlating with a rectangle. Mathematically put,α1,2 = (max arg |W ∗ O|) − P , where O is an all-ones vector NQ samples long.The absolute value is necessary because of the carrier, while certain frequenciesyield a minimum instead of a maximum. The algorithm will always spit out

Buffer length 3NQ

Buffer V, B-NQ Buffer U, B-NQ

Figure 10: The dividing of the buffer

0 500 1000 1500 2000 2500 3000 35000

10

20

30

40

50

60

70

80

[Samples]

[Pow

er]

Figure 11: A plot of the correlation for finding the coarse timing

a α for us, but to determine whether the buffer actually contains a frame, itis necessary to compare the magnitude of the maximum found to a threshold.Thus an lower threshold to judge the presence of a full frame is implemented.If present, NQ samples are picked out and passed on to decoding, whereafter it

13

Page 14: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

is known when the next frame starts. To determine whether part of the tail isnot cut away at the end of the buffer, θ ≤ B − NQ. In case of this half-frame,

the buffer is stepped 2NQ − length(P )2 samples forward. See figure 12.

b[0] b[2N+L+1]

TailCP CP

Frame detected Next frame

b[0] b[2N+L+1]

Incomplete frame

b[0] b[2N+L+1]

Incomplete frame

CP

Figure 12: Frames in buffers. Top to bottom: Frame present, not present, andonly part present

3.8 Training Frame Processing

3.8.1 Fine timing

The correlation used to detect the training sequence already gives a timingestimate, but it is however not very exact. Fine timing is done by finding theoffset τ , see figure 13, in a range around the coarse timing estimate, findingwhich one that fits training data the best. Put into mathematical terms,

τ = arg maxτ∈[0,3NQ]

N−1∑

k=0

d[kQ + τ ]t∗[k]

3.8.2 Estimation and Removal of the Fine Frequency Offset

The fine frequency offset is a constant phase-shift arising from the limited pre-cision in the frequency estimate. If, for instance, the coarsely estimated carrierfrequency, fcc is perfect, the fine frequency, θ becomes zero.

The fractional part, θ1,2 is estimated by calculating the complex difference be-tween the CP and the end of the data. This is done by taking the angle of thesum of the CP multiplied elementwise with its corresponding data sequence’complex conjugate. This is actually the ML estimate, see [1].

θ1,2 = − 1

2π∠

(

L−1∑

k=0

d1,2[k]d∗1,2[k + N ]

)

The original symbols can be extracted as d[k]1,2, k = L, ..., N +L is elementwise

multiplied by e−j2πθ1,2

N·(0:N−1).

14

Page 15: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

0 10 20 30 40 50 60 700

2

4

6

8

10

12

14

16

18

[Samples]

[Pow

er]

Figure 13: Fine timing

Thereafter the estimated frequency is updated:

fc = fcc +θ1 + θ2

2N

3.8.3 Channel estimation

The channel is estimated during the acquisition of the training sequence. Byknowing what is supposed to be and what is the channel is estimated:

H1,2[n] = D[n]1,2./T [n]

Please note that the carrier’s phase is built into this expression.

3.9 Frame Processing

When starting to process data frames, timing and frequency is already takencare of. In other words, no correlation in order to do timing is needed. The CPand its redundancy is hereafter only used to estimate the fine frequency offset,θ1,2.

3.9.1 Estimation and Removal of the Fine Frequency Offset

This part is carried out in exactly the same way as for the training frame.

θ1,2 = − 1

2π∠

(

L−1∑

k=0

d1,2[k]d∗1,2[k + N ]

)

The original symbols can then be extracted as d[k]1,2, k = L, ..., N + L is ele-

mentwise multiplied by e−j2πθ1,2

N·(0:N−1).

15

Page 16: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

3.9.2 Channel compensation and ECG

The channel is compensated for

D1[k] = D1[k]./H1[k], D2[k] = D2[k]./H2[k]

ECG

Z[n] =D1[n] + D2[n]

2

16

Page 17: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

4 Implementation

4.1 GUI

The graphic interface program has been developed in Microsoft Visual C++6.0. It’s the same GUI running on the transmitter side and the receiver side;with options that user can choose to make the program run in transmitter modeor receiver mode. This GUI is designed to take a wave file (*.wav) and put itin an unsigned short array to later transfer to the DSP. Generally, a user canselect any type of file to transmit to the DSP. The limitation on only transfer-ring wave file is based on that several sub functions which are merged to theGUI are designed only on processing wave file. The receiver takes the data thatcomes from the DSP, store it in a unsigned short array and regenerate the wavefile. To relieve the calculation pressure on DSP, some preprocessing has beenincluded into the interface program.

Figure 14: Graphic user interface

17

Page 18: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

4.1.1 Channel coding

The channel coding function in the transmitter mode takes an unsigned shortarray at any size, inserts zeros in every two thousand shorts, appends withzeros if the size of the original array is not a multiple of 2000, and code it witha convolutional coding scheme bitwise described in early chapter. The meaningof zero pending is that due to the size of the array the receiver can not bear thesize of the calculation (it will take a lot of memory and time to do the decodingand cause runtime errors.), then we need to truncate the data and make theinput to the decoder shorter. Currently it has been set to 2000 shorts, and thissize can be modified easily with some small changes on the source code (sincethe decoder is designed to take any size of array.).The decoding function takes an unsigned short array decode it using Viterbialgorithm. Since this coding is bitwise as we mentioned before, this operationtakes a significant calculation time (one short has 16 bits and an array with2000 shorts needs at least 32000 calculations).

4.1.2 Interleaving

The interleaving function is simple. It takes an array with any size, append withzeros if the size of the array is not a multiple of one hundred. Then it dividesthe array to a matrix with hundred rows and then rearranges it by transposingthe matrix and saving it as a new array. The interleaving is made for avoidburst bit errors. At the receiver side the deinterleaving does simply an inversedoperation to restore the original array.

4.1.3 Subfunctions

A series of sub functions have also been included into the GUI. An module callwave-file -handler which takes a wave file, returns its information such as soundquality, coded rate and length. A simple function to make the playback just tomake sure the wave file is playable before it is going to be sent and after it hasbeen regenerated. An activeX control is also been added to make some graphicplots.

4.2 DSP

4.2.1 DSP Board Description

The DSP board used in the project was the TI C6713DSK. The board workswith a 225 MHz TMS320C6713 Digital Signal Processor and has 256kBytes ofinternal memory. The DSK board counts with many peripherals including adual input/output 16 bit ADC/DAC with a 96kHz maximum sampling rate,this is the codec called AIC23. Both this codec and the RTDX module arethe main peripherals used. The first one since the EDMA module is the basicinterface between the output to the antennas and the DSK. The RTDX modulesince it is the interface for communications between the DSK and the PC. Theboard is equipped with other peripherals such as general purpose Input/Outputpins, four dip switches, 4 flashing LEDs, other Jtags and normal switches. How-ever, from these other peripherals only the LEDs have been used for graphical

18

Page 19: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

interface and debugging. While the program runs, the state machine changesare displayed on the LEDs as an extra visual aid to the user.

4.2.2 Basic Program Functionality

The DSP implementation of the theoretical model is a shadow of the Matlabsimulation. It is based on the EDMA RTDX GPIO skeleton program providedfor the project. The skeleton provides functionality to move buffers from/tothe ADC/DAC (EDMA), function to move buffers from/to the host (RTDX)and also to control 10 general purpose digital input output pins. The programwas, however, adapted so only the EDMA RTDX functionality is used. Thebasic structure works in the same way for both transmitter and receiver and itis as follows: The program starts with an initialization scheme by calling func-tion appl Init. In this function all the registers for configuring both RTDX andEDMA are set. Then the program simply enters an infinite loop and runs oninterrupts. The interrupts are activated by the EDMA whenever a new bufferis received in the ADC/DAC.

Inside the loop, two functions are called, namely appl BackgroundProcess andappl Process. The first one is used to send data to the PC using RTDX. This isdone once at least one receive buffer is put in a que to be sent to the PC. Theappl Process function is the core of the program. The buffers are therein pro-cessed before they are sent to the transmitter, as well as after they are receivedin the ADC/DAC channels. This processing is serial and the programmingmodel is implemented using a state machine which is shown in figure 15. Thisis where the Matlab model is applied. Once this process is done the receive andtransmit buffers are ready to be sent to the DAC (transmitter) or PC (receiver).As we said before, the program runs on interrupts so the appl Process functionhas to be fast enough to process a whole buffer before another interrupt fromthe EDMA is pulled. If this happens, a real time error flag is set.

The main difference between the transmitter and the receiver programs is ofcourse that the appl Process function is different. The transmitter is much sim-pler than the receiver. In the receiver a lot has to be taken into account inorder to recover the data. The wireless channel needs compensation and alsosynchronization has to be taken care of. On the other hand, in the transmitterthe appl BackgroundProcess is not used since we do not send information tothe PC, we just receive the initialization data in the appl Init function.

4.2.3 State Machine

Transmitter:

Sine Transmission:In order to estimate the frequency of the local oscillator at the receiver side, wetransmit a sine signal of 10 kHz prior prior to sending any kind of data. Thebuffer is sent during 2 buffer periods to ensure that the receiver will have atleast one full buffer filled with the sinusoid. The sine wave is generated from apre-defined table during the initialization process.

19

Page 20: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

Transmitter Receiver

Sine Sine

Transmission Detection

Guard Space Training Sequence

Detection and

Synchronization

Training Sequence

Transmission

Data Processing

Guard Space

Data Transmission

END

END

Figure 15: The State Machine

Guard space:To facilitate the detection of the training sequence, we send 2 empty buffersbetween the sine state and the training sequence state.

Training Sequence Transmission:The training sequence of 64 symbols is modulated using QAM-4 before it istransformed into the time plane using an inverse-fast fourier transform algo-rithm from the build in DSP library. A cyclic prefix of equal length is prependedthe training sequence and then upsampled by the factor Q = 14. A root-raisedcosine pulse shape then ensures that the transmitted signal has a bandwidthlower than the required 12 kHz. The altered training sequence must also be puton a carrier frequency of 10 kHz before it is sent over the channel. Identicaltraining sequences are sent every 20 data frames to correct timing drifts andupdate the channel estimation.

Guard space:To simplify the receiver side of the communication system, we send an emptyguard space between training and data frames.

20

Page 21: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

Data transmission:For each data frame we send a number of 16-bit signed integers to be modulated.The number of shorts depend on the modulation constellation we are using forthe current test. The modulation function is made to be able to construct QAMsignals of any scheme. Every data frame is, apart from this, processed in thesame fashion as the training sequence. After 20 frames we return to the trainingstate to start a new superframe.

Receiver:

Sine:The receiver’s first state is to wait for a sine wave to be sent over the channel. Itworks as a coarse synchronization as well as an estimator of the local oscillator’sfrequency. At least one filled buffer is received and the fast fourier transform iscalculated. The highest peak of this transform provides an amplitude which willbe compared to a predefined threshold. The index yields the frequency estimate.

Training sequence:After successful reception of a sine wave, the signal is down modulated to base-band and lowpass filtered to avoid the unwanted noise and high frequency com-ponents. Next the receiver self-correlates the received data to find the bestpossible estimate of the training sequence. Processing is done to achieve reli-able timing and channel estimatation. The timing calculation is crucial for thesucceeding data frames.

Data processing:With the help of the timing index acquired during the training state, the receivercan easily pick out each data frame and conduct the necessary processing. Thelast part of this state is to demodulate the received and processed sequence. Thisdemodulated sequence is then sent to the PC through the RTDX backgroundprocess for deinterleaving and decoding.

21

Page 22: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

5 Results

5.1 Simulation and algorithms

Figure 16 shows the performance of the timing algorithm. Parameters were cho-sen to make the BER to SNR ratio reflect this. 250 superframes each containingone data frame were sent for each level of SNR, implying that synchronisationis performed for each frame of data. In figure 17 the timing error is plotted.

10 15 20 25 30 35 40 4510

−4

10−3

10−2

10−1

100

SNR [db]

log 10

(B

ER

)

Figure 16: Performance of the timing algorithm

The importance of a robust timing algorithm is evident.

22

Page 23: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

−3 −2 −1 0 1 2 30

5

10

15

20

25

30

35

40

Timing error [samples]

BE

R [%

]

QAM−1024QAM−4

Figure 17: Error due to timing

The most interesting plot to come from the simulation is probably the oneshowing BER to SNR. See figure 18.

23

Page 24: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

10 12 14 16 18 20 22 24 26 28 3010

−4

10−3

10−2

10−1

100

SNR [db]

BE

R

BER QAM−1024BER QAM−256

Figure 18: BER of the simulated system. 5 superframes each containing 20 dataframes with N=128 were transmitted. Modulation used was QAM-1024.

5.2 Implementation

Figure 19 shows the true channel, estimated from dumping antenna input atthe receiver DSP and running through Matlab.

24

Page 25: Analysis, Simulation and Implementation of a SIMO OFDM …read.pudn.com/downloads194/doc/912931/greenreport.pdf · 2009-09-16 · Analysis, Simulation and Implementation of a SIMO

Green project report May 30, 2006

0 20 40 60 80 100 120 140

101.04

101.11

0 20 40 60 80 100 120 140−1

−0.95

−0.9

−0.85

−0.8

Figure 19: A plot of the channel. Upper graph - the magnitude, lower graph -the phase

References

[1] ”ML Estimation of Timing and Frequency Offset in Multicarrier Systems”, Beeket al. Tech. report Lule University of Technology, 1996

[2] ”An Introduction to Orthogonal Frequency-Division Multiplexing”, Edfors et al.,Tech. report Lule University of Technology, 1996

[3] ”Stanford Wireless communications-ch 12”

[4] ”WIDELAB, Technical Report, Royal Institute of Technology”, IR-S3-SB-0316,Per Zetterberg.

25