<?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>Devicetree overlay for simple GPIO</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95059/devicetree-overlay-for-simple-gpio</link><description>It seems like there are lots of questions regarding simple GPIOs and devicetree, but I can&amp;#39;t quite find something that describes my problem: 
 
 I am using the nrf52840dk, and I successfully created an overlay file to read/write to an I2C device, but</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 28 Dec 2022 10:05:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95059/devicetree-overlay-for-simple-gpio" /><item><title>RE: Devicetree overlay for simple GPIO</title><link>https://devzone.nordicsemi.com/thread/402401?ContentTypeID=1</link><pubDate>Wed, 28 Dec 2022 10:05:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95803042-b847-4bd6-9024-3762b743f1ca</guid><dc:creator>Menon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Glad to hear it worked.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind Regards,&lt;/p&gt;
&lt;p&gt;Abhijith&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Devicetree overlay for simple GPIO</title><link>https://devzone.nordicsemi.com/thread/402184?ContentTypeID=1</link><pubDate>Tue, 27 Dec 2022 02:36:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42aae853-bfd0-4eb4-84c3-0c17c842e3cc</guid><dc:creator>Lorozco</dc:creator><description>&lt;p&gt;Just to close this out - your link above helped me figure out my issue (which was due to my unfamiliarity with devicetree syntax!)&lt;br /&gt;&lt;br /&gt;To add new nodes, the correct syntax is&amp;nbsp;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;pre class="ui-code" data-mode="text"&gt;/{
SampleSignals
    {
     compatible = &amp;quot;gpio-keys&amp;quot;;
      input_signal1: input_signal1
      {
         gpios = &amp;lt;&amp;amp;gpio0 2 GPIO_ACTIVE_HIGH&amp;gt;;
          label = &amp;quot;Name your GPIO Signal&amp;quot;;
        };
    };
};&lt;/pre&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;However, if you are overriding something like an i2c bus, then no &amp;#39;root&amp;#39;&amp;nbsp; syntax is required:&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;i2c0
{
    new_i2c_device0: i2c_device@30
    {
        compatible = &amp;quot;i2c-device&amp;quot;;
        reg = &amp;lt; 0x30 &amp;gt;;
        label = &amp;quot;First new I2C device&amp;quot;;
    };
};&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Adding the two snippets above to an .overlay file works and does not require modifying the original .dts file in the sdk directories.&lt;br /&gt;&lt;br /&gt;Thanks again for the help!&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Devicetree overlay for simple GPIO</title><link>https://devzone.nordicsemi.com/thread/401927?ContentTypeID=1</link><pubDate>Thu, 22 Dec 2022 12:54:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af9e2a50-307e-4c5e-a840-5d6df5c15b3b</guid><dc:creator>Menon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Thank you for clarifying your issue.&lt;/p&gt;
&lt;p&gt;But I think this has been discussed in various other tickets. For eg: Look at &lt;a href="https://devzone.nordicsemi.com/support-private/support/266184"&gt;this ticket &lt;/a&gt;from my colleague there he shows how to add this in overlay file.&lt;/p&gt;
&lt;p&gt;Let me know if this not what you are looking for. Please expect a delay after this response as I will be away for Christmas vacation and whole Devzone is working understaffed.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind Regards,&lt;/p&gt;
&lt;p&gt;Abhijith&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Devicetree overlay for simple GPIO</title><link>https://devzone.nordicsemi.com/thread/401810?ContentTypeID=1</link><pubDate>Wed, 21 Dec 2022 22:41:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54a5afdd-aa08-4e39-926c-1da75918908f</guid><dc:creator>Lorozco</dc:creator><description>&lt;p&gt;Also, just to be clear, if I add&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;&lt;span&gt;sample_gpio_signals&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;&lt;span&gt;{&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; compatible = &amp;quot;gpio-keys&amp;quot;;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; columnswitchint: column_switch_input&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gpios = &amp;lt;&amp;amp;gpio0 2 GPIO_ACTIVE_LOW&amp;gt;;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; label = &amp;quot;Column Switch Interrupt Signal&amp;quot;;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; };&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;span&gt;};&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;To the .dts file (and not the overlay file), the project builds and works just fine.&amp;nbsp; My concern with this&amp;nbsp;is that now I&amp;#39;ve modified a file that is not in my project directory and I can&amp;#39;t easily commit it to my repository.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Devicetree overlay for simple GPIO</title><link>https://devzone.nordicsemi.com/thread/401806?ContentTypeID=1</link><pubDate>Wed, 21 Dec 2022 22:00:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:80decdbf-7012-4abc-b680-a68ad22f3dd6</guid><dc:creator>Lorozco</dc:creator><description>&lt;p&gt;Actually, if you can just point me to an example that toggles a GPIO pin on the&amp;nbsp;&lt;span&gt;nrf52840dk&lt;/span&gt; that is NOT one of the on-board LEDs, that will probably be enough to get me pointed in the right direction.&lt;/p&gt;
&lt;p&gt;Ideally the example should use a .overlay file (and not modify the original .dts file).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Devicetree overlay for simple GPIO</title><link>https://devzone.nordicsemi.com/thread/401779?ContentTypeID=1</link><pubDate>Wed, 21 Dec 2022 16:16:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:906f37da-7ad8-43d3-b492-71cacecc6094</guid><dc:creator>Lorozco</dc:creator><description>&lt;p&gt;Hi Abhijith,&lt;/p&gt;
&lt;p&gt;I understand what you&amp;#39;re saying, but the &amp;quot;&lt;strong&gt;gpio-keys&lt;/strong&gt;&amp;quot; binding I am trying to use is already present at&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ncs\v2.1.2\zephyr\dts\bindings\gpio&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The&amp;nbsp;file nrf52840dk_nrf52840.dts generated by the blinky example uses&amp;nbsp;the &amp;#39;&lt;strong&gt;gpio-keys&lt;/strong&gt;&amp;#39; binding with no issues, so why can&amp;#39;t I use it as well on my .overlay file?&lt;/p&gt;
&lt;p&gt;Also, if I am going to create my own binding files (which I&amp;#39;ve tried and not been successful yet), I would like to create them in my own application directory (and not in the ncs\xx\xx structure) so that I can commit them to my repository with the rest of my project files, but this is a separate topic. For now, I just want to be able to use the &amp;#39;&lt;strong&gt;gpio-keys&lt;/strong&gt;&amp;#39; binding in my overlay file (or any other binding in&amp;nbsp;the&amp;nbsp;&lt;strong&gt;ncs\v2.1.2\zephyr\dts\bindings&lt;/strong&gt; for that matter&lt;strong&gt;).&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Devicetree overlay for simple GPIO</title><link>https://devzone.nordicsemi.com/thread/401773?ContentTypeID=1</link><pubDate>Wed, 21 Dec 2022 15:40:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b95e2ab4-010e-40c7-9f3a-e95ee986861c</guid><dc:creator>Menon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I think the issue is with the compatible section here. AFAIK, the system always looks for the matching binding file and for this compatible properties are used. Take a look at&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/build/dts/bindings.html#dt-bindings"&gt; this page&lt;/a&gt; which explains more on this. I think you need to create a binding file inside&amp;nbsp;ncs\v2.x.x\nrf\dts\bindings and then add this to your dts node.&lt;br /&gt;Creating binding file is explained&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/build/dts/bindings.html#id6"&gt; here&lt;/a&gt;. Something like below need to be created. Each section inside the yaml file is described &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/build/dts/bindings.html#dt-bindings-file-syntax:~:text=The%20following%20sections%20describe%20these%20keys%20in%20more%20detail%3A"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;.&lt;pre class="ui-code" data-mode="text"&gt;description: GPIO test

compatible: &amp;quot;xyz,test&amp;quot;

include: base.yaml

properties:
  status:
    required: true

  gpios:
    type: phandle-array
    required: true
    description: |
      GPIO to use as testpin.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Try adding this to your dts node. Something like below&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;xyz: test {
	compatible = &amp;quot;xyz,test&amp;quot;;
	gpios = &amp;lt;&amp;amp;gpio0 29 GPIO_ACTIVE_HIGH&amp;gt;;
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I am not completely sure on this as I haven&amp;#39;t tried this before. Give it a shot and let me know.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind Regards,&lt;/p&gt;
&lt;p&gt;Abhijith&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Devicetree overlay for simple GPIO</title><link>https://devzone.nordicsemi.com/thread/401613?ContentTypeID=1</link><pubDate>Wed, 21 Dec 2022 00:09:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88684f37-fcc2-45bb-ae3c-e29e5685d859</guid><dc:creator>Lorozco</dc:creator><description>&lt;p&gt;..and I apologize in advance for the terrible formatting!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>