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: Programming flash using F021 API without erasing it first?

Part Number: TMS570LS1224

Hello everybody!

I have regarding the possibility to program a Flash sector without having erased it first!

I have found rather contradictory information from the following sources:

1. This thread:

TMS320F28035: Using Flash - C2000 microcontrollers forum - C2000™︎ microcontrollers - TI E2E support...

e2e.ti.com
Part Number: TMS320F28035 Building a unit that tied to vehicle ignition so we don't know when it will be powered down but need to store at most 5 values to be retreated
. The same thread mentions that only programming Flash will not damage it.

2. This thread:

OTP programming on F2812 with CCS v5 - C2000 microcontrollers forum - C2000™︎ microcontrollers - TI E2E...

e2e.ti.com
Can I program OTP on a F2812 without FlashAPI? Does FlashAPI 2.10 work with CCS v5? Can I reduce code from Flash API to use only the write to flash function
. It is mentioned that if the application only uses the program function, then the erase function will not be included in the final .out file.

3. SPNA117A: . On page 4/11, the document mentions that there are several steps required to program Flash using Flash API functions, one of which is erasing the target flash.

So, is erasing Flash a necessary step before programming it?

To give some context to my question: if I want to program a sector in Flash Bank 0 of the TMS570LS1224, do I need to necessarily first erase said sector before programming it?

Thank you in advance!

Mihail

  • Hello Mihail,

    The flash program operation can only change the bit from 1 to 0. The erase operation sets all bits in the sector or bank to 1. With a freshly erased sector, any location can be programmed. However, once a bit has been set to 0, only by erasing the entire sector can it be changed back to 1.

    My answer is the sector has to be erased before programming any data to this sector.