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.

TMS570 runtime flash usage

Hi All,

Is there any example code, or idiots-guide to programming the flash during runtime (i.e. having both program data and user data concurrently)? Looking to use some of the flash to storage reset-safe data, but don't want ot accidentally blow-away the program code!

Mat

  • P.S. TMS570LS20* device.

  • Hello Matthew,

    I know of only 1 example of Flash API usage on the TMS570LS20x devices which is this app note: Programming TMS570LS20x/10x Flash Using Flash API (Rev. A)

    One way to protect Flash from being erased or programmed is to write and link in your own version of Flash_Sector_Select_V() that sets the FBSE register to only enable the sectors you want to use for your data.  You could also put additional protections like testing what the active bank is:

    ex:

    Bank 0 is active, set FBSE=0x0 //disables all sectors for program and erase

    Bank 1 is active, set FBSE=0x4  //enables only sector 2 of Bank 1 for program and erase.

  • Thanks John - thats a brilliant link.

    One remaining question I have is how to safety shut down the ECC detection/correction during re-flashing operations, then re-enable. Just to be a pain, I would only want to do this on Bank3, leaving Bank0 active for the program memory. Any ideas?

    Mat

  • Mat,

    As long as you don't read from Bank3 until after it has been re-flashed with the new data and ECC, you shouldn't have a problem with ECC detection/correction.

    To disable/enable ECC, it takes a CP15 ARM assembly instruction, but I believe this will turn it off for the entire Flash.  I will forward this question to some colleagues and see if I can get you a better answer on this.

  • Mat,

    I have confirmed that the ECC disable/enable only does the whole Flash memory and not individual banks.

    Note:  I will release v1.09 of the pF035a Flash API by the end of next week.  This will be the new recommended version of the API.  The documentation has been updated indicate what functions must always be executed from RAM.

  • ok, I'm pushing my luck here...

    I've adapted the example code into my application, but am getting a DataAbort upon the first call to the API (_FlashCompact). Tracked down to a DFSR Background Fault.  Any ideas what may be causing this?

    Mat

  • Mat,

    I have never seen that, so I am not sure what is causing it.