Hello,
I'm trying to implement a CRC32 check on a byte array and get the same result obtained by ZLIB CRC32 (and bin2ascii and https://crccalc.com/, etc) check with no success.
On the MSP432E401Y side I'm using SYSCTL_PERIPH_CCM0 for the CRC32 calculation. After correct initialization, I'm setting up, what seam to me the correct parameters for the test I've made with ZLIB:
MAP_CRCConfigSet(CCM0_BASE, (CRC_CFG_INIT_1 | CRC_CFG_TYPE_P4C11DB7 | CRC_CFG_SIZE_32BIT));
CRC_CFG_INIT_1 --> Init 0xFFFFFFFF
CRC_CFG_TYPE_P4C11DB7 --> Poly 0x04C11DB7
CRC_CFG_SIZE_32BIT -> Using 32bit as input data.
I've also tried all the parameters available on MSP432E4 DriverLib API Guide to no avail.
I have no ideia what am I doing wrong (or not right). Appreciate any help I can get. Thank you.
CODE:
uint32_t data[] = { 0x00, 0x00, 0x00, 0x00 }; \\ I know this one should not work.
uint32_t data1[] = { 0x00000000 };
uint32_t data2 = 0x00000000;
int main(void)
{
uint32_t ui32Result, ui32Errors;
// Run from the PLL at 120 MHz.
MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480),
120000000);
PinoutSet(false, false);
ui32Errors = 0;
ConfigureUART();
//UARTprintf("\033[2J\033[H");
UARTprintf("\n");
UARTprintf("Starting CRC-32 demo.\n");
// Initialize the CRC and CCM modules.
if (!CRCInit())
{
UARTprintf("Initialization of the CRC module failed.\n");
ui32Errors |= 0x00000001;
}
MAP_SysCtlPeripheralReset(SYSCTL_PERIPH_CCM0);
while (!MAP_SysCtlPeripheralReady(SYSCTL_PERIPH_CCM0))
{
}
// Configure the CRC engine.
MAP_CRCConfigSet(CCM0_BASE,
(CRC_CFG_INIT_1 | CRC_CFG_TYPE_P4C11DB7 | CRC_CFG_SIZE_32BIT ));
ui32Result = MAP_CRCDataProcess(CCM0_BASE,data,(sizeof(data)/4),true);
UARTprintf("CRC result data[]: 0x%08x\n", ui32Result);
ui32Result ^= 0xFFFFFFFF;
UARTprintf("CRC result data[] with XOR: 0x%08x\n", ui32Result);
UARTprintf("#################################################\n");
ui32Result = MAP_CRCDataProcess(CCM0_BASE,data1,(sizeof(data1)/4),true);
UARTprintf("CRC result data1[]: 0x%08x\n", ui32Result);
ui32Result ^= 0xFFFFFFFF;
UARTprintf("CRC result data1[] with XOR: 0x%08x\n", ui32Result);
UARTprintf("#################################################\n");
ui32Result = MAP_CRCDataProcess(CCM0_BASE,&data2,1,true);
UARTprintf("CRC result data2: 0x%08x\n", ui32Result);
ui32Result ^= 0xFFFFFFFF;
UARTprintf("CRC result data2 with XOR: 0x%08x\n", ui32Result);
while (1)
{
}
}Output:
Starting CRC-32 demo.
CRC result data[]: 0x552d22c8
CRC result data[] with XOR: 0xaad2dd37
#################################################
CRC result data1[]: 0x4e26540f
CRC result data1[] with XOR: 0xb1d9abf0
#################################################
CRC result data2: 0xfbac7c3a
CRC result data2 with XOR: 0x045383c5
The expected result should be:
| Algorithm | Result | Check | Poly | Init | RefIn | RefOut | XorOut |
| CRC-32 | 0x2144DF1C | 0xCBF43926 | 0x04C11DB7 | 0xFFFFFFFF | true | true | 0xFFFFFFFF |
And I couldn't figure out yet what they meanin by RefIn and RefOut