Question about the nRF Connect SDK v2.1.0 - adc example using nRF52840(PCA10056)

Hello, I am trying to understand the adc example using the PCA10056. 

HI can see the following code that initializes 3 `zephyr_user` channels

#if !DT_NODE_EXISTS(DT_PATH(zephyr_user)) || \
	!DT_NODE_HAS_PROP(DT_PATH(zephyr_user), io_channels)
#error "No suitable devicetree overlay specified"
#endif

#define DT_SPEC_AND_COMMA(node_id, prop, idx) \
	ADC_DT_SPEC_GET_BY_IDX(node_id, idx),

/* Data of ADC io-channels specified in devicetree. */
static const struct adc_dt_spec adc_channels[] = {
	DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), io_channels,
	DT_SPEC_AND_COMMA)
	};
In the DT file, there are two different adcs in the device tree:
arduino_adc: analog-connector {
                compatible = "arduino,uno-adc";
                #io-channel-cells = <1>;
                io-channel-map = <0 &adc 1>,
                                 <1 &adc 2>,
                                 <2 &adc 4>,
                                 <3 &adc 5>,
                                 <4 &adc 6>,
                                 <5 &adc 7>;
        };

        zephyr,user {
                io-channels = <&adc 0>, <&adc 1>, <&adc 7>;
        };
My first question is: What is the difference between the `arduino_adc` vs the `zephyr_user` ADC? 
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?
For the `zephyr_user` adcs, I can see a node with the following properties
adc: adc@40007000 {
                        compatible = "nordic,nrf-saadc";
                        reg = <0x40007000 0x1000>;
                        interrupts = <7 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                        #io-channel-cells = <1>;
                        #address-cells = <1>;
                        #size-cells = <0>;
                        channel@0 {
                                reg = <0>;
                                zephyr,gain = "ADC_GAIN_1_6";
                                zephyr,reference = "ADC_REF_INTERNAL";
                                zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
                                zephyr,input-positive = <NRF_SAADC_AIN1>;
                                zephyr,resolution = <12>;
                        };

                        channel@1 {
                                reg = <1>;
                                zephyr,gain = "ADC_GAIN_1_6";
                                zephyr,reference = "ADC_REF_INTERNAL";
                                zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
                                zephyr,input-positive = <NRF_SAADC_VDD>;
                                zephyr,resolution = <14>;
                                zephyr,oversampling = <8>;
                        };

                        channel@7 {
                                reg = <7>;
                                zephyr,gain = "ADC_GAIN_1_5";
                                zephyr,reference = "ADC_REF_VDD_1_4";
                                zephyr,vref-mv = <750>;
                                zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
                                zephyr,input-positive = <NRF_SAADC_AIN6>;
                                zephyr,input-negative = <NRF_SAADC_AIN7>;
                                zephyr,resolution = <12>;
                        };

                };

The third question: Can anyone helps me understand the following properties in the node?
zephyr,gain;
zephyr,reference;
zephyr,vref-mv;
zephyr,acquisition-time;
zephyr,input-positive;
zephyr,input-negative;
zephyr,resolution;
Last question: After I checked the pin assignment, it seems there is no analog out. I am wondering why is that or maybe I missed something.
Thanks
Parents Reply Children
No Data
Related