ADC reading all the channels value even if 1 channel is setup

I am following the tutorial on Nordic Dev Academy I have a nrf7002dk board and I flashed the code present here. The problem is even if I configure only one channel and I connect input to P0.05, P0.06, P0.07, P0.25, P0.26 I am getting the readings. The output shall only be displayed when I connect the input to P0.04. Need help regarding the same

Parents
  • It's not clear what you want and what you observe. Can you share the .config and zephyr.dts from the build folder?

    Kenneth

  • Hi Kenneth,

    I am using this code https://github.com/NordicDeveloperAcademy/ncs-inter/tree/main/l6/l6_e1_sol as it is without any modification. The issue I am facing is as below:

    I want to read ADC value on pin P0.04. When I connect the ADC pin to 3v3 I get some fair readings that is as expected, but the issue is when I connect the same 3v3 to pin P0.05 or P0.06 I am still getting the same readings which should not happen.

    Simple scenario upload above code to nrf7002dk connect 3v3 to pin P0.04 it should work. Connect 3v3 to P0.05 you should not get any readings as P0.05 is not yet configured but I am getting the reading at that time as well.

    Build folder dts file

    7343.zephyr.dts

    My overlay file is as below

    /*
     * SPDX-License-Identifier: Apache-2.0
     *
     * Copyright (c) 2022 Nordic Semiconductor ASA
     */
    
    
    / {
    	zephyr,user {
    		io-channels = <&adc 0>;
    	};
    };
    
    &adc {
    	#address-cells = <1>;
    	#size-cells = <0>;
    	status = "okay";
    	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_AIN0>; /* P0.02 for nRF52xx, P0.04 for nRF53xx */
    		zephyr,resolution = <12>;
    	};
    };

    prj.conf

    #
    # Copyright (c) 2024 Nordic Semiconductor
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    CONFIG_LOG=y
    # STEP 1 - Enable the ADC API and driver
    CONFIG_ADC=y

Reply
  • Hi Kenneth,

    I am using this code https://github.com/NordicDeveloperAcademy/ncs-inter/tree/main/l6/l6_e1_sol as it is without any modification. The issue I am facing is as below:

    I want to read ADC value on pin P0.04. When I connect the ADC pin to 3v3 I get some fair readings that is as expected, but the issue is when I connect the same 3v3 to pin P0.05 or P0.06 I am still getting the same readings which should not happen.

    Simple scenario upload above code to nrf7002dk connect 3v3 to pin P0.04 it should work. Connect 3v3 to P0.05 you should not get any readings as P0.05 is not yet configured but I am getting the reading at that time as well.

    Build folder dts file

    7343.zephyr.dts

    My overlay file is as below

    /*
     * SPDX-License-Identifier: Apache-2.0
     *
     * Copyright (c) 2022 Nordic Semiconductor ASA
     */
    
    
    / {
    	zephyr,user {
    		io-channels = <&adc 0>;
    	};
    };
    
    &adc {
    	#address-cells = <1>;
    	#size-cells = <0>;
    	status = "okay";
    	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_AIN0>; /* P0.02 for nRF52xx, P0.04 for nRF53xx */
    		zephyr,resolution = <12>;
    	};
    };

    prj.conf

    #
    # Copyright (c) 2024 Nordic Semiconductor
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    CONFIG_LOG=y
    # STEP 1 - Enable the ADC API and driver
    CONFIG_ADC=y

Children
Related