<?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>Hold Deadman switch pin during DFU enable</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/58843/hold-deadman-switch-pin-during-dfu-enable</link><description>Hello, 
 This is a followup question regarding this old thread I started: https://devzone.nordicsemi.com/f/nordic-q-a/48295/hold-output-pin-during-bootloader-jump 
 IC: NRF52840 SDK: 15.3 IDE: SES 
 I have a battery powered device powered by a dead-man</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 10 Mar 2020 18:24:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/58843/hold-deadman-switch-pin-during-dfu-enable" /><item><title>RE: Hold Deadman switch pin during DFU enable</title><link>https://devzone.nordicsemi.com/thread/239209?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 18:24:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7fb3726f-4277-4153-a358-7a2fd8ddabd3</guid><dc:creator>LukeC</dc:creator><description>&lt;p&gt;It looks like this is a bug in debug mode even in Rev 2.&amp;nbsp; Going to SYSTEM_OFF does seem to fix this issue and preserve CNF registers, as long as you are not in debug mode.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/errata_nRF52840_Rev2/ERR/nRF52840/Rev2/latest/err_840.html"&gt;https://infocenter.nordicsemi.com/topic/errata_nRF52840_Rev2/ERR/nRF52840/Rev2/latest/err_840.html&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hold Deadman switch pin during DFU enable</title><link>https://devzone.nordicsemi.com/thread/238994?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 08:09:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b5d3bbe-7647-4478-8ff6-2dbd4e59fa3e</guid><dc:creator>LukeC</dc:creator><description>&lt;p&gt;I think my issue is a Rev 1 errata issue.&lt;/p&gt;
&lt;p&gt;It looks iike in Debug mode the CNF registers are cleared.&amp;nbsp; I will test tomorrow with the debugger detached to see if that fixes the issue.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/errata_nRF52840_Rev1/ERR/nRF52840/Rev1/latest/err_840.html"&gt;https://infocenter.nordicsemi.com/topic/errata_nRF52840_Rev1/ERR/nRF52840/Rev1/latest/err_840.html&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hold Deadman switch pin during DFU enable</title><link>https://devzone.nordicsemi.com/thread/238976?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 05:57:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31d8bdf1-81ac-4a22-bf5a-6c92bc3836e8</guid><dc:creator>LukeC</dc:creator><description>&lt;p&gt;Just to simplify things, I tried modifying a working example before the soft device was enabled to see if the GPIO registers would not reset to inputs when a SYSTEM_OFF event was received.&amp;nbsp; I wanted to remove the bootloader from the equation, so this is just an app restarting after SYSTEM_OFF event.&lt;/p&gt;
&lt;p&gt;I modified the ble_app_uart example with the following code at the begining of main():&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Setup Output pin and write to logic HIGH
nrf_gpio_cfg_output(9);
nrf_gpio_pin_write(9, true);

// Init logging
log_init();

// Init power managment
power_management_init();

// Setup always true sys off pin sense configuration 
nrf_gpio_cfg_sense_input(10, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_HIGH);
nrf_gpio_cfg_sense_input(26, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_HIGH);

// Enable SYSOFF
nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;When I hit a breakpoint set at&amp;nbsp;nrf_gpio_cfg_output(9) after the SYSOFF event,&amp;nbsp; pin 9 is reset back to an input.&lt;/p&gt;
&lt;p&gt;Is there another piece I am missing that will help me avoid the pin register reset issue?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hold Deadman switch pin during DFU enable</title><link>https://devzone.nordicsemi.com/thread/238946?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 21:13:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad06275f-46bd-44a5-a39e-1bb4bb0eb154</guid><dc:creator>LukeC</dc:creator><description>&lt;p&gt;Hung,&lt;/p&gt;
&lt;p&gt;This possible solution looks very encouraging, but I cannot replicate the preservation of the GPIO pin registers with this method.&amp;nbsp; Can you test this on your end?&lt;/p&gt;
&lt;p&gt;In my application, I setup an always true sense pin to cause a latch event and call the power_system_off function. (Maybe there is a better way to force a SYSTEMOFF reset?)&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt; nrf_gpio_cfg_sense_input(10, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_HIGH);
 
 #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;p&gt;I then set a breakpoint on the reset vector and at main in the DFU Boootloder.&lt;/p&gt;
&lt;p&gt;I am definitely reseting using the SYSTEMOFF method as I check RESETREAS and can verify&amp;nbsp;the register value and the correct GPRET value.&lt;/p&gt;
&lt;p&gt;However, the deadman switch output NRF_P0-&amp;gt;OUT gets cleared as well as PIN_CNF[17] is reset to an input (0x002).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1583786901228v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;It does look like the bootloader&amp;nbsp;preserves&amp;nbsp;the&amp;nbsp;SENSE pin 10 setting, but all other pins are reset to inputs and the OUT register is reset to 0.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1583787641651v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Questions:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1.) Are there any other settings I might have configured wrong? I remeoved &amp;#39;&lt;span&gt;CONFIG_GPIO_AS_PINRESET&amp;#39; from the bootloader and the app, but I don&amp;#39;t think that should cause any issues.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span&gt;2.) Do I have an early chip variant?&amp;nbsp; My reads out &amp;#39;AAC0&amp;#39;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hold Deadman switch pin during DFU enable</title><link>https://devzone.nordicsemi.com/thread/238873?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 14:35:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59fb606f-c8ae-42e8-971f-30d38c672ec1</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Luke,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can use this trick described by this customer:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/49525/wake-from-system-off-mode-with-usb-vbus"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/49525/wake-from-system-off-mode-with-usb-vbus&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Put the application to System OFF mode&amp;nbsp;when a&amp;nbsp;condition for waking up is already fulfill. This will trigger a reset immediately after CPU enters System_OFF. &lt;br /&gt;And this type of reset is the only option that can preserve GPIO pins.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hold Deadman switch pin during DFU enable</title><link>https://devzone.nordicsemi.com/thread/238681?ContentTypeID=1</link><pubDate>Sun, 08 Mar 2020 17:20:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:629cdc2b-6769-4c0d-bd35-87e87b3eb4a4</guid><dc:creator>LukeC</dc:creator><description>&lt;p&gt;I will definitely get our hardware guy to add this on Rev 2, but we already have boards built.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have all interrupts disabled before the jump so I don&amp;#39;t think it is a peripheral interrupt. I am thinking it has something to do with the MBR, UICR or softdevice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hold Deadman switch pin during DFU enable</title><link>https://devzone.nordicsemi.com/thread/238652?ContentTypeID=1</link><pubDate>Sun, 08 Mar 2020 07:05:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:950488a5-907e-4872-bd06-dbe063c52d60</guid><dc:creator>Turbo J</dc:creator><description>[quote userid="18155" url="~/f/nordic-q-a/58843/hold-deadman-switch-pin-during-dfu-enable"] The pin drops low for about 2 ms, enough to disable the power switch.[/quote]
&lt;p&gt;Just put an R+C low pass filter on the ouput pin.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Jumping into bootloader without resetting peripherials sounds rather dangerous, since most interrupts are NOT properly handled.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>