<?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 Interrupt nRF51822 freezing</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/18230/gpiote-interrupt-nrf51822-freezing</link><description>Hi, 
 I am writing a firmware for one of my custom boards which use GPIOTE to detect interrupt for 3 GPIOs inputs (P0.03, P0.06 and P0.09, both with internal pull-ups) and one pin set as an output (P0.05).
Everything is working perfectly until the P0</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 13 Jan 2017 13:04:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/18230/gpiote-interrupt-nrf51822-freezing" /><item><title>RE: GPIOTE Interrupt nRF51822 freezing</title><link>https://devzone.nordicsemi.com/thread/70388?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 13:04:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2bbe15a-5a39-49d7-af39-7e2be9ddc180</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;I am running out of ideas. It works with &lt;code&gt;.hi_accuracy = true&lt;/code&gt; which indicates that there is something wrong with the PORT event functionality, but then setting the polarity to toggle should work. What is the PIN_CNF[9] register when the interrupt stops? Is it still &lt;code&gt;PIN_CNF[9] = 0x0003000C&lt;/code&gt;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE Interrupt nRF51822 freezing</title><link>https://devzone.nordicsemi.com/thread/70387?ContentTypeID=1</link><pubDate>Wed, 11 Jan 2017 12:11:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47302696-4f3c-485f-9a45-fb9b9693f42e</guid><dc:creator>Guillaume Levant</dc:creator><description>&lt;p&gt;I tried the following configuration :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; nrf_drv_gpiote_in_config_t p9_config =
	    {
	        .sense = NRF_GPIOTE_POLARITY_TOGGLE,
	        .pull = NRF_GPIO_PIN_PULLUP ,
	        .is_watcher = false,
	        .hi_accuracy = false
	    };
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then when the interrupt occurs, I check with nrf_gpio_pin_read(9) that the pin level is 0.
But I have the same problem with this configuration : The interrupt is not processed, and the following interrupt are not either process unless I set p0.09 high.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE Interrupt nRF51822 freezing</title><link>https://devzone.nordicsemi.com/thread/70386?ContentTypeID=1</link><pubDate>Tue, 10 Jan 2017 13:50:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66f7ca36-a200-418c-824c-591dbe416d18</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;I totally understand that it is not acceptable to have that high current consumption, this was just to narrow down the possible causes for the problem.&lt;/p&gt;
&lt;p&gt;I think I know what is the cause of the problem now. It is probably in how the sense and port event mechanism works. As described in the &lt;a href="http://infocenter.nordicsemi.com/pdf/nRF51_RM_v3.0.1.pdf"&gt;Reference Manual&lt;/a&gt; chapter 14 - GPIO, each pin has a separate DETECT signal that is set high when the pin sense the correct level. All DETECT signals are combined into a common DETECT signal that is used to trigger the PORT event. When using &lt;code&gt;.hi_accuracy = false&lt;/code&gt; this mechanism is used. The problem is that the DETECT signal is not cleared unless no pins are sensing the correct level. This is why it works after you set the P0.09 pin manually to high and not before.&lt;/p&gt;
&lt;p&gt;I thought the gpiote driver had a way of avoiding this, but after checking more thoroughly this is only the case if the sense is set to NRF_GPIOTE_POLARITY_TOGGLE. Then the sense bit will be flipped in the interrupt, thereby clearing the DETECT signal for that pin.&lt;/p&gt;
&lt;p&gt;One way to fix your problem is to configure the sense to NRF_GPIOTE_POLARITY_TOGGLE, but then you need to check in some way if the pin went from high to low or low to high. You can do this by checking the pin input value with &lt;code&gt;nrf_gpio_pin_read(uint32_t pin_number)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I will talk to the developers if we can improve the gpiote driver such that this is not a problem in the future.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE Interrupt nRF51822 freezing</title><link>https://devzone.nordicsemi.com/thread/70384?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 14:43:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23743ade-3a69-48d1-85a3-04b22c2c93c5</guid><dc:creator>Guillaume Levant</dc:creator><description>&lt;p&gt;I tried it and the problem disappears with this configuration. But unfornutately the power consumption of the device is way too high in this case (about 1mA during advertising, 1.25mA connected). According to this result, do you know a solution which permit me to keep .hi_accuracy = false ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE Interrupt nRF51822 freezing</title><link>https://devzone.nordicsemi.com/thread/70385?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 13:53:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94530827-829d-4786-9d84-546af0b04acb</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Can you try to set the accuracy to high on P0.09:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;.hi_accuracy = true
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And see if you still have the same problem?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE Interrupt nRF51822 freezing</title><link>https://devzone.nordicsemi.com/thread/70383?ContentTypeID=1</link><pubDate>Thu, 22 Dec 2016 13:26:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46634d1c-70ec-4494-91ab-81c5e57f6e54</guid><dc:creator>Guillaume Levant</dc:creator><description>&lt;p&gt;I set it the priority of gpiote level to APP_IRQ_PRIORITY_HIGH, and the BLE is still working (I see BLE_GAP_EVT_CONNECTED and BLE_GAP_EVT_DISCONNECTED, and also read and write requests). But I noticed something interesting : The interrupt on P0.09 is active when the pin is low, and then the problem described above happens. But on a BLE disconnection event, I send an I2C command to a IC that sets the P0.09 high, and then the other interrupts are working even if the disconnection comes after the interrupt, and they works until P0.09 goes low again. So it seems to be link to the fact that P0.09 is low, but I can&amp;#39;t understand why. In you opinion what piece of my code is missing to permit you to help me further ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE Interrupt nRF51822 freezing</title><link>https://devzone.nordicsemi.com/thread/70382?ContentTypeID=1</link><pubDate>Wed, 21 Dec 2016 12:45:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:257a74f5-8c66-4ad2-a955-2144ad95bb0e</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;So something is happening when you get interrupt for P0.09 that is blocking all other interrupts at that level and below. If you increase the interrupt priority to APP_PRIORITY_HIGH you should see that the the BLE event also does not show. Could you verify this?&lt;/p&gt;
&lt;p&gt;I am not sure how I can help you further without having a look at your code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE Interrupt nRF51822 freezing</title><link>https://devzone.nordicsemi.com/thread/70381?ContentTypeID=1</link><pubDate>Thu, 15 Dec 2016 14:30:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84aa3e98-db08-4d33-adac-41f17e96d147</guid><dc:creator>Guillaume Levant</dc:creator><description>&lt;p&gt;Yes I noticed that the power_manage() function doesn&amp;#39;t return in this case, but it does for BLE event, so I think you are right. But the point is that when the interrupt should occurs, an RTT command should be sent in the gpiote handler, and I have never seen this interrupt for P0.09 interrupt, but I do for P0.03 and P0.06.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE Interrupt nRF51822 freezing</title><link>https://devzone.nordicsemi.com/thread/70380?ContentTypeID=1</link><pubDate>Thu, 15 Dec 2016 13:56:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c99384a2-8cd6-459e-9218-299fdbcc7a6c</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;The power_manage() function does basically the same thing as __WFE(), it puts the chip to sleep waiting for events that will wake it up. If it was stuck here nothing would work.&lt;/p&gt;
&lt;p&gt;My guess is that you are stuck in an interrupt at a low level. Then all interrupts at the same level or lower, including main, will not be able to execute. Interrupts at a higher level will work as usual, this will include the SoftDevice code. Check if your main code is called at all (add something after the power_manage function to indicate that this function returns).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE Interrupt nRF51822 freezing</title><link>https://devzone.nordicsemi.com/thread/70379?ContentTypeID=1</link><pubDate>Wed, 14 Dec 2016 16:04:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e83e1d98-f19e-42f4-9c71-e87995e49878</guid><dc:creator>Guillaume Levant</dc:creator><description>&lt;p&gt;Ole, I made a few test and I noticed that during this bug, only the gpiote interrupt and the timer are not working. The BLE works perfectly fine and I can send commands that shows that the MCU is not completely frozen when I use the gpiote interrupt, not the timer. I wonder if the code is stuck in a power_manage() function. Is it possible that it could disable the gpiote interrupt ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE Interrupt nRF51822 freezing</title><link>https://devzone.nordicsemi.com/thread/70378?ContentTypeID=1</link><pubDate>Thu, 08 Dec 2016 15:09:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96ac2c5f-2950-4ff1-abfa-9ef8fcab5818</guid><dc:creator>Guillaume Levant</dc:creator><description>&lt;p&gt;I set UART0_ENABLED to 0 in nrf_drv_config.h, and I excluded from build every library related to UART.
Here are the different value for PIN_CNF :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;PIN_CNF[3] = 0x0003000C&lt;/li&gt;
&lt;li&gt;PIN_CNF[6] = 0x0002000C&lt;/li&gt;
&lt;li&gt;PIN_CNF[9] = 0x0003000C&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So to me it fits with the configurations I sent during the initialization (Input, S0S1, pull-up, wake-up on low level).&lt;/p&gt;
&lt;p&gt;I tried to replace the interrupt by a timer in repeat mode with a period of 30 seconds, the same thing happens. So I think this problem is not related to the GPIOs or GPIOTE. I&amp;#39;ll look into if I encountered an error somewhere...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE Interrupt nRF51822 freezing</title><link>https://devzone.nordicsemi.com/thread/70377?ContentTypeID=1</link><pubDate>Thu, 08 Dec 2016 14:03:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6393e64-bcfa-47fb-a1eb-662be3513612</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;You are sure this pin is not used anywhere else in the code such that the gpio config is altered? On the DK pin P0.09 is used for uart TX, in case you are basing your code on a PCA10028 example and have not commented out uart code. To check that the gpio config is correct you can go into debug mode, stop the code when the problem happens (this will also tell you where the code is stuck), then you can check &lt;code&gt;system peripherals -&amp;gt; gpio&lt;/code&gt; and the PIN_CNF[9] register. It should be the same as PIN_CNF[6] and PIN_CNF[3], except for maybe the SENSE bit.&lt;/p&gt;
&lt;p&gt;Does the whole device freeze or is it only the gpiote interrupt that are not working? Can you check if you encountered an error condition? Check &lt;a href="https://devzone.nordicsemi.com/question/60125/my-device-is-freezing-and-restarting/"&gt;this&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>