<?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>Question about the nRF Connect SDK v2.1.0 - adc example using nRF52840(PCA10056)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/92967/question-about-the-nrf-connect-sdk-v2-1-0---adc-example-using-nrf52840-pca10056</link><description>Hello, I am trying to understand the adc example using the PCA10056. 
 HI can see the following code that initializes 3 `zephyr_user` channels 
 
 
 
 
 
 In the DT file, there are two different adcs in the device tree: 
 
 
 
 
 My first question is</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 20 Oct 2022 11:49:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/92967/question-about-the-nrf-connect-sdk-v2-1-0---adc-example-using-nrf52840-pca10056" /><item><title>RE: Question about the nRF Connect SDK v2.1.0 - adc example using nRF52840(PCA10056)</title><link>https://devzone.nordicsemi.com/thread/391639?ContentTypeID=1</link><pubDate>Thu, 20 Oct 2022 11:49:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a52e8f57-3354-495c-b079-8eb74953ff86</guid><dc:creator>Simon</dc:creator><description>[quote user=""]&lt;span&gt;&lt;span&gt;My first question is: What is the difference between the `&lt;/span&gt;&lt;/span&gt;&lt;span&gt;arduino_adc` vs the `zephyr_user` ADC?&amp;nbsp;&lt;/span&gt;[/quote]
&lt;p&gt;The VS Code Extension gives a good description of &amp;quot;zephyr,user&amp;quot;:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:230px;max-width:620px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/1240x460/__key/communityserver-discussions-components-files/4/0743.pastedimage1666263906456v1.jpeg" /&gt;&lt;/p&gt;
&lt;p&gt;The zephyr,user node does not have a compatible field. This is unusual, as far as I&amp;#39;m aware,&amp;nbsp;a node will always have a compatible field. The compatible field can then be used to access the DTS node properties from a .c/.h file&lt;/p&gt;
&lt;p&gt;The&amp;nbsp;arduino_adc on the other hand has a compatible field, which is &amp;quot;arduino,uno-adc&amp;quot;. I could not find any samples in the nRF Connect SDK that used this node. Check out the arduino,uno-adc binding for an explanation of this compatible:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.1.99-ncs1/dts/bindings/adc/arduino%2Cuno-adc.yaml"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v3.1.99-ncs1/dts/bindings/adc/arduino%2Cuno-adc.yaml&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]The second question: Based on the PCA10056 pin assignment, AIN0 - AIN7 are analog input pins, if I would like to use pins other than 0, 1, and 7. How can I initialize the DT?[/quote]
&lt;p&gt;You can not use any other pins than AIN0-AIN7. Check out&amp;nbsp;&lt;a title="Pin assignments" href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/pin.html?cp=4_0_0_6_0"&gt;nRF52840 --&amp;gt; Pin assignments&lt;/a&gt;&amp;nbsp;to see what Pin number that are associated with AIN0-AIN7:&lt;/p&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;AIN0&lt;/td&gt;
&lt;td&gt;P0.04&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AIN1&lt;/td&gt;
&lt;td&gt;P0.05&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AIN2&lt;/td&gt;
&lt;td&gt;P0.06&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AIN3&lt;/td&gt;
&lt;td&gt;P0.07&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AIN4&lt;/td&gt;
&lt;td&gt;P0.25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AIN5&lt;/td&gt;
&lt;td&gt;P0.26&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AIN6&lt;/td&gt;
&lt;td&gt;P0.27&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AIN7&lt;/td&gt;
&lt;td&gt;P0.28&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;I would recommend you to read through &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/saadc.html?cp=4_0_0_5_22"&gt;nRF52840 --&amp;gt; SAADC&lt;/a&gt; (ADC), to get a better understanding of the ADC on a deeper level&lt;/p&gt;
&lt;p&gt;If you would like to use P0.28 for example, you can&amp;nbsp;modify the file \zephyr\samples\drivers\adc\boards\nrf52840dk_nrf52840.overlay accordingly:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/ {
	zephyr,user {
		io-channels = &amp;lt;&amp;amp;adc 7&amp;gt;;
	};
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You may take a look at&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/getting-started/posts/nrf-connect-sdk-tutorial---part-2-ncs-v1-4-0#h185sjwm5882m1bcimiad82dnf4kcy0b"&gt;3.5 Add the ADC peripheral&lt;/a&gt;&amp;nbsp;as well, NCS 1.5.0 is used which is a bit outdated, but the section should still be useful.&lt;/p&gt;
[quote user=""]&lt;div&gt;&lt;span&gt;The third question: Can anyone helps me understand the following properties in the node?&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;zephyr,gain;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;zephyr,reference;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;zephyr,vref-mv;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;span&gt;zephyr,acquisition-time;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;zephyr,input-positive;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;zephyr,input-negative;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;span&gt;zephyr,resolution&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;[/quote]
&lt;p&gt;These fields belongs to the compatible&amp;nbsp;&amp;quot;nordic,nrf-saadc&amp;quot;. Take a look at the associated bindings for more information:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.1.99-ncs1/dts/bindings/adc/nordic%2Cnrf-saadc.yaml"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v3.1.99-ncs1/dts/bindings/adc/nordic%2Cnrf-saadc.yaml&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;this includes the binding adc-controller.yaml, which contains a description for all these fields&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.1.99-ncs1/dts/bindings/adc/adc-controller.yaml"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v3.1.99-ncs1/dts/bindings/adc/adc-controller.yaml&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For an even more thorough description of these fields, check out&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/saadc.html?cp=4_0_0_5_22"&gt;nRF52840 --&amp;gt; SAADC&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question about the nRF Connect SDK v2.1.0 - adc example using nRF52840(PCA10056)</title><link>https://devzone.nordicsemi.com/thread/391447?ContentTypeID=1</link><pubDate>Wed, 19 Oct 2022 13:23:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e8363f7-7688-4df3-a9bd-6ca925776fe9</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll take a look at your question later today/tomorrow&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>