<?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>LED PWM</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/108123/led-pwm</link><description>How many PWM channels I can define such as the following for nRF52832? 
 pwmleds { compatible = &amp;quot;pwm-leds&amp;quot;; pwm_led0: pwm_led_0 { pwms = &amp;lt;&amp;amp;pwm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED&amp;gt;; }; 
 }; 
 in DTSI file I will have corresponding pwm_default and pwm_sleep</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 15 Feb 2024 10:06:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/108123/led-pwm" /><item><title>RE: LED PWM</title><link>https://devzone.nordicsemi.com/thread/468975?ContentTypeID=1</link><pubDate>Thu, 15 Feb 2024 10:06:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8fc9483-7019-4b2a-a297-7463059d64f4</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hi Umesh, and sorry about the delay.&lt;/p&gt;
[quote user="umeshdj"]Same frequency is required for all six channels[/quote]
&lt;p&gt;That makes it easier.&lt;/p&gt;
&lt;p&gt;Have a look at this dts overlay file. Here I am enabling pwm1, and adding GPIO 22 and 23. Note that&amp;nbsp;pwm_led_4 uses channel 1.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;// To get started, press Ctrl+Space to bring up the completion menu and view the available nodes.

// You can also use the buttons in the sidebar to perform actions on nodes.
// Actions currently available include:

// * Enabling / disabling the node
// * Adding the bus to a bus
// * Removing the node
// * Connecting ADC channels

// For more help, browse the DeviceTree documentation at https://docs.zephyrproject.org/latest/guides/dts/index.html
// You can also visit the nRF DeviceTree extension documentation at https://nrfconnect.github.io/vscode-nrf-connect/devicetree/nrfdevicetree.html
// To get started, press Ctrl+Space to bring up the completion menu and view the available nodes.

// You can also use the buttons in the sidebar to perform actions on nodes.
// Actions currently available include:

// * Enabling / disabling the node
// * Adding the bus to a bus
// * Removing the node
// * Connecting ADC channels

// For more help, browse the DeviceTree documentation at https://docs.zephyrproject.org/latest/guides/dts/index.html
// You can also visit the nRF DeviceTree extension documentation at https://nrfconnect.github.io/vscode-nrf-connect/devicetree/nrfdevicetree.html
&amp;amp;pinctrl {
    pwm0_default: pwm0_default {
		group1 {
			psels = &amp;lt;NRF_PSEL(PWM_OUT0, 0, 17)&amp;gt;,
                    &amp;lt;NRF_PSEL(PWM_OUT1, 0, 18)&amp;gt;,
                    &amp;lt;NRF_PSEL(PWM_OUT2, 0, 19)&amp;gt;,
                    &amp;lt;NRF_PSEL(PWM_OUT3, 0, 20)&amp;gt;;


			nordic,invert;
		};
	};

	pwm0_sleep: pwm0_sleep {
		group1 {
			psels = &amp;lt;NRF_PSEL(PWM_OUT0, 0, 17)&amp;gt;,
                    &amp;lt;NRF_PSEL(PWM_OUT1, 0, 18)&amp;gt;,
                    &amp;lt;NRF_PSEL(PWM_OUT2, 0, 19)&amp;gt;,
                    &amp;lt;NRF_PSEL(PWM_OUT3, 0, 20)&amp;gt;;

			low-power-enable;
		};
	};
	pwm1_default: pwm1_default {
		group1 {
			psels = 
					//for additional module
					&amp;lt;NRF_PSEL(PWM_OUT1, 0, 22)&amp;gt;,
					&amp;lt;NRF_PSEL(PWM_OUT2, 0, 23)&amp;gt;;

			nordic,invert;
		};
	};

	pwm1_sleep: pwm1_sleep {
		group1 {
			psels = 
					//for additional module
					&amp;lt;NRF_PSEL(PWM_OUT1, 0, 22)&amp;gt;,
					&amp;lt;NRF_PSEL(PWM_OUT2, 0, 23)&amp;gt;;
			low-power-enable;
		};
	};
};
&amp;amp;pwm1 {
	status = &amp;quot;okay&amp;quot;;
	pinctrl-0 = &amp;lt;&amp;amp;pwm1_default&amp;gt;;
	pinctrl-1 = &amp;lt;&amp;amp;pwm1_sleep&amp;gt;;
	pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;
};

/{
	pwmleds {
		compatible = &amp;quot;pwm-leds&amp;quot;;
		pwm_led0: pwm_led_0 {
			pwms = &amp;lt;&amp;amp;pwm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED&amp;gt;;
		};
        pwm_led1: pwm_led_1 {
			pwms = &amp;lt;&amp;amp;pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED&amp;gt;;
		};
        pwm_led2: pwm_led_2 {
			pwms = &amp;lt;&amp;amp;pwm0 2 PWM_MSEC(20) PWM_POLARITY_INVERTED&amp;gt;;
		};
        pwm_led3: pwm_led_3 {
			pwms = &amp;lt;&amp;amp;pwm0 3 PWM_MSEC(20) PWM_POLARITY_INVERTED&amp;gt;;
		};
		

		pwm_led4: pwm_led_4 {
			pwms = &amp;lt;&amp;amp;pwm1 1 PWM_MSEC(20) PWM_POLARITY_INVERTED&amp;gt;;
		};
		pwm_led5: pwm_led_5 {
			pwms = &amp;lt;&amp;amp;pwm1 2 PWM_MSEC(20) PWM_POLARITY_INVERTED&amp;gt;;
		};
        
		status = &amp;quot;okay&amp;quot;;
		
	};
};
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I just tried this overlay along with the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.5.2/zephyr/samples/drivers/led_pwm/README.html"&gt;zephyr led pwm sample&lt;/a&gt; and got 6 leds to use pwm on the 52dk.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LED PWM</title><link>https://devzone.nordicsemi.com/thread/468741?ContentTypeID=1</link><pubDate>Wed, 14 Feb 2024 07:13:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eae87dce-320b-4dc7-b8e7-0621ae7e73fe</guid><dc:creator>umeshdj</dc:creator><description>&lt;p&gt;Hello Elfving&lt;/p&gt;
&lt;p&gt;I need 6 PWMs for driving LEDs with the same frequency.&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Umesh&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LED PWM</title><link>https://devzone.nordicsemi.com/thread/468148?ContentTypeID=1</link><pubDate>Fri, 09 Feb 2024 00:42:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29947703-30e0-4b32-83fe-678b702966df</guid><dc:creator>umeshdj</dc:creator><description>&lt;p&gt;Same frequency is required for all six channels&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LED PWM</title><link>https://devzone.nordicsemi.com/thread/468134?ContentTypeID=1</link><pubDate>Thu, 08 Feb 2024 19:26:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:705b0bac-5723-4138-9c9d-111fca038fdb</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/pwm.html#concept_pzc_1pw_nr"&gt;The nRF52832 comes with 3 PWM modules with 4 channels&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So you can get a total of 12 PWM channels, that can drive 12 assigned GPIOs. Though you only have independent frequency control in these 3 PWM modules.&lt;/p&gt;
&lt;p&gt;So driving 6 PWM LEDs is possible, the question is how you want to do it. Do any particular ones need a different frequency?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>