<?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>Question regarding application with DFU and bootloader</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/102631/question-regarding-application-with-dfu-and-bootloader</link><description>Hi All. I&amp;#39;m currently using softdevice S112 v7.2.0 with my application that uses BLE. 
 I want to add the possibility to update the application using OTA with the DFU and bootloader. 
 My question is, the application will have also the configuration of</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 10 Aug 2023 09:14:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/102631/question-regarding-application-with-dfu-and-bootloader" /><item><title>RE: Question regarding application with DFU and bootloader</title><link>https://devzone.nordicsemi.com/thread/440675?ContentTypeID=1</link><pubDate>Thu, 10 Aug 2023 09:14:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b29ab4d-3e24-4833-8600-e8d174c87467</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Clake,&amp;nbsp;&lt;br /&gt;Please make sure to add DEBUG to the preprocessor symbols in project setting. This will turn off the reset when an assert occurs.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question regarding application with DFU and bootloader</title><link>https://devzone.nordicsemi.com/thread/440623?ContentTypeID=1</link><pubDate>Thu, 10 Aug 2023 06:37:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b5327b8-075f-4f4a-81ac-56a682dc9a09</guid><dc:creator>clake</dc:creator><description>&lt;p&gt;Hi Hung Bui!&lt;/p&gt;
&lt;p&gt;Yes, I see usage when I build, but it does not say RAM usage, but yeah I can check the amount used in data+bss that is the RAM consumption.&lt;/p&gt;
&lt;p&gt;Great so I only have to check the RAM usage of my application, thanks for the confirmation.&lt;/p&gt;
&lt;p&gt;I was changing a little bit my application looking at ble buttonless dfu, but I can make it work yet, it is failing in the mail, I can see just one log an anything else, I have also changed the RAM start address. I&amp;#39;ll continue debugging and then try to tell more information about the error.&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question regarding application with DFU and bootloader</title><link>https://devzone.nordicsemi.com/thread/440550?ContentTypeID=1</link><pubDate>Wed, 09 Aug 2023 14:58:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e822316f-1132-4924-9ec8-e9400a1ac22f</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It&amp;#39;s been a while I didn&amp;#39;t use gcc, I assume you see the RAM and flash usage when you build.&amp;nbsp;&lt;br /&gt;&lt;a href="https://embeddedartistry.com/blog/2020/08/17/three-gcc-flags-for-analyzing-memory-usage/"&gt;https://embeddedartistry.com/blog/2020/08/17/three-gcc-flags-for-analyzing-memory-usage/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Please be aware that the bootloader and the application doesn&amp;#39;t run at the same time. So any RAM used by the bootloader is free after it switch to the application. So you don&amp;#39;t need to worry about the RAM used by the bootloader .&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question regarding application with DFU and bootloader</title><link>https://devzone.nordicsemi.com/thread/440519?ContentTypeID=1</link><pubDate>Wed, 09 Aug 2023 13:35:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b741387c-b024-4af5-9a2c-0da4ae430068</guid><dc:creator>clake</dc:creator><description>&lt;p&gt;Hi Hung Bui and again many thanks for all your replies!&lt;/p&gt;
&lt;p&gt;I think I have one more question. How can I know the use of RAM (I&amp;#39;m using armgcc to compile)? and also the bootloader uses RAM and when it start the application, the RAM that have use the bootloader is free? just to make sure that I have enough RAM for my application, since now it will have bootloader.&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question regarding application with DFU and bootloader</title><link>https://devzone.nordicsemi.com/thread/440489?ContentTypeID=1</link><pubDate>Wed, 09 Aug 2023 12:13:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12a21acc-b860-4bb7-bc29-bccedb222b09</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi again,&amp;nbsp;&lt;/p&gt;
[quote user="clake"]So, if I have to modify the behavior of the ble_dfu, for example to link in another GPIO instead of the pre-defined one, I have to modify it in that project right? This means that now my project will have the app (I have to merge my app and the example of ble buttonless dfu) and the secure bootloade[/quote]
&lt;p&gt;The bootloader and the application is two different entity.&amp;nbsp;They flashed separately and you don&amp;#39;t combine them. What you combine is the DFU buttonless service into your application and the only task this does is to reset the device to the bootloader.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you change the GPIO button that the bootloader used by default, you simply recompile the bootloader , not the application.&amp;nbsp;&lt;/p&gt;
[quote user="clake"], I &amp;#39;m also using NUS for ble in my application, this will lead to a conflict of having the ble buttonless dfu?[/quote]
&lt;p&gt;No, it should work fine if you combine them correctly.&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/48399/combining-ble-nus-and-buttonless-dfu"&gt;Combining BLE NUS and Buttonless DFU&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="clake"]If the application is ok and the bootloader take it as a good application but suddenly it, for some reason, doesn&amp;#39;t work, is there a way to enter in DFU mode without using a button?[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;No, the bootloader will always jump to the application if it&amp;#39;s a valid application. It wouldn&amp;#39;t know if it&amp;#39;s buggy or not. But what you can do is instead of (or inaddition to) entering DFU via a button you can&amp;nbsp;do a 10 seconds wait when booting up to enter DFU mode in such 10 seconds. If there is any connection in the 10 seconds then you can do DFU. After 10 seconds the bootloader can start the app.&amp;nbsp;&lt;/p&gt;
[quote user="clake"]If I want to put the system in deep-sleep and wake it up using a button, this configuration has to be made in the bootloader? or in the application? because I whant that my device start off and when I long-press a button it wake ups and start the system.[/quote]
&lt;p&gt;There is no option to wake up from a long press. We only have an option to put device in deep sleep and wake up from a GPIO interrupt. This mean it wouldn&amp;#39;t be able to detect if it&amp;#39;s a long press or short press. No code needed to detect this wake up source, it&amp;#39;s done in the hardware.&amp;nbsp;&lt;br /&gt;Implementing the code to put the device in deep sleep should be done in bootloader or application, it&amp;#39;s you to decide.&lt;/p&gt;
&lt;p&gt;You can implement the code in the bootloader so that if it&amp;#39;s power reset it will immediately enter deep sleep. If it&amp;#39;s wake up from power reset then it will enter application. Or you can implement the same thing in the application. It&amp;#39;s up to you.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question regarding application with DFU and bootloader</title><link>https://devzone.nordicsemi.com/thread/440475?ContentTypeID=1</link><pubDate>Wed, 09 Aug 2023 11:16:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad1806b6-1290-4937-9d2d-26ce9512eed7</guid><dc:creator>clake</dc:creator><description>&lt;p&gt;Yes, since I&amp;#39;m using nRF52810 I have to use a single bank update.&lt;/p&gt;
&lt;p&gt;I understand better now, thanks to your blog. So, if I have to modify the behavior of the ble_dfu, for example to link in another GPIO instead of the pre-defined one, I have to modify it in that project right? This means that now my project will have the app (I have to merge my app and the example of ble buttonless dfu) and the secure bootloader.&lt;/p&gt;
&lt;p&gt;Also one more question, I &amp;#39;m also using NUS for ble in my application, this will lead to a conflict of having the ble buttonless dfu?&lt;/p&gt;
&lt;p&gt;Another question: If the application is ok and the bootloader take it as a good application but suddenly it, for some reason, doesn&amp;#39;t work, is there a way to enter in DFU mode without using a button?&lt;/p&gt;
&lt;p&gt;EDIT: one more question: If I want to put the system in deep-sleep and wake it up using a button, this configuration has to be made in the bootloader? or in the application? because I whant that my device start off and when I long-press a button it wake ups and start the system.&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question regarding application with DFU and bootloader</title><link>https://devzone.nordicsemi.com/thread/440411?ContentTypeID=1</link><pubDate>Wed, 09 Aug 2023 07:51:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1301dc9-0d18-4c3f-8a54-cd20c3b04e0d</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Clake,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It depends on how you configure your bootloader, would it do single bank update or dual bank update. Please take a look here:&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_bootloader_dfu_banks.html?cp=9_1_3_5_1_2"&gt;https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_bootloader_dfu_banks.html?cp=9_1_3_5_1_2&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For dual bank update, the original is preserved and the new image is copied to a swap bank.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;For single bank update, the original application will be erased to get space to receive the new image. If the DFU process fail, it will fall back to the DFU bootloader and your device is only go back to normal operation after a successful update.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In your case, you use nRF52810 with limited flash space, I would assume you are using single bank update ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question regarding application with DFU and bootloader</title><link>https://devzone.nordicsemi.com/thread/440360?ContentTypeID=1</link><pubDate>Tue, 08 Aug 2023 18:12:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a202b4c-1dd1-40ae-be44-a2ab36724d08</guid><dc:creator>clake</dc:creator><description>&lt;p&gt;Hi Hung Bui, thank you for your answer.&lt;/p&gt;
&lt;p&gt;I meant the process of DFU. Does it first receive the application, then erase the application memory from the flash, and then start writing the new application? I can&amp;#39;t see where in the memory the new application is allocated. So, if the DFU process first deletes the app partition of the flash and the process fails, the application will be empty. That is my question.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll check out your blog!&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question regarding application with DFU and bootloader</title><link>https://devzone.nordicsemi.com/thread/440273?ContentTypeID=1</link><pubDate>Tue, 08 Aug 2023 10:22:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88ec2d7b-8e68-4da7-a75a-b91ebde9a314</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Clake,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Most of the DFU feature will be handled by the bootloader so if you plan to simply enter DFU mode by holding a button when the device reset or for example give a 15 seconds window when the device reboot to wait for DFU command then you don&amp;#39;t need to modify the application. Simply add DFU bootloader will work. Please follow the documentation or my blog &lt;a href="https://devzone.nordicsemi.com/guides/short-range-guides/b/software-development-kit/posts/getting-started-with-nordics-secure-dfu-bootloader"&gt;here&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However, if you plan to have &amp;quot;buttonless DFU&amp;quot; where the application would receive the DFU command via BLE when in operation to enter DFU mode, then you would need to implement buttonless service. Please take a look at the ble_app_buttonless_dfu example. It&amp;#39;s also covered in Appendix 3 in my blog above.&amp;nbsp;&lt;/p&gt;
[quote user=""]If the upload fails, the nrf52810 will be able to get a DFU from BLE?[/quote]
&lt;p&gt;I don&amp;#39;t get what you meant. If the DFU update fails it will return to the application and you would need to start DFU again.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>