<?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>Read gpio state on event</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/44535/read-gpio-state-on-event</link><description>Hi, 
 I&amp;#39;m implementing quadrature encoder to read motor speed/position. So far I configured a gpio pin where A channel of the quadrature encoder is connected to capture timer value on toggle using gpiote, ppi and timer. 
 Now I would like also to capture</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 08 Mar 2019 15:01:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/44535/read-gpio-state-on-event" /><item><title>RE: Read gpio state on event</title><link>https://devzone.nordicsemi.com/thread/175081?ContentTypeID=1</link><pubDate>Fri, 08 Mar 2019 15:01:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2262ca7a-6c99-4b41-83da-c63da33a321c</guid><dc:creator>Sigurd</dc:creator><description>[quote userid="7065" url="~/f/nordic-q-a/44535/read-gpio-state-on-event/174898"]it has same effect as reading gpio state in interrupt routine (which has some latency due to softdevice).[/quote]
&lt;p&gt;You can increment the timer counter with PPI using the Timer&amp;#39;s &amp;quot;&lt;span&gt;TASKS_COUNT&amp;quot; task.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read gpio state on event</title><link>https://devzone.nordicsemi.com/thread/174898?ContentTypeID=1</link><pubDate>Thu, 07 Mar 2019 19:45:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:081016ed-7033-46d6-94ca-9c6d121f4697</guid><dc:creator>gaminn</dc:creator><description>&lt;p&gt;Actually, I found that this idea doesn&amp;#39;t work - it has same effect as reading gpio state in interrupt routine (which has some latency due to softdevice). Now I&amp;#39;m trying this: on A channel&amp;#39;s rising/falling edge I trigger SPI transaction (B channel connected to MISO). SPI samples B channel and stores it value (0xFF or 0x00) to RX buffer where it is accessible later. The same &amp;quot;principle&amp;quot; would probably work with ADC - to buffer B channel using ADC on A channel falling/rising edge.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read gpio state on event</title><link>https://devzone.nordicsemi.com/thread/174871?ContentTypeID=1</link><pubDate>Thu, 07 Mar 2019 16:06:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28763c7b-97aa-4277-a608-1f81fd4dece8</guid><dc:creator>gaminn</dc:creator><description>&lt;p&gt;Great idea, thanks. The only drawback in my case is that I might run out of timers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read gpio state on event</title><link>https://devzone.nordicsemi.com/thread/174865?ContentTypeID=1</link><pubDate>Thu, 07 Mar 2019 15:46:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:484bc250-90ba-40a3-b16b-b6041d5fc83d</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can configure the GPIOTE to generate an event on GPIO rising edge,&amp;nbsp;falling edge or&amp;nbsp;any change. You can then configure an TIMER instance in counter mode, and use it to keep track of how many times the event has been&amp;nbsp;&lt;span&gt;generated. If you know the&amp;nbsp;initial gpio state(high/low), then you also know the current GPIO state simply by looking at the counter value.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>