<?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>how to decipher HARD FAULT / MPU FAULT on zephyr running on nrf52832</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/90787/how-to-decipher-hard-fault-mpu-fault-on-zephyr-running-on-nrf52832</link><description>hello Nordic 
 
 i work on nrf52832, trying to run it with zephyr application 
 one board runs fine (more/less, there are some MPU FAULT issue that i am facing with no luck yet and i brought it up also in this, waiting for answer, thread: 
 ) 
 when i</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 28 Sep 2022 12:42:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/90787/how-to-decipher-hard-fault-mpu-fault-on-zephyr-running-on-nrf52832" /><item><title>RE: how to decipher HARD FAULT / MPU FAULT on zephyr running on nrf52832</title><link>https://devzone.nordicsemi.com/thread/388354?ContentTypeID=1</link><pubDate>Wed, 28 Sep 2022 12:42:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24a9b2e3-b6ce-4d1b-ab06-061555c2c063</guid><dc:creator>ziv123</dc:creator><description>&lt;p&gt;hi Sigurd&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;thanks, that was really helpful debugging tips, found the issue and added stack size for the failing thread:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_LOG_PROCESS_THREAD_STACK_SIZE&lt;/span&gt;&lt;span&gt;=1024&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;best regards&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Ziv&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to decipher HARD FAULT / MPU FAULT on zephyr running on nrf52832</title><link>https://devzone.nordicsemi.com/thread/381014?ContentTypeID=1</link><pubDate>Wed, 10 Aug 2022 12:33:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:11679f55-246b-48ba-a66d-0d46aa01f83b</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi Ziv,&lt;/p&gt;
[quote user="ziv123"]&lt;p&gt;1. &amp;quot;the file is not displayed in the editor (vs code) because it is&amp;nbsp;ether&amp;nbsp;binary&amp;nbsp;or uses an unsupported&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; encoding&amp;quot; that&amp;#39;s the message i get when trying to see the zephyr.elf file&lt;/p&gt;[/quote]
&lt;p&gt;Sorry, I gave you the wrong file ending. I meant zephyr.lst.&lt;/p&gt;
[quote user="ziv123"] why is that and what can i do beside close the debug and try again[/quote]
&lt;p&gt;From your explanation, I am unsure what this could be. If trying again works, it seems like a workaround for now.&lt;/p&gt;
[quote user="ziv123"]my debug starts like this from assembly code, why is that, what can i learn from it, also there are unknown threads in the call stack as can be seen,[/quote]
&lt;p&gt;Try to add a breakpoint in the top of your main code, and &amp;quot;continue&amp;quot; the debugger until it breaks at the breakpoint.&lt;/p&gt;
[quote user="ziv123"]the fail is the following:[/quote]
&lt;p&gt;&amp;quot;[00000000] &amp;lt;err&amp;gt; os:&amp;nbsp;&amp;nbsp; Stacking error (context area might be not valid)&amp;quot;&lt;br /&gt;&lt;br /&gt;From these error codes, it looks like a stack overflow. Try to increase CONFIG_IDLE_STACK_SIZE to for example 4096.&lt;/p&gt;
&lt;p&gt;Do you still get the error then?&lt;/p&gt;
&lt;p&gt;EDIT: Another tip on how to debug: I copied the &amp;quot;Stacking Error (context area might not be valid)&amp;quot; into DevZone search.&lt;br /&gt;Among others,&amp;nbsp; found &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/72986/stack-overflow/306063"&gt;this case&lt;/a&gt;. That case looks like it has multiple good tips on how to debug stack overflows. I suggest you have a look at it,&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to decipher HARD FAULT / MPU FAULT on zephyr running on nrf52832</title><link>https://devzone.nordicsemi.com/thread/380931?ContentTypeID=1</link><pubDate>Wed, 10 Aug 2022 07:10:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b8602548-9ba5-47c7-b605-51438e5c9431</guid><dc:creator>ziv123</dc:creator><description>&lt;p&gt;hi Sigurd&lt;/p&gt;
&lt;p&gt;regarding B:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="106736" url="~/f/nordic-q-a/90787/how-to-decipher-hard-fault-mpu-fault-on-zephyr-running-on-nrf52832/380802"]Sometimes it is useful to have a look at the zephyr.elf file[/quote]
&lt;p&gt;1. &amp;quot;the file is not displayed in the editor (vs code) because it is&amp;nbsp;ether&amp;nbsp;binary&amp;nbsp;or uses an unsupported&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; encoding&amp;quot; that&amp;#39;s the message i get when trying to see the zephyr.elf file&lt;/p&gt;
&lt;p&gt;2. sometimes when trying to start debug i get this in the debug terminal&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;quot;Debugger requested to halt target...&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;and debugging does not start, seems like it is incapable to reset the device if it gets stuck or&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;something like that, why is that and what can i do beside close the debug and try again&lt;/p&gt;
&lt;p&gt;3. my debug starts like this from assembly code, why is that, what can i learn from it, also there are unknown threads in the call stack as can be seen,&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/2308.debug1.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;how can i know which threads are those can/should/how do i give my threads names?&lt;/p&gt;
&lt;p&gt;and when i try to run i don&amp;#39;t see anything change in my debugger but i see device is connecting and doing stuff so why ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;regarding A:&lt;/p&gt;
[quote userid="106736" url="~/f/nordic-q-a/90787/how-to-decipher-hard-fault-mpu-fault-on-zephyr-running-on-nrf52832/380802"]You say you get the error with one board, but not the other.&lt;br /&gt;Are the two boards different[/quote]
&lt;p&gt;i did not write this, and for simplicity lets leave the other board.&lt;/p&gt;
[quote userid="106736" url="~/f/nordic-q-a/90787/how-to-decipher-hard-fault-mpu-fault-on-zephyr-running-on-nrf52832/380802"]If you try to reproduce the issue 10 times in a row, do you always get the same issue?[/quote]
&lt;p&gt;i have one board that has the following fails, on a certain operation at about 70% fail 30% works&amp;nbsp;&lt;/p&gt;
&lt;p&gt;the fail is the following:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt; &amp;lt;inf&amp;gt; AUGU_SPI: nrfx_ppi_channel_alloc for spi: chan = 2
[00000010] &amp;lt;err&amp;gt; os: ***** MPU FAULT *****
[00000010] &amp;lt;err&amp;gt; os:   Stacking error (context area might be not valid)
[00000010] &amp;lt;err&amp;gt; os: r0/a1:  0x974b1c56  r1/a2:  0xa9037e23  r2/a3:  0xfd7b35b1
[00000010] &amp;lt;err&amp;gt; os: r3/a4:  0x04365cc4 r12/ip:  0x00000001 r14/lr:  0x00000000
[00000010] &amp;lt;err&amp;gt; os:  xpsr:  0x81000000
[00000010] [1;31m&amp;lt;err&amp;gt; os: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x00000000  s[ 3]:  0x00000000
[00000010] &amp;lt;err&amp;gt; os: s[ 4]:  0x00000000  s[ 5]:  0x00000000  s[ 6]:  0x00000000  s[ 7]:  0x00000000
[00000010] &amp;lt;err&amp;gt; os: s[ 8]:  0x00000000  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0xffffffff
[00000010] [1;31m&amp;lt;err&amp;gt; os: s[12]:  0x00000000  s[13]:  0x00000000  s[14]:  0x00000000  s[15]:  0xffffffff
[00000010] &amp;lt;err&amp;gt; os: fpscr:  0x00000000[0m
[00000010] &amp;lt;err&amp;gt; os: Faulting instruction address (r15/pc): 0x0003febc
[00000010] &amp;lt;err&amp;gt; os: &amp;gt;&amp;gt;&amp;gt; ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
[00000010] &amp;lt;err&amp;gt; os: Current thread: 0x20003200 (unknown)
[00000011] &amp;lt;err&amp;gt; fatal_error: Resetting system
*** Booting Zephyr OS build v2.6.99-ncs1-1  ***


[00000016] &amp;lt;inf&amp;gt; AUGU_SPI: nrfx_ppi_channel_alloc for spi: chan = 2
[00000017] &amp;lt;err&amp;gt; os: ***** MPU FAULT *****
[00000017] &amp;lt;err&amp;gt; os:   Stacking error (context area might be not valid)
[00000017] &amp;lt;err&amp;gt; os: r0/a1:  0xfd7b35b1  r1/a2:  0x04365cc4  r2/a3:  0x00000001
[00000017] &amp;lt;err&amp;gt; os: r3/a4:  0x00000000 r12/ip:  0x00000000 r14/lr:  0xe000ed00
[00000017] &amp;lt;err&amp;gt; os:  xpsr:  0x81000000[0m
[00000017] &amp;lt;err&amp;gt; os: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x00000000  s[ 3]:  0x00000000
[00000017] &amp;lt;err&amp;gt; os: s[ 4]:  0x00000000  s[ 5]:  0x00000000  s[ 6]:  0x00000000  s[ 7]:  0x00000000
[00000017] &amp;lt;err&amp;gt; os: s[ 8]:  0x00000000  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00000000
[00000017] &amp;lt;err&amp;gt; os: s[12]:  0x00000000  s[13]:  0xffffffff  s[14]:  0x00000000  s[15]:  0x00000000
[00000017] [1;31m&amp;lt;err&amp;gt; os: fpscr:  0x00000000
[00000017] &amp;lt;err&amp;gt; os: Faulting instruction address (r15/pc): 0x000321b8[0m
[00000017] &amp;lt;err&amp;gt; os: &amp;gt;&amp;gt;&amp;gt; ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
[00000017] &amp;lt;err&amp;gt; os: Current thread: 0x20003200 (unknown)
[00000017] &amp;lt;err&amp;gt; fatal_error: Resetting system
*** Booting Zephyr OS build v2.6.99-ncs1-1  ***


[00000008] &amp;lt;inf&amp;gt; AUGU_SPI: nrfx_ppi_channel_alloc for spi: chan = 2
[00000009] &amp;lt;err&amp;gt; os: ***** MPU FAULT *****
[00000009] &amp;lt;err&amp;gt; os:   Stacking error (context area might be not valid)
[00000009] &amp;lt;err&amp;gt; os: r0/a1:  0x974b1c56  r1/a2:  0xa9037e23  r2/a3:  0xfd7b35b1
[00000009] &amp;lt;err&amp;gt; os: r3/a4:  0x04365cc4 r12/ip:  0x20007742 r14/lr:  0x200073e0
[00000009] &amp;lt;err&amp;gt; os:  xpsr:  0x81000000
[00000009] &amp;lt;err&amp;gt; os: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x00000000  s[ 3]:  0x00000000
[00000009] &amp;lt;err&amp;gt; os: s[ 4]:  0x00000000  s[ 5]:  0x00000000  s[ 6]:  0x00000000  s[ 7]:  0x00000000
[00000009] &amp;lt;err&amp;gt; os: s[ 8]:  0x00000000  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00000000
[00000009] [1;31m&amp;lt;err&amp;gt; os: s[12]:  0x00000000  s[13]:  0x00000000  s[14]:  0x00000000  s[15]:  0xffffffff
[00000009] &amp;lt;err&amp;gt; os: fpscr:  0x00000000
[00000009] &amp;lt;err&amp;gt; os: Faulting instruction address (r15/pc): 0x0003feb2
[00000009] &amp;lt;err&amp;gt; os: &amp;gt;&amp;gt;&amp;gt; ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0m
[00000009] &amp;lt;err&amp;gt; os: Current thread: 0x20003200 (unknown)
[00000010] &amp;lt;err&amp;gt; fatal_error: Resetting system
*** Booting Zephyr OS build v2.6.99-ncs1-1  ***


[00000008] &amp;lt;inf&amp;gt; AUGU_SPI: nrfx_ppi_channel_alloc for spi: chan = 2
[00000009] &amp;lt;err&amp;gt; os: ***** MPU FAULT *****
[00000009] &amp;lt;err&amp;gt; os:   Stacking error (context area might be not valid)
[00000009] [1;31m&amp;lt;err&amp;gt; os: r0/a1:  0x974b1c56  r1/a2:  0xa9037e23  r2/a3:  0xfd7b35b1
[00000009] &amp;lt;err&amp;gt; os: r3/a4:  0x04365cc4 r12/ip:  0x00000001 r14/lr:  0x00000000
[00000009] &amp;lt;err&amp;gt; os:  xpsr:  0x81000000
[00000009] &amp;lt;err&amp;gt; os: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x00000000  s[ 3]:  0xffffffff
[00000009] &amp;lt;err&amp;gt; os: s[ 4]:  0x00000000  s[ 5]:  0x00000000  s[ 6]:  0x00000000  s[ 7]:  0x00000000
[00000009] [1;31m&amp;lt;err&amp;gt; os: s[ 8]:  0x00000000  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00000000
[00000009] &amp;lt;err&amp;gt; os: s[12]:  0x00000000  s[13]:  0x00000000  s[14]:  0x00000000  s[15]:  0xffffffff
[00000009] &amp;lt;err&amp;gt; os: fpscr:  0x00000000
[00000009] &amp;lt;err&amp;gt; os: Faulting instruction address (r15/pc): 0x0003feb2
[00000009] &amp;lt;err&amp;gt; os: &amp;gt;&amp;gt;&amp;gt; ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
[00000009] [1;31m&amp;lt;err&amp;gt; os: Current thread: 0x20003200 (unknown)
[00000010] &amp;lt;err&amp;gt; fatal_error: Resetting system
*** Booting Zephyr OS build v2.6.99-ncs1-1  ***


[00000017] &amp;lt;inf&amp;gt; AUGU_SPI: nrfx_ppi_channel_alloc for spi: chan = 2
[00000018] &amp;lt;err&amp;gt; os: ***** MPU FAULT *****
[00000018] &amp;lt;err&amp;gt; os:   Stacking error (context area might be not valid)
[00000018] &amp;lt;err&amp;gt; os: r0/a1:  0x974b1c56  r1/a2:  0xa9037e23  r2/a3:  0xfd7b35b1
[00000018] &amp;lt;err&amp;gt; os: r3/a4:  0x04365cc4 r12/ip:  0x00000001 r14/lr:  0x00000000
[00000018] &amp;lt;err&amp;gt; os:  xpsr:  0x81000000
[00000018] &amp;lt;err&amp;gt; os: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x00000000  s[ 3]:  0x00000000
[00000018] &amp;lt;err&amp;gt; os: s[ 4]:  0x00000000  s[ 5]:  0x00000000  s[ 6]:  0x00000000  s[ 7]:  0x00000000
[00000018] &amp;lt;err&amp;gt; os: s[ 8]:  0x00000000  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00000000
[00000018] &amp;lt;err&amp;gt; os: s[12]:  0x00000000  s[13]:  0x00000000  s[14]:  0x00000000  s[15]:  0xffffffff
[00000018] &amp;lt;err&amp;gt; os: fpscr:  0x00000000
[00000018] &amp;lt;err&amp;gt; os: Faulting instruction address (r15/pc): 0x0003feb2
[00000018] &amp;lt;err&amp;gt; os: &amp;gt;&amp;gt;&amp;gt; ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
[00000018] &amp;lt;err&amp;gt; os: Current thread: 0x20003200 (unknown)
[00000018] &amp;lt;err&amp;gt; fatal_error: Resetting system
*** Booting Zephyr OS build v2.6.99-ncs1-1  ***


# at restart
[00000000] &amp;lt;inf&amp;gt; COMM_MNG: Bluetooth advertising started! duration = 30000
[00000000] &amp;lt;err&amp;gt; os: ***** MPU FAULT *****
[00000000] &amp;lt;err&amp;gt; os:   Stacking error (context area might be not valid)
[00000000] &amp;lt;err&amp;gt; os: r0/a1:  0xfd7b35b1  r1/a2:  0x04365cc4  r2/a3:  0x00000001
[00000000] &amp;lt;err&amp;gt; os: r3/a4:  0x00000000 r12/ip:  0x20003200 r14/lr:  0x00000000
[00000000] &amp;lt;err&amp;gt; os:  xpsr:  0x81000000
[00000000] &amp;lt;err&amp;gt; os: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x00000000  s[ 3]:  0x00000000
[00000000] &amp;lt;err&amp;gt; os: s[ 4]:  0x00000000  s[ 5]:  0x00000000  s[ 6]:  0x00000000  s[ 7]:  0x00000000
[00000000] &amp;lt;err&amp;gt; os: s[ 8]:  0x00000000  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00000000
[00000000] &amp;lt;err&amp;gt; os: s[12]:  0x00000000  s[13]:  0x00000000  s[14]:  0x00000000  s[15]:  0xffffffff
[00000000] &amp;lt;err&amp;gt; os: fpscr:  0x00000000
[00000000] &amp;lt;err&amp;gt; os: Faulting instruction address (r15/pc): 0x0003feb2
[00000000] &amp;lt;err&amp;gt; os: &amp;gt;&amp;gt;&amp;gt; ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
[00000000] &amp;lt;err&amp;gt; os: Current thread: 0x20003200 (unknown)
[00000002] &amp;lt;err&amp;gt; fatal_error: Resetting system
*** Booting Zephyr OS build v2.6.99-ncs1-1  ***&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and it sometimes fails on init at restart but maybe 5 or 10% fail out of 90-95% pass&amp;nbsp;&lt;/p&gt;
[quote userid="106736" url="~/f/nordic-q-a/90787/how-to-decipher-hard-fault-mpu-fault-on-zephyr-running-on-nrf52832/380802"]Do you create your own ISR?&lt;br /&gt;If so, can you post the code of these (only the ISR)?[/quote]
&lt;p&gt;not sure what you mean by create my own ISR, i implement interrupt handlers like in this case:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void drdy_read_callback(void* ctx, uint8_t *rx_buff, int size)
{
	const struct device *iis_dev = (const struct device *)ctx;
	struct iis3dwb_data *data = iis_dev-&amp;gt;data;
	static int run_idx = 0;

	x_arrays[fill_sample_buff_idx][run_idx] = (uint16_t)(((uint16_t)(rx_buff[2]) &amp;lt;&amp;lt; 8) | rx_buff[1] );
	y_arrays[fill_sample_buff_idx][run_idx] = (uint16_t)(((uint16_t)(rx_buff[4]) &amp;lt;&amp;lt; 8) | rx_buff[3] );
	z_arrays[fill_sample_buff_idx][run_idx] = (uint16_t)(((uint16_t)(rx_buff[6]) &amp;lt;&amp;lt; 8) | rx_buff[5] );
	run_idx++;

	curr_ts = nrfx_timer_capture_get(data-&amp;gt;timer, 0);
	if (0 != start_ts )
	{
		curr_diff = curr_ts - last_ts;
		max_diff = (max_diff &amp;lt; curr_diff) ? curr_diff : max_diff;
		min_diff = (min_diff &amp;gt; curr_diff) ? curr_diff : min_diff;
		total_diff += curr_diff;
		int_num++;
		//nominal delta_t (based on ODR 26667HZ) is 37.5us
		//the diff must be grater than 0.5*37.5
		//the diff must be less than 1.5*37.5us
		//the actual values are in timer ticks that is *16
		if(curr_diff &amp;gt; 900)
		{
			bad_big_diff++;
		}
		else if(curr_diff &amp;lt; 300)
		{
			bad_small_diff++;
		}
	}
	else
	{
		start_ts = curr_ts;
	}
	last_ts = curr_ts;

	if( buffer_size &amp;lt;= run_idx )
	{
		run_idx = 0;
		if ( true == app_buff_busy ) 
		{
			buff_overrun = true;
			return;
		}
		int temp_idx = app_used_buff_idx;
		app_used_buff_idx = fill_sample_buff_idx;
		fill_sample_buff_idx = temp_idx;
		app_buff_busy = true;
		k_sem_give(&amp;amp;data-&amp;gt;gpio_sem);
	}
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;i also have spi_done handler and use enable ppi with timer to send spi request from a sensor&lt;/p&gt;
&lt;p&gt;i do open a thread by a function cal of &amp;quot;trigger_set&amp;quot; and let it close gracefully when sampling is done&lt;/p&gt;
&lt;p&gt;the thread open looks like so:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void iis3dwb_init_thread(const struct device *dev)
{
	struct iis3dwb_data *iis3dwb = dev-&amp;gt;data;

#if defined(CONFIG_IIS3DWB_TRIGGER_OWN_THREAD)
	k_sem_init(&amp;amp;iis3dwb-&amp;gt;gpio_sem, 0, UINT_MAX);
	sampling_on = true;

	k_thread_create(&amp;amp;iis3dwb-&amp;gt;thread, iis3dwb-&amp;gt;thread_stack,
					CONFIG_IIS3DWB_THREAD_STACK_SIZE,
					(k_thread_entry_t)iis3dwb_sampling_thread, (void*)dev,
					0, NULL, K_PRIO_COOP(CONFIG_IIS3DWB_THREAD_PRIORITY),
					0, K_NO_WAIT);		

#endif
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and the thread itself:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#ifdef CONFIG_IIS3DWB_TRIGGER_OWN_THREAD
static void iis3dwb_sampling_thread(int dev_ptr, int unused)
{
	const struct device *dev = INT_TO_POINTER(dev_ptr);
	struct iis3dwb_data *data = dev-&amp;gt;data;
	ARG_UNUSED(unused);
	
	k_sem_take(&amp;amp;data-&amp;gt;gpio_sem, K_FOREVER);
	buffer_size = CONFIG_IIS3DWB_FIFO_TH;
	start_ts = 0;

	while ( sampling_on ) 
	{
		app_buff_busy = false;
		k_sem_take(&amp;amp;data-&amp;gt;gpio_sem, K_FOREVER);
		augu_sensor_stream_data_t trig_data;
		trig_data.start_ts = start_ts;
		trig_data.end_ts = last_ts;
		trig_data.buff_size = buffer_size;
		trig_data.x_buff = x_arrays[app_used_buff_idx];
		trig_data.y_buff = y_arrays[app_used_buff_idx];
		trig_data.z_buff = z_arrays[app_used_buff_idx];
		trig_data.overrun = buff_overrun;
		if (data-&amp;gt;drdy_handler)
		{
			data-&amp;gt;drdy_handler(dev, trig_data);
		}
	}
}

#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;any ideas ?&lt;/p&gt;
&lt;p&gt;hope to read you soon&lt;/p&gt;
&lt;p&gt;best regards&lt;/p&gt;
&lt;p&gt;Ziv&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to decipher HARD FAULT / MPU FAULT on zephyr running on nrf52832</title><link>https://devzone.nordicsemi.com/thread/380802?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2022 10:30:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b1040356-e69d-48d1-9dc4-85412323d054</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;B: &lt;br /&gt;In your PROJECT/build/zephyr folder, there is a set of files.&lt;br /&gt;Sometimes it is useful to have a look at the zephyr.elf file, and find the Faulting instruction address.&lt;br /&gt;However, in my experience, these tools are more useful for debugging:&lt;br /&gt;1. Eventual error messages or asserts from the crash.&lt;br /&gt;2. Debugging functionality, see &lt;a href="https://www.youtube.com/watch?v=MGsZJpdLtco"&gt;Our Debugging with VS Code tutorial&lt;/a&gt;.&lt;br /&gt;3. Using the printk function to debug.&lt;/p&gt;
&lt;p&gt;A:&lt;/p&gt;
&lt;p&gt;I will help you debug some then. Lets start with some questions.&lt;/p&gt;
&lt;p&gt;You say you get the error with one board, but not the other.&lt;br /&gt;Are the two boards different?&lt;/p&gt;
&lt;p&gt;If you try to reproduce the issue 10 times in a row, do you always get the same issue?&lt;/p&gt;
&lt;p&gt;Do you create your own ISR?&lt;br /&gt;If so, can you post the code of these (only the ISR)?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to decipher HARD FAULT / MPU FAULT on zephyr running on nrf52832</title><link>https://devzone.nordicsemi.com/thread/380800?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2022 10:10:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6db334b1-e222-40c8-87d2-5ea4494833ee</guid><dc:creator>ziv123</dc:creator><description>&lt;p&gt;with both A and B&lt;/p&gt;
&lt;p&gt;A is a bit more urgent but B is crucial as well&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to decipher HARD FAULT / MPU FAULT on zephyr running on nrf52832</title><link>https://devzone.nordicsemi.com/thread/380797?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2022 10:03:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ba21eb5-654d-4836-94d8-3cc278544179</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi Ziv,&lt;/p&gt;
&lt;p&gt;To clarify, are you asking with help to either:&lt;/p&gt;
&lt;p&gt;A. Solve this issue you have, or&lt;/p&gt;
&lt;p&gt;B. Learn how you can use the Fault messages for debugging in general&lt;/p&gt;
&lt;p&gt;?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to decipher HARD FAULT / MPU FAULT on zephyr running on nrf52832</title><link>https://devzone.nordicsemi.com/thread/380794?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2022 09:58:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:251a32f0-62d6-4f09-ae49-05d8e216b2fe</guid><dc:creator>ziv123</dc:creator><description>&lt;p&gt;hi Sigurd&amp;nbsp;&lt;/p&gt;
&lt;p&gt;yes i do create threads in my code but not from inside an ISR&amp;nbsp;&lt;/p&gt;
&lt;p&gt;i don&amp;#39;t think the configs changed the type of error its just a different git branch failing on a different reason, just wanted to show that the configs did not add any input (including thread remains &amp;#39;unknown&amp;#39;), as far as i understand, on both cases&lt;/p&gt;
&lt;p&gt;hope to read you soon&lt;/p&gt;
&lt;p&gt;best regards&lt;/p&gt;
&lt;p&gt;Ziv&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to decipher HARD FAULT / MPU FAULT on zephyr running on nrf52832</title><link>https://devzone.nordicsemi.com/thread/380779?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2022 09:22:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5710cf4-2323-4bfd-8e0d-5fd50fade2ac</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi Ziv,&lt;/p&gt;
&lt;p&gt;As these configurations are for debugging, it is odd that they change the way your code fail.&lt;br /&gt;If you try to reproduce the issue 10 times in a row, do you always get the same issue?&lt;/p&gt;
&lt;p&gt;In your first error in this ticket, the error says that you should not create new thread inside your interrupts. Do you create any interrupts in your own code?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to decipher HARD FAULT / MPU FAULT on zephyr running on nrf52832</title><link>https://devzone.nordicsemi.com/thread/380747?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2022 07:41:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b3b7f84-9809-4935-8b5c-e962377989ad</guid><dc:creator>ziv123</dc:creator><description>&lt;p&gt;hi Sigurd&lt;/p&gt;
&lt;p&gt;&amp;nbsp;with the mentioned configs i see the following&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;ASSERTION FAIL [z_spin_lock_valid(l)] @ WEST_TOPDIR/zephyr/include/spinlock.h:129

  Recursive spinlock 0x5a7

[00000033] &amp;lt;err&amp;gt; os: r0/a1:  0x00000004  r1/a2:  0x00000081  r2/a3:  0x00000000
[00000033] &amp;lt;err&amp;gt; os: r3/a4:  0x00000007 r12/ip:  0x80000000 r14/lr:  0x0001378d
[00000033] &amp;lt;err&amp;gt; os:  xpsr:  0x61000000
[00000034] &amp;lt;err&amp;gt; os: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x00000000  s[ 3]:  0x00000000
[00000034] &amp;lt;err&amp;gt; os: s[ 4]:  0x00000000  s[ 5]:  0x00000000  s[ 6]:  0x00000000  s[ 7]:  0x00000000
[00000035] &amp;lt;err&amp;gt; os: s[ 8]:  0x00000000  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00000000
[00000035] &amp;lt;err&amp;gt; os: s[12]:  0x00000000  s[13]:  0x00000000  s[14]:  0x00000000  s[15]:  0x00000000
[00000035] &amp;lt;err&amp;gt; os: fpscr:  0x00000000
[00000036] [1;31m&amp;lt;err&amp;gt; os: Faulting instruction address (r15/pc): 0x000344ee
[00000036] &amp;lt;err&amp;gt; os: &amp;gt;&amp;gt;&amp;gt; ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
[00000036] &amp;lt;err&amp;gt; os: Current thread: 0x20002af0 (main)
[00021741] &amp;lt;err&amp;gt; os: Halting system&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;also get this type of fail on&amp;nbsp;a different&lt;span&gt;&amp;nbsp;&lt;/span&gt;branch&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;ASSERTION FAIL [r &amp;gt;= 0] @ WEST_TOPDIR/zephyr/drivers/sensor/nrf5/temp_nrf5.c:65

[00000095] &amp;lt;err&amp;gt; os: r0/a1:  0x00000004  r1/a2:  0x00000041  r2/a3:  0x20003218
[00000095] &amp;lt;err&amp;gt; os: r3/a4:  0x00000009 r12/ip:  0xfa000000 r14/lr:  0x0002ab2b
[00000095] &amp;lt;err&amp;gt; os:  xpsr:  0x41000000[0m
[00000095] &amp;lt;err&amp;gt; os: s[ 0]:  0x00000000  s[ 1]:  0x00000003  s[ 2]:  0x00000000  s[ 3]:  0x00000000
[00000095] &amp;lt;err&amp;gt; os: s[ 4]:  0x00000000  s[ 5]:  0x00000000  s[ 6]:  0x00000000  s[ 7]:  0x00000000
[00000095] &amp;lt;err&amp;gt; os: s[ 8]:  0x00000000  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00000000
[00000095] &amp;lt;err&amp;gt; os: s[12]:  0x00000000  s[13]:  0x00000000  s[14]:  0x0000fa4d  s[15]:  0x000000fa
[00000095] [1;31m&amp;lt;err&amp;gt; os: fpscr:  0x00000000
[00000095] &amp;lt;err&amp;gt; os: Faulting instruction address (r15/pc): 0x0003a980
[00000095] [1;31m&amp;lt;err&amp;gt; os: &amp;gt;&amp;gt;&amp;gt; ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
[00000095] &amp;lt;err&amp;gt; os: Current thread: 0x20001f48 (unknown)
[00000096] &amp;lt;err&amp;gt; os: Halting system&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;still not sure how it directs me to where the problem is, beside me thinking that this is a different type of problem then the one in the beginning of this thread&lt;/p&gt;
&lt;p&gt;what am i missing to understand that better and how can i debug it ?&lt;/p&gt;
&lt;p&gt;hope to read you soon&lt;/p&gt;
&lt;p&gt;best regards&lt;/p&gt;
&lt;p&gt;Ziv&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to decipher HARD FAULT / MPU FAULT on zephyr running on nrf52832</title><link>https://devzone.nordicsemi.com/thread/380620?ContentTypeID=1</link><pubDate>Mon, 08 Aug 2022 12:52:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1654584-c649-4049-9e95-b27bb90a2ddc</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi Ziv,&lt;/p&gt;
&lt;p&gt;If you set &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/kconfig/index.html#CONFIG_THREAD_NAME"&gt;CONFIG_THREAD_NAME&lt;/a&gt;, the fault will usually list the thread name instead of (unknown).&lt;/p&gt;
&lt;p&gt;I usually use this together with &amp;quot;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/kconfig/index.html#CONFIG_RESET_ON_FATAL_ERROR"&gt;CONFIG_RESET_ON_FATAL_ERROR&lt;/a&gt;=n&amp;quot; , so I do not get spammed down by fault logs.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>