<?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>PWM Device Tree</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/66794/pwm-device-tree</link><description>Hello! 
 I have the following component in my device tree: 
 
 
 I would like to retrieve the PWM device and the associated pin number (pwm1 and 0x14). I tried: 
 
 Which looks like the code I am using to retrieve a GPIO. But I get an error during compile</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 07 Oct 2020 22:00:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/66794/pwm-device-tree" /><item><title>RE: PWM Device Tree</title><link>https://devzone.nordicsemi.com/thread/273593?ContentTypeID=1</link><pubDate>Wed, 07 Oct 2020 22:00:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7919978b-d6ed-4f81-b303-dd6129ee7744</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]I would like to retrieve the PWM device and the associated pin number (pwm1 and 0x14)[/quote]
&lt;p&gt;Did you take a look at the blinky_pwm sample in Zephyr ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You can get the GPIO /&amp;nbsp;ch0-pin with:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define PWM_CHANNEL DT_PWMS_CHANNEL(PWM_LED0_NODE)&lt;/pre&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;And the PWM label with&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define PWM_LABEL   DT_PWMS_LABEL(PWM_LED0_NODE)&lt;/pre&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;where&amp;nbsp;PWM_LED0_NODE is defined like this:&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define PWM_LED0_NODE	DT_ALIAS(pwm_led0)&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>