S32k148 crc 32 bit ethernet

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

S32k148 crc 32 bit ethernet

1,134 Views
att11
Contributor I

Hello,

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,
.writeTranspose = CRC_TRANSPOSE_BITS_AND_BYTES,
.readTranspose = CRC_TRANSPOSE_BITS_AND_BYTES,
.complementChecksum = false
};

//In Main

//Initialize

CLOCK_SYS_Init(g_clockManConfigsArr,CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr,CLOCK_MANAGER_CALLBACK_CNT);


CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);


PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);

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

//Defines

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);
result=CRC_DRV_GetCrc32(INST_CRC1,data,true,seed);

Parameters I have tried. 

pastedImage_1.png

Tool I am using to determine accuracy. 

https://crccalc.com/ 

pastedImage_3.png

Thank you for help

Andrew.

Tags (3)
0 Kudos
0 Replies