<?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>S130 GPIO Interrupt</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16522/s130-gpio-interrupt</link><description>Hi 
 I&amp;#39;m trying to catch the GPIOTE_IRQn interrupt, while the device is in system off.
Not enabling the SD130 V2 the interrrupt is caught once, and then not anymore...
But I&amp;#39;m having problems keeping it running while the softdevice is active. 
 I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 20 Sep 2016 06:27:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16522/s130-gpio-interrupt" /><item><title>RE: S130 GPIO Interrupt</title><link>https://devzone.nordicsemi.com/thread/63194?ContentTypeID=1</link><pubDate>Tue, 20 Sep 2016 06:27:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:118b4791-f68a-4c2d-84bb-319d4c32dcd9</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;also note that adding uart prints into GPIOTE ISR have its own side ffects. This means that your ISR  might finish slow adding to the risk that very fast gpio toggles might not be detected if they are toggle more than twice  during the ISR execution.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S130 GPIO Interrupt</title><link>https://devzone.nordicsemi.com/thread/63193?ContentTypeID=1</link><pubDate>Tue, 20 Sep 2016 06:25:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7377f8be-d9a2-41b5-9538-543d7268bc1f</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;h2&gt;Version 1)&lt;/h2&gt;
&lt;p&gt;to get hi_accuracy callbacks you need to set
.hi_accuracy = true;&lt;br /&gt;
Then instead of PORT event IN_EVENT is used which will force the HFCLK ON.&lt;/p&gt;
&lt;h2&gt;Version2)&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;GPIOTE-&amp;gt;CONFIG[0] does not have any settings for GPIOTE_INTENSET_IN0_Set.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;PORT events are active by default you do not need to enable them. You just need to enable its interrupt if you want your ISR to be called on PORT events.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You are configuing pin 13 in GPIO and pin 10 in GPIOTE? I am not sure what you are trying to do.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;This is very important. You are trying to read the pin inside the GPIOTE_IRQHandler. The handler itself have latency on ARM core + the interrupt forwarding mechanism by MBR and softdevice adds up the latency. So when you are reading the GPIO pin inside the handler, the state of the pin is not necessarily the same as the condition that triggered the PORT event. I would change version 2) as below&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; static void init_wakeup_interrupt(){

 NRF_GPIO-&amp;gt;PIN_CNF[13] = (GPIO_PIN_CNF_SENSE_Low &amp;lt;&amp;lt; GPIO_PIN_CNF_SENSE_Pos)
                         | (GPIO_PIN_CNF_DRIVE_S0S1 &amp;lt;&amp;lt; GPIO_PIN_CNF_DRIVE_Pos)
                         | (GPIO_PIN_CNF_PULL_Disabled &amp;lt;&amp;lt; GPIO_PIN_CNF_PULL_Pos)
                         | (GPIO_PIN_CNF_INPUT_Connect &amp;lt;&amp;lt; GPIO_PIN_CNF_INPUT_Pos)
                         | (GPIO_PIN_CNF_DIR_Input &amp;lt;&amp;lt; GPIO_PIN_CNF_DIR_Pos);

 NRF_GPIOTE-&amp;gt;INTENSET = GPIOTE_INTENSET_PORT_Set &amp;lt;&amp;lt; GPIOTE_INTENSET_PORT_Pos;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;//  NVIC_EnableIRQ(GPIOTE_IRQn);
sd_nvic_SetPriority(GPIOTE_IRQn, 1);
sd_nvic_EnableIRQ(GPIOTE_IRQn);
}&lt;/p&gt;
&lt;p&gt;void GPIOTE_IRQHandler(void)
{
// Event causing the interrupt must be cleared
if ((NRF_GPIOTE-&amp;gt;EVENTS_PORT != 0))
{
NRF_GPIOTE-&amp;gt;EVENTS_PORT = 0;
NRF_LOG_PRINTF(&amp;quot;GPIO &amp;gt;&amp;gt; LOW : %d\r\n&amp;quot;, 13);
}
else
{
NRF_LOG_PRINTF(&amp;quot;GPIO &amp;gt;&amp;gt; HIGH : %d\r\n&amp;quot;, 13);
}
}&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>