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.

TMS320F28069: CRC protocol of the controlSUITE crc16 using vcu0

Part Number: TMS320F28069
Other Parts Discussed in Thread: CONTROLSUITE

Hi,

I was wondering what the CRC16 protocol is that's used by the controlSUITE implementation of getCRC16P2_vcu using the VCU0. I tried calculating the check value but it doesn't match with any protocols I found online. More specifically, I'd like to use the vcu instructions for this protocol . Is this possible using the VCU instructions?

Thanks.

  • Hello Menno,

    The polynomial being used by getCRC16P2_vcu is 0x1021 (x^0 + x^5 + x^12 + (x^16) (implicit)), which is the same polynomial as the one in CRC-16-CCITT. Did you find a mismatch between the library generated CRC and the CRC computed for CRC-16-CCITT on some online calculator? If yes, please provide details (16-bit test vector used, online reference for CRC-16-CCITT CRC etc.).

    Thanks,
    Sira
  • This is the code I used to test the implementation (on TI):

       uint16_t input[] = {0x0102, 0x0304, 0x0506, 0x0708, 0x0900};
       uint16_t const CRCvcuef = getCRC16P2_vcu(0, input, CRC_parity_even, 10); // from controlSUITE
    

    I'm pretty sure I'm just forgetting something (maybe undefined behaviour?), especially now that I've been playing around with it. I'm getting thoroughly confused. I have adapted the code from the automationwiki link above into two versions: Version 1 and Version2. Version1 gives the same output as my reference implementation using tables, whilst the second version gives the same output as the VCU version from controlSUITE. I can't figure out what they're doing different. I've been looking at them for too long.

    Any help is welcome.

  • You may be getting confused by the byte order of the CRC calculation. Whether, it is LSB or MSB calculated on first.

    sal
  • You're absolutely right. Thanks! By interpreting a sequence of uint16_t as a sequence of (8-bit) bytes, due to x86 and C2000 devices being little-endian, this results in a sequence of LSB0, MSB0, LSB1, MSB1, ... whereas I was expecting MSB to be before LSB.

    I'm guessing I can have the controlSUITE asm implementation match my reference implementation by interchanging the

    VCRC16P2L_1
    VCRC16P2H_1

    instructions. Thanks for the suggestion.

  • Version 1 matches the VCU output, and then by swapping the LSB-MSB, matches Version 2.

    Thanks,
    Sira