<?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>Cannot clear &amp;#39;wake on GPIO&amp;#39; input sense pin</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/31318/cannot-clear-wake-on-gpio-input-sense-pin</link><description>The wake on GPIO is working all the time now. 
 Unfortunately, I want to disable it except when needed. 
 Here is the scenario: 
 
 Power up, pushbutton pin senses clicks to allow pairing or to clear pairing, depending on number of clicks. 
 On timeout</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 14 Mar 2018 20:31:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/31318/cannot-clear-wake-on-gpio-input-sense-pin" /><item><title>RE: Cannot clear 'wake on GPIO' input sense pin</title><link>https://devzone.nordicsemi.com/thread/124463?ContentTypeID=1</link><pubDate>Wed, 14 Mar 2018 20:31:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0fb238c9-305b-4073-9bd7-8b4386a3c830</guid><dc:creator>dcollier8</dc:creator><description>&lt;p&gt;Found the issue was in Makefile:&lt;/p&gt;
&lt;p&gt;CFLAGS += -DCONFIG_GPIO_AS_PINRESET&lt;/p&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;p&gt;ASMFLAGS += -DCONFIG_GPIO_AS_PINRESET&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot clear 'wake on GPIO' input sense pin</title><link>https://devzone.nordicsemi.com/thread/124452?ContentTypeID=1</link><pubDate>Wed, 14 Mar 2018 18:43:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aeffaed8-2216-42a8-88fa-aa91e46b6921</guid><dc:creator>dcollier8</dc:creator><description>&lt;p&gt;The current error after wake from GPIO is:&lt;/p&gt;
&lt;p&gt;On initial startup the first call to &lt;em&gt;SOFTDEVICE_HANDLER_INIT&lt;/em&gt; subroutine has a variable called: power_clock_isr_enabled, which is false. On the wake from GPIO restart, the power_clock_isr_enabled is now true. I cannot find anywhere in the code where this is set to true. Is this a problem ? When its true it stops NVIC_DisableIRQ&amp;nbsp; and then starts the NVIC_EnableIRQ, before the error happens. The Pushbutton is caught by the GPIOTE_IRQHandler. Any relationship ? The Pushbutton click is not getting to GPIOTE_IRQHandler due to the error causing trap and reset: &lt;/p&gt;
&lt;p&gt;&lt;em&gt;#ifndef DEBUG&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NVIC_SystemReset();&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Hope this helps.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot clear 'wake on GPIO' input sense pin</title><link>https://devzone.nordicsemi.com/thread/124449?ContentTypeID=1</link><pubDate>Wed, 14 Mar 2018 18:15:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33dc4cdf-ab46-49b5-9b3b-b3fbcf98ade1</guid><dc:creator>dcollier8</dc:creator><description>&lt;p&gt;Is there a trick to starting the softdevice after a &lt;em&gt; NRF_POWER-&amp;gt;SYSTEMOFF = 0x1;&lt;/em&gt; ?&lt;/p&gt;
&lt;p&gt;I would be OK with starting like a cold boot up, I am not preserving RAM.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot clear 'wake on GPIO' input sense pin</title><link>https://devzone.nordicsemi.com/thread/124448?ContentTypeID=1</link><pubDate>Wed, 14 Mar 2018 18:11:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e00de139-c91b-4df2-88f5-34922769ab9d</guid><dc:creator>dcollier8</dc:creator><description>&lt;p&gt;I stopped all timers using this call:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; app_timer_stop(pwr_off_id);&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;app_timer_stop(g_blink_timer_id);&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;app_timer_stop(m_sec_req_timer_id);&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;app_timer_stop(m_battery_timer_id);&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;app_timer_stop(norecs_off_id);&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Which solves the above app_timer.c error. BUT now the error moved to this call in main.c :&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;em&gt; SOFTDEVICE_HANDLER_INIT(&amp;amp;clock_lf_cfg, NULL);&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I am trying to find the cause in this subroutine &lt;em&gt;SOFTDEVICE_HANDLER_INIT&lt;/em&gt;, which executes all its code OK, but then causes the error at completion of the call.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot clear 'wake on GPIO' input sense pin</title><link>https://devzone.nordicsemi.com/thread/124440?ContentTypeID=1</link><pubDate>Wed, 14 Mar 2018 16:48:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ebbe9563-a5c1-4d43-a434-c83358fc9218</guid><dc:creator>dcollier8</dc:creator><description>&lt;p&gt;RESETREAS reveals that there is an error causing the reset, the error is INVALID_STATE in app_timer.c timer create, line 991, for code which runs fine all the time before the error. We are not preserving RAM, but this looks like a resource problem.&lt;/p&gt;
&lt;p&gt;I am using this code to mask errors, so the error is happening just after wake on GPIO.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF_POWER-&amp;gt;SYSTEMOFF = 0x1;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Use data synchronization barrier and a delay to ensure that no failure&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // indication occurs before System OFF is actually entered.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; __DSB();&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; __NOP();&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot clear 'wake on GPIO' input sense pin</title><link>https://devzone.nordicsemi.com/thread/124372?ContentTypeID=1</link><pubDate>Wed, 14 Mar 2018 13:15:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37f5abce-8b6d-4f0b-bd6b-af9bd0425763</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;You can use&amp;nbsp;nrf_gpio_pin_latch_clear() to clear bits in the latch register, but I don&amp;#39;t think it explains why you are getting a reset when the device is not in system OFF mode. Suggest to check the&amp;nbsp;NRF_POWER-&amp;gt;RESETREAS on startup to check what the reset source is. Note that the RESETREAS register is only reset through brown out and power on reset.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot clear 'wake on GPIO' input sense pin</title><link>https://devzone.nordicsemi.com/thread/124009?ContentTypeID=1</link><pubDate>Mon, 12 Mar 2018 16:23:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:758ba41f-306a-40ee-8060-1867272c579b</guid><dc:creator>dcollier8</dc:creator><description>&lt;p&gt;I tried the above suggestions (DEBUG and nrf_gpio_cfg_default()), they did not work. Meanwhile I got another suggestion from Patyush Dave:&lt;/p&gt;
&lt;p&gt;the bit corresponding to the GPIO in the LATCH register needs to be reset by writing a &amp;lsquo;1&amp;rsquo; to the bit.&lt;/p&gt;
&lt;p&gt;BUT I do&amp;nbsp; not know how to do the above suggestion.&lt;/p&gt;
&lt;p&gt;Please provide sample code, and location of where to put the change, per the above suggestion.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot clear 'wake on GPIO' input sense pin</title><link>https://devzone.nordicsemi.com/thread/123914?ContentTypeID=1</link><pubDate>Mon, 12 Mar 2018 12:42:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d2a3473f-372b-4678-9e36-3c13129f8ede</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;A wakeup pin should only cause a reset when the device is in system OFF mode (Wakeup from System OFF mode reset). Is it possible that you are seeing a code assert once the button is presses in the app?&amp;nbsp; Please add &amp;quot;DEBUG&amp;quot; to the list of pre-processor definitions and see if the program ends up in the&amp;nbsp;app_error_handler() (actual handler name may be differ depending on SDK version)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Note that the pin must be configured with sense enabled if you are using PORT events to detect button presses.&amp;nbsp;&amp;nbsp;nrf_gpio_cfg_default() can be used to configure a pin back to its reset state.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>