zephyr/samples/drives/adc/ sample and use of other input channel

I Dried to start on base of ADC sample and using another pin as ADC pin

i fond a tree example

 Attempting to get ADC to work 

with

zephyr,input-positive = <NRF_ADC_AIN0>; /* P0.04 */

Using ain0 it worked.

Unfortunately id didnt work  on ain2

i found out that

zephyr,input-positive = <NRF_ADC_AIN2>; /* P0.06 */

did not lead to get correct readings on ain2

May you can check  Attempting to get ADC to work if the example tree fo nRF5340-DK is correct

May it worked because the definition of

#define NRF_ADC_AIN0 BIT(0)

and

#define NRF_SAADC_AIN0     1

resulting in the same value

but

#define NRF_ADC_AIN2 BIT(2)

and

#define NRF_SAADC_AIN2     3

are different

after changein to "NRF_SAADC_AIN2"  it worked.

&adc {
    #address-cells = <1>;
    #size-cells = <0>;
    status = "okay";
    adc0@2 {
        reg = <2>;
        zephyr,gain = "ADC_GAIN_1";
        zephyr,reference = "ADC_REF_INTERNAL";
        zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
        zephyr,input-positive = <NRF_SAADC_AIN2>; /* P0.06 */
        zephyr,resolution = <12>;
    };
};
Related