CRC 8 value on STM doesnt match online calculators

Viewed 275

So I've been trying to learn CRC and tried to implement the same on my STM32G070 nucleo board. After setting up all the required configuration I'm returned an unexpected value. The website I used to verify my values http://www.sunshine2k.de/coding/javascript/crc/crc_js.html My initial configuration was

Poly:0x31

Init:0xff

XOR: 00

no reflect on input and output

My configuration on the stm board are as per below

uint32_t crcCheck(uint32_t data)
{
    
    RCC->AHB1ENR                    |= (RCC_AHB1ENR_CRCEN);
    
    //RESET
    CRC->CR                             |= (CRC_CR_RESET);
    //8 BIT POLYNOMIAL
    CRC->CR                             |= (CRC_CR_POLYSIZE_1);
    CRC->POL                             = (0x31);
    CRC->INIT                            = (0xFF);
    CRC->DR                              = data;
    
    return CRC->DR;
}

for trial I provided 0x32 as input and got 0x0B from online calculator and 0x70 from my program which does not matches. However I noted something strange that when I keep the inital poly as 0X00, both of them gave me 0xA7 as an output. I've tried for a while but could not arrive on a conclusion for this behavior.

0 Answers
Related