<?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>sd_flash_write hangs after 10 words written</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/3926/sd_flash_write-hangs-after-10-words-written</link><description>Hi 
 I&amp;#39;m learning to use the sd_flash_write function to write words into flash memory. I&amp;#39;ve the SD enabled, but not advertising, so I&amp;#39;m able to debug. Scheduler is also initialized. 
 What I get, it is than when executing this little code: 
 buf[4</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 29 Sep 2014 06:46:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/3926/sd_flash_write-hangs-after-10-words-written" /><item><title>RE: sd_flash_write hangs after 10 words written</title><link>https://devzone.nordicsemi.com/thread/14130?ContentTypeID=1</link><pubDate>Mon, 29 Sep 2014 06:46:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:677aaa8f-a64f-4914-b7eb-1a4708811292</guid><dc:creator>Elena</dc:creator><description>&lt;p&gt;Hi again&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve discovered the problem. My fault: I wasn&amp;#39;t calling the scheduler from my loop. I&amp;#39;ve edited the code as follows:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;	for(i=10; i&amp;lt;256;i++){
		buf[0] = i;
		res = sd_flash_write(FLASH_DIR_LAST_PAGE+(i*4), (uint32_t *)buf, 1);
		TIMER_BASE_Delay(1000);
		**app_sched_execute();**
	}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Thanks for your help&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sd_flash_write hangs after 10 words written</title><link>https://devzone.nordicsemi.com/thread/14129?ContentTypeID=1</link><pubDate>Thu, 25 Sep 2014 17:21:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aad86bab-d032-443e-80f0-9fb642994356</guid><dc:creator>John</dc:creator><description>&lt;p&gt;I don&amp;#39;t know why the delay is not working for you. However, I don&amp;#39;t have your code so it is hard to tell. Does the call the sd_flash_write ever return anything other than NRF_SUCCESS?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sd_flash_write hangs after 10 words written</title><link>https://devzone.nordicsemi.com/thread/14128?ContentTypeID=1</link><pubDate>Thu, 25 Sep 2014 16:53:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9908d609-3f50-4eff-8e75-4ec0e9eba7c3</guid><dc:creator>Elena</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Thanks for your reply. You&amp;#39;re right: I&amp;#39;m waiting for one second in order to wait sufficient time to perform de operation. One second should be more than sufficient, so I don&amp;#39;t understand what&amp;#39;s happening.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll review my code and check the pstorage module.&lt;/p&gt;
&lt;p&gt;Thanks again,&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elena&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sd_flash_write hangs after 10 words written</title><link>https://devzone.nordicsemi.com/thread/14127?ContentTypeID=1</link><pubDate>Thu, 25 Sep 2014 15:35:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bfa2eea4-2c79-48b3-867c-de8a94aee931</guid><dc:creator>John</dc:creator><description>&lt;p&gt;The call to sd_flash_write returns before the write operation is complete. I&amp;#39;m guessing you know that since you have the delay in between calls to sd_flash_write. However, you really should be waiting for a flash system event before proceeding onto the next write operation.&lt;/p&gt;
&lt;p&gt;This is where pstorage is helpful as it will queue up to, I believe, 20 flash operations. So, you can fire off a number of flash operations and pstorage will take care of them. The flash events will come to you system event handler and you can then call the pstorage event handler and it will dequeue the next operation and run it. NOTE: You will want to check to make sure that the system event is a flash event before calling the pstorage event handler as it doesn&amp;#39;t screen the event type (at least it doesn&amp;#39;t in revision 5.2.0 of the SDK).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>