Other Parts Discussed in Thread: TMS570LS2125
Hi,
I am using the TMS570 inbuilt Cyclic Redundancy Check Controller (CRC) Module to CRC 8 16-bit words of data. This takes some 3 microseconds (yes, 3us, I'm not joking).
I have tried similar code style for a straight checksum in a simple loop and this takes 1.9us (I still think that this is an age).
However, here is my code, am I using the CRC module interface correctly?
uint16 HwCrc_CalculateCrc16From32bit( const uint32 nCrcDataPtr[], const uint16_least nCrcLength, const uint16 nCrcStartValue)
uint16_least nIdx;
regCrc.CRC_CTRL2 = 0x00000000U; /* CRC Global Control Register 2 */
/* Write seed */
regCrc.PSA_SIGREGL1 = (uint32)nCrcStartValue; /* Channel 1 PSA signature low register */
regCrc.CRC_CTRL2 = 0x00000003U; /* CRC Global Control Register 2 */
/* Write each part of data block to PSA signature register */
for(nIdx = 0U; nIdx < nCrcLength; nIdx++)
{
regCrc.PSA_SIGREGL1 = (uint32)((uint16)nCrcDataPtr[nIdx]); /* Channel 1 PSA signature low register */
}
return (uint16)regCrc.PSA_SIGREGL1; /* Channel PSA signature low register contains the LS 32 bits of the answer. We are only taking the LS 16 bits */
}