<?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>Pointers on how to debug nRF9160 soft reset</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114858/pointers-on-how-to-debug-nrf9160-soft-reset</link><description>Hi, 
 I&amp;#39;m developing an application on the nRF9160DK with custom firmware for both the nRF52840 as well as the nRF9160 on the board, using VSCode with the nRF Connect extension. (I&amp;#39;m currently on ncs v2.5.0 in case that matters.) Development is mostly</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 27 Sep 2024 18:42:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114858/pointers-on-how-to-debug-nrf9160-soft-reset" /><item><title>RE: Pointers on how to debug nRF9160 soft reset</title><link>https://devzone.nordicsemi.com/thread/504231?ContentTypeID=1</link><pubDate>Fri, 27 Sep 2024 18:42:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3158428d-52f3-492b-bffc-597fb2727d28</guid><dc:creator>WoutWG</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Thanks, but this doesn&amp;#39;t work for me, I assume because I&amp;#39;m on v2.5.0. The only way I &amp;#39;know&amp;#39; that this secure fault happens is because the application resets, so the only way I have to &amp;#39;catch&amp;#39; the error is by setting a breakpoint at the start of main(). But at this stage, there is no more exception handler to inspect the call stack of.&lt;/p&gt;
&lt;p&gt;So far I have been able to identify errors more quickly now that I know what to look for. If it really starts becoming an issue again, I&amp;#39;ll upgrade to v2.6.0+ to enable the fatal error handler which should provide more information as to where the error occurs.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Pointers on how to debug nRF9160 soft reset</title><link>https://devzone.nordicsemi.com/thread/503679?ContentTypeID=1</link><pubDate>Wed, 25 Sep 2024 08:36:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8238ae68-9d31-46b5-beec-b87656a450c0</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The secure fault handler is implemented in the TF-M application, not in the main application. But you can start a debug session with the main app and inspect the call stack after the secure fault has been raised.&lt;/p&gt;
&lt;p&gt;e.g., dereferencing NULL pointer to trigger a secure fault:&lt;/p&gt;
&lt;p&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/pastedimage1727253337701v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&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/pastedimage1727253359229v2.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Pointers on how to debug nRF9160 soft reset</title><link>https://devzone.nordicsemi.com/thread/503559?ContentTypeID=1</link><pubDate>Tue, 24 Sep 2024 11:20:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64d8bc2e-83bd-4e78-962e-3a8c2b89cf41</guid><dc:creator>WoutWG</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;That&amp;#39;s very helpful. I&amp;#39;ll consider upgrading to v2.6.0, but in the meantime, is there a way to debug secure faults while on v2.5.0?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Searching the sdk files, I found a reference to a &amp;#39;secure_fault&amp;#39; function in zephyr&amp;gt;arch&amp;gt;arm&amp;gt;core&amp;gt;aarch32&amp;gt;cortex_m&amp;gt;fault.c, but it is only enabled when CONFIG_ARM_SECURE_FIRMWARE is defined which isn&amp;#39;t the case for my application (it&amp;#39;s not even mentioned in .config in my build output, not even commented out), so it seems that this is not the error handler that I&amp;#39;m after.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Pointers on how to debug nRF9160 soft reset</title><link>https://devzone.nordicsemi.com/thread/503531?ContentTypeID=1</link><pubDate>Tue, 24 Sep 2024 09:27:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66198d57-56ce-46f1-96f7-21b432aa1013</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Good catch.&amp;nbsp;I think in v2.6.0 and later, a secure fault in the TF-M will be forwarded to the fatal error handler in the main app. Thus, making it easier to catch secure faults. The&amp;nbsp;&lt;span&gt;CONFIG_RESET_ON_FATAL_ERROR setting is also applied to the error handling in the TF-M image.&lt;/span&gt;&lt;/p&gt;
[quote user="WoutWG"]I just had another encounter (different from the one that made me open this ticket) and I found that the issue was that I was (re)scheduling a delayable work that I forgot to initialize first.&amp;nbsp;I&amp;#39;m not sure if this would &amp;#39;normally&amp;#39; (when not using tfm) result in a hard fault or anything that should leave a trace to help with debugging this?[/quote]
&lt;p&gt;I assume this lead to a secure fault. This can happen if the app tries to access secure RAM. For instance, when dereferencing a NULL pointer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Pointers on how to debug nRF9160 soft reset</title><link>https://devzone.nordicsemi.com/thread/503385?ContentTypeID=1</link><pubDate>Mon, 23 Sep 2024 11:06:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb686ed8-5350-49ee-a571-3888ee883d4e</guid><dc:creator>WoutWG</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Thank you for your feedback. I tried setting the breakpoint both in NVIC_SystemReset() and in sys_arch_reboot() (in scb.c), but the code doesn&amp;#39;t seem to hit either of these lines as it&amp;#39;s not breaking there.&lt;/p&gt;
&lt;p&gt;I checked my .config file in my build folder and CONFIG_RESET_ON_FATAL_ERROR is set to &amp;quot;y&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I just had another encounter (different from the one that made me open this ticket) and I found that the issue was that I was (re)scheduling a delayable work that I forgot to initialize first.&amp;nbsp;I&amp;#39;m not sure if this would &amp;#39;normally&amp;#39; (when not using tfm) result in a hard fault or anything that should leave a trace to help with debugging this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Pointers on how to debug nRF9160 soft reset</title><link>https://devzone.nordicsemi.com/thread/503267?ContentTypeID=1</link><pubDate>Fri, 20 Sep 2024 12:37:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24a28abf-e889-4543-b084-bb81e4b87b8b</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello Wout,&lt;/p&gt;
&lt;p&gt;Please try to place a breakpoint in&amp;nbsp;&lt;a href="https://github.com/zephyrproject-rtos/cmsis/blob/4b96cbb174678dcd3ca86e11e1f24bc5f8726da0/CMSIS/Core/Include/core_cm33.h#L2711"&gt;NVIC_SystemReset()&lt;/a&gt;&amp;nbsp;to see if it may be called elsewhere in your application. Usually it is only called from the fatal error handler when CONFIG_RESET_ON_FATAL_ERROR=y.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;
&lt;p&gt;EDIT: if the debugger won&amp;#39;t let you place the breakpoint in the inline function, you can place it in sys_arch_reboot() instead.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>