<?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 close spi in low power state? (52840)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112450/how-to-close-spi-in-low-power-state-52840</link><description>Dear, I&amp;#39;m developing on nordic 52840 with ncs2.6.1. 
 I found that the Current will reach to 600+uA in k_sleep state by enable SPI in device_tree and if i disable the spi, the current will increase to 100uA. 
 I have try to enable CONFIG_PM_DEVICE(As</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 10 Apr 2025 14:01:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112450/how-to-close-spi-in-low-power-state-52840" /><item><title>RE: how to close spi in low power state? (52840)</title><link>https://devzone.nordicsemi.com/thread/531388?ContentTypeID=1</link><pubDate>Thu, 10 Apr 2025 14:01:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ab654a2-d159-4146-9b04-93e1545abac0</guid><dc:creator>boris bergman1</dc:creator><description>&lt;p&gt;Found the cause, the the cs-gpio pin had to be disabled. Now power consumption is 7uA with 5seconds ble advertising interval.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    NRF_P1-&amp;gt;PIN_CNF[12] =
        (GPIO_PIN_CNF_DIR_Input &amp;lt;&amp;lt; GPIO_PIN_CNF_DIR_Pos) |
        (GPIO_PIN_CNF_INPUT_Disconnect &amp;lt;&amp;lt; GPIO_PIN_CNF_INPUT_Pos) |
        (GPIO_PIN_CNF_PULL_Disabled &amp;lt;&amp;lt; GPIO_PIN_CNF_PULL_Pos) |
        (GPIO_PIN_CNF_DRIVE_S0S1 &amp;lt;&amp;lt; GPIO_PIN_CNF_DRIVE_Pos) |
        (GPIO_PIN_CNF_SENSE_Disabled &amp;lt;&amp;lt; GPIO_PIN_CNF_SENSE_Pos);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to close spi in low power state? (52840)</title><link>https://devzone.nordicsemi.com/thread/531233?ContentTypeID=1</link><pubDate>Wed, 09 Apr 2025 16:32:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04b826dc-6727-4187-ad69-8208e7eda184</guid><dc:creator>boris bergman1</dc:creator><description>&lt;p&gt;I have the same problem. When I configure spi2 on a xiao rev2 chip disabled, I get low power around 40uA, but enabled it is around 180uA. &lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;spi2 {    
	status = &amp;quot;okay&amp;quot;;
	cs-gpios = &amp;lt;&amp;amp;gpio1 12 GPIO_ACTIVE_LOW&amp;gt;;	
	
	gendev: gendev@0 {
		
		compatible = &amp;quot;vnd,spi-device&amp;quot;;
		reg = &amp;lt;0&amp;gt;;
		spi-max-frequency = &amp;lt;DT_FREQ_M(1)&amp;gt;;
		
		label = &amp;quot;GenDev&amp;quot;;
		status = &amp;quot;okay&amp;quot;;
	}; 
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;const struct spi_dt_spec spiDevice = SPI_DT_SPEC_GET(DT_NODELABEL(gendev), SPIOP, 0);

pm_device_action_run(spiDevice.bus, PM_DEVICE_ACTION_SUSPEND);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The above code returns 0, no error, but also no effect.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to close spi in low power state? (52840)</title><link>https://devzone.nordicsemi.com/thread/521210?ContentTypeID=1</link><pubDate>Tue, 04 Feb 2025 04:19:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a79f5187-7856-4be0-9298-97988146597a</guid><dc:creator>emilyjohnson63</dc:creator><description>&lt;p&gt;I think...&lt;/p&gt;
&lt;ul&gt;
&lt;li data-sourcepos="5:1-5:496"&gt;&lt;strong&gt;Double-Check Support:&lt;/strong&gt; While you suspect &lt;code&gt;CONFIG_PM_DEVICE&lt;/code&gt; isn&amp;#39;t fully supported on the nRF52840 in NCS 2.6.1, &lt;em&gt;absolutely confirm&lt;/em&gt; this. The Zephyr documentation might have been updated. Check the release notes and the &lt;code&gt;Kconfig&lt;/code&gt; files for your specific board/SoC. If it &lt;em&gt;is&lt;/em&gt; supported, make sure it&amp;#39;s correctly enabled and that the &lt;code&gt;spi1_dev&lt;/code&gt; you&amp;#39;re passing to &lt;code&gt;pm_device_action_run()&lt;/code&gt; is the &lt;em&gt;correct&lt;/em&gt; device structure for your SPI1 peripheral. Print its address or name to be certain.&lt;/li&gt;
&lt;li data-sourcepos="6:1-6:213"&gt;&lt;strong&gt;Timing:&lt;/strong&gt; Ensure &lt;code&gt;pm_device_action_run()&lt;/code&gt; is called &lt;em&gt;immediately&lt;/em&gt; before &lt;code&gt;k_sleep()&lt;/code&gt;. Any code execution between these calls could re-enable the SPI peripheral or prevent it from entering the suspended state.&lt;/li&gt;
&lt;li data-sourcepos="7:1-8:0"&gt;&lt;strong&gt;Return Value:&lt;/strong&gt; Check the return value of &lt;code&gt;pm_device_action_run()&lt;/code&gt;. A non-zero return indicates an error. Print the error code to understand why the suspend operation might be failing. &lt;a href="https://slope-online.org/"&gt;slope&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to close spi in low power state? (52840)</title><link>https://devzone.nordicsemi.com/thread/516250?ContentTypeID=1</link><pubDate>Wed, 25 Dec 2024 09:44:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53c59b3b-d79c-4daf-b84f-eaf6d0d2fad4</guid><dc:creator>Angela4</dc:creator><description>&lt;p&gt;You can use Low Power Modes:&lt;br /&gt;Here is a simple example that demonstrates closing the SPI and entering a low power state:&lt;/p&gt;
&lt;p&gt;#include &amp;quot;nrf_gpio.h&amp;quot;&lt;br /&gt;#include &amp;quot;nrf_spi.h&amp;quot;&lt;br /&gt;#include &amp;quot;nrf_power.h&amp;quot;&lt;/p&gt;
&lt;p&gt;void close_spi_low_power(void) {&lt;br /&gt; // Disable SPI&lt;br /&gt; NRF_SPI0-&amp;gt;ENABLE = SPI_ENABLE_ENABLE_Disabled &amp;lt;&amp;lt; SPI_ENABLE_ENABLE_Pos;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Edited by&amp;nbsp;&lt;/em&gt;&lt;a href="https://slopegameio.io"&gt;slope game&lt;/a&gt;&lt;em&gt;&amp;nbsp;1 day ago&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to close spi in low power state? (52840)</title><link>https://devzone.nordicsemi.com/thread/490574?ContentTypeID=1</link><pubDate>Tue, 25 Jun 2024 10:20:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c66c65b-2a66-4007-bfbc-cf4b07a60b27</guid><dc:creator>Marted</dc:creator><description>&lt;p&gt;In your application, before calling k_sleep(), explicitly disable the SPI interface using the spi_release() function.&lt;br /&gt;This will ensure that the SPI interface is not active and consuming power during the low-power state.&lt;br /&gt;Here&amp;#39;s an example of how you can do this:&lt;/p&gt;
&lt;p&gt;#include &amp;lt;device.h&amp;gt;&lt;br /&gt;#include &amp;lt;drivers/spi.h&amp;gt;&lt;/p&gt;
&lt;p&gt;void main(void)&lt;br /&gt;{&lt;br /&gt; const struct device *spi_dev = DEVICE_DT_GET(DT_NODELABEL(spi0));&lt;/p&gt;
&lt;p&gt;while (1) {&lt;br /&gt; /* Disable the SPI interface */&lt;br /&gt; spi_release(spi_dev);&lt;/p&gt;
&lt;p&gt;/* Enter low-power state */&lt;br /&gt; k_sleep(K_SECONDS(5));&lt;/p&gt;
&lt;p&gt;/* Re-enable the SPI interface when needed */&lt;br /&gt; // spi_configure(spi_dev, ...);&lt;br /&gt; // spi_transceive(spi_dev, ...);&lt;br /&gt; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Edited by &lt;a href="https://slope3.com"&gt;slope&lt;/a&gt; 1 day ago&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>