<?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>Adding additional pins to PWM channel</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/96175/adding-additional-pins-to-pwm-channel</link><description>I&amp;#39;m trying to add addtional pins as PWM signals in my application. I&amp;#39;ve followed the process shown here , but I&amp;#39;m getting a bunch of build errors. 
 This is my overlay file: 
 
 With just that, I can get my code to build without errors. 
 But the moment</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 10 Feb 2023 17:41:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/96175/adding-additional-pins-to-pwm-channel" /><item><title>RE: Adding additional pins to PWM channel</title><link>https://devzone.nordicsemi.com/thread/409411?ContentTypeID=1</link><pubDate>Fri, 10 Feb 2023 17:41:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d06d202a-8236-4a64-889f-8dfdc88561fb</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;That is an overlay file for nRF52840dongle. The PWM0 pin assigned is here&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/main/boards/arm/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840-pinctrl.dtsi#L59-L75"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/main/boards/arm/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840-pinctrl.dtsi#L59-L75&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding additional pins to PWM channel</title><link>https://devzone.nordicsemi.com/thread/409242?ContentTypeID=1</link><pubDate>Thu, 09 Feb 2023 21:10:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46fe3753-d13d-4994-81f1-3e138495f75c</guid><dc:creator>Mike Austin (LPI)</dc:creator><description>&lt;p&gt;Thanks Amanda.&lt;/p&gt;
&lt;p&gt;So, just to clarify my understanding:&lt;/p&gt;
&lt;p&gt;With&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/87aae96b6c76c3522f2abfc82058b99cc94632cb/applications/nrf_desktop/configuration/nrf52840dongle_nrf52840/app.overlay#L13-L23"&gt;this overlay file&lt;/a&gt;&amp;nbsp;you have pwmleds assigned to PWM0, and then red_pwm_led, green_pwm_led and blue_pwm_led are assigned to channels 0, 1 and 2 respectively of PWM0.&amp;nbsp; There is then a second instance, pwmleds1, that is assigned to PWM1, and which has pwm_led1 assigned to channel 0.&lt;/p&gt;
&lt;p&gt;I can see that PWM1 has been allocated to Pin 6, and PWM0 has been allocated to the standard PWM0 pin for the nRF52840DK, but what I don&amp;#39;t understand is how do you allocate different channels to a pin?&amp;nbsp; Or do all the channels drive the same GPIO?&amp;nbsp; For example, where is the definition that says which pin red_pwm_led, green_pwm_led and blue_pwm_led connect to?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding additional pins to PWM channel</title><link>https://devzone.nordicsemi.com/thread/407634?ContentTypeID=1</link><pubDate>Wed, 01 Feb 2023 17:42:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:063631b7-370c-478e-9384-e24046f02525</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
[quote user="Mike Austin (LPI)"]If I read the specs for the nRF52832 correctly, there are 3 PWM instances (PWM0, PWM1 and PWM2) available, and then the option for up to 4 channels per instance.[/quote]
&lt;p&gt;That&amp;#39;s correct and it&amp;#39;s the answer to the first question.&amp;nbsp;&lt;/p&gt;
[quote user="Mike Austin (LPI)"]I want to try and understand how to access different channels in the same instance, compared to, say, channel 0 in different instances.[/quote]
&lt;p&gt;It depends on the&amp;nbsp;&lt;code&gt;&lt;span&gt;pwms&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;property of &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/build/dts/bindings.html#child-binding"&gt;pwmleds&lt;/a&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;. See &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/87aae96b6c76c3522f2abfc82058b99cc94632cb/applications/nrf_desktop/configuration/nrf52840dongle_nrf52840/app.overlay#L13-L23"&gt;this overlay&lt;/a&gt; and &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/c70f6efebef9f1077aeb52f1c13569ebc2de5b87/samples/caf/boards/nrf52840dk_nrf52840.overlay#L6-L39"&gt;this overlay&lt;/a&gt;.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;The following are the PWM examples in the NCS:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/samples/basic/blinky_pwm/README.html"&gt;&lt;span&gt;PWM&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;Blinky&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/samples/basic/rgb_led/README.html"&gt;PWM: RGB LED&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;-Amanda H.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding additional pins to PWM channel</title><link>https://devzone.nordicsemi.com/thread/407460?ContentTypeID=1</link><pubDate>Wed, 01 Feb 2023 06:29:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4de7f47a-ac19-4846-bb3f-f7bf297ebe21</guid><dc:creator>Mike Austin (LPI)</dc:creator><description>&lt;p&gt;Thanks Amanda.&lt;/p&gt;
&lt;p&gt;One other thing I can&amp;#39;t quite understand, nor find any clear explanation of, is the difference between:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;PWM instance&lt;/li&gt;
&lt;li&gt;PWM channel&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;And what you can and can&amp;#39;t do with either.&lt;/p&gt;
&lt;p&gt;If I read the specs for the nRF52832 correctly, there are 3 PWM instances (PWM0, PWM1 and PWM2) available, and then the option for up to 4 channels per instance.&lt;/p&gt;
&lt;p&gt;And then I want to try and understand how to access different channels in the same instance, compared to, say, channel 0 in different instances.&lt;/p&gt;
&lt;p&gt;Are there any examples, or explanations, available online that would help me understand how the PWM stuff all works?&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding additional pins to PWM channel</title><link>https://devzone.nordicsemi.com/thread/407419?ContentTypeID=1</link><pubDate>Tue, 31 Jan 2023 17:35:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4acc42b0-7391-40fa-a501-95aa2c61a33e</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Try to add&amp;nbsp;aliases into overlay file for the DT_ALIAS()&lt;span&gt;&amp;nbsp;function:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    aliases {
		pwm-led0 = &amp;amp;pwm_led0;
        pwm-led1 = &amp;amp;pwm_led1;

	};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So the&amp;nbsp;&lt;span&gt;overlay file would look like this:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;pinctrl {
    pwm0_custom: pwm0_custom {
        group1 {
            psels = &amp;lt;NRF_PSEL(PWM_OUT0, 0, 22)&amp;gt;,
                    &amp;lt;NRF_PSEL(PWM_OUT1, 0, 23)&amp;gt;;
            nordic,invert;
        };
    };

    pwm0_csleep: pwm0_csleep {
        group1 {
            psels = &amp;lt;NRF_PSEL(PWM_OUT0, 0, 22)&amp;gt;,
                    &amp;lt;NRF_PSEL(PWM_OUT1, 0, 23)&amp;gt;;
            low-power-enable;
        };
    }; 
};

&amp;amp;pwm0 {
    status = &amp;quot;okay&amp;quot;;
    pinctrl-0 = &amp;lt;&amp;amp;pwm0_custom&amp;gt;;
    pinctrl-1 = &amp;lt;&amp;amp;pwm0_csleep&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(1) PWM_POLARITY_NORMAL&amp;gt;;
        };
        pwm_led1: pwm_led_1 {
            pwms = &amp;lt;&amp;amp;pwm0 1 PWM_USEC(100) PWM_POLARITY_NORMAL&amp;gt;;
        };
    };

    aliases {
		pwm-led0 = &amp;amp;pwm_led0;
        pwm-led1 = &amp;amp;pwm_led1;

	};
};&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards,&lt;br /&gt;Amanda H.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>