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.

TMS570LS1224: CPU reads wrong data from the flash memory

Part Number: TMS570LS1224

Hello,

I have programmed erase/write flash function according to SPNU501H and SPNA148. It is working properly – the memory is erased and re-programmed. After that I want to write a CRC value into the flash in the same way.

But – when I read the location (blue highlight), where the CRC value (let's say 0xF9A1) should be - there is 0xFFFF. It seems to be an ECC error but... 

The interesting thing is, that when I read (in CCS memory browser) a different location (and only if I click enter to choose it, scrolling does not have this impact) and then I go back and read the right location - voila - CRC value is there. The same happens when I reset the CPU - the CRC value is there - even after ECC check is turn on during start-up.

Until the CRC value is properly read – write to CRC location gives OK_STATUS (If I am modifying the CRC value during these tries, after CRC value is read – there is the first value I tried to write).

After CRC can be read properly (caused by the way I am describing above) – write to CRC location gives ERROR – data is already present.

After erase and write operation is done, I flush the pipeline. I did not get the same error using only F021 app, on the other hand it might be another code change that cause this.

Do You have any idea what could cause this mysterious behavior? It seems the data is already at the place but the CPU is not able to read them... only if a reset occurs or a different location is read meanwhile in CCS memory browser.

Best regards,

Tomas

  • An update:
    1) when I turn the ECC check off before the CRC is written, everything works alright. But ECC bites in the dedicated ECC memory (I suppose it is 0xF0402000) seems OK to me - 0x2E for the first non-empty data words and 0xFF for the blank data rest.

    2) using F021 API, or not, does not have an effect.

  • Hello Tomas,

    1. The flash memory only allows changing 1s to 0s, so the memory should be erased before programming. Writing data to a un-erased flash location will not program the new data to flash properly.

    2. When you call the F021 Flash API:  Fapi_issueProgrammingCommand(...) to program data, if Fapi_AutoGeneration is enabled, the ECC will be calculated and programmed to the corresponding ECC area. 

    3. I don't know why the CCS memory browser doesn't show the flash content. Does close/re-open the memory browser help? You can read the data back in your code to make sure the data is written sucessfully.

       flash_data =  *(uint32_t *) Flash_Address;

  • Hello QJ Wang,

    thank You for Your response!

    1) that is clear

    2) I use my own function according to SPNA148, and it works - the 0x10010 and further locations are erased and re-programed as You can see in the following picture:

    0x10000 (CRC location) is erased too, but not yet programed

    3) I use similar syntax, thank You. Closing and re-opening the memory browser does help too.

    I will try to express the problem with different words -

    (a) I program CRC value

    (b) in CCS memory browser I can see changed ECC bits for the 0x10000 - 0x10010 memory:

    (c) but neither in CCS memory browser, neither in code I can see the CRC value (e.g. 0x100)

    (d) if I try to write different data (e.g. 0x200) to the CRC location, after that, it does not have effect

    (e) because after a reset occurs or a different location is read meanwhile in CCS memory browser, there is 0x100 - now I can see (or the code) can see the CRC value

     

    The question is - why I (or the code) can't see the CRC value when (c) - there are correct ECC bits and (d) the data are clearly written at the location right the first try. And (e) why reset or read a different location in CCS memory browser helps?

    With regards,

    Tomas

  • This is my test. I programmed 8 bytes of data to 0x10000, and 64 bytes of data to 0x10100. The flash ECC is disabled:

  • Thank You QJ Wang - could You also test programming the flash based on the example of Programming 128-Bit Data and 16-Bit ECC chapter in SPNA148? Because that is what I use.

    I did not find the error yet, but I discovered that if I write the CRC value to the place 8 bytes shifted from 0x10000 (0x10008) it is all OK. Could CPU have problem to write right at the beginning of the sector 4?

    May I also ask how could I program only 64-bits and then later the other 64-bits of the flash bank width? I have two difficulties:

    1) If I fill FWPWRITE_ECC register with 0xFF for the other ECC byte that is already present (I wrote it before), it aims to write 1 to 0.

    2) If I try to read the other ECC byte (to write it to the FWPWRITE_ECC register - so that it matches) it can cause an ECC error if the location is blank.

    With regards,

    Tom

  • Hi Tom,

    There is no problem to write to any locations including the beginning of the sector. Please use the F021 Flash Library to write data and ECC to the flash. Attached is my example CCS project:

    TMS570LS1224_Flash_Test.zip