If I have a mcu with page erasable flash and perform a write in first address of the page this consume one write/erase cycle. Now when I perform a second write in the next address of the same page this consume 2nd write/erase cycle in the current page or one write/erase in the current address? The endurance of memory concerns the address or pages?
-
1\$\begingroup\$ are you talking about the MCU internal flash memory or about an external MCU memory connected to an MCU??? \$\endgroup\$– KvegaoroCommented Aug 4, 2015 at 17:07
-
2\$\begingroup\$ Typically, the endurance limit on flash memory is on erase cycles, not write cycles. In fact, you can do multiple writes to a single byte without erasing (assuming you only set one bits to zero) without "consuming" endurance, though some parts' datasheets recommend against this. Having said this, you should look at the details of the specific part you are looking at. \$\endgroup\$– DoxyLoverCommented Aug 4, 2015 at 17:31
-
\$\begingroup\$ But in a memory with x "PAGE" write/erase endurance, can i perform x write/erase in each address of one page? or x cumulatively in a whole page? \$\endgroup\$– MrBitCommented Aug 4, 2015 at 18:10
-
1\$\begingroup\$ This is one of those "consult the datasheet" things. Different parts behave differently. \$\endgroup\$– Matt YoungCommented Aug 4, 2015 at 18:26
2 Answers
Flash is ruined by erases, not writes. If you make one (eight byte) page erase followed by eight writes this will count as one cycle. This technique is widely used in flash-based memories to increase endurance, see Microchip App.note 1095 for one such example -> http://ww1.microchip.com/downloads/en/AppNotes/01095D.pdf
It most likely refers to the number of erase/write cycles of the full page. Most flash memory are organized in such way the full page must be erased and even though individual bytes can be written to, actual flash memory work from buffers. So therefore there is a "page sized" buffer where you read the current page, modify it, erase the page and write the full contents of the buffer to the page.
Quoting from the Atmega88PA datasheet, section 25.1
"The Program memory is updated in a page by page fashion. Before programming a page with the data stored in the temporary page buffer, the page must be erased. The temporary page buffer is filled one word at a time using SPM and the buffer can be filled either before the Page Erase command or between a Page Erase and a Page Write operation: Alternative 1, fill the buffer before a Page Erase
• Fill temporary page buffer
• Perform a Page Erase
• Perform a Page Write
Alternative 2, fill the buffer after Page Erase
• Perform a Page Erase
• Fill temporary page buffer
• Perform a Page Write
If only a part of the page needs to be changed, the rest of the page must be stored (for example in the temporary page buffer) before the erase, and then be re-written. When using alternative 1, the Boot Loader provides an effective Read-Modify-Write feature which allows the user software to first read the page, do the necessary changes, and then write back the modified data. If alternative 2 is used, it is not possible to read the old data while loading since the page is already erased. The temporary page buffer can be accessed in a random sequence. It is essential that the page address used in both the Page Erase and Page Write operation is addressing the same page."
However, this could be different depending on how the manufacturer implements flash. So if you could provide details as to an specific Flash memory you are looking into we can only generalized and provide examples. So in conclusion, by making you work from the page buffer the ambiguity is resolved and therefore the erase/write cycles are those of the page in full
-
\$\begingroup\$ Another example is at45db641e dataflash IC from Adesto, where write must are done from a buffer to a page. \$\endgroup\$– KvegaoroCommented Aug 4, 2015 at 18:22
-
\$\begingroup\$ For example in atsam3x8e, whats the minimum quantity that can i store in the flash without move other data? bit program, byte program, word program page program? \$\endgroup\$– MrBitCommented Aug 4, 2015 at 18:46
-
1\$\begingroup\$ if you look up the the datasheet you'll find table 18-2 which shows the commands to write to the internal flash, and you'll notice all the write commands are for write page. You can simulate the bit, byte, and word program by reading the page 1st, modifying as needed and write again. But each time is a full erase/write cycle. \$\endgroup\$– KvegaoroCommented Aug 4, 2015 at 19:00
-
\$\begingroup\$ yes i've already noticed, but affected from flash's functions in Atmel Software Freamwork (ASF) which is performing even a byte write, i thought that there be something what i haven't noticed. ASF's flash functions May works with software buffering, to buffer the page, modify it, erase the page, and write the content back to flash \$\endgroup\$– MrBitCommented Aug 4, 2015 at 19:06
-
\$\begingroup\$ Most likely, they do implement the software buffering. Where you looking to implement some type of data logging?? \$\endgroup\$– KvegaoroCommented Aug 4, 2015 at 19:09