<?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>Run a function after successful DFU</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/23987/run-a-function-after-successful-dfu</link><description>I&amp;#39;ve looked through the Devzone, but couldn&amp;#39;t find an answer to my question. 
 We are looking to automate the OTA process. When our nRF52 device is charging, it advertises as being ready for DFU. We can then connect to the device with an Android phone</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 03 Aug 2017 22:28:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/23987/run-a-function-after-successful-dfu" /><item><title>RE: Run a function after successful DFU</title><link>https://devzone.nordicsemi.com/thread/94432?ContentTypeID=1</link><pubDate>Thu, 03 Aug 2017 22:28:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf8e7459-2240-461f-8916-bf3613cbec80</guid><dc:creator>koos</dc:creator><description>&lt;p&gt;Ah, somehow missed that function myself. That seems to be exactly what I need!
Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Run a function after successful DFU</title><link>https://devzone.nordicsemi.com/thread/94431?ContentTypeID=1</link><pubDate>Wed, 02 Aug 2017 10:58:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b73f4968-1b45-4bd9-b3d7-b49bc83ce411</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi koos,
assuming that you&amp;#39;re using the bootloader from our SDK, then the nRF52 will perform a soft-reset after a successful DFU, &lt;code&gt;see on_dfu_complete()&lt;/code&gt; in &lt;code&gt;dfu_req_handling.c&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;My suggestion would be to write a specific value to the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/power.html?cp=2_1_0_17_8_6#register.GPREGRET"&gt;GPREGRET&lt;/a&gt; register just before the NVIC_SystemReset() call. Upon entering the bootloader or later the application(depending on where you&amp;#39;re advertising that the device is ready for DFU) you can check the value of this register. If the register matches the value that indicates that a successful DFU was completed and you&amp;#39;re charging, then you stop advertising.&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>