<?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>nRF52840 PWM uninit power consumption</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/53406/nrf52840-pwm-uninit-power-consumption</link><description>nRF52840 
 SDK 15.3 
 Segger Embedded Studio 
 
 
 I PWM a piezo buzzer (with a transistor) , using the PWM peripheral. The problem I encounter is that before I call the PWM function the power consumption is around 5uA, while after the PWM uninit() from</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 16 Aug 2021 15:40:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/53406/nrf52840-pwm-uninit-power-consumption" /><item><title>RE: nRF52840 PWM uninit power consumption</title><link>https://devzone.nordicsemi.com/thread/325175?ContentTypeID=1</link><pubDate>Mon, 16 Aug 2021 15:40:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16c63dc5-df2e-4d87-88e8-0a3dd30b1128</guid><dc:creator>dCSeven</dc:creator><description>&lt;p&gt;Hi, I just wanted to ask if a fix for this issue has been found already, as I&amp;#39;m seeing a similar problem with the PWM causing around 700 uA of additional current consumption in power off (averaged).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 PWM uninit power consumption</title><link>https://devzone.nordicsemi.com/thread/225379?ContentTypeID=1</link><pubDate>Fri, 13 Dec 2019 13:44:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e99c7450-89e9-496e-8cc5-0c87d9803b0a</guid><dc:creator>Radiohead</dc:creator><description>&lt;p&gt;Thanks for your reponse, but the code you provided did not work. I had tried something alike, but as I stated in earlier posts it seems to be releated to DMA. Therefore writing to the PWM registers doesn&amp;#39;t chagne anything.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve resorted to performing an ADC conversion after each PWM event to reduce the power consumption back to normal.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 PWM uninit power consumption</title><link>https://devzone.nordicsemi.com/thread/218653?ContentTypeID=1</link><pubDate>Tue, 05 Nov 2019 16:06:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fbefb9f9-366b-464b-bac5-be6d59279b48</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;In other cases of unexpectedly high peripheral power issues it sometimes pays to force a &lt;em&gt;stop&lt;/em&gt; before a disable, and offhand I don&amp;#39;t think the Nordic library code you are using forces such a stop. Try this code &lt;em&gt;before&lt;/em&gt; the disable; it might not help but simple to test:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;  NRF_PWM_Type* const pNRF_PWM = NRF_PWM0;
  if ( pNRF_PWM-&amp;gt;ENABLE == 1) )
  {
     // Stop PWM, this will initiate a EVENTS_STOPPED event (and interrupt if enabled)
     pNRF_PWM-&amp;gt;TASKS_STOP = 1;
     // Response to STOP task, emitted when PWM pulses are no longer generated
     while (pNRF_PWM-&amp;gt;EVENTS_STOPPED == 0) ;
  }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Note: If there is an interrupt handler which clears the &lt;span&gt;EVENTS_STOPPED&lt;/span&gt; then either add a flag and wait on that or just wait a few uSecs after issuing Stop before doing the uninit rather than waiting for an EVENTS_STOPPED which was cleared in an interrupt&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 PWM uninit power consumption</title><link>https://devzone.nordicsemi.com/thread/218418?ContentTypeID=1</link><pubDate>Tue, 05 Nov 2019 07:30:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad724ac3-16b0-4227-9383-add93c3bc11a</guid><dc:creator>Radiohead</dc:creator><description>&lt;p&gt;Thank you for your response and clarification Stian.&lt;/p&gt;
&lt;p&gt;I take it you haven&amp;#39;t had the time to investigate futher?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 PWM uninit power consumption</title><link>https://devzone.nordicsemi.com/thread/217563?ContentTypeID=1</link><pubDate>Wed, 30 Oct 2019 14:08:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a799669-8351-4cd6-8ec3-09cb85690268</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;Ok, I see. This was not meant as a solution, I just wanted to see if you saw the same thing. I will have to try to reproduce this with only HW register calls to see if it&amp;#39;s the driver or the HW that causes this. Will let you know how it goes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 PWM uninit power consumption</title><link>https://devzone.nordicsemi.com/thread/217543?ContentTypeID=1</link><pubDate>Wed, 30 Oct 2019 13:17:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19295e0b-3311-4c1b-8976-7fdc1a6b4e8e</guid><dc:creator>Radiohead</dc:creator><description>&lt;p&gt;I&amp;#39;ve added an nrf_delay_ms(1) after nrf_drv_pwm_simple_playback(), nrf_drv_pwm_uninit() in the handler and before going to nrf_pwr_mgmt_run(), but this does not reduce the power consumption. It seems like interrupts from other peripherals clear the condition which causes the increase in power consumption. That is however an solution I don&amp;#39;t like, as I rather solve this problem at it source.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 PWM uninit power consumption</title><link>https://devzone.nordicsemi.com/thread/217349?ContentTypeID=1</link><pubDate>Tue, 29 Oct 2019 13:54:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:85010dfc-ec88-44d8-9518-f40bee462959</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;Hi, I tried out your code here, and I can reproduce it. Not really sure what is going on. If I add a delay after nrf_drv_pwm_simple_playback() and before going to sleep, the current goes down.&lt;/p&gt;
&lt;p&gt;Can you please try to add &amp;quot;nrf_delay_ms(1);&amp;quot; after the (void)nrf_drv_pwm_simple_playback(....) line, and see what happens? (you need to include &amp;quot;nrf_delay.h&amp;quot;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 PWM uninit power consumption</title><link>https://devzone.nordicsemi.com/thread/217319?ContentTypeID=1</link><pubDate>Tue, 29 Oct 2019 12:20:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3564a02-2000-4ef8-8a91-01868219de6f</guid><dc:creator>Radiohead</dc:creator><description>&lt;p&gt;Hello Amanda,&lt;/p&gt;
&lt;p&gt;Have you heard anything from the lab yet?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 PWM uninit power consumption</title><link>https://devzone.nordicsemi.com/thread/216297?ContentTypeID=1</link><pubDate>Wed, 23 Oct 2019 08:15:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18366ca9-33be-449f-8beb-3aadd0383035</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div&gt;I will have to check in the lab and see if there is something wrong with the PWM hardware on the chip, or if the library is doing something wrong. I will be back when I have the update.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;-Amanda H.&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 PWM uninit power consumption</title><link>https://devzone.nordicsemi.com/thread/216088?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2019 08:54:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90b923c5-40cc-42b5-8ff1-32dbbfc621dc</guid><dc:creator>Radiohead</dc:creator><description>&lt;p&gt;Hello Amanda,&lt;/p&gt;
&lt;p&gt;I test with a release build in which the logging is fully disabled. I can go down to 1.1uA in OFF_MODE and ~5uA in Sleep. So the logging doesn&amp;#39;t consume power in this case as that would apply a static current consumption of a few hundred microamps. The increased power consumption only starts after I enable the PWM module in the bsp event from a button event or an apptimer.&lt;/p&gt;
&lt;p&gt;However, I have the ADC measuring every 10 seconds currently according to this low power example.&lt;/p&gt;
&lt;p&gt;&lt;a title="nRF52 Low power SAADC example" href="https://devzone.nordicsemi.com/f/nordic-q-a/23867/nrf52-best-practise-for-ultra-low-power-saadc-4-channel-conversion#post-id-164115" rel="noopener noreferrer" target="_blank"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/23867/nrf52-best-practise-for-ultra-low-power-saadc-4-channel-conversion#post-id-164115&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In which much like to how I use the PWM0 module, the SAADC is initialized before a sample is taken and disabled after the sample is taken. However, the saadc_uninit seems to be able to disable the DMA after completion whereas the PWM unit can&amp;#39;t. From a measurement with the nRF power profiler I can clearly see the interval of the SAADC on which it samples. After each sample the increased power consumption caused by the PWM seems to be removed.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/ADCinterval.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;It might be a little difficult to see, but the highlighted area is the sample interval of the SAADC. Ever 10 seconds it takes a sample. In the highligted area you see&amp;nbsp; the boost converter being enabled first at the first and highest current peak. After that follow four beeps of the buzzer with some off-time. The current consumption is then around&amp;nbsp; a few hundred microamps until the ADC samples after which the current consumption goes back to the expected 5uA.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t see any other PWM peripherals active and the logging is disabled, so I assume it&amp;#39;s the DMA current that causes the increased power consumption. The SAADC example I linked to has the same issue, but works around it by disabling and initing the peripheral only when it&amp;#39;s needed. I&amp;#39;ve tried this approach for the PWM0 module, including disabling the IRQ and clearing the registers in the event handler, but the increased power consumption still persists.&lt;/p&gt;
&lt;p&gt;The link you provided does not specify how to disable the PWM peripheral properly. I would expect the&amp;nbsp;nrf_drv_pwm_uninit function would do so, which I already use.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 PWM uninit power consumption</title><link>https://devzone.nordicsemi.com/thread/215913?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2019 12:04:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3313bfd4-f71d-4ddd-85a6-2be4c67911f0</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]The problem I encounter is that before I call the PWM function the power consumption is around 5uA, while after the PWM uninit() from the PWM event handler, the power consumption has increased to ~660uA.[/quote]
&lt;p&gt;It looks strange. W&lt;span&gt;hen the device is using PWM&lt;/span&gt;, the power will consume a&lt;span&gt;round 500-1000 uA depending on frequency and load&lt;/span&gt;&amp;nbsp;normally.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Do you also turn off logging, NRF_LOG_ENABLED in sdk_config.h?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The nrf_drv_pwm library has a couple of debug outputs using &amp;quot;NRF_LOG_INFO&amp;quot;, and if your sdk_config.h has the defines &amp;quot;NRF_LOG_BACKEND_SERIAL_USES_UART&amp;quot; and &amp;quot;NRF_LOG_ENABLED&amp;quot; set to &amp;#39;1&amp;#39;, it may try to start up the serial interface, which will draw power.&lt;/p&gt;
&lt;p&gt;If you place a breakpoint after the nrf_drv_pwm_uninit call and look at the different peripheral registers in the debug overview (especially PWMx and UARTE0), are you able to see any peripheral still active that should ideally not be?&lt;/p&gt;
&lt;p&gt;Also, see this &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/40912/pwm-power-consumption-nrf52840"&gt;post&lt;/a&gt;.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>