SLUSDQ4 April 2019 BQ79606A-Q1
The CRC calculation by the transmitter is in bit-stream order across the entire transmission frame (except for the CRC). When determining bit-stream order for implementing the CRC algorithm, it is important to note that protocol bytes transmit serially, least-significant bit first. Figure 24 illustrates the bit-stream order concept.
The CRC (0x0000) is appended to the end of the bit-stream. This bit-stream is then initialized by XOR'ing with 0xFFFF to catch any leading 0 errors. This new bit-stream is then divided by the polynomial (0xC002) until only the 2 byte CRC remains. During this process, the most significant 17-bits of the bit stream are XOR’d with the polynomial. The leading zero’s of the result are removed and that result XOR’d with the polynomial once again. The process is repeated until only the 2 byte CRC remains. For example: