<?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</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/23020/dfu-problem</link><description>Hello, 
 I&amp;#39;m realizing dfu. 
 
 
 1st case - for test
NRF_LOG_PRINTF(&amp;quot;main start\r\n&amp;quot;);
// ******* main loop start ******* //
while (1)
{
enterBootloader(); 
 }
 
 
 
 Dfu works well. 
 
 
 2nd case - question
I call enterBootloader</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 01 Jul 2017 05:58:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/23020/dfu-problem" /><item><title>RE: dfu problem</title><link>https://devzone.nordicsemi.com/thread/90569?ContentTypeID=1</link><pubDate>Sat, 01 Jul 2017 05:58:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6bf2a9b6-bc03-4320-995c-11036514d7b4</guid><dc:creator>air</dc:creator><description>&lt;p&gt;I close this issue and answer again for file attachment.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: dfu problem</title><link>https://devzone.nordicsemi.com/thread/90567?ContentTypeID=1</link><pubDate>Thu, 29 Jun 2017 10:17:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43965ca1-5a56-4917-b994-bf1ade748ae7</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Please try to test using experimental_ble_app_buttonless_dfu example. The wait for 100ms doesn&amp;#39;t guarantee that the flash operation is success.&lt;/p&gt;
&lt;p&gt;Could you let me know why couldn&amp;#39;t you use what we have in enter_bootloader() in ble_dfu.c file ?&lt;/p&gt;
&lt;p&gt;Note that you can always debug the bootloader and check why it doesn&amp;#39;t enter DFU mode. The bootloader is not a black box. To debug the bootloader you need to change optimization to level 0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: dfu problem</title><link>https://devzone.nordicsemi.com/thread/90573?ContentTypeID=1</link><pubDate>Wed, 28 Jun 2017 02:22:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dcb2fbb6-3f8e-4383-95d9-ad75acc78cf0</guid><dc:creator>air</dc:creator><description>&lt;p&gt;I tried repetition and delay.
The result is same.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void enterBootloader(void)
{
#if 0			// old
	s_dfu_settings.enter_buttonless_dfu = true;
	(void)nrf_dfu_settings_write(flash_callback);
	sd_nvic_SystemReset();

#else
	uint8_t i;
	uint8_t result = 0;

	__disable_irq();
	nrf_delay_ms(100);

	s_dfu_settings.enter_buttonless_dfu = true;

	for(i=0; i&amp;lt;10; i++)
	{
		if(nrf_dfu_settings_write(flash_callback) == NRF_SUCCESS)
		{
			result = 1;
			break;
		}
		else
			nrf_delay_ms(200);
	}

	if(result)
	{
		nrf_delay_ms(100);
		sd_nvic_SystemReset();
	}
	else
	{

	}
#endif
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: dfu problem</title><link>https://devzone.nordicsemi.com/thread/90572?ContentTypeID=1</link><pubDate>Wed, 28 Jun 2017 02:20:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce92bf90-6cbb-454c-b64a-e030595a1479</guid><dc:creator>air</dc:creator><description>&lt;p&gt;The “doing other work” is to execute key function after some key input.
It&amp;#39;s not special work.
There I call the enterBootloader() for test.
This way I use now is the way your colleague suggested earlier.
Of course I might be wrong.
I want to send you my code.
So, I would like to know your personal mail if possible.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: dfu problem</title><link>https://devzone.nordicsemi.com/thread/90568?ContentTypeID=1</link><pubDate>Tue, 27 Jun 2017 09:35:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cddfec64-cb7c-41ab-8126-86ebb49dd6d8</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;What is that &amp;quot;doing other work&amp;quot; ? Please send your code snippet.&lt;/p&gt;
&lt;p&gt;I noticed that in your enterBootloader() code you triggered a reset right after nrf_dfu_settings_write(). This maybe not a good idea. Because nrf_dfu_settings_write() is not a blocking function. The flash is not written right after the call, but you need to wait for the call back before you can trigger the reset.&lt;/p&gt;
&lt;p&gt;What we did in flash_callback() is to try to disconnect after we have a flash call back. Then after that we trigger the reset.&lt;/p&gt;
&lt;p&gt;Again, I suggest you to test with unmodified dfu bootloader and unmodified experimental_ble_app_buttonless_dfu example.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: dfu problem</title><link>https://devzone.nordicsemi.com/thread/90570?ContentTypeID=1</link><pubDate>Tue, 27 Jun 2017 02:05:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17be4a2a-6d88-45c4-97d9-f2310014cd7d</guid><dc:creator>air</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;As in the above question, if enterBootloader() is executed directly in main, it enters into bootloader. But, If enterBootloader() is executed while doing other work, it doesn’t enter into bootloader.
I wonder if there are things to do before enterBootloader() call.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;As you mentioned, I tried the example dfu_secure(only blocked the FW version check).
The result is same.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;I am wondering why the application doesn’t run after dfu via nrfToolBox / dfu_secure. However, the application  runs normally after power off / on.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: dfu problem</title><link>https://devzone.nordicsemi.com/thread/90571?ContentTypeID=1</link><pubDate>Mon, 26 Jun 2017 09:13:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6be099e5-d6c7-45d7-8e8e-1abcc2d995ec</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Air,&lt;/p&gt;
&lt;p&gt;You mean sometimes you can enter the DFU bootloader sometimes you can&amp;#39;t?&lt;/p&gt;
&lt;p&gt;Could you try to test on a fresh copy of the SDK with no modification ? And state the steps you used to test.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>