Post Go back to editing

CRC Calculation - Unsure what method to use

Category: Hardware
Product Number: MAX22196

Comparing the results from the MAX22196 evaluation software CRC calculator - I don't get the same results as the version written here: https://www.analog.com/en/resources/app-notes/guidelines-to-implement-crc-programming-for-the-max14915-octal-industrial-highside-switch.html

This article is linked in the MAX22196 datasheet as a reference for how to implement the CRC.

Here's the write:

I translate this as the bits being sent as: 0b00000011, 0b11111111, which is 0x03ff, putting that in the software I get: 0x0D as the CRC, which is 0b1101, not 0b10010

Also, the datasheet says to send three 0 bits, and that matches the leftmost column on line 17 18 19, but I see a 1 bit being sent on line 18? Why?

Also, the article talks about "the two first MSB bits being treated as zero"- and the max22196 evaluation software also seems to assume those first two bits are zero, but this I believe is notably different from ignoring the first two bits rather than inputting them in as two zeros. The code does this, and the diagram in the article also seems to do this:

Also, the bitfield functions don't match up - on line 17 to 19 I see possible data, but for the MAX22196, it looks like it will always send zeros.

Could I get some guidance on what is correct specifically for the MAX22196?

  • Alright, I think I've found my answers.

    I believe the article doesn't match what the MAX22196 does, and it is as I suspected - the MAX22196 CRC sent on SDO is simply the same as you'd calculate for the SDI - but with the first two bits masked off.

    I.E.

    pub fn crc5_check(bytes: &[u8; 3]) -> bool {
        crc5_encode(&[bytes[0] & 0b00111111, bytes[1]]) == bytes[2]
    }
    

    This matches my logic analyzer traces.

    The code given in the article matches the expected results if you give it the two bytes you'd send for the MAX22196 and ignore the examples in the article.

  • Hi,

    You are right. When calculating the CRC on SDO, the first two bits are always considered as 0.

    The bit 17/18/19 are always 0, regardless it is the CRC on SDO or SDI.

    Thanks,

    Wei