<?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>nrf_pwr_mgmt_shutdown() fails while debugging.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/47590/nrf_pwr_mgmt_shutdown-fails-while-debugging</link><description>Hi 
 Im using nRF52832-QAAB0. SDK 15.3. Softdevice is running. 
 With debugger connected, calling nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_STAY_IN_SYSOFF) will assert in shutdown_process() when sd_power_system_off() returns. According to https://devzone</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 15 Oct 2019 12:07:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/47590/nrf_pwr_mgmt_shutdown-fails-while-debugging" /><item><title>RE: nrf_pwr_mgmt_shutdown() fails while debugging.</title><link>https://devzone.nordicsemi.com/thread/215064?ContentTypeID=1</link><pubDate>Tue, 15 Oct 2019 12:07:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50744c38-a9ef-4148-b5d9-308a40158917</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;yes,&amp;nbsp;it&amp;#39;s fixed in SDK 16.0.0 :)&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_pwr_mgmt_shutdown() fails while debugging.</title><link>https://devzone.nordicsemi.com/thread/211057?ContentTypeID=1</link><pubDate>Sun, 22 Sep 2019 07:34:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28b7057f-f510-4c70-9f05-8af1a9a691be</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;Will this be fixed in SDK 16.0.0? Seems a bad bug. If&amp;nbsp;nrf_pwr_mgmt_shutdown() returned an error code we could just handle this in&amp;nbsp;application code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_pwr_mgmt_shutdown() fails while debugging.</title><link>https://devzone.nordicsemi.com/thread/204984?ContentTypeID=1</link><pubDate>Tue, 20 Aug 2019 10:03:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40f61a78-3a28-428a-b6e2-5e45387014dc</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;I won&amp;#39;t get fixed in the SoftDevice so the power management library should have handled that, but it does not. You&amp;#39;ll want to use&amp;nbsp;an ifdef for debug mode though:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* Solution for simulated System OFF in debug mode */

        // Enter System OFF.
#ifdef SOFTDEVICE_PRESENT
        if (nrf_sdh_is_enabled())
        {
            ret_code_t ret_code = sd_power_system_off();
#ifdef DEBUG
            while(true)
            {
                __WFE;
            } 
#else
            ASSERT((ret_code == NRF_SUCCESS) || (ret_code == NRF_ERROR_SOFTDEVICE_NOT_ENABLED));
#endif
            UNUSED_VARIABLE(ret_code);
        }
#endif // SOFTDEVICE_PRESENT
        nrf_power_system_off();&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_pwr_mgmt_shutdown() fails while debugging.</title><link>https://devzone.nordicsemi.com/thread/204784?ContentTypeID=1</link><pubDate>Mon, 19 Aug 2019 13:15:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f32a059f-7361-451f-8340-25dfb8e76489</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;Surely this is still incorrect behaviour in nrf_pwr_mgmt_shutdown though &amp;ndash; it should have a while(1) after the call to sd_power_system_off as nrf_power_system_off does:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/* Solution for simulated System OFF in debug mode */
while (true)
{
    __WFE();
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Seems like a bug?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_pwr_mgmt_shutdown() fails while debugging.</title><link>https://devzone.nordicsemi.com/thread/188455?ContentTypeID=1</link><pubDate>Wed, 22 May 2019 08:14:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:22b5696c-fb8d-4601-af0a-4876f89c711e</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Yeah, it&amp;#39;s called &amp;quot;emulated shutdown&amp;quot;. If the MCU goes into SystemOFF mode with a debugger attached then the&amp;nbsp;&lt;a title="DAP - Debug access port" href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/dif.html?cp=3_0_0_3_7_0#dap"&gt;DAP - Debug access port&lt;/a&gt;&amp;nbsp;will also shut down and you will exit whatever debugging session you&amp;#39;re in. This is not really conducive to debugging so we emulated the shutdown, either by putting the system into SystemON Idle mode , holding the CPU in an infinite loop, or stopping the CPU.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Try compiling without the DEBUG flags, in SES you can use the &amp;quot;release&amp;quot; build environment.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>