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.

TMS570LS20216 CRC

Other Parts Discussed in Thread: TMS570LS3137, HALCOGEN

Hello,

I'm trying to validate the output of the TMS570 CRC with an external reference without success.

I've used this link as a reference(in another post in E2E forum):

The pycrc project supports this algorithm:

http://www.tty1.net/pycrc/index_en.html

 

The code used for the computation is as follows(Code idebtical in functionality from another post on E2E forum ) :

 

uint64 CRC_CalcCRC(const uint8 *ubData, uint8 ubSize, bool bCRCReset)
{
uint8  count;
uint64 result = 0;
uint64 tempC;

    if( bCRCReset )
    {
        /* reset CRC module */
        sCRC_t->CRC_CTRL0 |= 1;
        sCRC_t->CRC_CTRL0 &= ~1;
    }

    /* Configure the CRC controller */
    /* configure full CPU mode */
    sCRC_t->CRC_CTRL2 = 0;
    sCRC_t->CRC_CTRL2 = 3;

    for(count = 0; count < ubSize; count++)
    {
        sCRC_t->PSA_SIGREGL1 = ubData[count]; /* write a byte at address 0xFE000060 */
    }
    tempC = sCRC_t->PSA_SIGREGH1;
    result = (uint64)((uint64)sCRC_t->PSA_SIGREGL1 | (tempC <<32));
    return result;
}

The bytes array used for the computation is "123456789"

The output from the TMS570 CRC64 is 0x000002F9AE1A415B.

The actual CRC from the python project above (for the same reference string) is 0xE4FFBEA588933790.

Not close.

Any idea what is wrong ?

Thanks for your help

Regards,

Normand

  • Normand,

    Thank you for using our forum. I need to do some research and I will be back to you as soon as possible.

  • Hello Normand,

    Just a thought, but perhaps the data endianness of the software CRC is not matching the hardware CRC?  

    Regards,

    Karl 

  • Actually the 2 long words are not identical at all. Not an endianess issue.

     

    Regards,

     

    Normand

  • Normand,

    If I'm correct, you are running the CRC on the device and on your PC to verify the result.
    The possible endianess could be on the fact that PC is little and the device is big.
    We are not saying that the problem is on the result.

    I will dig more and will be back to you tomorrow.

  • Here is the matlab code that can get you the same result as the TMS570 did.

    http://e2e.ti.com/cfs-file.ashx/__key/communityserver-discussions-components-files/312/1614.test3.m

    1. I translate the ascii into integer.

    2. since you did not write to the CRC high register, I put zero in the code.

    Regards,

    Haixiao

  • Normand,

    Sorry for this late answer, but I had to run some experiment to be able to clarify and understand your problem.

    The hardware CRC module in the Hercules family allows to calculate a CRC-64.
    The module implementation provide 2  set of 32bits registers (PSA_SIGREGL1 and PSA_SIGREGH1) to write the 64bits data to process.
    In order to perform a CRC-64 computation, it is necessary to write these 2 registers at once.

    The bus interface to CRC module is 64 bits, so the following options are possible to perform this 64bits write:
    1]  STRD Rx, [R12]           ;Store Rx and Rx+1 at the address pointed by R12. In this case R12 =  PSA_SIGREGL1 (0xFE000060) Rx has to be even
    2]  STRM R12, {R0, R1}  ;Store R0 and R1 at the address pointed by R12.

    The other issue you were facing is when you  try to use pycrc to crosscheck the CRC calculation.
    As it was explained in other post, the endianess is different between the TMS570LS3137 and a PC.

    Let me provide you an example:

        uint32 dwInputVal[] =
        {                             //    pycrc   
        0x11111111, 0x22222222,       // 22222222 11111111
        0x22222222, 0x11111111,       // 11111111 22222222
        0x11112222, 0x33334444,       // 33334444 11112222
        0x11223344, 0x55667788        // 55667788 11223344
        };

    dwInputVal is an array of data that we want to process to calculate the CRC-64.
    The first data will be 0x1111111122222222. It is a 64 bit data. In order to calculate the CRC-64 on PC (using pycrc) the following data will have to be used:
    0x2222222211111111

    The command line I'm using for pycrc is :

    python pycrc.py --width 64 --poly 0x000000000000001b --reflect-in False --xor-in 0x0000000000000000 --reflect-out False --xor-out 0x0000000000000000 --check-hexstring 2222222211111111111111112222222233334444111122225566778811223344 -v

    I have also attached a CCS and Halcogen project used to demonstrate the usage of CRC4454.CRC.zip