<?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 differentiate which GPIO causing device to wake-up from System OFF</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/48588/how-to-differentiate-which-gpio-causing-device-to-wake-up-from-system-off</link><description>Hello, 
 
 I am using nRF52832, SDK_15.3.0, S132 SoftDevice and Segger for flashing the image. I am using ‘ble_app_blinky’. 
 
 RESETREAS will give cause of reset. But for System OFF, is there any option to determine which GPIO causes device to wake-up</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 01 Jul 2019 08:53:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/48588/how-to-differentiate-which-gpio-causing-device-to-wake-up-from-system-off" /><item><title>RE: How to differentiate which GPIO causing device to wake-up from System OFF</title><link>https://devzone.nordicsemi.com/thread/195550?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2019 08:53:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d3c9ea9-681a-44b9-90cd-6ce16777adc6</guid><dc:creator>beemavishnu</dc:creator><description>&lt;p&gt;I got your point. Thank you for your inputs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to differentiate which GPIO causing device to wake-up from System OFF</title><link>https://devzone.nordicsemi.com/thread/195541?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2019 08:33:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:818059de-71fa-49d8-8daa-4e54ead8639d</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;What likely happens is that the LATCH is cleared while the button is still active. This will then keep the signal set in the LATCH register, even after you cleared it, because it is still active.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The while function was for testing purposes, to see if the problem would disappear. You can ofcourse implement this debouncing in any way you&amp;#39;d like, using a RTC or any other timer functionality.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to differentiate which GPIO causing device to wake-up from System OFF</title><link>https://devzone.nordicsemi.com/thread/195406?ContentTypeID=1</link><pubDate>Fri, 28 Jun 2019 14:32:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65e85343-f14c-4719-9dff-ad15e525a6d5</guid><dc:creator>beemavishnu</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Still same issue. Please find below code. Any issues with this code.&lt;/p&gt;
&lt;p&gt;Also I cant keep while() loop as you mentioned as I need to press for 2 seconds to validate debounce using RTC.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;pre class="ui-code" data-mode="text"&gt;    for(i = 0; i &amp;lt; 32; i++)
    {
        bPinLatch = nrf_gpio_pin_latch_get(i);
        
        if(bPinLatch == 1)
        {
            uint32_t j, k, l;
            
            __NOP();
            __NOP();
            
            // The LATCH register will only be cleared if the CPU explicitly clears it by writing a &amp;#39;1&amp;#39;
            // to the bit that shall be cleared.
            nrf_gpio_pin_latch_clear(i);
            
            __NOP();
            __NOP();
            
            nrf_gpio_pin_latch_get(i);
            nrf_gpio_pin_latch_get(i);
            nrf_gpio_pin_latch_get(i);
            
            __NOP();
            __NOP();
            
            j = nrf_gpio_pin_latch_get(i);
            
            NRF_LOG_INFO(&amp;quot;latchN %d %d&amp;quot;, i, j);
        }
    }
    &lt;/pre&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;/p&gt;
&lt;p&gt;Thanks &amp;amp; Regards&lt;/p&gt;
&lt;p&gt;Vishnu Beema&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to differentiate which GPIO causing device to wake-up from System OFF</title><link>https://devzone.nordicsemi.com/thread/193174?ContentTypeID=1</link><pubDate>Mon, 17 Jun 2019 12:30:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da9562c1-3b2c-4264-8399-c22fb3f70c1a</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;We have an errata on the LATCH wrt. clear/reading the register:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/errata_nRF52832_Rev2/ERR/nRF52832/Rev2/latest/anomaly_832_173.html?cp=3_1_1_0_1_43"&gt;https://infocenter.nordicsemi.com/topic/errata_nRF52832_Rev2/ERR/nRF52832/Rev2/latest/anomaly_832_173.html?cp=3_1_1_0_1_43&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try forcing a wait cycle, for instance by adding nop&amp;#39;s or reading a peripheral event, like &amp;quot;(void)NRF_TIMER1-&amp;gt;EVENTS_COMPARE[0];&amp;quot; ?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to differentiate which GPIO causing device to wake-up from System OFF</title><link>https://devzone.nordicsemi.com/thread/193168?ContentTypeID=1</link><pubDate>Mon, 17 Jun 2019 12:09:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b29c4bc-4954-4463-95ea-7bb50ec9b839</guid><dc:creator>beemavishnu</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;After calling&amp;nbsp;nrf_gpio_pin_latch_clear(), if I call&amp;nbsp;nrf_gpio_pin_latch_get() I am still getting output as 1. Is this expected.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;pre class="ui-code" data-mode="text"&gt;    uint32_t i, j;
    bool bPinLatch;
    
    for(i = 0; i &amp;lt; 32; i++)
    {
        // NRF_GPIO-&amp;gt;LATCH // To identify the cause of Wakeup
        bPinLatch = nrf_gpio_pin_latch_get(i);
        
        if(bPinLatch == 1)
        {
            // The LATCH register will only be cleared if the CPU explicitly clears it by writing a &amp;#39;1&amp;#39;
            // to the bit that shall be cleared.
            nrf_gpio_pin_latch_clear(i);
            j = nrf_gpio_pin_latch_get(i);
            
            NRF_LOG_INFO(&amp;quot;latch %d %d&amp;quot;, i, j);
        }
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;/p&gt;
&lt;p&gt;Thanks &amp;amp; Regards&lt;/p&gt;
&lt;p&gt;Vishnu Beema&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to differentiate which GPIO causing device to wake-up from System OFF</title><link>https://devzone.nordicsemi.com/thread/193145?ContentTypeID=1</link><pubDate>Mon, 17 Jun 2019 11:15:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25b7b33d-1917-4f6a-a6fa-3ac325f1a684</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Vishnu,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could it be due to the pin still being active when entering this loop?&lt;/p&gt;
&lt;p&gt;Could you try adding a simple debounce routine prior to handling the LATCH to see if the issue still occurs?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Simple Debounce
while (nrf_gpio_pin_read(13) == 0 || nrf_gpio_pin_read(14) == 0);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to differentiate which GPIO causing device to wake-up from System OFF</title><link>https://devzone.nordicsemi.com/thread/192922?ContentTypeID=1</link><pubDate>Fri, 14 Jun 2019 12:11:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5196ad32-7034-4450-8c9f-cfe7bc2ce74d</guid><dc:creator>beemavishnu</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I am using Segger and testing over nRF52832 development kit.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Below is the code I implemented. I configure two pins to wake-up from System off mode (For example P0.13 and P0.14 in ble_app_blinky)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;&lt;b&gt;Sequence 1 (Press same button &lt;/b&gt;&lt;b&gt;&lt;u&gt;repeatedly&lt;/u&gt;&lt;/b&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;1) Press button 1(P0.13) repeatedly. Always I will get &amp;#39;latch 13&amp;#39;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2) Since LATCH register is cleared, if I press button 2 (P0.14) repeatedly I am seeing &amp;#39;latch 14&amp;#39; only.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;3) If I don&amp;#39;t clear LATCH register, even though I press button 2 (P0.14) I keep getting both &amp;#39;latch 13&amp;#39; and &amp;#39;latch 14&amp;#39;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So sequence 1 worked fine for me.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;Sequence 2 (Press buttons alternatively)&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;1) For first time if I press button 1 (P0.13) it will show only &amp;#39;latch 13&amp;#39;.&lt;/p&gt;
&lt;p&gt;2) But after System OFF, if I press button 2 (P0.14) rather than button 1 (P0.13) I am getting both P0.13 and P0.14 for first time.&lt;/p&gt;
&lt;p&gt;3) Again if I press button 2 (P0.14) I am getting only &amp;#39;latch 14&amp;#39; (Similar to Sequence 1).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;My query are&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;1) Though LATCH register is cleared, why both pins are detected when they are pressed alternatively.&lt;/p&gt;
&lt;p&gt;2)&amp;nbsp;All above scenarios are without debugger connect. If I connect debugger, though I press button 1 (P0.13) repeatedly, still it shows both &amp;#39;latch 13&amp;#39; and &amp;#39;latch 14&amp;#39;. I am not sure why in debug mode.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;To cross check, you can keep below code as is and test. Am I missing anything.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;pre class="ui-code" data-mode="text"&gt;    uint32_t i;
    bool bPinLatch;
    
    for(i = 0; i &amp;lt; 32; i++)
    {
        // NRF_GPIO-&amp;gt;LATCH // To identify the cause of Wakeup
        bPinLatch = nrf_gpio_pin_latch_get(i);
        
        if(bPinLatch == 1)
        {
            // The LATCH register will only be cleared if the CPU explicitly clears it by writing a &amp;#39;1&amp;#39;
            // to the bit that shall be cleared.
            nrf_gpio_pin_latch_clear(i);
            NRF_LOG_INFO(&amp;quot;latch %d&amp;quot;, i);
        }
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks &amp;amp; Regards&lt;/p&gt;
&lt;p&gt;Vishnu Beema&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to differentiate which GPIO causing device to wake-up from System OFF</title><link>https://devzone.nordicsemi.com/thread/192889?ContentTypeID=1</link><pubDate>Fri, 14 Jun 2019 10:44:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ffdab18-8860-431e-a32e-17ed3180b936</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can read out the GPIO LATCH register on boot up:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/gpio.html?cp=3_1_0_19_2_7#register.LATCH"&gt;https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/gpio.html?cp=3_1_0_19_2_7#register.LATCH&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Note that this is a cumulative register, meaning that you need to clear it after reading.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>