Data Link Control Error Detection and Correction
Error Detection and Correction Data can be corrupted during transmission. For reliable communication, errors must be detected and corrected. Single-Bit Error In a single-bit error, only one bit in the data unit has changed. Burst Error A burst error means that 2 or more bits in the data unit have changed.
Error Detection and Correction Single-Bit Error In a single-bit error, only one bit in the data unit has changed.
Error Detection and Correction Burst Error A burst error means that 2 or more bits in the data unit have changed.
Error Detection and Correction Error detection uses the concept of redundancy, which means adding extra bits for detecting errors at the destination. Parity Check Cyclic Redundancy Check (CRC) Checksum
Error Detection and Correction Redundancy
Error Detection and Correction Parity Check Two-Dimensional Parity check Even-Parity check Odd-Parity check Even-Parity check concept In parity check, a parity bit is added to every data unit so that the total number of 1s is even (or odd for odd-parity).
Error Detection and Correction Even-Parity Check Concept
Error Detection and Correction Example of Even-Parity check Suppose the sender wants to send the word world. In ASCII the five characters are coded as 1110111 1101111 1110010 1101100 1100100 The following shows the actual bits sent 11101110 11011110 11100100 11011000 11001001
Error Detection and Correction Example of Even-Parity check – Receive No error Now suppose the word world in the last sample is received by the receiver without being corrupted in transmission. 11101110 11011110 11100100 11011000 11001001 The receiver counts the 1s in each character and comes up with even numbers (6, 6, 4, 4, 4). The data are accepted.
Error Detection and Correction Example of Even-Parity check – with errors Now suppose the word world in the last sample is corrupted during transmission. 11111110 11011110 11101100 11011000 11001001 The receiver counts the 1s in each character and comes up with even and odd numbers (7, 6, 5, 4, 4). The receiver knows that the data are corrupted, discards them, and asks for retransmission.
Error Detection and Correction Remark: Simple parity check can detect all single-bit errors. It can detect burst errors only if the total number of errors in each data unit is odd.
Error Detection and Correction Example of Even-Parity check – more than 1 errors 1110111 1101111 1110010 1101100 1100100 The following shows the actual bits errors 10101010 11010010 11100100 11011000 10011001
Error Detection and Correction Two-Dimensional parity
Error Detection and Correction Two-Dimensional parity – single bit error VRC 1 0 1 0 0 1 1 1 1 0 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 0 0 0 1 0 0 0 1 0 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1 LRC 1 2 3 4 5 6 Longitudinal Redundancy Check Vertical Redundancy Check
Error Detection and Correction Two-Dimensional parity – double bit error ข้อมูลเดิม คือ 1 0 1 1 0 1 1 VRC 1 0 1 0 1 1 1 1 1 0 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 0 0 0 1 0 0 0 1 0 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1 LRC 1 2 3 4 5 6 √ X พบข้อผิดพลาดจากการตรวจสอบ LRC
Error Detection and Correction Two-Dimensional parity – double bit error ข้อมูลเดิม คือ 1 0 1 1 0 1 1 VRC 1 1 0 1 0 1 1 0 0 0 1 1 0 1 1 1 1 1 0 0 0 1 0 0 0 1 0 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1 LRC 1 2 3 4 5 6 1 0 1 1 1 1 1 X
Error Detection and Correction Two-Dimensional parity – can not detect err. VRC 1 1 0 1 0 1 1 0 0 0 1 0 0 1 1 1 1 1 0 0 0 1 0 0 0 1 0 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1 LRC 1 2 3 4 5 6 1 0 1 1 0 1 1 1 0 0 1 1 1 1 0 0 1 1 1 0 1 √
Error Detection and Correction Cyclic Redundancy Check (CRC) Given a K-Bit Frame The Transmitter Generate an N-Bits sequence - FCS (Frame Check Sequence) K bits N bits FCS K + N bits The resulting frame consisting of k+n bits is Exactly divisible by some predetermined number
Error Detection and Correction Cyclic Redundancy Check (CRC)
Error Detection and Correction Cyclic Redundancy Check (CRC) คุณสมบัติตัวหาร (Divisor) ใช้หลักการของ XOR ในการคำนวณ Bit ซ้ายสุดและขวาสุดจะต้องเป็น 1 เสมอ จำนวนบิตจะต้องน้อยกว่าจำนวนบิตของข้อมูล data1 data2 XOR output 1
Error Detection and Correction Binary division in A CRC generator
Error Detection and Correction Binary division in CRC Checker
Error Detection and Correction A polynomial representing a divisor
Error Detection and Correction Sample of a polynomial representing #1 Data to be send is 1010001101 (10 bits) Divisor is 110101 แปลงเป็นโพลีโนเมียลได้ดังนี้ 1010001101 = X9+X7+X3+X2+1 110101 = X5 + X4 + X2 + 1
Error Detection and Correction Sample of a polynomial representing #2 Data to be send is 100100 (6 bits) Divisor is 1101 CRC 3 bits แปลงเป็นโพลีโนเมียลได้ดังนี้ 100100 = X5+X2 100100000 = X8+X5 1101 = X3 + X2 + 1
Error Detection and Correction Sample of a polynomial representing #3
Error Detection and Correction Sample of a polynomial representing #4 Data to be send is 100100 (6 bits) Divisor is 1101 CRC 3 bits แปลงเป็นโพลีโนเมียลได้ดังนี้ 100100 = X5+X2 100100000 = X8+X5 1101 = X3 + X2 + 1 ฉะนั้น CRC ที่ได้ = Remainder of (X8+X5)/(X3 + X2 + 1 ) Remainder = 1 CRC = 001 ดังนั้นข้อมูลทั้งหมดที่จะส่งคือ 100100001
Error Detection and Correction Sample of a polynomial representing #3
Error Detection and Correction Sample of a polynomial representing #5 ผู้รับตรวจสอบข้อมูลด้วยตัวหารชุดเดียวกัน Data received is 100100001 (9 bits) Divisor is 1101 100100001 = X8 + X5 + 1 1101 = X3 + X2 + 1 การตรวจสอบ = Result of (X8+X5+1)/(X3 + X2 + 1 ) Remainder = 0 เมื่อผลหารลงตัวโดยไม่เหลือเศษ สรุปได้ว่า ข้อมูลที่ส่งมานั้นถูกต้อง
Error Detection and Correction Standard Cyclic Redundancy Check Polynomials CRC Standard Polynomial Bit String Used CRC-12 X12 + X11 + X3 + X2 + 1 1100000001101 CRC-16 X16 + X15 + X2 + 1 11000000000000101 CRC-CCITT X16 + X12 + X5 + 1 10001000000100001 CRC-32 X32 + X26 + X23 + X22 + X16 + X12 + X11 + X10 + X8 + X7 + X5 + X4 + X2 + X + 1 10000010011000001 0001110110110111 ใช้ใน LAN IEEE 802
Error Detection and Correction Checksum The Sender follows these steps: The unit is divided into k sections, each of n bits. All sections are added using one’s complement to get the sum. The sum is complemented and becomes the checksum. The checksum is sent with the data
Error Detection and Correction Checksum The Receiver follows these steps: The unit is divided into k sections, each of n bits. All sections are added using one’s complement to get the sum. The sum is complemented. If the result is zero, the data are accepted: otherwise, rejected.
Error Detection and Correction Checksum
Error Detection and Correction Sample of Checksum - Sender Suppose the following block of 16 bits is to be sent using a checksum of 8 bits. 10101001 00111001 The numbers are added using one’s complement 1 0 1 0 1 0 0 1 0 0 1 1 1 0 0 1 Sum 1 1 1 0 0 0 1 0 Checksum 0 0 0 1 1 1 0 1 The pattern sent is 10101001 00111001 00011101
Error Detection and Correction Sample of Checksum - Receiver Now suppose the receiver receives the pattern sent is no error. When the receiver adds the three sections, it will get all 1s, which, after complementing, is all 0s and shows that there is no error. 10101001 00111001 00011101 Sum 11111111 Complement 00000000 means that the pattern is OK. 10101001 00111001 00011101
Error Detection and Correction Sample of Checksum – Received with errors Now suppose there is a burst error of length 5 that affects 4 bits. (10101001 00111001 00011101) 10101111 11111001 00011101 When the receiver adds the three sections, it gets 10101111 11111001 00011101 Partial Sum 1 11000101 Carry 1 Sum 11000110 Complement 00111001 the pattern is corrupted.
Error Detection and Correction Sample of Checksum - Sender What is the checksum value for the extended ASCII message “Help!” ? 01001000 H 01100101 e 01101100 l 01110000 p 00100001 ! 10101011 (Sum) 01010100 (Checksum – one’s complement) 01001000 01100101 01101100 01110000 00100001 01010100
Error Detection and Correction Sample of Checksum - Receiver 01001000 01100101 01101100 01110000 00100001 01010100 01001000 H 01100101 e 01101100 l 01110000 p 00100001 ! 01010100 (Checksum) 11111111 (sum) 00000000 (One’s complement) 10101101 10001010 11011100 01110101 11111111
Error Detection and Correction การแก้ไขความผิดเพี้ยนของข้อมูล ประกอบด้วย 2 แนวทางคือ Forward Error Correction แก้ไขแบบไม่ส่งข้อมูลซ้ำ โดยที่ผู้รับสามารถแก้ไขข้อมูลที่ผิดได้เอง Retransmission แก้ไขแบบส่งข้อมูลซ้ำ ผู้ส่งจะทำการส่งข้อมูลที่ถูกต้องมาให้ใหม่ อีกครั้ง
Error Detection and Correction Forward Error Correction วิธีการแก้ไขข้อมูลแบบไม่ส่งซ้ำที่ได้รับความนิยมอย่างสูงได้แก่ การแก้ไขข้อมูลแบบแฮมมิ่ง (Hamming Code) คิดค้นโดย R.W. Hamming ซึ่งนำวิธีการแบบ Parity มาประยุกต์ให้มีความ เที่ยงตรงสูงขึ้น โดยการเพิ่ม bits ข้อมูลสำหรับควบคุมเข้าไปรวม กับตัวข้อมูล และการแก้ไขข้อมูลจะใช้แบบ Even Parity
Error Detection and Correction Hamming Code: Data and Redundancy bits Number of Data bits (K) Redundancy bits (R) Total Bits (K+R) 1 2 3 5 6 4 7 9 10 11
Error Detection and Correction Position of Redundancy bits in Hamming Code:
Error Detection and Correction Redundancy bits Calculation:
Error Detection and Correction Sample of Redundancy bits Calculation:
Error Detection and Correction Error detection using Hamming Code: Normal Case 1 0 0 1 1 1 0 0 1 0 1 1 1 1 1
Error Detection and Correction Error detection using Hamming Code: 1 0 0 1 1 1 0 0 1 0 1
Questions & Answers Q&A