<?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>Big current draw when sleeping, nRF9160 custom board with I2C EEPROM &amp;amp; SI7050, SPI ExternalFlash &amp;amp; LSM6DSL, uart0,uart1 using SES v1.6.1</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/78371/big-current-draw-when-sleeping-nrf9160-custom-board-with-i2c-eeprom-si7050-spi-externalflash-lsm6dsl-uart0-uart1-using-ses-v1-6-1</link><description>Basically, I implement code using uart0,uart1,ADC,I2C for EPROM and temperature chip, SPI for the external flash and lsm6dsl chip. 
 I use a Zephyr timer to keep a one second time base waking up the program for a main loop check if there is anything to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 02 Sep 2021 05:52:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/78371/big-current-draw-when-sleeping-nrf9160-custom-board-with-i2c-eeprom-si7050-spi-externalflash-lsm6dsl-uart0-uart1-using-ses-v1-6-1" /><item><title>RE: Big current draw when sleeping, nRF9160 custom board with I2C EEPROM &amp; SI7050, SPI ExternalFlash &amp; LSM6DSL, uart0,uart1 using SES v1.6.1</title><link>https://devzone.nordicsemi.com/thread/327693?ContentTypeID=1</link><pubDate>Thu, 02 Sep 2021 05:52:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0bd28b5d-2985-4498-86c6-7a4a634d4132</guid><dc:creator>DavidKaplan</dc:creator><description>&lt;p&gt;We verified that now we are getting a little over 29ua in our sleep state which is very good.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Big current draw when sleeping, nRF9160 custom board with I2C EEPROM &amp; SI7050, SPI ExternalFlash &amp; LSM6DSL, uart0,uart1 using SES v1.6.1</title><link>https://devzone.nordicsemi.com/thread/327685?ContentTypeID=1</link><pubDate>Thu, 02 Sep 2021 03:47:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55c1eaa3-b01a-4f48-8e78-1fb515cec021</guid><dc:creator>DavidKaplan</dc:creator><description>&lt;p&gt;I added&amp;nbsp;&lt;span&gt;NRF_UARTE0_NS-&amp;gt;PSEL.TXD = PIN_NUM_UART0_TXD; in&amp;nbsp;&lt;/span&gt;&lt;span&gt;ReInit() before enabling the uart and now I can reenable the uart and send debug information.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;  NRF_UARTE0_NS-&amp;gt;PSEL.TXD      = PIN_NUM_UART0_TXD;
  NRF_UARTE0_NS-&amp;gt;PSEL.RXD      = PIN_NUM_UART0_RXD; 
  NRF_UARTE0_NS-&amp;gt;ENABLE        = 8;
  NRF_UARTE0_NS-&amp;gt;TASKS_STARTRX = 1;
  NRF_UARTE0_NS-&amp;gt;TASKS_STARTTX = 1;
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I hope to have an inetegration session soon to recheck the current.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks David&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Big current draw when sleeping, nRF9160 custom board with I2C EEPROM &amp; SI7050, SPI ExternalFlash &amp; LSM6DSL, uart0,uart1 using SES v1.6.1</title><link>https://devzone.nordicsemi.com/thread/327631?ContentTypeID=1</link><pubDate>Wed, 01 Sep 2021 13:11:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18fc56aa-566f-4e64-8952-be7c597184ec</guid><dc:creator>DavidKaplan</dc:creator><description>&lt;p&gt;I also tried adding&amp;nbsp;&amp;nbsp;NRF_UARTE0_NS-&amp;gt;PSEL.TXD&amp;nbsp; &amp;nbsp; &amp;nbsp; = PIN_NUM_UART0_TXD; in&amp;nbsp;&lt;span&gt;ReInit()&amp;nbsp;but still none of my debug information&amp;nbsp;is sent after&amp;nbsp;the Deint() function.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Big current draw when sleeping, nRF9160 custom board with I2C EEPROM &amp; SI7050, SPI ExternalFlash &amp; LSM6DSL, uart0,uart1 using SES v1.6.1</title><link>https://devzone.nordicsemi.com/thread/327615?ContentTypeID=1</link><pubDate>Wed, 01 Sep 2021 12:33:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dab0a689-0d29-4bc6-b5d4-ec398e6e0e1c</guid><dc:creator>DavidKaplan</dc:creator><description>&lt;p&gt;Thanks for your response.&lt;/p&gt;
&lt;p&gt;This morning I changed the code which waits for&amp;nbsp;the semaphore which is given every second which there is nothing to do.&lt;/p&gt;
&lt;p&gt;Previously I had tried using&amp;nbsp;k_cpu_atomic_idle(key) from an example I saw on the forum.&lt;/p&gt;
&lt;p&gt;Now I just use&amp;nbsp;k_sem_take(&amp;amp;sec_wakeup_sem, K_FOREVER) again.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I had a session with our hardware guy in LasVegas after updating the code and he reports a very good current consumption of 31ua which spikes very second as expected. He will check the current with a more precise current meter at work.&lt;/p&gt;
&lt;p&gt;Now I used the direct uart disable and enable examples also found on the forum but after disabling uart0, enabling uart0 does not restore my printouts for debug information. I called&amp;nbsp;printk() with&amp;nbsp;CONFIG_PRINTK=y in one version and then calling&amp;nbsp;z_impl_k_str_out() directly with&amp;nbsp;&lt;span&gt;CONFIG_PRINTK=n with the same results - no printout after reenabling uart0.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void ami_uart_boot_DeInit(void)
{
#if defined(CONFIG_UART_INTERRUPT_DRIVEN)
  //---------------------------------------------------------------------------
  // Low power
  //  When putting the system in low power and the peripheral is not needed, 
  // lowest possible power consumption is achieved by stopping, and then disabling the peripheral.
  // The STOPTX and STOPRX tasks may not be always needed (the peripheral might already be stopped), 
  // but if STOPTX and/or STOPRX is sent, software shall wait until the TXSTOPPED and/or RXTO event is received in response,
  // before disabling the peripheral through the ENABLE register.
  //---------------------------------------------------------------------------
  NRF_UARTE0_NS-&amp;gt;TASKS_STOPRX=1;
  while(NRF_UARTE0_NS-&amp;gt;EVENTS_RXTO == 0);
  NRF_UARTE0_NS-&amp;gt;EVENTS_RXTO = 0;

  NRF_UARTE0_NS-&amp;gt;TASKS_STOPTX = 1;
  while(NRF_UARTE0_NS-&amp;gt;EVENTS_TXSTOPPED == 0);
  NRF_UARTE0_NS-&amp;gt;EVENTS_TXSTOPPED = 0;

  NRF_UARTE0_NS-&amp;gt;ENABLE = 0;
  NRF_UARTE0_NS-&amp;gt;PSEL.TXD = 0xFFFFFFFF;
  //---------------------------------------------------------------------------
  // Set BOOT Txd P0.1
  //---------------------------------------------------------------------------
  NRF_P0_NS-&amp;gt;OUTSET = (1 &amp;lt;&amp;lt; 1);
  //---------------------------------------------------------------------------
  // Set BOOT Rxd P0.0
  //---------------------------------------------------------------------------
  NRF_P0_NS-&amp;gt;OUTSET = (1 &amp;lt;&amp;lt; 0);
  //---------------------------------------------------------------------------
  // RXD is now an input change to an output high!
  //---------------------------------------------------------------------------
  ami_board_ConfigPin(AMI_BOARD_OUT_BOOT_RXD,GPIO_OUTPUT_HIGH);
#endif
  //---------------------------------------------------------------------------
  // Set Boot driver is NOT active
  //---------------------------------------------------------------------------
  bBootDriverActive   = FALSE;
  //---------------------------------------------------------------------------
  // Cancel staying awake because of Debug &amp;amp; Direct connect
  //---------------------------------------------------------------------------
  ami_main_CancelStayAwake(AQUA_MAIN_AWAKE_BOOT_DIRECT | AQUA_MAIN_AWAKE_DEBUG);
} // ami_uart_boot_DeInit

bool ami_uart_boot_ReInit(void)
{
#if defined(CONFIG_UART_INTERRUPT_DRIVEN)
  //---------------------------------------------------------------------------
  // RXD change back to an input
  //---------------------------------------------------------------------------
  ami_board_ConfigPin(AMI_BOARD_OUT_BOOT_RXD,GPIO_INPUT);
  NRF_UARTE0_NS-&amp;gt;ENABLE = 8;
  NRF_UARTE0_NS-&amp;gt;TASKS_STARTRX = 1;
  NRF_UARTE0_NS-&amp;gt;TASKS_STARTTX = 1;
  //---------------------------------------------------------------------------
  // Set Boot driver is active
  //---------------------------------------------------------------------------
  bBootDriverActive = TRUE;
  return TRUE;
} //ami_uart_boot_ReInit
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The debug serial channel stops working but the rest of the code seems to still work so there is no hard fault exception.&lt;/p&gt;
&lt;p&gt;Again the debug channel works until I can the Deint() function and then ReInit() when I need to send another string.&lt;/p&gt;
&lt;p&gt;What could be my problem?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Big current draw when sleeping, nRF9160 custom board with I2C EEPROM &amp; SI7050, SPI ExternalFlash &amp; LSM6DSL, uart0,uart1 using SES v1.6.1</title><link>https://devzone.nordicsemi.com/thread/327458?ContentTypeID=1</link><pubDate>Tue, 31 Aug 2021 14:55:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28cface5-b824-4ba6-9212-3ac4e8f56590</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;Hi David,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m taking over this case from Heidi.&lt;/p&gt;
&lt;p&gt;Can you please read out the GPIO registers using nrfjprog to see the state of the GPIOs. Something like this:&lt;/p&gt;
&lt;pre&gt;$ nrfjprog --family nrf91 --memrd 0x50842500 --n 0x28&lt;br /&gt;0x50842500: 00000000 00000000 00000000 00000000&amp;nbsp;&amp;nbsp; |................|&lt;br /&gt;0x50842510: 00000000 00000000 00000000 00000000&amp;nbsp;&amp;nbsp; |................|&lt;br /&gt;0x50842520: 00000000 00000000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |........|&lt;br /&gt;&lt;br /&gt;$ nrfjprog --family nrf91 --memrd 0x50842700 --n 128&lt;br /&gt;0x50842700: 00000002 00000002 00000002 00000002&amp;nbsp;&amp;nbsp; |................|&lt;br /&gt;0x50842710: 00000002 00000002 00000002 00000002&amp;nbsp;&amp;nbsp; |................|&lt;br /&gt;0x50842720: 00000002 00000002 00000002 00000002&amp;nbsp;&amp;nbsp; |................|&lt;br /&gt;0x50842730: 00000002 00000002 00000002 00000002&amp;nbsp;&amp;nbsp; |................|&lt;br /&gt;0x50842740: 00000002 00000002 00000002 00000002&amp;nbsp;&amp;nbsp; |................|&lt;br /&gt;0x50842750: 00000002 00000002 00000002 00000002&amp;nbsp;&amp;nbsp; |................|&lt;br /&gt;0x50842760: 00000002 00000002 00000002 00000002&amp;nbsp;&amp;nbsp; |................|&lt;br /&gt;0x50842770: 00000002 00000002 00000002 00000002&amp;nbsp;&amp;nbsp; |................|&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Also please post the board schematic. Then I can try to guide you on what state the GPIOs should be in when in idle.&lt;/p&gt;
&lt;p&gt;Are you able to post the complete project?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; When after using uart0, when sleeping I did not call the uart0 disable code, I got the 900ua baseline current.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; When after using uart0, when sleep I performed&amp;nbsp; the uart0 code above, I got a 480ua to 490ua draw.[/quote]
&lt;p&gt;&amp;nbsp;Based on this statement it sounds to me that the HF clock and all other peripherals that requires the HF clock to run are successfully shut down when you get to 490 uA. Since the HF clock consumes about 4-500 uA (which will add up to 900uA). This leads me to think that the remaining current is not due to any of the peripherals. I&amp;#39;m thinking that maybe there is a thread still running/polling something? Are you able to measure the power profile and see if you get any regular current spikes suggesting regular wake ups (in the 10-20 ms range)?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br /&gt;Stian&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Big current draw when sleeping, nRF9160 custom board with I2C EEPROM &amp; SI7050, SPI ExternalFlash &amp; LSM6DSL, uart0,uart1 using SES v1.6.1</title><link>https://devzone.nordicsemi.com/thread/327383?ContentTypeID=1</link><pubDate>Tue, 31 Aug 2021 10:44:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afa76187-a103-41c2-82c6-f1c780b17fa7</guid><dc:creator>DavidKaplan</dc:creator><description>&lt;p&gt;Anything new?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Big current draw when sleeping, nRF9160 custom board with I2C EEPROM &amp; SI7050, SPI ExternalFlash &amp; LSM6DSL, uart0,uart1 using SES v1.6.1</title><link>https://devzone.nordicsemi.com/thread/326544?ContentTypeID=1</link><pubDate>Wed, 25 Aug 2021 12:17:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90f64995-ce2c-43c3-b96b-cce7dbcce63e</guid><dc:creator>DavidKaplan</dc:creator><description>&lt;p&gt;Anything new?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Big current draw when sleeping, nRF9160 custom board with I2C EEPROM &amp; SI7050, SPI ExternalFlash &amp; LSM6DSL, uart0,uart1 using SES v1.6.1</title><link>https://devzone.nordicsemi.com/thread/325524?ContentTypeID=1</link><pubDate>Wed, 18 Aug 2021 13:11:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4f9267f-2cee-409a-9f86-5a6b22cdc740</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Hi! I&amp;#39;m looking into this. I&amp;#39;ll have an update for you shortly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Big current draw when sleeping, nRF9160 custom board with I2C EEPROM &amp; SI7050, SPI ExternalFlash &amp; LSM6DSL, uart0,uart1 using SES v1.6.1</title><link>https://devzone.nordicsemi.com/thread/324959?ContentTypeID=1</link><pubDate>Sun, 15 Aug 2021 06:45:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d66f59ab-ded0-4cff-8e6a-e4ead1cb95b2</guid><dc:creator>DavidKaplan</dc:creator><description>&lt;p&gt;Anyone can help with this whole thread?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Big current draw when sleeping, nRF9160 custom board with I2C EEPROM &amp; SI7050, SPI ExternalFlash &amp; LSM6DSL, uart0,uart1 using SES v1.6.1</title><link>https://devzone.nordicsemi.com/thread/324580?ContentTypeID=1</link><pubDate>Thu, 12 Aug 2021 06:07:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03c951b3-771e-4459-bdaf-b5ee672c92ba</guid><dc:creator>DavidKaplan</dc:creator><description>&lt;p&gt;This morning after disabling the SPI bus, I set the pins to output High and when I&amp;nbsp;switch to&amp;nbsp;PM_STATE_SOFT_OFF&amp;nbsp;the current drops from 100ua to 60ua. So when I do not switch&amp;nbsp;&lt;span&gt;PM_STATE_SOFT_OFF I still get more than 400ua, so something is still active in the module. What could be going on?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Do I need also to configure pins that are not connected? and if so what should they be confugured?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks David.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Big current draw when sleeping, nRF9160 custom board with I2C EEPROM &amp; SI7050, SPI ExternalFlash &amp; LSM6DSL, uart0,uart1 using SES v1.6.1</title><link>https://devzone.nordicsemi.com/thread/324354?ContentTypeID=1</link><pubDate>Wed, 11 Aug 2021 06:11:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b32f6d81-0b93-430c-9815-6468dd09414d</guid><dc:creator>DavidKaplan</dc:creator><description>&lt;p&gt;Yesterday in another integration session, I added code that would just shutdown the nRF9160 I think in order to see how much current the custom was drawing otherwise and to see what pins&amp;#39; state should be adjusted to reduce current when sleeping.&lt;/p&gt;
&lt;p&gt;The current went from 480ua..490ua to about 100ua. I can guess that something in the nRF9160 is still running that gives the 380ua different when the regulator is not shut off.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;//-----------------------------------------------------------------------------
// ami_main_Sleep
//  Description
//   Called to put the board to sleep till RTC one second wakeup
//  Parameters
//  Returns
//-----------------------------------------------------------------------------
void ami_main_Sleep(void)
{
  //-------------------------------------------------------------------------
  // Switch pins to sleep
  //-------------------------------------------------------------------------
  ami_board_AwakeSleepSwPins(true);
  //-------------------------------------------------------------------------
  // IRQ Lock to prevent race situation
  //-------------------------------------------------------------------------
  unsigned int key = irq_lock();
  //-------------------------------------------------------------------------
  // Wait for semaphore from ISR; if acquired, do related work, then
  //  go to next loop iteration (the semaphore might have been given again);
  //  else, make the CPU idle.
  //-------------------------------------------------------------------------
  if (k_sem_take(&amp;amp;sec_wakeup_sem, K_NO_WAIT) == 0) {
    //-----------------------------------------------------------------------
    // Ulock IRQ
    //-----------------------------------------------------------------------
    irq_unlock(key);
    //-----------------------------------------------------------------------
    // continue do processing 
    //-----------------------------------------------------------------------
  }else{
        //-------------------------------------------------------------------
        //
        //-------------------------------------------------------------------
 //       pm_low_power_devices();
        //-------------------------------------------------------------------
        // put CPU to sleep to save power 
        //-------------------------------------------------------------------
        k_cpu_atomic_idle(key);
  //      ?!?
        //-------------------------------------------------------------------
        // 
        //-------------------------------------------------------------------
 //       pm_resume_devices();
  }

//#define AMI_EXTRA_LOW_POWER
#ifdef AMI_EXTRA_LOW_POWER
  while (true){
    struct pm_state_info info;
    k_cpu_idle();
    info.state = PM_STATE_SOFT_OFF;
    pm_power_state_set(info);
  } // while                  
#endif                
  //-------------------------------------------------------------------------
  // Switch pins to awake state
  //-------------------------------------------------------------------------
  ami_board_AwakeSleepSwPins(false);
} // ami_main_Sleep
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The modem is off as I call lte_lc_deinit(); beforehand.&lt;/p&gt;
&lt;p&gt;I hope this helps...&lt;/p&gt;
&lt;p&gt;Any thoughts on what is still running. I did not exactly understand what defines are needed in interrupt mode for the uarts. I need to set a timer to each uart?&lt;/p&gt;
&lt;p&gt;Thanks David&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>