<?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>USAGE FAULT Stack Overflow when using NCS 3.1.1</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/124679/usage-fault-stack-overflow-when-using-ncs-3-1-1</link><description>I&amp;#39;m currently trying to integrate Memfault to my project that is using nRF9151 DK. Memfault was working fine until I turned on these configs: 
 # Collect LTE Metrics CONFIG_MEMFAULT_NCS_LTE_METRICS=y CONFIG_LTE_LC_EDRX_MODULE=y CONFIG_LTE_LC_PSM_MODULE</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 01 Oct 2025 14:59:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/124679/usage-fault-stack-overflow-when-using-ncs-3-1-1" /><item><title>RE: USAGE FAULT Stack Overflow when using NCS 3.1.1</title><link>https://devzone.nordicsemi.com/thread/550387?ContentTypeID=1</link><pubDate>Wed, 01 Oct 2025 14:59:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:814e5b70-0f31-48b5-91ec-432b74ccb204</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Excellent! Thank you for reporting back on what the issue was.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USAGE FAULT Stack Overflow when using NCS 3.1.1</title><link>https://devzone.nordicsemi.com/thread/550385?ContentTypeID=1</link><pubDate>Wed, 01 Oct 2025 14:55:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:291b3a9a-5a93-47f7-9e78-f5c73cfebfcf</guid><dc:creator>Yun531</dc:creator><description>&lt;p&gt;Thank you so much! I looked into the zephyr.map and zephyr_final.map and the PSP address falls into the range for the&amp;nbsp;work_q_stack.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;.noinit.&amp;quot;WEST_TOPDIR/nrf/lib/lte_link_control/common/work_q.c&amp;quot;.0
                0x0000000020013d10      0x400 modules/nrf/lib/lte_link_control/lib..__nrf__lib__lte_link_control.a(work_q.c.obj)
                0x0000000020013d10                work_q_stack&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I increase the stack size to &lt;code&gt;CONFIG_LTE_LC_WORKQUEUE_STACK_SIZE=2048&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Still not sure why the crash log and addr2line didn&amp;#39;t print out this info but everything works now! Thanks again!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USAGE FAULT Stack Overflow when using NCS 3.1.1</title><link>https://devzone.nordicsemi.com/thread/550356?ContentTypeID=1</link><pubDate>Wed, 01 Oct 2025 12:18:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e835d932-9556-44a3-af4c-1cd6548dfa27</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I&amp;#39;m surprised that addr2line failed to return a valid file and line number. I&amp;#39;m not sure what the reason for that could be. But since the crash log reports a stack overflow, it would be good to first determine which stack it occurred in. I would also try doubling the main thread stack to see if it make any difference (CONFIG_MAIN_STACK_SIZE=8192)&lt;/p&gt;
&lt;p&gt;The crash log should end with a line that&amp;nbsp;tells which thread the fault occurred in, for example:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;E: Current thread: 0x200026a8 (unknown)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If you compile with CONFIG_THREAD_INFO=y, the thread name will also be included. If this line is not printed for some reason, you can look up the PSP address in your zephyr.map file to see which address range the&amp;nbsp;process stack pointer was in when the stack guard got triggered.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USAGE FAULT Stack Overflow when using NCS 3.1.1</title><link>https://devzone.nordicsemi.com/thread/550262?ContentTypeID=1</link><pubDate>Tue, 30 Sep 2025 17:43:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01dd9a42-6399-4d8d-a79d-efdd76a5c836</guid><dc:creator>Yun531</dc:creator><description>&lt;p&gt;Thank you for your response.&lt;/p&gt;
&lt;p&gt;Using&amp;nbsp;&lt;span&gt;0x00029b3b to addr2line&amp;nbsp;also return&amp;nbsp;??:?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I tried other addresses in the fault message and it either returns&amp;nbsp;??:? or&amp;nbsp;??:0.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I have the CONFIG_FPU=y because I need it for handle GNSS latitude and longitude. I checked the .config file in the build folder and it has both CONFIG_FPU=y and&amp;nbsp;CONFIG_FPU_SHARING=y&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I decided to enable Memfault shell to manually export the coredump. Here is what I found:&lt;/p&gt;
&lt;p&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/Screenshot-2025_2D00_09_2D00_30-at-10.38.07_2F20_AM.png" /&gt;&lt;/p&gt;
&lt;p&gt;The stack trace is essentially:&lt;/p&gt;
&lt;p&gt;__ssvfscanf_r&lt;/p&gt;
&lt;p&gt;&amp;nbsp;_vsscanf_r&lt;/p&gt;
&lt;p&gt;nrf_modem_at_scanf&lt;/p&gt;
&lt;p&gt;modem_info_get_rsrp (&lt;span&gt;nrf/lib/modem_info/modem_info.c:882)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;modem_params_get&amp;nbsp;(nrf/modules/memfault-firmware-sdk/&lt;span&gt;memfault_lte_metrics.c:76&lt;/span&gt;)&lt;/p&gt;
&lt;p&gt;lte_handler (nrf/modules/memfault-firmware-sdk/memfault_lte_metrics.c:119)&lt;/p&gt;
&lt;p&gt;&lt;span&gt;event_handler_list_dispatch (nrf/lib/lte_link_control/common/event_handler_list.c:113)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;and this is the log before the crash:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;inf&amp;gt; mflt: Reset Reason, RESETREAS=0x10001
&amp;lt;inf&amp;gt; mflt: Reset Causes:I&amp;lt;inf&amp;gt; mflt:  Pin Reset
&amp;lt;inf&amp;gt; mflt: GNU Build ID: b370b80ce32a5558123521aba7473e7ee940a544
&amp;lt;inf&amp;gt; mflt: Periodic background upload scheduled - initial delay=63s period=120s
&amp;lt;inf&amp;gt; nRF9151_LTE: Initializing modem library
&amp;lt;inf&amp;gt; nRF9151_LTE: Comparing credentials: Match
&amp;lt;inf&amp;gt; nRF9151_LTE: Connecting to LTE network
&amp;lt;inf&amp;gt; nRF9151_LTE: LTE cell changed: Cell ID: &amp;lt;id&amp;gt;, Tracking area: &amp;lt;area-id&amp;gt;
&amp;lt;inf&amp;gt; nRF9151_LTE: RRC mode: Connected
&amp;lt;inf&amp;gt; nRF9151_LTE: Network registration status: Connected - roaming
&amp;lt;inf&amp;gt; nRF9151_LTE: Connected to LTE network&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;After connecting to LTE, I follow the similar behavior in my loop to disable it to switch to GNSS. Reference from this &lt;a href="https://github.com/NordicDeveloperAcademy/cell-fund/blob/9b69261caf46fea76ad2473a3e5ceb8146864b40/l8/l8_sol/src/main.c#L511"&gt;sample code&lt;/a&gt;. I&amp;#39;m just wondering if&amp;nbsp;it would be the cause? For example,&amp;nbsp;if memfault is collecting lte metrics, and the &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/560d4f7b09e2b58630a4e8c867f5be068173072e/lib/modem_info/modem_info.c#L882"&gt;modem_info.c:882&lt;/a&gt;&amp;nbsp;calls AT command, would it cause the modem to crash/hang?&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USAGE FAULT Stack Overflow when using NCS 3.1.1</title><link>https://devzone.nordicsemi.com/thread/550208?ContentTypeID=1</link><pubDate>Tue, 30 Sep 2025 13:48:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d96d2a48-89c5-4a5f-82cb-b0e513981f60</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;It is possible that the tread analyzer is not showing the thread that had the stack overflow.&amp;nbsp;Are you able to&amp;nbsp;see where the call was made from if you look up the LR address instead (0x00029b3b - 1 thumb bit)?&lt;/p&gt;
&lt;p&gt;&lt;span&gt;$ arm-zephyr-eabi-addr2line -e build/nRF9151_lte/zephyr/zephyr.elf &amp;nbsp;0x00029b3a&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I also see that the crashlog is including the FPU registers. Did you enable&amp;nbsp;CONFIG_FPU_SHARING in your project?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Vidar&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>