CRC Error Detection Technology principle

Source: Internet
Author: User
Tags modulus

One, off-topic

Ashamed to say, the first thing to consider is to write about the CRC error-detecting technology in a deeper mathematical principle, but after looking at "Basic Algebra", I decisively abandoned this unrealistic idea. Personally think that is not because of my poor math level or poor ability, but the concept of postgraduate textbooks knowledge has a certain degree of coherence, it takes a lot of time to study. But I still find a book for CRC Technology, "Algebraic theory of Error correcting code"---Feng Keqin , friends who are interested in maths can also read the book in their spare time.

Use the domestic search engine to search for CRC error-checking technology articles or blogs, the content is basically the same, basically is to introduce how to modulo 2 operation. Write down this article, hoping to make up for the domestic so-called technical article part of the shortcomings. Of course, the main thing is to help themselves and the reader to improve.

Second, the Circulation Redundancy School Check Code source

CRC this abbreviation, in my opinion can have two kinds of understanding: one is cyclic redundancy check, that is, cyclic redundancy detection technology, the other is cyclic redundance code, that is, cyclic redundancy test code. In the computer network, basically all uses the former one, but I also have seen can understand the latter's statement.

The first time I came into contact with the CRC is the error detection section of the data link layer frame in the computer network textbook. The actual network communication link is not ideal, that is, in the network communication, the electromagnetic signal will be affected by the external electromagnetic wave or pulse interference, in the bit transmission process will appear bit error (a transmission error), so in order to ensure the reliability of computer network data transmission, in the network transmission of data, Error detection measures must be adopted.

In the process of computer network development, mathematics plays a vital role. When the communication experts helpless the error detection measures, the mathematicians in the team introduced the two element gamma Rovavic (GF (2)) in abstract algebra, which tells us that we can solve the problem of bit error detection by mathematical means. The rest of the situation only depends on your brain.

Third, the principle of cyclic redundancy school inspection

  The fifth edition of the computer network---Shehiren 's textbook The principle of cyclic redundancy testing is illustrated by the following examples:

On the sending side, the data is first divided into groups, assuming that each group of K-bits. The Data m=101001 (K=6) to be transmitted is now assumed. The CRC operation is to add an n-bit redundancy code for error detection after the data m, and then make a frame to send out, sending (k+n) bits altogether . After the data to be sent to increase the n-bit redundant code, although the cost of data transmission increases, but can be error detection. It is often worthwhile to pay such a price when there is a possibility of errors in the transmission.

This n-bit redundancy code can be obtained using the following methods. A binary modulo 2 operation is used to multiply M, which is equivalent to adding n 0 after M. The number of the obtained (K+N) bits divided by the pre-agreed length of the receiving and transmitting parties is (N+1) the divisor p, the quotient is Q and the remainder is R (n bit, one less than P). About divisor p is also described below. In the example shown in Figure 1, m=101001 (i.e., k=6). Assume the divisor p=1103 (that is, n=3). After the modulo 2 division operation, the result is: quotient q=110101 (this quotient is not useful), and the remainder r=001. This remainder R is sent out behind the data m as a redundant code stitching. This redundancy code, which is added for error checking, is often referred to as the frame check sequence FCS(frame checked Sequence). Therefore, after adding FCS, the frames sent are 101001001 (i.e.), with a common (k+n) bit.

Figure 1 Example of cyclic redundancy detection principle

By the way, the cyclic redundancy check CRC and the frame test sequence FCS are not the same concept. CRC is a method of error detection , and FCS is added to the data behind the redundant code , in the error-checking method can choose the CRC, but also can not use CRC.

In the receiving end of the received data in a frame for CRC test: Each received frame divided by the same divisor p (modulo 2 operation), and then check the resulting remainder R.

If there is no error in the transmission process, then the remainder R obtained after the CRC test is definitely 0. But if there is a bit of error, then the probability of the remainder r being equal to zero is very very small (can be calculated by a less complex probability).

In summary, the receiving end of each frame received after the CRC Test, there are the following two cases:

1) If the remainderof the r=0, then determine that the frame is not wrong , that is, accept (acceptance);

2) If the remainder r!=0, the frame is determined to be wrong , that is, discard (discard).

A more convenient method is to use a polynomial to represent the cyclic redundancy test process. In the above example, a polynomial is used to denote the above divisor p=1101 (the highest bit corresponds to, the lowest bit corresponds to). The polynomial P (X) is called the generative polynomial . There are several types of generated polynomial P (X) that are now widely used:

At the data link layer, the sending end frame test sequence FCS generation and the receiving side of the CRC Test are done with hardware, processing is very fast, and therefore does not delay the transmission of data.

  Summary:

 Summarize the contents of the above-mentioned textbook:

1) What is "modulo 2 operation"? in one example, I want to be able to form a clear concept in your mind. If a number k is removed by any number, the remainder must be in the [0,n] interval. i.e. x mod n∈[0, N). Modulo 2 operation is also in line with this theory, that is, modulo 2 operation means that the result can only be in the [0,2] interval to take integer values of the operation, obviously "modulo 2 operation" refers to the result can only be 0, 1 of the special binary operation . 2) Why "modulo 2 operation" belongs to the special binary operation, must highlight "special" two words? 1th, "modulo 2 operation" and "binary operation" name itself is different, so the analogy of the use of "special" two words, 2nd, the two operations are actually different, "modulo 2 operation" neither carry nor abdication, and "binary operations" and "decimal operations" are required to enter, abdication. 3) Cyclic redundancy test is just one of the mathematical error-checking techniques, as well as the mathematical methods such as parity-checking and even calibration. And the cyclic redundancy test does not guarantee that 100% is correct, can only say nearly 100%. 4) To create the application of the polynomial:Figure 2 PPP frame format Figure 3 Mac frame formatas can be seen from figures 2 and 3, CRC-16 is applied to PPP frames (16-bit Crc-ccitt for HDLC links) and CRC-32 to Mac frames. Moreover, CRC-32 is more reliable than CRC-16.

----------------------------------------------------------------------------------- The dividing line of God ------------ ------------------------------------------------------------------

This section is about the mathematical principle of CRC error-checking technology, and the reference article is GF (2)---wikipedia.

  GF (2) (also F2, z/2z or z2) is the GAlois Field of the elements. It is the smallest finite field.

Wikipedia gives the following definitions: GF (2) is a two element Galois domain and also the smallest finite field.

  

"Modulo 2 operation" analogy binary operation difference---No in, abdication is determined by the nature of GF (2) .

  

  Summary :

The modulo 2 operation is a special arithmetic, which is divided into modulo 2 operation, reduced modulus 2 operation, multiplicative modulus 2 operation, and modulo 2 operation.

Four, cyclic redundancy error detection technology combat

  

  The first analysis of the generation of the polynomial , obviously n=3, so the cyclic redundancy code should be 3-bit binary number. To generate a polynomial representing the binary divisor p=1001, the data sent is 101110, then the real dividend is 101110. The 2 operation (XOR operation) of the module is as follows:

Figure 4 Modulo 2 operation steps

So the FCS is 011, so the sending data is actually 101110011 (divided by 1001 to 0, the reader can try it by itself). Notice that, at the time of the operation, every time will be backward one, that is, the first person is eliminated each time.

V. The past confusion and reflection

When I first came into contact with the CRC detection technology in the computational network, there was a problem that plagued me because of the lack of experience and knowledge: If the NIC automatically adds FCS to the end of the frame when it sends the frame, how is the receiving end judged? The receiver does not know what the divisor p is for the sending end.

Now, in retrospect, the idea of questioning seems quite reasonable. For this problem, in fact, this article has given the answer to the question: in computer network communication, we have a unified standard for generating polynomial (divisor), that is, for different frames, send the end of the network card to add different FCS, and the receiving end network card to know the corresponding frame with CRC-16 or CRC-32 to check the wrong.

Problem solved, and then briefly talk about the CRC error detection technology after the harvest it. To tell the truth, before only the linear algebra, number theory and so on in the field of computer algorithms have a wide range of applications, did not think of the computer field has also used a group theory of this profound knowledge. Shakespeare has a famous saying: "The wise man always thinks he is a fool, but the fool always thinks he is very clever ". Then, continue to work in the study bar.

CRC Error Detection Technology principle

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.