<?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>NRF52 Getting Peripheral Power Status</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/97583/nrf52-getting-peripheral-power-status</link><description>I am trying to optimize power consumption on our product which utilizes the NRF52840. I have found many great posts with recommendations to shut down UARTs, debug logging and so on. However, I am looking for ways to see what peripherals my project is</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 13 Mar 2023 14:59:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/97583/nrf52-getting-peripheral-power-status" /><item><title>RE: NRF52 Getting Peripheral Power Status</title><link>https://devzone.nordicsemi.com/thread/414967?ContentTypeID=1</link><pubDate>Mon, 13 Mar 2023 14:59:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3a8a8d2-2921-4d6e-9126-b43880c9e31d</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]However, I am looking for ways to see what peripherals my project is using and enabling in the background.[/quote]
&lt;p&gt;The easiest way to do this is to enter debug mode and check the ENABLE/status registers of each peripheral that is in-use in your firmware.&lt;/p&gt;
&lt;p&gt;This should tell you which are currently enabled.&lt;/p&gt;
[quote user=""]&lt;p&gt;In Zephyr I am aware of the following configuration files which affect which peripherals are being enabled.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;prj.conf&amp;nbsp; -- to level project configuration with &amp;quot;my&amp;quot; changes&lt;/li&gt;
&lt;li&gt;build/.config&amp;nbsp; -- Generated during build listing every flag&lt;/li&gt;
&lt;li&gt;device tree -- Device tree defining hardware, such as nrf52840.dts&lt;/li&gt;&lt;/ul&gt;[/quote]
&lt;p&gt;prj.conf gives the settings specific to your application, while build-folder/zephyr/.config gives the full configuration, including the defconfig&amp;#39;s that is chosen for your specific $BOARD.&lt;/p&gt;
&lt;p&gt;Device tree is similar; boards/$BOARD.overlay gives specific overlays for your application; but the build-folder/zephyr/zephyr.dts provides the whole DTS based on the current build-configuration.&lt;/p&gt;
&lt;p&gt;This is explained more detailed in our dev academy:&amp;nbsp;&lt;a href="https://academy.nordicsemi.com/topic/devicetree/"&gt;https://academy.nordicsemi.com/topic/devicetree/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]The Power Management Unit (PMU) is responsible for shutting down clocks and peripherals to save power. I have found some registers that indicate if the LDO or DC/DC converter is running, but am having trouble tracking much more down. Is there any way to extract information about what is active and in which state from this peripheral? Is there a driver available that I can to read this info out?[/quote]
&lt;p&gt;Your chosen power mode is set upon boot, ie. if you run on DCDC or LDO.&lt;/p&gt;
&lt;p&gt;If you run on DCDC, this will be handled by the hardware itself, based on the amount of current drawn in the system as a whole. This is because DCDC&amp;#39;s is not efficient to use in lower uA areas.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;DCDC is enabled in the POWER.DCDCEN (and .DCDCEN0 for nRF52840) register.&lt;/p&gt;
[quote user=""]&lt;p&gt;Is there any consistent method or set of registers across all the peripherals that software can use to read if each peripheral is on/off/sleeping etc? For example, is there some place I can read if the clock to each peripheral is enabled?&lt;/p&gt;
&lt;p&gt;The system RAM is broken down into a large number of blocks and it seems they can be configured to retain state at different sleep/power states. How do I change this configuration? Is there a way to read out the state/configuration of each block?&lt;/p&gt;
&lt;p&gt;Are there any other config files, peripherals or modules I can use to extract information on what is powered up in my device?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;The clocking is automated in hardware based on what peripherals are active. I would recommend that you check the registers of the bus peripherals in debug mode to see what is enabled or not.&lt;/p&gt;
&lt;p&gt;The previously mentioned build-folder/zephyr/zephyr.dts will also show which devices are enabled in your current build (search for status = &amp;quot;okay&amp;quot;)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;RAM usage in sys off / sys on mode can be set using the nrf_power.h api. Here&amp;#39;s an example that shows this usage:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/tree/v3.2.99-ncs2/samples/boards/nrf/system_off"&gt;https://github.com/nrfconnect/sdk-zephyr/tree/v3.2.99-ncs2/samples/boards/nrf/system_off&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>