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.

[参考译文] TMS320F280039C:通过 VCRC 配置来匹配标准 CRC-32算法

Guru**** 2535150 points
Other Parts Discussed in Thread: C2000WARE

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1275572/tms320f280039c-vcrc-configuration-to-match-standard-crc-32-algorithm

器件型号:TMS320F280039C
主题中讨论的其他器件:C2000WARE

您好!

我正在尝试配置 VCRC、以生成与该计算器等效的输出、用于 CRC-32算法: https://crccalc.com/?crc=12&method=CRC-32&datatype=ascii&outtype=0

我已经按照 C2000Ware 中的28003x_vcrc_crc_32示例进行了跟踪、并生成了以下代码:

    uint16_t buffer[1] = {0x3132};

    uint32_t crcResult = 0;

    txCrcHandle->seedValue = 0xFFFFFFFF;
    txCrcHandle->nMsgBytes = 2;
    txCrcHandle->parity = CRC_parity_even;
    txCrcHandle->crcResult = 0;
    txCrcHandle->pMsgBuffer = (uint16_t *)&buffer[0];
    txCrcHandle->init = CRC_init32Bit;
    txCrcHandle->run = CRC_run32BitPoly1;

    txCrcHandle->init(txCrcHandle);
    txCrcHandle->run(txCrcHandle);

    crcResult = txCrcHandle->crcResult;

当 run 时、将生成0x40442760的结果。 这与上面链接的结果(0x4F5344CD)不匹配 )。

我尝试过其他几种设置、但都不会得到与在线计算器保持一致的结果。

对于需要更改的设置、欢迎提出任何建议。

谢谢。

凯文

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    以下内容应该会帮助您:

    https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1260124/tms320f280025-incorrect-output-using-the-crc-routine-provided-on-page-642-of-spruhs1c

    我们对 CRC-32和 CRC32-MPEG2实现之间的差异进行了一些分析、该分析可在下图中获得。 flipInputBuf_CPU ()是在 VCU0情况下需要的显式 C 函数,但在 VCRC 中,可以使用 VSETCRCMSGFLIP  指令反转输入位。

    谢谢。

    Sira

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Sira:

    感谢您的帮助! 这给了我使它工作所需的一切、我能够匹配 https://crccalc.com/?crc=31的输出 32&method=CRC32&datattype=hex&outtype=0

    对于任何其他找到此帖子的人、以下是我用于使此帖子正常运行的最终代码:

        // Note: The CRC is fed the data from LSB to MSB so 0x31 is processed before 0x32.
        uint16_t buffer[1] = {0x3231};
    
    
        txCrcHandle->seedValue = 0xFFFFFFFF;
        txCrcHandle->nMsgBytes = 2;
        txCrcHandle->parity = CRC_parity_even;
        txCrcHandle->crcResult = 0x00000000;
        txCrcHandle->pMsgBuffer = (uint16_t *)&buffer[0];
        txCrcHandle->init = CRC_init32Bit;
        txCrcHandle->run = CRC_run32BitPoly1Reflected;
    
        txCrcHandle->init(txCrcHandle);
        txCrcHandle->run(txCrcHandle);
    
        crcResult = txCrcHandle->crcResult;
    
        crcResult = __flip32(crcResult);
        crcResult = ~crcResult;