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.

TMS570LC4357: Erasing only 8 bytes of Flash Emulated EEPROM location instead of complete sector

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

Hi,

In TMS570LC4357, we wanted to use EEPROM (FEE) to store some data. We are using F021 APIs to program or erase the EEPROM locations.

But as a sector of EEPROM is 4KB, if we want to write only 8 bytes of data we have to always erase the complete sector.

Is there any method to erase only 8 bytes of data in the Flash EEPROM location? which would get rid of erasing a complete sector.

  • Hi Srithari,

    The minimum erase size is one sector. If using FEE driver, you don't need to erase the flash when writing new data to the flash. In FEE, the data block is used to define where the data is mapped within a virtual sector. One or more variables can be within a data block. Each block has header which defines the block status, block size, and block number. 

    Whenever a Data Block has to be written, it is programmed at the first unused memory location of the Active Virtual Sector. The very first data write operation is performed on the empty location immediately after the Virtual sector header. The next unused memory location will be computed by adding the previous block’s address and the previous block’s size. If a data block already exists, the older record is marked as “Invalid” and the new data will be marked as “Valid”.

    If there is insufficient space in the current Virtual Sector to update the data, it switches over to the next Virtual Sector and copies all the valid data blocks in current Virtual Sector to the new one. After copying all the valid data blocks, the current Virtual Sector is marked as ready for erase and the new one is marked as Active Virtual Sector. Any new data is now written into the new Active Virtual Sector and the Virtual Sector which is marked as ready for erase will be erased in background.

    The minimum virtual sector size is one flash sector (4KB), and at least 2 virtual sectors are required. 

    The HALCoGen contains one FEE example which use FEE APIs to read data from FEE and write data to FEE.