Hi Charudatta,
S12ZVL EEPROM Features:
*The EEPROM memory is composed of one Flash block divided into sectors of 4 bytes
*Ability to program up to four words in a burst sequence
So, you are right with first example. If you want to write one byte of data on address 0x100003 then you have to recover remaining three bytes of data from sector, perform erase on sector and write two words of data on sector.
Your second case supposes that target EEPROM area may be already written and you want rewrite these data. Correct?
In that case you are right. You have to extent target area to start address of first sector (start global address [1:0]=0b00) and to end address of last sector (end global address [1:0]=0b11). This area should be checked whether it is erased or not. If not, partial write should be applied. So, simplest way for partial write will be read whole 3 sectors into RAM, modify appropriate 8 bytes in RAM, erase 3 sectors and write back 6 words (4+2/2+4/3+3).
Of course, if you will write much longer data than 8 bytes, reading just first and last sector prior update may have some sense from performance point of view. However I suppose that this effect will be negligible in comparing with necessary total time for main programming.
I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------