Pin Assignment Overwrite for adc

I want to read data from 8 channels of ADC, when configuring all channels it shows that some of the pins are pre-occupied by other nodes. i have applied different things to resolve this issue including these  GPIO overlays  Can't override pin assignment in .overlay , but an error occurred, kindly tell me how should i resolve this issue. 

This is my Overlay file:

/ {
    pinctrl: pin-controller{
        /delete-node/ &uart0_default;
        /delete-node/ &uart0_sleep;
    };
    
    zephyr,user {
		io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 3>, <&adc 4>, <&adc 5>, <&adc 6>,  <&adc 7>;
	};
};

&adc {
	#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_AIN0>; /* P0.03 */
		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_AIN1>; /* P0.03 */
		zephyr,resolution = <12>;
	};
    channel@2 {
		reg = <2>;
		zephyr,gain = "ADC_GAIN_1_6";
		zephyr,reference = "ADC_REF_INTERNAL";
		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
		zephyr,input-positive = <NRF_SAADC_AIN2>; /* P0.03 */
		zephyr,resolution = <12>;
	};
    channel@3 {
		reg = <3>;
		zephyr,gain = "ADC_GAIN_1_6";
		zephyr,reference = "ADC_REF_INTERNAL";
		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
		zephyr,input-positive = <NRF_SAADC_AIN3>; /* P0.03 */
		zephyr,resolution = <12>;
	};
    channel@4 {
		reg = <4>;
		zephyr,gain = "ADC_GAIN_1_6";
		zephyr,reference = "ADC_REF_INTERNAL";
		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
		zephyr,input-positive = <NRF_SAADC_AIN4>; /* P0.03 */
		zephyr,resolution = <12>;
	};
    channel@5 {
		reg = <5>;
		zephyr,gain = "ADC_GAIN_1_6";
		zephyr,reference = "ADC_REF_INTERNAL";
		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
		zephyr,input-positive = <NRF_SAADC_AIN5>; /* P0.03 */
		zephyr,resolution = <12>;
	};channel@6 {
		reg = <6>;
		zephyr,gain = "ADC_GAIN_1_6";
		zephyr,reference = "ADC_REF_INTERNAL";
		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
		zephyr,input-positive = <NRF_SAADC_AIN6>; /* P0.03 */
		zephyr,resolution = <12>;
	};
    channel@7 {
		reg = <7>;
		zephyr,gain = "ADC_GAIN_1_6";
		zephyr,reference = "ADC_REF_INTERNAL";
		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
		zephyr,input-positive = <NRF_SAADC_AIN7>; /* P0.03 */
		zephyr,resolution = <12>;
	};
};

This the error thrown:

Problem window:

Before adding delete node uart0-default and sleep, Pin 5 was also shown in the problem as preoccupied.

Parents Reply Children
  • Ok, I see. I believe the issue is that what you are trying to delete is a property, and not a node. So either you can delete the uart0 node:

    / {
        pinctrl: pin-controller{
            /delete-node/ uart0;
        };
        
        zephyr,user {
    		io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 3>, <&adc 4>, <&adc 5>, <&adc 6>,  <&adc 7>;
    	};
    };

    Or you can delete the uart0_default and uart0_sleep properties:

    / {
        pinctrl: pin-controller{
            /delete-property/ uart0_default;
            /delete-property/ uart0_sleep;
        };
        
        zephyr,user {
    		io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 3>, <&adc 4>, <&adc 5>, <&adc 6>,  <&adc 7>;
    	};
    };

    Also note that I removed the '&' before "uart0" in all cases.

    When doing these changes, it builds here.

    Best regards,

    Edvin

  • I have tried it, it do not through any build error but there are some overlapping and unknown node problems in the problem window. can you please help me how to resolve this?....or does this cause any issue in communication?

       

  • I don't trust the "Problems" tab in VS Code, as this doesn't necessarily pick up all the configurations for the project. Does the build log mention any errors? Does the log when running the application mention any errors? Does it work with all 8 channels?

    BR,

    Edvin

Related