I'm writing code for communicating with a TLD7002 for a development tool, and would like to ask a few questions concerning the calculation of the CRC sums. As the driver library is not yet available to me, I'm implementing basic access to the HSLI in the programming language I'm using.
The datasheet of the TLD7002-16ES specifies two types of CRC algorithms, a 3-bit CRC, and an 8-bit CRC.
1. Regarding the 3-bit CRC, in the software design training video there appears a step where the crc value is reflected (mirrored) after processing the first 5 bits:
/* get reflected CRC3 value */ crc = TLD7002_MIRROR_MID_CRC3[crc];
I cannot find this step in the datasheet on page 67, though — an extra step reflecting the crc value after the first 5 bits and the tail 8 bits is not mentioned there; is the datasheet correct regarding the calculation of the 3-bit CRC?
2. The CRC-8 is defined as using the generator polynomial "0x8e = x^8 +x^4 +x^3 +x^2 +1" from CRC-8-AUTOSAR and SAE J1850.
But, from my understanding, 0x8E — binary: (1)-1000-1110 — actually is not the same as x⁸ + x⁴ + x³ + x² + 1;
0x8E is the reversed — LSB-first — form of 0x71 (1)-0111-0001, which corresponds to the polynomial x⁸ + x⁶ + x⁵ + x⁴ + 1, and is a reciprocal form of the CRC-8-SAE polynomial 0x1D, but with similar properties:
So if the polynomial actually is 0x8E, then for calculating the CRC-8 of the safety byte the reversed, LSB first, algorithm would have to be used. Is this correct?
If yes, then it possibly also applies to the CRC-3, because two CRC sums used in the same HSLI frame are likely implemented in the same fashion. This could mean that the polynomial to be used when calculating the CRC-3 would be 0x6 ("reversed"), or 0x5 ("reversed reciprocal"), but not 0x3. Which one is actually used by the TLD7002-16ES?
The CRC-8 of SAEJ1850, by the way, also defines a final XOR step, where 0xFF is XOR'ed into the crc value. I suppose, since the datasheet of the TLD7002-16ES does not mention this, this final step of the original SAEJ1850 definition does not need to be performed in case of HSLI?
It could probably be helpful, if a table of example CRC results for various input values would be included in the datasheet, similarly as it is done in the Autosar document; this way users could perform a test for plausibility of their crc implementations, before sending actual requests to the TLD7002.