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.

How to calculate the ECC code in TMS570LS31x?



 Hi TI experts,

I am trying to understand the ECC (SECDED) scheme used in TMS50LS31x.

According to SPNA126, during  read access, the ECC is re-calculated and

Syndrome = stored_ECC xor re-calculated_ECC# 

The note 2 of Tab. 5-1 in SPNU499B states that “Each ECC[x] bit represents the XOR of all the data bits marked with x in the same row”.

I assume it means “Each ECC[x] bit represents the XOR of all the data bits marked with x in the same row, and then XOR the parity bit”.  

The interpretation of syndrome byte is given in Tab. 5-3 in SPNU499B.

Just to verify my understanding of the ECC algorithm, I tried the following calculation:

Write 0x0 to flash address 0x0.

First calculate the parity byte, it is 0x0C (according to Tab. 5-3 in SPNU499B).

Then calculate the ECC, it is parity byte xor (all bits marked with x in Tab. 5-3) = 0x0C xor 0x00.

Therefore stored_ECC = 0x0C. (This way I can explain why the ECC for all data in TCRAM after initialization is 0x0C as described in Section 6.4 of SPNU499B).

 If the bit 0 at address 0 is corrupted, the data at address 0x0 will be changed to 0x1. During read access, re-calculate ECC:

First calculate the parity byte, it is 0xF3 (according to Tab. 5-3)

Then calculate the ECC, it is parity byte xor (all bits marked with x in Tab. 5-3) = 0xF3 xor 0xE3.

Hence, the re-calculated_ECC = 0x10.

 Finally calculate syndrome: syndrome = stored_ECC xor re-calculated_ECC = 0x0C xor 0x10 = 0x1C.

Look up in Tab. 5-3, I get D15 which  means data bit 15 is corrupted. But actually bit 0 was corrupted, and I expect the syndrome to be 0xE3 (which maps to D00 -- single bit erro at bit 0).

Now the question: Where did I make the mistake? If the parity bit is not included in the ECC calculation, how to get the ECC code 0x0C as described in section 6.4 of SPNU499B?

One more question: The address bits are not included in the ECC calculation for TCM RAM, will the syndrome table be different from Tab. 5-3 in SPNU499B?

Thank you for the support!

Regards,

Libo

  • Hi Libo,

    the calculation of the ECC bits according to Table 5-1 works a bit differently than you did it:

    for one ECC bit (ECC[x]) you need to XOR all address and data bits marked with an 'x' in the Table 5-1 and additionally if 'parity' is marked as 'odd' the row needs to be XOR'ed with '1'. If parity is 'even' then the result of the row is already the ECC[x] bit.

    This means for address 0x0 and data 0x0 the ECC result is still 0x0C.
    However the ECC result for address 0x0 and data 0x1 is 0xEF.

    This means for the syndrome = 0x0C XOR 0xEF = 0xE3 which is the value which you expected.

    I'll let someone else comment on the question regarding syndrome table for RAM ECC.

    Best regards

    Andreas

  • Hi Andreas,

    thanks for the quick answer!

    I had misunderstood the note for parity. So it is clear for me.

    It would be very helpful if someone can reply the question regarding the syndrome table for B0TCM and B1TCM RAM ECC.

    Thank you!

    Libo

  • Hello Libo,

    The ECC controllers in the R4 CPU apply the same ECC scheme to ATCM, BTCM0, and BTCM1 transactions.  The CPU does not distinguish between the type of memory attached to these interfaces.

    The additional XOR of address into the ECC code is performed by the flash wrapper only.

    Regards,

    Karl

  • Hi Karl,

    thanks for the answer.

    According to Section 5.3.3 of SPNU499B, "A syndrome value of 00000000 indicates there is no error. Any other syndrome combinations not shown in the table are un-correctable multi-bit error." Since the address bits are not included in the ECC calculation, the address error positions in Tab. 5-2 will disappear.

    My understanding is that the cells in Tab. 5-3 marked with A03, A04, ..., A21 will be marked with "M". For example, the syndrome 0x9E is for A03 error in Tab. 5-3. Actually it is a "M" error in TMS570LS31. Is my understanding right?

    Thanks and regards,

    Libo

  • Hi Libo,

    I'm afraid I don't quite understand how to decode that table.  I'll see if one of our designers can get you that answer.

    Regards,

    Karl