<?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>How to get GPIO register state in GPIOTE handler</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/116368/how-to-get-gpio-register-state-in-gpiote-handler</link><description>Hello Nordic! My question probably a simple one but I&amp;#39;m a novice so there&amp;#39;s it. I&amp;#39;m looking for a way to get a GPIO port state that was at the moment of GPIOTE event triggering, inside the event handler. Is there any register I can read to get that? </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 19 Dec 2024 10:59:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/116368/how-to-get-gpio-register-state-in-gpiote-handler" /><item><title>RE: How to get GPIO register state in GPIOTE handler</title><link>https://devzone.nordicsemi.com/thread/515694?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2024 10:59:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:743261ce-bcc9-438b-9048-f6b30eb0e125</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi, yes, that could work. You will get the pin number in the gpiote handler.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get GPIO register state in GPIOTE handler</title><link>https://devzone.nordicsemi.com/thread/515631?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2024 04:18:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f08cf2c-fbe5-45b7-8b33-6ced6ee14705</guid><dc:creator>Vas</dc:creator><description>&lt;p&gt;Thank you for the links. I got another idea - what if I connect both DIN and SCLK to an AND logical element and feed the result to another GPIO pin. Both signals never change together. Will I be able to check which GPIOs were triggered in GPIOTE event handler?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get GPIO register state in GPIOTE handler</title><link>https://devzone.nordicsemi.com/thread/513418?ContentTypeID=1</link><pubDate>Wed, 04 Dec 2024 12:36:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f74ea70-fad0-407d-a67a-9db3d96a3b90</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Unfortunately, it is not possible to capture digital levels on GPIOs using PPI.&lt;/p&gt;
&lt;p&gt;Some potential workarounds:&lt;/p&gt;
&lt;p&gt;1) You can configure the GPIOTE to generate an event on GPIO rising edge, falling edge or any change for the&amp;nbsp;&lt;span&gt;SCLK input.&lt;/span&gt;&lt;br /&gt;You can then configure a TIMER instance in counter mode, and use it to keep track of how many times the GPIOTE event has been generated.&lt;br /&gt;If you know the initial gpio state(high/low), then you also know the current GPIO state simply by looking at the counter value.&lt;br /&gt;Trigger the TIMER CC capture task using PPI with the GPIOTE event for the DIN. Then in the GPIO handler, you can read TIMER CC register, and based on that value you can know if the &lt;span&gt;SCLK&amp;nbsp;was high or low.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2) Use SAADC, see this post:&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/103840/is-it-possible-to-read-a-data-pin-with-ppi-ps-2-bit-banging-using-ppi/446442"&gt;RE: Is it possible to read a data pin with PPI? (PS/2 bit banging using PPI)&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get GPIO register state in GPIOTE handler</title><link>https://devzone.nordicsemi.com/thread/512640?ContentTypeID=1</link><pubDate>Thu, 28 Nov 2024 18:58:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54482adf-1950-410a-8b6b-4c9da40b7877</guid><dc:creator>Vas</dc:creator><description>&lt;p&gt;Both DIN and SCLK are inputs for the nRF52840 in my case. And if that would be the current reading it will be the issue I described in the original post. The time difference between falling DIN and SCLK is 10 us so when I&amp;#39;m reading the GPIO input from the handler it&amp;#39;s already past that time and the SCLK is already fallen low.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get GPIO register state in GPIOTE handler</title><link>https://devzone.nordicsemi.com/thread/512565?ContentTypeID=1</link><pubDate>Thu, 28 Nov 2024 12:01:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0f5f939-6c31-4296-af14-82048e870df6</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Current reading. I&amp;#39;m not familiar with &lt;span&gt;TM1640. Is the&amp;nbsp;SCLK&amp;nbsp;input or output from the nRF52840 ?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get GPIO register state in GPIOTE handler</title><link>https://devzone.nordicsemi.com/thread/512488?ContentTypeID=1</link><pubDate>Thu, 28 Nov 2024 03:37:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe7f6ab7-2695-4f5e-86f5-a58d39cd84be</guid><dc:creator>Vas</dc:creator><description>&lt;p&gt;Will I get the input state of the moment when the GPIOTE event&amp;nbsp;triggered or I&amp;#39;ll get the current reading?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get GPIO register state in GPIOTE handler</title><link>https://devzone.nordicsemi.com/thread/512456?ContentTypeID=1</link><pubDate>Wed, 27 Nov 2024 22:45:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4769a75-5021-4749-a412-17e82d0ba5d8</guid><dc:creator>Sigurd</dc:creator><description>[quote user="Vas"]I&amp;#39;m catching DIN change by GPIOTE but I need to know if SCLK was high at the moment.[/quote]
&lt;p&gt;If this SCLK is a input, you could try reading the GPIO IN register.&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf52840/page/gpio.html#ariaid-title7"&gt;https://docs.nordicsemi.com/bundle/ps_nrf52840/page/gpio.html#ariaid-title7&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get GPIO register state in GPIOTE handler</title><link>https://devzone.nordicsemi.com/thread/510549?ContentTypeID=1</link><pubDate>Thu, 14 Nov 2024 17:13:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc5d2235-7dd4-4870-bc2d-5a711b8e3e52</guid><dc:creator>Vas</dc:creator><description>&lt;p&gt;I&amp;#39;m actually looking at the other signal state. I&amp;#39;m catching DIN change by GPIOTE but I need to know if SCLK was high at the moment.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get GPIO register state in GPIOTE handler</title><link>https://devzone.nordicsemi.com/thread/510501?ContentTypeID=1</link><pubDate>Thu, 14 Nov 2024 13:35:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:096af615-7a40-4427-a863-1a758834e946</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;A GPIOTE event can come from one of the following input conditions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Rising edge&lt;/li&gt;
&lt;li&gt;Falling edge&lt;/li&gt;
&lt;li&gt;Any change&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So if you have e.g. configured it to &lt;span&gt;Rising&amp;nbsp;&lt;/span&gt;edge, you then already know it was rising to high when the event triggered.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>