<?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 - Instruction bus error</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75077/bus-fault---instruction-bus-error</link><description>Hello, 
 I am running a single ( main() starts sysworkq thread) thread application in Segger Embedded Studio v5.34a, built for the nRF52833 SoC. 
 Although I am using a proprietary board built around the nRF52833 SoC, I am using the config for the board</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 30 May 2021 14:46:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75077/bus-fault---instruction-bus-error" /><item><title>RE: BUS FAULT - Instruction bus error</title><link>https://devzone.nordicsemi.com/thread/312509?ContentTypeID=1</link><pubDate>Sun, 30 May 2021 14:46:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37e386e1-f5fa-4b58-861f-18e6b31485b7</guid><dc:creator>Hakon</dc:creator><description>[quote user="Learner"]Meanwhile, can you please comment&amp;nbsp;on why after this change in prj.conf the fault disappeared?[/quote]
&lt;p&gt;&amp;nbsp;Compiler optimizations generally reduces the amount of stack required by the application. It&amp;#39;s difficult to tell without having looked at your code. It could be a stack overflow in some of the threads, but I&amp;#39;m not 100 % certain.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BUS FAULT - Instruction bus error</title><link>https://devzone.nordicsemi.com/thread/311027?ContentTypeID=1</link><pubDate>Fri, 21 May 2021 11:51:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88dbc90e-f191-4127-b967-fc726d439372</guid><dc:creator>Learner</dc:creator><description>&lt;p&gt;Hi Hakon,&lt;/p&gt;
&lt;p&gt;Thank you for your suggestion. I will need to undo some of the changes that made the MPU/BUS FAULT disappear in order to reproduce the problem. I will let you know how I got on.&lt;/p&gt;
&lt;p&gt;I have reproduced the MPU FAULT,&lt;/p&gt;
&lt;p&gt;[00:04:46.795,989] &amp;lt;err&amp;gt; os: ***** MPU FAULT *****&lt;br /&gt;[00:04:46.795,989] &amp;lt;err&amp;gt; os: Instruction Access Violation&lt;br /&gt;[00:04:46.796,020] &amp;lt;err&amp;gt; os: r0/a1: 0x00000000 r1/a2: 0x00000000 r2/a3: 0x20002c40&lt;br /&gt;[00:04:46.796,020] &amp;lt;err&amp;gt; os: r3/a4: 0x00000001 r12/ip: 0x200033f4 &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;r14/lr: 0x0001f7d5&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;[00:04:46.796,020] &amp;lt;err&amp;gt; os: xpsr: 0x81000000&lt;br /&gt;[00:04:46.796,020] &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;&amp;lt;err&amp;gt; os: Faulting instruction address (r15/pc): 0xee19c986&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;[00:04:46.796,020] &amp;lt;err&amp;gt; os: &amp;gt;&amp;gt;&amp;gt; ZEPHYR FATAL ERROR 0: CPU exception on CPU 0&lt;br /&gt;[00:04:46.796,051] &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;&amp;lt;err&amp;gt; os: Current thread: 0x20002c40 (sysworkq)&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;[00:04:47.033,508] &amp;lt;err&amp;gt; os: Halting system&lt;/p&gt;
&lt;p&gt;the addr2line command gave this response,&lt;/p&gt;
&lt;p&gt;C:\WINDOWS\System32&amp;gt;C:\Zypher\v1.5.0-rc1\toolchain\opt\bin\&lt;strong&gt;arm-none-eabi-addr2line.exe -e&lt;/strong&gt; C:\Sandbox\Main-RX-TX\build_nrf52833dk_nrf52833_NO_DEBUG_OPTIMIZATIONS_MPU_FAULT\zephyr\zephyr.elf &lt;strong&gt;0x0001f7d5&lt;/strong&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;C:/Zypher/v1.5.0-rc1/zephyr/drivers/spi/spi_nrfx_spim.c:250&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Line 250 corresponds to the&amp;nbsp;return from the function spi_nrfx_transceive()&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;static int spi_nrfx_transceive(const struct device *dev,&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;const struct spi_config *spi_cfg,&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;const struct spi_buf_set *tx_bufs,&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;const struct spi_buf_set *rx_bufs)&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp;return transceive(dev, spi_cfg, tx_bufs, rx_bufs, false, NULL);&lt;/strong&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;&lt;span style="color:#000000;"&gt;}&lt;/span&gt; &amp;gt;&amp;gt;&amp;gt; This is line 250&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;It looks like the fault occurred&amp;nbsp;in the SPI driver function &lt;strong&gt;transceive()&lt;/strong&gt;. However,&amp;nbsp;This function gets called for every SPI transaction.&amp;nbsp;Why is it that it works for seconds, minutes, and sometimes even over an hour then eventually fails with a MPU FAULT?&lt;/p&gt;
&lt;p&gt;I will have to debug a bit deeper than I was expecting to come to the bottom of this problem&lt;/p&gt;
&lt;p&gt;Meanwhile, can you please comment&amp;nbsp;on why after this change in prj.conf the fault disappeared?&lt;/p&gt;
[quote userid="92434" url="~/f/nordic-q-a/75077/bus-fault---instruction-bus-error"]&lt;strong&gt;CONFIG_DEBUG_OPTIMIZATIONS=y&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;CONFIG_COMPILER_OPT=&amp;quot;&amp;quot;&lt;/strong&gt;[/quote]
&lt;p&gt;Hopefully, the reply will be quicker this time.&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Mohamed Belaroussi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BUS FAULT - Instruction bus error</title><link>https://devzone.nordicsemi.com/thread/311002?ContentTypeID=1</link><pubDate>Fri, 21 May 2021 10:57:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4b1478d-94d2-4b8c-b0b8-80ae82f1be5a</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]&lt;strong&gt;&amp;lt;err&amp;gt; os: r3/a4: 0x00000001 r12/ip: 0x2000337c r14/lr: 0x0001ee1d&lt;/strong&gt;[/quote]
&lt;p&gt;&amp;nbsp;Can you check the address on &amp;quot;lr&amp;quot;? It should work with addr2line and you can also find it in the .map file.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>