0% found this document useful (0 votes)
4 views

chapter 3 Error detection & correction

Chapter 3 discusses error detection and correction in digital signal transmission, highlighting the impact of noise on data integrity. It covers various error types, the necessity of error control coding, and techniques for detection and correction, including parity checking, checksums, and cyclic redundancy checks. Additionally, it explains framing methods for data transmission, emphasizing the importance of ensuring accurate and reliable communication between systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

chapter 3 Error detection & correction

Chapter 3 discusses error detection and correction in digital signal transmission, highlighting the impact of noise on data integrity. It covers various error types, the necessity of error control coding, and techniques for detection and correction, including parity checking, checksums, and cyclic redundancy checks. Additionally, it explains framing methods for data transmission, emphasizing the importance of ensuring accurate and reliable communication between systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 69

Chapter 3

Error Detection &


Correction
Errors and their effects:

• In transmission of digital signal between 2 system as above,


the signal get contaminated due to addition of noise in it.
• The noise can introduce error in binary bits travelling from 1
system to other. i.e. 0 may change to 1or10.
• These errors can become a serious threat to accuracy of
digital system. So it is necessary to detect and correct errors.
Note

Data can be corrupted


during transmission.

Some applications require that


errors be detected and corrected.
Need of Error control coding
• Errors are introduced during transmission of data due to
noise.
• The reliability of data transmission will be severely affected
due to these errors.
• In order to improve the reliability of data transmission,
designer have to increase signal power or reduce noise
spectral density so as to maximize ratio Eb/No.
• Practically it is not possible to increase ratio, some kind of
coding is used to improve quality of transmitted signal.
• This will in turn reduce required transmitted power and size
of antenna.
• For coding 1 or more than 1 extra bits added to data at the
time of transmission, extra bits called parity bits and data
with parity bits called as codeword.
Note

To detect or correct errors, we need to send


extra (redundant) bits with data.
Types of errors
• Errors introduced during transmission categorized as:
1. Content errors: are nothing but errors in the contents of a
message. 0 received as 1 & vice versa.
2. Flow integrity errors: means missing blocks of data. It can
be due to data block lost in network because can be
delivered to wrong destination.
• Depending on no. of bits in error can classify in types:
1. Single bit error : only 1 bit in the data unit has changed from
“0 to 1” or “1 to 0”.
2. Burst errors: means that 2 or more bits in the data unit have
changed from “0 to 1” or “1 to 0”. The length of burst error
extends from first erroneous bit to last erroneous bit. Even
though some of bits in between have not been corrupted.
Single-bit error

Burst error of length 8


Disadvantages of coding
1. An increased transmission bandwidth is required in order to
transmit the encoded signal. This is due to additional bits.
2. Use of coding make the system complex.

Redundancy Data bits parity bits

• It involves transmission of extra bits along with the data bits.


These extra bits do not contain any data or information but
they ensure the detection and correction of errors introduced
during the data travel from sender to receiver.
• As the extra bits do not contain any information so called as
redundant bits and are also known as parity check bits.
• These bits are produced from data bits using some predefined
rule. The data bits and parity bits together called codeword.
Detection and correction

• Error control techniques:


1. Error detection: means only whether an error has
occurred or not. Not interested even in no. of errors.
2. Error correction: it involves multiple processes as
detecting errors, knowing number of errors, location of
errors and then correcting erroneous bits.
• The correction of errors is more difficult as compared to
detection because correction needs detection and then
correction of error.
Error Detection

• Enough redundancy is added to detect an error.


• The receiver knows an error occurred but does not
know which bit(s) is(are) in error.
• Has less overhead than error correction.

Error detection methods are as


 Parity Checking
 Checksum error detection
 Cyclic Redundancy Check(CRC)
Error correction

 In error correction techniques, codes are generated at sender


by adding a group of parity bits or check bits as in figure.
 Source generates data in binary form, encoder accepts the bits

and add check bits to produce code words. These code words
are transmitted towards receiver. The check bits are used by
decoder to detect and correct the errors. Decoder separates
the data and check bits, data bits passed to destination.
Techniques of Error correction
 Forward Error Correction (FEC)
 Automatic request for retransmission (ARQ)
Automatic request for retransmission (ARQ)
• In the ARQ system of error control, when an error is detected,
the receiver makes a request for the retransmission of that
signal (complete or part of message) so the feedback channel
is required for sending request for retransmission.
• In ARQ system less number of check bits are required to be
sent.
• A return transmission path and additional hardware in order
to implement repeat transmission of codeword needed
• The bit rate of forward transmission must make allowance for
the backward repeat transmission.
• Error probability on the return path: is negligibly small
because the bit rate of return transmission which involves
return transmission of ACK/NAK signal is low as compared to
bit rate of forward transmission.
ARQ System

• In the ARQ system of error control,


Forward Error correction (FEC)
 In Forward error correction techniques, there is no such
feedback path and request for retransmission. So error
correction has to take place at the receiver.
 The receiver tries to guess the transmitted message with the

help of redundant bits. So searches for most likely correct


code word. It is useful only for small no. of errors.
 When an error is detected, the distance between received

invalid code word and possible valid codeword is obtained.


 The nearest valid code

word (one having min. dist.)


is most likely correct
version of received code
word. Code word 1
1. Parity Checking
 The simplest technique for detecting errors is to add extra bits
known as parity bit to each word being transmitted.
 As in fig of 8-bit word  1 bit MSB is Parity and remaining 7-
bits are data bits.
 The parity of 8-bit transmitted word can even or odd parity.
 Even parity no. of 1’s in word including parity bit are even
(2,4,….)
 Odd parity no. of 1’s in word including parity bit are odd
(1,3,….)
Use of Parity bit to decide parity

1 1001011 Odd parity No. of 1’s= 4

0 1001011 Even parity No. of 1’s= 4

0 1001010 odd parity No. of 1’s= 3

1 1001010 Even parity No. of 1’s= 3


How does error detection take place?

1001011 Message to transmit

1 1001011 Odd parity No. of 1’s= 4

Received
1 0001011 with 1 error Even parity

Parity changed so
error is present
How does error detection take place?

1001011 Message to transmit

1 1001011 Odd parity No. of 1’s= 4

Received
1 0000011 with 2 error odd parity

Parity not changed so


error is not present
Failed to detect error
How does error detection take place?

1001011 Message to transmit

1 1001011 Odd parity No. of 1’s= 4

Received
1 0100011 with 3 error even parity

Parity changed so
error is present
pass to detect error
Note

A simple parity-check code can detect an odd


number of errors.
Can not detect even number of errors.
Two-dimensional parity-check code
Figure Two-dimensional parity-check code
2. Checksum
 Parity checking can not detect 2 or even no. of errors in same
word, so to overcome this problem two dimensional parity
used up to only 2 errors not worked for 4 errors so now see.
 Each word is transmitted, it is added to the previously sent
word and the sum is retained at the transmitter.
 Each successive word is added in this manner to the previous
sum. At the end of transmission the sum (checksum) up to that
time is sent.
 Checksum is transmitted along with every block of data bytes.
Here a 8 bit accumulator is used to add 8 bit bytes of a block
of data to find the checksum byte.
 The carries of MSB are ignored while finding out checksum
byte
How to detect error using the checksum byte ?
1. After transmitting a block of data bytes the checksum byte is
also transmitted. The checksum byte is regenerated at the
receive separately by adding the received bytes.
2. The regenerated checksum byte is then compared with the

transmitter one. If both are identical then there is no error. If


they are different then the errors are present in the block of
received data bytes.
3. Sometimes it can be done by using 2’s complement of checksum
is transmitted instead of checksum.
• Advantage of checksum method: the data bits are mixed up

due to the 8 bit addition. So checksum represents overall data


block, so 255 to 1 chance of detecting random errors.
Checksum Calculation
1
Carry
1 0 1 1 1 1 1
Byte 1 0 1 0 1 1 0 1 0

Byte 2 1 1 0 0 0 1 0 1

Byte 3 1 1 0 1 1 0 0 1

Sum 1 1 1 1 1 0 0 0
Checksum Calculation using 2’s complement
• Data items 7,11,12,0,6 to be sent , calculate value of
checksum at sending end. Show how error detection takes
place at receiver.
• Step 1: generation of checksum
• 7+11+12+0+6=36
• Binary form= 100100
• 4-bit checksum 0100
• wrapping + 10
• ---------------------------------
• 0110=6
• Complement of 6=15-6= 9
• Step 2: Packet sent by sender 7,11,12,0,6 ,9
Checksum Calculation using 2’s complement
• Step 3: at receiver 7+11+12+0+6+9=45
• Binary form= 101101
• 4-bit checksum 1101
• wrapping + 10
• ---------------------------------
• 1111=15

• Complement of 15=15-15=0

• So data not corrupted


Cyclic Redundancy check
Hamming Code
Framing
The data link layer needs to pack bits into frames, so that
each frame is distinguishable from another. Our postal system
practices a type of framing. The simple act of inserting a
letter into an envelope separates one piece of information
from another; the envelope serves as the delimiter.

Figure A frame in a character-oriented protocol

Topics discussed in this section:


Fixed-Size Framing
Variable-Size Framing
Fixed-Size Framing
• The bits to be transmitted is first broken into discrete frames
at data link layer.
• Checksum of each frame is computed and added with frame
for error free communication.
• When a frame is received, the data link layer, recomputes the
checksum. If it is different then error is present.
• It then discard the bad frame and send back a request for
retransmission.
• Breaking the bit stream into frames is called framing. The
way of doing it is by inserting time gaps between frames as fig
• The framing technique is called as fixed size framing as size
of each frame( no. of bits) same.
• Practically not works, n/w don’t make any guarantee of timing
Variable-Size Framing
• Practically fixed size framing technique not works, n/w don’t
make any guarantee of timing so other methods are derived.

• So frame size is kept variable and some of methods are as


1. Character count
2. Starting and ending characters, with character stuffing.
3. Starting and ending flags with bit stuffing.
4. Physical layer coding violation.
1. Character count

• In this method, a field in the header is used to specify the no.


of characters in the frame.
• This number helps to receiver to know exact no. of characters
present in the frame following this count is as fig.
• 2 frames shown in fig contains 3 & 8 characters respectively.
• Disadvantage of this method is that, an error can change the
character count itself.
• If the wrong character count no. is received due to error then
the receiver will get out of synchronization and will be able to
locate the start of next frame.
2. Starting and ending characters,
with character stuffing
• In this method, problem of character count method is solved
by using a starting character before the starting of each frame
and ending character at the end of each frame.
• Each frame is preceded by the transmission of ASCII character
sequence DLE ( data link escape) STX (start of text).
• After each frame DLE ETX(end of text) is transmitted.
• So if the receiver loses the synchronization, it just has to
search for the STX DLE or DLE ETX characters to return back
on track.
2. Starting and ending characters, with character stuffing

• In this method problem is that the characters STX DLE or


DLE ETX can be part of data as well.
• If so, they will be misinterpreted by the receiver as start or end
of frame. This problem can be solved by character stuffing.
• The data link layer at the sending end inserts an DLE
character just before each accidental DLE character in the
data being transmitted and will be removed in same layer at
the receiver. This can be distinguished from the one in data
because DLEs appear more than once.
3.Starting and ending flags, with bit stuffing
• In this method, at the beginning and end of each frame, a specific
bit pattern 0111 1110 called flag byte is transmitted by the
sending station.
• Since there are 6 consecutive 1s in the flag byte a technique
called bit stuffing which is similar to character stuffing is used.
• Whenever the sender data link layer detects the presence of 5
consecutive 1s in the data stream, it automatically stuffs a 0 bit
into the outgoing bit stream. Hence there is no chance of
misinterpretation. Called bit stuffing.
• When a receiver detects presence of 5 consecutive 1s in received
bit stream, it automatically deletes the 0 bit following the five 1s
called de-stuffing.
• The data section is stuffed with extra byte escape character(ESC)
when there is character with same as flag called byte stuffing
Bit stuffing and de-stuffing
Note

Bit stuffing is the process of adding one extra


0 whenever five consecutive 1s follow a 0 in
the data, so that the receiver does not
mistake
the pattern 0111110 for a flag.
Figure Byte stuffing and unstuffing
Note

Byte stuffing is the process of adding 1 extra


byte whenever there is a flag or escape
character in the text.
4. Physical layer coding violation
• This method of framing is applicable only to those networks in
which the encoding on the physical medium contains some
redundancy.
• Some LANs encode each bit of data using 2 physical bits.
• E.g. use of Manchester coding as in fig makes transition at the
middle of the bit interval.
• So 1 bit 10 and 0 bit 01 encoded, this helps in recognizing
the boundaries of bits in a precise manner.
Error Control
• To make sure that all frames are eventually delivered to the
network layer at the destination in proper order.
• The receiver sends back some feedback(positive or negative) to
convey information about whether it has received a frame or
not.
• A positive acknowledgement (feedback) ACK indicates a
successful and error free delivery of a frame.
• Negative acknowledgement (NAK) means something has gone
wrong and that particular frame needs to be retransmitted.
• Due to the presence of noise burst a frame may vanish
completely. So the receiver does not receive anything and it
does not react at all (no acknowledgement).
• This problem is overcome by introducing a timer in the data
link layer.
Function of a Timer
• When a sender transmits a frame, then it also starts data link
timer.
• Timer timing set by factors such as
1.time required for frame to reach destination,
2. processing time at destination and
3.time required for ack to return back.
• If frame received correctly and ack return back to sender
before timer runs out then timer cancelled.
• But if a frame is lost or ack is lost, then timer will go off it
shows there is some problem. Solution is to retransmit frame.
• And if frame transmitted multiple times, then receiver may
receive same frame 2 or more times and called duplication.
• To avoid this each outgoing frame is assigned a distinct
sequence number and will help to distinguish retransmission.
Note

Error control in the data link layer is based


on automatic repeat request, which is the
retransmission of data.
Flow Control
• In flow control the problem to be handled is when sender wants to
send data at faster rate than capacity of the receiver to receive
them.
• The receiver will keep loosing some of the frames because they
are arriving quickly so need to introduce flow control.
• Flow control will control the rate of transmission to a value
which can be handled by receiver.
• It requires some kind of feedback mechanism from receiver to
sender, can adjust sending rate automatically.
• When sender sending data it must wait for ack, else overflow.
• The speed of processing of any receiving device is limited and
limited storage space(buffer) for storing incoming data.
• So the receiver should tell sender about adjusting data flow rate
to suit its speed or stop temporarily.
• Incoming data is first stored in buffer and sequentially processed.
Note

Flow control refers to a set of procedures used


to restrict the amount of data
that the sender can send before
waiting for acknowledgment.
Protocols
Now let us see how the data link layer can combine framing,
flow control, and error control to achieve the delivery of data
from one node to another. The protocols are normally
implemented in software by using one of the common
programming languages.

unrestricted Simplex

Simplex Stop and wait


Noiseless Channels
Let us first assume we have an ideal channel in which no
frames are lost, duplicated, or corrupted. We introduce two
protocols for this type of channel.

Topics discussed in this section:


Simplest Protocol unrestricted Simplex
Stop-and-Wait Protocol Simplex Stop and wait
1. An unrestricted Simplex protocol
• This is Simplest protocol.
• The transmission of data takes place in one direction.
• It is assumed that n/w layer of sender and receiver always
ready.
• Communication channel is noise free so no damage and no
loss of any frame and ignore processing time and consider
buffer space available infinite.
• This is highly unrealistic.
Figure The design of the simplest protocol with no flow or error control
Example
an example of communication using this protocol. It is very simple.
The sender sends a sequence of frames without even thinking
about the receiver. To send three frames, three events occur at the
sender site and three events at the receiver site. Note that the data
frames are shown by tilted boxes; the height of the box defines the
transmission time difference between the first bit and the last bit
in the frame.
2. Simplex Stop-and-Wait protocol
• In this protocol it is assumed that a finite processing is
essential, channel is noise free and comm. is in one direction
at a time.
• It deals with how to prevent sender from flooding receiver
due to data rates faster than processing speed of receiver.
• A dummy frame (ack) sent back from receiver to sender to
indicate that it can send next frame.
• Sender sends 1 frame and wait for ack.
• Once ack received, sends next frame and waits for ack.
Hence called as stop-and-wait protocol.
Figure Design of Stop-and-Wait Protocol
Example
an example of communication using this protocol. It is still very
simple. The sender sends one frame and waits for feedback from
the receiver. When the ACK arrives, the sender sends the next
frame. Note that sending two frames in the protocol involves the
sender in four events and the receiver in two events.
Piggybacking
•Transmission of data needs to be bi-directional (full duplex)
•It can done by taking 2 channels for data and other for ack.
•Better solution to use each channel to send frames both ways
•The receiver waits until its network layer passes in the next
data packet. The delayed acknowledgement is then attached
to this outgoing data frame. This technique of temporarily
delaying the acknowledgement so that it can be hooked with
next outgoing data frame is known as piggybacking.
•Adv: better use of available channel bandwidth as ack frame
need not send seprately.
•Disadv: 1. additional complexity,
2. if data link layer waits too long before sending ack ,
retransmission of frame may happen
Figure Design of piggybacking
Noisy Channels

Although the Stop-and-Wait Protocol gives us an idea of


how to add flow control to its predecessor, noiseless
channels are nonexistent. We discuss three protocols in
this section that use error control.

Topics discussed in this section:


A Simplex Protocol for noisy channel
Sliding Window Protocols
Stop-and-Wait Automatic Repeat Request
Go-Back-N Automatic Repeat Request
Selective Repeat Automatic Repeat Request
A Simplex Protocol for noisy channel
• Assume comm. Channel is noisy and introduce error in data
travelling over it. Means may damage or loose frame.
• Sender waits for +ve ack before advancing to next data item.
• There is a timer set at sender when a frame is sent, if sender
times out it will resend the same frame again. So called PAR
(+VE ack with retransmission) or ARQ type protocol.
• Due to retransmission, possibility of duplication of frames.
• To avoid this sender puts a sequence no. in header of each
frame it sends. receiver checks seq no and discard duplicate.
• Operations can be divided in 2 modes:
1. Normal operation
2. Time out
Normal Operation and Time Out

1. Normal Operation 2. Time Out and retransmission


Sliding window protocols
• Sliding window protocols are data link layer protocols for
reliable and sequential delivery of data frames. The sliding
window is also used in Transmission Control Protocol.
• In this protocol, multiple frames can be sent by a sender at a time
before receiving an ack from the receiver.
• Sliding windows are imaginary boxes at sender and receiver.
• The size of the sending window determines the sequence number
of the outbound frames. If the sequence number of the frames is
an n-bit field, then the range of sequence numbers that can be
assigned is 0 to 2𝑛−1. Consequently, the size of the sending
window is 2𝑛−1.
• The size of the receiving window is the maximum number of
frames that the receiver can accept at a time. It determines the
maximum number of frames that the sender can send before
receiving acknowledgment.
Sender and Receiver Sliding windows
Movement of Sender’s & Receiver’s windows
• The sender sends the no. of frames allowed by the size of its
own sliding window and wait for ack from receiver.
• Receiver sends ack which includes no. of next frame that the
sender send.
• If sender sent frames 0 &1 to receiver and till ack receives
sender’s window contain only 2 frames i.e. 2&3.
• when receives correctly, then ack sent by receiver include
no. 2 indicating sender to send frame no.2. and understand
frame no. 0&1 receives correctly and expand window size 4.
• Left edge of senders window shift right when data frame sent.
• Right edge of senders window shift right when ack received.
• Left edge of receivers window shift right when frame receives.
• Sends ack indicating next frame no. and then
• Right edge of receivers window shift right when ack send.
Sliding Window Protocols types

Sliding Window Protocols are of 3 types they show a different


performance in terms of their efficiency, complexity and
buffer requirements.

1. Stop-and-Wait Automatic Repeat Request


2. Go-Back-N Automatic Repeat Request
3. Selective Repeat Automatic Repeat Request
1-bit sliding window protocol (Stop-and-Wait ARQ)
• It uses max window size 1 and
stop and wait technique.
• Operation of this protocol based
on ARQ (automatic repeat request).
• Sender sends 1 frame & wait for
acknowledgement from receiver.
• If receives ACK sends next frame.
• If receives NAK resend same frame
• Features:
1. Sender stores last copy of sent frame till ack received for frame.
2. Data & frame numbered 0&1 alternately as frame 0 send and frame is
acknowledge by ACK1 so that next frame sender can send.
3. If error occurs in transmission, receiver sends NAK frame to sender
for retransmission and it has no number so last frame sent
4. Timer take care for ACK, if not receive in time then resend last frame
1-bit sliding window protocol (Stop-and-Wait ARQ)
• Fig shows normal operation means
sender sending data frame and
receiver processing it and reply with
ACK frame with no. indicating sender
to send next frame.
• When is the retransmission necessary
1. If Received frame is damaged.
2. If Transmitted frame is lost.
3. If ACK from receiver is lost
Go-Back-N ARQ

• In this method the inefficiency of stop and wait overcome


by allowing transmitter to continue sending enough
frames so that channel kept busy while transmitter waits
for Ack.
• If one frame is damaged or lost all frames are sent since
the last frame acknowledged are retransmitted.
Go-Back-N ARQ

Although t

• When is the retransmission necessary


1.If Received frame is damaged.
2.If Transmitted frame is lost.
3.If ACK from receiver is lost
Go-Back-N ARQ
Selective Repeat ARQ
• In this method only damaged or lost frame is retransmitted.
• Selective repeat system differs from go-back-n in as
1. Receiver can do sorting of data frames and is also able to
store frames received after it has sent NAK until the damaged
frame has been replaced.
2. Sender has a searching mechanism that allows it to choose
only those frame which are requested for retransmission.
3. Window size in this method is less than or equal to(n+1)/2
•Sender doesn’t wait for ACK
for transmission of next
frame, continuously sending
frame till it receives NAK.
•So it detects error in received
frame & send only that frame

You might also like