<?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>Unexpected consumption using System OFF Sample &amp;amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/106874/unexpected-consumption-using-system-off-sample-nrf52840dk</link><description>Greetings, 
 
 I have been measuring the current consumption of our custom FW in our custom board using PPK2 and found some unexpected spikes in the current consumption curve. 
 I decided to look deeper into this so programmed our custom FW to the nRF52840</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 23 Jan 2024 10:45:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/106874/unexpected-consumption-using-system-off-sample-nrf52840dk" /><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/465523?ContentTypeID=1</link><pubDate>Tue, 23 Jan 2024 10:45:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1db265f6-7370-4e1f-8d77-299214018a00</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I suggest changing the UART1 status to &amp;#39;disabled&amp;#39; in your custom board files,&amp;nbsp;removing&amp;nbsp;the need to create overlays for your project. Same as we did for the nrf52840dk_nrf52840 board in more recent SDK releases.&lt;/p&gt;
&lt;p&gt;It is possible to apply named overlays to child images as well by passing CMake symbols to the build. E.g.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/*Build MCUboot with disable_uart1.overlay */
-Dmcuboot_DTC_OVERLAY_FILE=disable_uart1.overlay&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/config_and_build/multi_image.html#image-specific-variables"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/config_and_build/multi_image.html#image-specific-variables&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/465508?ContentTypeID=1</link><pubDate>Tue, 23 Jan 2024 09:41:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0cd8f0ee-c5ad-44b7-89b6-da92964166b6</guid><dc:creator>clockis</dc:creator><description>&lt;p&gt;Indeed, the uart1 was enabled for the MCUBoot, so using an overlay file I disabled it ( also made sure by checking&amp;nbsp;&lt;span&gt;/build/mcuboot/zephyr/zephyr.dts.)!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you very much for your support in tracking down this unexpected source of consumption it was crucial for my application!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;One last a bit trivial question:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I am using an overlay file to disable the uart1, which is setup in my application directory under child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay. Is it possible to use an overlay file with a more generic name so I can apply it to all my custom boards for example mcuboot.overlay, similar to the child_image/mcuboot.conf overlay I am using for the configuration options of the MCUBoot?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/465486?ContentTypeID=1</link><pubDate>Tue, 23 Jan 2024 07:49:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a5a79c2-d552-45c2-bf55-afbf982ef98d</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Did you ensure that UART1 is also disabled in the device tree&amp;nbsp;used to build&amp;nbsp;the bootloader? You can check&amp;nbsp;whether it is enabled or disabled in /build/mcuboot/zephyr/zephyr.dts.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/465400?ContentTypeID=1</link><pubDate>Mon, 22 Jan 2024 15:34:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26c07380-2082-481a-95c2-b8499ce5529e</guid><dc:creator>clockis</dc:creator><description>&lt;p&gt;So after a lot of testing and different trial and error tests, I found that the culprit was the Serial of the MCUBoot that was enabled and when disabled in the mcuboot.conf overlay file I have in my application (child_image/mcuboot.conf). After I added the CONFIG_MCUBOOT_UART=n &amp;amp; CONFIG_SERIAL=n the consumption fell to the expected numbers I was seeing in the samples when the UART was properly disabled.&lt;/p&gt;
&lt;p&gt;So now my main question is:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Is there a way to be able to have Serial recovery with the MCUBoot but be able to have the serial properly disabled when the application is loaded? Could I disable the UART (UART pin config) manually during the initialization of my application?&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/465385?ContentTypeID=1</link><pubDate>Mon, 22 Jan 2024 15:02:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18e2200b-5780-4b27-9d17-d66e2c542d22</guid><dc:creator>clockis</dc:creator><description>&lt;p&gt;Apparently disabling the MCUMgr fixes the issue, but the thing is I need the MCUMgr for DFU(I am guessing it implicitly enables something the increases the consumption maybe it is the UART) so is there a way (configuration option for example) to disable this increased consumption without disabling the whole MCUMgr (UART for the MCMgr is already disabled CONFIG_MCUMGR_SMP_UART=n) ?&lt;/p&gt;
&lt;p&gt;I am still investigating this on my own so I might be able to figure it out but I would still appreciate any hints or tips on this issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/465343?ContentTypeID=1</link><pubDate>Mon, 22 Jan 2024 13:43:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9c16154-ed1e-4f95-9081-6ec05320e327</guid><dc:creator>clockis</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Thank you for your response, I took your consideration into account.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/106874/unexpected-consumption-using-system-off-sample-nrf52840dk/465131"]You also mention having some sensors, are they included in the measurement or powered separately?[/quote]
&lt;p&gt;Sorry for misleading in my previous message, what I meant was I don&amp;#39;t have any peripherals or sensors connected to the I2C bus of the DK, actually, I do not have anything connected to the DK (apart from the PPK2 for the measurement).&lt;/p&gt;
&lt;p&gt;In our custom FW, I have disabled all sensors and I2C transactions except for one I2C peripheral that is not connected which tries and fails to communicate with it. Besides this and the initialization of the BLE stack and advertising, there are no other processes running after this. I have checked the execution flow with the debugger and after the initialization of the BLE stack and advertisement no thread is running.&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/106874/unexpected-consumption-using-system-off-sample-nrf52840dk/465131"]Have you tried to not enabling these sensors?[/quote]
&lt;p&gt;I have also tried commenting out any other piece of code in the initialization of our custom FW leaving only the BLE stack initialization and BLE advertisement start.&lt;/p&gt;
&lt;p&gt;The results are the same and the increased consumption is still present.&lt;/p&gt;
&lt;p&gt;Could you please take a look at the configuration options of our application to check whether something on here can cause this increased consumption.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;prj.conf&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;pre class="ui-code" data-mode="text"&gt;################################################################################
## Zephyr Configuration

#########################################################
# Libraries &amp;amp; Peripherals configuration

# Enable the UART driver
CONFIG_UART_ASYNC_API=n
CONFIG_NRFX_UARTE0=n

# Enable the GPIO module
CONFIG_GPIO=y

# Enable the I2C module
CONFIG_I2C=y
CONFIG_I2C_NRFX=y
CONFIG_CBPRINTF_FP_SUPPORT=y

# Make sure printk is printing to the RTT console
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n
CONFIG_RTT_CONSOLE=y

# Enable the SPI module
CONFIG_SPI=y
CONFIG_SPI_NRFX=y

# Enable the Date/Time library
CONFIG_DATE_TIME=y
# CONFIG_DATE_TIME_UPDATE_INTERVAL_SECONDS=2147483647
# CONFIG_DATE_TIME_TOO_OLD_SECONDS=10 
# CONFIG_DATE_TIME_MODEM=n
CONFIG_DATE_TIME_NTP=n
CONFIG_DATE_TIME_LOG_LEVEL_DBG=n
# CONFIG_DATE_TIME_LOG_LEVEL_WRN=y

# Enable the Reboot functionality
CONFIG_REBOOT=y

# Enable the HW Information module
CONFIG_HWINFO=y

#########################################################
# System Stack Sizes configuration

# Increased the stack for the MCUmgr &amp;amp; History Module
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=5096
# CONFIG_MPSL_WORK_STACK_SIZE=2048
# CONFIG_SHELL_STACK_SIZE=2048
# CONFIG_IDLE_STACK_SIZE=2048
# CONFIG_MAIN_STACK_SIZE=4096
# CONFIG_ISR_STACK_SIZE=4096
# CONFIG_PRIVILEGED_STACK_SIZE=2048
# CONFIG_BT_LONG_WQ_STACK_SIZE=2048

# Configure the HEAP Memory Size
CONFIG_HEAP_MEM_POOL_SIZE=4096

# CONFIG_TIMESLICING=n

#########################################################
# Power Management configuration

# Enable Power Management
CONFIG_PM=y

# Enable to use the System OFF State
CONFIG_PM_DEVICE=y

#########################################################
# Flash File System configuration
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y
CONFIG_FS_LOG_LEVEL_INF=y
CONFIG_NVS_LOG_LEVEL_WRN=y

# SPI NOR configuration
# CONFIG_SPI_NOR=y
# CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096

# Partition Manager Setttings
# CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=n

#########################################################
# Task Watchdog configuration
CONFIG_WATCHDOG=y
CONFIG_WDT_LOG_LEVEL_WRN=y
CONFIG_WDT_DISABLE_AT_BOOT=y
CONFIG_TASK_WDT=y
CONFIG_TASK_WDT_CHANNELS=15
CONFIG_TASK_WDT_HW_FALLBACK=n
# CONFIG_TASK_WDT_MIN_TIMEOUT=1000
# CONFIG_TASK_WDT_HW_FALLBACK_DELAY=1000


#########################################################
# BLE stack configuration
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME=&amp;quot;Nordic_UART_Service&amp;quot;
CONFIG_BT_DEVICE_APPEARANCE=833
CONFIG_BT_MAX_CONN=1
CONFIG_BT_MAX_PAIRED=1
CONFIG_BT_DEVICE_NAME_DYNAMIC=y

# Thread Stack Sizes
# CONFIG_BT_LONG_WQ=y
# CONFIG_BT_LONG_WQ_STACK_SIZE=2048

# Enable Logging for the BLE stack
# CONFIG_BT_LOG_LEVEL_DBG=y
# CONFIG_BT_NUS_LOG_LEVEL_DBG=y
# CONFIG_BT_CONN_CTX=y
# CONFIG_BT_CONN_CTX_LOG_LEVEL_DBG=y

# CONFIG_BT_CONN_TX_MAX=100
# CONFIG_BT_L2CAP_TX_BUF_COUNT=100
CONFIG_BT_BUF_ACL_TX_COUNT=50

CONFIG_BT_L2CAP_TX_MTU=247
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251

# CONFIG_BT_L2CAP_TX_MTU=252
# CONFIG_BT_BUF_ACL_TX_SIZE=256
# CONFIG_BT_BUF_ACL_RX_SIZE=256

# CONFIG_BT_L2CAP_TX_MTU=498
# CONFIG_BT_BUF_ACL_RX_SIZE=502
# CONFIG_BT_BUF_ACL_TX_SIZE=502

# CONFIG_BT_PRIVACY=y #DO NOT ENABLE THIS BECAUSE DFU WILL NOT WORK 

# This does the same job as manual update_connection_parameters() function
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
# CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS=y
# CONFIG_BT_PERIPHERAL_PREF_MIN_INT=15
# CONFIG_BT_PERIPHERAL_PREF_MAX_INT=15
# CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400


# CONFIG_BT_LOG_SNIFFER_INFO=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CONN_PARAM_UPDATE_TIMEOUT=300
CONFIG_BT_USER_PHY_UPDATE=y
CONFIG_BT_GATT_CLIENT=y
# CONFIG_BT_GATT_AUTO_UPDATE_MTU=y # Use the manual update for better throughput
CONFIG_BT_USER_DATA_LEN_UPDATE=y

# CONFIG_BT_HCI_ACL_FLOW_CONTROL=y

# Enable the NUS service
CONFIG_BT_NUS=y
# CONFIG_BT_NUS_LOG_LEVEL_DBG=y

# Enable for proper BLE operation
CONFIG_BT_SETTINGS=y
CONFIG_NVS=y
CONFIG_SETTINGS=y

# Enable pairing with static passkey &amp;amp; bonding
# CONFIG_BT_NUS_SECURITY_ENABLED=y
# CONFIG_BT_NUS_AUTHEN=y
# CONFIG_BT_SMP=y
# CONFIG_BT_SMP_SC_ONLY=y
# CONFIG_BT_FIXED_PASSKEY=y
# CONFIG_BT_BONDABLE=y
# CONFIG_BT_TINYCRYPT_ECC=y


#########################################################
# MCU Manager for DFU functionality configuration

# Enable mcumgr.
CONFIG_MCUMGR=y

# Enable most core commands.
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y
# CONFIG_MCUMGR_CMD_STAT_MGMT=y

# Ensure an MCUboot-compatible binary is generated.
# NSIB as immutable first-stage &amp;amp; MCUBoot as Upgradable
# CONFIG_SECURE_BOOT=y
# CONFIG_SB_SIGNING_KEY_FILE=&amp;quot;C:/ncs/feel_v2_fw/feel_v2_fw/child_image/keys/feel_sign_priv.pem&amp;quot;
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUBOOT_IMAGE_VERSION=&amp;quot;0.18.0+1&amp;quot;

# Enable the serial mcumgr transport.
CONFIG_MCUMGR_SMP_UART=n
# Enable USB subsystem
# CONFIG_USB_DEVICE_STACK=y
CONFIG_SERIAL=n
# CONFIG_UART_LINE_CTRL=n

# Enable the Bluetooth (unauthenticated) and shell mcumgr transports.
CONFIG_MCUMGR_SMP_BT=y
CONFIG_MCUMGR_SMP_BT_AUTHEN=n
# CONFIG_MCUMGR_SMP_BT_CONN_PARAM_CONTROL=y

# # Required by the `taskstat` command.
# CONFIG_THREAD_MONITOR=y

# # Enable statistics and statistic names.
# CONFIG_STATS=y
# CONFIG_STATS_NAMES=y

#########################################################
# Logger configuration
CONFIG_LOG=n
# CONFIG_USE_SEGGER_RTT=y
# CONFIG_LOG_BACKEND_RTT=y
# CONFIG_LOG_BACKEND_UART=n

# Increase if logging thread is at its limit
CONFIG_LOG_BUFFER_SIZE=8192
CONFIG_LOG_PROCESS_THREAD=y
CONFIG_LOG_SPEED=y
CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=4096

# CONFIG_LOG_PRINTK=y

# For debugging watchdog resets please use the IMMEDIATE mode (only)
# all other times use the DEFERED (default) mode by commenting out this option
# CONFIG_LOG_MODE_IMMEDIATE=y

CONFIG_ASSERT=n
#########################################################
# Thread Analyzer configuration
# CONFIG_THREAD_ANALYZER=y
# CONFIG_THREAD_ANALYZER_AUTO=y
# CONFIG_THREAD_ANALYZER_AUTO_INTERVAL=5
# CONFIG_THREAD_ANALYZER_USE_LOG=y
CONFIG_THREAD_NAME=y&lt;/pre&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Essentially&amp;nbsp;&lt;strong&gt;&lt;/strong&gt;I have enabled the I2C, SPI, Watchdog, Reboot, HW info, Date/Time, PM, PM Device, LittleFS for the internal flash, BLE, NUS &amp;amp; MCUMgr.&lt;/p&gt;
&lt;p&gt;Could some of this be the cause for this increased consumption?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;To sum up, I have disabled all initialization code except for the BLE init &amp;amp; advertise, have checked that nothing else is being executed after this, have the CONFIG_SERIAL=n disabled, and have checked that the output (.conf ) file has it disabled correctly and I still get the increased consumption with the same exact current curve between advertising events as I had in the beacon sample before disabling the UART correctly.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;So I am assuming since I have no other devices connected to the DK it could be a floating input?&lt;/p&gt;
&lt;p&gt;Thank you and I look forward to hearing from you!&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Stavros&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/465131?ContentTypeID=1</link><pubDate>Fri, 19 Jan 2024 17:44:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e88131d-f783-4da3-b3db-d6a8b272c232</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Stavros,&lt;/p&gt;
[quote userid="113452" url="~/f/nordic-q-a/106874/unexpected-consumption-using-system-off-sample-nrf52840dk/465115"]I do not. But it has exactly the same current curve and current levels that I see with the samples (UART enabled)[/quote]
&lt;p&gt;This suggests that the UART is not the culprit. There are several things that have a similar power profile to the UART. You also mention having some sensors, are they included in the measurement or powered separately?&lt;/p&gt;
[quote userid="113452" url="~/f/nordic-q-a/106874/unexpected-consumption-using-system-off-sample-nrf52840dk/465115"]Could it be some other peripheral that is enabled, like SPI or I2C? Any input or hint is very helpful on this, or how I could go about debugging this.[/quote]
&lt;p&gt;Likely not from I2C or SPI peripherals themselves, but it could be floating inputs or current drawn from the devices connected to these buses. Have you tried to not enabling these sensors?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/465115?ContentTypeID=1</link><pubDate>Fri, 19 Jan 2024 16:22:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f6b4bb6f-5502-49ec-8134-06f470cc4e54</guid><dc:creator>clockis</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/106874/unexpected-consumption-using-system-off-sample-nrf52840dk/465070"]To be sure the ~500 uA is from the UART, do you get the expected idle current if you build with CONFIG_SERIAL=n[/quote]
&lt;p&gt;I do not. But it has exactly the same current curve and current levels that I see with the samples (UART enabled)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Beacon System Sleep between advertising events&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1705680523798v1.png" alt=" " /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;My custom FW&lt;/strong&gt; (essentially just initializes some sensors which are not present in the DK and at this point its just a connectable BLE device that just advertises every 100 msec, not much different in terms of execution than the beacon. There is no other execution that is performed at this point only BLE advertise)&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1705680972222v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;These are identical, for me it is for sure the UART.&lt;/p&gt;
&lt;p&gt;What else could cause this current curve/consumption between advertising events ( where the device does nothing else but BLE advertise)? Could it be some other peripheral that is enabled, like SPI or I2C? Any input or hint is very helpful on this, or how I could go about debugging this.&lt;/p&gt;
&lt;p&gt;Thank you very much&lt;/p&gt;
&lt;p&gt;BR&lt;/p&gt;
&lt;p&gt;Stavros&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/465070?ContentTypeID=1</link><pubDate>Fri, 19 Jan 2024 14:00:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0e77f79-6373-4aad-b557-22fc3962efb4</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Stavros,&lt;/p&gt;
&lt;p&gt;Glad to hear that it worked now.&lt;/p&gt;
[quote userid="113452" url="~/f/nordic-q-a/106874/unexpected-consumption-using-system-off-sample-nrf52840dk/465057"]Is there a way to check (e.g. from the output files like .conf or the Compiled DeviceTree Output) if a UART module is still enabled?[/quote]
&lt;p&gt;Yes, you can check the generated zephyr.dts in build/zephyr to see whether the uart1 node is enabled or not.&lt;/p&gt;
&lt;p&gt;To be sure the ~500 uA is from the UART, do you get the expected idle current if you build with CONFIG_SERIAL=n&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/465057?ContentTypeID=1</link><pubDate>Fri, 19 Jan 2024 13:26:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2586c55a-24ee-4e31-8cc6-ef23a72a723b</guid><dc:creator>clockis</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;I tested the System Off modified sample with an&amp;nbsp;&lt;span&gt;nrf52840dk_nrf52840&lt;/span&gt;.overlay file with the lines you suggested and it worked!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The consumption is now on the correct/expected levels! Thank you!&lt;/p&gt;
&lt;p&gt;Unfortunately, I am still&amp;nbsp;trying to fix this issue on my custom fw application, I have gone through all the steps of making sure to suspend the UART and disable uart1 but I am still getting this increased consumption (exactly the same current curve as when a UART peripheral is enabled) which is clearly a UART peripheral still enabled.&lt;/p&gt;
&lt;p&gt;Is there a way to check (e.g. from the output files like .conf or the Compiled DeviceTree Output) if a UART module is still enabled?&lt;/p&gt;
&lt;p&gt;Thank you and I look forward to hearing from you&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Stavros&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/464841?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2024 14:14:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d00d6d81-178f-4006-8cb5-a16478a6a87a</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Stavros,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The&amp;nbsp;main goal of attempting to build the project with a newer SDK version was to help narrow down the issue. I&amp;#39;ve just done that, and it&amp;nbsp;think I&amp;#39;ve&amp;nbsp;found the culprit; until SDK v2.4.0, the nRF52840 DK board file had the UARTE1 instance enabled by default. The PM action only disables the UARTE0 instance, which is assigned to the Zephyr console.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;Create a DT overlay (nrf52840dk_nrf52840.overlay) that disabled the UARTE1 instance:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;uart1 {
    status = &amp;quot;disabled&amp;quot;;
};&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/464829?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2024 13:44:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76619aa0-2a7e-4f97-bfba-7dfc2f85221a</guid><dc:creator>clockis</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;I have run the System Off &amp;amp; Beacon samples without any changes as I did previously and also by disabling the UART during build (CONFIG_UART=n). It is clear that the issue is the UART not being suspended, as you can see the power consumption drops to the expected values when disabled.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;System Off sample - unmodified&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1705584546991v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Zoomed in the System Sleep (System ON Idle) state&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img height="191" src="https://devzone.nordicsemi.com/resized-image/__size/638x382/__key/communityserver-discussions-components-files/4/pastedimage1705584478234v1.png_2D00_640x480.png" width="319" alt=" " /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;System Off sample - built with UART disabled (CONFIG_SERIAL=n)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1705584602127v3.png" alt=" " /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;immediately you can see the difference in the SYstem ON Idle portions of the execution.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Zoomed in the System Sleep (System ON Idle) state&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/ppk_2D00_20240115T154401_5F00_system_5F00_off_5F00_sample_5F00_SERIAL_5F00_OFF.png" alt=" " /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As you can see the System ON Idle (system Sleep) portion o f the sample has the expected values (same current curve and values as the system_on_demo.hex you provided) and significantly less power consumption. This is also observed for the beacon sample shown below.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Beacon sample - unmodified&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/ppk_2D00_20240117T125528_5F00_BEACON_5F00_SERIAL_5F00_ON.png" alt=" " /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Zoomed in the System Sleep (System ON Idle) state between the advertising events&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/ppk_2D00_20240117T125528_5F00_BEACON_5F00_2.png" alt=" " /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Beacon&amp;nbsp;sample - built with UART disabled (CONFIG_SERIAL=n)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/ppk_2D00_20240118T100022_5F00_BEACON_5F00_SERIAL_5F00_OFF.png" alt=" " /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Zoomed in the System Sleep (System ON Idle) state between the advertising events&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/ppk_2D00_20240118T100022_5F00_BEACON_5F00_SERIAL_5F00_OFF_5F00_2.png" alt=" " /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Again the power consumption is significantly less and aligns with the current values reported by the datasheet&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Now I want to find the way to disable/suspend the UART module during runtime correctly as the&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;pm_device_action_run&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;cons&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;PM_DEVICE_ACTION_SUSPEND&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;function does not seem to work properly.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;I will need to be able to do this in the current SDK version (v2.1.0) because migrating to the v2.5.1 only because I want to suspend the UART during runtime will be very time-consuming.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;So my question is how is it possible to suspend the UART correctly in the v2.1.0 version of the SDK?&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;I will try of course your suggestion but I should be able to properly suspend the UART in v2.1.0 as well unless that is a bug in the NCS which will require extensive modifications to patch. I would like to keep working with v2.1.0 unless it&amp;#39;s absolutely necessary and no other way is possible but to migrate to a newer version. Also if there is a fix I can apply to my version of NCS that would be great or if you have any alternatives o suggest.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Thank you for your support and I look forward to hearing from you!&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Best regards,&lt;/div&gt;
&lt;div&gt;Stavros&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/464813?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2024 13:08:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5f86c6e-0980-446e-ba3d-4f8a718a7dc7</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Please try to build the sample against a newer SDK version and see if you still&amp;nbsp;experience the high idle current after suspending the UART. For example, v2.5.1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/464648?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2024 15:09:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5626365a-cfcf-499a-ab2b-20d658218d06</guid><dc:creator>clockis</dc:creator><description>&lt;p&gt;The commit you mentioned removed the previous 4 states (Busy Wait 2 seconds, Busy Wait UART off 2 seconds, System Sleep, System Sleep UART off) and only put the device in System Off mode. The state I am interested in measuring the consumption for is the 4th state (System Sleep aka System ON Idle or Idle current) not the System OFF ( I do not use the System Off mode in my application at all so it totally irrelevant to me).&lt;/p&gt;
&lt;p&gt;Also I tried commenting out line 85 and I get the same current curves as the ones shown above (no change).&lt;/p&gt;
&lt;p&gt;I also tried commenting out lines 85, 83 &amp;amp; 77 but I get the same result again.&lt;/p&gt;
&lt;p&gt;I also tried commenting out lines 85, 83, 77 &amp;amp; 75 and adding the UART suspend in the beginning as shown in the code below but also got the same results as my previous post.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/*
 * Copyright (c) 2019 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;zephyr/zephyr.h&amp;gt;
#include &amp;lt;zephyr/device.h&amp;gt;
#include &amp;lt;zephyr/init.h&amp;gt;
#include &amp;lt;zephyr/pm/pm.h&amp;gt;
#include &amp;lt;zephyr/pm/device.h&amp;gt;
#include &amp;lt;zephyr/pm/policy.h&amp;gt;
#include &amp;lt;soc.h&amp;gt;
#include &amp;quot;retained.h&amp;quot;
#include &amp;lt;hal/nrf_gpio.h&amp;gt;

#define BUSY_WAIT_S 2U
#define SLEEP_S 2U

/* Prevent deep sleep (system off) from being entered on long timeouts
 * or `K_FOREVER` due to the default residency policy.
 *
 * This has to be done before anything tries to sleep, which means
 * before the threading system starts up between PRE_KERNEL_2 and
 * POST_KERNEL.  Do it at the start of PRE_KERNEL_2.
 */
static int disable_ds_1(const struct device *dev)
{
	ARG_UNUSED(dev);

	pm_policy_state_lock_get(PM_STATE_SOFT_OFF, PM_ALL_SUBSTATES);
	return 0;
}

SYS_INIT(disable_ds_1, PRE_KERNEL_2, 0);

void main(void)
{
	int rc;
	const struct device *cons = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));

	if (!device_is_ready(cons)) {
		printk(&amp;quot;%s: device not ready.\n&amp;quot;, cons-&amp;gt;name);
		return;
	}

	rc = pm_device_action_run(cons, PM_DEVICE_ACTION_SUSPEND);

	printk(&amp;quot;\n%s system off demo\n&amp;quot;, CONFIG_BOARD);

	if (IS_ENABLED(CONFIG_APP_RETENTION)) {
		bool retained_ok = retained_validate();

		/* Increment for this boot attempt and update. */
		retained.boots += 1;
		retained_update();

		printk(&amp;quot;Retained data: %s\n&amp;quot;, retained_ok ? &amp;quot;valid&amp;quot; : &amp;quot;INVALID&amp;quot;);
		printk(&amp;quot;Boot count: %u\n&amp;quot;, retained.boots);
		printk(&amp;quot;Off count: %u\n&amp;quot;, retained.off_count);
		printk(&amp;quot;Active Ticks: %&amp;quot; PRIu64 &amp;quot;\n&amp;quot;, retained.uptime_sum);
	} else {
		printk(&amp;quot;Retained data not supported\n&amp;quot;);
	}

	/* Configure to generate PORT event (wakeup) on button 1 press. */
	nrf_gpio_cfg_input(NRF_DT_GPIOS_TO_PSEL(DT_ALIAS(sw0), gpios),
			   NRF_GPIO_PIN_PULLUP);
	nrf_gpio_cfg_sense_set(NRF_DT_GPIOS_TO_PSEL(DT_ALIAS(sw0), gpios),
			       NRF_GPIO_PIN_SENSE_LOW);

	printk(&amp;quot;Busy-wait %u s\n&amp;quot;, BUSY_WAIT_S);
	k_busy_wait(BUSY_WAIT_S * USEC_PER_SEC);

	printk(&amp;quot;Busy-wait %u s with UART off\n&amp;quot;, BUSY_WAIT_S);
	// rc = pm_device_action_run(cons, PM_DEVICE_ACTION_SUSPEND);
	k_busy_wait(BUSY_WAIT_S * USEC_PER_SEC);
	// rc = pm_device_action_run(cons, PM_DEVICE_ACTION_RESUME);

	printk(&amp;quot;Sleep %u s\n&amp;quot;, SLEEP_S);
	k_sleep(K_SECONDS(SLEEP_S));

	printk(&amp;quot;Sleep %u s with UART off\n&amp;quot;, SLEEP_S);
	// rc = pm_device_action_run(cons, PM_DEVICE_ACTION_SUSPEND);
	k_sleep(K_SECONDS(SLEEP_S));
	// rc = pm_device_action_run(cons, PM_DEVICE_ACTION_RESUME);

	printk(&amp;quot;Entering system off; press BUTTON1 to restart\n&amp;quot;);

	if (IS_ENABLED(CONFIG_APP_RETENTION)) {
		/* Update the retained state */
		retained.off_count += 1;
		retained_update();
	}

	/* Above we disabled entry to deep sleep based on duration of
	 * controlled delay.  Here we need to override that, then
	 * force entry to deep sleep on any delay.
	 */
	pm_state_force(0u, &amp;amp;(struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0});

	/* Now we need to go sleep. This will let the idle thread runs and
	 * the pm subsystem will use the forced state. To confirm that the
	 * forced state is used, lets set the same timeout used previously.
	 */
	k_sleep(K_SECONDS(SLEEP_S));

	printk(&amp;quot;ERROR: System off failed\n&amp;quot;);
	while (true) {
		/* spin to avoid fall-off behavior */
	}
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nrf_5F00_system_5F00_off_5F00_uart_5F00_modified.hex"&gt;devzone.nordicsemi.com/.../nrf_5F00_system_5F00_off_5F00_uart_5F00_modified.hex&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I have included both the code and the FW image.&lt;/p&gt;
&lt;p&gt;Could you please provide a way to properly&amp;nbsp;suspend the UART and avoid the current leakage so I can properly measure the current consumption for the S&lt;strong&gt;ystem ON Idle&lt;/strong&gt; aka &lt;strong&gt;System Sleep&lt;/strong&gt; (Idle current) (no the System Off current as it is irrelevant for my application). I need to know how to properly suspend the UART this way (during runtime) as this is exactly what I need to do in my custom application ( I cannot disable it during build time using CONFIG_SERIAL=n).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/464634?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2024 14:22:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb9dabc8-b1b5-419c-b0cc-995be9111120</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I tried the &amp;#39;system OFF&amp;#39; sample just now and got similar results. The problem is that the sample does not suspend the UART before entering &amp;#39;System OFF&amp;#39;, causing the UART pin states to be retained during sleep. This leads to current leakage. I will report this as a bug internally. You can comment the&amp;nbsp;&lt;span&gt;&amp;nbsp;&amp;#39;rc = pm_device_action_run(cons, PM_DEVICE_ACTION_RESUME);&amp;#39; at line 85 for now.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: this was fixed by this commit:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/commit/2cbc452d1d0dcf9dc6bc9c6081b4bc54f6a04e89"&gt;https://github.com/nrfconnect/sdk-zephyr/commit/2cbc452d1d0dcf9dc6bc9c6081b4bc54f6a04e89&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/464624?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2024 13:59:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5539adae-8311-409c-a7ed-e6966f77a4fb</guid><dc:creator>clockis</dc:creator><description>&lt;p&gt;I used the nrf/system_off sample without any modifications. I did not set this up, it is provided with the nRF Connect SDK v2.1.0 in samples folder.&lt;/p&gt;
&lt;p&gt;I am pasting the code of the sample below (only has two files a main.c and a retained.c which is not used as the config option for this is disabled)&lt;/p&gt;
&lt;p&gt;main.c (FYI CONFIG_APP_RETENTION is disabled)&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/*
 * Copyright (c) 2019 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;zephyr/zephyr.h&amp;gt;
#include &amp;lt;zephyr/device.h&amp;gt;
#include &amp;lt;zephyr/init.h&amp;gt;
#include &amp;lt;zephyr/pm/pm.h&amp;gt;
#include &amp;lt;zephyr/pm/device.h&amp;gt;
#include &amp;lt;zephyr/pm/policy.h&amp;gt;
#include &amp;lt;soc.h&amp;gt;
#include &amp;quot;retained.h&amp;quot;
#include &amp;lt;hal/nrf_gpio.h&amp;gt;

#define BUSY_WAIT_S 2U
#define SLEEP_S 2U

/* Prevent deep sleep (system off) from being entered on long timeouts
 * or `K_FOREVER` due to the default residency policy.
 *
 * This has to be done before anything tries to sleep, which means
 * before the threading system starts up between PRE_KERNEL_2 and
 * POST_KERNEL.  Do it at the start of PRE_KERNEL_2.
 */
static int disable_ds_1(const struct device *dev)
{
	ARG_UNUSED(dev);

	pm_policy_state_lock_get(PM_STATE_SOFT_OFF, PM_ALL_SUBSTATES);
	return 0;
}

SYS_INIT(disable_ds_1, PRE_KERNEL_2, 0);

void main(void)
{
	int rc;
	const struct device *cons = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));

	if (!device_is_ready(cons)) {
		printk(&amp;quot;%s: device not ready.\n&amp;quot;, cons-&amp;gt;name);
		return;
	}

	printk(&amp;quot;\n%s system off demo\n&amp;quot;, CONFIG_BOARD);

	if (IS_ENABLED(CONFIG_APP_RETENTION)) {
		bool retained_ok = retained_validate();

		/* Increment for this boot attempt and update. */
		retained.boots += 1;
		retained_update();

		printk(&amp;quot;Retained data: %s\n&amp;quot;, retained_ok ? &amp;quot;valid&amp;quot; : &amp;quot;INVALID&amp;quot;);
		printk(&amp;quot;Boot count: %u\n&amp;quot;, retained.boots);
		printk(&amp;quot;Off count: %u\n&amp;quot;, retained.off_count);
		printk(&amp;quot;Active Ticks: %&amp;quot; PRIu64 &amp;quot;\n&amp;quot;, retained.uptime_sum);
	} else {
		printk(&amp;quot;Retained data not supported\n&amp;quot;);
	}

	/* Configure to generate PORT event (wakeup) on button 1 press. */
	nrf_gpio_cfg_input(NRF_DT_GPIOS_TO_PSEL(DT_ALIAS(sw0), gpios),
			   NRF_GPIO_PIN_PULLUP);
	nrf_gpio_cfg_sense_set(NRF_DT_GPIOS_TO_PSEL(DT_ALIAS(sw0), gpios),
			       NRF_GPIO_PIN_SENSE_LOW);

	printk(&amp;quot;Busy-wait %u s\n&amp;quot;, BUSY_WAIT_S);
	k_busy_wait(BUSY_WAIT_S * USEC_PER_SEC);

	printk(&amp;quot;Busy-wait %u s with UART off\n&amp;quot;, BUSY_WAIT_S);
	rc = pm_device_action_run(cons, PM_DEVICE_ACTION_SUSPEND);
	k_busy_wait(BUSY_WAIT_S * USEC_PER_SEC);
	rc = pm_device_action_run(cons, PM_DEVICE_ACTION_RESUME);

	printk(&amp;quot;Sleep %u s\n&amp;quot;, SLEEP_S);
	k_sleep(K_SECONDS(SLEEP_S));

	printk(&amp;quot;Sleep %u s with UART off\n&amp;quot;, SLEEP_S);
	rc = pm_device_action_run(cons, PM_DEVICE_ACTION_SUSPEND);
	k_sleep(K_SECONDS(SLEEP_S));
	rc = pm_device_action_run(cons, PM_DEVICE_ACTION_RESUME);

	printk(&amp;quot;Entering system off; press BUTTON1 to restart\n&amp;quot;);

	if (IS_ENABLED(CONFIG_APP_RETENTION)) {
		/* Update the retained state */
		retained.off_count += 1;
		retained_update();
	}

	/* Above we disabled entry to deep sleep based on duration of
	 * controlled delay.  Here we need to override that, then
	 * force entry to deep sleep on any delay.
	 */
	pm_state_force(0u, &amp;amp;(struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0});

	/* Now we need to go sleep. This will let the idle thread runs and
	 * the pm subsystem will use the forced state. To confirm that the
	 * forced state is used, lets set the same timeout used previously.
	 */
	k_sleep(K_SECONDS(SLEEP_S));

	printk(&amp;quot;ERROR: System off failed\n&amp;quot;);
	while (true) {
		/* spin to avoid fall-off behavior */
	}
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This sample can be found in&amp;nbsp;..\v2.1.0\zephyr\samples\boards\nrf\system_off&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/464623?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2024 13:56:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:63050144-3ea2-456a-a081-22dda180522c</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;How did you turn off the UART?&amp;nbsp;When UART reception is enabled in sleep mode, the HF clock remains active to allow data reception. This means the sleep current will be around .5 to 1 mA in System ON.&lt;/p&gt;
&lt;p&gt;You can disable the UART before entering sleep&amp;nbsp;using the pm_device_* APIs as shown in the code snippet I posted here:&amp;nbsp;&amp;nbsp;&lt;a class="ui-contentpeek internal-link" href="https://devzone.nordicsemi.com/f/nordic-q-a/101650/how-to-put-the-uart-to-sleep-low-power-mode/435323" data-contentid="c8fbfc01d94340cfbd117505d0138435" data-contenttypeid="f586769b0822468ab7f3a94d480ed9b0"&gt;RE: How to put the UART to sleep (low power mode)&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/464622?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2024 13:52:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:369bf328-a0f0-4e57-90c6-d7c1c6792d1d</guid><dc:creator>clockis</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;That is great news and very reassuring, still, I would like now that the measurement setup has been verified as correct to explain the current curves that I observe when measuring the System ON IDle (System Sleep) current curve using the unmodified &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.1.0/zephyr/samples/boards/nrf/system_off/README.html"&gt;nrf/system_off&lt;/a&gt; sample ( NCS v2.1.0 ).&lt;/p&gt;
&lt;p&gt;With the same verified measurement setup that we confirmed in the previous message I have measured again the current consumption for the sample.&lt;/p&gt;
&lt;p&gt;The full curve for all 5 states, of the sample, is shown below.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:275px;max-width:458px;" height="275" src="https://devzone.nordicsemi.com/resized-image/__size/916x550/__key/communityserver-discussions-components-files/4/pastedimage1705498055775v2.png" width="457" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;The state I am interested in confirming and measuring correctly is the 4th, namely the System Sleep (System ON Idle) with UART OFF, for which the current curve is shown below (zoomed in from the curve above).&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1705498308973v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;more zoomed in&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1705498329687v4.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;As you can observe the current never drops to the&amp;nbsp;typical values seen in the system_on_demo.hex you sent, and they never drop below ~100uA in contrast with the system_on_demo.hex in which I get always below ~10uA. Shouldn&amp;#39;t I get the current curve seen with system_on_demo.hex as well as the average current at least much closer than this?&lt;/p&gt;
&lt;p&gt;I am also attaching the image used which was generated by building the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.1.0/zephyr/samples/boards/nrf/system_off/README.html"&gt;nrf/system_off&lt;/a&gt; sample for the nRF52840DK (NCS 2.1.0) nrf_system_off_sample_v2.1.0.hex&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nrf_5F00_system_5F00_off_5F00_sample_5F00_v2.1.0.hex"&gt;devzone.nordicsemi.com/.../nrf_5F00_system_5F00_off_5F00_sample_5F00_v2.1.0.hex&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Could you please check this with your setup as well, because it does not make sense for the average current to be 682 uA compared to the 3.59 uA measured with the system_on_demo.hex you sent me. Also the current curve never reaches below ~100uA which also does not conform to the current curve observed with the system_on_demo.hex you sent.&lt;/p&gt;
&lt;p&gt;Thank you very much and I look forward to hearing from you.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Stavros&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/464578?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2024 11:58:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7256bf0d-2b83-4074-b00b-d802d3236401</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Stavros,&lt;/p&gt;
&lt;p&gt;Yes, this looks much better. Thank you for the update. The system ON measurement is slightly higher on your board, but it&amp;#39;s still within the expected range. This can be explained by variation in sleep current from chip to chip.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/464576?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2024 11:45:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40926d5d-6828-41c3-9487-3d748424a0fa</guid><dc:creator>clockis</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Thank you very much for your patience and support, from what I was seeing this makes sense. I desoldered the SB40. I hope the measurement setup for the nRF52840DK is now correct.&lt;/p&gt;
&lt;p&gt;Now with the correct setup, the same as yours, with the system_on_demo.hex &amp;amp; system_off_demo.hex loaded. I am getting the current curves shown below.&amp;nbsp;They look&amp;nbsp;very similar to the ones you observed. The system_on_demo seems to be exactly the same but slightly shifted higher by about 1 uA.&lt;/p&gt;
&lt;p&gt;system_off_demo.hex&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/ppk_2D00_20240115T145208_5F00_system_5F00_off_5F00_demo_5F00_CORRECT_5F00_SETUP.png" /&gt;&lt;/p&gt;
&lt;p&gt;system_on_demo.hex&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1705491189659v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;Is this expected? Are these measurements normal? Am I missing something else on my setup?&lt;/p&gt;
&lt;p&gt;Thank you and I look forward to hearing from you!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Stavros&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/464565?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2024 10:58:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3cd2cdb-3ec3-44cd-9720-b38f8c0ab6da</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Stavros,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The solder bridge (SB) must be cut when measuring current. Otherwise, the nRF52840 will be powered by the USB-to-3V buck regulator when the USB is connected. Also, with the&amp;nbsp;SB shorted, the PPK voltage applied on P22 may&amp;nbsp;be fed into other parts of the board&amp;#39;s circuitry, which should not be included in the measurement.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I recommend using a jumper, as it allows you to easily switch between current measuring mode and the regular mode.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1705489031509v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/464443?ContentTypeID=1</link><pubDate>Tue, 16 Jan 2024 15:04:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a975041-0c0c-43bf-a54e-5e7285f81d93</guid><dc:creator>clockis</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;I plugged the USB to the nRF52840DK and to my PC and I get the measurement shown below&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/ppk_2D00_20240115T145208_5F00_system_5F00_on_5F00_demo_5F00_NEW_5F00_SETUP_5F00_USB_5F00_PLUGGED.png" /&gt;&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/106874/unexpected-consumption-using-system-off-sample-nrf52840dk/464434"]Also, have you cut the solder bridge next to P22? From your picture, it appears to be shorted with solder.[/quote]
&lt;p&gt;I previously used the PPK2 in Ampere mode to measure the current so I needed to cut the SB40 (as the screenshot from the guide you posted suggests) so for this measurement I shorted it again (using solder) as the nRF52840DK would not be powered at all if I didn&amp;#39;t, is that not correct? The nRF52840DK Guide (pg. 38) also mentions this.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1705481757453v2.png" /&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Stavros&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/464434?ContentTypeID=1</link><pubDate>Tue, 16 Jan 2024 14:57:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f8554be-7859-48c3-943e-e371e39fa069</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Stavros,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I&amp;nbsp;see that the USB is not connected, please try plugging it in. Also, have you cut the solder bridge next to P22? From your picture, it appears to be shorted with solder.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1705417046565v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/464422?ContentTypeID=1</link><pubDate>Tue, 16 Jan 2024 14:34:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ee0a572-83f7-4b0f-8f86-97150740207d</guid><dc:creator>clockis</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Thank you very much for your immediate reply!&lt;/p&gt;
&lt;p&gt;I just loaded the system_on_demo.hex you sent to the nRF52840DK (using the nRF Connect Programmer app)&amp;nbsp; &amp;amp; then set up the PPK2 &amp;amp; nRF52840DK as you mentioned ( all switches in the positions you mentioned and Supply Voltage to 3.0V as in your screenshot)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/IMG_5F00_20240116_5F00_162728.jpg" alt=" " /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The current curve I got is shown below&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/ppk_2D00_20240115T145208_5F00_system_5F00_on_5F00_demo_5F00_NEW_5F00_SETUP.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;which is still very different from what you are getting. What could be the reason for this?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;
&lt;p&gt;Stavros&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unexpected consumption using System OFF Sample &amp; nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/464413?ContentTypeID=1</link><pubDate>Tue, 16 Jan 2024 14:06:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95979fa3-8cad-4ea7-a8e8-1f4a683231c0</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Stavros,&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s a picture of my setup:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1705413743849v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Where the switches are put in the following positions: SW6 - nRF ONLY , SW10 - &lt;strong&gt;OFF&lt;/strong&gt; , SW8 -&amp;nbsp;&lt;strong&gt;ON&lt;/strong&gt;&amp;nbsp;, SW9 - VDD.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Please try to replicate my setup as shown above to see if you achieve better results. It&amp;#39;s possible that your current setup is measuring more leakage. Since you are using the same hex files that I built, this should not be an issue related to the firmware configuration.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Vidar&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>