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.

CRC table generated by "TI ARM Code Generation Tools 5.1.3" is wrong.

Other Parts Discussed in Thread: HALCOGEN

Hello,

In the linker file of my project I have the line

    .section_to_be_verified: palign(8) {bsp_sys_startup.obj(.text)} crc_table(_crc_table) > FLASH0 | FLASH1

so a variable _crc_table is generated by the linker with the crc for the section bsp_sys_startup.obj(.text). 

The problem is that the calculated CRC is wrong, I have verified the result with python "crcmod" (also double check with some other tools).

I have also verified using the CRC hardware module of TMS570LS31x/21x.

Also, using the CRC hardware module, I have verified that if I do not swap the HIGH and LOW 32 bits when writing to "PSA Signature Register" and when reading from "PSA Sector Signature Register" the result matches with the result calculated by the linker.

Also, note that halcogen tool is generating a wrong crc example source code, as values are not swapped when written nor read. This must be fixed as well.

  • Francisco,

    Thanks for flagging this.  I have forwarded your post to the halcogen team and they will double check.

  • Hi Francisco

    What version of HALCoGen are you using? Did you see the same issue with latest Version 3.08.00? I remember there was a fix on CRC.

  • Hello Prathap,

    I just installed halcogen 3.08 as suggested and I can see the same problem. But my question/problem is related to the compiler, as the crc table generated is wrong (it matches halcogen code what is also wrong). As I said I have verified with python "crcmod" that the generated table is not CRC-64 (ISO 3309).

    As I explained in my first post, if I swap the 32 bits hight and low bits of the input data before computing crc and also the 32 high and low bits of the result then, the result is correct according to CRC-64 (ISO 3309).

    Regards,

    Francis-

  • Hello Prathap,

    Thanks for your answer. Yes, the thread you proposed has been very helpful.

    The only problem is that swapping the words to perform a CRC calculation will mean that the performance is much worse. Also, in case we need to check the CRC calculated by TMS570 against the CRC calculated by another tool (which we can not modify) means that the swapping has to be done in the microcontroller (and can not be done in a PC for example). So in that case we will have a performance problem and in case we would like to use DMA transfers to calculate the CRC, it means that our DMA would need to perform the swapping and probably it would be complicated to created such a DMA transfer.

    I can not understand that TI had such a big mistake and put the registers in the wrong order. Even more, document spnu118l.pdf talks about TMS570_CRC_ISO !!! But this is not the standard ISO!! the polynomial used is the same but the algorithm is not the same.

    And finally, I think that such a big mistake should be described in spnu499b.pdf where the CRC module is described. 

    Is there any errata for that problem? Is TI planning to fix it? Hopefully answer is yes.

    Regards,

    Francis.

  • Hello Francis,

    Actually you don't need to SWAP the WORDS when writing to CRC Register. Instead for the OFFLINE Calculation of CRC Signature, you need to SWAP the WORDS and everything will be fine. Think of these as NAMES of REGISTERS. It doesn't matter whether you call them LOW or HIGH. Usually offline CRC computation is performed on PC [Intel], where it is naturally SWAPPED  because Intel is LE and TMS570 [Hercules] family is BE format.

    Hope it is clear now.
    Thank you.
    Regards
    Pashan