<?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>GPIOTE freezes on pin value change</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/23326/gpiote-freezes-on-pin-value-change</link><description>I currently have a problem with the gpiote setup. I&amp;#39;m using it to detect an interrupt from mma8652 accelerometer. 
 here is an annotated version with the key portions of the code. 
 pin_event_handler()
{
 NRF_LOG_INFO(&amp;quot;\r\n PIN 26 triggered \r\n&amp;quot;</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 16 Jul 2017 03:00:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/23326/gpiote-freezes-on-pin-value-change" /><item><title>RE: GPIOTE freezes on pin value change</title><link>https://devzone.nordicsemi.com/thread/91701?ContentTypeID=1</link><pubDate>Sun, 16 Jul 2017 03:00:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b21e9058-9410-4d7f-b6c9-4bcb2b1f2007</guid><dc:creator>Dan</dc:creator><description>&lt;p&gt;I&amp;#39;m not really getting  results I want but that is what I was thinking so at least my thought process is correct. This seems more like a hidden issue somewhere and I think the initial question has been answered. Thanks Jørgen for taking the time to go though this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE freezes on pin value change</title><link>https://devzone.nordicsemi.com/thread/91702?ContentTypeID=1</link><pubDate>Thu, 13 Jul 2017 13:52:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b486d09-8948-4826-806c-142afdbba43f</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I would expect your code to wait on &lt;code&gt;while(nrf_drv_gpiote_in_is_set(26) == 1)&lt;/code&gt; until an interrupt is received. Then you clear the interrupt in the interrupt callback and read sensor data and data_handler is called once. I would then expect the sensor to have cleared the interrupt and you will be left waiting at &lt;code&gt;while(nrf_drv_gpiote_in_is_set(26) == 1)&lt;/code&gt; until the next interrupt is received. If the interrupt is not cleared, you will continue reading sensors and calling data_handler until the interrupt pin is cleared.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE freezes on pin value change</title><link>https://devzone.nordicsemi.com/thread/91700?ContentTypeID=1</link><pubDate>Thu, 13 Jul 2017 02:31:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a59711e-564a-4aa4-a2c4-427ff6fbd0ae</guid><dc:creator>Dan</dc:creator><description>&lt;p&gt;I&amp;#39;m using eclipse and am having trouble getting debug working. While I try to get that running could I ask what is your definition of continuing is for this code? My definition is that I expect to see data_handler() being called repeatedly and seeing my TWI values in uart. The interrupt period is longer than the print call and there is plenty of time to see it written to the uart between interrupts so I don&amp;#39;t expect that to be the issue. Am I wrong somewhere?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE freezes on pin value change</title><link>https://devzone.nordicsemi.com/thread/91703?ContentTypeID=1</link><pubDate>Wed, 12 Jul 2017 12:54:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8aae8bf-b424-41af-95be-cb176784f20b</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I tried your code again, and it still seems to continue after getting interrupt (commented out the TWI transfer functions, as I don&amp;#39;t have that accelerometer available). I suppose you have removed the &lt;code&gt;if(0)&lt;/code&gt; statement to get the code further down in main() to run? Have you tried &lt;a href="https://devzone.nordicsemi.com/question/60125/my-device-is-freezing-and-restarting/"&gt;debugging&lt;/a&gt;, to see if any functions return error codes, or that the application is continuing as expected?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE freezes on pin value change</title><link>https://devzone.nordicsemi.com/thread/91699?ContentTypeID=1</link><pubDate>Tue, 11 Jul 2017 01:00:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54a816ff-a0e3-4476-aa5b-262cd660960d</guid><dc:creator>Dan</dc:creator><description>&lt;p&gt;The MMA8652FC technical data sheet says that reading the F_STATUS register should clear the FIFO interrupt flag that I send and I do that. There is another function call in main to read out the accelerometer data. I based that code off the temp_sensor example. Here is a link to &lt;a href="https://www.dropbox.com/s/fxrrwfqexlpptr1/main.c?dl=0"&gt;main.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE freezes on pin value change</title><link>https://devzone.nordicsemi.com/thread/91698?ContentTypeID=1</link><pubDate>Mon, 10 Jul 2017 13:15:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff149138-d3bc-4bb2-b43e-d2aa7dd8487f</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I tested your code and it seems to contine as expected for me. Are you doing anything else in your code? Is the interrupt pin from the accelerometer cleared again after being set? You should not have to do anything with the registers when using the driver, it should handle this for you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE freezes on pin value change</title><link>https://devzone.nordicsemi.com/thread/91706?ContentTypeID=1</link><pubDate>Sat, 08 Jul 2017 09:51:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10565a06-1318-4377-9a60-9b335bfe6bf9</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Hi Dan, fully understand the constrains, just note that clones of Saleae Logic can be yours for 5USD including shipping...;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE freezes on pin value change</title><link>https://devzone.nordicsemi.com/thread/91697?ContentTypeID=1</link><pubDate>Sat, 08 Jul 2017 04:21:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:abce1e32-0a27-40a3-b41b-d3d5ff35b913</guid><dc:creator>Dan</dc:creator><description>&lt;p&gt;This appears to have worked as I can now trigger the statement in pin_event_handler. As a follow-up question, is there something that stops the function form going on after hitting the interrupt? It seems to just stop doing anything in the outermost while loop in function main?
I&amp;#39;ve seen other question that reference
NRF_GPIOTE-&amp;gt;EVENT_PORT = 0
NRF_GPIOTE-&amp;gt;EVENTS_IN[0]
but I don&amp;#39;t quite understand how these work or if they are related at all to make the code continue.&lt;/p&gt;
&lt;p&gt;I assume this should be fairly common action to code where a sensor sends an interrupt and I want to take take note of that and call a read on the data. I haven&amp;#39;t seen any examples but is there anything I can reference for this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE freezes on pin value change</title><link>https://devzone.nordicsemi.com/thread/91705?ContentTypeID=1</link><pubDate>Sat, 08 Jul 2017 04:07:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a43f2caf-d510-4a26-b5ba-f360e713da8d</guid><dc:creator>Dan</dc:creator><description>&lt;p&gt;That&amp;#39;s good to know that some things like uart can be the source. The delay_ms function was my attempt just to do a quick debug on the value coming in and I wanted to verify that I was getting an interrupt from the accelerometer since if I don&amp;#39;t have uart I won&amp;#39;t see anything. That I can remove. And unfortunately, since I don&amp;#39;t own the hardware like an oscilloscope, uart is the easiest option for me to look at the pin output.&lt;/p&gt;
&lt;p&gt;If you have anything like this to point out about my response to Jorgen that would be appreciated. More knowledge or examples is always helpful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE freezes on pin value change</title><link>https://devzone.nordicsemi.com/thread/91696?ContentTypeID=1</link><pubDate>Fri, 07 Jul 2017 07:47:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15dc3d7b-52d2-4279-be70-95ce87542064</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You need to set the &lt;code&gt;int_enable&lt;/code&gt; parameter in &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v13.0.0/group__nrf__drv__gpiote.html#gaae09a8502cf8bd099736f46a7542c82f"&gt;&lt;code&gt;nrf_drv_gpiote_in_event_enable()&lt;/code&gt;&lt;/a&gt; to &lt;strong&gt;true&lt;/strong&gt; to enable the interrupt. If you look in the implementation of the function, you will see that interrupt and handler is only set if this parameter is true.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE freezes on pin value change</title><link>https://devzone.nordicsemi.com/thread/91704?ContentTypeID=1</link><pubDate>Fri, 07 Jul 2017 07:14:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba3a6bba-5459-489a-aa23-e2b17276948a</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Two hints:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;nrf_delay_ms function is blocking MCU with NOP instructions, doesn&amp;#39;t really work well if you wait for some asynchronous thing like interrupt. I use it for some quick debugging as well but in your case implementing correct timer (e.g. through RTC based app_timer library) would be much better.&lt;/li&gt;
&lt;li&gt;Similar with your interrupt handler: doing any time-consuming action or computation might lead to different kind of failures or unexpected behavior. So your UART logging might look short but in some extreme cases you can be running out of time. As you experience some troubles exactly here I would either remove it completely or put some faster debugging indication like simple GPIO LOW/HIGH control of single output PIN and observing it with oscilloscope or better logical analyzer....&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>