<?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>Defining IO pin in zephyr</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/118045/defining-io-pin-in-zephyr</link><description>I am trying to define a simple output pin. 
 in the DTS file I have: 
 
 aliases { 
 ledred = &amp;amp;hwledred; 
 ledgreen = &amp;amp;hwledgreen; 
 memwp = &amp;amp;hwmemwp; 
 }; 
 
 soc { 
 gpio0: gpio@50000000 { 
 status = &amp;quot;okay&amp;quot;; 
 }; 
 }; 
 
 chosen { 
 zephyr,sram = &amp;amp;sram0;</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 23 Jan 2025 13:47:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/118045/defining-io-pin-in-zephyr" /><item><title>RE: Defining IO pin in zephyr</title><link>https://devzone.nordicsemi.com/thread/519784?ContentTypeID=1</link><pubDate>Thu, 23 Jan 2025 13:47:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b1652969-1ca3-44bc-8cda-b38834b0adcb</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Apologies for the response time.&lt;/p&gt;
[quote user="cmag"]I have found direct pin control samples in Internet, [/quote]
&lt;p&gt;Could you share a link to this sample? You might be missing some configurations if there&amp;#39;s a mismatch between the sample and the SDK version you&amp;#39;re using&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Defining IO pin in zephyr</title><link>https://devzone.nordicsemi.com/thread/518443?ContentTypeID=1</link><pubDate>Wed, 15 Jan 2025 13:20:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5523fdaf-0fb9-47a0-bbfd-6fc742f0f0be</guid><dc:creator>cmag</dc:creator><description>&lt;p&gt;For the red LEDs I have:&lt;br /&gt;hwledred linked to &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;ledred&lt;/strong&gt; &lt;/span&gt;and referenced in C as:&lt;/p&gt;
&lt;p&gt;#define LED_RED_NODE DT_ALIAS(&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;ledred&lt;/strong&gt;&lt;/span&gt;)&lt;br /&gt;static const struct gpio_dt_spec ledRed = GPIO_DT_SPEC_GET(LED_RED_NODE, gpios);&lt;/p&gt;
&lt;p&gt;I expected that the analogous for WP should be:&lt;br /&gt;hwmemwp linked to &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;memwp&lt;/strong&gt; &lt;/span&gt;and referenced in C as:&lt;/p&gt;
&lt;p&gt;#define WP DT_ALIAS(&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;memwp&lt;/strong&gt;&lt;/span&gt;)&lt;br /&gt;const struct gpio_dt_spec memWP = GPIO_DT_SPEC_GET_OR(WP, gpios, {0});&lt;/p&gt;
&lt;p&gt;Should work in the same way.&lt;br /&gt;But I am obviously missing something.&lt;br /&gt;I have found direct pin control samples in Internet, but when I try them I get a long chain of errors concerning macros calling more macros.&lt;br /&gt;For this I am asking of a simple example of a DTS defining a pin and the C file referencing it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Defining IO pin in zephyr</title><link>https://devzone.nordicsemi.com/thread/518439?ContentTypeID=1</link><pubDate>Wed, 15 Jan 2025 13:01:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:006597d1-4f45-4963-b578-0f156b36233a</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;In the zephyr,user node you&amp;#39;ve written &amp;quot;mew_wp&amp;quot;. Shouldn&amp;#39;t this also be&amp;nbsp;&lt;span&gt;mem_wp or memwp depending on the alias you decided to use??&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Have you defined this device binding somewhere? I can&amp;#39;t see the device binding for any memwp within the SDK&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kind regards,&lt;br /&gt;Andreas&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>