<?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 by app using MTP</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/77902/dfu-by-app-using-mtp</link><description>Hi my application will be based on nRF52820 and has only USB connection (no BLE). I&amp;#39;m developping with nRF5_SDK_17.0.2_d674dde and a nRF52840 devkit. The end user should be able to update the firmware without any tools. Thus I implemented Media Transfer</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 29 Aug 2021 12:31:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/77902/dfu-by-app-using-mtp" /><item><title>RE: DFU by app using MTP</title><link>https://devzone.nordicsemi.com/thread/327074?ContentTypeID=1</link><pubDate>Sun, 29 Aug 2021 12:31:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9eae597d-a8ef-477a-baaa-bd9086da7b40</guid><dc:creator>peterz</dc:creator><description>&lt;p&gt;Hi again&lt;br /&gt;finally SOLVED (pfff...)&lt;br /&gt;the last problem was a misunderstanding on my side. As debugging bootloader mechanics with Segger Studio tends to be complicated (is it possible at all?) I used J-Link RTT Viewer to see bootloader debug output.&lt;br /&gt;But it seems to me that a restart causes RTT Viewer to lose connection (reset might clear RTT buffers?).&lt;br /&gt;This led me to the wrong conclusion that bootloader is not started by MBR.&lt;br /&gt;I added 20 seconds wait in the bootloader code -&amp;nbsp; enough time to stop/restart JRTT Viewer and see bootloader messages until the new firmware image is installed and takes control.&lt;br /&gt;&lt;br /&gt;What other developer should know when they are implementing application based firmware update:&lt;/p&gt;
&lt;p&gt;a) after a reset the MBR takes control, calls the bootloader which in turn calls whatever sits at 0x00001000 (softdevice or application)&lt;/p&gt;
&lt;p&gt;b) &amp;lt;SDK&amp;gt;/examples/peripheral/blinky/pca10056/mbr/armgcc/blinky_gcc_nrf52.ld is your friend. Make sure you understand&lt;br /&gt;&amp;nbsp;&amp;nbsp; FLASH (rx) : ORIGIN = 0x1000, LENGTH = 0xff000&lt;br /&gt;&amp;nbsp;&amp;nbsp; RAM (rwx) :&amp;nbsp; ORIGIN = 0x20000008, LENGTH = 0x3fff8&lt;/p&gt;
&lt;p&gt;c) VERY PAINFUL to find: for my application I used &amp;lt;SDK&amp;gt;/examples/peripheral/usbd_hid_composite&lt;br /&gt;&amp;nbsp;&amp;nbsp; For most of the development I used Segger Studio. But for deployment I used armgcc.&lt;br /&gt;&amp;nbsp;&amp;nbsp; In Segger Studio the code worked and at the beginning the GCC version worked as well.&lt;br /&gt;&amp;nbsp;&amp;nbsp; You don&amp;#39;t want to read about the journey it took to find the following:&lt;br /&gt;&amp;nbsp;&amp;nbsp; the GCC Makefile of the example says&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Optimization flags&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OPT = -O3 -g3&lt;br /&gt;&amp;nbsp;&amp;nbsp; while the Segger project says&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gcc_optimization_level=&amp;quot;Optimize For Size&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp; Setting OPT = -Os in Makefile did the trick.&lt;br /&gt;&amp;nbsp;&amp;nbsp; Why/where/what gets broken by -O3 -g3 I don&amp;#39;t know and I will not find out&lt;/p&gt;
&lt;p&gt;d) the bootloader concept covers successfully many complex questions.&lt;br /&gt;&amp;nbsp;&amp;nbsp; But the idea that an application takes care of firmware transport is not really supported.&lt;br /&gt;&amp;nbsp;&amp;nbsp; Read the source files in &amp;lt;SDK&amp;gt;/components/libraries/bootloader&lt;br /&gt;&amp;nbsp;&amp;nbsp; Wrong expectations lead to lots of wasted hours.&lt;br /&gt;&amp;nbsp;&amp;nbsp; Beware: if the bootloader has no clue yet about the installed application nrf_dfu_bank1_start_addr() will return 0x00001000&lt;/p&gt;
&lt;p&gt;e) depending on what you want to achieve (how close/far your use case is to the standard DFU procedure) it will take 1 hour - or 1 month.&lt;br /&gt;&amp;nbsp;&amp;nbsp; REFUSE a deadline for the implementation - it takes what it takes&lt;/p&gt;
&lt;p&gt;f) I could not open the COM port with nrfutil for USB-Serial DFU.&lt;br /&gt;&amp;nbsp;&amp;nbsp; get a precompiled binary from &lt;a href="https://github.com/NordicSemiconductor/pc-nrfutil/releases/"&gt;github.com/.../&lt;/a&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; (I agree: downloading a precompiled EXE for python based application is weird. But I spent 5 hours&lt;br /&gt;&amp;nbsp;&amp;nbsp; on Windows 8.1, Windows 10 and a Debian Linux trying python 2.7, 3.6, 3.8 - nothing worked)&lt;/p&gt;
&lt;p&gt;g) note: the debug versions of examples/dfu/secure_bootloader/... not only add debug output but also size because a lot more code is linked. As a consequence the bootloader base address moves away from 0x000F8000&lt;/p&gt;
&lt;p&gt;h) the function nrf_bootloader_app_start_final() used within the bootloader to launch the application tries to nrf_bootloader_flash_protect() which can cause the bootloader to reboot, creating an infinite loop without ever calling the application. I don&amp;#39;t understand this (something to do with interrupts which are disabled just before the function?). This problem does not arise with the application&amp;nbsp; /examples/dfu/secure_dfu_test_images/uart/nrf52840/blinky_mbr.hex (only with my own app - I have not the faintest idea why)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU by app using MTP</title><link>https://devzone.nordicsemi.com/thread/326950?ContentTypeID=1</link><pubDate>Fri, 27 Aug 2021 09:56:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:baae0c0e-af4c-46e1-9f8d-1f03301066b9</guid><dc:creator>peterz</dc:creator><description>&lt;p&gt;Hi Sigurd&lt;/p&gt;
&lt;p&gt;the HEX file of the bootloader ends with&lt;br /&gt;:020000041000EA&lt;br /&gt;:0410140000800F0049&lt;br /&gt;:0410180000E00F00E5&lt;br /&gt;:04000003F00082B5D2&lt;br /&gt;which writes UICR registers&lt;/p&gt;
&lt;p&gt;double checking:&lt;br /&gt;nrfjprog&amp;nbsp; --memrd 0x10001014 0x04 0x01&lt;br /&gt;0x10001014: 000F8000&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |....|&lt;br /&gt;&lt;br /&gt;nrfjprog&amp;nbsp; --memrd 0x10001018 0x04 0x01&lt;br /&gt;0x10001018: 000FE000&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |....|&lt;/p&gt;
&lt;p&gt;and most important: the bootloader gets started as long as there is no blinky app.&lt;br /&gt;IMHO this proves the MBR knows the starting address of the bootloader.&lt;/p&gt;
&lt;p&gt;Adding the blinky app with nrfjprog (without touching anything else! UICR is NOT modified, just checked again) alters the situation: MBR ignores the bootloader and starts blinky.&lt;/p&gt;
&lt;p&gt;IMHO this is at least unexpected. You never encounter this situation for the whole concept of the bootloader is based on the idea, that the first application is loaded by the bootloader (not the app). So setting the UICR vector is not enough. The bootloader does something more - something that I do not do. But what???&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU by app using MTP</title><link>https://devzone.nordicsemi.com/thread/326942?ContentTypeID=1</link><pubDate>Fri, 27 Aug 2021 09:35:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf6eb21e-3748-4c12-8a7a-5bb6c03a4c4a</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;We have some MBR documentation here:&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/sds_s140/SDS/s1xx/mbr_bootloader/bootloader.html"&gt;https://infocenter.nordicsemi.com/topic/sds_s140/SDS/s1xx/mbr_bootloader/bootloader.html&lt;/a&gt;&lt;/p&gt;
[quote user="zankl"]To find out why MBR prefers starting the app instead of the bootloader[/quote]
&lt;p&gt;&amp;nbsp;From the docs:&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:rgba(228, 237, 245, 1);"&gt;&lt;em&gt;The BOOTLOADERADDR address can be provided either at the&amp;nbsp;&lt;code&gt;MBR_BOOTLOADER_ADDR&lt;/code&gt;&amp;nbsp;flash memory location, which is defined in&amp;nbsp;&lt;span&gt;nrf_mbr.h&lt;/span&gt;, or in the UICR.NRFFW[0] register.&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;/em&gt;So if this is not done, MBR will not start the bootloader.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU by app using MTP</title><link>https://devzone.nordicsemi.com/thread/326866?ContentTypeID=1</link><pubDate>Thu, 26 Aug 2021 20:58:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20dedd8d-1b4a-476b-b2c3-c5ced80fb260</guid><dc:creator>peterz</dc:creator><description>&lt;p&gt;Hi again&lt;br /&gt;as I can bear 3-4 hours of frustration per day I make very little progress&lt;br /&gt;I boiled it all down to a simple question (see below):&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfjprog -f nrf52 --halt
nrfjprog -f nrf52 --eraseall
nrfjprog -f nrf52 --program &amp;lt;myOwnBootloader.hex&amp;gt;
nrfjprog -f nrf52 --program nRF5_SDK_17.0.2_d674dde/components/softdevice/mbr/hex/mbr_nrf52_2.4.1_mbr.hex
nrfjprog -f nrf52 --reset
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;My bootloader gets started and produces empty bootloader settings at 0x000FF000 and an identical backup at 0x000FE000&lt;br /&gt;This is essentially unmodified code and expected behaviour (taken from an example, just removed the transport).&lt;br /&gt;&lt;br /&gt;Then I add the blinky MBR example image&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfjprog -f nrf52 --program nRF5_SDK_17.0.2_d674dde/examples/dfu/secure_dfu_test_images/uart/nrf52840/blinky_mbr.hex
nrfjprog -f nrf52 --reset
&lt;/pre&gt;&lt;br /&gt;result: MBR does NOT call bootloader anymore but starts directly blinky&lt;br /&gt;But if the bootloader is not called anymore it has no chance to ever install the new image I prepare within my app.&lt;br /&gt;To find out why MBR prefers starting the app instead of the bootloader I compared bootloader settings produced by examples with settings I produced myself. I found only one candidate which could explain what I see, the structure&amp;nbsp;nrf_dfu_settings_t member&lt;br /&gt;&amp;nbsp; boot_validation_t&amp;nbsp; boot_validation_bootloader&lt;br /&gt;&lt;br /&gt;That would make sense: MBR could check validity of the bootloader.&lt;br /&gt;So I tried to reproduce the values I found in the examples - I failed.&lt;br /&gt;Then I tried to guess (and failed again):&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;mySettings.boot_validation_bootloader.type = VALIDATE_CRC;
crc = crc32_compute((uint8_t*)0x000F8000, 0x000FE000 - 0x000F8000, NULL);
*(uint32_t *)&amp;amp;(mySettings.boot_validation_bootloader.bytes[0]) = crc;
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now I&amp;#39;m out of ideas and there&amp;#39;s no MBR source to check:&lt;br /&gt;MBR calls the bootloader as long as there&amp;#39;s no application.&lt;br /&gt;But why does MBR not call the bootloader as soon as there&amp;#39;s the blinky app?&lt;br /&gt;&lt;br /&gt;Maybe you could copy/paste the few lines of MBR code that show how/hwy the bootloader is ruled out?&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU by app using MTP</title><link>https://devzone.nordicsemi.com/thread/326143?ContentTypeID=1</link><pubDate>Mon, 23 Aug 2021 10:23:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea841c0f-8bf4-4697-b40c-eae227cc5a96</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="zankl"]Now I guess my path to succes should be:[/quote]
&lt;p&gt;&amp;nbsp;Correct.&lt;/p&gt;
[quote user="zankl"]interesting and not yet understood: 8 bytes of RAM are skipped - why?[/quote]
&lt;p&gt;&amp;nbsp;T&lt;span&gt;he first 8 bytes are used by the MBR for interrupt forwarding.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU by app using MTP</title><link>https://devzone.nordicsemi.com/thread/326055?ContentTypeID=1</link><pubDate>Sun, 22 Aug 2021 13:37:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:39757d93-a01c-410d-9a6b-22c1cfd9f0b4</guid><dc:creator>peterz</dc:creator><description>&lt;p&gt;Hi&lt;br /&gt;after further investigation I think the missing piece in my picture is MBR. Its source code is not available so I have to guess.&lt;br /&gt;The RESET vector points to the code in MBR. If the MBR code detects a bootloader it passes control to this bootloader. Otherwise it calls an application at 0x1000 (aka softdevice). &lt;/p&gt;
&lt;p&gt;Helpful: the blinky example comes in 2 flavours - blank and MBR. The difference between the linker files is&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;$ diff blank/armgcc/blinky_gcc_nrf52.ld mbr/armgcc/blinky_gcc_nrf52.ld
&amp;lt;   FLASH (rx) : ORIGIN = 0x0, LENGTH = 0x100000
&amp;lt;   RAM (rwx) :  ORIGIN = 0x20000000, LENGTH = 0x40000
---
&amp;gt;   FLASH (rx) : ORIGIN = 0x1000, LENGTH = 0xff000
&amp;gt;   RAM (rwx) :  ORIGIN = 0x20000008, LENGTH = 0x3fff8
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The MBR version puts blinky in the position of the softdevice (interesting and not yet understood: 8 bytes of RAM are skipped - why?)&lt;/p&gt;
&lt;p&gt;Now I guess my path to succes should be:&lt;br /&gt;a) move my application code to 0x1000 (reserving 8 bytes of RAM) to put it in place of the softdevice&lt;br /&gt;b) add MBR&lt;/p&gt;
&lt;p&gt;best regards, Peter&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU by app using MTP</title><link>https://devzone.nordicsemi.com/thread/325765?ContentTypeID=1</link><pubDate>Thu, 19 Aug 2021 13:35:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b84094b-c7d5-4ca0-8b12-bf84adeb0293</guid><dc:creator>peterz</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;after checking my DFU for days I find that everything would work - except booting. The application prepares bank1, the bootloader settings and reboots. But the CPU does definitely NOT execute the bootloader but restarts the application instead.&lt;/p&gt;
&lt;p&gt;On the other hand: all is in place and I step through the bootloader in Segger Studio. It perfectly recognizes the new image, copies bank1 to bank0, updates bootloader settings and MBR (settings backup), restarts the bootloader, detects there^s nothing left to do...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case ACTIVATION_NONE:&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; nrf_bootloader_app_start();&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; break;&lt;br /&gt;and nrf_bootloader_app_start() ends up somewhere in Nirwana but not in the app.&lt;/p&gt;
&lt;p&gt;Yes, UICR settings are correct and checked (snippet from bootloader hex):&lt;br /&gt;:02 0000 04 1000&amp;nbsp; EA&lt;br /&gt;:04 1014 00 00800F00&amp;nbsp; 49&lt;br /&gt;:04 1018 00 00E00F00&amp;nbsp; E5&lt;/p&gt;
&lt;p&gt;I have the bootloader and a valid app in place and do a power up: &lt;br /&gt;the app starts - no trace from the bootloader.&lt;/p&gt;
&lt;p&gt;Now I compiled the blinky example to check what pointer is set at VTOR address 0x00000000&lt;br /&gt;The hex file says in the first line&lt;br /&gt;:10 0000 00 00000420 B5020000 DD020000 DF020000 55&lt;br /&gt;does this really mean VTOR Reset vector points to 0x20040000, the very first non-existing address in RAM? I do definitely not understand what&amp;#39;s going on here :-(&lt;br /&gt;Does this address intentionally provoke a hard fault which is then handled?&lt;br /&gt;Or is VTOR not at address 0x00000000 as I expect? What vector is used at power up?&lt;br /&gt;&lt;br /&gt;I need some pat on the shoulder (a hint, a pointer to docs, whatever):&lt;br /&gt;how the heck does BOOT work???&lt;/p&gt;
&lt;p&gt;best regards, Peter&lt;/p&gt;
&lt;p&gt;PS -&amp;nbsp; EDIT:&lt;br /&gt;gcc_startup_nrf52840.S reveals&lt;br /&gt;0x00000000&amp;nbsp; __StackTop&lt;br /&gt;0x00000004&amp;nbsp; Reset_Handler&lt;br /&gt;(so I was wrong to expect the RESET vector at address 0x00000000)&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU by app using MTP</title><link>https://devzone.nordicsemi.com/thread/323935?ContentTypeID=1</link><pubDate>Mon, 09 Aug 2021 08:59:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a109992e-455a-4247-b10a-53bbcd0b951d</guid><dc:creator>peterz</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;&amp;gt; Is it correct that you have set &amp;quot;#define NRF_DFU_IN_APP 1&amp;quot; in the bootloader?&lt;br /&gt;no this was wrong - thanks for the hint!&lt;/p&gt;
&lt;p&gt;and also wrong in my fake bootloader settings for the very first DFU - I should have added:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    // copied from boot_validation_crc(nrf_dfu_settings_t const * p_settings) in nrf_dfu_settings.c
    dummySettings.boot_validation_crc = crc32_compute((const uint8_t *)&amp;amp;(dummySettings.boot_validation_softdevice),
                          (3 * sizeof(boot_validation_t)), NULL);
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Providing debug output from the bootloader requires adding a lot of library code which leads to much bigger bootloader - it won&amp;#39;t fit anymore to 0xF8000 - 0xFDFFF&lt;br /&gt;It isn&amp;#39;t working yet but I feel like making progress again - I&amp;#39;ll provide feedback - hopefully I&amp;#39;ll tell you that it works.&lt;/p&gt;
&lt;p&gt;thanks a lot&lt;br /&gt;Peter&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU by app using MTP</title><link>https://devzone.nordicsemi.com/thread/323573?ContentTypeID=1</link><pubDate>Thu, 05 Aug 2021 14:17:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c65d7478-ca8b-4ac6-b960-9c15375a4621</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Is it correct that you have set &amp;quot;#define NRF_DFU_IN_APP 1&amp;quot; in the bootloader? This should normally be set in the &amp;quot;Background DFU application&amp;quot; to prevent it from writing the parts that bootloader will handle. If you set this in the bootloader, it may not work properly.&lt;/p&gt;
&lt;p&gt;Would you be able to provide minimal examples/instructions that can be used to reproduce/debug this issue?&lt;/p&gt;
&lt;p&gt;Can you enable and provide logs (preferably debug level) from the bootloader?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU by app using MTP</title><link>https://devzone.nordicsemi.com/thread/322501?ContentTypeID=1</link><pubDate>Thu, 29 Jul 2021 14:02:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2208b4c-269c-49ed-b2ad-838ad54046ab</guid><dc:creator>peterz</dc:creator><description>&lt;p&gt;Hi &lt;span&gt;J&amp;oslash;rgen&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;yes, my image is just a proof of concept and small enough to fit (&amp;lt;100k)&lt;br /&gt;the &amp;#39;fake bootloader settings&amp;#39; are calculated to eat up the first half of the available flash and to place bank 1 in the second half. Then I calculate CRC of whatever is currently in the first half (bank0).&lt;br /&gt;I&amp;#39;m aware of the 52820 having just a quarter of the flash and I want to make it work with the DevKit before I move to my own hardware.&lt;/p&gt;
[quote userid="14926" url="~/f/nordic-q-a/77902/dfu-by-app-using-mtp/322492#322492"]The initial bootloader settings should either be generated by the bootloader when you perform the first DFU, or be generated by nrfutil and merged with the initial flashed application.[/quote]
&lt;p&gt;I do not have a &amp;quot;first DFU&amp;quot; and integrating MTP as transport into the bootloader would a nightmare and a waste of flash. Generating settings with nrfutil is both uncomfortable while developing and an (unwanted) additional step for production. IMHO it&amp;#39;s quite simple to create these initial settings for the very first DFU on the fly.&lt;/p&gt;
&lt;p&gt;I like to separate my settings in app_config.h and for the bootloader it contains the following:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define NRF_BL_DFU_ALLOW_UPDATE_FROM_APP 1
#define NRF_DFU_REQUIRE_SIGNED_APP_UPDATE 1
#define NRF_DFU_APP_DOWNGRADE_PREVENTION 0
#define NRF_DFU_EXTERNAL_APP_VERSIONING 0
#define NRF_DFU_FORCE_DUAL_BANK_APP_UPDATES 1
#define NRF_DFU_SINGLE_BANK_APP_UPDATES 0

#define NRF_BL_DFU_ENTER_METHOD_BUTTON 0
#define NRF_BL_DFU_ENTER_METHOD_BUTTONLESS 0

#define NRF_DFU_HW_VERSION 52


// &amp;lt;i&amp;gt; Enable this to disable writing to areas of the settings that are protected
// &amp;lt;i&amp;gt; by the bootlader. If this is not enabled in the app, certain settings write
// &amp;lt;i&amp;gt; operations will cause HardFaults or will be ignored. Enabling this option
// &amp;lt;i&amp;gt; also causes postvalidation to be disabled since this is meant to be done
// &amp;lt;i&amp;gt; in the bootloader. NRF_BL_DFU_ALLOW_UPDATE_FROM_APP must be enabled in the bootloader.
#define NRF_DFU_IN_APP 1


// NRF_DFU_APP_DATA_AREA_SIZE - The size (in bytes) of the flash area reserved for application data. 
// This area is found at the end of the application area, next to the start of
// the bootloader. This area will not be erased by the bootloader during a
// firmware upgrade. The size must be a multiple of the flash page size.
#define NRF_DFU_APP_DATA_AREA_SIZE 12288


// &amp;lt;i&amp;gt; External apps are apps that will not be activated. They can 
// &amp;lt;i&amp;gt; e.g. be apps to be sent to a third party. External app updates 
// &amp;lt;i&amp;gt; are verified upon reception, but will remain in bank 1, and 
// &amp;lt;i&amp;gt; will never be booted. An external app will be overwritten if 
// &amp;lt;i&amp;gt; a new DFU procedure is performed. Note: This functionality is 
// &amp;lt;i&amp;gt; experimental and not yet used in any examples.
#define NRF_DFU_SUPPORTS_EXTERNAL_APP 0



#define NRF_LOG_ENABLED 0
#define NRF_LOG_BACKEND_RTT 0
#define NRF_LOG_DEFERRED 0
#define NRF_LOG_DEFAULT_LEVEL 4

#define NRF_LOG_BACKEND_RTT_ENABLED 1
#define NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE 64
#define SEGGER_RTT_CONFIG_BUFFER_SIZE_UP 4096
#define SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS 2
#define SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN 16
#define SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS 2
#define SEGGER_RTT_CONFIG_DEFAULT_MODE 0
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;thank you very much for your support :-))&lt;/p&gt;
&lt;p&gt;Peter&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU by app using MTP</title><link>https://devzone.nordicsemi.com/thread/322492?ContentTypeID=1</link><pubDate>Thu, 29 Jul 2021 13:42:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e906f57-14b6-4929-8e8e-873c2e99b8e5</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Are you using an image that will fit in the flash of the device?&lt;/p&gt;
&lt;p&gt;The &amp;quot;Fake Bootloader settings&amp;quot; you posted shows an application size of&amp;nbsp;&lt;span&gt;0x0007AFFC (503804 bytes), while the nRF52820 only have 256 kB of flash available.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The initial bootloader settings should either be generated by the bootloader when you perform the first DFU, or be generated by nrfutil and merged with the initial flashed application.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;It sounds like what you are trying to achieve is very similar to how the&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/lib_background_dfu.html"&gt;Background DFU&lt;/a&gt;&amp;nbsp;solution in previous SDKs work. Have you configured the bootloader to allow updates from the application (&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/group__nrf__bootloader__config.html#ga660b59eacfe333594fa89cc3951bb2c0"&gt;NRF_BL_DFU_ALLOW_UPDATE_FROM_APP&lt;/a&gt;&lt;/span&gt;&lt;span&gt;)? I assume this is where you try to write the bootloader settings from?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Jørgen&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>