Hello,
I used to to calculate CRC-32 with VCRC module on F283DD, and the parameters are set as follows.
VCRC parameter setup
| Poly | 0x04C11DB7 |
| seedValue | 0xFFFFFFFF |
| parity | Even |
| run function | CRC_run32BitPoly1Reflected(poly = 0x04c11db7) |
Specification of CRC-32
| Poly | 0x04C11DB7 |
| Size | 32 |
| Initial value | 0xFFFFFFFF |
| RefIn | True |
| RefOut | True |
| XorOut | 0xFFFFFFF |
Now I try to use the GCRC module to calculate CRC-32 on the CM. i have selected the most reasonable parameter settings (such as the code in the attachment file) according to multiple tests, but his calculation result still does not match the CRC value calculated by the CRC-32 specification.
/**
* main.c
*/
#include "cm.h"
uint32_t CRCResult1 = 0;
uint32_t CRCGolden = 0x880D622E; // calculate by CRC-32 calculator http://www.sunshine2k.de/coding/javascript/crc/crc_js.html
void main(void)
{
CM_init();
uint32_t poly = 0x4C11DB7;
uint32_t polysize = 32;
uint32_t endianness = GCRC_ENDIANNESS_BIG;
uint32_t dataType = GCRC_DATATYPE_8BIT;
bool bitRev = true;
uint32_t dataMask = 0;
GCRC_setDataType( GCRC_BASE, dataType );
GCRC_setDataEndianness( GCRC_BASE, endianness );
GCRC_setDataMask( GCRC_BASE, dataMask );
GCRC_enableBitReverse( GCRC_BASE, bitRev );
//
// Set Seed value
//
GCRC_setPolynomial( GCRC_BASE, 0x00000001, polysize );
GCRC_setSeedValue( GCRC_BASE, 0xFFFFFFFF );
GCRC_setPolynomial( GCRC_BASE, poly, polysize );
//
// Write data to the CRC engine
//
GCRC_writeData( GCRC_BASE, 0x11, GCRC_DATATYPE_8BIT );
GCRC_writeData( GCRC_BASE, 0x22, GCRC_DATATYPE_8BIT );
GCRC_writeData( GCRC_BASE, 0x33, GCRC_DATATYPE_8BIT );
GCRC_writeData( GCRC_BASE, 0x44, GCRC_DATATYPE_8BIT );
//
// Read the CRC result
//
CRCResult1 = GCRC_readResult(GCRC_BASE);
//
// Check for computed crc values
//
if((crcResult1 != crcGolden)
{
//
// Error. The computed crc does not match the golden value
//
__asm(" bkpt #0");
}
// IDLE loop. Just sit and loop forever (optional)
while( 1 ) {}
}
Note. The setting method of the seed refers to the conclusion CCS/TMS320F28388D: GCRC module seed issue
Are there any precautions for using GCRC that I have missed? Or can you give any suggestions on parameter settings?
thanks,
Jim