Slua 363
Slua 363
ABSTRACT
Certain Texas Instruments (TI) products such as the 1K-bits EPROM bq2022, the
battery monitor bq2023, and the security IC bq26150 require the host to be able to
calculate a cyclic redundancy check (CRC) based on a specific polynomial. The
purpose of this document is to briefly discuss what a CRC is, how it is used within the
mentioned TI products, and how to implement it within a system that interacts with
these products.
Contents
1 What is CRC? ....................................................................................... 1
2 CRC Used as a Data Verifier ..................................................................... 1
3 CRC Used as an Encryption Scheme ........................................................... 2
4 CRC Calculation Example ......................................................................... 2
List of Tables
1 Coefficients for Example Polynomial ............................................................. 2
2 Example of CRC Calculation ...................................................................... 3
1 What is CRC?
The cyclic redundancy check (CRC) calculation is a form of polynomial modulo 2 arithmetic. The CRC is
typically used as a calculation that returns a checksum based on a block of data and a set polynomial with
binary coefficients. It is useful for error detection during data transmission.
Once the polynomial is determined, the CRC seed must be identified. A seed value of 0x00 is used in this
example. This corresponds with the CRC operation of a bq2022 or bq2023. Remember that in bq26150,
this value is chosen by the user when programming it into the one-time-programmable memory of the
device.
The last thing needed to begin calculating the CRC is the data that will actually pass through the CRC.
The data for this example is 0x0F.
• Compare the least significant byte (LSB) of the CRC with the LSB of data.
• If they are not equal, then shift both values to the right and then add (bit-wise XOR) the polynomial
coefficient to the CRC after being shifted.
• If they are equal, only shift right CRC and data.
• Repeat procedure until 8 sets of LSB bits have been compared.
• The last CRC value is the final solution.
These steps can be followed while verifying with Table 2. The final result of the CRC is 0x41. If another
byte of data were to be pushed through the CRC, then the procedure done in Table 2 would be repeated,
substituting 0x41 as the CRC seed. When calculating larger CRCs such as a 16-bit CRC, the table is
adjusted so that all 16 coefficients of the polynomial are considered.
Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications,
enhancements, improvements, and other changes to its products and services at any time and to discontinue
any product or service without notice. Customers should obtain the latest relevant information before placing
orders and should verify that such information is current and complete. All products are sold subject to TI’s terms
and conditions of sale supplied at the time of order acknowledgment.
TI warrants performance of its hardware products to the specifications applicable at the time of sale in
accordance with TI’s standard warranty. Testing and other quality control techniques are used to the extent TI
deems necessary to support this warranty. Except where mandated by government requirements, testing of all
parameters of each product is not necessarily performed.
TI assumes no liability for applications assistance or customer product design. Customers are responsible for
their products and applications using TI components. To minimize the risks associated with customer products
and applications, customers should provide adequate design and operating safeguards.
TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right,
copyright, mask work right, or other TI intellectual property right relating to any combination, machine, or process
in which TI products or services are used. Information published by TI regarding third-party products or services
does not constitute a license from TI to use such products or services or a warranty or endorsement thereof.
Use of such information may require a license from a third party under the patents or other intellectual property
of the third party, or a license from TI under the patents or other intellectual property of TI.
Reproduction of information in TI data books or data sheets is permissible only if reproduction is without
alteration and is accompanied by all associated warranties, conditions, limitations, and notices. Reproduction
of this information with alteration is an unfair and deceptive business practice. TI is not responsible or liable for
such altered documentation.
Resale of TI products or services with statements different from or beyond the parameters stated by TI for that
product or service voids all express and any implied warranties for the associated TI product or service and
is an unfair and deceptive business practice. TI is not responsible or liable for any such statements.
Following are URLs where you can obtain information on other Texas Instruments products and application
solutions:
Products Applications
Amplifiers amplifier.ti.com Audio www.ti.com/audio
Data Converters dataconverter.ti.com Automotive www.ti.com/automotive
DSP dsp.ti.com Broadband www.ti.com/broadband
Interface interface.ti.com Digital Control www.ti.com/digitalcontrol
Logic logic.ti.com Military www.ti.com/military
Power Mgmt power.ti.com Optical Networking www.ti.com/opticalnetwork
Microcontrollers microcontroller.ti.com Security www.ti.com/security
Telephony www.ti.com/telephony
Video & Imaging www.ti.com/video
Wireless www.ti.com/wireless