<?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>nRF52832 System ON Run modes of consumption</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/94784/nrf52832-system-on-run-modes-of-consumption</link><description>Hello, 
 I am working in a project using the nRF52832 SoC, on the nRF5_SDK_17.1.0, using the Softdevice S132 and working over the SES IDE. For managing the consumption I have seen some cases related tonthe System On and System Off options using Softdevice</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 13 Dec 2022 07:59:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/94784/nrf52832-system-on-run-modes-of-consumption" /><item><title>RE: nRF52832 System ON Run modes of consumption</title><link>https://devzone.nordicsemi.com/thread/400296?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2022 07:59:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ae41006-c0ed-4010-8510-3b7ed1cd3c0c</guid><dc:creator>jinvers</dc:creator><description>&lt;p&gt;Ok. Thank you. I&amp;#39;ll look for them.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Joel&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 System ON Run modes of consumption</title><link>https://devzone.nordicsemi.com/thread/400295?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2022 07:57:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42663286-67de-4277-8eec-cbc8f270e902</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;In the nRF5 SDK there is no automatic disabling of peripherals like you have in the nRF Connect SDK, so you will have to manage that yourself. This is not complicated though, it basically involves stopping UART, SAADC, SPIM or any other peripherals you may be using when they are not needed, and then starting them again. Most of the drivers will have API functions for that. Exactly what they are called differs from different drivers, but you should see terms like &amp;quot;stop&amp;quot;, &amp;quot;uninit&amp;quot; or &amp;quot;disable&amp;quot;. See for instance &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/19284/turn-off-uart-on-nrf52832/74740"&gt;this old post &lt;/a&gt;with regard to UART.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 System ON Run modes of consumption</title><link>https://devzone.nordicsemi.com/thread/400292?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2022 07:49:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b41edd1-b4c7-4028-afba-f8178e25def6</guid><dc:creator>jinvers</dc:creator><description>&lt;p&gt;Thanks for your explanation.&lt;/p&gt;
&lt;p&gt;So, please may you share some link where I could see the function calls to disable and reenable the peripherals when needed? I am using nRF5_SDK_17.1.0 ans SES IDE.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 System ON Run modes of consumption</title><link>https://devzone.nordicsemi.com/thread/400291?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2022 07:44:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b15d8b8b-c10b-4b24-ad11-b1ec2d6885b6</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Joel,&lt;/p&gt;
&lt;p&gt;The&amp;nbsp;PMU block essentially just enables clocks and regulators when some peripherals need the HFCLK or some specific voltages. It does not switch between HFXO and HFINT (the internal high frequency RC), and it does not control the LFCLK (which is normally started at startup and runs continiously. Essentially you don&amp;#39;t have to think about it, just remember that if you have any peripherals that need the HFCLK running, it will run.&lt;/p&gt;
&lt;p&gt;This brings us to the next point about peripherals. These are not automatically controlled, so to achieve low power, you must disable peripherals that is not currently needed. (For a HW perspective at least, if using the nRF Connect SDK there is a power management system I&amp;nbsp;mentioned in my initial reply which assists with this in som cases). But generally, it is up to your application to stop everything that is not needed. If for instance UART is active, the HF clock will be running, and the device will be consuming a&amp;nbsp;significant amount of power even if the CPU is sleeping.&lt;/p&gt;
&lt;p&gt;PS:&amp;nbsp;Regarding system off mode, that is useful in some special cases, but in this case the LFCLK is also stopped and you only have a few selected wakeup sources. Also, wakeup is also in form of a reset. The &amp;quot;normal&amp;quot; sleep mode which is often the only sleep mode used, and in virtually all products the main sleep mode, is system ON sleep mode. Here you can have more wakeup sources and the LFCLK is typically running.&lt;/p&gt;
&lt;p&gt;For a Bluetooth application&amp;nbsp;where the SoftDevice keeps the LFCLK and RTC0 running in system ON mode, you&amp;nbsp;can get a sleep current of a few micro amps (see &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/pmu.html?cp=4_2_0_16_0#unique_1667566419"&gt;Current consumption scenarios&lt;/a&gt;).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 System ON Run modes of consumption</title><link>https://devzone.nordicsemi.com/thread/400287?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2022 07:29:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:035a3cd5-c48e-44e5-abbb-e1b10f5d0aa5</guid><dc:creator>jinvers</dc:creator><description>&lt;p&gt;Ok Einar. I understand that all this control then is automaticaly made by the PMU block inside the nRF52832 and little things can be done except using SoftDevice as calling to sd_app_evt_main() for System ON Wait or sd_power_system_off(). &lt;/p&gt;
&lt;p&gt;Or is it any specific order or function call to disable and renable a peripheral in runtime?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Joel&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 System ON Run modes of consumption</title><link>https://devzone.nordicsemi.com/thread/400282?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2022 06:34:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be92639e-d487-4337-8d7e-82bde11b1585</guid><dc:creator>Einar Thorsrud</dc:creator><description>[quote user="jinvers"]Excuse me if I have not explained well. The board has not an onboard 32.768KHz crystal.[/quote]
&lt;p&gt;I understand, that is why I explained how to configure an LFRC. And the mentionning of no need to dynamically switch was as a comment to why this is done&amp;nbsp;build&amp;nbsp;time as you did not like that (I don&amp;#39;t see any reason this should be runtime).&lt;/p&gt;
[quote user="jinvers"]The question, then, is how (in execution time) is it possible to disable the HFCLK to use the LFRC and just th other way round.[/quote]
&lt;p&gt;As mentioned, the CPU always needs the HFCLK while running. When the CPU is sleeping (which is after a __WFE() or __WFI() instruction, typically after calling sd_app_evt_wait() when using a SoftDevice), and no other peripherals are requesting the HFCLK, this is disabled. The SoftDevice always keeps the LFCLK and RTC0 running for time keeping. RTC1 is also typically used by the app_timer library. You can see how this is done in any Bluetooth example in the SDK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 System ON Run modes of consumption</title><link>https://devzone.nordicsemi.com/thread/400208?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2022 15:45:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ce1e51a-8510-43b1-a42c-cc15d159e15b</guid><dc:creator>jinvers</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;Excuse me if I have not explained well. The board has not an onboard 32.768KHz crystal. The question, then, is how (in execution time) is it possible to disable the HFCLK to use the LFRC and just th other way round.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Joel&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 System ON Run modes of consumption</title><link>https://devzone.nordicsemi.com/thread/400204?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2022 15:18:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:281c0fa3-ffc6-45f6-804b-ef2899326ec8</guid><dc:creator>Einar Thorsrud</dc:creator><description>[quote user="jinvers"]So definitely I cannot stop the main HFCLK using external 32MHz crystal. Is this correct?[/quote]
&lt;p&gt;No. The CPU will always need a 64 kHz clock &lt;em&gt;while running&lt;/em&gt; (meaning when not in sleep), but that can be generated from either HFINT (RC) or HFXO (the latter is needed when an accurate clock is needed, like when using the radio). Switching between the two oscillators is seemless. And when the clock is not needed (like when the CPU and other peripherals that runs of the HF clock is sleeping or disabled), the HFCLK (regardless of source) can be disabled.&lt;/p&gt;
[quote user="jinvers"]Using the sdk_config.h implies make the selection in the design phase and not in the execution phase.[/quote]
&lt;p&gt;Yes. I cannot think of any real world use cases where you would want to ever use LFRC if your board has an onboard 32.768 kHz crystal.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 System ON Run modes of consumption</title><link>https://devzone.nordicsemi.com/thread/400194?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2022 14:58:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a126f0e8-9d6f-4512-a4de-759ac036f28f</guid><dc:creator>jinvers</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/94784/nrf52832-system-on-run-modes-of-consumption/400189"]That is not supported on the nRF5 devices. On the nRF52 series the high frequency clock is always 64 MHz. However, this clock only runs when needed. The only clock that always runs is the 32.768 kHz clock. The paradigm used for power optimization in the nRF devices is &amp;quot;&lt;a href="https://en.wikichip.org/wiki/race-to-sleep"&gt;race to idle&lt;/a&gt;&amp;quot;.[/quote]
&lt;p&gt;So definitely I cannot stop the main HFCLK using external 32MHz crystal. Is this correct?&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/94784/nrf52832-system-on-run-modes-of-consumption/400189"]You don&amp;#39;t normally switch. If you have a 32.768 kHz crystal you always use that. If not, you use the RC. As you use the SoftDevice this is part of the SoftDevice configuration, and you adjust sdk_config.h as explained in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/67478/nrf52840-examples-with-lfrc-and-calibration/276416"&gt;this post&lt;/a&gt;.[/quote]
&lt;p&gt;Using the sdk_config.h implies make the selection in the design phase and not in the execution phase. &lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/94784/nrf52832-system-on-run-modes-of-consumption/400189"]I think you misunderstood how this works. sd_app_evt_wait waits indefinitel[/quote]
&lt;p&gt;I have understood it well. Considering your other answers, I see that the options are very limited.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Joel&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 System ON Run modes of consumption</title><link>https://devzone.nordicsemi.com/thread/400189?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2022 14:42:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c1d3bd7-8bdb-49b3-8581-1b5a7c8d65e1</guid><dc:creator>Einar Thorsrud</dc:creator><description>[quote user="jinvers"]- Usually in other microcontrollers the total consumption may be reduced by dividing the clock that use the CPU and the peripherals, although the main crystal oscillator could be running. Are there no instructions for this, then?[/quote]
&lt;p&gt;That is not supported on the nRF5 devices. On the nRF52 series the high frequency clock is always 64 MHz. However, this clock only runs when needed. The only clock that always runs is the 32.768 kHz clock. The paradigm used for power optimization in the nRF devices is &amp;quot;&lt;a href="https://en.wikichip.org/wiki/race-to-sleep"&gt;race to idle&lt;/a&gt;&amp;quot;.&lt;/p&gt;
[quote user="jinvers"]- What are the function calls or instructions to switch between the internal 32.768KHz LFRC oscillator and the HFCLK?[/quote]
&lt;p&gt;You don&amp;#39;t normally switch. If you have a 32.768 kHz crystal you always use that. If not, you use the RC. As you use the SoftDevice this is part of the SoftDevice configuration, and you adjust sdk_config.h as explained in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/67478/nrf52840-examples-with-lfrc-and-calibration/276416"&gt;this post&lt;/a&gt;.&lt;/p&gt;
[quote user="jinvers"]I have seen this functions in other cases and I will be able to use it probably in a part of the code. But there will be other cases in the machine state of the application wher I cannot enter into a wait state. In these last cases (in fact, the more usual) where I would try to reduce the consumption by reducing the oscillator frequency or switching to tha LFRC oscillator.[/quote]
&lt;p&gt;I think you misunderstood how this works. sd_app_evt_wait waits indefinitely, and most applications only include this in a single place, which is in your application main loop. The way this then works is that whenever the device wakes up on an interrupt, the main loop runs after the interrupts are processed, and then all other calls in the main loop is run once until calling&amp;nbsp;sd_app_evt_wait(). This way the CPU sleeps when not in use instead of spending CPU cycles doing nothing. You can see this being used in virtually all SDK examples.&lt;/p&gt;
&lt;p&gt;Also, the CPU can never run of the LFRC. Only a few selected low power peripherals use the LFRC, most notably the RTC, which is used to keep basic track of time for when to wake up. For instance, when in a BLE connection, the RTC is used to wake up the device before every advertising event, connection event, and so on.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 System ON Run modes of consumption</title><link>https://devzone.nordicsemi.com/thread/400181?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2022 14:27:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4928ae52-153e-4042-a1fe-29cf23e17f8b</guid><dc:creator>jinvers</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;Thank you for your answer.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using the nRF52832 SoC over nRF5_SDK_17.1.0 and the SES IDE.&lt;/p&gt;
[quote user="eith"]No, that is not possible. However, the nRF will normally use the HFINT which is an high frequency RC oscillator when there is no need for a highly accurate clock.[/quote]
&lt;p&gt;- Usually in other microcontrollers the total consumption may be reduced by dividing the clock that use the CPU and the peripherals, although the main crystal oscillator could be running. Are there no instructions for this, then?&lt;/p&gt;
&lt;p&gt;- What are the function calls or instructions to switch between the internal 32.768KHz LFRC oscillator and the HFCLK?&lt;/p&gt;
&lt;p&gt;-&lt;/p&gt;
[quote user="eith"]If using the nRF5 SDK, the main thread of the examples will typicall enter system ON low power mode in the main loop by calling sd_app_evt_wait(), via the power management library[/quote]
&lt;p&gt;I have seen this functions in other cases and I will be able to use it probably in a part of the code. But there will be other cases in the machine state of the application wher I cannot enter into a wait state. In these last cases (in fact, the more usual) where I would try to reduce the consumption by reducing the oscillator frequency or switching to tha LFRC oscillator. &lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Joel&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 System ON Run modes of consumption</title><link>https://devzone.nordicsemi.com/thread/400180?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2022 13:10:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49e41aa0-89dd-45ec-8930-10bc16518096</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Joel,&lt;/p&gt;
[quote user=""]Run mode using the external 32MHz crystal (I have no one external 32KHz crystal).[/quote]
&lt;p&gt;You can never achieve low power if the 32 MHz clock is running all the time. However, that is no concern, as the nRF has an internal 32.768 kHz low frequency RC (LFRC) oscillator that will be used when there is no 32.768 kHz crystal.&lt;/p&gt;
[quote user=""]- Modifying the HFCLK clock frequency dinamically while the BLE module would not be needed.[/quote]
&lt;p&gt;No, that is not possible. However, the nRF will normally use the HFINT which is an high frequency RC oscillator when there is no need for a highly accurate clock. Whenever an accurate HF clock is needed, the HFXO will be started (this is for instance always when using the radio).&lt;/p&gt;
[quote user=""]- Deactivating and reenabling dinamically internal peripherals.[/quote]
&lt;p&gt;This is a key point. The details are different depending on which SDK you are using, but in any case the CPU will normally enter a low power system ON sleep mode whenever there is nothing to do. In this case, the RTC0 is running and will wake the CPU when it is time. However, other peripherals and resources must be disabled so that they do not consume power (for instance, if the UART is kept active, it will request the HF clock, causing a high current consumption even if the CPU is sleeping).&lt;/p&gt;
&lt;p&gt;If you use the nRF Connect SDK you may find &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/app_power_opt.html"&gt;Power optimization&lt;/a&gt;&amp;nbsp;and &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/services/pm/index.html"&gt;Power Management&lt;/a&gt;&amp;nbsp;relevant. If using the nRF5 SDK, the main thread of the examples will typicall enter system ON low power mode in the main loop by calling sd_app_evt_wait(), via the power management library. This will wait for event, typically from RTC0, or any other application interrupt.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>