<?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>MCUBoot BLE DFU fails due to custom power-on / accidental boot logic intercepting DFU reboots</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/126634/mcuboot-ble-dfu-fails-due-to-custom-power-on-accidental-boot-logic-intercepting-dfu-reboots</link><description>Hi Nordic Team, 
 I am using MCUBoot with BLE DFU on nRF5340 and I am facing an issue where the DFU process cannot complete due to my application’s custom boot logic. 
 After chipset power-on, my application determines the boot mode based on the power</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 23 Jan 2026 21:52:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/126634/mcuboot-ble-dfu-fails-due-to-custom-power-on-accidental-boot-logic-intercepting-dfu-reboots" /><item><title>RE: MCUBoot BLE DFU fails due to custom power-on / accidental boot logic intercepting DFU reboots</title><link>https://devzone.nordicsemi.com/thread/559487?ContentTypeID=1</link><pubDate>Fri, 23 Jan 2026 21:52:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:161941ab-f0e4-40e4-9285-c0880250ee9a</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Looks like you can go with&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;1. Set &amp;quot;DFU ion progress&amp;quot; flag whenever you receive an image.&lt;/p&gt;
&lt;p&gt;2. If you know the image confirmation sequence, you might clear the flag in the last confirmation. Hooks allow to get to know which image the command was targeted.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Eventually, you might use two independent flags (bits) in GPREGRET as well for recognizing the state per-image and the common state.&lt;/p&gt;
&lt;p&gt;Alternatively, if you know the sequence of loading images, then you can introduce a custom DFU state management image that you need. You can add a mcumgr custom command for driving the state.&lt;/p&gt;
&lt;p&gt;Time out is something that you should consider as a precaution.&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot BLE DFU fails due to custom power-on / accidental boot logic intercepting DFU reboots</title><link>https://devzone.nordicsemi.com/thread/559333?ContentTypeID=1</link><pubDate>Thu, 22 Jan 2026 09:52:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b731699-6d12-49da-945b-0f05c8f4f86a</guid><dc:creator>Ben_M</dc:creator><description>&lt;p data-start="102" data-end="112"&gt;Hi Amanda,&lt;/p&gt;
&lt;p data-start="114" data-end="377"&gt;Thanks for the clarification &amp;mdash; using &lt;strong data-start="151" data-end="217"&gt;GPREGRET / reset-retention registers to mark &amp;ldquo;DFU in progress&amp;rdquo;&lt;/strong&gt; makes perfect sense, and I&amp;rsquo;ve implemented this approach to prevent my application from entering the accidental-boot sleep path during DFU reboots.&lt;/p&gt;
&lt;p data-start="379" data-end="597"&gt;However, after implementing this, I ran into a follow-up question regarding where and when the GPREGRET flag should be set and cleared in the context of nRF5340 + MCUBoot + SMP OTA using nRF Connect for Mobile.&lt;/p&gt;
&lt;h3 data-start="599" data-end="610"&gt;Context&lt;/h3&gt;
&lt;ul data-start="611" data-end="963"&gt;
&lt;li data-start="611" data-end="653"&gt;
&lt;p data-start="613" data-end="653"&gt;Platform: nRF5340, NCS v2.9.0&lt;/p&gt;
&lt;/li&gt;
&lt;li data-start="654" data-end="743"&gt;
&lt;p data-start="656" data-end="743"&gt;OTA method: BLE SMP (mcumgr), uploading &lt;code data-start="696" data-end="717"&gt;dfu_application.zip&lt;/code&gt; from nRF Connect Mobile&lt;/p&gt;
&lt;/li&gt;
&lt;li data-start="848" data-end="963"&gt;
&lt;p data-start="850" data-end="963"&gt;DFU requires &lt;strong data-start="863" data-end="882"&gt;multiple resets&lt;/strong&gt;, and GPREGRET successfully allows bypassing the sleep logic across those resets.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 data-start="965" data-end="984"&gt;Follow-up issue&lt;/h3&gt;
&lt;p data-start="985" data-end="1077"&gt;In practice, I found the DFU process appears to involve &lt;strong data-start="1033" data-end="1063"&gt;multiple stages and resets by &lt;span&gt;annotation&amp;nbsp;boot logic code&lt;/span&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;ul data-start="1078" data-end="1238"&gt;
&lt;li data-start="1078" data-end="1117"&gt;
&lt;p data-start="1080" data-end="1117"&gt;DFU progresses to ~60%, device resets&lt;/p&gt;
&lt;/li&gt;
&lt;li data-start="1118" data-end="1162"&gt;
&lt;p data-start="1120" data-end="1162"&gt;DFU continues to ~90%, device resets again&lt;/p&gt;
&lt;/li&gt;
&lt;li data-start="1163" data-end="1238"&gt;
&lt;p data-start="1165" data-end="1238"&gt;Sometimes progress restarts from 0%, and eventually reports &amp;ldquo;DFU success&amp;rdquo;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-start="1240" data-end="1423"&gt;To support this, I currently &lt;strong data-start="1269" data-end="1317"&gt;set GPREGRET when DFU upload activity starts&lt;/strong&gt; (e.g. on img_mgmt upload chunk callbacks), which works well to keep the device DFU-capable across resets.&lt;/p&gt;
&lt;p data-start="1425" data-end="1483"&gt;The open question is about &lt;strong data-start="1452" data-end="1482"&gt;clearing the GPREGRET flag&lt;/strong&gt;:&lt;/p&gt;
&lt;ul data-start="1484" data-end="1779"&gt;
&lt;li data-start="1484" data-end="1619"&gt;
&lt;p data-start="1486" data-end="1619"&gt;Clearing it based on &lt;code data-start="1507" data-end="1532"&gt;boot_is_img_confirmed()&lt;/code&gt; can be &lt;strong data-start="1540" data-end="1553"&gt;too early&lt;/strong&gt;, because DFU may still need additional resets or transfer stages.&lt;/p&gt;
&lt;/li&gt;
&lt;li data-start="1620" data-end="1779"&gt;
&lt;p data-start="1622" data-end="1779"&gt;Relying solely on image confirmation does not reliably indicate that the &lt;strong data-start="1695" data-end="1729"&gt;entire DFU session is complete&lt;/strong&gt;, especially with multi-reset behavior on nRF5340.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 data-start="1781" data-end="1793"&gt;Question&lt;/h3&gt;
&lt;p data-start="1794" data-end="1867"&gt;From Nordic&amp;rsquo;s perspective, what is the &lt;strong data-start="1833" data-end="1862"&gt;recommended best practice&lt;/strong&gt; for:&lt;/p&gt;
&lt;ol data-start="1869" data-end="2355"&gt;
&lt;li data-start="1869" data-end="2020"&gt;
&lt;p data-start="1872" data-end="1921"&gt;&lt;strong data-start="1872" data-end="1883"&gt;Setting&lt;/strong&gt; the GPREGRET &amp;ldquo;DFU in progress&amp;rdquo; flag&lt;/p&gt;
&lt;ul data-start="1925" data-end="2020"&gt;
&lt;li data-start="1925" data-end="2020"&gt;
&lt;p data-start="1927" data-end="2020"&gt;Is setting it on the first &lt;code data-start="1954" data-end="1964"&gt;img_mgmt&lt;/code&gt; upload chunk / DFU_STARTED event the intended approach?&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li data-start="2022" data-end="2355"&gt;
&lt;p data-start="2025" data-end="2057"&gt;&lt;strong data-start="2025" data-end="2037"&gt;Clearing&lt;/strong&gt; the GPREGRET flag&lt;/p&gt;
&lt;ul data-start="2061" data-end="2355"&gt;
&lt;li data-start="2061" data-end="2243"&gt;
&lt;p data-start="2063" data-end="2243"&gt;Is there a specific mcumgr/img_mgmt event (e.g. DFU_CONFIRMED, DFU_STOPPED) that should be treated as the authoritative &amp;ldquo;DFU session complete&amp;rdquo; signal when using nRF Connect Mobile?&lt;/p&gt;
&lt;/li&gt;
&lt;li data-start="2247" data-end="2355"&gt;
&lt;p data-start="2249" data-end="2355"&gt;Or is an &lt;strong data-start="2258" data-end="2298"&gt;idle/timeout-based clearing strategy&lt;/strong&gt; expected for SMP OTA sessions that span multiple resets?&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p data-start="2357" data-end="2383"&gt;The goal is to avoid both:&lt;/p&gt;
&lt;ul data-start="2384" data-end="2529"&gt;
&lt;li data-start="2384" data-end="2441"&gt;
&lt;p data-start="2386" data-end="2441"&gt;prematurely clearing the flag and interrupting DFU, and&lt;/p&gt;
&lt;/li&gt;
&lt;li data-start="2442" data-end="2529"&gt;
&lt;p data-start="2444" data-end="2529"&gt;leaving the flag set permanently and bypassing normal boot logic after DFU completes.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-start="2531" data-end="2649"&gt;Any guidance on the intended lifecycle of a &amp;ldquo;DFU in progress&amp;rdquo; marker for nRF5340 SMP OTA would be greatly appreciated!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot BLE DFU fails due to custom power-on / accidental boot logic intercepting DFU reboots</title><link>https://devzone.nordicsemi.com/thread/559304?ContentTypeID=1</link><pubDate>Wed, 21 Jan 2026 16:50:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee52a73b-6f80-4647-b88a-a49332047cc2</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi Ben,&amp;nbsp;&lt;/p&gt;
[quote user=""]Is using GPREGRET / reset-retention registers the recommended approach to mark “DFU in progress” across reboots?[/quote]
&lt;p&gt;Yes, you can use GPREGRET (or a similar reset-retention register) to mark “DFU in progress” before rebooting to instruct your application to enter the desired boot logic during DFU.&amp;nbsp;&lt;span&gt;Also see&amp;nbsp;&lt;/span&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/124732/does-nrf-connect-sdk-support-gpregret-on-nrf5340dk/550609"&gt;this post&lt;/a&gt;&lt;span&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards,&lt;br /&gt;Amanda H.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>