<?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>Using two GPIOTE config to a single pin</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/11718/using-two-gpiote-config-to-a-single-pin</link><description>In another thread entitled: 
 Change in GPIO to start/stop timer and fire interrupt 
 The following code is used: 
 NRF_GPIOTE-&amp;gt;CONFIG[0] = (GPIOTE_CONFIG_POLARITY_HiToLo &amp;lt;&amp;lt; GPIOTE_CONFIG_POLARITY_Pos)
 | (myPin &amp;lt;&amp;lt; GPIOTE_CONFIG_PSEL_Pos) // using</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 05 Feb 2016 04:27:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/11718/using-two-gpiote-config-to-a-single-pin" /><item><title>RE: Using two GPIOTE config to a single pin</title><link>https://devzone.nordicsemi.com/thread/44317?ContentTypeID=1</link><pubDate>Fri, 05 Feb 2016 04:27:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5cad4ced-40f5-4c9b-982c-b8309524993b</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;your problems will start when you are using the softdevice and interrupts get delayed and you miss a flip. This is why I use the same pin in GPIOTE events and hold my nose, it works ok. You can try doing it with a GPIOTE pin toggle event and lots of PPIs, but you soon run out of PPIs, and sanity. You end up with PPIs triggering tasks and other PPIs disabling and re-enabling the first PPIs.&lt;/p&gt;
&lt;p&gt;I just changed my board so that the next version will send the same signal to two different pins so I can follow the manual, just to be sure.&lt;/p&gt;
&lt;p&gt;And no you don&amp;#39;t have to clear the interrupt, the Cortex does that for you, you have to clear the EVENT else  that will continue to assert the interrupt which will re-set as soon as the Cortext clears it and put you back there again.  &lt;code&gt;GPIOTE-&amp;gt;EVENTS_IN[0]=0&lt;/code&gt; before you leave the handler.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using two GPIOTE config to a single pin</title><link>https://devzone.nordicsemi.com/thread/44316?ContentTypeID=1</link><pubDate>Fri, 05 Feb 2016 04:19:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bee4e942-2c17-43cb-aa64-db7fad9e70bf</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;The event is whatever is configured in CONFIG[0]&amp;#39;s bitmask, which includes whether the GPIOTE is set for TASK or EVENT, you want EVENT, what the pin is, what the transition is (that&amp;#39;s a bitmask) and OUTINIT which you don&amp;#39;t care about, because that&amp;#39;s for TASKS.&lt;/p&gt;
&lt;p&gt;When the given transition occurs on the given pin, that EVENT triggers. At that point the model is the same for any other EVENT in the system, eg CLOCK has an HFCLKSTARTED event, in this case you have an array of IN events. So GPIOTE-&amp;gt;EVENTS_IN[0] == 1 and if you have the interrupt set to fire, it will fire. You have to clear that EVENTS_IN[0] back to 0 before you exit the interrupt handler, or it will fire again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using two GPIOTE config to a single pin</title><link>https://devzone.nordicsemi.com/thread/44315?ContentTypeID=1</link><pubDate>Fri, 05 Feb 2016 04:17:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d88f0fec-df3d-4763-a84d-4b49c73cbaf8</guid><dc:creator>osenjw</dc:creator><description>&lt;p&gt;I was going to try to flip in the interrupt.  If I have a clean signal no problem.  But I have the same concern as you, what happens with noise or a true interrupt that is missed?  And thanks for clearing my issues with pin vs signal.&lt;/p&gt;
&lt;p&gt;I have another question on interrupts.  I am used to interrupts that when you end up in the ISR, you need to clear the interrupt flag - or else a subsequent interrupt is not going to happen.  Often this is done by just reading the interrupt status register.  But with the M0 you actually have to write to the clear interrupt register.  Am I reading the RM correctly?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using two GPIOTE config to a single pin</title><link>https://devzone.nordicsemi.com/thread/44314?ContentTypeID=1</link><pubDate>Fri, 05 Feb 2016 04:11:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e468ef91-16da-4c58-8899-854068f19cb2</guid><dc:creator>osenjw</dc:creator><description>&lt;p&gt;Thanks for nudging me towards understanding.  I am reading the RM on GPIOTE.  The RM is defining the IN[] registers as&amp;#39; IN[0] 0x100 Event generated from pin specified in CONFIG[0].PSEL&amp;#39;.&lt;/p&gt;
&lt;p&gt;What is the &amp;#39;event&amp;#39;?  Is it an enumerated value such as LowToHigh or HighToLow?  When I end up in the interrupt what should be in the IN[] location?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using two GPIOTE config to a single pin</title><link>https://devzone.nordicsemi.com/thread/44313?ContentTypeID=1</link><pubDate>Thu, 04 Feb 2016 23:59:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e57ec996-4578-4429-ad33-adc9ff8b6134</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;but technically violates the one-pin-one-GPIOTE rule which does not, in the documentation, have an exception for EVENTs vs TASKS or you can use one GPIOTE and keep flipping it from up to down transitions, although you&amp;#39;re almost bound to run into issues where you don&amp;#39;t get through the interrupt handler in time to flip it and miss a transition, worse if some of your signals tend to bounce at the edge as some of mine do.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using two GPIOTE config to a single pin</title><link>https://devzone.nordicsemi.com/thread/44312?ContentTypeID=1</link><pubDate>Thu, 04 Feb 2016 23:54:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78896ccd-90f3-4289-8ee2-44b23b01759f</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;None of this is Cortex-M0-specific. By &amp;#39;input&amp;#39; I meant the signal you are trying to measure transitions on, the actual signal line. Pin means the logical number of input/output connection on the chip, eg P0.23, which of course then confusingly maps to a physical pin on the device.&lt;/p&gt;
&lt;p&gt;The spec-compliant way to do it is to have the input signal route to two separate pins and have the GPIOTE monitor one pin for up transitions and one for down transitions. GPIOTE has two modes, in TASK mode it controls a pin output, it&amp;#39;s pretty clear you can&amp;#39;t have two GPIOTEs driving a pin, in EVENT mode it monitors a pin, it seems reasonable that two GPIOTEs could monitor events on the same pin and empirically that works, but does violate the letter of the documentation. So your options are to find a way to send the same signal to separate pins, to use the fact EVENT mode seems to work,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using two GPIOTE config to a single pin</title><link>https://devzone.nordicsemi.com/thread/44311?ContentTypeID=1</link><pubDate>Thu, 04 Feb 2016 18:21:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3029aba-e54e-46d2-8576-c54536d82104</guid><dc:creator>osenjw</dc:creator><description>&lt;p&gt;I am confused by terminology.  I have a physical connection to what I call a pin.  I want an interrupt on both rising and falling events.  I do not have the option of connecting two physical pins to a single signal line.
I am also new to the M0 architecture.  Is an input a logical concept inside the M0?  What is the difference between an input and a pin?  I think of pin and input as synonyms.  If you could point me to the correct section of the RM, I would appreciate it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using two GPIOTE config to a single pin</title><link>https://devzone.nordicsemi.com/thread/44309?ContentTypeID=1</link><pubDate>Thu, 04 Feb 2016 08:26:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7443e5f9-f104-4723-b50c-765225e52643</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;+1 for RK, It does break the rule, could be some side effects if myPin is toggling close to system clock frequency. But at lower frequencies on myPin (&amp;lt;4MhZ) this would work (not recommended though)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using two GPIOTE config to a single pin</title><link>https://devzone.nordicsemi.com/thread/44310?ContentTypeID=1</link><pubDate>Thu, 04 Feb 2016 06:59:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69162371-835d-4649-8187-9fe8938d7ea3</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;The above code does break the one-pin-one-GPIOTE rule, however I&amp;#39;ve done this for events (and only events not tasks) very often and I&amp;#39;ve never had an issue with it.&lt;/p&gt;
&lt;p&gt;The absolute right way to do it would be to map the one input to two different pins and use one gpiote on one pin for the Lo to Hi, and the other Hi to Lo on the other pin.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>