Digital Signal Processing Reference
In-Depth Information
this operation must always be zero; any other result indicates that transmission errors
have occurred.
Due to the simplicity of the algorithm, LRCs can be calculated very simply and
quickly. However, LRCs are not very reliable because it is possible for multiple errors
to cancel each other out, and the check cannot detect whether bytes have been trans-
posed within a data block (Rankl and Effing, 1996). LRCs are primarily used for the
rapid checking of very small data blocks (e.g. 32 byte).
7.1.3 CRC procedure
The CRC (cyclic redundancy check) procedure was originally used in disk drives, and
can generate a checksum that is reliable enough even for large data quantities. However,
it is also excellently suited for error recognition in data transfer via wire-bound (tele-
phone) or wireless interfaces (radio, RFID). The CRC procedure represents a highly
reliable method of recognising transmission errors, although it cannot correct errors.
As the name suggests, the calculation of the CRC is a cyclic procedure. Thus the
calculation of a CRC value incorporates the CRC value of the data byte to be calculated
plus the CRC values of all previous data bytes. Each individual byte in a data block
is checked to obtain the CRC value for the data block as a whole.
Mathematically speaking, a CRC checksum is calculated by the division of a polyno-
mial using a so-called generator polynomial . The CRC value is the remainder obtained
from this division. To illustrate this operation we have calculated a 4-bit CRC sum
for a data block. The first byte of the data block is 7Fh, the generator polynomial is
x 4
10011 (Figure 7.4).
To calculate a 4-bit CRC, we first shift the data byte four positions to the left
(eight positions for CRC 8, etc.). The four positions that become free are occupied by
the starting value of the CRC calculation. In the example this is 00h. The generator
polynomial is now gated with the data byte by a repeated XOR operation in accordance
with the following rule: 'The highest value bit of the data byte is XOR logic gated
with the generator polynomial. The initial zeros of the intermediate result are deleted
and filled from the right with positions from the data byte or starting value, in order to
carry out a new XOR gating with the generator polynomial. This operation is repeated
until a 4 position remainder is left. This remainder is the CRC value for the data byte.'
+
x
+
1
=
F7h
0000
Starting value
11110111
XOR 10011
011011
XOR 10011
010001
XOR 10011
00010100
XOR 10011
0011100
XOR 10011
1111
Figure 7.4 Step-by-step calculation of a CRC checksum
 
Search WWH ::




Custom Search