<?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>OTA DFU with a timer and no button</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/44641/ota-dfu-with-a-timer-and-no-button</link><description>Hi, 
 I just learned how to do a OTA DFU. I tried it with nrf52840 DK and was successful in it, but our custom board does not have a button on it. In production we will like the board to start always in the DFU mode when powered ON and look for new packages</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 19 Mar 2019 12:20:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/44641/ota-dfu-with-a-timer-and-no-button" /><item><title>RE: OTA DFU with a timer and no button</title><link>https://devzone.nordicsemi.com/thread/176991?ContentTypeID=1</link><pubDate>Tue, 19 Mar 2019 12:20:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d9f200e-b866-45dd-a39c-d6086d8cecbc</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;The program execution is always starting in the bootloader, then it either enters DFU mode or the main application (depending on different conditions).&amp;nbsp;That is the reason you enter the bootloader after performing a DFU, since it goes directly to the bootloader, sets the&amp;nbsp;&amp;nbsp;GPREGRET register, and enters DFU mode again.&lt;/p&gt;
&lt;p&gt;The normal way of&amp;nbsp;doing it is to set the&amp;nbsp;GPREGRET&amp;nbsp;register in the main application and then restarting the chip through&amp;nbsp;NVIC_SystemReset() or&amp;nbsp;sd_nvic_SystemReset() (see &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/12606/jumping-to-bootloader-from-the-application"&gt;this&lt;/a&gt; ticket for more information).&amp;nbsp;Earlier I said that you didn&amp;#39;t need to modify the application, and I am sorry for that, I am still learning about the DFU and don&amp;#39;t know how it all works.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As I understand it, you would like to achieve the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="text-decoration:underline;"&gt;Enter DFU mode and stay there for 30 seconds --&amp;gt;&amp;nbsp;Boot&amp;nbsp;the application&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are several ways of achieving this&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Start the bootloader--&amp;gt;Enter the application--&amp;gt;Press the reset button and start the bootloader--&amp;gt;&lt;span style="text-decoration:underline;"&gt;Enter DFU mode and stay there for 30 seconds --&amp;gt;&amp;nbsp;Boot&amp;nbsp;the application&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;Ask Vidar in the private tickets if you have problems doing this&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Start the bootloader--&amp;gt;Enter the application--&amp;gt;set the&amp;nbsp;GPREGRET register and restart the chip--&amp;gt;&lt;span style="text-decoration:underline;"&gt;Enter DFU mode and stay there for 30 seconds--&amp;gt; &lt;span&gt;Boot&lt;/span&gt; the application&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;Here you would need to modify the application to only start the bootloader (and DFU mode) the first time:
&lt;ul&gt;
&lt;li&gt;One approach is to&amp;nbsp;add a characteristic to your application, and do this by writing to it.&lt;/li&gt;
&lt;li&gt;Another approach is to create a variable in flash that&amp;nbsp;checks if the application is running for the first time, and&amp;nbsp;start/not start the bootloader depending on that&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Use the DFU buttonless example&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU with a timer and no button</title><link>https://devzone.nordicsemi.com/thread/176502?ContentTypeID=1</link><pubDate>Fri, 15 Mar 2019 16:32:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0eda1838-54d1-44a1-a060-169790599a6e</guid><dc:creator>arshdeep</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;I tried that:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;And now when I try to do DFU using nrfconnect mobile app. It goes till 100% but the board remains in DFU mode. May be it does flashes my new application but switches back to DFU mode within milliseconds. What will I have to do stop this ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;int main(void)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t ret_val;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp; sd_power_gpregret_set(0, 0xB1);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong&gt; nrf_power_gpregret_set(0xA5);&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Protect MBR and bootloader code from being overwritten.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ret_val = nrf_bootloader_flash_protect(0, MBR_SIZE, false);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; APP_ERROR_CHECK(ret_val);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ret_val = nrf_bootloader_flash_protect(BOOTLOADER_START_ADDR, BOOTLOADER_SIZE, false);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; APP_ERROR_CHECK(ret_val);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (void) NRF_LOG_INIT(app_timer_cnt_get);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF_LOG_DEFAULT_BACKENDS_INIT();&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF_LOG_INFO(&amp;quot;Inside main&amp;quot;);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ret_val = nrf_bootloader_init(dfu_observer);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; APP_ERROR_CHECK(ret_val);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrf_bootloader_app_start();&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Should never be reached.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF_LOG_INFO(&amp;quot;After main&amp;quot;);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Please suggest&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU with a timer and no button</title><link>https://devzone.nordicsemi.com/thread/176176?ContentTypeID=1</link><pubDate>Thu, 14 Mar 2019 12:31:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0d81c9e-d2cb-4e66-a8b6-5b7c8cfa9b89</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Try&amp;nbsp;using the call&amp;nbsp;&lt;em&gt;nrf_power_gpregret_set()&amp;nbsp;&lt;/em&gt;instead. I tried running &lt;span&gt;&lt;em&gt;sd_power_gpregret_set()&lt;/em&gt; similar as you and did not get the return value&amp;nbsp;NRF_SUCCESS. I think this is because the SoftDevice enable function isn&amp;#39;t called yet.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Simon&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU with a timer and no button</title><link>https://devzone.nordicsemi.com/thread/176054?ContentTypeID=1</link><pubDate>Wed, 13 Mar 2019 21:38:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4ad0b59-dea8-46b7-b279-9cdf5923aa4c</guid><dc:creator>arshdeep</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;My reset button is not working on custom board. So I tried writing to GPREGRET register to switch to DFU mode.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In sdk_config.h I wrote 1 to&amp;nbsp;NRF_BL_DFU_ENTER_METHOD_GPREGRET&lt;/p&gt;
&lt;p&gt;#ifndef NRF_BL_DFU_ENTER_METHOD_GPREGRET&lt;br /&gt;#define NRF_BL_DFU_ENTER_METHOD_GPREGRET 1&lt;br /&gt;#endif&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;and in the main function wrote&amp;nbsp;sd_power_gpregret_set(0, 0xB1);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;int main(void)&lt;br /&gt;{&lt;br /&gt; uint32_t ret_val;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; sd_power_gpregret_set(0, 0xB1);&lt;br /&gt;&lt;br /&gt; ret_val = nrf_bootloader_flash_protect(0, MBR_SIZE, false);&lt;br /&gt; APP_ERROR_CHECK(ret_val);&lt;br /&gt; ret_val = nrf_bootloader_flash_protect(BOOTLOADER_START_ADDR, BOOTLOADER_SIZE, false);&lt;br /&gt; APP_ERROR_CHECK(ret_val);&lt;/p&gt;
&lt;p&gt;(void) NRF_LOG_INIT(app_timer_cnt_get);&lt;br /&gt; NRF_LOG_DEFAULT_BACKENDS_INIT();&lt;/p&gt;
&lt;p&gt;NRF_LOG_INFO(&amp;quot;Inside main&amp;quot;);&lt;/p&gt;
&lt;p&gt;ret_val = nrf_bootloader_init(dfu_observer);&lt;br /&gt; APP_ERROR_CHECK(ret_val);&lt;br /&gt; nrf_bootloader_app_start();&lt;br /&gt; NRF_LOG_INFO(&amp;quot;After main&amp;quot;);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But it is not working . When I Power reset the board, it still remains in the application and does not enter in DFU mode.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What am I missing here ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU with a timer and no button</title><link>https://devzone.nordicsemi.com/thread/175956?ContentTypeID=1</link><pubDate>Wed, 13 Mar 2019 13:38:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d6d8f50-5886-4727-b24b-36a6161ebaaf</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;You don&amp;#39;t need to change your application or use the buttonless DFU example in order to enter DFU mode on startup, it can be achieved by modifying the bootloader. I saw that you created a new ticket, where the reset pin is used to enter DFU mode, and I think that is the right approach.&lt;/p&gt;
&lt;p&gt;In order to switch back to the application after 30 seconds you have to set&amp;nbsp;NRF_BL_DFU_INACTIVITY_TIMEOUT_MS equal to 30000.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU with a timer and no button</title><link>https://devzone.nordicsemi.com/thread/175865?ContentTypeID=1</link><pubDate>Wed, 13 Mar 2019 09:55:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b13c3a33-23eb-4d62-802f-b445234160c0</guid><dc:creator>arshdeep</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Yes . He says just Enter the DFU mode on startup and then use a timeout&amp;nbsp; .&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But how to enter in DFU mode in start up?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU with a timer and no button</title><link>https://devzone.nordicsemi.com/thread/175863?ContentTypeID=1</link><pubDate>Wed, 13 Mar 2019 09:50:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:80f1260b-5e2d-4eab-acc0-5dd6bd5c112e</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I can see that my colleague has answered your question in ticket&amp;nbsp;222994. If you want me to elaborate more about anything, please ask.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU with a timer and no button</title><link>https://devzone.nordicsemi.com/thread/175752?ContentTypeID=1</link><pubDate>Tue, 12 Mar 2019 16:28:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b532609-afa3-4cb0-89cb-5274bba7d522</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I will try to provide you with an answer by thursday/friday.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>