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.

TMS320F280049C: The question of ECC Calculation Algorithm in FLASH_API guide

Part Number: TMS320F280049C
Other Parts Discussed in Thread: C2000WARE

Tool/software:

Hello,

I'm currently working with the Flash API on a C2000 F28004x device, and I'm using the Fapi_issueProgrammingCommand() function in Fapi_DataAndEcc mode to program both data and ECC values.

I'm confused about how the ECC values are actually generated and written to Flash in this mode. I have a few questions:

  1. When using Fapi_DataAndEcc, does the Flash API internally generate the ECC values based on the data I provide, or am I responsible for manually calculating and supplying them?

  2. If I pass a valid ECC buffer to the Fapi_issueProgrammingCommand() function, will the API write it directly to the ECC memory, or does it still recalculate ECC internally?

  3. What is the correct way to manually calculate ECC using Fapi_calculateEcc()? Should I use 64-bit chunks aligned to 64-bit addresses?

  4. Are there any constraints on data alignment, address alignment, or buffer size when programming data and ECC together?

I’ve noticed that writing in Fapi_AutoEcc mode works fine, but when switching to Fapi_DataAndEcc, verification or subsequent writes may fail unless ECC is handled very carefully. I would really appreciate clarification on the expected behavior and recommended usage pattern.

Thanks in advance!

  • Hi,

    When using Fapi_DataAndEcc, does the Flash API internally generate the ECC values based on the data I provide, or am I responsible for manually calculating and supplying them?

    This mode will program both the supplied data and ECC in Flash at the address specified.Fapi_calculateEcc() function can be used to calculate ECC for a given 64-bit aligned address and the corresponding data.

    If I pass a valid ECC buffer to the Fapi_issueProgrammingCommand() function, will the API write it directly to the ECC memory, or does it still recalculate ECC internally?

    Api will program the provided Ecc data into Ecc memory range.

    What is the correct way to manually calculate ECC using Fapi_calculateEcc()? Should I use 64-bit chunks aligned to 64-bit addresses?
    Are there any constraints on data alignment, address alignment, or buffer size when programming data and ECC together?

    The data supplied must be aligned on a 64-bit memory boundary and the length of data must correlate to the supplied ECC. That means, if the data buffer length is 4 16-bit words, the ECC buffer must be 1 byte. If the data buffer length is 8 16-bit words, the ECC buffer must be 2 bytes in length. If the start address is 128-bit aligned, then either 8 or 4 16-bit words should be programmed at the same time as needed. If the start address is 64-bit aligned but not 128-bit aligned, then only 4 16-bit words should be programmed at the same time. The LSB of pu16EccBuffer corresponds to the lower 64-bits of the main array and the MSB of pu16EccBuffer corresponds to the upper 64-bits of the main array. The Fapi_calculateEcc() function can be used to calculate ECC for a given 64-bit aligned address and the corresponding data.

    Refer flash api example for F28002x device in C2000ware. This example demonstrate "DataAndEcc" mode programming.

    Thanks & Regards,

    Rajeshwary