This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PGA411-Q1: PGA411 CRC6 error

Part Number: PGA411-Q1

Hello,

I am using the code snippet below to calculate CRC6 for PGA411 SPI frame.

This is from TIDA-00796.

CRC6 calculated (as per TIDA-00796 snippet)for 0xAE0000  = 0x37.

As per table11 of data sheet  this value is: 0x11.

What could be wrong?

/* CRC6 calculation - optimized for PGA411 */
Uint16 pga411_crc2(Uint32 datin)
{
Uint16 byte_idx, bit_idx, crc = (CRC_INITSEED << 2);
/* byte by byte starting from most significant (3-2-1) */
for (byte_idx = CRC_BYTECOUNT; byte_idx >= 1; byte_idx--)
{
/* XOR-in new byte from left to right */
crc ^= ((datin >> (byte_idx << 3)) & 0x000000FF);
/* bit by bit for each byte */
for (bit_idx = 0; bit_idx < 8; bit_idx++)
{
crc = crc << 1 ^ (crc & 0x80 ? (CRC_POLYNOM << 2) : 0);
}
}
return (crc >> 2 & CRC_INITSEED); /*restore two bit offset */
}

best regards