Skip to main content
Visitor II
December 17, 2025
Question

STM32U5 CRC init parameters

  • December 17, 2025
  • 1 reply
  • 155 views

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?

    This topic has been closed for replies.

    1 reply

    Super User
    December 17, 2025

    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.