<?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>Disable Softdevice from observer crashes; &amp;quot;don&amp;#39;t do that&amp;quot; should be documented?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/33493/disable-softdevice-from-observer-crashes-don-t-do-that-should-be-documented</link><description>I tried to disable Softdevice from within an observer (kind ble_observer.) It seems to crash. Instead, I just schedule another task to run (and disable the Softdevice) after the observer completes. That seems to work better. Should it be stated in the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 28 Aug 2023 19:32:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/33493/disable-softdevice-from-observer-crashes-don-t-do-that-should-be-documented" /><item><title>RE: Disable Softdevice from observer crashes; "don't do that" should be documented?</title><link>https://devzone.nordicsemi.com/thread/443456?ContentTypeID=1</link><pubDate>Mon, 28 Aug 2023 19:32:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c004daa-9abc-4a61-a0fd-ddf47d9d769e</guid><dc:creator>ask6483</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This bug will also happen when&amp;nbsp;NRF_PWR_MGMT_CONFIG_USE_SCHEDULER is enabled. System power off is delayed then and&amp;nbsp;&lt;span&gt;nrf_sdh_ble_evts_poll()&amp;nbsp;runs causing the crash.&amp;nbsp;I was incredibly lucky to find this post ;)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disable Softdevice from observer crashes; "don't do that" should be documented?</title><link>https://devzone.nordicsemi.com/thread/312551?ContentTypeID=1</link><pubDate>Mon, 31 May 2021 07:49:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55e15b75-c89c-462a-872f-add10d34669c</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This has unfortunately&amp;nbsp;not been fixed in SDK 17.0.2.&amp;nbsp;nrf_sdh_soc_evts_poll and nrf_sdh_ble_evts_poll functions may cause reset if nrf_sdh_disable_request is called from observer. Proposed fix is to add an exception for&amp;nbsp;NRF_ERROR_SOFTDEVICE_NOT_ENABLED in&amp;nbsp;nrf_sdh_soc.c and nrf_sdh_ble.c&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;    if (ret_code != NRF_ERROR_NOT_FOUND &amp;amp;&amp;amp; ret_code != NRF_ERROR_SOFTDEVICE_NOT_ENABLED)
    {
        APP_ERROR_HANDLER(ret_code);
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disable Softdevice from observer crashes; "don't do that" should be documented?</title><link>https://devzone.nordicsemi.com/thread/312480?ContentTypeID=1</link><pubDate>Sat, 29 May 2021 03:24:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47eafe86-4cec-46d3-80f8-948f18b0bdbe</guid><dc:creator>Keith Wakeham</dc:creator><description>&lt;p&gt;Just adding a note to this old post. Butch&amp;#39;s solution works after days of pulling my hair out on this. Keep in mind that even in SDK 17 examples like buttonless DFU is written with the&amp;nbsp;nrf_sdh_disable_request() inside the event that Sigurd said causes a bug.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The reason it works in their examples is because they go to system power off BEFORE the observer runs&amp;nbsp;&lt;span&gt;nrf_sdh_ble_evts_poll() thus causing the crash. So basically, the examples are a bit &amp;quot;buggy&amp;quot; here.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disable Softdevice from observer crashes; "don't do that" should be documented?</title><link>https://devzone.nordicsemi.com/thread/130493?ContentTypeID=1</link><pubDate>Wed, 02 May 2018 09:34:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90c156f8-f2e4-4146-bc73-f83bc9030e58</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you for reporting this.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;What is happening is that we are pulling events from the SoftDevice in nrf_sdh_ble_evts_poll(), and are forwarding them to the observers. We do this until we no longer have any new events from the SoftDevice to process, and sd_ble_evt_get() returns NRF_ERROR_NOT_FOUND. But if we disable the SoftDevice in one of the observers, the next call to sd_ble_evt_get() will return NRF_ERROR_SOFTDEVICE_NOT_ENABLED, and we will enter the error-handler because only NRF_ERROR_NOT_FOUND and NRF_SUCCESS are considered valid return codes.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>