<?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>DFU - problem with moving data from external to internal flash</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/25872/dfu---problem-with-moving-data-from-external-to-internal-flash</link><description>Hi, 
 I&amp;#39;m working on modification of DFU Bootloader to use external flash instead of standard Dual-bank or Single-bank version. Now it works quite well, but I have problems with moving data received over BT and stored in external memory to Bank 0 (in</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 13 Oct 2017 11:21:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/25872/dfu---problem-with-moving-data-from-external-to-internal-flash" /><item><title>RE: DFU - problem with moving data from external to internal flash</title><link>https://devzone.nordicsemi.com/thread/101899?ContentTypeID=1</link><pubDate>Fri, 13 Oct 2017 11:21:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42b3e0ec-1ec2-4f1b-b000-b937da75a8c4</guid><dc:creator>Michal L.</dc:creator><description>&lt;p&gt;I was not sure, if I can call postvalidate function when there isn&amp;#39;t image in flash yet. So I decided to copy data from external to internal flash before.&lt;/p&gt;
&lt;p&gt;But..&lt;/p&gt;
&lt;p&gt;I probably found solution for my problem. It&amp;#39;s simmilar to your suggested idea - I just call wait_for_pending() at the end of each iteration. In that case it waits to finish store/erase operations and then start next iteration - this was exactly what I needed. :)&lt;/p&gt;
&lt;p&gt;Now I have to figure out, how to compare data in flash with data in page_buffer (in RAM), because nrf_dfu_mbr_compare() function probably doesn&amp;#39;t work in that case. But it&amp;#39;s another story... :)&lt;/p&gt;
&lt;p&gt;Thank you for your help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU - problem with moving data from external to internal flash</title><link>https://devzone.nordicsemi.com/thread/101898?ContentTypeID=1</link><pubDate>Fri, 13 Oct 2017 09:04:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8026a87-ad5c-47fc-88e3-08d0649609dc</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Not sure why you want to call nrf_dfu_app_continue() inside nrf_dfu_data_req(), why not let it run after the new image has been validated ? We do nrf_dfu_app_continue() after a reset and before the softdevice start to let the swapping image can run faster (because we can access flash directly, not requires softdevice)&lt;/p&gt;
&lt;p&gt;If you do flash activity when the softdevice is active, make sure you use nrf_fstorage_sd.c not the _nvmc.c one.&lt;/p&gt;
&lt;p&gt;When the softdevice is running, the operation is not blocking and you only register the command to the softdevice, so you need to check the call back to dequeue the number of queued activity.&lt;/p&gt;
&lt;p&gt;You can follow what we do when we call nrf_dfu_flash_store() in dfu_req_handling.c , we use dfu_data_write_handler() as the callback handler.&lt;/p&gt;
&lt;p&gt;Im not 100% sure why you have the issue you described, but what you can do is to make sure the last operation is finished m_flash_operations_pending=0 before you do next operation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU - problem with moving data from external to internal flash</title><link>https://devzone.nordicsemi.com/thread/101897?ContentTypeID=1</link><pubDate>Fri, 13 Oct 2017 05:40:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cee4bd65-06db-4b32-88d1-57ea4b8c7484</guid><dc:creator>Michal L.</dc:creator><description>&lt;p&gt;I&amp;#39;m using SDK 13.0.0, bootloader is based on example &lt;em&gt;bootloader_secure_ble&lt;/em&gt;.
My modified function &lt;code&gt;nrf_dfu_app_continue()&lt;/code&gt; is called in &lt;code&gt;nrf_dfu_data_req()&lt;/code&gt;, right before &lt;code&gt;nrf_dfu_postvalidate() call&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure if softdevice is running during the call, but I think so, because BT communication is still working.&lt;/p&gt;
&lt;p&gt;wait_for_queue() is function from nrf_dfu_settings.c, which I only made extern to use in other functions. Its code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;while (fs_queue_is_full())
{
        delay_operation();
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When I write only one page, it is OK - one page is correctly written.&lt;/p&gt;
&lt;p&gt;In SDK documentation there is comment to nrf_dfu_flash_store():
&lt;em&gt;With SoftDevice, the operation is complete when the fstorage event is received.&lt;/em&gt;
But I don&amp;#39;t now how to work with that, I tried to use shared bool variable, which was set true when event occured, but it didn&amp;#39;t work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU - problem with moving data from external to internal flash</title><link>https://devzone.nordicsemi.com/thread/101900?ContentTypeID=1</link><pubDate>Thu, 12 Oct 2017 12:41:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fdfa5158-3897-4caa-b57d-045b02de0679</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Could you let me know which SDK you are using ?&lt;/p&gt;
&lt;p&gt;When do you call nrf_dfu_app_continue() ?&lt;/p&gt;
&lt;p&gt;Do you have the softdevice running when you call that function ? If the softdevice is running, the access to NVMC peripheral is blocked and you shouldn&amp;#39;t use the function. We call nrf_dfu_app_continue() after we reset and have the softdevice not running.&lt;/p&gt;
&lt;p&gt;What do you have inside wait_for_queue() ?&lt;/p&gt;
&lt;p&gt;What if you try to write only 1 page ? So only the first nrf_dfu_flash_store() is called  ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>