<?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 Slave enable/disable issue</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/90170/spi-slave-enable-disable-issue</link><description>Hi, 
 I&amp;#39;m working on final project wrapup on a device with an nRF5340 using NCS v1.7.1 where the Nordic part is an SPI slave to another processor. 
 My customer is getting my code running on his board for the first time and he&amp;#39;s seeing SPI init errors</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 22 Jul 2022 05:24:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/90170/spi-slave-enable-disable-issue" /><item><title>RE: SPI Slave enable/disable issue</title><link>https://devzone.nordicsemi.com/thread/378211?ContentTypeID=1</link><pubDate>Fri, 22 Jul 2022 05:24:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18d1d764-524a-4e91-ae97-a424c9338bff</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;The way&amp;nbsp; I see it is that powerwise both should be same.&amp;nbsp;&lt;span&gt;nrfx_spis_uninit will additionally disable the interrupt (on an already disabled peripheral, no power consequences) and will also uninitialize the driver. So next time you want to enable spi will need the driver to be re-initialized which has some power consequences (amount of cpu cycles taken to reinitialize the spis driver).&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI Slave enable/disable issue</title><link>https://devzone.nordicsemi.com/thread/378179?ContentTypeID=1</link><pubDate>Thu, 21 Jul 2022 17:31:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:385991b8-f0a1-4ab6-8b09-ca4a2ba0ac42</guid><dc:creator>Glen M</dc:creator><description>&lt;p&gt;AH - The main problem is that at the end of this project I reworked my .overlay file and I ended up with&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;status&lt;/span&gt;&lt;span&gt; = &lt;/span&gt;&lt;span&gt;&amp;quot;okay&amp;quot; for my SPI peripheral in the file. That sets up the peripheral to already be in the initialized state, so my init code was throwing the error.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;This solves my main question, but before we mark this solved I would still love a response to my last question in the above message: &amp;quot;Regarding power&amp;nbsp;consumption - are you saying that disabling it with&amp;nbsp;nrf_spis_disable is as good as fully uninitializing it with&amp;nbsp;nrfx_spis_uninit?&amp;quot;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Thanks!&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI Slave enable/disable issue</title><link>https://devzone.nordicsemi.com/thread/378167?ContentTypeID=1</link><pubDate>Thu, 21 Jul 2022 15:41:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4fca477-59c6-4a24-8fa9-83e6a06051e1</guid><dc:creator>Glen M</dc:creator><description>&lt;p&gt;The error code printed is&amp;nbsp;&lt;span&gt;195887109 (BAD005 in hex). My customer got back to me and said it&amp;#39;s not happening all the time - just occasionally.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I call the disable function just to make sure that it&amp;#39;s not enabled due to some edge case, because I believe trying to enable and already enabled peripheral causes a crash.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Regarding power&amp;nbsp;consumption - are you saying that disabling it with&amp;nbsp;nrf_spis_disable is as good as fully uninitializing it with&amp;nbsp;nrfx_spis_uninit?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI Slave enable/disable issue</title><link>https://devzone.nordicsemi.com/thread/378003?ContentTypeID=1</link><pubDate>Thu, 21 Jul 2022 07:28:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9699ee6d-d3b2-461f-85f7-0addbc8e9e46</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Glen,&lt;/p&gt;
&lt;p&gt;What kind of SPIS init errors are you and your customer are getting?&lt;/p&gt;
&lt;p&gt;I see that in your handler you first disable spis just before enabling it. Why do you have to disable an already disabled SPIS?&lt;/p&gt;
&lt;p&gt;I do not think that doing this in the interrupt handler is an issue as this seems quick and with no waiting logic.&lt;/p&gt;
[quote user=""]2)&amp;nbsp;How much (if any) power am I saving by using&amp;nbsp;nrfx_spis_init and nrfx_spis_uninit to fully enable and disable the peripheral every time vs just setting it up in my init code and using&amp;nbsp;nrf_spis_enable and nrf_spis_disable to turn it on and off? Would this code be more reliable if I just enabled/disabled vs initializing and uninitializing?[/quote]
&lt;p&gt;In the sleep state, disabling SPIS releases hfclk if no other peripheral are enabled that uses it. So the power save is considerable.&amp;nbsp;When the chip select is low I think the SPIS when not disable consumes about 1mA power.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>