<?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>SPI CS pin input vs output inactive power consumption</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/110408/spi-cs-pin-input-vs-output-inactive-power-consumption</link><description>Hi, I was checking the HAL for SPI in master mode and notice that when pm_device_action_run(&amp;lt;spi_device&amp;gt;, PM_DEVICE_ACTION_SUSPEND); the CS pin isnt changed since it status change after every transmission to output inactive : https://github.com/nrfconnect</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 13 Feb 2026 09:06:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/110408/spi-cs-pin-input-vs-output-inactive-power-consumption" /><item><title>RE: SPI CS pin input vs output inactive power consumption</title><link>https://devzone.nordicsemi.com/thread/561083?ContentTypeID=1</link><pubDate>Fri, 13 Feb 2026 09:06:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6114dc24-f9c6-44b3-b86b-74b9012cc36a</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I don&amp;#39;t foresee any&amp;nbsp;problem with toggling&amp;nbsp;the CS pin state from the application as long as there are no SPI transactions taking place while&amp;nbsp;it is being controlled by the app. Normally when using the Zephyr driver you use Power Management suspend task to make the SPI NOR driver command the chip to enter deep power down mode, and similarly wake it up again on when the &amp;quot;resume&amp;quot; request is received. However, if you are powering it off, it seems lik you need to trigger the&amp;nbsp;PM_DEVICE_ACTION_TURN_ON to re-init the SPI flash after powering it on again:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/3c80c155dc70f1a3874f365c570c6fd2adce7e2e/drivers/flash/spi_nor.c#L1680"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/3c80c155dc70f1a3874f365c570c6fd2adce7e2e/drivers/flash/spi_nor.c#L1680&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;zephyr/drivers/spi.h&amp;gt;
#include &amp;lt;zephyr/drivers/gpio.h&amp;gt;
	...
	/* Get CS GPIO pin used for flash device */
	const struct gpio_dt_spec cs = SPI_CS_GPIOS_DT_SPEC_GET(DT_NODELABEL(mx25r64));
	
	/* Configure pin as input with input buffer disconnected after 
	 * powering off SPI flash.
 	 */
	int err = gpio_pin_configure_dt(&amp;amp;cs, GPIO_DISCONNECTED);
	if (err) {
	    printk(&amp;quot;gpio_pin_configure() failed. (err:%d)\n&amp;quot;, err);
	}
	&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI CS pin input vs output inactive power consumption</title><link>https://devzone.nordicsemi.com/thread/561069?ContentTypeID=1</link><pubDate>Fri, 13 Feb 2026 04:09:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6076323e-0978-431a-b29b-7edda3f4ce93</guid><dc:creator>Monkeytronics</dc:creator><description>&lt;p&gt;I arrived here because I am using a SPI Flash with active low CS. When the SOC goes to sleep, it sets the CS pin high. My problem is that I am controlling the power domain in which the Flash device sits so that the VCC rail is removed during sleep. Result is that the high on CS is going against the device datasheet requirements (should &amp;quot;track&amp;quot; the VCC during power up&amp;nbsp; / down). How can I either specify the sleep polarity of the CS pin, or directly access it as a GPIO and drive it myself?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI CS pin input vs output inactive power consumption</title><link>https://devzone.nordicsemi.com/thread/480327?ContentTypeID=1</link><pubDate>Wed, 24 Apr 2024 06:16:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4fb5b9c5-79ae-4984-ae05-7c60e3239031</guid><dc:creator>Vidar Berg</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/110408/spi-cs-pin-input-vs-output-inactive-power-consumption/480235"]Yes, I can&amp;#39;t think of any scenario where you would want to keep the SS pin configured as an output after you have uninitialized the driver.[/quote]
&lt;p&gt;After a bit further consideration, disconnecting the SS line may not&amp;nbsp;be a good idea in the typical scenarios where the SPI slave remains powered in a suspended state. I will update the ticket with the feedback I get from the developers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI CS pin input vs output inactive power consumption</title><link>https://devzone.nordicsemi.com/thread/480238?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 13:52:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9bb57d21-c089-4882-beb3-2b4954e8b92d</guid><dc:creator>Miguel Ferreira</dc:creator><description>&lt;p&gt;Cool! The NRFx SPIM driver already does this with the &lt;code&gt;ss_pin&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;when setting it to the default value. Thanks for the support, I will close the ticket for now and if you want I can also open a PR with this changes :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI CS pin input vs output inactive power consumption</title><link>https://devzone.nordicsemi.com/thread/480235?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 13:48:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3b74f94-9d20-43bf-add7-28800aa5e394</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;No problem! Yes, I can&amp;#39;t think of any scenario where you would want to keep the SS pin configured as an output after you have uninitialized the driver.&lt;/p&gt;
&lt;p&gt;I have added this as a feature request internally.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI CS pin input vs output inactive power consumption</title><link>https://devzone.nordicsemi.com/thread/480234?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 13:35:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed202e60-4f45-483b-8d9e-622d7e4de0f1</guid><dc:creator>Miguel Ferreira</dc:creator><description>&lt;p&gt;Hmm I see, thanks for pointing out! &lt;br /&gt;But will be a good practice on the uninit to set the SS pin as input for all situations ? &lt;br /&gt;Thanks again!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI CS pin input vs output inactive power consumption</title><link>https://devzone.nordicsemi.com/thread/480230?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 13:30:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40acf580-8740-4266-9c4f-84d585828c73</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I don&amp;#39;t know which SPI slave IC you are using, but the problem is likely that you are applying voltage on the SS input when the IC is powered off, see&amp;nbsp;&lt;a id="" href="https://www.reddit.com/r/ElectricalEngineering/comments/9fpq4i/what_does_backpowering_a_microprocessor_mean/"&gt;https://www.reddit.com/r/ElectricalEngineering/comments/9fpq4i/what_does_backpowering_a_microprocessor_mean/&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I will create a ticket in our internal bug tracker and request that we make the driver configure the SS pin as &amp;#39;input,disconnect&amp;#39; on uninit.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI CS pin input vs output inactive power consumption</title><link>https://devzone.nordicsemi.com/thread/480224?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 13:23:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ad70085-f745-472e-8aa4-da28ca857968</guid><dc:creator>Miguel Ferreira</dc:creator><description>&lt;p&gt;Do you know why this is happening ? What Im currently doing is basically setting as input after suspending the SPIM and it does the job.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI CS pin input vs output inactive power consumption</title><link>https://devzone.nordicsemi.com/thread/480222?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 13:15:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:441dfa61-7489-4ab2-8e09-4dd94e9b905b</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I see. This means that when in the suspended state, the SPI slave IC will be powered by your SS output, hence the additional 7mA idle current. The driver assumes that the IC will remain powered in the suspended state. Since this is not the case for you, you will need to patch the driver to disconnect the SS pin.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI CS pin input vs output inactive power consumption</title><link>https://devzone.nordicsemi.com/thread/480218?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 13:05:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21cfd8e5-bb61-4195-bc4c-0edf680ab923</guid><dc:creator>Miguel Ferreira</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Yes Im cutting the power from the SPI slave IC and after that putting the SPIM in suspend.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI CS pin input vs output inactive power consumption</title><link>https://devzone.nordicsemi.com/thread/480199?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 12:13:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86169685-15f0-4b90-b5d6-0406d081a584</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;pinctrl only controls pins assigned to peripherals such as MOSI and MISO for SPIM, while SS is controlled as a regular GPIO by the driver. Are you&amp;nbsp;cutting the power&amp;nbsp;to your SPI slave IC in the suspended state? 7 mA suggests that the SS output might be back-powering&amp;nbsp;your SPI sensor.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI CS pin input vs output inactive power consumption</title><link>https://devzone.nordicsemi.com/thread/479954?ContentTypeID=1</link><pubDate>Mon, 22 Apr 2024 10:53:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ac0c6db-a292-469b-b424-0f515035390f</guid><dc:creator>Miguel Ferreira</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/110408/spi-cs-pin-input-vs-output-inactive-power-consumption/479897"]SPI[/quote]
&lt;p&gt;Hi again,&lt;br /&gt;&lt;br /&gt;Used the PPK and the difference is quite big.&amp;nbsp; With the CS pin being controlled by the pinctrl, basically without manually changing the CS pin to input after pm_device_action_run(&amp;lt;spi_dev&amp;gt; PM_DEVICE_ACTION_SUSPEND);&amp;nbsp;&lt;br /&gt; In suspend mode it consumes 7mA.&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1713783040562v1.png" alt=" " /&gt;&lt;br /&gt;&lt;br /&gt;With the CS pin being set as input after a pm_device_action_run(&amp;lt;spi_dev&amp;gt; PM_DEVICE_ACTION_SUSPEND). It consumed almost 1 mA.&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1713783199100v2.png" alt=" " /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI CS pin input vs output inactive power consumption</title><link>https://devzone.nordicsemi.com/thread/479897?ContentTypeID=1</link><pubDate>Mon, 22 Apr 2024 08:42:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d0032ab-0dce-42ef-992a-7b84a61c6dc0</guid><dc:creator>Vidar Berg</dc:creator><description>[quote user="Miguel Ferreira"]So Im kind confused what approach should be the best one to achieve a low power consumption.[/quote]
&lt;p&gt;This should be measured on your setup. Disconnecting the SS pin on the nRF may lead to a floating input on your SPI flash sensor.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI CS pin input vs output inactive power consumption</title><link>https://devzone.nordicsemi.com/thread/479882?ContentTypeID=1</link><pubDate>Mon, 22 Apr 2024 08:01:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a42a23ac-ef10-4561-b222-a777434ec957</guid><dc:creator>Miguel Ferreira</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;Thanks for the reply. I understand that the SS pin is controlled by pintctrl or as a normal GPIO (like I mentioned in the question and added the sourced code where this is done). But my question is why the SPIM driver puts the SS pin as input while the pinctrl puts it as output inactive. Also, I believe a GPIO pin set as input will consume less energy compared to GPIO set as output low ? &lt;br /&gt;From the dataseeht there is also this info:&lt;br /&gt;&lt;em&gt;The input buffer of a GPIO pin can be disconnected from the pin to enable power savings when the pin is&lt;/em&gt;&lt;br /&gt;&lt;em&gt;not used as an input&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/em&gt;So Im kind confused what approach should be the best one to achieve a low power consumption.&lt;em&gt;&lt;br /&gt;&lt;br /&gt;Thank you!&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI CS pin input vs output inactive power consumption</title><link>https://devzone.nordicsemi.com/thread/479867?ContentTypeID=1</link><pubDate>Mon, 22 Apr 2024 07:40:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6450b40-e851-49ed-857c-85ad96e344d5</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The SS pin is controlled as a regular GPIO by the driver, not by the SPIM peripheral itself like MISO, MOSI, and CLK. Therefore, it is not the responsibility of the pinctrl module to configure this pin. The driver should probably have reconfigured this pin to its reset state to match the behavior when pinctrl is not enabled.&lt;/p&gt;
[quote user=""]My question is what is the difference between both, how setting the pin as input differ as setting the pin as ouput inactive.[/quote]
&lt;p&gt;&lt;span style="text-decoration:line-through;"&gt;Output inactive corresponds to an active low output, i.e., the SS signal will be driven low.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;But why do you need to suspend the SPIM peripheral? Are you experiencing high sleep currents between SPIM transactions?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;
&lt;p&gt;Edit: The chip select signal is almost always active low, which means the pin will be driven high when set to inactive. Whether this will lead to any additional current consumption or not depends on the SS input on your SPI slave sensor.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>