Tool/software: Code Composer Studio
I am trying to use the CRC module to calculate the CRC-32 using the polynomial 0x4C11DB7 with EK-TM4C129EXL
I have tried several combinations of seed, bit reversal, endiannes etc. but so far I do not get the same results for the same input data.
//*****************************************************************************
//
// crc32.c - Simple CRC-32 demo
//
// Copyright (c) 2013-2017 Texas Instruments Incorporated. All rights reserved.
// Software License Agreement
//
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
//
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
//
// This is part of revision 2.1.4.178 of the EK-TM4C129EXL Firmware Package.
//
//*****************************************************************************
#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_ccm.h"
#include "inc/hw_memmap.h"
#include "driverlib/crc.h"
#include "driverlib/debug.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "driverlib/udma.h"
#include "drivers/pinout.h"
#include "utils/uartstdio.h"
//*****************************************************************************
//
//! \addtogroup example_list
//! <h1>CRC-32 Demo (crc32)</h1>
//!
//! Simple demo showing an CRC-32 operation using the CCM0 module.
//!
//
//*****************************************************************************
//*****************************************************************************
//
// Configuration defines.
//
//*****************************************************************************
uint32_t g_ui32Result;
//
// Random data for generating CRC.
//
uint32_t g_ui32RandomData[16] =
{
0x8a5f1b22, 0xcb935d29, 0xcc1ac092, 0x5dad8c9e,
0x6a83b39f, 0x8607dc60, 0xda0ba4d2, 0xf49b0fa2,
0xaf35d524, 0xffa8001d, 0xbcc931e8, 0x4a2c99ef,
0x7fa297ab, 0xab943bae, 0x07c61cc4, 0x47c8627d
};
int main(void)
{
// g_ui32Result=0;
//
// Enable the CRC module.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_CCM0);
//
// Wait for the CRC module to be ready.
//
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_CCM0))
{
}
//
// Configure the CRC module.
//
// CRCConfigSet(EC_BASE, CRC_CFG_INIT_SEED | CRC_CFG_TYPE_P4C11DB7 | CRC_CFG_SIZE_32BIT);
// CRCConfigSet(CCM0_BASE, CRC_CFG_INIT_SEED | CRC_CFG_RESINV | CRC_CFG_TYPE_P4C11DB7 |
// CRC_CFG_OBR | CRC_CFG_IBR | CRC_CFG_SIZE_32BIT);
// //
CRCConfigSet(CCM0_BASE, ( CRC_CFG_INIT_SEED | CRC_CFG_RESINV | CRC_CFG_TYPE_P4C11DB7 | CRC_CFG_OBR | CRC_CFG_IBR |
CRC_CFG_SIZE_32BIT));
// Set the seed value.This value is the start value for CRC operations. If this value is not written, then the residual seed from
// the previous operation is used as the starting value.
//
// CRCSeedSet(EC_BASE, 0x5a5a5a5a);
// CRCSeedSet(CCM0_BASE, 0x5a5a5a5a);
uint32_t seed = 0x5a5a5a5a;
CRCSeedSet(CCM0_BASE, seed);
//
// Process the data and get the result. The result should be
// 0x75fd6f5c.
//
//g_ui32Result = CRCDataProcess(EC_BASE, g_ui32RandomData, 16, false);
g_ui32Result = CRCDataProcess(CCM0_BASE, g_ui32RandomData, 16, false);
while(1);
}