<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>flash write</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/4481/flash-write</link><description>hi everyone
(1) everytime,the pstorage_init get the same block id, if we wrtie it more than 20,000 times , will this block become a bad one? if it will, can the program automatically get another good block id,and write it smoothly? thank you.
(2)is</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 17 Nov 2014 09:40:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/4481/flash-write" /><item><title>RE: flash write</title><link>https://devzone.nordicsemi.com/thread/15892?ContentTypeID=1</link><pubDate>Mon, 17 Nov 2014 09:40:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88b17867-7f43-4586-bfde-23d5e5823305</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;(1)
You are correct, the flash memory has specified endurance of 20.000 write cycles. This endurance is per bit, meaning that if you write or erase a single bit more than 20.000 times, it is not guaranteed to work any more (even though it might). So if you anticipate that you will need to write a certain data to flash more than 20.000 times for the lifetime of your product, you should implement a mechanism to write that data into different flash locations.&lt;/p&gt;
&lt;p&gt;(2)
The block id is not exactly the physical address of the flash you write to. The physical address space for flash operations made by the application is specified in the pstorage_platform.h file. Typically, the application writes to the last page of the flash. If there is a bootloader already flashed to the chip, the application flash space is located at the last page before the bootloader.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Address space of the whole flash is from 0x00000 - 0x40000, i.e. 256kB&lt;/li&gt;
&lt;li&gt;Size of each page is 0x400, i.e. 1kB&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Lets assume that there is no bootloader flashed to the chip and the application flash space is located at the last page in flash. If specifying 10 blocks, each with 16 bytes (like done in the example provided in &lt;a href="https://devzone.nordicsemi.com/question/15271/how-can-i-write-10kb-of-data-to-internal-flash/?answer=17300#post-id-17300"&gt;this thread&lt;/a&gt;), the first block is located at 0x40000 - 0x400 = 0x3FC00, the address of the second block is 0x3FC00 + 0x10 = 0x3FC10, the address of the third block is 0x3FC00 + 0x20 = 0x3FC20, and so on&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>