cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U5 CRC init parameters

adegrandcourt
Associate

Hello,

I would like to calculate a CRC-16/IBM-SDLC.

adegrandcourt_0-1765966006369.png

I configure the CRC_HandleTypeDef structure as below for HAL_CRC_Init function:

h->Init.DefaultPolynomialUse = DEFAULT_POLYNOMIAL_DISABLE;
h->Init.DefaultInitValueUse = DEFAULT_INIT_VALUE_DISABLE;
h->Init.GeneratingPolynomial = 0x00001021U;
h->Init.CRCLength = CRC_POLYLENGTH_16B;
h->Init.InitValue = 0x0000FFFFU;
h->Init.InputDataInversionMode = CRC_INPUTDATA_INVERSION_BYTE;
h->Init.OutputDataInversionMode = CRC_OUTPUTDATA_INVERSION_ENABLE;
h->InputDataFormat = CRC_INPUTDATA_FORMAT_BYTES;

But it seems that the parameters 'InputDataInversionMode' and 'OutputDataInversionMode' have no effect because I get 0xA60C as result for input 0x11 0x22 0x33 0x44 what it is matching with CRC-16/GENIBUS.

Someone could be help me to understand the issue?

1 REPLY 1
TDK
Super User

Show your code.

 

If you're feeding in bytes (and not half-words or words) then InputDataInversionMode has no effect.

TDK_0-1765984007070.png

 

OutputDataInversionMode should have an effect.

If you feel a post has answered your question, please click "Accept as Solution".