<?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>Bus fault sometimes when reading ADC</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69072/bus-fault-sometimes-when-reading-adc</link><description>Hallo Nordic team, 
 We are developing our own product based on the nRF9160. The software we wrote must use ADC in order to measure battery voltage and things are working well. However, sometimes we are encountering a BUS FAULT when the function adc_read</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 04 Dec 2020 11:01:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69072/bus-fault-sometimes-when-reading-adc" /><item><title>RE: Bus fault sometimes when reading ADC</title><link>https://devzone.nordicsemi.com/thread/283292?ContentTypeID=1</link><pubDate>Fri, 04 Dec 2020 11:01:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2adbd40-ca02-49a7-8069-8274e6736086</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;When you get a fault print out, you can map the addresses to actual code lines, atleast the values that are located in flash (from 0 -&amp;gt; 1MB).&lt;/p&gt;
&lt;p&gt;The 0x19??? range is in the non-secure application space, which would be the ELF file in build-folder/zephyr/zephyr.elf.&lt;/p&gt;
&lt;p&gt;If you use arm-none-eabi-addr2line (or manually check the zephyr/zephyr.map file), you can highly likely (but not always) get a file/line from the program if the lookup address is in flash.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;arm-none-eabi-addr2line -e build/zephyr/zephyr.elf 0x19442&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;R14 (LR = link register = 0x1940f) can also be interesting to look up.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="turboj"]Buffer overflow..?[/quote]
&lt;p&gt;This is the most common one.&amp;nbsp;&lt;/p&gt;
[quote user=""]E: Current thread: 0x20025b7c (unknown)[/quote]
&lt;p&gt;&amp;nbsp;Which thread is running on this memory address? You can check this in your map file.&lt;/p&gt;
&lt;p&gt;If it is the main thread, you can try to increase the stack size in your prj.conf:&lt;/p&gt;
&lt;p&gt;CONFIG_MAIN_STACK_SIZE=HIGHER_THAN_YOUR_CURRENT_VALUE_FOR_INSTANCE_8192&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: Bus fault sometimes when reading ADC</title><link>https://devzone.nordicsemi.com/thread/283207?ContentTypeID=1</link><pubDate>Thu, 03 Dec 2020 20:36:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d208fc95-bf14-4ffd-ae85-5bc5e9f38a79</guid><dc:creator>Turbo J</dc:creator><description>[quote userid="54993" url="~/f/nordic-q-a/69072/bus-fault-sometimes-when-reading-adc"]the BFAR address is located in the SRAM (my assumption).[/quote]
&lt;p&gt;Wrong assumtion. Those addresses are outside the SRAM address space.&lt;/p&gt;
&lt;p&gt;Buffer overflow..?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>