NETWORK ACCESS LAYER
Error Detection and Correction
Abdulkadir Hassen (Capt)
(Lecturer, Senior System and Network
Administrator ICT)
POSITION OF THE DATA-LINK LAYER
Slide
2
Data Comm & Networking
ERROR DETECTION AND CORRECTION
Data can be corrupted during transmission.
Some applications require that errors be detected
and corrected.
Error Detection and Correction are implemented
at the data link layer and the transport layer of the
internet model
Slide
3
Data Comm & Networking
DATA LINK LAYER
Slide
4
Data Comm & Networking
ERROR DETECTION AND CORRECTION
Data can be corrupted during transmission. For
reliable communication, error must be detected and
corrected
Error Detection and Correction are implemented
either at the data link layer or the transport layer of
the OSI model
Slide
5
Data Comm & Networking
TYPE OF ERRORS
Slide
6
Data Comm & Networking
TYPE OF ERROR’S
Single-Bit Error
In a single-bit error, only 1 bit in the data unit has
changed.
Slide
7
Data Comm & Networking
TYPE OF ERRORS(CONT’D)
Burst-Bit Error
A burst error means that 2 or more bits in the data unit
have changed.
The length of the burst is measured from the 1st
corrupted bit to the last corrupted bit.
Some bits in between may not have been corrupted. Slide
8
Data Comm & Networking
ERROR DETECTION VS CORRECTION
Error detection
looking only to see if any error has occurred.
Error correction
Need to know the exact number of bits that are
corrupted and more importantly, their location in the
message.
The correction of errors is more difficult than the
detection.
Slide
9
Data Comm & Networking
FORWARD ERROR CORRECTION VS RETRANSMISSION
Forward Error Correction
is the process in which the receiver tries to guess the
message by using redundant bits.
Retransmission
is a technique in which the receiver detects the
occurrence of an error and asks the sender to resend the
message.
Slide
10
Data Comm & Networking
REDUNDANCY
The central concept in detecting or correcting errors
is Redundancy.
Instead of repeating the entire data stream, a
shorter group of bits may be appended to the end of
each unit. → This technique is called Redundancy.
These extra bits are discarded as soon as the accuracy of
the transmission has been determined.
To detect or correct errors, we need to send
extra (redundant) bits with data.
Data Comm & Networking
BLOCK CODING - ERROR DETECTION
In block coding, we divide our message into blocks, each of k
bits, called datawords. We add r redundant bits to each block
to make the length n = k + r. The resulting n-bit blocks are
called codewords.
If the following two conditions are met, the receiver
can detect a change in the original codeword.
The receiver has (or can find) a list of valid codewords.
The original codeword has changed to an invalid one.
Slide
12
Data Comm & Networking
DETECTION - REDUNDANCY CHECK
Slide
13
Data Comm & Networking
DETECTION
Detection methods
VRC(Vertical Redundancy Check)
LRC(Longitudinal Redundancy)
CRC(Cyclic redundancy Check)
Checksum
Slide
14
Data Comm & Networking
DETECTION(CONT’D)
VRC(Vertical Redundancy Check)
A parity bit is added to every data unit so that the
total number of 1s(including the parity bit)
becomes even for even-parity check or odd for
odd-parity check
VRC can detect all single-bit errors.
It can detect multiple-bit or burst errors only the
total number of errors is odd
Slide
15
Data Comm & Networking
DETECTION(CONT’D)
Even parity VRC concept
Slide
16
Data Comm & Networking
TWO-DIMENSIONAL PARITY CHECK CODE
In Two-dimensional parity-
check code, the data code is
organized in a table (rows
and columns).
In fig, the data to be sent, five
7bit bytes, are put in separate
rows.
For each row and each column,
1 parity-check bit is calculated.
The whole table is then sent to
the receiver, which finds the
syndrome for each row and
each column.
As Fig. shows, the two-
dimensional parity check can
detect up to three errors that Slide
occur anywhere in the table. 17
LINEAR BLOCK CODES - TWO-DIMENSIONAL PARITY CHECK
CODE
Two-dimensional parity-check code
Two-dimensional parity-check code
Data Comm & Networking
LINEAR BLOCK CODES - Two-dimensional parity Check Code
Figure Two-dimensional parity-check code
CYCLIC REDUNDANCY CHECK
A powerful way to detect errors in transmission is by
attaching a fixed number of digits to the lower (in
terms of significance) end of the data. These bits are
the Cyclic Redundancy Check (CRC) bits.
The well-known concept of integer division forms
the basis for the use of CRCs
Slide
20
Data Comm & Networking
CYCLIC REDUNDANCY CHECK
CRC(Cyclic Redundancy Check)
~ is based on binary division.
CRC must have 2 qualities
• It must have exactly one less bit
than the divisor
• Resulting bit sequence (Data+CRC)
exactly divisible by the divisor.
Data Comm & Networking
Cyclic Redundancy Check
CRC encoder and decoder
Data Comm & Networking
MODULO-2 ARITHMETIC
Adding 0+0=0 0+1=1 1+0=1 1+1=0
Subtracting 0-0=0 0-1=1 1-0=1 1-1=0
Figure XORing of two single bits or two words
Data Comm & Networking
Cyclic Redundancy Check
Division in CRC encoder
Data Comm & Networking
CRC CHECKER
Slide
25
Data Comm & Networking
Cyclic Redundancy Check
Figure Division in the CRC decoder for two cases
Data Comm & Networking
POLYNOMIAL
Polynomials
CRC generator(divisor) is most often represented not as
a string of 1s and 0s, but as an algebraic polynomial.
Data Comm & Networking
POLYNOMIAL
A polynomial representing a divisor
Data Comm & Networking
POLYNOMIAL
Standard polynomials
Data Comm & Networking
CRC ADVANTAGES
Advantages of Cyclic Codes
Cyclic codes have a very good performance in detecting
single-bit errors, double errors, an odd number of errors,
and burst errors.
They can easily be implemented in hardware and
software.
They are especially fast when implemented in hardware.
This has cyclic codes a good candidate for many
networks.
Slide
30
Data Comm & Networking
CHECKSUM
Like linear and cyclic codes, the checksum is based on
the concept of redundancy.
Several protocols still use the checksum for error
correction, although the tendency is to replace it
with a CRC.
Slide
31
Data Comm & Networking
CHECK SUM IDEA
Suppose our data is a list of five 4-bit numbers that
we want to send to a destination. In addition to
sending these numbers, we send the sum of the
numbers.
For example, if the set of numbers is (7, 11, 12, 0, 6),
we send (7, 11, 12, 0, 6, 36), where 36 is the sum of
the original numbers.
The receiver adds the five numbers and compares
the result with the sum. If the two are the same, the
receiver assumes no error, accepts the five numbers,
and discards the sum. Otherwise, there is an error
somewhere and the data are not accepted.
Slide
32
Data Comm & Networking
CHECKSUM IDEA
We can make the job of the receiver easier if we
send the negative (complement) of the sum, called
the checksum.
In this case, we send (7, 11, 12, 0, 6, −36). The
receiver can add all the numbers received (including
the checksum). If the result is 0, it assumes no error;
otherwise, there is an error.
Slide
33
Data Comm & Networking
ONE’S COMPLEMENT - CHECKSUM
In one’s Complement arithmetic, We can represent
unsigned numbers between 0 and 2n -1 using only n
bits.
If the number has more than n bits, the extra left most
bits need to be added to the n rightmost bits (wrapping).
A negative number can be represented by inverting all
bits (changing a 0 to a 1 and a 1 to a 0).
This is the same as subtracting the number from 2n -1.
Slide
34
Data Comm & Networking
One’s Complement - Checksum
Example
How can we represent the number 21 in one’s
complement arithmetic using only four bits?
Solution
• The number 21 in binary is 10101 (it needs
five bits).
• We can wrap the leftmost bit and add it to
the four rightmost bits.
• We have (0101 + 1) = 0110 or 6.
Data Comm & Networking
DETECTION-USING CHECKSUM
Example ( at a sender)
16 bits block 8 bits checksum
Original data : 10101001 00111001
1’s complement addition
10101001
00111001
--------------
11100010 Sum
00011101 Checksum
Sending bits
10101001 00111001 00011101 transmitting
Data Comm & Networking
DETECTION(CONT’D)
Example ( at a receiver)
No errors:
Received data : 10101001 00111001 00011101
8 bits sum
10101001
00111001
00011101
---------------
11111111 Sum
Complement of Sum
00000000 Complement : It means No error
Data Comm & Networking
INTERNET CHECKSUM
Checksum Generator
Data Comm & Networking