<?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 current value of an OUTPUT gpio pin</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/104417/read-current-value-of-an-output-gpio-pin</link><description>Hi! 
 Any way in Zephyr to read the current value of a GPIO pin that is configured as OUTPUT? 
 Thanks! 
 Pedro.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 12 Nov 2025 17:24:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/104417/read-current-value-of-an-output-gpio-pin" /><item><title>RE: Read current value of an OUTPUT gpio pin</title><link>https://devzone.nordicsemi.com/thread/554176?ContentTypeID=1</link><pubDate>Wed, 12 Nov 2025 17:24:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:acfd4d60-14a3-4cc3-a05e-4af9bca58a4a</guid><dc:creator>Achim Kraus</dc:creator><description>[quote userid="125646" url="~/f/nordic-q-a/104417/read-current-value-of-an-output-gpio-pin/449528"] you can use still use Zephyr&amp;#39;s gpio_pin_get() to get the state of the the output pin.[/quote]
&lt;p&gt;To be more precise: you read to level of the input at that pin. If the output is high, but the load pulls it too much down, you will read a low instead of the value high set to the output. Maybe in my case, the load is out of spec.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read current value of an OUTPUT gpio pin</title><link>https://devzone.nordicsemi.com/thread/449547?ContentTypeID=1</link><pubDate>Tue, 10 Oct 2023 11:51:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cbe611f3-ec84-4ff8-843d-2dbc4bd57d70</guid><dc:creator>Pedro</dc:creator><description>&lt;p&gt;Thank you Joe! This also works.&lt;/p&gt;
&lt;p&gt;Anyway, I&amp;#39;m curious about knowing how to know&amp;nbsp;the include path for any .h file, which does not corresponds with the system folder structure. Somebody knows?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Pedro.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read current value of an OUTPUT gpio pin</title><link>https://devzone.nordicsemi.com/thread/449528?ContentTypeID=1</link><pubDate>Tue, 10 Oct 2023 11:01:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f903207-0129-45d3-aff4-424758100364</guid><dc:creator>Joe Kane</dc:creator><description>&lt;p&gt;Pedro,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Actually, you can use still use Zephyr&amp;#39;s gpio_pin_get() to get the state of the the output pin.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The trick is to configure the pin as both an output and input in Zephyr, like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;gpio_pin_configure_dt(&amp;amp;led1, GPIO_OUTPUT_INACTIVE | GPIO_INPUT);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;and now gpio_pin_get() will work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read current value of an OUTPUT gpio pin</title><link>https://devzone.nordicsemi.com/thread/449518?ContentTypeID=1</link><pubDate>Tue, 10 Oct 2023 10:31:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d01e6c4-e7ca-458a-be5c-946acc9bc673</guid><dc:creator>Pedro</dc:creator><description>&lt;p&gt;Thanks Einar!&lt;/p&gt;
&lt;p&gt;How can I find in the future the include path for other .h files? They do not correspond with the system folder structure.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read current value of an OUTPUT gpio pin</title><link>https://devzone.nordicsemi.com/thread/449517?ContentTypeID=1</link><pubDate>Tue, 10 Oct 2023 10:27:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:240941d9-43bc-4bf2-8145-b7b459c9ba14</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Pedro,&lt;/p&gt;
&lt;p&gt;You should include it like this:&lt;/p&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;hal/nrf_gpio.h&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read current value of an OUTPUT gpio pin</title><link>https://devzone.nordicsemi.com/thread/449505?ContentTypeID=1</link><pubDate>Tue, 10 Oct 2023 09:52:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:842e4a52-1a0c-4a43-a143-5814415ce83f</guid><dc:creator>Pedro</dc:creator><description>&lt;p&gt;Ah, I see.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve found this function in&amp;nbsp;&lt;code&gt;C:\ncs\v2.0.2\modules\hal\nordic\nrfx\hal\nrf_gpio.h&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;But, how can I include it in my project?&lt;/p&gt;
&lt;p&gt;If I try&amp;nbsp;&lt;code&gt;&lt;span&gt;#include&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;lt;modules/hal/nordic/nrfx/hal/nrf_gpio.h&amp;gt; &lt;/span&gt;&lt;/code&gt;it does not find the file.&lt;/p&gt;
&lt;p&gt;I do not understand the include paths when using NCS. They do not correspond exactly with file system folder structure.&lt;/p&gt;
&lt;p&gt;Thanks again!&lt;/p&gt;
&lt;p&gt;Pedro.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read current value of an OUTPUT gpio pin</title><link>https://devzone.nordicsemi.com/thread/449474?ContentTypeID=1</link><pubDate>Tue, 10 Oct 2023 07:58:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d84744e4-58b1-4f68-acc6-cc449d0cdf43</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;It is a low-level function from nrfx that is&amp;nbsp;available regardless of which SDK you are using. It exist in NCS v2.0.2, and also in the latest v2.4.2.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read current value of an OUTPUT gpio pin</title><link>https://devzone.nordicsemi.com/thread/449454?ContentTypeID=1</link><pubDate>Tue, 10 Oct 2023 07:06:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8ff2e14-da8b-4c21-a4e1-665093451945</guid><dc:creator>Pedro</dc:creator><description>&lt;p&gt;But, how can I use&amp;nbsp;&lt;span&gt;&lt;code&gt;nrf_gpio_pin_out_read()&lt;/code&gt; with&amp;nbsp;NCS v2.0.2, with Zephyr? Isn&amp;#39;t it a function of the old Nordic SDK?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read current value of an OUTPUT gpio pin</title><link>https://devzone.nordicsemi.com/thread/449451?ContentTypeID=1</link><pubDate>Tue, 10 Oct 2023 07:04:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7c5c2a9-73a8-429f-b59e-b8a5cacdf6e0</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Pedro,&lt;/p&gt;
&lt;p&gt;You are right, &lt;code&gt;gpio_pin_get()&lt;/code&gt;&amp;nbsp;can only be used to read an input pin. That is why I suggested that you use&amp;nbsp;&lt;span&gt;&lt;code&gt;nrf_gpio_pin_out_read()&lt;/code&gt;&amp;nbsp;, which is for reading the state of an output pin &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read current value of an OUTPUT gpio pin</title><link>https://devzone.nordicsemi.com/thread/449287?ContentTypeID=1</link><pubDate>Mon, 09 Oct 2023 07:23:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bcb27720-5531-465b-8e70-54683b5f4621</guid><dc:creator>Pedro</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using NCS v2.0.2, with Zephyr, so I use&amp;nbsp;&lt;code&gt;gpio_pin_get()&lt;/code&gt;. The problem is when GPIO is configured as output, I can not use this function to read its current value.&lt;/p&gt;
&lt;p&gt;How can I do this?&lt;/p&gt;
&lt;p&gt;Thanks and kind regards,&lt;/p&gt;
&lt;p&gt;Pedro.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read current value of an OUTPUT gpio pin</title><link>https://devzone.nordicsemi.com/thread/449152?ContentTypeID=1</link><pubDate>Fri, 06 Oct 2023 11:23:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60574aaf-4ce6-4440-9b77-94085fda22eb</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can use&amp;nbsp;nrf_gpio_pin_out_read() to read&amp;nbsp;the&amp;nbsp;state of an output pin in the OUT register.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>