Texas Instruments | CRC Implementation (Rev. E) | Application notes | Texas Instruments CRC Implementation (Rev. E) Application notes

Texas Instruments CRC Implementation (Rev. E) Application notes
Design Note DN502
SWRA111E – November 2006 – Revised September 2018
CRC Implementation
ABSTRACT
This document is an overview of the CRC implementation for the CC430, CC1100, CC1100E, CC1101,
CC1110, CC1111, CC1150, CC2500, CC2510, CC2511, and CC2550. See Section 4 for links to the data
sheets and user's guides.
1
2
3
4
Contents
Abbreviations .................................................................................................................
CRC Implementation ........................................................................................................
Code Example................................................................................................................
References ...................................................................................................................
1
2
3
3
List of Figures
1
Normal Mode CRC .......................................................................................................... 2
2
CC2400 CRC ................................................................................................................. 2
Trademarks
All trademarks are the property of their respective owners.
1
Abbreviations
CRC
MSB
Cyclic redundancy check
Most significant bit
SWRA111E – November 2006 – Revised September 2018
Submit Documentation Feedback
Copyright © 2006–2018, Texas Instruments Incorporated
CRC Implementation
1
CRC Implementation
2
www.ti.com
CRC Implementation
CC2500, CC2510, CC2511, and CC2550 all support two CRC implementations:
• Normal mode CRC
• CC2400 CRC (only for backwards compability)
Bit 3 (CC2400_EN) in the PKTCTRL0 register is used to select which mode to use.
CC430, CC1100, CC1100E, CC1101, CC1110, CC1111, and CC1150 only support the normal mode
CRC, and hence bit 3 in the PKTCTRL0 register is not used on these devices.
In the normal mode (PKTCTRL0.CC2400_EN = 0), the CRC polynomial is CRC16 (x16 + x15 + x2 + 1) with
the CRC register reset to all ones. Figure 1 shows the shift register implementation. Note that the data
input is at x16.
Data input
(MSB first)
r15
r14
r13
r12
r11
r10
r9
r8
r7
r6
r4
r5
r3
r2
r1
r0
Figure 1. Normal Mode CRC
For backward compatibility, the CC2400 CRC implementation is also supported
(PKTCTRL0.CC2400_EN = 1). Figure 2 shows the shift register implementation. The data input is at x0.
When PKTCTRL0.CC2400_EN = 1, PKTCTRL0.WHITE_DATA and PKTCTRL1.CRC_AUTOFLUSH must
be 0.
Data input
(MSB first)
r15
r14
r13
r12
r11
r10
r9
r8
r7
r6
r5
r4
r3
r2
r1
r0
Figure 2. CC2400 CRC
CRC is calculated over all bytes transmitted after the sync word. The CRC16 checksum is automatically
transmitted after the last data byte. MSB is transmitted first.
See the device-specific data sheets for detailed use of the CRC functionality.
2
CRC Implementation
SWRA111E – November 2006 – Revised September 2018
Submit Documentation Feedback
Copyright © 2006–2018, Texas Instruments Incorporated
Code Example
www.ti.com
3
Code Example
#define
CRC16_POLY 0x8005
UINT16 culCalcCRC(BYTE crcData, UINT16 crcReg) {
UINT8 i;
for (i = 0; i < 8; i++) {
if (((crcReg & 0x8000) >> 8) ^ (crcData & 0x80))
crcReg = (crcReg << 1) ^ CRC16_POLY;
else
crcReg = (crcReg << 1);
crcData <<= 1;
}
return crcReg;
}// culCalcCRC
//---------------------------------------------------------------// Example of Usage
#define CRC_INIT 0xFFFF
UINT8 txBuffer = {0, 1, 2, 3, 4, 5};
UINT16 checksum;
UINT8 i;
checksum = CRC_INIT;
// Init value for CRC calculation
for (i = 0; i < sizeof(txBuffer); i++)
checksum = culCalcCRC(txBuffer[i], checksum);
4
References
1.
2.
3.
4.
5.
6.
7.
8.
9.
CC430 User's Guide
CC1100 Single-Chip Low Cost Low Power RF-Transceiver
CC1100E Low-Power Sub-GHz RF Transceiver (470-510 MHz & 950-960 MHz)
CC1101 Single-Chip Low Cost Low Power RF-Transceiver
CC1110Fx/CC1111Fx Low-Power Sub-1 GHz RF System-on-Chip (SoC) with MCU, Memory,
Transceiver, and USB Controller
CC1150 Single Chip Low Cost Low Power RF-Transmitter
CC2500 Single-Chip Low Cost Low Power RF-Transceiver
CC2510Fx/CC2511Fx Low-Power SoC (System-on-Chip) with MCU, Memory, 2.4 GHz RF
Transceiver, and USB Controller
CC2550 Low-Cost Low-Power 2.4 GHz RF Transmitter
SWRA111E – November 2006 – Revised September 2018
Submit Documentation Feedback
Copyright © 2006–2018, Texas Instruments Incorporated
CRC Implementation
3
Revision History
www.ti.com
Revision History
NOTE: Page numbers for previous revisions may differ from page numbers in the current version.
Changes from October 27, 2009 to September 27, 2018 ................................................................................................ Page
•
4
Formatting and editorial changes throughout document ............................................................................. 1
Revision History
SWRA111E – November 2006 – Revised September 2018
Submit Documentation Feedback
Copyright © 2006–2018, Texas Instruments Incorporated
IMPORTANT NOTICE AND DISCLAIMER
TI PROVIDES TECHNICAL AND RELIABILITY DATA (INCLUDING DATASHEETS), DESIGN RESOURCES (INCLUDING REFERENCE
DESIGNS), APPLICATION OR OTHER DESIGN ADVICE, WEB TOOLS, SAFETY INFORMATION, AND OTHER RESOURCES “AS IS”
AND WITH ALL FAULTS, AND DISCLAIMS ALL WARRANTIES, EXPRESS AND IMPLIED, INCLUDING WITHOUT LIMITATION ANY
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT OF THIRD
PARTY INTELLECTUAL PROPERTY RIGHTS.
These resources are intended for skilled developers designing with TI products. You are solely responsible for (1) selecting the appropriate
TI products for your application, (2) designing, validating and testing your application, and (3) ensuring your application meets applicable
standards, and any other safety, security, or other requirements. These resources are subject to change without notice. TI grants you
permission to use these resources only for development of an application that uses the TI products described in the resource. Other
reproduction and display of these resources is prohibited. No license is granted to any other TI intellectual property right or to any third
party intellectual property right. TI disclaims responsibility for, and you will fully indemnify TI and its representatives against, any claims,
damages, costs, losses, and liabilities arising out of your use of these resources.
TI’s products are provided subject to TI’s Terms of Sale (www.ti.com/legal/termsofsale.html) or other applicable terms available either on
ti.com or provided in conjunction with such TI products. TI’s provision of these resources does not expand or otherwise alter TI’s applicable
warranties or warranty disclaimers for TI products.
Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265
Copyright © 2018, Texas Instruments Incorporated
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertising