<?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</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/34140/nrf52832-flash-erase</link><description>HI,All 
 Before I erase flash ,I must do memcpy(). I do not know why. 
 As follow, after i delete the function memcpy( (uint8_t*)&amp;amp;data_buff[0], pdata, len), when i write data[8]={0x01,02,03,04,05,06,07,08} to flash, I see the memory is 0x00, 0x00, 0x00</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 11 May 2018 07:05:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/34140/nrf52832-flash-erase" /><item><title>RE: nrf52832 flash erase</title><link>https://devzone.nordicsemi.com/thread/131665?ContentTypeID=1</link><pubDate>Fri, 11 May 2018 07:05:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce097896-dc59-4c4a-9e30-c546278d700f</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Ok, so you are sure that save_mac_buff&lt;strong&gt; &lt;/strong&gt;and data_buff are two separate buffers?&amp;nbsp;&amp;nbsp;The memcpy routine copies data from &amp;quot;pdata&amp;quot; to &amp;quot;data_buff&amp;quot;, which seems to be required to get the correct data stored. Where does&amp;nbsp;save_mac_buff get updated with pdata?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 flash erase</title><link>https://devzone.nordicsemi.com/thread/131602?ContentTypeID=1</link><pubDate>Thu, 10 May 2018 03:32:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc8b1c9f-dadb-46b1-8373-1e4c86405730</guid><dc:creator>amywei</dc:creator><description>&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;data_buff is not the source pointer,&amp;nbsp;&amp;nbsp;&lt;span&gt;the source pointer is&amp;nbsp;save_mac_buff&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Here is the fs_store operation&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void fs_evt_handler(fs_evt_t const * const evt, fs_ret_t result)
{
	if ( FS_EVT_STORE == evt-&amp;gt;id &amp;amp;&amp;amp; FS_SUCCESS == result )
	{
		printf(&amp;quot;flash store done\r\n&amp;quot;);
	}
	else if ( FS_EVT_ERASE == evt-&amp;gt;id &amp;amp;&amp;amp; FS_SUCCESS == result )
	{
//		printf(&amp;quot;flash erase done\r\n&amp;quot;);
		fs_store(&amp;amp;fs_config, fs_config.p_start_addr, save_mac_buff, 2, NULL);
	}
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 flash erase</title><link>https://devzone.nordicsemi.com/thread/131435?ContentTypeID=1</link><pubDate>Wed, 09 May 2018 06:00:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:420bdf33-d035-4ce9-8d92-e48eb2c52c3d</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Yes, you need to perform an erase before you can update flash content.&lt;/p&gt;
&lt;p&gt;Is data_buff the source pointer you are passing to&amp;nbsp;fs_store()? In that case you have to make sure that data_buff contains the data you want to store, which I assume is what the memcpy is doing here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 flash erase</title><link>https://devzone.nordicsemi.com/thread/131431?ContentTypeID=1</link><pubDate>Wed, 09 May 2018 03:00:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e54b7692-1cf9-475b-84fb-dbe817372b13</guid><dc:creator>amywei</dc:creator><description>&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Here is only erase flash.&amp;nbsp; I think&amp;nbsp; fs_erase(&amp;amp;fs_config, fs_config.p_start_addr, 1, NULL) is necessary.,but why function memcpy() is also necessary?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 flash erase</title><link>https://devzone.nordicsemi.com/thread/131345?ContentTypeID=1</link><pubDate>Tue, 08 May 2018 11:41:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54a2d76f-aa38-4d7d-9642-fb173b1b6711</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Both source and destination pointer must be word aligned, have you checked if pdata pointer is word aligned? You can enforce word alignment by using the __ALIGN() keyword when defining the variable.&lt;/p&gt;
&lt;p&gt;e.g.,&lt;strong&gt;__ALIGN(4)&lt;/strong&gt; static uin8_t pdata[128] ;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>