<?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>Random ~265uA extra current consuption when NRF52832 is in sleep mode.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/110377/random-265ua-extra-current-consuption-when-nrf52832-is-in-sleep-mode</link><description>Hello, we have a product that uses the NRF52832. We recently detected that the device will randomly increase its current consumption by about 260uA during sleep mode. Once this extra current consumption starts, we can only eliminate it with a soft reset</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 29 Apr 2024 20:30:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/110377/random-265ua-extra-current-consuption-when-nrf52832-is-in-sleep-mode" /><item><title>RE: Random ~265uA extra current consuption when NRF52832 is in sleep mode.</title><link>https://devzone.nordicsemi.com/thread/481179?ContentTypeID=1</link><pubDate>Mon, 29 Apr 2024 20:30:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f01c4bcf-045c-4eac-9c58-7b8b44633ec9</guid><dc:creator>Luis</dc:creator><description>&lt;p&gt;Hello All,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Just to add more information:&lt;br /&gt;&lt;br /&gt;Follow a minimal version that will bring the problem:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**
 * @file main.c
 */

#include &amp;lt;inttypes.h&amp;gt;
#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;quot;app_timer.h&amp;quot;
#include &amp;quot;nordic_common.h&amp;quot;
#include &amp;quot;nrf.h&amp;quot;
#include &amp;quot;nrf_ble_lesc.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;nrf_log_ctrl.h&amp;quot;
#include &amp;quot;nrf_log_default_backends.h&amp;quot;
#include &amp;quot;nrf_pwr_mgmt.h&amp;quot;
#include &amp;quot;nrf_sdh.h&amp;quot;
#include &amp;quot;nrf_drv_timer.h&amp;quot;
#include &amp;quot;bsp.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;

APP_TIMER_DEF(m_reset_timer_id);

static void reset_timer_handler(void *p_context) {
  sd_nvic_SystemReset();
}

/**
 * @brief Initialize all the required modules and the application layer.
 */
void setup(void)
{

    NRF_CLOCK-&amp;gt;LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal &amp;lt;&amp;lt; CLOCK_LFCLKSRC_SRC_Pos)|(CLOCK_LFCLKSRC_BYPASS_Enabled &amp;lt;&amp;lt; CLOCK_LFCLKSRC_BYPASS_Pos ) |
     (CLOCK_LFCLKSRC_EXTERNAL_Enabled &amp;lt;&amp;lt; CLOCK_LFCLKSRC_EXTERNAL_Pos);

    NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED = 0; 
    NRF_CLOCK-&amp;gt;TASKS_LFCLKSTART = 1;
    while(NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED == 0)
    {//do nothing
    }

    nrf_gpio_input_disconnect(BSP_DEF_VBAT_M_PIN);

    // FLASH_CS
    nrf_gpio_cfg_output(BSP_DEF_FLASH_CS_PIN);
    nrf_gpio_pin_write(BSP_DEF_FLASH_CS_PIN, 1);

    // ACCEL_INT
    nrf_gpio_cfg_input(BSP_DEF_ACCEL_INT_PIN, GPIO_PIN_CNF_PULL_Disabled);

    // ACCEL_CS
    nrf_gpio_cfg_output(BSP_DEF_ACCEL_CS_PIN);
    nrf_gpio_pin_write(BSP_DEF_ACCEL_CS_PIN, 1);

    // LED
    nrf_gpio_cfg_output(BSP_DEF_LED_RED_PIN);
    nrf_gpio_pin_write(BSP_DEF_LED_RED_PIN, 1);
        // LED
    nrf_gpio_cfg_output(BSP_DEF_LED_GREEN_PIN);
    nrf_gpio_pin_write(BSP_DEF_LED_GREEN_PIN, 1);
    
        // LED
    nrf_gpio_cfg_output(BSP_DEF_LED_BLUE_PIN);
    nrf_gpio_pin_write(BSP_DEF_LED_BLUE_PIN, 1);

    // VBAT_M_EN
    nrf_gpio_cfg_output(BSP_DEF_VBAT_M_EN_PIN);
    nrf_gpio_pin_write(BSP_DEF_VBAT_M_EN_PIN, 0);

    // BAT_CHARGED
    nrf_gpio_cfg_input(BSP_DEF_BAT_CHARGED_PIN, GPIO_PIN_CNF_PULL_Pullup);
    nrf_gpio_cfg_input(BSP_DEF_LSEN_INT_PIN, GPIO_PIN_CNF_PULL_Pullup);
    nrf_gpio_cfg_input(BSP_DEF_VAUX_MONITOR_PIN, GPIO_PIN_CNF_PULL_Pullup);
  
    uint32_t err_code = app_timer_init();
    APP_ERROR_CHECK(err_code);

    app_timer_create(&amp;amp;m_reset_timer_id,
                                  APP_TIMER_MODE_SINGLE_SHOT,
                                  reset_timer_handler);
    app_timer_start(m_reset_timer_id, APP_TIMER_TICKS(30000), NULL);
}

/**
 * @brief Main loop.
 */

int main(void)

{
    setup();
    while (1)
    {
        // Wait for an event.
        __WFE();
        // Clear the internal event register.
        __SEV();
        __WFE();
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The GPIOs configuration is specific from my board. The problem happens when you power cycle the board and wait a few reset cycles. When it happen it will go away most of the times with another reset so will star just for a few seconds.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Any idea of the cause of the problem? I am convinced that it is related of the use of the external clock with bypass.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Best&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random ~265uA extra current consuption when NRF52832 is in sleep mode.</title><link>https://devzone.nordicsemi.com/thread/479791?ContentTypeID=1</link><pubDate>Fri, 19 Apr 2024 22:02:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4c9e1da-0143-4bd0-bfa0-f76ed87a85b1</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;If using the softdevice have to go via the API to avoid a crash &amp;quot;&lt;em&gt;If a SoftDevice is running, the clock is managed by the SoftDevice and all requests are handled by the SoftDevice. This function cannot be called from all interrupt priority levels in that case&lt;/em&gt;&amp;quot;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random ~265uA extra current consuption when NRF52832 is in sleep mode.</title><link>https://devzone.nordicsemi.com/thread/479790?ContentTypeID=1</link><pubDate>Fri, 19 Apr 2024 21:52:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77961db4-86db-418d-ab38-479937942e90</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;Do you know that the HFCLK is used by UART, SPI, I2C ?&lt;/p&gt;
&lt;p&gt;Turn your SPI, I2C off as I showed you to see what would happen.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random ~265uA extra current consuption when NRF52832 is in sleep mode.</title><link>https://devzone.nordicsemi.com/thread/479786?ContentTypeID=1</link><pubDate>Fri, 19 Apr 2024 20:44:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97fa202a-6c00-4634-9f5f-e2acf73a4076</guid><dc:creator>Luis</dc:creator><description>&lt;p&gt;I tested stoping the HFCLK right before going to sleep mode but it crashes the software. I guess it is something I cannot do when using the SoftDevice.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random ~265uA extra current consuption when NRF52832 is in sleep mode.</title><link>https://devzone.nordicsemi.com/thread/479778?ContentTypeID=1</link><pubDate>Fri, 19 Apr 2024 16:52:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a173918-c50c-4618-bb8e-86a3c252d5e5</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Maybe use HFCLKSTAT to see if it running periodically; if not needed issue HFCLKSTOP. Unfortunately there is no STOPPED event, but it is possible to see if it unexpectedly started:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;Event:  CLOCK-&amp;gt;EVENTS_HFCLKSTARTED      0x4000&amp;#39;0100 = 1 (No Enable Field)       IntEnable 0x4000&amp;#39;0300=         0
Event:  CLOCK-&amp;gt;EVENTS_LFCLKSTARTED      0x4000&amp;#39;0104 = 1 (No Enable Field)       IntEnable 0x4000&amp;#39;0300=         0&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random ~265uA extra current consuption when NRF52832 is in sleep mode.</title><link>https://devzone.nordicsemi.com/thread/479777?ContentTypeID=1</link><pubDate>Fri, 19 Apr 2024 16:47:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5eba9efc-65ad-4aba-9baa-0e64fe4849b2</guid><dc:creator>Luis</dc:creator><description>&lt;p&gt;I did that. I checked all CNF, OUT, Pull Up/Down and the state of the pins with a scope. Everything as should be.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;From my tests it looks like the HFCLK is on during the idle mode even when BLE is not enabled. I am trying to understand what is going on.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random ~265uA extra current consuption when NRF52832 is in sleep mode.</title><link>https://devzone.nordicsemi.com/thread/479776?ContentTypeID=1</link><pubDate>Fri, 19 Apr 2024 16:44:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7d0c4fe-83f0-4456-b7b0-aeb1d2726126</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;13K @ 3.3V is about 254uA; 13k-ish happens to be the port io pull-up resistance. Worth scanning all the port CNF registers on wakeup to see if there is one unexpectedly set.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random ~265uA extra current consuption when NRF52832 is in sleep mode.</title><link>https://devzone.nordicsemi.com/thread/479770?ContentTypeID=1</link><pubDate>Fri, 19 Apr 2024 16:28:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba77cb2c-be01-4722-a8c2-81ea2fa4b328</guid><dc:creator>Luis</dc:creator><description>&lt;p&gt;Adding a bit more of information. I tested to add a standard timer to ran continuously and measured the current. The current goes up as expected as the timer is on during the sleep (idle) mode. However the extra 265uA never comes again, so it looks like that something is forcing the HFCLK to stay on during the sleep mode. Weirdly I do not directly use the HFCLK for nothing. Probably only the SoftDevice uses it for the BLE connection. Is there anyway to check what is making the HFCLK stay on. I tryed to look into all registers of the device but could not find anything.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random ~265uA extra current consuption when NRF52832 is in sleep mode.</title><link>https://devzone.nordicsemi.com/thread/479763?ContentTypeID=1</link><pubDate>Fri, 19 Apr 2024 15:07:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7fc7c4c9-038a-4ec4-99e0-e4380a0c8fac</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;This is how power off. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;// Undocumented Power down I2C. Nordic Bug with DMA causing high current consumption&lt;br /&gt;#ifdef TWIM_PRESENT&lt;br /&gt; *(volatile uint32_t *)((uint32_t)dev-&amp;gt;pDmaReg + 0xFFC);&lt;br /&gt; *(volatile uint32_t *)((uint32_t)dev-&amp;gt;pDmaReg + 0xFFC) = 1;&lt;br /&gt; *(volatile uint32_t *)((uint32_t)dev-&amp;gt;pDmaReg + 0xFFC) = 0;&lt;br /&gt;#else&lt;br /&gt; *(volatile uint32_t *)((uint32_t)dev-&amp;gt;pReg + 0xFFC);&lt;br /&gt; *(volatile uint32_t *)((uint32_t)dev-&amp;gt;pReg + 0xFFC) = 1;&lt;br /&gt; *(volatile uint32_t *)((uint32_t)dev-&amp;gt;pReg + 0xFFC) = 0;&lt;br /&gt;#endif&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random ~265uA extra current consuption when NRF52832 is in sleep mode.</title><link>https://devzone.nordicsemi.com/thread/479761?ContentTypeID=1</link><pubDate>Fri, 19 Apr 2024 14:58:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be1613c0-23a0-4460-aed1-91162b9df9ef</guid><dc:creator>Luis</dc:creator><description>&lt;p&gt;I was not powering off as it should not use a lot a power when not used. Anyway I did power off and on both and nothing. Also I checked all SPI and I2C level on the multimeter and they are as they are suposed to be.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random ~265uA extra current consuption when NRF52832 is in sleep mode.</title><link>https://devzone.nordicsemi.com/thread/479553?ContentTypeID=1</link><pubDate>Thu, 18 Apr 2024 21:00:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c57c5e3b-0a10-4fdb-94cb-6442fbed09f9</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;Do you power off the I2C &amp;amp; SPI ? Disable only may still consume power. &amp;nbsp;Gpio input with pull-up needs to disconnect as well.&lt;/p&gt;
&lt;p&gt;One of the test I usually do is to create a firmware that does nothing. &amp;nbsp;While a while(1) __WFE(); &amp;nbsp;and gradually checking for leaks. &amp;nbsp;Anything more than 1uA with that means hardware is leaking somewhere.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random ~265uA extra current consuption when NRF52832 is in sleep mode.</title><link>https://devzone.nordicsemi.com/thread/479549?ContentTypeID=1</link><pubDate>Thu, 18 Apr 2024 20:43:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:481a854e-7a46-44c1-b716-6d3a6b14168d</guid><dc:creator>Luis</dc:creator><description>&lt;p&gt;We do have a few and also use I2C and SPI. We checked the GPIO states and all of them are as they should be. The weird part is that the problem only exist during sleep mode, so the I2C or SPI pin would have to change state during the sleep. Also a 4.7K pullup would lead to more than 260uA of current.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random ~265uA extra current consuption when NRF52832 is in sleep mode.</title><link>https://devzone.nordicsemi.com/thread/479542?ContentTypeID=1</link><pubDate>Thu, 18 Apr 2024 20:04:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60c9eb8d-6d71-4154-97e5-7ceb80d077c3</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;Any gpio as input that has pull-up ? or i2c ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random ~265uA extra current consuption when NRF52832 is in sleep mode.</title><link>https://devzone.nordicsemi.com/thread/479541?ContentTypeID=1</link><pubDate>Thu, 18 Apr 2024 19:58:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de9ca07e-60ac-4c24-964b-0d958fc42c96</guid><dc:creator>Luis</dc:creator><description>&lt;p&gt;Hello Nguyen,&lt;br /&gt;&lt;br /&gt;Thank you for the reply. We are not using UART.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Any other ideas?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Random ~265uA extra current consuption when NRF52832 is in sleep mode.</title><link>https://devzone.nordicsemi.com/thread/479540?ContentTypeID=1</link><pubDate>Thu, 18 Apr 2024 19:36:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb0a7cd1-d2f6-42d7-bade-570d7ddac3f8</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;It&amp;#39;s looks like the UART is still on. &amp;nbsp;Are you using UART ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>