S32k148 crc 32 bit ethernet

Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32k148 crc 32 bit ethernet

Contributor I


First off I am a beginner so I might be missing something here.

If you see something I am missing, please let me know because I am actively trying to learn.

I am starting to use CRC as well as the S32k148 SDK

I am having issues creating a configuration that is compatible with CRC 32 bit Ethernet or just common CRC 32 bit.

The polynomial for the CRC 32 I am talking about is  0x04C11DB7

I was successful in getting CRC 16 bit to work, however I am having issues with CRC 32 bit.

I notice when I have the default settings (no read/write transpose or XOR ) I get CRC 32 MPEG-2 rather then CRC-32 bit Ethernet.

The difference between them I found is that CRC-32 ethernet has a reflected in and reflected out data compared to MPEG-2. My assumption from the reading the data sheet is that this is the same as NXP's  transpose read and write.

Unfortunately when I implemented this it gave me a result that was incorrect. 

Since I was at a lost, I try all the different parameters given to me (checksum  read/write transpose etc.) and no results were correct for the basic crc-32 bit for Ethernet. 

Is there any other core function about CRC I am missing that it is not enabling me to get a basic 32 bit crc working?

I will have some of my code below.

//In CRC1 Config

//Config settings

crc_user_config_t crc1_InitConfig0 = {
.crcWidth = CRC_BITS_32,
.seed = 0xFFFFFFFFU,
.polynomial = 0x04C11DB7U,
.complementChecksum = false

//In Main




PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);

//CRC initialization 
CRC_DRV_Init(INST_CRC1, &crc1_InitConfig0);


volatile uint32_t output1;
uint32_t seed = 0xFFFFFFFFU;
uint32_t data = 0x12345678U;
volatile uint32_t result;

char data_set [10]= {'0','1','2','3','4','5','6','7','8','9'};

//CRC code calc
CRC_DRV_WriteData(INST_CRC1, data_set, 10);
output1= CRC_DRV_GetCrcResult(INST_CRC1);

Parameters I have tried. 


Tool I am using to determine accuracy. 



Thank you for help


Tags (3)
0 Kudos
0 Replies