<?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>nRF52832 flash erase problem:cannot erase the third page</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/26438/nrf52832-flash-erase-problem-cannot-erase-the-third-page</link><description>Hi, 
 Now I test flashwrite example using nRF52832 with software version V12.2.0. I want to erase all memory pages with the code bellow: 
 for(pg_num=0;pg_num&amp;lt;=pg_total_num;pg_num++)
 {
 addr = (uint32_t *)(pg_size * pg_num); //pg_size=4096 Bytes</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 01 Nov 2017 00:47:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/26438/nrf52832-flash-erase-problem-cannot-erase-the-third-page" /><item><title>RE: nRF52832 flash erase problem:cannot erase the third page</title><link>https://devzone.nordicsemi.com/thread/104028?ContentTypeID=1</link><pubDate>Wed, 01 Nov 2017 00:47:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:389ef72b-4edf-43b5-a21f-fe1762b1944f</guid><dc:creator>longycy</dc:creator><description>&lt;p&gt;Yes,I also think this is the problem. I cannot erase all pages becacase it will erase my code so that the system crash. Thank you very much!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 flash erase problem:cannot erase the third page</title><link>https://devzone.nordicsemi.com/thread/104029?ContentTypeID=1</link><pubDate>Tue, 31 Oct 2017 14:36:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8df4ab67-5c79-4782-8e42-44b354c29307</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Where in flash is your application located? Make sure you are not erasing any pages where the code is stored. Please refer the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.2.0/flashwrite_example.html?cp=4_0_5_4_5_9"&gt;flashwrite example&lt;/a&gt;, which shows how to erase &lt;strong&gt;the last page in flash&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;pg_size = NRF_FICR-&amp;gt;CODEPAGESIZE;
pg_num  = NRF_FICR-&amp;gt;CODESIZE - 1;  // Use last page in flash
// Start address:
addr = (uint32_t *)(pg_size * pg_num);
// Erase page:
flash_page_erase(addr);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 flash erase problem:cannot erase the third page</title><link>https://devzone.nordicsemi.com/thread/104027?ContentTypeID=1</link><pubDate>Tue, 31 Oct 2017 03:37:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31b7aabf-f3eb-4e94-9308-00553303aa04</guid><dc:creator>Vincent</dc:creator><description>&lt;p&gt;would you try these and pg_size is 1024 Words&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define PAGE_SIZE_WORDS 1024

// Retrieve the address of a page.
static uint32_t const * address_of_page(uint16_t page_num)
{
    return fs_config.p_start_addr + (page_num * PAGE_SIZE_WORDS);
}

void m_flash_erase_page_0(void)
{
	  erase_flag=1;
	  // Erase one page (page 0).
    fs_ret_t ret = fs_erase(&amp;amp;fs_config, address_of_page(0), 1, NULL);
    if( ret != FS_SUCCESS )
    {
        NRF_LOG_INFO(&amp;quot;fs_erase error\r\n&amp;quot;);
    }
		 while(erase_flag == 1) { power_manage(); }
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>