I am trying to understand how the cyclic redundancy check (CRC) algorithm from the Controller Area Network (CAN) specification works. Here is the pseudocode.
CRC_RG = 0; // initialize shift register
CRCNXT = NXTBIT EXOR CRC_RG(14);
CRC_RG(14:1) = CRC_RG(13:0); // shift left by
CRC_RG(0) = 0; // 1 position
IF CRCNXT THEN
CRC_RG(14:0) = CRC_RG(14:0) EXOR (4599hex);
UNTIL (CRC SEQUENCE starts or there is an ERROR condition)
I do understand the standard algorithms but not the CAN algorithm. I have calculated it by hand and programmed it and it works fine. I just don't understand why/how it works.