<?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>SW PWM power consumption</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/98848/sw-pwm-power-consumption</link><description>Hi, I developed a solution using the pwm_nrf5_sw. 
 The accuracy is good enough, and I tested the power consumption using the PPK2 kit. 
 The average consumption is around 200uA, but the maximum consumption goes up to 480uA. My question here is, should</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 21 Apr 2023 12:52:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/98848/sw-pwm-power-consumption" /><item><title>RE: SW PWM power consumption</title><link>https://devzone.nordicsemi.com/thread/421761?ContentTypeID=1</link><pubDate>Fri, 21 Apr 2023 12:52:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04056973-3cd3-4272-9078-fe1f0e9eec82</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes, the current consumption seems reasonable considering you using the RTC as the clock source. Note that the current drawn by the LED is not included in the measurement when you measure on the DK as the LEDs are supplied from a different power rail.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;These lines can be omitted:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;const struct pm_state_info si = {PM_STATE_SUSPEND_TO_RAM, 0, 0};&lt;br /&gt; pm_state_force(0, &amp;amp;si);&lt;/p&gt;
&lt;p&gt;This call&amp;nbsp;will not have any effect anyway as this power state is not implemented for the nRF5x chips. The chip will enter&amp;nbsp;&lt;a title="System ON mode" href="https://infocenter.nordicsemi.com/topic/ps_nrf52833/power.html?cp=5_1_0_4_2_3#unique_637723235"&gt;System ON mode&lt;/a&gt;&amp;nbsp;when&amp;nbsp;your program returns to the idle thread.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For expected power numbers in System ON, please refer to the &amp;quot;&lt;a title="Sleep" href="https://infocenter.nordicsemi.com/topic/ps_nrf52833/_tmp/nrf52833/autodita/CURRENT/parameters.i_sleep.html?cp=5_1_0_4_1_0_0"&gt;Sleep&lt;/a&gt;&amp;quot; section in the PS.&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: SW PWM power consumption</title><link>https://devzone.nordicsemi.com/thread/421004?ContentTypeID=1</link><pubDate>Tue, 18 Apr 2023 11:31:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:413c3e9d-a3aa-4d6d-9a37-268c31276935</guid><dc:creator>ian1442</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Since I posted the original post, I managed to further optimise the consumption.&lt;/p&gt;
&lt;p&gt;But, since the consumption is so low, I assume I&amp;#39;m doing something wrong regarding the consumption measurements.&lt;br /&gt;&lt;br /&gt;So i cut the SB9, connected the board to PC (USB cable), PPK2 to PC (USB cable-&amp;gt;DATA/POWER), VOUT to P22 (the upper nRF current measurement pin), and GND to External Supply - pin.&lt;br /&gt;&lt;br /&gt;The power switch on the nRF52DK is ON.&lt;br /&gt;I set the PPK2 to Source mode, enabled power output (3V), and uploaded the program to nRF.&lt;br /&gt;The output voltage of the pin is correct, but the consumption measurements are (as I understand) unexpectedly low. Could you confirm my measurement process is fine?&lt;br /&gt;&lt;br /&gt;Here is the code:&amp;nbsp;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/pm/pm.h&amp;gt;
#include &amp;lt;zephyr/pm/policy.h&amp;gt;
#include &amp;lt;zephyr/sys/printk.h&amp;gt;
#include &amp;lt;zephyr/device.h&amp;gt;
#include &amp;lt;zephyr/drivers/pwm.h&amp;gt;

static const struct pwm_dt_spec pwm_led0 = PWM_DT_SPEC_GET(DT_ALIAS(pwm_led0));

#define NUM_STEPS	50U
#define SLEEP_MSEC	100U

void main(void)
{
	uint32_t period = PWM_HZ(32);
	uint32_t pulse_width = (uint32_t)(0.90*period);

	int ret;
	bool state = false;

	printk(&amp;quot;PWM-based LED fade\n&amp;quot;);

	if (!device_is_ready(pwm_led0.dev)) {
		printk(&amp;quot;Error: PWM device %s is not ready\n&amp;quot;,
		       pwm_led0.dev-&amp;gt;name);
		return;
	}
	ret = pwm_set_dt(&amp;amp;pwm_led0, period, pulse_width);
	if (ret) {
		printk(&amp;quot;Error %d: failed to set pulse width\n&amp;quot;, ret);
		return;
	}
	const struct pm_state_info si = {PM_STATE_SUSPEND_TO_RAM, 0, 0};
	pm_state_force(0, &amp;amp;si);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;prj.conf:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_PWM&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_PWM_NRF5_SW&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_SERIAL&lt;/span&gt;&lt;span&gt;=n&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;and nrf52dk_nrf52832.overlay&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/ {
	pwmleds {
		compatible = &amp;quot;pwm-leds&amp;quot;;
		pwm_led0: pwm_led_0 {
			pwms = &amp;lt;&amp;amp;sw_pwm 0 32 PWM_POLARITY_INVERTED&amp;gt;;
		};
	};
};

&amp;amp;sw_pwm {
	status =&amp;quot;okay&amp;quot;;
	channel-gpios = &amp;lt;&amp;amp;gpio0 13 GPIO_ACTIVE_LOW&amp;gt;,
					&amp;lt;&amp;amp;gpio0 14 GPIO_ACTIVE_LOW&amp;gt;;
	clock-prescaler = &amp;lt;0&amp;gt;;
	generator = &amp;lt; &amp;amp;rtc0&amp;gt;;
};&lt;/pre&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;The consumption levels:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&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/pastedimage1681817656489v1.png" alt=" " /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SW PWM power consumption</title><link>https://devzone.nordicsemi.com/thread/420994?ContentTypeID=1</link><pubDate>Tue, 18 Apr 2023 11:16:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c6f9632-fb37-4729-b5b1-522309e460d1</guid><dc:creator>Priyanka</dc:creator><description>&lt;p&gt;Is it possible to share the solution here so that I can try to reproduce this? Please do let me know in case you wish to set this ticket as private.&lt;/p&gt;
&lt;p&gt;-Priyanka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SW PWM power consumption</title><link>https://devzone.nordicsemi.com/thread/420993?ContentTypeID=1</link><pubDate>Tue, 18 Apr 2023 11:14:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:261429ae-8ce4-4585-98d8-0aae57f94f56</guid><dc:creator>ian1442</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It&amp;#39;s a nRF52DK board (nRF52832).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SW PWM power consumption</title><link>https://devzone.nordicsemi.com/thread/420987?ContentTypeID=1</link><pubDate>Tue, 18 Apr 2023 11:05:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:406cfdcb-5a2f-48e2-aaee-30415ffb4f04</guid><dc:creator>Priyanka</dc:creator><description>&lt;p&gt;Hi Ian,&lt;/p&gt;
&lt;p&gt;Which board are you trying this on? Is it a custom board?&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Priyanka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>