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
  • Hello,

    There is a sample found in:

    ncs\zephyr\samples\drivers\adc\

    that is set up pretty much like you did here. I can't spot any immediate errors from what you have included here (other than the build log, of course), but does this sample work if you try to build it? Remember to copy the nrf52840dk_nrf52840.overlay file found in adc\boards and name it nrf52dk_nrf52832.overlay.

    If you are still stuck, can you please .zip and upload your application folder here?

    Best regards,

    Edvin

  • Yes, I am using the same sample. I had also copied the nrf52840 overlay file for nrf52832. 

    adc_ble.zip

  • 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

Reply
  • 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

Children
Related