<?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>Older DFU application valid issue</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/17246/older-dfu-application-valid-issue</link><description>Hello, 
 There have been some questions on the forum regarding the DFU and it&amp;#39;s zero value for the application CRC. However, none of them seem to address this question so I thought I would float it out here and see if anyone else has encountered this</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 26 Oct 2016 12:08:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/17246/older-dfu-application-valid-issue" /><item><title>RE: Older DFU application valid issue</title><link>https://devzone.nordicsemi.com/thread/66239?ContentTypeID=1</link><pubDate>Wed, 26 Oct 2016 12:08:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1494217-bc66-4430-ba51-ead4bd8c9e7d</guid><dc:creator>John</dc:creator><description>&lt;p&gt;Thanks Vidar! That confirms what I thought was happening.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Older DFU application valid issue</title><link>https://devzone.nordicsemi.com/thread/66241?ContentTypeID=1</link><pubDate>Wed, 26 Oct 2016 10:24:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e775e24-caab-4da1-b812-0ad84a717a01</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi John,&lt;/p&gt;
&lt;p&gt;you&amp;#39;re right, the empty flash check is clearly a mistake, I didn&amp;#39;t notice that. You can typecast it into a pointer and then deference it to make it work.&lt;/p&gt;
&lt;p&gt;The SD will report NRF_EVT_FLASH_OPERATION_ERROR if it failed to complete a flash operation. In that case the bootloader will reset itself (error handler) instead of trying it again as it is not expected to ever time out during an update. I know there have been made some bugfixes on the pstorage module since SDK 5.2.0, and maybe the problem related to the pstorage module itself and not time out in the softdevice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Older DFU application valid issue</title><link>https://devzone.nordicsemi.com/thread/66240?ContentTypeID=1</link><pubDate>Tue, 25 Oct 2016 15:33:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f5d500c-9641-49a7-afb6-ca77667832f7</guid><dc:creator>John</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Thanks for your response. Regarding the check for the empty flash mask, that is there but I think there is a problem with it. Doesn&amp;#39;t the DFU_BANK_0_REGION_START need to be a pointer? Because there is no way 0x14000 is going to equal 0xFFFFFFFF. I&amp;#39;m still recovering from a nasty cold so forgive me if I got that wrong.&lt;/p&gt;
&lt;p&gt;I was thinking the same thing on your second statement.&lt;/p&gt;
&lt;p&gt;One last question: Can&amp;#39;t the events that the stack sends up when flash operations complete return a result that is not NRF_SUCCESS? I believe I&amp;#39;ve seen that in the past and in this case it would trigger a reset in the middle of the bootload operation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Older DFU application valid issue</title><link>https://devzone.nordicsemi.com/thread/66238?ContentTypeID=1</link><pubDate>Tue, 25 Oct 2016 14:54:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aebe9c77-56dc-4c99-ba9f-6a2fd593c921</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;bootloader_app_is_valid() checks whether the first word DFU_BANK_0_REGION_START is erased or not. So it shouldn&amp;#39;t have started the application if BANK 0 was completely erased at least.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Do you have that check in your bootloader_app_is_valid() function?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// There exists an application in CODE region 1.
if (DFU_BANK_0_REGION_START == EMPTY_FLASH_MASK)
{
    return false;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That said, without CRC check you can&amp;#39;t be 100% sure if the image was partially erased/stored. A reset/timeout during the swap could have caused the device to get bricked as you described. I think might be safer to update the boot settings before erasing as you suggested:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;update_status.status_code = DFU_BANK_0_ERASED;

bootloader_dfu_update_process(update_status);     

// Erase BANK 0.
err_code = pstorage_raw_clear(&amp;amp;m_storage_handle_app, m_image_size);
APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Worst case is then that it will fall back into DFU mode rather than attempting to boot a non-existent application and cause a hardfault exception.&lt;/p&gt;
&lt;ol start="2"&gt;
&lt;li&gt;You could inject the CRC for bank 0 into  the application valid.hex you have, use nrfjprog to write it manually after loading the merged .hex file, or initialize the m_boot_settings with the CRC and app valid flag in your bootloader code ( .bank_0 = BANK_VALID_APP and .bank_0_crc = CRC of app.bin) .&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>