<?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>HardFault in SoftDevice @ 0x20B55</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95315/hardfault-in-softdevice-0x20b55</link><description>Hi 
 I have a hardfault which was triggered at address 0x20B55. The memory region from the SoftDevice is from 0x1000 – 0x26633. 
 Can you tell me what is the root cause of this HardFault? I have no access to this region because its inside of the softdevice</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 24 Feb 2023 09:59:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95315/hardfault-in-softdevice-0x20b55" /><item><title>RE: HardFault in SoftDevice @ 0x20B55</title><link>https://devzone.nordicsemi.com/thread/411889?ContentTypeID=1</link><pubDate>Fri, 24 Feb 2023 09:59:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17dc00e8-7869-4a78-9207-d3a30ea8f8b3</guid><dc:creator>Dominik Eugster</dc:creator><description>&lt;p&gt;was a problem in the user code, case closed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault in SoftDevice @ 0x20B55</title><link>https://devzone.nordicsemi.com/thread/404335?ContentTypeID=1</link><pubDate>Wed, 11 Jan 2023 13:43:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b84db392-2d4e-47eb-bea6-e70eaf681071</guid><dc:creator>Sigurd</dc:creator><description>[quote user="Dominik Eugster"]We are testing this, but it looks like this was the problem of the HardFault, keep you posted.[/quote]
&lt;p&gt;Great!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault in SoftDevice @ 0x20B55</title><link>https://devzone.nordicsemi.com/thread/404323?ContentTypeID=1</link><pubDate>Wed, 11 Jan 2023 13:13:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db388fd7-e3d0-4d92-8adb-490f36e0b625</guid><dc:creator>Dominik Eugster</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;We found an Array overflow after the ringbuffer handlig on our side before calling:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint32_t common_ble_gatt_custon_uart_write(ble_cus_t* p_cus, uint8_t* p_msg, uint8_t len)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;We are testing this, but it looks like this was the problem of the HardFault, keep you posted.&lt;/p&gt;
&lt;p&gt;Regard&amp;#39;s&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault in SoftDevice @ 0x20B55</title><link>https://devzone.nordicsemi.com/thread/404074?ContentTypeID=1</link><pubDate>Tue, 10 Jan 2023 12:07:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2a8a9dd-30e5-489e-802c-baee11ba7d2f</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;1) I don&amp;#39;t see anything wrong with the&amp;nbsp;common_ble_gatt_custon_name_write() function itself. Could you show the code where you call&amp;nbsp;common_ble_gatt_custon_name_write() ?&lt;/p&gt;
&lt;p&gt;2) Could you also post the code used when adding/init this&amp;nbsp;characteristic?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault in SoftDevice @ 0x20B55</title><link>https://devzone.nordicsemi.com/thread/403859?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2023 13:25:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b77b43cb-c703-4fc4-b903-7a1d6ad6c335</guid><dc:creator>Dominik Eugster</dc:creator><description>&lt;p&gt;No, it&amp;#39;s not alway happening. It happens during runnning realease without debugger every some days which makes it really difficult to get the root-cause. Its running in a mesh struct of 28 devices connected over the BLE-mesh.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint32_t common_ble_gatt_custon_name_write(ble_cus_t* p_cus, uint8_t* p_msg, uint8_t len)
{
	BLE_CUS_PRINTF(&amp;quot;-- ble gatt custom name write\r\n&amp;quot;);

	if (p_cus == NULL)
	{
		return NRF_ERROR_NULL;
	}

	uint32_t err_code = NRF_SUCCESS;
	ble_gatts_value_t gatts_value;
	// Initialize value struct.
	memset(&amp;amp;gatts_value, 0, sizeof(gatts_value));
	gatts_value.len     = len;
	gatts_value.offset  = 0;
	gatts_value.p_value = p_msg;
	// Update database.
	err_code = sd_ble_gatts_value_set(p_cus-&amp;gt;conn_handle,
	                                  p_cus-&amp;gt;custom_value_2_handles.value_handle,
	                                  &amp;amp;gatts_value);
	return err_code;
}

.... 

uint32_t common_ble_gatt_custon_uart_write(ble_cus_t* p_cus, uint8_t* p_msg, uint8_t len)
{
	if (p_cus == NULL)
	{
		return NRF_ERROR_NULL;
	}

	//BLE_CUS_PRINTF(&amp;quot;-- ble gatt custom uart write\r\n&amp;quot;);
	BLE_CUS_PRINTF(&amp;quot;send msg size %d, 0x&amp;quot;, len);

	for (uint8_t i = 0; i &amp;lt; len; i++)
	{
		BLE_CUS_PRINTF(&amp;quot;%02X&amp;quot;, p_msg[i]);
	}

	//BLE_CUS_PRINTF(&amp;quot;\r\n&amp;quot;);
	BLE_CUS_PRINTF(&amp;quot; - &amp;quot;);
	uint32_t err_code = NRF_SUCCESS;
	ble_gatts_value_t gatts_value;
	// Initialize value struct.
	memset(&amp;amp;gatts_value, 0, sizeof(gatts_value));
	gatts_value.len     = len;
	gatts_value.offset  = 0;
	gatts_value.p_value = p_msg;
	// Update database.
	err_code = sd_ble_gatts_value_set(p_cus-&amp;gt;conn_handle,
	                                  p_cus-&amp;gt;custom_value_1_handles.value_handle,
	                                  &amp;amp;gatts_value);

	if (err_code != NRF_SUCCESS)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault in SoftDevice @ 0x20B55</title><link>https://devzone.nordicsemi.com/thread/403852?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2023 13:13:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7c282f7-2423-4aa2-8510-2aa76580fef5</guid><dc:creator>Sigurd</dc:creator><description>[quote user="Dominik Eugster"]&lt;p&gt;this is called from a app_timer_create with interrupt priority 6.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div&gt;&lt;a href="#"&gt;&lt;/a&gt;&lt;/div&gt;[/quote]
&lt;p&gt;Ok, good.&lt;/p&gt;
&lt;p&gt;Is this consistent? Does it always happen when you call&amp;nbsp;&lt;span&gt;sd_ble_gatts_value_set()?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Could you show&amp;nbsp;your&amp;nbsp;code that calls&amp;nbsp;&lt;span&gt;sd_ble_gatts_value_set() ?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault in SoftDevice @ 0x20B55</title><link>https://devzone.nordicsemi.com/thread/403842?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2023 12:41:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1cb7fb92-e989-4917-a94a-0253017c19f9</guid><dc:creator>Dominik Eugster</dc:creator><description>&lt;p&gt;this is called from a app_timer_create with interrupt priority 6.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;// &amp;lt;i&amp;gt; Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
// &amp;lt;0=&amp;gt; 0 (highest) 
// &amp;lt;1=&amp;gt; 1 
// &amp;lt;2=&amp;gt; 2 
// &amp;lt;3=&amp;gt; 3 
// &amp;lt;4=&amp;gt; 4 
// &amp;lt;5=&amp;gt; 5 
// &amp;lt;6=&amp;gt; 6 
// &amp;lt;7=&amp;gt; 7 

#define APP_TIMER_CONFIG_IRQ_PRIORITY 6

ret_code_t app_timer_init(void)

#define SWI_IRQ_PRI             APP_TIMER_CONFIG_IRQ_PRIORITY               /**&amp;lt; Priority of the SWI  interrupt (used for updating the timer list). */

NVIC_ClearPendingIRQ(SWI_IRQn);
NVIC_SetPriority(SWI_IRQn, SWI_IRQ_PRI);
NVIC_EnableIRQ(SWI_IRQn);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault in SoftDevice @ 0x20B55</title><link>https://devzone.nordicsemi.com/thread/403624?ContentTypeID=1</link><pubDate>Fri, 06 Jan 2023 14:53:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:abbca365-6349-4cf3-9135-4901ff7d1296</guid><dc:creator>Sigurd</dc:creator><description>[quote user="Dominik Eugster"]We are working with the SoftDevice 7.2.0 S140, the 7.3.0 is available, could this be a try to upadte or what do you guess?[/quote]
&lt;p&gt;No, I don&amp;#39;t think SD version have something to do with this.&lt;/p&gt;
[quote user="Dominik Eugster"]&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;cursor:zoom-in;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/4213.Code-Statement.png" /&gt;&lt;/p&gt;[/quote]
&lt;p&gt;Most common way to get a hardfault when calling a sd_ function, is that it&amp;#39;s called from a context that is in a too high interrupt priority level. So you should try lowering the&amp;nbsp;&lt;span&gt;interrupt priority for the context you are calling&amp;nbsp;sd_ble_gatts_value_set() from.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault in SoftDevice @ 0x20B55</title><link>https://devzone.nordicsemi.com/thread/403540?ContentTypeID=1</link><pubDate>Fri, 06 Jan 2023 09:57:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ea0810a-da45-4f1a-b2e1-f0b90fb58fc3</guid><dc:creator>Dominik Eugster</dc:creator><description>&lt;p&gt;We got additional information about an occured HardFault right now, maybe you can help us to clarify the root cause of this:&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/6082.hardfault.png" /&gt;&lt;/p&gt;
&lt;p&gt;CFSR Bit 17 -&amp;gt;&amp;nbsp; [17] = &amp;quot;The processor has attempted to execute an instruction that makes illegal use of the EPSR&amp;quot;,&lt;/p&gt;
&lt;p&gt;HFSR Bit 30 -&amp;gt; &amp;nbsp; FORCED - This means a configurable fault (i.e. the fault types we discussed in previous sections) was escalated to a HardFault, either because the configurable fault handler was not enabled or a fault occurred within the handler.&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/Code-Statement.png" /&gt;&lt;/p&gt;
&lt;p&gt;We are working with the SoftDevice 7.2.0 S140, the 7.3.0 is available, could this be a try to upadte or what do you guess?&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault in SoftDevice @ 0x20B55</title><link>https://devzone.nordicsemi.com/thread/403032?ContentTypeID=1</link><pubDate>Tue, 03 Jan 2023 16:51:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ce4825d-c1b1-401c-a27b-d96774ac2a3e</guid><dc:creator>Dominik Eugster</dc:creator><description>&lt;p&gt;1) Unfurtenatly we have no debugger connected&lt;/p&gt;
&lt;p&gt;The hardfault handler is enabled.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define HARDFAULT_HANDLER_ENABLED 1&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The call is from this code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void HardFault_Handler(void)
{
	uint32_t* sp = (uint32_t*) __get_MSP();  // Get stack pointer
	uint32_t ia = sp[12]; // Get instruction address from stack
	m_hardfault_type = hardfault_hardfault;
	m_hardfault_address = ia;
	printf(&amp;quot;Hard Faults at address: 0x%08x\r\n&amp;quot;, (unsigned int)ia);
	hal_ext_uart_buffer_flush();    // print out all bytes

	while (1)
		;
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I will try to get some more detialed information about the hardfault&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault in SoftDevice @ 0x20B55</title><link>https://devzone.nordicsemi.com/thread/403017?ContentTypeID=1</link><pubDate>Tue, 03 Jan 2023 15:28:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87f222b9-71ac-4fc1-85e8-5eafccd091b2</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The address does not seem to correspond to any softdevice assert.&lt;/p&gt;
&lt;p&gt;1) Do you have any logs? or call-stack info that shows this fault?&lt;/p&gt;
&lt;p&gt;2) Was&amp;nbsp;app_error_fault_handler() called?&lt;/p&gt;
&lt;p&gt;3) Make sure that the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_hardfault.html"&gt;hardfault library&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;is used.&lt;/p&gt;
&lt;p&gt;Add these to your projects:&lt;/p&gt;
&lt;p&gt;$(SDK_ROOT)/components/libraries/hardfault/hardfault_implementation.c&lt;br /&gt;$(SDK_ROOT)/components/libraries/hardfault/nrf52/handler/hardfault_handler_gcc.c&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And set HARDFAULT_HANDLER_ENABLED to 1 in sdk_config.h, and add DEBUG_NRF in your preprocessor definitions&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault in SoftDevice @ 0x20B55</title><link>https://devzone.nordicsemi.com/thread/402939?ContentTypeID=1</link><pubDate>Tue, 03 Jan 2023 12:06:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b11532d-52d5-450b-a263-17970191a7f4</guid><dc:creator>Dominik Eugster</dc:creator><description>&lt;p&gt;nRF5 SDK v17.1.0 with s140_nrf52_7.2.0_softdevice.hex&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault in SoftDevice @ 0x20B55</title><link>https://devzone.nordicsemi.com/thread/402934?ContentTypeID=1</link><pubDate>Tue, 03 Jan 2023 11:39:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1a3eb67-db04-48c0-b891-15b72965eae0</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;What&amp;nbsp;SoftDevice variant and version are you using?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>