STM32G031F6 CRC calculate problem.
Hi everyone.
I am working on SMBus communication and i want to calculate PEC (packet error code) value. PEC value is using CRC-8 checksum with 0x07 polynomial. I want to use CRC peripheral in STM32G031F6 for PEC calculate. Cubemx settings are below.
And code is here;
CRC_Data[0] = 0x16;
CRC_Data[1] = 0x0f;
CRC_Data[2] = 0x17;
CRC_Data[3] = 0xe9;
CRC_Data[4] = 0x03;
SMBus_PEC = HAL_CRC_Calculate (&hcrc, CRC_Data, 5);SMBus_PEC value is 0x54 but this is wrong. It must be 0xE8. I am calculating with online CRC calculation from this site ==> https://www.lddgo.net/en/encrypt/crc
I read from the SMBus PEC value is also 0xE8. Also, when I calculate it manually, i get same value.
What is the problem?
Have a nice day.
