<?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>Problem writing/reading from flash</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/36017/problem-writing-reading-from-flash</link><description>Hi, 
 
 
 I&amp;#39;m having problem with flash storage. First it&amp;#39;s flashed with the writing code uncommented. Then I reflash it with the writing code commented like in the snippet posted below. 
 But when it&amp;#39;s reset or disconnected from power. The flash is erased</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 03 Jul 2018 08:46:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/36017/problem-writing-reading-from-flash" /><item><title>RE: Problem writing/reading from flash</title><link>https://devzone.nordicsemi.com/thread/138701?ContentTypeID=1</link><pubDate>Tue, 03 Jul 2018 08:46:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86087a3b-8a54-422c-9da8-5ddc9a2b4786</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;You are not using pointers correctly. The address has to be defined and used in a different way&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;int main(void)
{
    uint32_t err_code;

    err_code = NRF_LOG_INIT(NULL);
    APP_ERROR_CHECK(err_code);

    NRF_LOG_INFO(&amp;quot;Flashwrite example\r\n&amp;quot;);

    while (true)
    {
				uint32_t *address = (uint32_t *)0x1000108C;
				uint32_t valueReturn = 0; 
				
				uint32_t value = 0x12345678;
				flash_page_erase(address);
				flash_word_write(address, value);

        while (true)
        {
						nrf_delay_ms(1000);
            
						memcpy(&amp;amp;valueReturn, address, 1024);
					
						NRF_LOG_INFO(&amp;quot;&amp;#39;%x&amp;#39; was read from flash\r\n\r\n&amp;quot;, valueReturn);
            NRF_LOG_FLUSH();
        }
    }
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>