DJ5-2 Error detection and correction

Table of contents

1. Error detection and error correction technology

1. Sending node

2. Receiving node

3. Description

2. Error detection technology

1. One-bit parity check

2. Two-dimensional Odd parity check

3. Internet checksum method (review)

4. Cyclic redundancy detection CRC

5. Comparison of error detection methods


1. Error detection and error correction technology

The link layer provides both bit-level error detection and correction services. EDC is Error Detection and Correction bit.

① Bit-level error detection and correction

Refers to the detection and correction of bit impairments in link layer frames sent from one node to another physically connected adjacent node.

The main error detection techniques are: parity check, Internet checksum, and cyclic redundancy detection.

② Error detection is not 100% reliable

The more error-checking bits, the better the error detection and correction.

1. Sending node

  • Send the data D along with the additional error detection and correction bits EDC to the link.

The protection scope of error detection and correction covers all fields of data D. Data D includes not only datagrams passed down from the network layer to be transmitted through the link, but also link-level addressing information, sequence numbers and other fields in the link frame header.

2. Receiving node

Receive the bit sequence D' and EDC'.

The receiver judges whether D' is the same as the original D according to D' and EDC', that is, whether the transmission of D is correct.

  • Correct: Decapsulate the datagram and deliver it to the network layer.
  • Error: Perform error handling.

In case of a transmitted bit error (0→1, 1→0), D' and EDC' may differ from the transmitted D and EDC.


 

3. Description

① Error detection and correction technology cannot guarantee that the receiver can detect all bit errors.

That is, the receiver does not find out that there is a bit error, let alone know which bit has an error.

② Select an appropriate error detection scheme so that the probability of undetected occurrence is very small.

③ The better the error detection and error correction technology, the more complex and expensive it is.

2. Error detection technology

Three main error detection techniques

  • Parity: the most basic method.
  • Internet checksums: Commonly used at the transport layer.
  • Cyclic redundancy detection: commonly used in the link layer.

1. One-bit parity check

sender:

  • Append a parity bit after the information D (d bit) to be sent
  • Make the number of "1" odd (odd parity) or even (even parity)
  • Transmit together to send (d+1 bits)

receiver:

  • Detect the number of "1" in the received message (d+1 bits).
  • Even parity: An odd number of "1s" is found, and at least one bit error occurs (odd number of bit errors).
  • Odd parity: When an even number of "1"s are found, at least one bit is in error.

One-bit parity check can only detect odd number of bit errors, but not even number of bit errors, because even number of 0→1, 1→0 will cancel each other out.

Features:

  1. Any odd number of errors can be detected, but not any even number of errors.
  2. If the probability of bit error is small and errors occur independently, a one-bit parity check can meet the requirements.
  3. If the bit errors are grouped together in a "burst", there is a 50% probability that no errors will be detected in a frame.

A one-bit parity check can only detect errors, but cannot point out which bit has an error.

2. Two-dimensional Odd parity check

Basic idea:

  • Divide the information D (d bits) to be transmitted into i rows and j columns
  • Perform corresponding parity checks on each row and column of information
  • The error detection bits of the frame are finally composed of i+j+1 parity bits

Features:

  1. Single bit errors can be detected and corrected.
  2. Errors of any two bits in a packet can be detected but not corrected.

3. Internet checksum method (review)

sender:

  1. + pseudo-header;
  2. Cut data in units of 16 bits;
  3. sum and wrap all 16-bit integers;
  4. Perform bit-by-bit inversion on the obtained sum -- checksum;
  5. Put the checksum into the header of the message segment and send it together.

receiver:

The received information is summed in the same way as the sender.

  • All "1": the received data is error-free;
  • If there is "0": There is an error in the received data.

Features:

  • Small grouping overhead: because the checksum has fewer bits.
  • Weak error detection capability: applicable to the transport layer, error detection is implemented by software, and the inspection method is simple and fast.

Error detection at the link layer is implemented by dedicated hardware in the adapter, using a stronger CRC method.

4. Cyclic redundancy detection CRC

cyclic redundancy check 

CRC coding: polynomial coding, which regards the bit string to be sent as a polynomial whose coefficient is 0 or 1, and regards the operation of the bit string as a polynomial operation.

The specific generation process of the check code is as follows: Assuming that the sent information is expressed by the information polynomial C(X), and shifting C(x) to the left by R bits, it can be expressed as C(x)*2R, so that the right side of C(x) is The R bit will be vacated, which is where the checksum will be. The remainder obtained by dividing C(x)*2R by the generator polynomial G(x) is the check code.

Basic idea: the sender and the receiver jointly select a generator polynomial G (r+1 bits), the most significant bit is 1.

① sender

  • Add all 0 additional bits R(r) whose number of digits is G minus one to the back of data D to generate DR(d+r)
  • Use DR to remove G, replace the R with all 0s with the remainder, become a new R, and send it together

Since the final DR is the initial DR plus the remainder of the initial DR/G, the final DR is divisible by the generator polynomial G.

② Receiver

Use the received DR (d+r) to remove G:

  • The remainder is not 0: an error occurred in the transmission
  • The remainder is 0: the transmission is correct, remove the trailing r bits to get the required data D(r)

CRC example:

Note: In the process of division, instead of subtracting the following item from the above item, the two are XORed; if the number of digits is not enough, the quotient is 0, and if the number of digits is sufficient, the quotient is 1. CRC can only detect bit errors less than or equal to r bits, but it can detect 100%.

5. Comparison of error detection methods

  • The parity check capability is the weakest, and the CRC check capability is the strongest.
  • Parity is often used for simple serial communication.
  • Internet checksums are typically used at the network layer and above, requiring simple and fast software implementations.
  • CRC is usually applied at the link layer and is usually implemented by the adapter's hardware.

Guess you like

Origin blog.csdn.net/m0_64140451/article/details/130672988