<?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>Add function in secure bootloader ble</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/99153/add-function-in-secure-bootloader-ble</link><description>hi,I would like to ask a few questions about bootloader 
 SDK:17.1.0 CHIP:nrf52810. application: ble_app_uart (Added buttonless dfu service and successfully upgraded OTA) bootloader: secure bootloader ble At present, I want to add two functions. 1.One</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 04 May 2023 07:28:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/99153/add-function-in-secure-bootloader-ble" /><item><title>RE: Add function in secure bootloader ble</title><link>https://devzone.nordicsemi.com/thread/423678?ContentTypeID=1</link><pubDate>Thu, 04 May 2023 07:28:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb0b42ff-3f17-4ce3-a639-3c40dea3daa6</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Zicongkuang,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can find the main loop in&amp;nbsp;loop_forever() function in nrf_bootloader.c.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But I would suggest to use the timer to check for the button instead of using the main loop. Please take a look at nrf_bootloader_dfu_timers.c to see how we set up the WDT timer handler and the inactivity timer. You can add your own timer in (use an extra CC counter ).&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Add function in secure bootloader ble</title><link>https://devzone.nordicsemi.com/thread/423644?ContentTypeID=1</link><pubDate>Thu, 04 May 2023 03:34:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f52223c-5049-49cb-8787-7f1797639f13</guid><dc:creator>kenyon</dc:creator><description>&lt;p&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="0" data-group="0-0"&gt;oh, thank you very much.&lt;/span&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="1" data-group="0-1"&gt; Then I also want to ask a question about where is the mainloop of bootloader? I want to make him fall asleep by pressing 3s during the two minutes of DFU.&lt;/span&gt;&lt;span class="tgt color_text_0" data-section="0" data-sentence="2" data-group="0-2"&gt; So I need to check the mainloop to see if the keys have input.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Add function in secure bootloader ble</title><link>https://devzone.nordicsemi.com/thread/422913?ContentTypeID=1</link><pubDate>Fri, 28 Apr 2023 09:09:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1822033-65e3-41ca-a8d8-9c8ee31fd09b</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Zicongkuang,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My theory is that in your application you enters SYSTEM OFF after&amp;nbsp; the &lt;span&gt;ADV DURATION of 180 seconds&amp;nbsp;&lt;/span&gt;?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When waking up from SYSTEM OFF the device will reset. When resetting if you still press the button which if course you still because it&amp;#39;s wake up really fast and you still hold the button at that point, the bootloader will enter DFU mode.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My suggestion is to select one of these solutions:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1 - You don&amp;#39;t enter system OFF but instead simply put the device to sleep (System ON Idle).&amp;nbsp;You can choose to start advertising again if there is a button press.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2 - You enter System OFF ( this will safe more power consumption than #1) and in the bootloader you check for&amp;nbsp;RESETREAS register to see if you just wake up from SYSTEM OFF or you wake up from POWER RESET. If you wake up from SYSTEM OFF then you don&amp;#39;t enter DFU mode when a button is pressed. This is similar to what we do in&amp;nbsp;crc_on_valid_app_required() function, where we don&amp;#39;t check CRC if waking up from SYSTEM OFF.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;3 - You enter System OFF , and in the bootloader you don&amp;#39;t enter DFU mode if the button is not pressed for says 2 seconds. So if you release the button in less than 2 seconds you will not enter DFU mode. You can modify&amp;nbsp;dfu_enter_check() function to do that.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Add function in secure bootloader ble</title><link>https://devzone.nordicsemi.com/thread/422733?ContentTypeID=1</link><pubDate>Thu, 27 Apr 2023 12:15:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e48f8bd-2dad-4c2d-b1a2-5ad853423d4d</guid><dc:creator>kenyon</dc:creator><description>&lt;p&gt;&lt;span&gt;Oh, thank you very much for your answer! The first question has been taken care of.&lt;br /&gt;&lt;br /&gt;But the second question, I want to make sure, let&amp;#39;s say we set pin16 to NRF_BL_DFU_ENTER_METHOD_BUTTON_PIN。&lt;/span&gt;When APP ADV DURATION is set to 18000,which means that after three minutes, the device will go to sleep.&lt;span&gt;At this point, when I press the button(pin16), the device will enter dfu mode.&lt;/span&gt;&lt;span&gt;But this is not what I want, I want to press the button, I wake up directly into the application section.&lt;br /&gt;&lt;/span&gt;So what code do I need to change in the bootloader？&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Looking forward to your reply! Thank you&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&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: Add function in secure bootloader ble</title><link>https://devzone.nordicsemi.com/thread/422705?ContentTypeID=1</link><pubDate>Thu, 27 Apr 2023 10:58:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c9ade77-ded0-45d6-900f-1fc6b9e7dcd9</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Zicongkuang,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1. RTC1 is already used by nrf_bootloader_dfu_timer module. So you can&amp;#39;t define your own timer module.&amp;nbsp;&lt;br /&gt;However, what you can do is to modify nrf_bootloader_dfu_timer to add your own timer in. Your timer should be defined similar to&amp;nbsp;mp_inactivity and&amp;nbsp;mp_wdt_feed. As you can see in the code they use respectively CC[0] and CC[1] as the counter. You can add your own timer in and it can use either CC[2] or CC[3]:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;dfu_timer_t   m_timers[2] = {{.cc_channel = 0}, {.cc_channel = 1}}; //!&amp;lt; The timers used by this module.
dfu_timer_t * mp_inactivity = &amp;amp;m_timers[0];                         //!&amp;lt; Direct pointer to the inactivity timer, for convenience and readability.
dfu_timer_t * mp_wdt_feed   = &amp;amp;m_timers[1];  &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You will need to make&amp;nbsp;a similar function to&amp;nbsp;nrf_bootloader_wdt_feed_timer_start() function to start your timer and define your all callback in main.c or in your file to serve as the timeout handler function.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;2. As far as I know, that exactly how the DFU enter button should work. It only put the device to DFU mode when the device is booting. It has no effect when the device is already booted and the application is running.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>