<?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>Getting prescalar issue when I try to run PWM example with a period of 9975ms and pulse of 25ms</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/119119/getting-prescalar-issue-when-i-try-to-run-pwm-example-with-a-period-of-9975ms-and-pulse-of-25ms</link><description>Hello, I tried the blinky_pwm example on the nrf5340 board and it has worked successfully. I am getting the error when I try to run the pwm code with some modifications Objective: To run the PWM to control the LED where the period is 9975ms and pulse</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 20 Feb 2025 11:59:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/119119/getting-prescalar-issue-when-i-try-to-run-pwm-example-with-a-period-of-9975ms-and-pulse-of-25ms" /><item><title>RE: Getting prescalar issue when I try to run PWM example with a period of 9975ms and pulse of 25ms</title><link>https://devzone.nordicsemi.com/thread/523879?ContentTypeID=1</link><pubDate>Thu, 20 Feb 2025 11:59:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1b1ee11-0ca4-47f2-842f-98cfc679dc5b</guid><dc:creator>Nathan93</dc:creator><description>&lt;p&gt;I have solved this.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;This Discussion :&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/117111/pwm-in-nrf5340---blinky-example-fails-to-compile-with-sdk-2-7-0"&gt;PWM in nrf5340 - blinky example fails to compile with SDK 2.7.0&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Mentions that the default pwm node is software emulated and has a limitation of 262ms [PERIOD]. Thus we need to use the SW_PWM node.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;The only changes required are in the overlay file&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;/ {
	pwmleds {
		compatible = &amp;quot;pwm-leds&amp;quot;;
		status = &amp;quot;okay&amp;quot;;

		red_pwm_led: red_pwm_led {
			pwms = &amp;lt;&amp;amp;sw_pwm 0 PWM_MSEC(100) PWM_POLARITY_INVERTED&amp;gt;; // This is P0.13
			label = &amp;quot;RED PWM LED&amp;quot;;
		};

		green_pwm_led: green_pwm_led {
			pwms = &amp;lt;&amp;amp;sw_pwm 1 PWM_MSEC(100) PWM_POLARITY_INVERTED&amp;gt;; // This is P0.14
			label = &amp;quot;GREEN PWM LED&amp;quot;;
		};

		blue_pwm_led: blue_pwm_led {
			pwms = &amp;lt;&amp;amp;sw_pwm 2 PWM_MSEC(100) PWM_POLARITY_INVERTED&amp;gt;; //This is P0.15
			label = &amp;quot;BLUE PWM LED&amp;quot;;
		};
	};

    aliases {
		red-pwm-led = &amp;amp;red_pwm_led;
		green-pwm-led = &amp;amp;green_pwm_led;
		blue-pwm-led = &amp;amp;blue_pwm_led;
		swpwm = &amp;amp;sw_pwm;
	};
};

&amp;amp;pwm0 {
	status = &amp;quot;okay&amp;quot;;
};

&amp;amp;sw_pwm {
	status = &amp;quot;okay&amp;quot;;
	channel-gpios = &amp;lt;&amp;amp;gpio1 15 PWM_POLARITY_INVERTED&amp;gt;,
					&amp;lt;&amp;amp;gpio1 14 PWM_POLARITY_INVERTED&amp;gt;,
					&amp;lt;&amp;amp;gpio1 13 PWM_POLARITY_INVERTED&amp;gt;;
};&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;It works as expected and the prescalar issue is no longer observed.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>