<?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>nRF9160 modem hard fault debugging</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/90901/nrf9160-modem-hard-fault-debugging</link><description>Hello, 
 
 My nRF9160 hard faults (i think?) when issuing a command to the modem, specifically this line: 
 
 which then calls ncs function: 
 
 
 This leads to I think is a hard fault and the board resets, the modem never returns any values, so I can</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 18 Aug 2022 11:29:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/90901/nrf9160-modem-hard-fault-debugging" /><item><title>RE: nRF9160 modem hard fault debugging</title><link>https://devzone.nordicsemi.com/thread/382247?ContentTypeID=1</link><pubDate>Thu, 18 Aug 2022 11:29:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d58d94ac-a826-437d-adb3-3fc6b1ddd42d</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Robert K"]Im not quite sure how to see what Thread that was running[/quote]
&lt;p&gt;As previously mentioned:&lt;/p&gt;
[quote user="hkn"]Content of R2, 537000870 (0x2001fba6), is in the RAM and must be checked in the build/zephyr/zephyr.map file manually to see which section/thread/etc that this might be.[/quote]
&lt;p&gt;You can look for any of the faulting registers that has this 0x200XXXXX offset, as this will be in the RAM region.&lt;/p&gt;
&lt;p&gt;If you&amp;#39;re lucky, you can see it in the call stack trace as well.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 modem hard fault debugging</title><link>https://devzone.nordicsemi.com/thread/382103?ContentTypeID=1</link><pubDate>Wed, 17 Aug 2022 18:29:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8db6de24-41a8-46bc-9320-c94553e0f834</guid><dc:creator>Robert K</dc:creator><description>&lt;p&gt;Yes this was the latest output,&lt;/p&gt;
&lt;p&gt;Im not quite sure how to see what Thread that was running, i&amp;#39;m using VS Code with the nRF Connect Extensions.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If I debug with Ozone and save the snapshot after the fault, would that be of any use?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 modem hard fault debugging</title><link>https://devzone.nordicsemi.com/thread/381774?ContentTypeID=1</link><pubDate>Tue, 16 Aug 2022 12:23:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5540df5-dea7-41fd-9481-dab9d91a4571</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Robert K"]I got R2 hex 0xD this time i ran it, and in the zephyr.map I got 8 occurences for this value:[/quote]
&lt;p&gt;0xd can just be a random value that was used within one scope, it is not a guarantee that it can be resolved back to a specific function or RAM area.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Robert K"]&lt;p&gt;Thank you, this is the output:&lt;/p&gt;
&lt;p&gt;LR: ncs/v1.9.1/zephyr/include/arch/arm/aarch32/asm_inline_gcc.h:95&lt;br /&gt;PC: ncs/v1.9.1/zephyr/include/drivers/adc.h:386&lt;/p&gt;[/quote]
&lt;p&gt;Was this output with the latest assert messages? Each time you compile and flash, the content of the CPU registers will change.&lt;/p&gt;
&lt;p&gt;If they were, it indicates that you assert when you&amp;#39;re trying to access the ADC&amp;nbsp;/ unlocking an IRQ:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.7.99-ncs1-1/include/arch/arm/aarch32/asm_inline_gcc.h#L95"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v2.7.99-ncs1-1/include/arch/arm/aarch32/asm_inline_gcc.h#L95&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.7.99-ncs1/include/drivers/adc.h#L386"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v2.7.99-ncs1/include/drivers/adc.h#L386&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Which thread was running? Have you tried debugging to see between which functions it faults? Ie. set a breakpoint, see if it hits, jump to the next function, etc. until it faults.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 modem hard fault debugging</title><link>https://devzone.nordicsemi.com/thread/381635?ContentTypeID=1</link><pubDate>Mon, 15 Aug 2022 17:48:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc749182-dee5-4811-bf15-61c9ae8abd2e</guid><dc:creator>Robert K</dc:creator><description>&lt;p&gt;Thank you, this is the output:&lt;/p&gt;
&lt;p&gt;LR: ncs/v1.9.1/zephyr/include/arch/arm/aarch32/asm_inline_gcc.h:95&lt;br /&gt;PC: ncs/v1.9.1/zephyr/include/drivers/adc.h:386&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I got R2 hex 0xD this time i ran it, and in the zephyr.map I got 8 occurences for this value:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt; .rodata.lwm2m_engine_delete_obj_inst.str1.1
                0x00000000        0xd zephyr/subsys/net/lib/lwm2m/libsubsys__net__lib__lwm2m.a(lwm2m_engine.c.obj)
                
.rodata.str1.1
                0x00058cf4        0xd zephyr/libzephyr.a(stream_flash.c.obj)
                
.rodata.cmd_read.str1.1
                0x0005d6b3        0xd zephyr/drivers/flash/libdrivers__flash.a(flash_shell.c.obj)
                
.rodata.str1.1
                0x0005da85        0xd modules/nrf/lib/nrf_modem_lib/lib..__nrf__lib__nrf_modem_lib.a(nrf91_sockets.c.obj)
                
.rodata.fota_update_counter_update.str1.1
                0x0005fcbd        0xd modules/nrf/subsys/net/lib/lwm2m_client_utils/lib..__nrf__subsys__net__lib__lwm2m_client_utils.a(settings.c.obj)
                
.rodata.str1.1
                0x00060328        0xe modules/nrf/subsys/net/lib/lwm2m_client_utils/lib..__nrf__subsys__net__lib__lwm2m_client_utils.a(lwm2m_device.c.obj)
                                  0xd (size before relaxing)
                                  
                                  
 .rodata.str1.1
                0x00060c47        0xd modules/mcuboot/boot/bootutil/zephyr/libmcuboot_util.a(bootutil_public.c.obj)
                
.rodata._dtoa_r.str1.1
                0x00061de4        0xd c:/Users/Robert/ncs/v1.9.1/toolchain/opt/arm-none-eabi/lib/thumb/v8-m.main/nofp\libc_nano.a(lib_a-dtoa.o)
                                  0xf (size before relaxing)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 modem hard fault debugging</title><link>https://devzone.nordicsemi.com/thread/381511?ContentTypeID=1</link><pubDate>Mon, 15 Aug 2022 09:14:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e153244-752e-4cf8-bf70-e8015fb1e821</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you convert the decimal numbers to hex, specifically the contents of&amp;nbsp;LR and PC, you should be able to do a lookup of the addresses using arm-none-eabi-addr2line:&lt;/p&gt;
&lt;p&gt;LR: arm-none-eabi-addr2line -e path/to/build/zephyr/zephyr.elf 0x4a17b&lt;/p&gt;
&lt;p&gt;&lt;span&gt;PC: arm-none-eabi-addr2line -e path/to/build/zephyr/zephyr.elf&amp;nbsp;0x27326&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Content of R2, 537000870 (0x2001fba6), is in the RAM and must be checked in the build/zephyr/zephyr.map file manually to see which section/thread/etc that this might be.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Could you post the output of the above?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kind regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Håkon&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 modem hard fault debugging</title><link>https://devzone.nordicsemi.com/thread/381413?ContentTypeID=1</link><pubDate>Fri, 12 Aug 2022 15:40:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb641b14-97b5-4f21-86d1-bf88d771c29c</guid><dc:creator>Robert K</dc:creator><description>&lt;p&gt;This is what I can extract from when the debugger hits the breakpoint in VS Code:&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;0x20002ea0 &amp;lt;z_interrupt_stacks+1984&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1660318781823v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 modem hard fault debugging</title><link>https://devzone.nordicsemi.com/thread/381353?ContentTypeID=1</link><pubDate>Fri, 12 Aug 2022 12:03:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8bb7f5f-cabf-4c45-9e22-3e39f9ae43cc</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try one of these solutions?&lt;/p&gt;
&lt;p&gt;1. Switch over the UART based logging. This should print any fault scenarios (if present).&lt;/p&gt;
&lt;p&gt;2. Enter debug mode, set a breakpoint at the function &amp;quot;z_arm_fatal_error&amp;quot;, and if that breakpoint hits: share the content of either &amp;quot;esf_copy&amp;quot; of &amp;quot;esf&amp;quot;?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 modem hard fault debugging</title><link>https://devzone.nordicsemi.com/thread/381323?ContentTypeID=1</link><pubDate>Fri, 12 Aug 2022 09:39:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eeccb1bc-01fe-40fb-823f-5c7d79babcfa</guid><dc:creator>Robert K</dc:creator><description>&lt;p&gt;Hi, thank you for your reaponse.&lt;/p&gt;
&lt;p&gt;I run RTT Viewer and it does not show any logs when the device resets. I only see my debug prints which prints just before the above mentioned function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 modem hard fault debugging</title><link>https://devzone.nordicsemi.com/thread/381303?ContentTypeID=1</link><pubDate>Fri, 12 Aug 2022 08:51:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4a9b4c4-530d-4251-ae8a-827473594b38</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Do you have a log or similar showing what happens?&lt;/p&gt;
&lt;p&gt;If a fault condition occurs, you&amp;#39;ll usually see a printout on the terminal.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>