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.

TMS320F28388D: VCRC giving incorrect CRC based off seed value.

Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE

Hello,

I am trying to implement the VCRC module into my code as it should be much faster than our current software implementation.

While working on VCRC, I was testing byte by byte. So, in this case, the first byte is 0x55 and my SW CRC16 implementation matches the CRC16/CCITT-FALSE implementation as it gives the value of 0xEBA0. The VCRC module gives the value 0x0A50 which is CRC-16/XMODEM.

 

One weird thing I am noticing is that CRC-16/XMODEM algorithm is meant for 0x1021 polynomial with an initial value of 0. I clearly set my initial value to 0xFFFF. When checking the VCRC result register before it performs the CRC16, it has the value of 0x0000FFFF (this is fine due to anything under 32 bits is right justified). The pictures below show the value I get when I do the VCRC based off the first 8 bit byte (0x55). The answer should be 0xEBA0 but im getting 0A50 which according to the online calculator states that my initial seed value is 0x0000 which is incorrect as you can see below.

My code is as follows:

UINT16 __HWCRC16Calculate(CHAR * data, UINT16 lengthOfData, UINT32 initialSeedValue)

XAR4 = data

XAR5 = lengthOfData

XAR6 = initialSeedValue

I call the function as follows:

UINT16 testData = {

0x55, 0xA1

};

__HWCRC16Calculate((CHAR *)data,sizeof(data),0xFFFF)

The ASM code is as follows:

VCRCCLR ; clearing result register before writing into it

VCLRCRCMSGFLIP; clearing parity bit to make sure its big endian

VMOV32  VCRC, XAR6; writing initial seed value into VCRC result register

NOP

NOP

NOP

DEC AR5; decrementing the length by 1 for branching instruction

Loop:

VCRC16P2H_1 *XAR4 ;; CRC based off MSB

VCRC16P2L_1 *XAR4++ ; CRC based off LSB then increment data

BANZ Loop, AR5-- ; go until lengthOfData = 0

VMOV32 ACC VCRC; store VCRC into result register

LRETR

Thanks...