S12zvl EEPROM odd address write

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S12zvl EEPROM odd address write

523 Views
charudattaingal
Contributor IV

Dear Team,

 

As s12z EEPROM is word programmable before program EEPROM we have to erase sector of four bytes.

For EX.

1) If I want to write one byte of data on address 0x100003 then I have to recover remaining three bytes of data from sector, perform erase on  sector  and write two words of data on sector.

2) If i want 8 bytes of data on address starting from 0x100003 then i have to recover data present on first sector starting from 0x100000(3 bytes) and third sector starting from 0x100008(1byte) finally  I have to perform three sector erase and write 6 words of data.

 

Looking for efficient solution to write number of bytes of data on EEPROM.

good to have any good example project to handle such type of scenario.

Requesting assistance for the same.

 

Thanks & Regards,

Charudatta.

Labels (1)
0 Kudos
1 Reply

380 Views
RadekS
NXP Employee
NXP Employee

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!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos