AnsweredAssumed Answered

Duplicate x^8 + x^5 + x^4 + x^0 CRC with ST IP?

Question asked by Barta.Hank on Jan 12, 2017
Latest reply on Jan 12, 2017 by Clive One

This CRC is used by an I2C peripheral and documented at…  

Can this CRC be duplicated using the CRC IP on the STM32F7? The HAL library defaults to X^4 + X^2 + X^1 and I seem unable to change that (and it states that the exponents must be less than 8.) I tried substituting the code for the polynomial above (0x131) and the HAL initialization code rejected it.

Is this a shortcoming of the library or a limit of the H/W?


Code to init the CRC produced by Cube is:

/* CRC init function */
static void MX_CRC_Init(void)

hcrc.Instance = CRC;
hcrc.Init.DefaultPolynomialUse = DEFAULT_POLYNOMIAL_DISABLE;
hcrc.Init.DefaultInitValueUse = DEFAULT_INIT_VALUE_DISABLE;
hcrc.Init.GeneratingPolynomial = 0x7;
hcrc.Init.CRCLength = CRC_POLYLENGTH_8B;
hcrc.Init.InitValue = 65535;
hcrc.Init.InputDataInversionMode = CRC_INPUTDATA_INVERSION_NONE;
hcrc.Init.OutputDataInversionMode = CRC_OUTPUTDATA_INVERSION_DISABLE;
if (HAL_CRC_Init(&hcrc) != HAL_OK)



(Hmmm not sure I've got this code formatting thing right.)

(Hmmm.2 - two CRC posts in one day!)