You are on page 1of 30

Error-Correcting codes on

cellular phones

May 12, 2005

by
Divyanshu Vats
Ania Kacewicz

Submitted to
Prof. David Saltman
TABLE OF CONTENTS
1.0 INTRODUCTION 3

2.0 COMMUNICATION SYSTEM 3-4

3.0 CELL PHONE STANDARDS 4

4.0 GSM ARCHITECTURE 4-5


4. 1 Mobile Station 5
4.2 Base Station Subsystem 5
4.3 Network Subsystem 5

5.0 LOGICAL CHANNELS 6


5.1 Traffic Channels 6
5.2 Signaling Channels 6

6.0 MULTIPLE ACCESS 6-9


6.1 FDMA 7
6.2 TDMA 7-8
6.3 CDMA 8-9

7.0 BURSTS 9 - 10
7.1 Normal Burst 9 - 10
7.2 Frequency Correction Burst 10
7.3 Synchronization Burst 10
7.4 Dummy Burst 10
7.5 Access Burst 10

8.0 CHANNEL CODING IN GSM 11 - 12


8.1 Block codes on speech channels 11
8.2 Block codes on signaling channels 12

9.0 CONVOLUTIONAL CODES 12 - 15


9.1 Encoder Structure 12 - 13
9.2 Polynomial Representation 13
9.3 Tree Diagram 13 - 14
9.4 Trellis Diagram 14
9.5 Convolutional Codes on Speech and Control Channels 15
9.6 Interleaving 15

10.0 CHANNEL DECODING 15 - 17


10.1 Maximum Likelihood Decoding 15 - 16
10.2 Viterbi Convolutional Decoding 16 - 17
10.3 Soft-Decision Viterbi Decoding 17

2
11.0 CHANNEL CODING IN CDMA 18 - 20

12.0 DIGITAL MODULATION 20 - 21


12.1 Phase Shift Keying (PSK) 20 - 21
12.2 Minimum Shift Keying (MSK) 21

13.0 SIMULATIONS 21 - 24

14.0 CONCLUSION 24 - 25

15.0 REFERENCES 25

APPENDIX A 26
APPENDIX B 27 - 29

FIGURES
1- Communication System 3
2- GSM Network 5
3- Multiple Access Schemes 7
4- FDMA Frequency Spectrum 7
5- Channel Division in FDMA Uplink Frequencies 7
6- TDMA Multi-Frame 8
7- TDMA Frame 8
8- CDMA Transmitter and Receiver 9
9- Burst Structure 10
10- Block Code Encoder and Decoder for Speech Channel 11
11- Convolutional Encoder Structure 12
12- Tree Diagram for Encoder 14
13- Trellis Diagram 14
14- Decoder Trellis Diagram 16
15- Eliminating Paths in Decoder Trellis Diagram 17
16- Decoding 17
17- Basic Turbo Code Structure 18
18- CDMA Base Station Transmitter 18
19- Encoder Structure for UMTS Turbo Codes 19
20- Turbo Code Encoder for cdma2000 19
21- Phase Shift Keying Signals 20
22- Bit Division for Quadrature Phase Shift Keying 21
23- Signal Waveform for Quadrature Phase Shift Keying 21
24- Block Diagram for Simulation 22
25- Plot of Original Input Speech 22
26- Introducing Burst Errors of Length 2 in all 57 bit blocks 23
27- Introducing Burst Errors of Length 10 to 57 bit Block 23
28- Introducing Burst Errors of Length 20 to 57 bit Block 24
29- Introducing Burst Errors of Length 30 to 57 bit Block 24

3
1.0 INTRODUCTION

Error correcting codes add redundancy into bits to improve the performance of a system. They
are widely used in almost all digital systems as they provide a method for dealing with the
unknown, noise. But this capability has several costs and trade-offs. Apart from needing an
extra encoder and decoder, we have to transmit more information in the same amount of time i.e.
increased data rates which translates into more bandwidth. It is not surprising that cell phones
also use error correction. Imagine a cell phone service that did not protect speech of their
customers. All the noise and interference would result in the final speech being noisy and thus
make customers unhappy. It might also affect various other things such as billing and call
management.

We attempt to discuss the different kinds of codes in cell phone networks. Our primary
discussion is of the most popular cell phone standard, GSM, but we also discuss codes used in
the competing CDMA standard. We start of by describing a basic digital communication system
so that readers can get a feel of how the error correction fits in. Then we discuss various cell
phone standards and then briefly describe the GSM network so that the reader knows where and
how the coded signals are transmitted. Further, we discuss the medium and method by which the
codes are sent out to the receiver followed by a detailed discussion of the channel coding used in
GSM and CDMA systems. To complete the topic, we discuss how the digital symbols are
translated into waveforms via modulation. In the end we conclude by discussing some
simulations we ran of coding speech signals.

2.0 COMMUNICATION SYSTEM

Figure 1 – Digital Communication system [1]

4
Figure 1 shows the basic signal flow and signal processing steps in a digital communication
system. The blank blocks are the key processes and the rest ensure the signal transferred is
correctly and received on the other end with minimum amount of bandwidth used. It is clear
from the figure that the steps in transmission are reversed on the receiver side [1].

Formatting refers to converting the input signal into a bit stream. Source encoding compresses
the bit stream by removing redundancies and thereby compressing the data. Source decode
block performs a reverse operation of source encode. Encryption-Decryption blocks provide
security features which prevent hackers or malicious users from eavesdropping. Channel
encoding-decoding add the capability of error correction. Multiplexing and Multiple Access
provide for users to share the communication resource (e.g. spectrum, time). Frequency spread
is also technique for multiple access. Pulse Modulations corresponds converting bit streams into
pulses i.e. representing signals by discrete voltages. When pulse modulation is applied to binary
symbols the resultant binary waveform is called a pulse-code-modulation (PCM) waveform.
When the channel cannot support pulse-like waveforms, the waveforms are frequency translated
by a carrier. This is done by the Bandpass Modulator which corresponds to the demodulator on
the receiver.

3.0 CELL PHONE STANDARDS

In the early 1980’s several European countries were individually developing their own analog
standards for cell phones. All of these systems were incompatible with each other which caused
many problems bounding cell phone use to national boundaries. The European Union realized
this problem and developed GSM phase I standard. At that time GSM stood for Groupe Special
Mobile, but now it is referred to as Global System for Mobile Communications. Eventually the
GSM replaced the popular analog standards such as TACS in United Kingdom and AMPS in the
United States. GSM is now the de facto standard in Europe and Asia and also used in parts of
North America, mainly by Cingular Wireless and T-Mobile [4].

In the United States, a standard based on Code Division Multiple Access (CDMA) is much more
popular. Unlike GSM, where division of bandwidth is done in terms of time and frequency,
CDMA utilizes special codes for sharing bandwidth. It was first developed by Qualcomm in
California [8]. The popular CDMA based standards are UMTS and cdma2000. The latter is
used by well known cell phone services such as Verizon Wireless and Sprint PCS.

4.0 GSM ARCHITECTURE

GSM is a complex system and difficult to understand. We give a brief overview of the
architecture so that the channel coding concepts can be clear. For further reading on the
architecture we refer the reader to [2].

The GSM network can be divided into three parts as shown in Figure 2. The Mobile Station (MS)
refers to the mobile equipment. The Base Station Subsystem controls the radio link with the
Mobile Station. The Network Subsystem performs main functions such as switching of calls
between mobile users, mobility management operations, and proper operation and setup of a
network. These functions are controlled by the Mobile Services Switching Center (MSC).

5
Figure 2 – GSM Network

4.1 Mobile Station

The Mobile Station is mainly the Subscriber Identity Module (SIM) card. The SIM provides
personal mobility, so that users can have access to mobile services irrespective of mobile
terminal, and receive other subscribed services. It also contains an authentication key mainly
used for encryption and decryption of messages [3].

4.2 Base Station Subsystem

The Base Station Subsystem (BSS) is composed of two parts, the Base Transceiver Station
(BTS) and the Base Station Controller (BSC). The Base Transceiver Station houses the radio
transceivers that define a cell and handles the radio-link protocols with the Mobile Station.
The radius of cells is chosen according to the number of subscribers in the system. The BSC
acts as a bridge between the Network Subsystem and the Mobile Station [3].

4.3 Network Subsystem

The central component of the Network Subsystem is the MSC. It provides functionality
needed to handle mobile subscribers, such as registration, authentication, location updating,
handovers, and call routing. Some components of the Network Subsystem shown in Figure 2
are Home Location Register (HLR), Visitor Location Register (VLR), Equipment Identity
Register (EIR), and Authentication Center (AuC). The HLR contains all administrative
information of a user in the corresponding GSM network along with the current location of
the mobile. VLR contains selected information from the HLR necessary for call control and
provision of subscribed services. The HLR and VLR, together provide for call routing and
roaming capabilities of GSM. It should be noted that the MSC does not contain any
information of mobile location and these are all stored in registers. The EIR and AuC
provide for authentication and security. The EIR contains a list of valid mobile equipments
on the network. The AuC contains a list of the authentication key stored in each users SIM
card. This is used for authentication and encryption over the radio channel [3].

6
5.0 LOGICAL CHANNELS

Logical channels act as a medium for transmitting bits in a GSM system. Later these logical
channels are mapped onto actual physical channels for actual transmission. They are divided
into two categories: Traffic channels and Signaling (control) channels.

5.1 Traffic Channels (TCH)

Traffic channels are used for the transmission of speech and user data (fax, text). They do not
carry any information for controlling a network. For carrying speech, TCH can be either
fully used, full-rate TCH (TCH/F), or be split into two half-rate channels (TCH/H). By
splitting the TCH/F into two channels we can allocate channels to different subscribers. For
carrying user data there are three types of TCH channels with different bit rates: TCH with
9.6 kbit/s, 4.8 kbit/s, or 2.4 kbit/s. The TCH/4.8 and TCH/2.4 can be further divided into
full-rate and half-rate channels [3].

5.2 Signaling Channels

The signaling channels are used for the control and management of a cellular network.
They are always active except when a mobile station is turned off. There are three types of
signaling channels: Broadcast Channel (BCH), Common Control Channel (CCCH), and
Dedicated Control Channel (DCCH) [10].

The BCH is further divided into Broadcast Control Channel (BCCH), Frequency Correction
Channel (FCCH), and Synchronization Channel (SCH). The BCCH is broadcasted on the
first frequency assigned to a cell because it carries information about organization of a radio
network in a local base station. The FCCH is used to send information about correcting
transmission frequency and SCH is used to broadcast information about a BTS and is able to
synchronize frames of a MS [3]. The CCH is used to manage access information i.e.
information about dividing channels among users. They are further divided into four
channels out which Random Access Channel (RACH) is the important one. The Random
Access Channel (RACH) is a Slotted Aloha channel that is used by the mobile station to
request access to the channel. The Slotted Aloha channel connects a particular user to a
particular time slot with some probability p [4]. Unlike BCH and CCH, DCCH is bi-
directional channel meaning that it can be transmitted by both the mobile station and the base
station.

6.0 MULTIPLE ACCESS

Multiple access is a method that allows multiple users to share a channel at the same time. It
basically involves the division of channel along time, frequency, codes, or combination of all of
them. Figure 3 illustrates how each of the method: Time Division Multiple Access (TDMA),
Frequency Division Multiple Access (FDMA), and Code Division Muliple Access (CDMA),
allocates space in a channel. GSM uses FDMA combined with TDMA resulting in multiple
users sending information at the same frequency but not at the same time [6].

7
Figure 3 - Multiple Access Schemes

6.1 FDMA

FDMA was the first method developed for sharing bandwidth. Just as the name suggests,
FDMA divides the frequency spectrum into different channels and each signal is sent at a
different frequency. For a GSM network, the mobile station uses the 890 MHz to 915 MHz
range while the base station uses the 935 MHz to 960 MHz range. This scheme is shown in
Figure 4 [6].

Figure 4 – FDMA Frequency Spectrum

Each 25 MHz is divided into 124 single carrier channels of 200 kHz width. There is actually
space for 125 channels in this 25 MHz band, but at 890 MHz to 890.2 MHz there is a guard
band that prevents interference from other non-GSM systems. This channel division is shown
below in Figure 5 [6].

Figure 5 - Channel Division in FDMA Uplink Frequencies

6.2 TDMA

TDMA is the division of channels into time slots. Once the frequencies are divided into 124
channels, each 200 kHz channel is further divided into 120 ms multi-frames composed of 26

8
frames as shown in Figure 6 [6]. The first two frames are used by signaling channels and the
remaining 24 frames are used by traffic channels.

Figure 6 - TDMA Multi-Frame Division

Each frame is further divided into 8 time slots called bursts. These 8 time slots, shown in
Figure 7 [6], form a TDMA frame. Each time slot lasts 576.9 s and as a result each frame
lasts 4.615 ms [6]. The different types of bursts and their structures will be described in
section 7.

Figure 7 - TDMA Frame

6.3 CDMA

In the CDMA the bandwidth is shared by using spreading codes. They have an effect of
spreading the frequency of the signal over the whole frequency range. In order to make sure
interference is minimized, the codes are chosen to be orthogonal to each other [7]. This
allows for several users to send information at the same time, but also calls for tight
synchronization of data on the receiving side. If one part of the information gets delayed,
then codes would not be orthogonal and this will result in interference. The capacity of
CDMA is same as that for TDMA and FDMA, but CDMA has the advantage of not requiring
guard bands to be sent during transmission [5]. The main advantage of CDMA over TDMA
and FDMA is that there are practically infinite number of codes that can be used on
transmission [5]. A huge problem with CDMA is called the “near-far-problem”. This
happens when two signals are sent simultaneously with equal power and the receiver receives
the closer transmitter’s signal with much higher power than the signal farther away
transmitter. Thus, far away transmitters have significantly less power then closer ones and
this causes distortions in the signal and maybe even unreadability. This problem can be
reduced by adding fast power control.

Each base station is assigned a different spreading code, and each code differs from station to
station. The spreading codes are composed of +1’s and -1’s. If stations interfere with each
other then their codes will add up, but since these codes are orthogonal the receiver will be
able to correctly determine the message that is being sent. This is possible because the
receiver will have the code key to the station whose signal it wants to receive, and the dot

9
product with the received signals will zero out other stations’ messages and leave only the
desired stations message. Each station will send its code to represent a 1 and its code inverse
to convey a 0. The dot product of a code with its inverse will result in a -1, and then the
receiver will know that a 0 was being sent. The basic CDMA transmitter and receiver with k
users are shown in Figure 8 [5].

Figure 8 - CDMA Transmitter and Receiver

Here bk(t) represents bits for user k, Ck is the spreading code, J is the spreading factor, sk(t) is
^
the transmitted signal for user k, and y(t) is the received signal for all users. b k is given by
^ J
bk = sgn C k y[n]
i =1
^
If we consider 4 users in a system then b k with k = 1 will be decoded as b1 because the
spreading are taken to orthogonal and the dot product of orthogonal codes is 0. The sgn(x)
return 1 is x > 0 and -1 if x < 0 [5].

7.0 BURSTS

In a GSM system messages are transferred by means of bursts. Each burst corresponds to one
TDMA slot and depending on applications; there are five kinds of burst structures. Each burst
has 156.25 bits.

7.1 Normal Burst

The normal burst is used to transmit information on the traffic and control channels, except
for RACH, SCH, and FCCH. The structure of normal bursts, along with other bursts, is
shown in Figure 9. The start and end have 3 tail bits which are always set to ``0’’. This
gives the transmitter time to get ready to send bits and also helps in modulation of signals.
The two blocks of 57 bits contain the actual data which is to be received. The data is error-
protected, channel-coded, and finally interleaved before it goes out as a burst. Two signaling
bits around the 26 bit block tell the receiver whether traffic data or signaling data is being
sent. These bits are often referred to as stealing flags because during handovers these bits are
stolen by the FACCH channel and this limits the transmission of traffic data. The 26 bit
training sequence helps the equalizer build a model of the channel. The equalizer tries to

10
model the impulse response of the channel so that it can negate the effect of channel
interference [4].

Normal Burst 3 57 data bits 26 bit training 57 data bits 3 8.25


sequence
Frequency Correction
Burst 3 142 fixed bits 3 8.25

Synchronization
Burst 3 39 data 64 bit training 39 data 3 8.25
bits sequence bits
Dummy Burst 3 26 bit training 3 8.25
sequence
Access Burst
8 41 bit training 36 data bits 3 68.25
sequence
Figure 9 – Burst Structure

7.2 Frequency Correction Burst

This burst is used for frequency synchronization of a mobile station. It is done over the
Frequency Correction Channel (FACCH). The data bits and tail bits are all set ``0’’.
Because of the modulation process (section 12.0), all 0’s correspond to carrier wave of the
required frequency. This will be seen in later sections. This burst allows for time
synchronization with the TDMA frame and also correction of the carrier frequency [4].

7.3 Synchronization Burst

This burst is used for time synchronization with the BSS. In the 39 bits on the sides, it sends
addition information such as running number of the TDMA frame, reduced TDMA frame
number. It uses the Synchronization Channel (SCH) for transmitting bits [4].

7.4 Dummy Burst

This burst is transmitted when no other burst are to be transmitted. It uses the frequency
channel of the BCCH. This ensures the BCCH continuously sends data to the base station in
a time slot and also enables the mobile station to collect useful data such as signal power
measurements. It also sends a 26 bit training sequence so that the channel can be
continuously modeled for future transmission of data [4].

7.5 Access Burst

This burst is used for random access to the Random Access Channel (RACH). This enables
mobile station to get access to a dedicated signaling channel. Since most of the mobile
stations sending data on this channel are not yet time synchronized, the guard period for this
burst is very long. This avoids collision between users [4].

11
8.0 CHANNEL CODING IN GSM

Channel coding adds redundancies for protection of data. As seen in section 7.0, there are
several channels in a GSM network and each has its own coding scheme. But the general model
for coding is to first apply a block code for error detection and then use a convolutional code for
error correction.

8.1 Block codes on speech channels

Before any encoding goes on we must mention the structure of a speech message. There are
260 bits coming out of a speech coder every 20 ms. These 260 bits are divided into three
classes: class Ia, Ib, and II. There are 50 class Ia bits and these are the most sensitive to bit
errors. Class Ib contains 132 bits which are moderately sensitive to bit errors. There are 78
class II bits which are mildly affected by bit errors and receive no protection.

Block codes, also known as redundancy codes, are thought of as giving external protection in
the encoding process. In the speech channels block codes are used on the class Ia bits to add
extra protection to these particularly sensitive bits. The block code used here is a (53, 50, 2)
code with generator polynomial
G(x) = x3 + x + 1
This produces 3 parity bits, {p1, p2, p3}. If {d1, d2, … d182} are the class I bits then the parity
bits are included in the middle as follows
{d2, d4, d6,…, d182, p1, p2, p3, d181, d179, …, d1, 0, 0, 0, 0}
The four zero bits, also known as tail bits, at the end of the 185 bits are used to reset the shift
registers of the convolutional encoder that the class I bits are sent through next.

Figure 10 - Block Code Encoder and Decoder for Speech Channel

If we represent the class Ia bits by D(x) = D49 x49 + D48 x48 + ... + D1 x + D0, then the
decoder first finds R(x) = D(x) x3 (mod G(x)). The parity bits are calculated by inverting the
bits of R(x). This is implemented as a cyclic shift register shown in Figure 10. We first
initialize the registers with D49, D48, and D47. This is represented by the multiplication by x3
in the equation of R(x). The division is done by inputting the rest of the bits and in the end
taking the final values in the shift registers and inverting them. The decoder implementation
is the same as in Figure 10. To know whether an error has occurred, the final values in the
shift registers should all be 1 corresponding to the polynomial 1+x+x2. If an error occurs
then the speech frame is discarded and the value is calculated by extrapolating the previous
correctly received frame. The 189 are an input to the convolutional code which will give 378
bits. On concatenating these bits with the class II bits we will get a total of 456 bits per 20ms
of speech frame

12
8.2 Block codes on signaling channels

The signaling data is much more important then than the speech data. This is because this is
the data that lets the network know who is making the call, for how long, and lets a
subscriber get connected on the network. The channel input is 184 bits except for RACH and
SCH. In RCH the generator polynomial is 1+x+x2 +x3 +x5+ x6 and in SCH the polynomial is
1 +x + x4 +x5 +x6 + x8 +x10. In other signaling channels an extremely powerful block code,
caled fire code, is used. The fire code generator polynomial used is
G(x) = (x23+1) (x17+ x3 +1)
The parity bits are such that when divided by G(x) produce the polynomial 1+x+x2+…+x39.
The encoding and decoding is done the same way as in Figure 10. The 40 parity bits are
again put in the middle of the stream and tail bits of value ‘0’ are added to initialize the
convolutional encoder. Again we will get a total of 456 bits of data.

9.0 CONVOLUTIONAL CODES

In almost all applications of digital communications, convolutional codes are used as the main
error correction code because of its ease of implementation compared to an equivalent block
code. This coding gain translates into reduced cost and weight of the equipment. Convolutional
codes can be summed up as codes without a block structure. For example, to encode a block
code we divide an infinite data stream into blocks and then apply the code on each individual
block. The final output depends on the corresponding block it came from in the input stream.
For convolutional codes, we again divide the stream into blocks, but the blocks are much smaller.
The final output for convolutional codes depends on multiple blocks from the input stream.
Another property which makes it ideal for communication systems is Linear Time-Invariance
(LTI). All analysis of communication systems assume LTI systems, as non-linearity is difficult
to model and predict.

9.1 Encoder Structure

A convolutional code is represented by its rate and constraint length. Rate is the ratio of
inputs to outputs. For example a rate of ½ means that we get 2 outputs for each input.
Constraint length is defined as the number of symbols in the data stream that have an effect
on the output of the encoder. The outputs are determined by adders, which can also be
represented by polynomials.
Output 1

Input

Output 2
Figure 11 – Convolutional Encoder Structure

13
Figure 11 shows a simple (2, 1) convolutional encoder with constraint length K = 3. The rate
of this code is clearly ½. The two modulo-2 adders control the output. To see how the
output is formed we pass in a sample input, 101, into the encoder. Initially, the registers will
contain all 0's. As we move one input into the registers, the outputs will change. This
process is shown in Table 1 [1]. Also, notice how two extra 0’s are introduced into the bit
stream to flush out the contents of the register. This is an important step because we do not
want bitstreams to interfere with each other.

Input Register Output


Contents
1 00 11
0 10 10
1 01 00
0 10 10
0 00 11
Table 1 – Encoding a message

9.2 Polynomial Representation

We can also represent convolutional encoders by polynomials. For the encoder in Figure 5,
the generator polynomials are

g1(x) = 1 + x + x2
g2(x) = 1 + x2

Suppose we represent our message sequence by a polynomial m(x), then for getting the
output we interlace m(x)g1(x) with m(x)g2(x) [1]. For example, if we want to transmit m =
101, we convert it into polynomial form 1 + x2.

m(x)g1(x) = (1 + x2)(1 + x + x2) = 1 + x + x3 + x4 = 1 + x + 0x2 + x3 + x4


m(x)g2(x) = (1 + x2)(1 + x2) = 1+x4 = 1 + 0x + 0x2 + 0x3 + x^4

On interlacing, we get U(x) = (1,1)+(1,0)x+(0,0)x2 +(1,0)x3 +(1,1)x4

The output sequence is the same as Table 1, after the flushing the registers with 0’s.

9.3 Tree Diagram

The tree diagram shows all possible information and encoded sequence of the convolutional
encoder. A tree diagram for the encoder of Figure 11 is shown is Figure 12. A solid line
represents a 0 and a dashed line represents a 1. For getting the output codeword, we trace the
tree according to our input message and spit out the word on each branch. For example, for
encoded 101 we first go down and get 11 as the codeword. Our next input is 0 and thus we
go up to get 10. Following that we go down because and get an output of 00. Further we
will need 2 consecutive 0 bits for flushing the registers. The output sequence is the same as
we got before. The tree keeps on growing exponentially and is not an optimum way of
describing a code. An optimum simplification of the tree diagram is the trellis diagram.

14
Figure 12 – Tree Diagram for Encoder

9.4 Trellis Diagram

On carefully observing the tree diagram in Figure 12, we see that the structure repeats itself
at time t = 4. This is not surprising because at this stage the fourth input enters the encoder
and first input leaves it which means that the fourth output set is not affected by the first
input. Thus, for arbitrary sequences 001xy and 000xy, the output after t = 3 will be the same.
This means we can merge paths and get a compact representation of the tree. This
representation is called a trellis diagram and corresponding diagram for the encoder in Figure
11 is shown in Figure 13. On the left we see all possible states for the shift registers. The
dotted line represents a 0 and the solid lines represent 1. For encoding 101, we trace the
trellis and output the codeword on the branch as we move on.

Figure 13 – Trellis Diagram

The trellis description of a convolutional code is useful for decoding. A typical decoding
algorithm will be to trace the trellis such that the probability of error is minimized.
Searching through all the paths will be computationally expensive and thus we use
algorithms for eliminating paths. The popular algorithm used in almost all of
communications is the Viterbi algorithm.

15
9.5 Convolutional Codes on Speech and Control Channels

Having introduced the concepts of convolutional encoding, we now see how they are used on
the speech channels of GSM. After the block coding of Class Ia bits, we get a total of 189
bits. These are fed into a convolutional encoder of rate = ½, giving us 378 bits of output.
These are combined with the Class II bits and sent out to the interleaver (section 9.6).
Finally, we get 8 blocks of 57 bits of data which fit perfectly in the normal burst blocks
(section 7.1).

The generator polynomials for speech channels are

g0(x) = x4 + x3 + 1 and g1(x) = x4 + x3 + x + 1 with a constraint length of 5.

This polynomial is also used for almost all signaling (or control) channels. This enables the
network to use the same encoder again and again.

9.6 Interleaving

Interleaving is like shuffling a deck of cards. An interleaver takes a set of data bits and
attempts to reorder them in an anomalous manner [9]. This prevents long strings of 1’s and
0’s and hence improves the performance of the convolutional codes. Most errors in a
transmitted signal are due to noise, which usually comes in bursts. Interleaving gets rid of
these bursts and spreads the errors randomly throughout the code. This is necessary since
convolutional codes work very well on random or independent errors and rather poorly on
bursts of errors. The reason being, the lack of block structure and because of this the burst
errors propagate during decoding. In a GSM speech channel, we have 456 bit code c = (c0, c1,
c2, ... c455), coming out of the convolutional encoder and these bits are grouped into eight
blocks of 57 bits in the following manner. Into the first block, B1, we place bits c0, c8,
c16, …c448, into B2 go bits c1, c9, c17,…, c449, and so on to B8. Next, the bits are further
interleaved by placing the bits in the first four blocks, B1, B2, B3, and B4, into the even
number spots in a 456 bit code, and the bits in the next four blocks, B5 through B8, are placed
in the odd numbered positions in a 456 bit code. There are different interleaving schemes for
different channels. Deinterleaving performs the reverse operation of interleaving to obtain the
original message. Deinterleaving and interleaving result in transmission delay, which is a
large problem. This delay is about eight frames in length, or 37 ms [4]!

10.0 CHANNEL DECODING

10.1 Maximum Likelihood Decoding

If all input message sequences are equally likely, a decoder with minimum probability of
error is one that compares likelihood function, P( Z | U (m ) ) . Here Z is the received sequence
and U(m) is a possible transmitted sequences. An obvious rule for decoding will be to choose
U(m’) such that
P ( Z | U ( m ') ) = max
(m)
P ( Z | U ( m ) ).
U

16
This equation defines principle of maximum likelihood decoding. If we assume that the
noise is additive white Gaussian noise and the channel is memoryless i.e. each the noise
affects each code symbols independently, the likelihood function can be expanded as
∞ ∞ n
M = P( Z | U (m)
) = ∏ P( Z i | U i
(m)
) = ∏∏ P( z ji | u (jim ) )
i =1 i =1 j =1

Zi is the ith branch of the received sequence and Ui is the ith branch of a possible output
sequence. If we assume a 1/n encoder, then we will have n bits for each branch represented
zji and uji. Thus the problem of decoding changes to maximizing M. Since M contains
products we simplify this by taking log(M). For maximizing this quantity we use the well
known Viterbi algorithm which traverses through a trellis and eliminates paths while doing
so.

10.2 Viterbi Convolutional Decoding

If we assume that the channel is binary symmetric i.e.

P(0|1) = P(1|0) = p then P(1|0) = P(1|0) = 1 – p

then the likelihood function can be replaced by a hamming distance metric [ref]. Thus the
Viterbi algorithm minimizes the hamming distance between codewords. The first step is to
assign distance metrics to each branch for corresponding input and output. For example if
Input: 1 1 0 1 1
Codeword: 11 01 01 00 01
Received sequence: 11 01 01 10 01
The corresponding decoder trellis diagram for the encoder in Figure 11 is shown in Figure 14.
As we trace the trellis, the metrics are assigned by comparing the received sequence with the
codeword that was originally there.

Figure 14 – Decoder Trellis Diagram

Viterbi algorithm traces through the trellis and eliminates possible paths as we go ahead. A
nice feature is that we always go ahead in the trellis and automatically get the decoded
sequence. The basic principle is that if two paths in a trellis merge to the same state, one of
them can be eliminated. This is shown in Figure 15. The top path has a total distance metric
of 4 and the bottom path has a total distance metric of 1. Thus we can eliminate the top path
because we can not possible get a minimum sequence out of it.

17
Figure 15 – Eliminating Paths in Decoder Trellis Diagram

(a) Paths Merging (b) Eliminating Paths


Figure 16 – Decoding using the Viterbi Algorithm

We start the algorithm by considering all possible paths from each node. When we get to a
point where paths can be eliminated, we eliminate paths and then proceed ahead. This is
shown in Figure 16. At t4, we see that two metrics merge into each other. By calculating the
sum of metrics, we eliminate paths and come up with the figure on the right. From this trellis
we can easily conclude that the first input is 1 because that is the only path left from t1 to t2.
In similar ways we can get all other inputs.

10.3 Soft-Decision Viterbi Decoding

The algorithm outlined above described hard-decision decoding. This means that only 1’s
and 0’s are received from the receiver or that the receiver makes firm decisions regarding the
final output. The GSM networks use soft-decision Viterbi algorithm, where the input to the
decoder has more than two levels (three levels for GSM). The three levels can be seen as a
measure of confidence. For example, if the input is 111, then the receiver is saying that the
input signal is definitely 1. If we get 011, then the input most probably 0. The algorithm
remains mostly the same, except we use a form of Euclidean distance instead of Hamming
distance. The numbers are represented by octal numbers instead of binary. For example, 11
will be represented as 77. Soft-decision decoding results in better performance with the price
of having to use more memory.

11.0 CHANNEL CODING IN CDMA

18
The two main types of CDMA standards are UMTS and cdma2000. UMTS stands for Universal
Mobile Telecommunications System. For channel coding, these standards use turbo codes or
convolutional codes. Turbo codes are composed of two codes that are separated by an interleaver
and concatenated parallely afterwards. An interleaver is an important aspect in turbo codes.
Turbo coding combines Cyclic Redundancy Code (CRC) and convolutional codes. The basic
turbo code structure is shown in Figure 17 [11].

Figure 17 – Basic Turbo Code Structure

The basic transmitter structure at the base station for CDMA is shown in Figure 18 [11].

Figure 18 – CDMA Base Station Transmitter

Conventional convolutional codes are nonsystematic codes (NSC), meaning that their input does
not appear at the output. There is a convolutional encoder, that the turbo codes use, that encodes
in a recursive and systematic manner, allowing both the input and parity bit to leave at the output.
This results in one parity bit in RSC (Recursive Systematic Convolutional encoder) instead of
two compared to NSC, but we reach a maximum interleaver gain due to the recursive bit. UMTS
and cdma2000 both use a recursive systematic convolutional encoder, though they use different
ones. For the turbo codes, UMTS uses a pair of RSC encoders with a constraint length K = 4.
The encoder for UMTS turbo codes is shown in Figure 19 [11].

19
Figure 19 – Encoder Structure for UMTS Turbo Codes

Xi is the input bit and there are two parity bits at the output from the upper and lower encoder, Zi
and Z’i respectively. Thus, this code has an approximate rate of 1/3 which is actually slightly due
to tail bits. When some data is sent into the input of this encoder the shift registers are in an
initial state of all zeros. Depending on the contents of a k-bit input, the shift registers will be in
one of eight states when the data has been encoded. In order to ensure that the shift registers are
in their initial states, there are six all-zero tail bits concatenated to the end of each data stream to
clear out the registers (there are three in each encoder). Due to these six tail bits added on a k bit
input, the rate actually becomes r = k/(3k+12). For large k this is approximately 1/3 [11].

For error correction, cdma2000 also uses either turbo codes or convolutional codes. The
encoding scheme for turbo codes is very similar for cdma2000 to that of UMTS and the main
differences arises from their interleaving algorithm. The rate of the cdma2000 RSC encoder is
also 1/3 neglecting tail bits. Tail bits are added to clear the shift registers just like in UMTS. The
rate could be increased if puncturing is performed. Puncturing is a process that removes one or
more of the parity bits before the message is sent. Figure 20 is the diagram of the cdma2000
turbo code encoder [11].

Figure 20 – Turbo Code Encoder for cmda2000

20
The first parity bit of the cdma2000 RSC encoder is the same as the upper encoders’ parity bit in
UMTS. The second parity bits are different and this is due to the interleaving schemes used.
Both UMTS and cdma2000 use a type of maximum likely-hood decoding algorithm that uses
trellis diagrams called soft-output Viterbi algorithm (SOVA).

12.0 DIGITAL MODULATION

Modulation refers to converting a bitstream into waveforms for final transmission over a channel.
The modulation technique used in GSM is called Gaussian Minimum Shift Keying (GMSK). It
is based on a simpler modulation technique, Phase Shift Keying (PSK).

12.1 Phase Shift Keying (PSK)

PSK was developed during the early days of deep-space communication and it is widely used
in military and commercial applications. For Binary PSK (BPSK), the signal is coded by two
waveforms corresponding to 1’s and 0’s. The signals are phase shifted versions of each other.

2E 2E
s0 = cos(ω 0 ) s1 = cos(ω 0 +π )
T T
E is the energy of the symbol; T is time period for which the waveform lasts and ω 0 is the
frequency of the wave. Waveforms for PSK are shown in Figure 21.

Figure 21 – PSK Signals

PSK can be extended to Quadrature Phase Shift Keying (QPSK), where we define four
signals with waveforms phase shifted by 90o. The conversion is done by dividing the data
stream into two blocks: in-phase part and quadrature part. The division of bits is shown in
Figure 22. It is clear that the in-phase part (dI(t)) and the quadrature part (dq(t)) contain even
and odd bits respectively of a bit stream d(t).

The modulation is done by the equation


1 1
s (t ) = d I (t ) cos(2πft + π / 4) + d Q (t ) sin(2πft + π / 4)
2 2
This can be simplified to a cosine with phase shifts 0, 90o, -90o, 180o. The waveform for the
signal in Figure 22 is shown in Figure 23. Notice how the waveform lasts for a period of 2T
instead of T.

21
d(t) dI(t)

d0 d1 d5 d6 d7
d0 d6

d2 d3 d4 d2 d4

T 2T 3T 4T 5T 6T 7T 8T
dQ(t) 2T 4T 6T 8T

d1 d5 d7

d3

2T 4T 6T 8T

Figure 22 – Bit Division for QPSK

Figure 23 – Signal Waveform for QPSK

12.2 Minimum Shift Keying (MSK)

The waveforms in Figure 15 are discontinuous which might cause problems at the receiver.
Although the receiver will read waveform every T seconds, still things are never perfect and
the discontinuities might result in an unstable system. This can be corrected by changing the
phase of the waveforms so that they are equal at the point of discontinuities. MSK is given
by the equation
1 π 1 π
s (t ) = d I (t ) cos cos 2πft + d Q (t ) sin sin 2πft
2 2T 2 2T
This will produce continuous waveforms. For GMSK we preprocess the signal with a
Gaussian filter to reduce the bandwidth of the signal. Although this bandwidth reduction
results in inter-symbol interference, it increases power efficiency which is worth the cost for
a GSM network.

13.0 SIMULATIONS

The goal of our simulation was to show the power of convolutional codes and interleaving done
in GSM for speech signals. We did not simulate the actual GSM speech vocoder because it is
very complex and not the main goal. Instead, we used a very simple algorithm for getting bits
out an input stream. Later we pass these bits into a convolutional encoder and group the
resultant bits into blocks of 456 for the interleaving process. The block diagram for our process,
along with decoding, is shown in Figure 24. It was implemented in MATLAB because of its in-

22
built capability to handle matrices and also it has tools for doing convolutional encoding. The
code is included in Appendix B.

Sampling and Convolutional Interleaving and


Input Speech Quantization bits Encoder 456 bits sending 57 bits
16 bits p/samle (1/2, 5) at a time

57 bits
Output
Speech Packing bits to Decoding using Channel: Interleaving and
get final speech Viterbi Adding noise sending 57 bits
Algorithm at a time
Figure 24 – Block Diagram for Simulation

Our input speech was man saying “Card games are fun to play”. After sampling the input speech,
we get a plot of the sampled speech values, which is shown in Figure 25. This figure will be
used as a reference to show how the decoding performed.

We get the bit string by passing the speech through the function getbitString(“input speech”).
The function channel_code_speech(speech, no. of bits) does convolutional coding on the speech.
The convolutional code used is same as the one described in section 9.5. Once the speech has
been encoded, we get 456 bits and interleave them into eight 57 bit blocks. These are sent out on
the channel and noise is added. We wrote three kinds of bursts: burst noise, periodic noise, and
random noise. The decoding is done using the Viterbi algorithm described in section 10. The
interleaving is done using the table shown in Appendix A.

0.3

0.25

0.2

0.15

0.1

0.05

-0.05

-0.1

-0.15

-0.2
0 2000 4000 6000 8000 10000 12000 14000 16000 18000
Figure 25 – Plot of original input speech

23
Our first experiment was to introduce 1 bit error per 57 bits of data we send with interleaving.
The final output was exactly the same as the input which means that the decoding was exact.
When we do the same thing without the interleaver, we get the same output without any error.

Next we introduce a burst of length 2 in each of the 57 blocks. This shows a very noisy channel
which constantly emits noise. After doing the decoding we get output which sounds almost
exactly like the input, but digitally it is a little different. When we do the same without
interleaving, we get a very noisy output. This is shown in Figure 26 by plotting the difference
between the original speech signal and output speech signal.
-3
x 10
4 0.5

3 0.4

2
0.3

1
0.2
0

0.1
-1

0
-2

-3 -0.1

-4 -0.2
0 2000 4000 6000 8000 10000 12000 14000 16000 18000 0 2000 4000 6000 8000 10000 12000 14000 16000 18000

(a) Error Values With Interleaving (b) Error Values Without Interleaving
Figure 26 – Introducing burst error of length 2 in all 57 bits blocks

We now test the code by modeling a channel that sends a lot of error at particular time instants.
For each 456 data bits it sends, we introduce a burst error variable lengths in one the interleaved
blocks of length 57 bits. From this setup we get speech that sounds almost like the original one
but with very small noise. We repeat the same without interleaving the data. This time, we get a
significant amount of noise as shown in Figure 27, Figure 28 and Figure 29.
-3
x 10 0.2
4

3 0.15

2 0.1

1
0.05

0
0
-1

-0.05
-2

-0.1
-3

-4 -0.15
0 2000 4000 6000 8000 10000 12000 14000 16000 18000 0 2000 4000 6000 8000 10000 12000 14000 16000 18000

(a) Error Values With Interleaving (b) Error Values Without Interleaving
Figure 27 – Introducing Burst error of length 10 for one block of 57 bits

24
1
0.07

0.06
0.5

0.05

0.04 0

0.03

-0.5
0.02

0.01
-1

-0.01 -1.5
0 2000 4000 6000 8000 10000 12000 14000 16000 18000 0 2000 4000 6000 8000 10000 12000 14000 16000 18000

(a) Error Values With Interleaving (b) Error Values Without Interleaving

Figure 28 – Introducing Burst error of length 20 for one block of 57 bits

We see that the error values with interleaving are very small and this is negligible when we hear
the speech. The error values are significant when we do not do interleaving. When we add
bursts of length 30 and do not interleave the data, we see a lot of errors which makes the signal
unrecognizable. But for the same, with interleaving, we get a signal with large error only for
some times. This shows how much effect interleaving has on coding messages in systems
1.5 1.5

1 1

0.5 0.5

0 0

-0.5 -0.5

-1 -1
0 2000 4000 6000 8000 10000 12000 14000 16000 18000 0 2000 4000 6000 8000 10000 12000 14000 16000 18000

(a) Error Values With Interleaving (b) Error Values Without Interleaving

Figure 29 – Introducing Burst error of length 30 for one block of 57 bits

14.0 CONCLUSION

The error correction techniques used in cell phones are the reason that we are able to have an
understandable conversation on our mobile phones, which is usually pretty clear. Applying these
codes does not take very long and they usually are able to correct almost all the errors. In some
cases, when the data is very important, these codes allow for proper error detection so a faulty
signal can be discarded. These codes save users from receiving another user’s phone bill and
give people the option to talk on the telephone while they are on the run. All the above

25
mentioned standards use some type of convolutional code to encode the message and then
Viterbi trellis decoding is used to extract the transmitted message. There are disadvantages and
advantages to each multiple access technique, but since there are several standards that use
different techniques, a user can pick the one that has the type of service that they want. We see
from the simulation that the interleaver is a very important part of convolutional codes and
without it the encoding is almost pointless.

REFERENCES

[1] Bernard Sklar, Digital Communications: Fundamentals and Applications, Prentice Hall, 2001.

[2] Siegmund M. Rdl, An Introduction to GSM, Boston, 1995

[3] Overview of the Global System for Mobile Communications,


http://ccnga.uwaterloo.ca/~jscouria/GSM/gsmreport.html

[4] Vijay K. Garg and Joseph E. Wilkes, Principles and Applications of GSM, Prentice Hall,
1999

[5] Code Division Multiple Access for Wireless Communications,


http://www.ece.utexas.edu/wncg/cdmarefs/cdma_talk.pdf

[6] GSM Multiple Access Scheme, http://www.eecg.toronto.edu/~nazizi/gsm/ma/

[7] William Stallings Data and Computer Communications 7th Edition: Chapter 9 Spread
Spectrum, http://juliet.stfx.ca/~lyang/csci-465/lectures/09-SpreadSpectrum-new.ppt

[8] Code Division Multiple Access,


http://www.answers.com/main/ntquery;jsessionid=i4kgxu1lom6a?method=4&dsid=2222&de
key=Code+division+multiple+access&gwp=8&curtab=2222_1&sbid=lc02a

[9] GSM System Block Diagram, http://www.eecg.toronto.edu/~nazizi/gsm/system/

[10] Introduction To GSM, http://www.pulsewan.com/data101/gsm_basics.htm

[11] Matthew C. Valenti and Jian Sun, Chapter 12: Turbo Codes, Handbook of RF and Wireless
Technologies

26
APPENDEX A – TABLE FOR INTERLEAVING

k mod 8= 0 1 2 3 k mod 8= 4 5 6 7
j=0 k=0 57 114 171 j=1 228 285 342 399
2 64 121 178 235 3 292 349 406 7
4 128 185 242 299 5 356 413 14 71
6 192 249 306 363 7 420 21 78 135
8 256 313 370 427 9 28 85 142 199
10 320 377 434 35 11 92 149 206 263
384 441 42 99 156 213 270 327
448 49 106 163 220 277 334 391
56 113 170 227 284 341 398 455
120 177 234 291 348 405 6 63
20 184 241 298 355 21 412 13 70 127
248 305 362 419 20 77 134 191
312 369 426 27 84 141 198 255
376 433 34 91 148 205 262 319
440 41 98 155 212 269 326 383
30 48 105 162 219 31 276 333 390 447
112 169 226 283 340 397 454 55
176 233 290 347 404 5 62 119
240 297 354 411 12 69 126 183
304 361 418 19 76 133 190 247
40 368 425 26 83 41 140 197 254 311
432 33 90 147 204 261 318 375
40 97 154 211 268 325 382 439
104 161 218 275 332 389 446 47
168 225 282 339 396 453 54 111
50 232 289 346 403 51 4 61 118 175
296 353 410 11 68 125 182 239
360 417 18 75 132 189 246 303
424 25 82 139 196 253 310 367
32 89 146 203 260 317 374 431
60 96 153 210 267 61 324 381 438 39
160 217 274 331 388 445 46 103
224 281 338 395 452 53 110 167
288 345 402 3 60 117 174 231
352 409 10 67 124 181 238 295
70 416 17 74 131 71 188 245 302 359
24 81 138 195 252 309 366 423
88 145 202 259 316 373 430 31
152 209 266 323 380 437 38 95
216 273 330 387 444 45 102 159
80 280 337 394 451 81 52 109 166 223
344 401 2 59 116 173 230 287
408 9 66 123 180 237 294 351
16 73 130 187 244 301 358 415
80 137 194 251 308 365 422 23
90 144 201 258 315 91 372 429 30 87
208 265 322 379 436 37 94 151
272 329 386 443 44 101 158 215
336 393 450 51 108 165 222 279
400 1 58 115 172 229 286 343
100 8 65 122 179 101 236 293 350 407
72 129 186 243 300 357 414 15
136 193 250 307 364 421 22 79
200 257 314 371 428 29 86 143
264 321 378 435 36 93 150 207
110 328 385 442 43 111 100 157 214 271
112 392 449 50 107 113 164 221 278 335

27
APPENDIX B

MATLAB code for simulations

%% script for channel coding for speech


%% coding.m
%% Authors: Divyanshu Vats and Ania Kacewicz

clear

[d y] = getbitString('MAL.wav');

code = channel_code_speech(d,224); % initially coded speech

[code_I I] = interleave(code);
%code_I = code; %% uncomment this line for interleaving

%% Add noise

noise = noise_burst(30,20);
%plan = zeros(1,57);
%plan = repmat(plan,1,7);
%noise = [noise plan];
%noise = repmat(noise,1,8);
noise = repmat(noise,length(code),1);

code_I = code_I + noise;

[code_DI] = deinterleave(code_I, I);


%code_DI = code_I; %% uncomment this line for no interleaving

[dec] = channel_decode(code_DI, length(d)); %% decoding speech

%% function for getting bitstring out of speech


%% Authors: Divyanshu Vats and Ania Kacewicz

function [d, y] = getbitString(filename)

[y,Fs,bits] = wavread(filename);
encode = double(uencode(y,bits,1,'unsigned'));
enc = dec2bin(encode,bits);
enc = enc';
f = enc(1:end);
d = double(f) - 48; %% input stream of bits

%% Noise functions : generates noise for 57 bits of data


function out = noise_burst(len,pos);

bb = ones(1,len);
k = zeros(1,57);

k(pos:pos + len-1) = 1;

out = k(1:57);
function out = noise_per(len, per);

28
%% generate noise of length 57 bits

% types
% "periodic" - some number of ones after every len bits

if len > 57
len = 57;
end
l = ones(1,len);
g = ceil(57 / per);
f = [l zeros(1,per-len)];
k = repmat(f,1,g);
out = k(1:57);

function out = noise_rand(num);

if num > 57
num = 57;
end

out = randerr(1,57, num);

%% Interleaving algorithm for GSM


%% It is done by reading input file given in Appendix A
%% Authors: Divyanshu Vats and Ania Kacewicz

function [out, I] = interleave(code)

i0 = textread('inter_0.txt','%d') + 1;
i1 = textread('inter_1.txt','%d') + 1;
i2 = textread('inter_2.txt','%d') + 1;
i3 = textread('inter_3.txt','%d') + 1;
i4 = textread('inter_4.txt','%d') + 1;
i5 = textread('inter_5.txt','%d') + 1;
i6 = textread('inter_6.txt','%d') + 1;
i7 = textread('inter_7.txt','%d') + 1;

I = [i0 i1 i2 i3 i4 i5 i6 i7];
out = [code(:,i0) code(:,i1) code(:,i2) code(:,i3) code(:,i4)
code(:,i5) code(:,i6) code(:,i7)];

%% performing deinterleaving
%% based on information about interleaver stored in I

function out = deinterleave(code_I, I);

sz = size(code_I);
out = zeros(sz);

for i = 1:8;
out(:,I(:,i)) = code_I(:,1 + 57*(i-1):57 + 57*(i-1));
end

%% decoding the convolutional code after addition of noise and giving


out the sample speech signals

function [out] = channel_decode(code, ll)

29
trellis = poly2trellis(5,[23 33]);

tb = 4;

for i = 1:length(code)
codeDec(i,:) = vitdec(code(i,:),trellis,tb,'cont','hard');
end

codeDD(:,:) = codeDec(:,5:end);
codeorig = codeDD';
codeorig = codeorig(:);
%codeorig = codeorig';

co = codeorig';
size(co)
co = co(1:ll);
co1 = reshape(co,16,ll/16);
co1 = co1';
out = co1;
%out = out';
out1 = out(:,1)*2^15 + (out(:,2)*2^14 + out(:,3)*2^13 + out(:,4)*2^12
+ out(:,5)*2^11 + out(:,6)*2^10 + out(:,7)*2^9 + out(:,8)*2^8 +
out(:,9)*2^7 + out(:,10)*2^6 + out(:,11)*2^5 + out(:,12)*2^4 +
out(:,13)*2^3 + out(:,14)*2^2 + out(:,15)*2 + out(:,16));
out = udecode(uint16(out1),16);

30

You might also like