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.

AM2634: Doubts regarding mcrc module

Part Number: AM2634

Tool/software:

Hi jagadish, 

   Is initial value will change from polynomial to polynomial ?

  For Example : polynomial type : SAEJ1850 CRC ->  Initial value : 0x00

                         polynomial type : H2F Autosar 4.0 -> Initial Value : 0xFF 



  • Hi Sravya,

       Is initial value will change from polynomial to polynomial ?

      For Example : polynomial type : SAEJ1850 CRC ->  Initial value : 0x00

                             polynomial type : H2F Autosar 4.0 -> Initial Value : 0xFF

    As per my understanding the default initial values for this controller is 0x00. However, we can control this one easily in software.

    For example:

    If the initial value is 0x00 and the data is 0x23 then the generated CRC is 0xA0 right?

    If the initial value is 0xFF and the data is 0x23 then the generated CRC is 0x64 right?

    To get this 0x64 there is another way that is, in lookup table verify the data value which can give the CRC of 0xFF:

    As you can see byte 126(0x7E) can give the 0xFF as CRC, right?

    So, we can just append this 0x7E to our actual data and just use initial value as 0x00 only this will produce the same result as 0xFF. Verify the below picture once:

    This is because if you keep 0xFF as initial value in your CRC generation mean it (0xFF) actually gets XOR with your first byte of the data and then polynomial division takes place, so to happen this indirectly we are including 0x7E in our data that means the CRC for 0x7E is nothing but 0xFF right, so that means 0xFF CRC will get generate by our first byte 0x7E and then it will get XOR with our next byte and process will get continue.

    --
    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    The above case works for the polynomial 0x2F, but it doesn't work for the polynomial 0xF4ACFB13 (crc 32bit). You can check the lookup table for the CRC 32bit polynomial below — there's no 0xFFFFFFFF present to find the index.

    My request is to give inital value 0xFFFFFFFF for this crc 32bit polynomial.





    Regards, 
    K.Sravya.

  • Hi Sravya,

    The above case works for the polynomial 0x2F, but it doesn't work for the polynomial 0xF4ACFB13 (H2F AUTOSAR 4.0).

    H2F AUTOSAR 4.0 polynomial is just 0x2F only right?

    That means it is just an 8-bit CRC only.

    So, the CRC table should be as follows only right?

    --
    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

       My bad, I was mistakenly mentioned as h2f autosar polynomial. It's crc 32bit polynomial of value 0xF4ACFB13.

    I have edited the previous query with correct naming. Once go through it.

    Thank you 

  • Hi Sravya,

    I never did any testing related to initial values on 32-bit polynomials. Maybe the previous method i discussed will only be applicable for 8-bit polynomials.

    Give me some time to analyze whether there is any way to change initial values for 32-bit polynomials.

    --
    Thanks & Regards,
    Jagadish.

  • Hi Sravya,

    On my testings i found that the initial and final values for the CRC-32 bit already 0xFFFFFFFF.

    For more details refer below of your other thread once:

    (+) AM2634: Doubts in mcrc code - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums

    --
    Thanks & regards,
    Jagadish.