<?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>SoftDevice crash after custom bootloader handover – peripheral state conflict (USB/RTC/SPI)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/126772/softdevice-crash-after-custom-bootloader-handover-peripheral-state-conflict-usb-rtc-spi</link><description>Symptoms: 
 
 When running Bootloader + SoftDevice + App (with SoftDevice enabled in the app), The bootloader runs correctly and starts SD. The app is started, but crashes on the first use of USB, RTC timer (used for logging), or SPI. 
 When running Bootloader</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 05 Feb 2026 10:51:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/126772/softdevice-crash-after-custom-bootloader-handover-peripheral-state-conflict-usb-rtc-spi" /><item><title>RE: SoftDevice crash after custom bootloader handover – peripheral state conflict (USB/RTC/SPI)</title><link>https://devzone.nordicsemi.com/thread/560421?ContentTypeID=1</link><pubDate>Thu, 05 Feb 2026 10:51:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:956ee018-dadd-4e1e-9b6f-4eeec73e94ff</guid><dc:creator>Jonas S Andersen</dc:creator><description>&lt;p&gt;Thanks a lot&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice crash after custom bootloader handover – peripheral state conflict (USB/RTC/SPI)</title><link>https://devzone.nordicsemi.com/thread/560416?ContentTypeID=1</link><pubDate>Thu, 05 Feb 2026 10:25:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16543fe6-0667-43c2-aeb7-c232e01e22d2</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;&lt;span&gt;The VTOR register may be used in applications that do not rely on the softdevice. Otherwise, it should not be used.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice crash after custom bootloader handover – peripheral state conflict (USB/RTC/SPI)</title><link>https://devzone.nordicsemi.com/thread/560414?ContentTypeID=1</link><pubDate>Thu, 05 Feb 2026 10:16:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:410ad787-d1f3-4b29-98ac-1c64cb5ecd6d</guid><dc:creator>Jonas S Andersen</dc:creator><description>&lt;p&gt;So what is best practice? On the&amp;nbsp;setup&amp;nbsp;not using Softdevice - is&amp;nbsp;it setting VTOR as the first thing when reaching main in the application, or keep it as the last thing in the bootloader?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice crash after custom bootloader handover – peripheral state conflict (USB/RTC/SPI)</title><link>https://devzone.nordicsemi.com/thread/560407?ContentTypeID=1</link><pubDate>Thu, 05 Feb 2026 09:40:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3751069-574a-4adc-a9d6-9cf14fe3428e</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;You have likely found&amp;nbsp;the root cause. The softdevice architecture requires that&amp;nbsp;interrupts are routed through&amp;nbsp;the MBR and Softdevice before they are forwarded to the application. But by setting VTOR to 0x1000 you are effectively bypassing the MBR causing the Softdevice to receive the interrupts directly without being pre-processed by the MBR.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice crash after custom bootloader handover – peripheral state conflict (USB/RTC/SPI)</title><link>https://devzone.nordicsemi.com/thread/560404?ContentTypeID=1</link><pubDate>Thu, 05 Feb 2026 09:17:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0a0e6ff-9508-49c1-8847-1d2ee16ed9e5</guid><dc:creator>Jonas S Andersen</dc:creator><description>&lt;p&gt;I think you are onto something with you last comment. When making the bootloader initialy for another usecase (The one with the xflash setup you also helped with) - I added this VTOR change just before jumping to the application at 0x1000.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1770282672299v1.png" alt=" " /&gt;&lt;br /&gt;&lt;br /&gt;Without this the application wouldnt start. But when using the bootloader with softdevice, the softdevice might handle this??&lt;br /&gt;&lt;br /&gt;Now when testing the setup with the softdevice it seems to work when i remove&amp;nbsp;the VTOR from the screenshot. Ill have to do some more testing, i will let you know.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice crash after custom bootloader handover – peripheral state conflict (USB/RTC/SPI)</title><link>https://devzone.nordicsemi.com/thread/560306?ContentTypeID=1</link><pubDate>Wed, 04 Feb 2026 08:53:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3b96150-785f-4529-b201-35c7e54ff413</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Thank you. This wasn&amp;#39;t the result I expected. Could you please read out the vector tables as well?&lt;/p&gt;
&lt;p&gt;&lt;span&gt;nrfjprog --memrd 0x0 --n 0x104 &amp;gt; mbr.txt&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;nrfjprog --memrd 0x1000 --n 0x104 &amp;gt; softdevice.txt&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;nrfjprog --memrd 0x27000 --n 0x104 &amp;gt; app.txt&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And also just to confirm, the bootloader is not changing the VTOR register in this case?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice crash after custom bootloader handover – peripheral state conflict (USB/RTC/SPI)</title><link>https://devzone.nordicsemi.com/thread/560302?ContentTypeID=1</link><pubDate>Wed, 04 Feb 2026 08:31:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a86ba9f-5bed-4b00-b6e8-e69b9fcd0a71</guid><dc:creator>Jonas S Andersen</dc:creator><description>&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-components-multipleuploadfilemanager/70b4cbe6_2D00_73f5_2D00_4e30_2D00_a5b2_2D00_206a4db8de5a-148990-complete/pastedimage1770129228319v2.png" alt=" " /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p class="isSelectedEnd"&gt;&lt;span&gt;I&amp;rsquo;ve checked the values after reaching &lt;/span&gt;&lt;code&gt;&lt;span&gt;main()&lt;/span&gt;&lt;/code&gt;&lt;span&gt; in the application.&lt;/span&gt;&lt;/p&gt;
&lt;p class="isSelectedEnd"&gt;&lt;span&gt;At:&lt;/span&gt;&lt;/p&gt;
&lt;ul data-spread="false"&gt;
&lt;li&gt;
&lt;p class="isSelectedEnd"&gt;&lt;strong&gt;&lt;span&gt;0x20000000&lt;/span&gt;&lt;/strong&gt;&lt;span&gt; &amp;rarr; &lt;/span&gt;&lt;code&gt;&lt;span&gt;0x00001000&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p class="isSelectedEnd"&gt;&lt;strong&gt;&lt;span&gt;0x20000004&lt;/span&gt;&lt;/strong&gt;&lt;span&gt; &amp;rarr; &lt;/span&gt;&lt;code&gt;&lt;span&gt;0x00027000&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="isSelectedEnd"&gt;&lt;span&gt;These match the expected interrupt forwarding addresses for the MBR and SoftDevice. I&amp;rsquo;ve attached a screenshot showing the memory view for reference.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Please let me know if you&amp;rsquo;d like me to check anything else or perform additional diagnostics.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Here is the linker script for the one with the softdevice:&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1770193792584v3.png" alt=" " /&gt;&lt;br /&gt;&lt;br /&gt;And for the one without:&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1770193827704v4.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice crash after custom bootloader handover – peripheral state conflict (USB/RTC/SPI)</title><link>https://devzone.nordicsemi.com/thread/560242?ContentTypeID=1</link><pubDate>Tue, 03 Feb 2026 14:24:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:750fb6f7-fcfa-4215-a74a-413eef919025</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks. As you can see from the call stacks, the exception handlers are being executed at invalid addresses (0x1200400 and 0x20040000). The latter is the typical initial stack pointer value and is also the first entry in the Cortex-M vector table, which is suspicious. The issue is clearly related to interrupt handling.&lt;/p&gt;
&lt;p&gt;After reaching main() in the application, please read out the value at 0x20000000 and&amp;nbsp;&lt;span&gt;0x20000004. These hold the interrupt forwarding address for the MBR and Softdevice respectively (expected values are: 0x1000 and 0x27000).&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice crash after custom bootloader handover – peripheral state conflict (USB/RTC/SPI)</title><link>https://devzone.nordicsemi.com/thread/560239?ContentTypeID=1</link><pubDate>Tue, 03 Feb 2026 14:07:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b2708bd-c660-4814-a1db-1233021a18d4</guid><dc:creator>Jonas S Andersen</dc:creator><description>&lt;p class="isSelectedEnd"&gt;&lt;span&gt;Hey,&lt;/span&gt;&lt;/p&gt;
&lt;p class="isSelectedEnd"&gt;&lt;span&gt;Below is what I&amp;rsquo;m seeing regarding the crash behavior.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span&gt;With USB inserted:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span&gt;This is how it crashes when USB is connected.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1770127105398v2.png" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span&gt;Without USB inserted:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span&gt;Here is the call stack at the point of the crash when the device runs without USB connected.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1770127058980v1.png" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p class="isSelectedEnd"&gt;&lt;span&gt;I&amp;rsquo;ve also tried explicitly deinitializing the peripherals used by the bootloader before&amp;nbsp;jumping&amp;nbsp;on. I&amp;rsquo;m calling the deinit routines for CDC (USB) and I2C once the bootloader is done using them, so they should be re-initialized cleanly by the application after the jump.&lt;/span&gt;&lt;/p&gt;
&lt;p class="isSelectedEnd"&gt;&lt;span&gt;Despite this, the crash behavior remains the same.&lt;br /&gt;&lt;br /&gt;For completeness: I2C is not used or initialized in the bootloader at all, so it should already be in its reset state when the application starts.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice crash after custom bootloader handover – peripheral state conflict (USB/RTC/SPI)</title><link>https://devzone.nordicsemi.com/thread/559915?ContentTypeID=1</link><pubDate>Thu, 29 Jan 2026 13:45:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb3fa8f2-948c-4fa1-ac8e-f4438ed2191c</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Are you able to provide a bit more detail about the nature of the crash? If you pause the debugger, can you see where the program ends up after it crashes? Since it happens when you start using these peripherals, I’m wondering if it could be related to interrupt forwarding.&lt;/span&gt;&lt;/p&gt;
[quote user=""]Make the bootloader run straight to app (at 0x27000). That worked but initializing the Softdevice (present at 0x1000) made application crash. According to fora, this is not the way to go.[/quote]
&lt;p&gt;It is possible to jump branch directly to the app from the bootloader but that requires the bootloader to execute the Softdevice&amp;#39;s reset handler prior to jumping. This will not make any practical difference.&lt;/p&gt;
[quote user=""]I have noticed that our custom bootloader initializes some peripherals, that the stock BL does not use. RTC and USB for log (NOT NRF_LOG) and SPI for external flash. I have tried using the NRF_LOG, and not initialize the rtc, but that did not work.[/quote]
&lt;p&gt;It’s generally good practice for the bootloader to reconfigure any peripherals it uses back to their reset state before branching to the application to ensure that the app always boots into the same known state.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>