<?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>ADC_DT_SPEC_GET doesn&amp;#39;t work for DT nodes other than /zephyr,user</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/103583/adc_dt_spec_get-doesn-t-work-for-dt-nodes-other-than-zephyr-user</link><description>I&amp;#39;m using SDK v2.4.2 and trying to measure the voltage on the AIN0 pin of the nRF9160 SoC. The relevant code from my device tree source is as follows: 
 
 In the C source code, I created an adc_dt_spec structure as follows: 
 
 For some reason, this results</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 21 Sep 2023 11:19:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/103583/adc_dt_spec_get-doesn-t-work-for-dt-nodes-other-than-zephyr-user" /><item><title>RE: ADC_DT_SPEC_GET doesn't work for DT nodes other than /zephyr,user</title><link>https://devzone.nordicsemi.com/thread/447037?ContentTypeID=1</link><pubDate>Thu, 21 Sep 2023 11:19:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9787f77c-49ae-41d0-b4d6-1bac6da60236</guid><dc:creator>Kenneth Goveas</dc:creator><description>&lt;p&gt;Hi Naeem,&lt;/p&gt;
&lt;p&gt;Ah, so every node mandatorily needs a compatible. This I did not know. Now that solves the problem. I just defined another DT binding as follows,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;description: |
    Analog input channel.

compatible: analog-input

include: base.yaml

properties:
    io-channels:
        type: phandle-array
        required: true&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and wrote my device tree node compatible with this binding,&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/ {
    batt {
        compatible = &amp;quot;analog-input&amp;quot;;
        io-channels = &amp;lt;&amp;amp;adc 0&amp;gt;;
    };
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and now everything works just as I expect it to.&lt;/p&gt;
&lt;p&gt;Thanks a lot for your help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC_DT_SPEC_GET doesn't work for DT nodes other than /zephyr,user</title><link>https://devzone.nordicsemi.com/thread/446225?ContentTypeID=1</link><pubDate>Fri, 15 Sep 2023 10:33:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:827c1844-1f25-44f5-90e4-d00624da8d0d</guid><dc:creator>Naeem Maroof</dc:creator><description>&lt;p&gt;Hi Kenneth,&lt;/p&gt;
&lt;p&gt;I get what you are saying, and I can see that the ADC_DT_SPEC_GET_BY_IDX does not require &amp;quot;voltage-divider&amp;quot; compatibility.&lt;/p&gt;
&lt;p&gt;However, when I try to&amp;nbsp; define a node in the overlay, it immediately informs me that &amp;quot;compatible&amp;quot; is required property for a node.&lt;/p&gt;
&lt;p&gt;(more info here:&amp;nbsp;&lt;a href="https://academy.nordicsemi.com/courses/nrf-connect-sdk-fundamentals/lessons/lesson-2-reading-buttons-and-controlling-leds/topic/devicetree/#:~:text=Every%20devicetree%20node%20must%20have,definition%20in%20the%20devicetree%20binding."&gt;DTS Bindings&lt;/a&gt;&amp;nbsp;and &lt;a href="https://docs.zephyrproject.org/latest/build/dts/bindings-intro.html#:~:text=Devicetree%20nodes%20are%20matched%20to%20bindings%20using%20their%20compatible%20properties."&gt;Devicetree Bindings&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1694773676670v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;And accordingly, the compatible will also enforce other properties, for example &amp;quot;output-ohms&amp;quot; is required property for &amp;quot;voltage-divider&amp;quot; compatible node.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC_DT_SPEC_GET doesn't work for DT nodes other than /zephyr,user</title><link>https://devzone.nordicsemi.com/thread/446128?ContentTypeID=1</link><pubDate>Thu, 14 Sep 2023 17:06:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:945067eb-d67e-4096-9a9e-10135324ee47</guid><dc:creator>Kenneth Goveas</dc:creator><description>&lt;p&gt;Hi Naeem,&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;Thanks for your response. However, the&amp;nbsp;Readme you mentioned is specific to the battery measurement sample. If you look into its C source code, it specifically&amp;nbsp;looks for either &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;/vbatt&lt;/span&gt; or &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;/zephyr,user&lt;/span&gt; which is why the devicetree nodes must be named as such. In my source code, I use &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;/batt&lt;/span&gt; to initialize the &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;struct adc_dt_spec&lt;/span&gt; like this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;static struct adc_dt_spec _batt_spec = ADC_DT_SPEC_GET(DT_PATH(batt));&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;For this to work, the devicetree node should indeed be &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;/batt&lt;/span&gt; and not &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;/vbatt&lt;/span&gt; or &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;/zephyr,user&lt;/span&gt;. Now, the weird thing is that this works if I define &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;/batt&lt;/span&gt; with the &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;quot;voltage-divider&amp;quot;&lt;/span&gt; compatible but not without it. According to Zephyr&amp;#39;s documentation on&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.4.2/zephyr/hardware/peripherals/adc.html#c.ADC_DT_SPEC_GET"&gt;ADC_DT_SPEC_GET&lt;/a&gt; and&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.4.2/zephyr/hardware/peripherals/adc.html#c.ADC_DT_SPEC_GET_BY_IDX"&gt;ADC_DT_SPEC_GET_BY_IDX&lt;/a&gt;, it should not be necessary to use the &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;quot;voltage-divider&amp;quot;&lt;/span&gt; compatible. Simply defining the node with the &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;io-channels&lt;/span&gt; property should suffice.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC_DT_SPEC_GET doesn't work for DT nodes other than /zephyr,user</title><link>https://devzone.nordicsemi.com/thread/445137?ContentTypeID=1</link><pubDate>Fri, 08 Sep 2023 12:37:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:67a7eb9b-6496-484a-b1a1-fe7e697b7467</guid><dc:creator>Naeem Maroof</dc:creator><description>&lt;p&gt;Hello Kenneth,&lt;/p&gt;
&lt;p&gt;As per &lt;a href="https://github.com/zephyrproject-rtos/zephyr/blob/main//samples/boards/nrf/battery/README.rst"&gt;Battery Measurement Readme&lt;/a&gt;, either the board devicetree should have a /vbatt node with &amp;quot;voltage-divider&amp;quot; compatible or the ADC config needs to be provided via zephyr,user node.&lt;/p&gt;
&lt;p&gt;Compatible is required property for voltage divider node.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1694176610271v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;BR, Naeem&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>