<?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>Increased idle current draw in nRF5340 when SPI4 chosen over SPI1</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/72564/increased-idle-current-draw-in-nrf5340-when-spi4-chosen-over-spi1</link><description>Platform: nRF5340-DK 
 Tools: I am using SDK 1.5.0 (but seen on earlier SDKs too) 
 Configuration: Using high speed spi pins whether for SPI1 or SPI4 
 
 If I use SPI1 I see around 40uA idle current draw when running my application 
 If I change to use</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 26 Mar 2021 13:42:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/72564/increased-idle-current-draw-in-nrf5340-when-spi4-chosen-over-spi1" /><item><title>RE: Increased idle current draw in nRF5340 when SPI4 chosen over SPI1</title><link>https://devzone.nordicsemi.com/thread/302147?ContentTypeID=1</link><pubDate>Fri, 26 Mar 2021 13:42:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c53e3c60-2746-4f10-afaf-069887c31b24</guid><dc:creator>helsing</dc:creator><description>&lt;p&gt;Thank you for the update. Let us know if this issue cause you any trouble as your project is progressing.&lt;/p&gt;
&lt;p&gt;Have a nice weekend.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increased idle current draw in nRF5340 when SPI4 chosen over SPI1</title><link>https://devzone.nordicsemi.com/thread/301661?ContentTypeID=1</link><pubDate>Wed, 24 Mar 2021 12:08:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d02285a2-3a22-40c3-96ed-7767e00ee623</guid><dc:creator>d_c_h_w</dc:creator><description>&lt;p&gt;I can confirm this works for my application. I am using the method with the ENABLE register directly. Also I see no additional latency either due to the enabling and disabling which is good. I will leave this in my code until there is a more formal fix.&lt;/p&gt;
&lt;p&gt;Thanks again for you help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increased idle current draw in nRF5340 when SPI4 chosen over SPI1</title><link>https://devzone.nordicsemi.com/thread/301642?ContentTypeID=1</link><pubDate>Wed, 24 Mar 2021 11:02:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad02f0da-2469-4d95-aa5a-53f24a1fefa2</guid><dc:creator>d_c_h_w</dc:creator><description>&lt;p&gt;Thank you for looking into this, I will try your initial&amp;nbsp;workaround and see if I can&amp;nbsp;see the same current drop as yourselves.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increased idle current draw in nRF5340 when SPI4 chosen over SPI1</title><link>https://devzone.nordicsemi.com/thread/301640?ContentTypeID=1</link><pubDate>Wed, 24 Mar 2021 10:48:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca3f25b3-a6cd-442b-a71e-8686d1b1be94</guid><dc:creator>helsing</dc:creator><description>&lt;p&gt;&lt;span style="font-size:inherit;"&gt;Below follows findings about this issue and a proposed temporary workaround. We can confirm different harwdware behaviour between SPI1 and SPI4, and our team is working on a proper workaround. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;First, for SPI1, current consumption should also be lower than 40uA. If you add &lt;code&gt;CONFIG_SERIAL=n&lt;/code&gt; to prj.conf, then idle should drop to around 3uA(measured in the blinky sample you posted).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;When it comes to SPI4, only disabling logging does not help as we are still seeing around 600uA. However, if we comment out &lt;code&gt;SPI_sendData&lt;/code&gt;, then the current consumption becomes normal. This shows us the current draw is related to SPI4 and TX.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;The following code demonstrates the increased current, and also how it could be minimized.&lt;/span&gt;&lt;/p&gt;
&lt;div style="font-family:Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, Courier, monospace;font-size:14px;font-style:normal;font-weight:400;letter-spacing:normal;text-indent:0;text-transform:none;white-space:pre;"&gt;
&lt;pre&gt;typedef struct ArrayList
{
    uint8_t buffer[100];
} ArrayList_type;

static ArrayList_type spi_tx[100];
static ArrayList_type * spi_tx_p = spi_tx;
static ArrayList_type spi_rx[100];
static ArrayList_type * spi_rx_p = spi_rx; 

void main(void)
{
    NRF_SPIM4-&amp;gt;PSEL.MOSI = 11;
    NRF_SPIM4-&amp;gt;PSEL.MISO = 12;
    NRF_SPIM4-&amp;gt;PSEL.SCK = 13;
    NRF_SPIM4-&amp;gt;RXD.PTR = (uint32_t)spi_rx_p;
    NRF_SPIM4-&amp;gt;RXD.MAXCNT = 100;
    NRF_SPIM4-&amp;gt;TXD.PTR = (uint32_t)spi_tx_p;
    NRF_SPIM4-&amp;gt;TXD.MAXCNT = 100;
    NRF_SPIM4-&amp;gt;ENABLE = 7;    
    
    while (1) {
        NRF_SPIM4-&amp;gt;ENABLE = 7;
        NRF_SPIM4-&amp;gt;TXD.PTR = (uint32_t)spi_tx_p;
        NRF_SPIM4-&amp;gt;TXD.MAXCNT = 100;
        NRF_SPIM4-&amp;gt;TASKS_START = 1;
        k_msleep(100);

        NRF_SPIM4-&amp;gt;TASKS_STOP = 1;
        NRF_SPIM4-&amp;gt;ENABLE = 0;
        k_msleep(500);
    }
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p lang="nb-NO"&gt;The code sets up an SPI transaction every 600ms. After it starts, it waits 100ms, then runs &lt;code&gt;ENABLE=0&lt;/code&gt;. This makes the device go back to a &amp;quot;normal&amp;quot; idle and it now draws 3uA.&lt;/p&gt;
&lt;p lang="nb-NO"&gt;If one remove &lt;code&gt;ENABLE=0&lt;/code&gt;, then the current draw stays at 700uA in idle(which it, of course, should not).&lt;/p&gt;
&lt;p lang="nb-NO"&gt;So, the temporary proposal is to disable SPI after the transaction. I could get back to you regarding the best way to do this in harmony with the driver. It might be either to use the &lt;code&gt;ENABLE&lt;/code&gt; register directly after the transaction, or perhaps, to use the driver&amp;#39;s uninit function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increased idle current draw in nRF5340 when SPI4 chosen over SPI1</title><link>https://devzone.nordicsemi.com/thread/301504?ContentTypeID=1</link><pubDate>Tue, 23 Mar 2021 15:32:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cea23bd6-d48a-4e7c-9117-ac24f35a1b62</guid><dc:creator>helsing</dc:creator><description>&lt;p&gt;We have reproduced the issue on two boards. We are working on some theories and will keep you updated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increased idle current draw in nRF5340 when SPI4 chosen over SPI1</title><link>https://devzone.nordicsemi.com/thread/301402?ContentTypeID=1</link><pubDate>Tue, 23 Mar 2021 11:28:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:571d429c-4df0-454e-b5c0-7177f0f5e95e</guid><dc:creator>helsing</dc:creator><description>&lt;p&gt;Hi Dominic, I will give you an update later today. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increased idle current draw in nRF5340 when SPI4 chosen over SPI1</title><link>https://devzone.nordicsemi.com/thread/301178?ContentTypeID=1</link><pubDate>Mon, 22 Mar 2021 11:56:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69448e27-2be1-4eac-8d8e-633e7f98a83d</guid><dc:creator>d_c_h_w</dc:creator><description>&lt;p&gt;Hi helsing, have you managed to take a look into this yet&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increased idle current draw in nRF5340 when SPI4 chosen over SPI1</title><link>https://devzone.nordicsemi.com/thread/299561?ContentTypeID=1</link><pubDate>Fri, 12 Mar 2021 19:59:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e4d643f-cd3d-48b8-b8e0-2efeb19d9315</guid><dc:creator>helsing</dc:creator><description>&lt;p&gt;Thank you very much for providing the code and detailed description. I am looking discussing this with the team and will get back to you next week.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increased idle current draw in nRF5340 when SPI4 chosen over SPI1</title><link>https://devzone.nordicsemi.com/thread/299104?ContentTypeID=1</link><pubDate>Wed, 10 Mar 2021 17:16:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26a910a4-ee89-43c6-bee5-5a6f4516d8c4</guid><dc:creator>d_c_h_w</dc:creator><description>&lt;p&gt;I have modified the simple binky sample on an nRF5340-DK using the 1.5.0 SDK version&lt;br /&gt;I erased the flash first so there is nothing running on the network core&lt;br /&gt;To trigger the extra idle current it just takes a single spi tx using SPI4 &lt;br /&gt;The&amp;nbsp;code&amp;nbsp;is set to use spi4 currently, to change back to spi1, 3 files need to be changed&lt;/p&gt;
&lt;p&gt;1) Change &amp;#39;&amp;amp;spi4&amp;#39; to &amp;#39;&amp;amp;spi1&amp;#39; in nrf5340dk_nrf5340_cpuapp.overlay&lt;br /&gt;2) Change &amp;#39;CONFIG_SPI_4=y&amp;#39; to &amp;#39;CONFIG_SPI_1=y&amp;#39; in prj.conf&lt;br /&gt;3) Change SPI_DEVICE_NAME so that it references spi1 instead of spi4 in main.c&lt;/p&gt;
&lt;p&gt;Sorry, I probably could have made this easier with a KConfig option.&lt;/p&gt;
&lt;p&gt;If switching SPI interfaces in an active project, as project files have changed you need to then do:&lt;br /&gt;Project-&amp;gt;Reload &amp;#39;blinky&amp;#39;&lt;br /&gt;Project-&amp;gt;Run Cmake&lt;br /&gt;Build-&amp;gt;Build and Run&lt;/p&gt;
&lt;p&gt;On this particular project, with SPI4 interface active I see 750uA idle, but only 126uA idle with SPI1&lt;/p&gt;
&lt;p&gt;Hope this helps you reproduce the issue&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/4846.blinky.zip"&gt;devzone.nordicsemi.com/.../4846.blinky.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increased idle current draw in nRF5340 when SPI4 chosen over SPI1</title><link>https://devzone.nordicsemi.com/thread/299085?ContentTypeID=1</link><pubDate>Wed, 10 Mar 2021 15:44:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ef7d713-e740-441f-a0f0-79c325d21924</guid><dc:creator>d_c_h_w</dc:creator><description>&lt;p&gt;Hi, no it is our own application, I don&amp;#39;t believe there any samples that use spi in the SDK.&lt;/p&gt;
&lt;p&gt;I will try and craft a simple example using one of the samples, as I don&amp;#39;t think you have to actually send any spi traffic to trigger the higher base load.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increased idle current draw in nRF5340 when SPI4 chosen over SPI1</title><link>https://devzone.nordicsemi.com/thread/299079?ContentTypeID=1</link><pubDate>Wed, 10 Mar 2021 15:34:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5eea2d14-24eb-47a8-a26f-8a48768c962f</guid><dc:creator>helsing</dc:creator><description>&lt;p&gt;Hi Dominic,&lt;/p&gt;
&lt;p&gt;I will be taking a look at this and check if anyone in our team has seen similar things.&lt;/p&gt;
&lt;p&gt;I will also try to reproduce the issue. Is your application based on a sample?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>