<?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>HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/88015/hard-fault-during-xtaskresumeall-after-ending-a-dfu-session-and-disabling-the-softdevice</link><description>Hi all, 
 I am working on nrf52840 chip with SDK 17.0.2. 
 Our application runs smoothly and we want to add it the capabilities of upgrading another nrf52840 chip using Nordic DFU service. 
 In order to do that we turn off our application RADIO, suspend</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 27 May 2022 11:49:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/88015/hard-fault-during-xtaskresumeall-after-ending-a-dfu-session-and-disabling-the-softdevice" /><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/369766?ContentTypeID=1</link><pubDate>Fri, 27 May 2022 11:49:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ccf2723-6773-4af8-89e0-bffb6bfa3e6a</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="Rafalino"]&amp;nbsp; &amp;nbsp; &amp;nbsp;my workaround &lt;span&gt;&amp;amp;&amp;amp; p_instance-&amp;gt;timer_id&amp;nbsp; &amp;nbsp;&lt;span&gt;seems to work but I don&amp;#39;t think this is the proper&lt;/span&gt;&lt;/span&gt;[/quote]
&lt;p&gt;Good find, and why do you think your workaround is not proper?&lt;/p&gt;
&lt;p&gt;I think your workaround is very&amp;nbsp;proper&amp;nbsp;to check if the timer_id is valid before attempting to access the API of that timer through that id.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/369691?ContentTypeID=1</link><pubDate>Thu, 26 May 2022 22:01:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:110db2b4-4078-4b0c-957d-9407e2e4de32</guid><dc:creator>Rafalino</dc:creator><description>&lt;p&gt;Hello Susheel,&lt;/p&gt;
&lt;p&gt;I have put a break point at timer.c inside&amp;nbsp;&lt;strong&gt;xTimerGenericCommand&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;at the point we call&lt;/p&gt;
&lt;p&gt;&amp;nbsp;xReturn = &lt;strong&gt;xQueueSendToBackFromISR&lt;/strong&gt;( xTimerQueue, &amp;amp;xMessage, pxHigherPriorityTaskWoken );&lt;/p&gt;
&lt;p&gt;Then I was able to look at the call stack.&lt;/p&gt;
&lt;p&gt;My finding are :&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;We perform &lt;strong&gt;nrf_ble_scan_start&lt;/strong&gt;&amp;nbsp;and when it returns with&amp;nbsp;&lt;strong&gt;BLE_GAP_EVT_DISCONNECTED&lt;/strong&gt;&amp;nbsp; we&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;call again&amp;nbsp; to&amp;nbsp;&lt;strong&gt;nrf_ble_scan_start &lt;/strong&gt;(should we call some cleaning function before ?)&lt;/p&gt;
&lt;p&gt;Then, what I see from the call stack is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;&lt;strong&gt;ble_conn_params.c&lt;/strong&gt;&amp;nbsp;&amp;nbsp;has &lt;strong&gt;on_disconnect&lt;/strong&gt; event handler&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;span&gt;conn_handle is 0 in my case and from&amp;nbsp;&lt;/span&gt;&lt;/span&gt;
&lt;pre class="c-mrkdwn__pre"&gt;ble_conn_params_instance_t * p_instance  = instance_get(conn_handle); &lt;/pre&gt;
&lt;span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span&gt;we get&amp;nbsp;&lt;/span&gt;&lt;b&gt;p_instance&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;span&gt;but it has everything set to 0&amp;nbsp; including the timer id.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; so although&amp;nbsp;&lt;/span&gt;(p_instance != NULL)&amp;nbsp; &amp;nbsp;is true, we get a garbage&amp;nbsp;&amp;nbsp;&lt;strong&gt;instance-&amp;gt;timer_id&amp;nbsp; &amp;nbsp;&lt;/strong&gt;and&lt;strong&gt;&amp;nbsp; &amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/strong&gt;then&amp;nbsp;&lt;span&gt;app_timer_stop(p_instance-&amp;gt;timer_id) leads to hard fault.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;my workaround &lt;span style="color:#ff0000;"&gt;&amp;amp;&amp;amp; p_instance-&amp;gt;timer_id&amp;nbsp; &amp;nbsp;&lt;span style="color:#000000;"&gt;seems to work but I don&amp;#39;t think this is the proper &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span style="color:#ff0000;"&gt;&lt;span style="color:#000000;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; solution.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;&lt;span style="color:#000000;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; What do you say?&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000080;"&gt;static void on_disconnect(ble_evt_t const * p_ble_evt)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;ret_code_t err_code;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; uint16_t conn_handle = p_ble_evt-&amp;gt;evt.gap_evt.conn_handle;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; ble_conn_params_instance_t * p_instance = instance_get(conn_handle);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; if (p_instance != NULL &lt;span style="color:#ff0000;"&gt;&amp;amp;&amp;amp; p_instance-&amp;gt;timer_id&lt;/span&gt;) /*&lt;span style="color:#008000;"&gt; Workaround&lt;/span&gt; */&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Stop timer if running&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; err_code = app_timer_stop(p_instance-&amp;gt;timer_id);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (err_code != NRF_SUCCESS)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;send_error_evt(err_code);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; instance_free(p_instance);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/hard_5F00_fault_5F00_ble_5F00_sdh_2D00_3.JPG" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/369612?ContentTypeID=1</link><pubDate>Wed, 25 May 2022 17:53:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e8b6c11-4c55-4ac7-856f-a0221ff24485</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;If you already have the XTAL LFCLK, why use RC? you can change&amp;nbsp;&lt;span&gt;NRF_SDH_CLOCK_LF_SRC&amp;nbsp; to 1.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If this does not fix, then I am starting to believe that it probably is not related to softdevice.&lt;br /&gt;We need to focus back on the tasks at hand. You already confirmed that it is not a stack overflow,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;If we can trust the hardfault stack frame which suggests that it is a timer task,&amp;nbsp; So start with commenting out creation of timers one by one until&amp;nbsp;&lt;span&gt;xTaskResumeAll does not crash. If all the timer creation code is commented out and no application timer are left and still able to trigger a hardfault, then we can forget about the timer task and assume that hardfault stack frame is useless in terms of info it holds to debug.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;move on by starting to comment out creating of tasks one by one until&amp;nbsp;xTaskResumeAll&amp;nbsp;does not create this hardfault, we would then atleast know which task resumption is creating this hardfault.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/369587?ContentTypeID=1</link><pubDate>Wed, 25 May 2022 14:47:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26607675-c4ea-47f1-9b18-6735b7296c75</guid><dc:creator>Rafalino</dc:creator><description>&lt;p&gt;Hello Susheel,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;NRF_SDH_CLOCK_LF_SRC is indeed set to 0.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I have&amp;nbsp;added delay of 200ms before&amp;nbsp;xTaskResumeAll&amp;nbsp; but it didn&amp;#39;t help.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span style="color:#008000;"&gt;/* sd_is_enabled is changed to false once we know that the SD is disabled (on brg_dfu_state_obs handler)*/&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#000080;"&gt;while(sd_is_enabled)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NRF_LOG_PROCESS();&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;wlt_utils_watchdog_feed();&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt; }&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="color:#000080;"&gt;nrf_delay_ms(200);&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000080;"&gt;if( !xTaskResumeAll () )&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; taskYIELD ();&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt; }&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000080;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000080;"&gt;&lt;span style="color:#000000;"&gt;Any more suggestions?&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f914.svg" title="Thinking"&gt;&amp;#x1f914;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/369540?ContentTypeID=1</link><pubDate>Wed, 25 May 2022 12:58:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d7165471-60dc-483d-a094-454a2c664332</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;What kind of clock the softdevice thinks it is using depends on the first parameter you give to&amp;nbsp;sd_softdevice_enable. If you are using&amp;nbsp;nrf_sdh_enable_request then the LFCLK the softdevice uses on the configuration you set with&amp;nbsp;NRF_SDH_CLOCK_LF_SRC in the sdk_config.h file. If this is set to 0, then you are making the softdevice think that it is using the internal RC which makes me think that the calibration might&lt;/p&gt;
&lt;p&gt;The while wait condition on&amp;nbsp;&lt;span&gt;sd_is_enabled&amp;nbsp;will still not help if the issue is with the extra delay needed with clock calibration (will only be possible if you have set&amp;nbsp;NRF_SDH_CLOCK_LF_SRC&amp;nbsp;to 0.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If none of that are relavent, then try to put about 80-100ms of extra delay just before&amp;nbsp;xTaskResumeAll&amp;nbsp;to confirm to check if this issue is with clock calibration or not. Because the clock calibration should not take more than 100ms worst case before it disables the softdevice.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/369506?ContentTypeID=1</link><pubDate>Wed, 25 May 2022 11:41:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cfaeabac-bfaf-427b-a7ed-53e81b889d39</guid><dc:creator>Rafalino</dc:creator><description>[quote userid="6207" url="~/f/nordic-q-a/88015/hard-fault-during-xtaskresumeall-after-ending-a-dfu-session-and-disabling-the-softdevice/369491#369491"]Can you show me how you are waiting to know that the softdevice is disabled?[/quote]
&lt;p&gt;This is the part of disabling the SD:&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000080;"&gt;err_code = nrf_sdh_disable_request();&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt; APP_ERROR_CHECK(err_code);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;/&lt;span style="color:#008000;"&gt;* sd_is_enabled is changed to false once we know that the SD is disabled (on brg_dfu_state_obs handler)*/&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#000080;"&gt;while(sd_is_enabled)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NRF_LOG_PROCESS();&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;wlt_utils_watchdog_feed();&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt; }&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt; if( !xTaskResumeAll () )&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt; taskYIELD ();&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt; }&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;And here is the event handler&amp;nbsp;:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000080;"&gt;static void brg_dfu_state_obs(nrf_sdh_state_evt_t state, void * p_context)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;UNUSED_PARAMETER(p_context);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NRF_LOG_INFO(&amp;quot;%s state = %d&amp;quot;, __FUNCTION__, state);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (state == NRF_SDH_EVT_STATE_DISABLED)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sd_is_enabled = false;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000080;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/88015/hard-fault-during-xtaskresumeall-after-ending-a-dfu-session-and-disabling-the-softdevice/369491#369491"]Are you using XTAL HFCLK and/or LFCLK? [/quote]
&lt;p&gt;We are calling the following in our application before we even start the Softdevice:&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000080;"&gt;nrf_drv_clock_hfclk_request(NULL);&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt; nrf_drv_clock_lfclk_request(NULL);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000080;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000000;"&gt;Any recommendation ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000080;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/369491?ContentTypeID=1</link><pubDate>Wed, 25 May 2022 10:49:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b887a37a-4b05-4506-96d2-cb0085b03bf4</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hmm,&amp;nbsp; Interesting observation.&lt;/p&gt;
[quote user=""]When we finish the DFU process we call&amp;nbsp;&lt;strong&gt;nrf_sdh_disable_request &lt;/strong&gt;and wait until we know that the Softdevice is disabled.[/quote]
&lt;p&gt;Can you show me how you are waiting to know that the softdevice is disabled?&lt;/p&gt;
&lt;p&gt;In the examples of FreeRTOS we deliver with our SDK, the softdevice events are pulled in a task called &amp;quot;softdevice_task&amp;quot;.&amp;nbsp;&lt;br /&gt;I am assuming that you are not using this task since you suspend all tasks just before enabling the softdevice. Which also makes me assume that all the activity of the softdevice and BLE is happening with a baremetal kind of event handling.&lt;/p&gt;
[quote user="Rafalino"]&lt;p&gt;&lt;span&gt;It feels as if there is an internal connection timeout at the Softdevice that is triggered once there is a connection that we somehow don&amp;#39;t clean when disable the&amp;nbsp;&lt;/span&gt;Softdevice&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Does that make sense&amp;nbsp;?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;[/quote]
&lt;p&gt;It seems like for some reason there is a need for larger delay that the wait you have in your application to know that the softdevice is disabled. Are you using XTAL HFCLK and/or LFCLK? or are you only using internal RC for the LFCLK? We have noticed that if you are using internal RC clocks and disable the softdevice in midst of internal clock calibration, then the softdevice disable function might return normally but takes longer than expected to actually disable the softdevice since it is busy calibrating internal clocks before actually servicing the disable softdevice request.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/369465?ContentTypeID=1</link><pubDate>Wed, 25 May 2022 09:20:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd466285-4fca-4a42-b722-6bc13b76b720</guid><dc:creator>Rafalino</dc:creator><description>&lt;p&gt;Hey Susheel,&lt;/p&gt;
&lt;p&gt;We are using &lt;span&gt;nrf_libuarte&amp;nbsp; but I have un-init that interface and disabled my UART task before enabling the Softdevice&amp;nbsp;so I don&amp;#39;t think that this is the case.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;As for&amp;nbsp;tickless disable - we are using&amp;nbsp;&lt;strong&gt;configUSE_TICKLESS_IDLE =&amp;nbsp;&lt;/strong&gt;&lt;strong&gt;0&lt;/strong&gt; by default.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;What I see in my testing is that If suspend&amp;nbsp;all my application tasks and then suspend the scheduler (via &lt;strong&gt;vTaskSuspendAll&lt;/strong&gt;&amp;nbsp;), enable Softdevice&amp;nbsp;and start BLE scanning before actually establishing BLE connection with the other chip&lt;strong&gt;, and at this point&lt;/strong&gt;&amp;nbsp;power off the remote chip so that the ble connection will fail, and then call disable Softdevice&amp;nbsp;and and resume scheduler - I do NOT see the hard fault and I am able to resume my application tasks.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;It feels as if there is an internal connection timeout at the Softdevice that is triggered once there is a connection that we somehow don&amp;#39;t clean when disable the&amp;nbsp;&lt;/span&gt;Softdevice&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Does that make sense&amp;nbsp;?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Rafalino&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/369263?ContentTypeID=1</link><pubDate>Tue, 24 May 2022 11:39:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0429059-38b1-413d-88fa-05b54d82a903</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;The issue is not with using the UARTE but using the libUARTE. If you are not using libuarte then this is not the same issue.&lt;/p&gt;
&lt;p&gt;But if you are using LibUARTE, then there is a bug in the way nrf_libuarte where a macro to initialize nrf_libuarte_async_t structure, particularly&amp;nbsp;&lt;span&gt;p_app_timer_t&amp;nbsp; is done incorrectly when using freertos (since app_timer_freertos.c uses different timer casting than the app_timer.c). The dirty hack was to set .end_val in the below lstruct to 0.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static app_timer_t xLibUarteCOM0_app_timer_data =
{
.end_val = 0xFFFFFFFFFFFFFFFFULL,
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This is just to make the freertos app_timer initialization pass and then properly initialize these structures later.&lt;/p&gt;
&lt;p&gt;If none of the above works, then I am thinking that this could be related to Tickless mode (if you have enabled it in FreeRTOSConfig.h file?)&lt;/p&gt;
&lt;p&gt;If the chip is waking up from sleep at the time of you resuming all tasks, then it might be some how related to the port specific changes we did on the tick interrupt handling. Can you disable tickless mode to see if you can still reproduce it?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So far based on your investigation&lt;/p&gt;
&lt;p&gt;1) You confirmed that there are no stack overflows caught when enabling stack overflow checks and increasing the timer stack.&lt;/p&gt;
&lt;p&gt;2) You applied or will apply the work around given in the link if you are using nrf_libuarte library.&lt;/p&gt;
&lt;p&gt;3) Try to see if tickless disable have the same effect.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/369250?ContentTypeID=1</link><pubDate>Tue, 24 May 2022 11:21:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:863f6c75-c2f9-4073-91c3-dd0533e15854</guid><dc:creator>Rafalino</dc:creator><description>&lt;p&gt;Hello Susheel,&lt;/p&gt;
&lt;p&gt;I have added the code that you suggested but could not see much on the call stack :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1653391201260v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As for the UARTE, we do use UARTE and I would like to add the workaround that you suggested but could not fully understand where to set&amp;nbsp;&lt;strong&gt;p_xLibUarteCOM0_app_timer_data-&amp;gt;end_val = 0x0ULL;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Can you clarify ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/369239?ContentTypeID=1</link><pubDate>Tue, 24 May 2022 10:50:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88dd30ac-b0fd-4438-b2f8-92cd79c6c8dd</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Then it might be possible that we are overlooking into the memory corruption direction. If this is not a memory corruption by stack overflow, then the application is somehow passing the wrong timerID.&lt;/p&gt;
&lt;p&gt;You can write a small code snippet like below in&amp;nbsp;&lt;strong&gt;prvProcessReceivedCommands&lt;/strong&gt;&lt;span&gt;&amp;nbsp; just before&amp;nbsp;&lt;strong&gt;uxListRemove&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;if (pxTimer-&amp;gt;pvTimerID == 0x0x1E200000)
{
    static volatile uint32_t counter = 0;
    counter++;     // &amp;lt;-- Put a breakpoint at this line
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Compile your code, flash and start the code in the debugger. Put the breakpoint at the &amp;quot;counter++&amp;quot; and run the application in an attempt to trigger the hardfault.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The debugger should halt at the breakpoint and now your function call stack should allow you to browse through the functions that lead to this breakpoint. Try to understand the context of how this value has been passed to pvTimerID.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Please note that there is known &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/81197/freertos-with-libuarte-incompatibility-between-app_timer-and-app_timer_freertos"&gt;bug in the libuarte library when using FreeRTOS &lt;/a&gt;as the macros use to initialize libuarte instances initialize the app_timer_freertos instances wrongly (after an incompatible casting). Please check if you are affected by this.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/369238?ContentTypeID=1</link><pubDate>Tue, 24 May 2022 10:37:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e83ccd62-c820-4b82-8576-ebb4c63d6d20</guid><dc:creator>Rafalino</dc:creator><description>&lt;p&gt;Hello Susheel,&lt;/p&gt;
&lt;p&gt;I have increased&amp;nbsp;&lt;strong&gt;configTIMER_TASK_STACK_DEPTH&amp;nbsp; &lt;/strong&gt;from 80 to 256 but still got the same hard fault .&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f612.svg" title="Unamused"&gt;&amp;#x1f612;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I then&amp;nbsp;&amp;nbsp;set&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;strong&gt;#define configCHECK_FOR_STACK_OVERFLOW&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; 1&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;and added&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;strong&gt;void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName )&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;while (1)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NRF_LOG_INFO(&amp;quot; %s %s&amp;quot;, __FUNCTION__, pcTaskName);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;But it didn&amp;#39;t jump into the above hook and I got the same&amp;nbsp;&lt;span&gt;hard fault&amp;nbsp;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000000;"&gt;What are we missing ?&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f914.svg" title="Thinking"&gt;&amp;#x1f914;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/369204?ContentTypeID=1</link><pubDate>Tue, 24 May 2022 08:21:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:779a491d-e22b-49ce-be4e-46ec2b1e2233</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="Rafalino"]app: xMessage.xMessageID = 8, pxTimer=0x0x00000A81 , pxTimer-&amp;gt;pvTimerID=0x0x1E200000[/quote]
&lt;p&gt;This address is not a valid RAM location. So I strongly suspecting a memory corruption. Since this is happening the Timer task context, I am assuming that your timer stack size is too small.&lt;/p&gt;
&lt;p&gt;Try increasing&amp;nbsp;&lt;code&gt;configTIMER_TASK_STACK_DEPTH in your FreeRTOSConfig.h file to a bigger value for testing.&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Also, Like I suggested in my previous reply. Enable stack overflow checks.&lt;br /&gt;&lt;/code&gt;&lt;/p&gt;
[quote user="Aryan"]You can enable &lt;a href="https://www.freertos.org/Stacks-and-stack-overflow-checking.html"&gt;stack overflow check&lt;/a&gt;&amp;nbsp;to see if there are any stack overflows[/quote]
&lt;p&gt;&lt;code&gt;&amp;nbsp;&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/369174?ContentTypeID=1</link><pubDate>Tue, 24 May 2022 07:21:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0436a37-5e4a-4532-a6a3-c1cd74b02941</guid><dc:creator>Rafalino</dc:creator><description>&lt;p&gt;&lt;br /&gt;Hello Sushell,&lt;/p&gt;
&lt;p&gt;I have added&amp;nbsp;&lt;span&gt;xMessageID&amp;nbsp; to the prints at&amp;nbsp;&amp;nbsp;&lt;strong&gt;prvProcessReceivedCommands&lt;/strong&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;just before&amp;nbsp;&lt;strong&gt;&amp;nbsp;( void ) uxListRemove( &amp;amp;( pxTimer-&amp;gt;xTimerListItem ) )&lt;/strong&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;app: xMessage.xMessageID = 6, pxTimer=0x0x2000CE98 , pxTimer-&amp;gt;pvTimerID=0x0x2002D2D8 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;app: xMessage.xMessageID = 8, pxTimer=0x0x00000A81 , pxTimer-&amp;gt;pvTimerID=0x0x1E200000&lt;/span&gt; &lt;/p&gt;
&lt;p&gt;&lt;span&gt;The last two messages are coming from ISR (message ID 6 and 8)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000000;"&gt;The problematic message is&amp;nbsp; :&amp;nbsp;&lt;strong&gt;#define tmrCOMMAND_STOP_FROM_ISR ( ( BaseType_t ) 8 )&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000000;"&gt;Is there a chance that the the Softdevice has a timer ISR that triggers it ? &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000000;"&gt;(Even though the Softdevice is already disabled at that stage).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000000;"&gt;Thanks in advance,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000000;"&gt;Rafalino&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000000;"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/369153?ContentTypeID=1</link><pubDate>Tue, 24 May 2022 05:29:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0846e869-f82b-462a-988b-eb8dc9da9126</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Either it is a memory corruption or it is an attempt to remove an already removed timer.&amp;nbsp;&lt;br /&gt;You can enable &lt;a href="https://www.freertos.org/Stacks-and-stack-overflow-checking.html"&gt;stack overflow check&lt;/a&gt;&amp;nbsp;to see if there are any stack overflows happening for the first suspicion.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You need to add more logs to find out if the last one is an attempt to delete an already deleted timer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/369030?ContentTypeID=1</link><pubDate>Mon, 23 May 2022 12:48:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97fcb611-8402-4202-811e-4693d06eca8e</guid><dc:creator>Rafalino</dc:creator><description>&lt;p&gt;Hello Sushel,&lt;/p&gt;
&lt;p&gt;I have added prints at &lt;strong&gt;timers.c&amp;nbsp;&amp;nbsp;&lt;/strong&gt;:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;NRF_LOG_INFO(&amp;quot; pxNewTimer=0x%p , pxTimer-&amp;gt;pvTimerID=0x%p&amp;nbsp; &amp;quot;, pxNewTimer, pxNewTimer-&amp;gt;pvTimerID)&lt;/span&gt;;&lt;/p&gt;
&lt;p&gt;at the end of &lt;strong&gt;xTimerCreate&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;NRF_LOG_INFO(&amp;quot; pxTimer=0x%p , pxTimer-&amp;gt;pvTimerID=0x%p&amp;nbsp; &amp;quot;, pxTimer, pxTimer-&amp;gt;pvTimerID);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;at&amp;nbsp; &lt;strong&gt;prvProcessReceivedCommands&lt;/strong&gt; just before&amp;nbsp;&lt;span&gt;&lt;strong&gt; ( void ) uxListRemove( &amp;amp;( pxTimer-&amp;gt;xTimerListItem ) )&lt;/strong&gt;;&lt;/span&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;This is what we see:&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#993300;"&gt;&amp;nbsp;&amp;lt;info&amp;gt; app: pxNewTimer=0x0x2000CE40 , pxTimer-&amp;gt;pvTimerID=0x0x200169C8 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#993300;"&gt;&amp;nbsp;&amp;lt;info&amp;gt; app: pxNewTimer=0x0x2000D0C0 , pxTimer-&amp;gt;pvTimerID=0x0x200168F0 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#993300;"&gt;&amp;nbsp;&amp;lt;info&amp;gt; app: pxNewTimer=0x0x2000D0F0 , pxTimer-&amp;gt;pvTimerID=0x0x2002D310 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#993300;"&gt;&amp;nbsp;&amp;lt;info&amp;gt; app: pxNewTimer=0x0x2000D120 , pxTimer-&amp;gt;pvTimerID=0x0x2002D330&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#993300;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#993300;"&gt;&amp;nbsp;&amp;lt;info&amp;gt; app: pxTimer=0x0x2000D120 , pxTimer-&amp;gt;pvTimerID=0x0x2002D330 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#993300;"&gt;&amp;nbsp;&amp;lt;info&amp;gt; app: pxTimer=0x0x2000D120 , pxTimer-&amp;gt;pvTimerID=0x0x2002D330 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#993300;"&gt;&amp;nbsp;&amp;lt;info&amp;gt; app: pxTimer=0x0x2000D0F0 , pxTimer-&amp;gt;pvTimerID=0x0x2002D310&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Just before the hard fault :&lt;br /&gt;&amp;nbsp;&lt;span style="color:#ff0000;"&gt;&amp;lt;info&amp;gt; app: pxTimer=0x0x00000A81 , pxTimer-&amp;gt;pvTimerID=0x0x1E200000&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;We see that all the timers are at address&amp;nbsp;0x0x2000D&lt;strong&gt;XXX&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;and the timer that we need to remove is in weird&amp;nbsp;address&amp;nbsp;&lt;strong&gt;0x0x00000A81&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;What can&amp;nbsp;cause this corruption ?&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/369009?ContentTypeID=1</link><pubDate>Mon, 23 May 2022 12:03:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7812c81e-dc11-41e5-b3e2-69fbc7fd3798</guid><dc:creator>Rafalino</dc:creator><description>&lt;p&gt;Hello Susheel,&lt;/p&gt;
&lt;p&gt;I am checking return value using &lt;strong&gt;APP_ERROR_CHECK(ERR_CODE)&amp;nbsp;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;From&amp;nbsp; :&amp;nbsp; &amp;nbsp;...&lt;strong&gt;nRF5_SDK\nRF5_SDK_17.0.2_d674dde\components\libraries\util\app_error.h&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;But I don&amp;#39;t see anything special.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/368972?ContentTypeID=1</link><pubDate>Mon, 23 May 2022 10:19:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d7facdf-f56a-4a7c-97bd-745a75179275</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Please make sure that you are handling all the return values correctly from the API especially app_timer_stop&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/368971?ContentTypeID=1</link><pubDate>Mon, 23 May 2022 10:15:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3a3fbd5-d167-4979-bcff-7707b3dc56b2</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Ori,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for your patience.&lt;br /&gt;It looks to me that the pxTimer might be pointing to an invalid instance of timer here in the uxListRemove.&amp;nbsp;&lt;br /&gt;Can you put some logs in the timer to print the instances of the pxTimer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This might not be directly related to DFU but might be related to the way you are suspending and resuming all tasks. My best guess right now, is that the timer instance or the list instance within the timer is somehow invalid or corrupted. If that is the case, we need to find out how and when that happened.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/368802?ContentTypeID=1</link><pubDate>Fri, 20 May 2022 10:58:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8e22228-1248-4fe5-b5a0-bf7635429b36</guid><dc:creator>Rafalino</dc:creator><description>&lt;p&gt;Hello Edvin,&lt;/p&gt;
&lt;p&gt;As you can see from the screen shot that I attached (that has the Call stack):&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/3058.pastedimage1652790272862v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;it is coming from list.c&amp;nbsp; and it was called from timer.c :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#008000;"&gt;&lt;em&gt;/* The timer is in a list, remove it. */&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;em&gt; ( void ) uxListRemove( &amp;amp;( pxTimer-&amp;gt;xTimerListItem ) );&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I suspect some timer was not stopped/cleared by the Softdevice&amp;nbsp;but I can&amp;#39;t figure out which one.&lt;/p&gt;
&lt;p&gt;Rafalino&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/368787?ContentTypeID=1</link><pubDate>Fri, 20 May 2022 10:21:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78e55aa7-5a92-47c9-a2f9-0b0de07ea4aa</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Ah, I see. Thank you for clarifying&lt;/p&gt;
&lt;p&gt;Can you reproduce it once more (reproduce it with your latest build, so that the addresses from the log are correct), and see what is found at the address that the log is claiming contains the hardfault. In your original post, that would be&amp;nbsp;&lt;span&gt;0x00029350.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Then, make sure that the tool arm-none-eabi-addr2line is in the environment path on your computer. In my case, it is found in&amp;nbsp;C:\Program Files (x86)\GNU Tools ARM Embedded\4.9 2015q3\bin\arm-none-eabi-addr2line.exe, so I added &amp;quot;C:\Program Files (x86)\GNU Tools ARM Embedded\4.9 2015q3\bin\&amp;quot; to my environment path. To check whether it is in your environment path or not, you can use the command &amp;quot;where arm-none-eabi-addr2line&amp;quot;. If it replies with the destination, that is fine. If it is not found, you need to install it and/or add it to your path. It is part of the GNU ARM embedded toolchain.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Then, go to your build folder for your application. I see that you are using Segger Embedded Studio, so that would be the &amp;quot;Output&amp;quot; folder, and locate the .elf file. Using the ble_app_uart example for demonstration, you can use this command to find out what function that is located at the Hardfault address:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;arm-none-eabi-addr2line -e Output\Release\Exe\ble_app_uart_pca10056_s140.elf 0x00029350&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Does it point to list.c: 193? If so, can you try to set a breakpoint there to see what happens right before the hardfault?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/368686?ContentTypeID=1</link><pubDate>Thu, 19 May 2022 19:25:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:003fc2f3-e0ef-4b17-97bf-705aa359e5e5</guid><dc:creator>Rafalino</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;Let me clarify&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Our application uses the chip&amp;#39;s RADIO to send BLE beacons at times that we want to control so during that part of the application we do not enable the Softdevice.&lt;/p&gt;
&lt;p&gt;Since we have several chips in our setup , we wanted to use Nordic&amp;#39;s DFU service to upgrade one chip from another one over the air.&lt;/p&gt;
&lt;p&gt;Let&amp;#39;s say chip A has version 3 and chip B has version 2.&lt;/p&gt;
&lt;p&gt;So we send a command from chip A to chip B to move to bootloader (a special BLE beacon).&lt;/p&gt;
&lt;p&gt;Then chip B reboots and stays at bootloader while chip A disables our primary application (by suspending most of its freeRTOS tasks and also the scheduler itself by calling &lt;strong&gt;vTaskSuspendAll&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;) and then enables the Softdevice in order to send application version 3 OTA to chip B.&lt;/p&gt;
&lt;p&gt;Up until this part, everything works smoothly and we are able to send all the application over to chip B.&lt;/p&gt;
&lt;p&gt;The problem occurs on chip A after we finish the OTA and we disable the Softdevice , resume our tasks and call&amp;nbsp;&lt;strong&gt;xtaskresumeall&amp;nbsp;&lt;/strong&gt;to resume the scheduler.&lt;/p&gt;
&lt;p&gt;During&amp;nbsp;&lt;strong&gt;xtaskresumeall&amp;nbsp; &lt;/strong&gt;we get Hard fault :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/3058.pastedimage1652790272862v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Do you have any suggestions what can cause that ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/368619?ContentTypeID=1</link><pubDate>Thu, 19 May 2022 12:47:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6cc305a-f211-4829-a653-48a4ec731c4b</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Oh, sorry. I thought you said you were using the softdevice in your application, but I see that you are not using the softdevice in the application. Only the Radio.&lt;/p&gt;
&lt;p&gt;So your DFU procedure: When this issue occurs, is it after a successful DFU? Or was the DFU aborted? What bootloader are you using? Background DFU or &amp;quot;normal&amp;quot; DFU (where the transport happens in the bootloader)? Does the error happen after you reset the device as well, or only directly after a DFU?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;br /&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/368382?ContentTypeID=1</link><pubDate>Wed, 18 May 2022 13:24:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3b6cd2f-6f16-426d-8d93-dda9eb8c276e</guid><dc:creator>Rafalino</dc:creator><description>&lt;p&gt;Hello Edvin,&lt;/p&gt;
&lt;p&gt;We did not try enabling the Softdevice after we disabled it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Our Application uses the RADIO all the time so we can&amp;#39;t have the Softdevice running while we run our application.&lt;/p&gt;
&lt;p&gt;We make sure that the Softdevice is disabled by checking the &lt;span&gt;Softdevice&amp;nbsp;&lt;/span&gt;state using&amp;nbsp; NRF_SDH_STATE_OBSERVER.&lt;/p&gt;
&lt;p&gt;Rafalino.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HARD FAULT during xTaskResumeAll after ending a DFU session and disabling the Softdevice</title><link>https://devzone.nordicsemi.com/thread/368375?ContentTypeID=1</link><pubDate>Wed, 18 May 2022 13:14:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f0bd04f-f2c2-4b80-a9cf-7b582590016e</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Rafalino,&lt;/p&gt;
&lt;p&gt;Did you try enabling the softdevice again before you resume the rest of the threads? Does that change anything?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>