Findest du in der SD-Spec. Genauer Part 1, Physical Layer, Kapitel 4.5.
Ist auch in der (kostenlosen) Simplified Specification.
"CRC7
The CRC7 check is used for all commands, for all responses except type
R3, and for the CSD and CID registers. The CRC7 is a 7-bit value and is
computed as follows:
Generator polynomial: G(x) = x7 + x3 + 1. M(x) = (first bit) * xn +
(second bit) * xn-1 +...+ (last bit) * x0 CRC[6...0] = Remainder [(M(x)
* x7)/G(x)]
The first bit is the most left bit of the corresponding bit string (of
the command, response, CID or CSD). The degree n of the polynomial is
the number of CRC protected bits decreased by one. The number of bits to
be protected is 40 for commands and responses (n = 39), and 120 for the
CSD and CID (n = 119).
CRC7 Examples
The CRC section of the command/response is bolded.
CMD0 (Argument=0) --> 01 000000 00000000000000000000000000000000
"1001010" 1
CMD17 (Argument=0) --> 01 010001 00000000000000000000000000000000
"0101010" 1 Response of CMD17 --> 00 010001
00000000000000000000100100000000 "0110011" 1
"
"CRC16
In the case of one DAT line usage, the CRC16 is used for payload
protection in block transfer mode. The CRC check sum is a 16-bit value
and is computed as follows:
Generator polynomial G(x) = x16 +x12 +x5 +1 M(x) = (first bit) * xn +
(second bit)* xn-1 +...+ (last bit) * x0 CRC[15...0] = Remainder [(M(x)
* x16)/G(x)]
The first bit is the first data bit of the corresponding block. The
degree n of the polynomial denotes the number of bits of the data block
decreased by one (e.g. n = 4095 for a block length of 512 bytes). The
generator polynomial G(x) is a standard CCITT polynomial. The code has a
minimal distance d=4 and is used for a payload length of up to 2048
Bytes (n <= 16383).
The same CRC16 method shall be used in single DAT line mode and in wide
bus mode. In wide bus mode, the CRC16 is done on each line separately."
"512 bytes with 0xFF data --> CRC16 = 0x7FA1"