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.

TMS320F28374S: How to modify the CRC check function of VCU so that the calculated CRC code can get the result in MODBUS format?

Part Number: TMS320F28374S


Hi Team,

I use the CRC check function of the VCU module to verify the SCI communication, and the code is as follows.

The obtained CRC code is always different from the result obtained by using the CRC calculator and the table lookup method, and the result calculated by using the CRC custom calculator according to the configured CRC structure parameters is also different from the result obtained by the program.

Could you please tell me how to configure it so as to get the CRC code in modbus format, and how to use the CRC calculator to calculate the CRC code that is the same as the program result?

 CRC.seedValue    = 0xFFFF;

    CRC.nMsgBytes    = uiLen;    //communication array length=uiLen (16bit)

    CRC.parity       = CRC_parity_even;

    CRC.crcResult    = 0;

    CRC.pMsgBuffer   = (UINT16 *)pucFrame;   //pucFrame is the address of the communication array

    CRC.pCrcTable    = NULL;

    CRC.init         = (void (*)(void *))CRC_init16Bit;

    CRC.run          = (void (*)(void *))CRC_run16BitPoly1Reflected;  

 

    // Step 2: Run the VCU 16-bit CRC routine and save the result

    handleCRC = &CRC;

//    CRC.init(handleCRC);

    CRC.run(handleCRC);

    uiCRC   = CRC.crcResult;

The polynomial I configured above is 8005, the initial value of CRC is FFFF, the input data is reversed.

After reading the routine, I'm not sure whether the XOR value of the result is either 0000 or FFFF. I tried various combinations with the computer but did not get the same result as that of the program.

What is the XOR value (XOROUT) of the result when the VCU performs CRC check? If I know this value, I may be able to use a calculator to calculate the result of the program. Is it FFFF or 0000? I have tried both, but it doesn't seem right.

Kind regards,

Katherine