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.

TMS570LC4357: How to calculate ECC for Diagnostics RAM12, RAM16 and 17

Part Number: TMS570LC4357

Hi experts, The Diagnostics RAM12, RAM16 and RAM17 all need a ECC value for the test.

When looking into the TI Safety Library there are given some value like ECC for 0x0U is 0xCU, but there is no explanation how to calculate that value

(Q1) Can you give an example on how to calculate the ECC value for 64 Bit value in RAM?

Thank you and best regards,
Max

  • Hi Max,

    You can us the ECC table used for Flash: Table 7-1. ECC Encoding for BE32 Devices

    But the address portion is not used.

  • Hi QJ,

    I do not understand how to use table 7-1 and there is no explanation given.

    Can you pls explain how to use Table 7-1?

  • Hi QJ,

    I think I understand how the table works now. Can you please confirm that he following is correct?

    If you have 64bit word where each bit is 1 and wanted to calculate ECC bit 7 and 2 one would have to do the following

    For ECC bit 7

    ecc[7] = bit55 ^  bit54 ^  bit53 ^  bit52 ^  bit51 ^  bit50 ^  bit49 ^  bit48 ^  bit47 ^  bit46 ^  bit45 ^  bit44 ^  bit43 ^  bit42 ^  bit41 ^  bit40 ^  bit31 ^  bit30 ^  bit29 ^  bit28 ^  bit27 ^  bit26 ^  bit25 ^  bit24 ^  bit7 ^  bit6 ^  bit5 ^  bit4 ^  bit3 ^  bit2 ^  bit1 ^  bit0
    ecc[7] = 0

    And for ECC bit 3 we have to xor with parity = 1:

    ecc[3] = (bit55 ^  bit54 ^  bit53 ^  bit52 ^  bit51 ^  bit50 ^  bit49 ^  bit48 ^  bit47 ^  bit46 ^  bit45 ^  bit44 ^  bit43 ^  bit42 ^  bit41 ^  bit40 ^  bit31 ^  bit30 ^  bit29 ^  bit28 ^  bit27 ^  bit26 ^  bit25 ^  bit24 ^  bit7 ^  bit6 ^  bit5 ^  bit4 ^  bit3 ^  bit2 ^  bit1 ^  bit0) ^ parity
    ecc[3] = 1

    Using the whole table to calculate the ECC for 0xFFFF FFFF FFFF FFFF: The ECC would be 0x51.

    Thank you and best regards,
    Max

  • Hi Max,

    Each ECC bit is the XOR of all the 32 data bits marked "x" and parity bit.

    Parity=EVEN --> ECC = (XOR of 32 data bits) XOR 0 (Parity) = XOR of 32 data bits

    Parity=ODD -->  ECC = (XOR of 32 data bits) XOR 1 (Parity)

    For data=0xFFFF_FFFF_FFFF_FFFF

    XOR of 32 data bits = 0

    So ECC[7] = 0;

          ECC[6] = 0;

          ECC[5] = 0;

          ECC[4] = 0;

          ECC[3] = 0 XOR 1 = 1;

          ECC[2] = 0 XOR 1 = 1;

          ECC[1] = 0;

          ECC[0] = 0;

    The ECC value should be 0x0C

  • Thank you.

    Your clarification helped me find he error in my calculation. Now I get the same values.