<?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</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69521/dfu</link><description>Hi, 
 
 I use a custom board, softdevice and boot loader. 
 
 I use DFU to update a slave chip firmware. Everything goes right until we invalidate and write flash : 
 // Invalidate bank, marking completion. nrf_dfu_bank_invalidate(&amp;amp;s_dfu_settings.bank_1</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 16 Dec 2020 14:55:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69521/dfu" /><item><title>RE: DFU</title><link>https://devzone.nordicsemi.com/thread/285384?ContentTypeID=1</link><pubDate>Wed, 16 Dec 2020 14:55:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21e33875-c5cf-4545-a058-d0796c41cf7c</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure I understand the setup, is the received image meant for an external device? In that case, is the image transferred to the other chip by your application or by your bootloader? And is the problem that you can&amp;#39;t clear the .bank_1 code after the update is complete?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU</title><link>https://devzone.nordicsemi.com/thread/285263?ContentTypeID=1</link><pubDate>Wed, 16 Dec 2020 09:46:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b233581-f252-4039-889f-aa1da614f27b</guid><dc:creator>Mikael</dc:creator><description>&lt;p&gt;yes understood the reason of hardfault.&lt;/p&gt;
&lt;p&gt;What I don&amp;#39;t understand is :&lt;/p&gt;
&lt;p&gt;why the function invalidate is not sufficient ?&lt;/p&gt;
&lt;p&gt;after loading zip file, bootloader call my app&lt;/p&gt;
&lt;p&gt;then we do this :&lt;/p&gt;
&lt;p&gt;&amp;nbsp; ret_code_t ret_val = &lt;strong&gt;nrf_dfu_settings_init&lt;/strong&gt;(false);&lt;br /&gt;&amp;nbsp; if (ret_val != NRF_SUCCESS)&lt;br /&gt;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //return NRF_ERROR_INTERNAL;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF_LOG_ERROR(&amp;quot;Impossible d&amp;#39;init nrf_dfu_settings_init&amp;quot;);&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; else&lt;br /&gt;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF_LOG_DEBUG(&amp;quot;s_dfu_settings bank 1 : 0x%02x&amp;quot;, s_dfu_settings.bank_1.bank_code);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (s_dfu_settings.bank_1.bank_code == NRF_DFU_BANK_VALID_EXT_APP)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p&gt;else the s_dfu_settings.bank_1.bank_code is never valid.&lt;/p&gt;
&lt;p&gt;but if I do this the s_dfu_settings.bank_1.bank_code is ALWAYS valide except if we wrote in MBR param.&lt;br /&gt;just want to understand why i need to erase MBR param.&lt;/p&gt;
&lt;p&gt;seems data are written by bootloader to inform data available but then restore at each reboot except if I wrote it back in MBR param&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU</title><link>https://devzone.nordicsemi.com/thread/285258?ContentTypeID=1</link><pubDate>Wed, 16 Dec 2020 09:34:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97f2482f-6137-4c42-a224-088b0f92437c</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;The hardfault happens because the app is not intented to have access the backup page (i.e, MBR param page), see my first post to see which fields the it&amp;#39;s permitted to change by default. But, if you want to give you give your app full write access, you can do so by disabling the flash protection in your bootloader as you already suggested.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU</title><link>https://devzone.nordicsemi.com/thread/285227?ContentTypeID=1</link><pubDate>Wed, 16 Dec 2020 08:14:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:566b638b-20aa-49a0-88ff-8101b12e99f0</guid><dc:creator>Mikael</dc:creator><description>&lt;p&gt;yes I confirm my feeling.&lt;/p&gt;
&lt;p&gt;hardfault arrive in nrf_dfu_settings_write_and_backup()&amp;nbsp; because it try to erase at adress 0x7e000.&lt;/p&gt;
&lt;p&gt;question : why?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU</title><link>https://devzone.nordicsemi.com/thread/285224?ContentTypeID=1</link><pubDate>Wed, 16 Dec 2020 07:57:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f80c3680-70d0-4e1e-9c1c-9300e6a4d635</guid><dc:creator>Mikael</dc:creator><description>&lt;p&gt;one more things&lt;/p&gt;
&lt;p&gt;in nrf_dfu_types.h i found this:&lt;/p&gt;
&lt;p&gt;#elif defined( NRF52832_XXAA )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #define BOOTLOADER_SETTINGS_ADDRESS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (0x0007F000UL)&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;and&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;#elif defined(NRF52832_XXAA)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #define NRF_MBR_PARAMS_PAGE_ADDRESS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (0x0007E000UL)&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;so area_size = BOOTLOADER_SIZE + NRF_MBR_PARAMS_PAGE_SIZE&lt;/p&gt;
&lt;p&gt;BOOTLOADER_SIZE = (NRF_MBR_PARAMS_PAGE_ADDRESS - BOOTLOADER_START_ADDR)&lt;/p&gt;
&lt;p&gt;NRF_MBR_PARAMS_PAGE_ADDRESS = 0x7e000&lt;/p&gt;
&lt;p&gt;BOOTLOADER_START_ADDR = 0x78000&lt;/p&gt;
&lt;p&gt;so BOOTLOADER_SIZE&amp;nbsp; = 0x6000&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;NRF_MBR_PARAMS_PAGE_SIZE = CODE_PAGE_SIZE&lt;/p&gt;
&lt;p&gt;CODE_PAGE_SIZE = 1024 * sizeof( uint32) == 1000&lt;/p&gt;
&lt;p&gt;area_size= 0x7000&lt;/p&gt;
&lt;p&gt;so evrything should work fine as the MBR settings start at 0x7f000.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;so why the nrf_dfu_settings_write_and_backup() function lead to hardfault handler ?&lt;/p&gt;
&lt;p&gt;maybe it try to access something that is not in BOOTLOADER settings but in MBR params?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU</title><link>https://devzone.nordicsemi.com/thread/285219?ContentTypeID=1</link><pubDate>Wed, 16 Dec 2020 07:22:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6bff127c-2135-4ce6-96ba-e600b23d4f87</guid><dc:creator>Mikael</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;maybe i found out why setting &lt;span&gt;NRF_BL_DFU_ALLOW_UPDATE_FROM_APP&lt;/span&gt; is not enough in our case.&lt;/p&gt;
&lt;p&gt;actually I look in details the bootloader and found this :&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; area_size = BOOTLOADER_SIZE + NRF_MBR_PARAMS_PAGE_SIZE;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!NRF_BL_DFU_ALLOW_UPDATE_FROM_APP &amp;amp;&amp;amp; !NRF_BL_DFU_ENTER_METHOD_BUTTONLESS &amp;amp;&amp;amp; !NRF_DFU_TRANSPORT_BLE)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; area_size += BOOTLOADER_SETTINGS_PAGE_SIZE;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ret_val = nrf_bootloader_flash_protect(BOOTLOADER_START_ADDR, area_size);&lt;/p&gt;
&lt;p&gt;in my case BOOTLOADER_SIZE is&lt;/p&gt;
&lt;p&gt;#define BOOTLOADER_SIZE (NRF_MBR_PARAMS_PAGE_ADDRESS - BOOTLOADER_START_ADDR)&lt;/p&gt;
&lt;p&gt;What I found is the following :&lt;/p&gt;
&lt;p&gt;actually it BOOTLOADER_START_ADDR&amp;nbsp; is 0x00078000 (in debug mode I look at nrf_bootloader_flash_protect() function)&lt;/p&gt;
&lt;p&gt;area_size is 0x7000.&lt;/p&gt;
&lt;p&gt;and so all the end of flash is then protected and then the bootloader settings as well.&lt;/p&gt;
&lt;p&gt;Maybe we have miss something here.&lt;/p&gt;
&lt;p&gt;Could you tell us more on this?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU</title><link>https://devzone.nordicsemi.com/thread/285148?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 15:20:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c6871ef-6bb6-48fa-8c58-e038423595c0</guid><dc:creator>Mikael</dc:creator><description>&lt;p&gt;in that case this part is not done :&lt;/p&gt;
&lt;p&gt;nrf_dfu_settings_write_and_backup()&lt;/p&gt;
&lt;p&gt;and the log message say this :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;nrf_dfu_settings: Copying forbidden parts from backup page.&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;source, write not needed. Skipping.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;and so after a power off/power on the binary is written again, but I don&amp;#39;t want this.&lt;/p&gt;
&lt;p&gt;Actually, what I want is the same behavior when my debugger is connected (the area can be written and all is fine)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;actually the only way I found to have a correct behavior was this : comment the flash protect in the bootloader&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp; ret_val = nrf_bootloader_flash_protect(BOOTLOADER_START_ADDR, area_size);&lt;br /&gt;&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp; ret_val = nrf_bootloader_flash_protect(0,&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrf_dfu_bank0_start_addr() + ALIGN_TO_PAGE(s_dfu_settings.bank_0.image_size));&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU</title><link>https://devzone.nordicsemi.com/thread/285130?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 14:51:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ffca38d-dc37-4dfb-aff3-e3d64747f236</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Yes, please try again with NRF_DFU_IN_APP&amp;nbsp; set to 1 in the app. This is probably the reason for the hardfault.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU</title><link>https://devzone.nordicsemi.com/thread/285128?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 14:49:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b72b3047-fa70-4d60-819a-66016976154b</guid><dc:creator>Mikael</dc:creator><description>&lt;p&gt;yes it my app that call nrf_dfu_settings_write_and_backup() at the end of our slave chip doanloading&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU</title><link>https://devzone.nordicsemi.com/thread/285127?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 14:48:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c71e4e0f-d737-4d87-9068-cb11832ed652</guid><dc:creator>Mikael</dc:creator><description>&lt;p&gt;I will try this &lt;/p&gt;
&lt;p&gt;&lt;span&gt;NRF_BL_DFU_ALLOW_UPDATE_FROM_APP&lt;/span&gt; set to 1 in bootloader &lt;/p&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;p&gt;NRF_DFU_IN_APP set to 1 in our app.&lt;/p&gt;
&lt;p&gt;Is that correct?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU</title><link>https://devzone.nordicsemi.com/thread/285126?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 14:45:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52337a57-9a16-4b50-a8cc-3f8e7dc81c50</guid><dc:creator>Mikael</dc:creator><description>&lt;p&gt;sorry but I don&amp;#39;t understand,&lt;/p&gt;
&lt;p&gt;we use nordic bootloader for DFU.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;then in our app we check if a new binary exist for our slave chip.&lt;/p&gt;
&lt;p&gt;we load it in our chip and it is OK&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;then we always have hardfault handler on nrf_dfu_settings_write_and_backup()&lt;/p&gt;
&lt;p&gt;even with &lt;span&gt;NRF_BL_DFU_ALLOW_UPDATE_FROM_APP&lt;/span&gt; set to 1&lt;/p&gt;
&lt;p&gt;please elaborate&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU</title><link>https://devzone.nordicsemi.com/thread/285124?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 14:43:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10710afa-6b59-40af-a383-60cfc2f45a94</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Is it your main application that calls&amp;nbsp;nrf_dfu_settings_write_and_backup(), and not the bootloader? In that case, make sure the app is compiled with the NRF_DFU_IN_APP flag enabled.&amp;nbsp; This will prevent the nrf_dfu_settings module from attempting to erase the flash page protected by the &lt;span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/bprot.html?cp=4_2_0_11#concept_gdr_qlx_vr"&gt;BPROT — Block protection&lt;/a&gt;&lt;/span&gt; peripheral. And note that BPROT protection is automatically disabled in debug interface mode.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU</title><link>https://devzone.nordicsemi.com/thread/285045?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 12:18:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ef0031d-c6c8-432d-93dd-849406c762b4</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Looks like you are handling DFU in the application code? In that case, you may find this post relevant: &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/69006/custom-dfu-process"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/69006/custom-dfu-process.&lt;/a&gt; Our bootloader enables write protection on the MBR param page at 0x7E000 by defaullt ( With BPROT if 52832 is used), which could explain the hardfault.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU</title><link>https://devzone.nordicsemi.com/thread/284957?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 08:47:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74b78108-8efe-4745-9782-368b43e32c0b</guid><dc:creator>Mikael</dc:creator><description>&lt;p&gt;static inline void wait_for_flash_ready(void)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy) {;}&lt;br /&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>