<?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>How to trigger an task on a GPIO output from a GPIO input event</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/124148/how-to-trigger-an-task-on-a-gpio-output-from-a-gpio-input-event</link><description>Hi 
 I am trying to use the two GPIO pins. One GPIO pin is configured as a input and connected externally to a button. 
 The second is configured as an output pin. I want to press the button and trigger the second GPIO pin to output a low signal 
 The</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 14 Sep 2025 17:08:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/124148/how-to-trigger-an-task-on-a-gpio-output-from-a-gpio-input-event" /><item><title>RE: How to trigger an task on a GPIO output from a GPIO input event</title><link>https://devzone.nordicsemi.com/thread/548673?ContentTypeID=1</link><pubDate>Sun, 14 Sep 2025 17:08:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1b73c05-40ec-446e-898b-ae41af6411c5</guid><dc:creator>Oystein</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I dont have any bootloader but solved it like this. With this code i can choose wether to have a software reset or hardware reset&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;//Button pins interface init
 NRF_P1-&amp;gt;PIN_CNF[6] = 0x0000000C;     //Nrf52 button GPIO input pin port P1.06, internal pull up, STANDARD driveSENSE disabled
 NRF_GPIOTE-&amp;gt;INTENCLR = 0x00000001;   //Disable interupts on CONFIG[0] pin
 NRF_GPIOTE-&amp;gt;CONFIG[0] = 0x00122601;  //Set BUTTON press on port P1.06 as a GPIOTE EVENT to generate an interrupt event when going from HIGH to LOW.
 NRF_GPIOTE-&amp;gt;EVENTS_IN[0] = 0;        // Clear any potential events that could have occured during configuration
 NRF_GPIOTE-&amp;gt;INTENSET = 0x00000001;   //Enable EVENT interupts on UARTTE CONFIG[0] pin

 //nRF52 self RESET pin
 NRF_P1-&amp;gt;OUTSET = 0x00000400;        //Set P1.10 GPIO output pin HIGH. 
 NRF_P1-&amp;gt;PIN_CNF[10] = 0x0000000F;   //GPIO output pin port P1.10, internal pull up, STANDARD drive, SENSE disabled

 //Enable GPIOTE interrupt in NVIC
 NVIC_EnableIRQ(GPIOTE_IRQn);        // Enable GPIOTE interrupt in NVIC

//GPIOTE Interrupt handler
void GPIOTE_IRQHandler(void)
{
    if (NRF_GPIOTE-&amp;gt;EVENTS_IN[0])   // Check if event on channel 0 fired
    {
        NRF_GPIOTE-&amp;gt;EVENTS_IN[0] = 0;  // Clear event

        //Use only soft or hard reset
        //NVIC_SystemReset();            // &amp;#128293; Force system soft reset
        NRF_P1-&amp;gt;OUTCLR = 0x00000400;     // &amp;#128293; Force system hard reset
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I am not 100% sure if myt understanding of SOFT and HARD RESET is coreect, but anyway both NVIC_SYSTEMRESET() or setting the P.1.10 LOW both ways will reset the MCU&lt;/p&gt;
&lt;p&gt;kr&lt;/p&gt;
&lt;p&gt;&amp;Oslash;ystein&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to trigger an task on a GPIO output from a GPIO input event</title><link>https://devzone.nordicsemi.com/thread/548179?ContentTypeID=1</link><pubDate>Tue, 09 Sep 2025 09:04:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a43b74e-6292-4bd2-8eb0-8b4a79f35a5f</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Øystein,&lt;/p&gt;
[quote user="Oystein"]I also encountered a problem with my design. The PPI channel TASK OUT do not release the PIN and set it HIGH, its kept&amp;nbsp; LOW so the&amp;nbsp; MCU freezes. It do not work. I also tried to set up a second PPI channel to trigger a LOW_TO_HIGH on the GPIO pin 1.10 when the nRESET signal goes&amp;nbsp; LOW. Not sure why, but did not work[/quote]
&lt;p&gt;Are you testing with the output physically connected to the reset line?&amp;nbsp;&lt;/p&gt;
[quote user="Oystein"]Anyway. as you point out,&amp;nbsp;&lt;span&gt;Is it not sufficient to perform a soft reset from your code. I think maybe I try that, but is there any code exapmles or guides on how I can trigger SOFT RESET triggered by a GPIO INTERRUPT event HIGH_TO_LOW on pin GPIO 1.6&lt;/span&gt;[/quote]
&lt;p&gt;You can&amp;nbsp;write &amp;#39;0xB1&amp;#39; (BOOTLOADER_DFU_START) followed by NVIC_SystemReset() in your button ISR to reset into bootloader DFU mode as long as the bootloader is built with&amp;nbsp;NRF_BL_DFU_ENTER_METHOD_GPREGRET&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to trigger an task on a GPIO output from a GPIO input event</title><link>https://devzone.nordicsemi.com/thread/547996?ContentTypeID=1</link><pubDate>Sun, 07 Sep 2025 18:59:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07871d8d-2eca-482c-87de-b645a61de2e5</guid><dc:creator>Oystein</dc:creator><description>&lt;p&gt;Hi Vidar&lt;/p&gt;
&lt;p&gt;I think you are correct, its uneccesary I think to use a GPIO and route it to the nRESET pin. It semmes like it has hostorically been designed that way for firmware upgrade over USB.&amp;nbsp;&lt;strong&gt;USBDFU Trigger Lib need a GPIO that can control the physical &amp;quot;RESET pin&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I also encountered a problem with my design. The PPI channel TASK OUT do not release the PIN and set it HIGH, its kept&amp;nbsp; LOW so the&amp;nbsp; MCU freezes. It do not work. I also tried to set up a second PPI channel to trigger a LOW_TO_HIGH on the GPIO pin 1.10 when the nRESET signal goes&amp;nbsp; LOW. Not sure why, but did not work&lt;/p&gt;
&lt;p&gt;Anyway. as you point out,&amp;nbsp;&lt;span&gt;Is it not sufficient to perform a soft reset from your code. I think maybe I try that, but is there any code exapmles or guides on how I can trigger SOFT RESET triggered by a GPIO INTERRUPT event HIGH_TO_LOW on pin GPIO 1.6&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;KR&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;Oslash;ystein&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to trigger an task on a GPIO output from a GPIO input event</title><link>https://devzone.nordicsemi.com/thread/547745?ContentTypeID=1</link><pubDate>Thu, 04 Sep 2025 11:52:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:307a8212-9030-4668-ab58-027cfc06af73</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Øystein,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I&amp;#39;m not sure I like the idea of having a GPIO output connected directly to the reset line. Is it not sufficient to perform a soft reset from your code? Anyway, I took the liberty of updating your code to make it more readable, see below. The&amp;nbsp;&lt;span&gt;&amp;nbsp;TEP or EEP or endpoint address was wrong.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define BTN_INPUT   NRF_GPIO_PIN_MAP(1,6)
#define RESET_SIG   NRF_GPIO_PIN_MAP(1,10)


nrf_gpio_cfg_input(BTN_INPUT, NRF_GPIO_PIN_PULLUP);
NRF_GPIOTE-&amp;gt;CONFIG[0] = (GPIOTE_CONFIG_MODE_Event &amp;lt;&amp;lt; GPIOTE_CONFIG_MODE_Pos) |
                        (BTN_INPUT &amp;lt;&amp;lt; GPIOTE_CONFIG_PSEL_Pos) |
                        (GPIOTE_CONFIG_POLARITY_HiToLo &amp;lt;&amp;lt; GPIOTE_CONFIG_POLARITY_Pos);

NRF_GPIOTE-&amp;gt;CONFIG[1] = (GPIOTE_CONFIG_MODE_Task &amp;lt;&amp;lt; GPIOTE_CONFIG_MODE_Pos) |
                        (RESET_SIG &amp;lt;&amp;lt; GPIOTE_CONFIG_PSEL_Pos) |
                        (GPIOTE_CONFIG_POLARITY_HiToLo &amp;lt;&amp;lt; GPIOTE_CONFIG_POLARITY_Pos) |
                        (GPIOTE_CONFIG_OUTINIT_High &amp;lt;&amp;lt; GPIOTE_CONFIG_OUTINIT_Pos);

NRF_PPI-&amp;gt;CH[0].EEP = (uint32_t) &amp;amp;NRF_GPIOTE-&amp;gt;EVENTS_IN[0];
NRF_PPI-&amp;gt;CH[0].TEP = (uint32_t) &amp;amp;NRF_GPIOTE-&amp;gt;TASKS_OUT[1];
NRF_PPI-&amp;gt;CHENSET = 1;&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Vidar&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>