<?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 Read SPI MISO as a GPIO?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/126404/how-to-read-spi-miso-as-a-gpio</link><description>Using nRF5340-DK, nRF Connect for VS Code 2026.1, ncs v3.1.1 I&amp;#39;m interfacing over a SPI bus to a custom ASIC that uses MISO as a sort of RTS/CTS kind of idea. While CS is active the ASIC raises the MISO line asynchronously with SCLK to indicate it has</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 08 Jan 2026 14:54:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/126404/how-to-read-spi-miso-as-a-gpio" /><item><title>RE: How To Read SPI MISO as a GPIO?</title><link>https://devzone.nordicsemi.com/thread/558306?ContentTypeID=1</link><pubDate>Thu, 08 Jan 2026 14:54:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d739957-0bc9-4200-aa43-fac2137f18fc</guid><dc:creator>Dan Winker</dc:creator><description>&lt;p&gt;Ahh, I&amp;#39;d have to suspend the SPI if I want to use the GPIO to create an interrupt. That makes sense. (Yes, I was only thinking about polling it at this point).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How To Read SPI MISO as a GPIO?</title><link>https://devzone.nordicsemi.com/thread/558305?ContentTypeID=1</link><pubDate>Thu, 08 Jan 2026 14:52:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad20fa17-bb02-481d-8c7b-b3ba1e7e59cb</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I think it is fine. The difference would be that you would have to &amp;quot;manually&amp;quot; read/poll the pin to see which state it is in, while if you set it up as an interrupt pin (after suspending the SPI), you would get an interrupt, so you could put the device in sleep mode while waiting.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But it is definitely an option to just read it, wait for a while if it is not ready, and read it again, if that suits your application.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How To Read SPI MISO as a GPIO?</title><link>https://devzone.nordicsemi.com/thread/558214?ContentTypeID=1</link><pubDate>Wed, 07 Jan 2026 19:45:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fcbfc980-992e-4d0a-857a-cef9ed5378c8</guid><dc:creator>Dan Winker</dc:creator><description>&lt;p&gt;It seems to be working without suspending the spi4 device. I simply added the GPIO to my board&amp;#39;s .overlay file and access it as a GPIO in the middle of using it as a SPI line. I haven&amp;#39;t made my algorithm yet. But, my ASIC leaves the MISO line at whatever was last read so I can read a register with an even number in it and see that MISO as a GPIO is 0 then read a register that has an odd number in it and see that MISO as a GPIO is 1.&lt;/p&gt;
&lt;p&gt;Since it seems to work without doing much special I&amp;#39;d like to leave it at that and not do the&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;pm_device_action_run(spi0_dev, PM_DEVICE_ACTION_SUSPEND);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Do you know of&amp;nbsp;a lurking problem with not suspending the SPI device?&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s where I make a GPIO. I can read it with gpio_pin_get_dt().&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;aliases {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; spi = &amp;amp;spi4;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; spi-cs = &amp;amp;gpio1_11;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; spi-miso = &amp;amp;gpio1_14; // This GPIO pin is also assigned to spi4 as MISO&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;... &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt; };&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;pins {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; compatible = &amp;quot;gpio-keys&amp;quot;;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; gpio1_14: gpio1_14 {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; &amp;nbsp; gpios = &amp;lt;&amp;amp;gpio1 14 GPIO_ACTIVE_HIGH&amp;gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; &amp;nbsp; label = &amp;quot;SPI MISO as General Purpose Input&amp;quot;;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; };&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt; };&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I do get a squiggly line under the &amp;quot;14&amp;quot; that says &amp;quot;Pin 14 of &amp;amp;gpio1 already assigned to &amp;amp;spi4 &amp;bull; MISO&amp;quot;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How To Read SPI MISO as a GPIO?</title><link>https://devzone.nordicsemi.com/thread/558165?ContentTypeID=1</link><pubDate>Wed, 07 Jan 2026 13:37:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae6f3092-9236-495a-948c-1ef047c5af82</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;If you have tried setting up the pin as a GPIO before, it should be pretty straight forward. What you need to do is to suspend the SPI instance that you are using, then enable it as an input pin. After you have received the interrupt, disable it as an input pin, and re-enable the SPI instance.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Make sure that you have this in your prj.conf to be able to suspend peripherals:&lt;/p&gt;
&lt;p&gt;CONFIG_PM_DEVICE=y&lt;/p&gt;
&lt;p&gt;And then you can try something like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;zephyr/device.h&amp;gt;
#include &amp;lt;zephyr/pm/device.h&amp;gt;

/* Get the device binding for SPI0 */
const struct device *spi0_dev = DEVICE_DT_GET(DT_NODELABEL(spi0));

void suspend_spi0(void) {
    if (device_is_ready(spi0_dev)) {
        /* Put the peripheral into suspended state */
        int err = pm_device_action_run(spi0_dev, PM_DEVICE_ACTION_SUSPEND);
        if (err) {
            // Handle error
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then use a similar method to enable your input pin.&lt;/p&gt;
&lt;p&gt;To enable the SPI again, use:&lt;/p&gt;
&lt;p&gt;int err = pm_device_action_run(spi0_dev, PM_DEVICE_ACTION_RESUME);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>