Title: Framing and Error Detection
1- Framing and Error Detection
2Last time Encoding NRZ
NRZ Encode 0s and 1s using two different
levels.
Problem 1 The signal is synchronous that is,
theres a reference clock marking the length of
each bit.
Problem 2 Separating 0s from 1s is not trivial.
3NRZI and Manchester Encoding
Clock recovery depends on transitions. To keep
clocks in sync, the more transitions the better
too few and clocks will drift.
NRZI Encode 1s using transitions 0s keep
current level.
Manchester XOR NRZ-encoded signal and clock.
4Summary
- NRZ Baseline wander and clock recovery are
problem. - NRZI 0s have no transitions and thus they wont
help with clock recovery. - Manchester Doubles the rate of transitions
making clock recovery easier, on the other hand,
it doubles the rate of transitions. Since there
are 2 transitions for every single bit, the
efficiency (information per unit of time) drops
by 50.
54B/5B Encoding
- Basic idea Insert extra bits into the stream to
break up long sequences of 0s and 1s. Doesnt
allow more than one leading 0 and no more than
two trailing 0s.
f
4 bits
5 bits
64B/5B Encoding
16 codes are left over and some can be used for
purposes other than encoding data. For
instance 11111 idle line 00000 dead
line 00100 halt 7 codes violate the one
leading 0, two trailing 0s rule.
7Framing
Problem description A sequence of bits is sent
from node A to node B over a point-to-point link.
The network adaptor on node B must recognize
exactly what set of bits constitutes a frame,
that is, it must determine where the frame begins
and ends.
8Byte-Oriented Protocols
- Underlying concept Treat frames as collections
of bytes (or - characters in a particular set).
- Sentinel approach
IBM BISYNC
sentinels (special characters)
Problem ETX may appear in the body of the
frame. Solution character-stuffing. Precede ETX
in the body with an escape character DLE. If DLE
occurs in the body, it is also escaped.
SYN start of frame SOH start of header STX
start of text ETX end of text
9Byte-Oriented Protocols (cont.)
Byte-Counting approach Instead of relying on a
special marker to indicate the end of the frame,
send a count value which reflects the length of
the body (number of bytes).
DECNET DDCMP
Question Can you see any additional problems
with these protocols?
Hint What happens in the sentinel approach if an
ETX is corrupted on transmission? What happens in
the byte-counting approach if the count is
corrupted?
Answer Framing errors back-to-back frames are
incorrectly received.
10Bit-Oriented Protocols
Underlying concept Treat frames as collections
of bits, that is, pay no regard to byte
boundaries.
HLDC (ISO)
Beginning sequence Ending sequence 01111110
Problem 01111110 may appear in the body of the
frame. Solution bit-stuffing. Sender side
111111 becomes 1111101. Receiver side if 11111
arrives and the next bit is 0, the 0 is removed
if the next bit is 1, then either (1) this is the
ending sequence, or (2) there was a transmission
error and the frame is discarded.
11Error Detection
Approaches 1) Send two copies of the message. 2)
Send a small number of redundant bits.
Two-dimensional parity
12The Internet Checksum Algorithm
Underlying concept Add up all the words to be
transmitted in a frame and send the result
(checksum) together with the frame.
- u_short
- cksum(u_short buf, int count)
-
- register u_long sum 0
- while (count--)
-
- sum buf
- if (sum 0xFFFF0000)
- /carry has occurred/
- sum 0xFFFF
- sum
-
-
- return (sum 0xFFFF)
-
Notes - count is a 16 bit value. - buf has been
padded with 0 to a multiple of 16 bits. - code
uses 1s complement arithmetic.
Question Any problems?
13Cyclic Redundancy Check
- Underlying concept A (n1) bit message, say is
represented by an n degree a polynomial M(x).
Example for 10011010 is -
- Send and receiver agree on a divisor polynomial
C(x) of degree k. - A (n1)-bit message is sent with additional k
bits, call this extended message P(x). We want to
make P(x) exactly divisible by C(x). - The receiver checks if the received message is
also exactly divisible by C(x). If it is not,
then with good probability an error occurred.