<?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 after flash erase, fails</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/3545/flash-write-after-flash-erase-fails</link><description>Hi 
 I&amp;#39;m using sd_flash_erase to clear a page in flash. The event NRF_EVT_FLASH_OPERATION_SUCCESS comes to my sys_evt_dispatcher. After the event has arrived I continue with sd_flash_write. 
 Now two different things can happen,
If the page was already</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 20 Aug 2014 14:11:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/3545/flash-write-after-flash-erase-fails" /><item><title>RE: Flash write after flash erase, fails</title><link>https://devzone.nordicsemi.com/thread/12836?ContentTypeID=1</link><pubDate>Wed, 20 Aug 2014 14:11:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99943589-8fc5-4680-8f19-bd042a585950</guid><dc:creator>H&amp;#229;kan Wennerholm</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank yo for the answer.&lt;/p&gt;
&lt;p&gt;The values of my pointers are the same in both cases, sorry I forgot to write that in my initial question.
I check the content of the flash with a memory window in the Keil-debugger.
When I see only FF:s there the erase works, event triggers, write works and event triggers again.
If I see something else but FF:s then the erase works and triggers its event, but the following write fails even though the pointer values are exactly the same as in the previous run.&lt;/p&gt;
&lt;p&gt;Best regards
/Håkan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash write after flash erase, fails</title><link>https://devzone.nordicsemi.com/thread/12835?ContentTypeID=1</link><pubDate>Wed, 20 Aug 2014 13:17:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a79af531-e4db-44a1-b818-7282ba9cde2b</guid><dc:creator>John</dc:creator><description>&lt;p&gt;That error code should only be returned in two cases: 1) Your flash address (p_dst) is out of the flash memory range; 2) Either of your p_src and p_dst pointers are not aligned to a 4 byte boundary. I do not believe that sd_flash_write checks that the page is empty before it writes. Can you verify in the failure case what the values of the pointers are?&lt;/p&gt;
&lt;p&gt;How do you know the page is empty or not when this failure occurs?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>