Error Detection and Correction
Error Detection and Correction
Tx
DATA
frame
Rx
data out
Tx
DATA
frame
Rx
Most errors are signicant must be detected If only detect errors Reverse Error Correction (REC) must ask for retransmission ARQ protocol unsuited to real-time applications unsuited to simplex communication If detect and correct errors Forward Error Correction (FEC)
Tx
Rx
Send data twice Rx delivers data if two copies identical and generates ACK-frame Rx sends NAK-frame if two copies differ
data out
Tx
Rx
data out
Tx
Rx
6
Send A
?
0 0 0
Tx
Rx
. . . H1 mn1 H2
H1
mn H2
10
Hamming Distance
b1 6 10 11
00 111
01 - b0
101 > b2
HD is number of bits between codewords e.g. 0002 is HD of two from 0112 , 1012 , and 1102 Error detection/correction based on HD between valid codewords
11
One bit error will change valid codeword to invalid codeword Two bit error will change valid codeword into different valid codeword
12
One bit error will change valid codeword to invalid codeword invalid code HD of one from only one valid codeword Two bit error will change valid codeword to invalid codeword
13
14
HD = e + 1 To reliably detect and correct up to e bits in error bits in error must be less than halfway of HD e= HD 1 2
HD = 2e + 1
15
Parity Bits
modulo arithmetic no carry 0 +2 0 = 0 r = m0 +2 . . . +2 m6 1 +2 0 = 1 0 +2 1 = 1 ASCII X (10110002 ) 1 1 0 1 1 0 0 0 1 +2 1 = 0
codeword r m6 m5 m4 m3 m2 m1 m0
16
Parity Bits
codeword r m6 m5 m4 m3 m2 m1 m0
r = m0 +2 . . . +2 m6
ASCII X (10110002 ) 1 1 0 1 1 0 1 1 0 0 1 0 0 0 0 0
17
Parity Bits
codeword r m6 m5 m4 m3 m2 m1 m0
r = m0 +2 . . . +2 m6
ASCII X (10110002 ) 1 1 0 1 1 0 1 1 0 1 1 0 0 0 1 0
18
Parity Bits
codeword r m6 m5 m4 m3 m2 m1 m0
r = m0 +2 . . . +2 m6
ASCII X (10110002 ) 1 1 0 0 1 0 1 1 0 1 1 0 0 0 0 0
19
Dont need to know which bit is redundant bit Implements HD=2 reliably detects one bit errors
20
1111
1010
1000
1011
1100
1001
2. If 1000 is to be a valid codeword, shade codewords which maintain HD=2. 3. What type of parity do codewords have? 4. If 1010 was received, with single bit, what codewords might have been sent? 5. How bit errors can parity check detect, and how many can it correct?
21
Parity only detects one bit errors Improve by adding BCC at end, doing column-wise parity
22
BCC defeated by four bits in error HD=4 detect three bit errors detect and correct one bit errors
23
Smallest burst with four bit square is ten bits remember, not all bits in a burst need be in error, just the rst and last BCC copes with 9 bit bursts
24
Hamming Code
b12 20 21 22 23 m8 X 0
b11
b10
b9
b8
b7
b6
b5
b4
b3
b2
b1
m7 1
m6 0
m5 1
r4 ?
m4 1
m3 0
m2 0
r3 ?
m1 0
r2 ?
r1 ?
Each bit position bn where n = 2x used for redundancy bit Parity generated on all bits bm where m has x bit set
25
26
b12 20 21 22 23 m8 X 0
b11 1
b10
b9 1
b8
b7 1
b6
b5 0
b4
b3 0
b2
b1 ?
m7 1
m6 0
m5 1
r4 ?
m4 1
m3 0
m2 0
r3 ?
m1 0
r2 ?
r1 ?
The value of r1 is the even parity for all bn where n has b1 = 1 Thus r1 = 1
27
b12 20 21 22 23 m8 X 0
b11
b10
b9
b8
b7
b6
b5
b4
b3
b2
b1
m7 1
m6 0
m5 1
r4 ?
m4 1
m3 0
m2 0
r3 ?
m1 0
r2 ?
r1 1
The value of r2 is the even parity for all bn where n has b2 = 1 Thus r2 = 0
28
b12 20 21 22 23 m8 X 0 0
b11
b10
b9
b8
b7
b6
b5
b4
b3
b2
b1
m7 1
m6 0
m5 1
r4 ?
m4 1
m3 0
m2 0
r3 ?
m1 0
r2 0
r1 1
The value of r3 is the even parity for all bn where n has b3 = 1 Thus r3 = 1
29
Hamming Code
b12 20 21 22 23 0 0 m8 X 0
b11 1 1
b10 0
b9 1
b8
b7 1 1 1
b6 0 0
b5 0
b4
b3 0 0
b2 0
b1 1
1 m7 1
0 m6 0
1 m5 1
0 r4 0 m4 1 m3 0 m2 0 r3 1 m1 0 r2 0 r1 1
Each bit position bn where n = 2x use for redundancy bit Parity generated on all bits bm where m has x bit set
30
b12 20 21 22 23 0 0 m8 X 0
b11 1 1
b10 0
b9 1
b8
b7 1 1 1
b6 1 1
b5 0
b4
b3 0 0
b2 0
b1 1
1 m7 1
0 m6 0
1 m5 1
0 r4 0 m4 1 m3 1 m2 0 r3 1 m1 0 r2 0 r1 1
Parity checks failing points to error HD=3 detect and correct one bit errors
31
1. Write message 11101110 into the message bit boxes above. 2. Compute using even parity the bits r4 r3 r2 r1 3. Invert message bit m6 , and write down in the order r4 r3 r2 r1 a 1 if rn parity is now incorrect, or a 0 if correct. 4. Invert the bit position in the codeword which the number represents.
32
33
245 161 1 84
First error pattern not detected = 16110 = 101000012 Second error pattern not detected = 32210 = 1010000102
34
X 16 + X 15 + X 2 + 1 11000000000000101 USB
CRC-CCITT X 16 + X 12 + X 5 + 1 10001000000100001 Bluetooth Choosing values for polynomials need care to achieve the best performance. Those above detect: error bursts of 16 bits all error bursts with an odd number of bits 99.997% of 17 bit errors 99.998% of 18 or longer bit errors
35
36
Error Bursts
message1 +redundant1 = n1 n1 n1 n1 n1 5 4 3 2 1 message2 +redundant2 = n2 n2 n2 n2 n2 5 4 3 2 1 message3 +redundant3 = n3 n3 n3 n3 n3 5 4 3 2 1 message4 +redundant4 = n4 n4 n4 n4 n4 5 4 3 2 1 transmitted data interleaves codewords
. . . n1 n4 n3 n2 n1 n4 n3 n2 n1 3 2 2 2 2 1 1 1 1
If basic error checking can detect B bit bursts, interleaving N codewords allows N B bursts to be detected